Commit 59c376ad authored by tianbo's avatar tianbo

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

# Conflicts: # amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
parents b3dab61c 06ad7844
......@@ -18,7 +18,8 @@ public enum WorkFlowEnum {
GROUPNAME("groupName","角色组的key"),
NAME("name","任务节点的key"),
PROCESSINSTANCEID("processInstanceId",""),
ASSIGN("assignee","角色执行人key");
ASSIGN("assignee","角色执行人key"),
INFORMERLIST("informerList", "用户信息集合");
private String code;//对应菜单组件名称
private String desc;//描述
......
package com.yeejoin.amos.boot.biz.common.service;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -59,6 +60,12 @@ public interface IWorkflowExcuteService{
* @throws Exception
*/
public Object getCurrentUserAllTaskList(String key, ReginParams userInfo) throws Exception;
/**
* 根据流程id获取下一节点操作人员userId集合
* @param procressId
* @return
* @throws Exception
*/
public List<String> getUserIdsByWorkflow(String procressId, String checkLeaderId) throws Exception;
}
......@@ -16,11 +16,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
......@@ -267,4 +264,27 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
return allTaskResultList;
}
/**
* 根据工作流获取下一审核人角色下的所有用户ID
* @return
*/
@Override
public List<String> getUserIdsByWorkflow(String procressId, String checkLeaderId) throws Exception {
List<String> userIds = new ArrayList<>();
JSONObject teskObject = workflowFeignService.getTaskList(procressId);
JSONArray taskDetailArray = teskObject.getJSONArray(WorkFlowEnum.DATA.getCode());
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
JSONArray informerList = detail.getJSONArray(WorkFlowEnum.INFORMERLIST.getCode());
if (informerList.size() > 0) {
userIds = informerList.stream().map(item -> {
JSONObject jsonItem = (JSONObject) item;
return jsonItem.getString("userId");
}).collect(Collectors.toList());
} else {
userIds.add(checkLeaderId);
}
}
return userIds;
}
}
......@@ -607,6 +607,7 @@ public class DateUtils {
//System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
//System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
// System.out.println(getDate(dateParse("2017-01-17", null)));
//System.out.println(getDate(dateParse("2017-01-17", null)));
/*
System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
......@@ -615,12 +616,13 @@ public class DateUtils {
/*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_YEAR));
System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_MONTH));
System.out.println(getWeekOfYear(new Date()));
System.out.println(getQuarterStr(getMonth(dateParse("2021-5-11", null))));
System.out.println(getWeekBeginDate(dateParse("2021-10-11", null)));
System.out.println(getWeekEndDate(dateParse("2021-10-11", null)));
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_YEAR));
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_MONTH));
// System.out.println(getWeekOfYear(new Date()));
// System.out.println(getQuarterStr(getMonth(dateParse("2021-5-11", null))));
// System.out.println(getWeekBeginDate(dateParse("2021-10-11", null)));
// System.out.println(getWeekEndDate(dateParse("2021-10-11", null)));
System.out.println(secondsToTimeStr(3600));
}
/**
......@@ -802,4 +804,21 @@ public class DateUtils {
String weekDateStr = getWeekBeginDate(date) + "-" + getWeekEndDate(date);
return month + weekDateStr + "日";
}
/**
* 将秒数转换为时分秒格式
* @param times
* @return
*/
public static String secondsToTimeStr(int times) {
if(times <= 0){
return "00:00:00";
}
int h = times/3600;
int m = (times-h*3600)/60;
int s = times - h*3600-m*60;
String time = "%02d:%02d:%02d";
time = String.format(time,h,m,s);
return time;
}
}
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author fengwang
* @date 2021-11-01.
*/
@Data
@ApiModel(value = "性能指标详情返回vo实体", description = "性能指标详情返回vo实体")
public class EquipmentIndexDto {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "equipment_id")
private String equipmentId;
@ApiModelProperty(value = "性能指标名称")
private String perfQuotaName;
@ApiModelProperty(value = "性能指标id")
private String perfQuotaDefinitionId;
@ApiModelProperty(value = "数量单位名称")
private String unitName;
@ApiModelProperty(value = "否物联指标")
private Integer isIot;
@ApiModelProperty(value = "物联指标")
private String typeName;
@ApiModelProperty(value = "物联指标ID")
private String typeCode;
@ApiModelProperty(value = "分类名称")
private String groupName;
@ApiModelProperty(value = "指标原始id,从iot平台接口获取")
private String indexId;
@ApiModelProperty(value = "性能指标")
private String perfQuotaStr;
@ApiModelProperty(value = "是否是核心参数")
private Boolean isImportentParameter;
@ApiModelProperty(value = "排序")
private Integer sortNum;
@ApiModelProperty(value = "類型")
private Integer type;
@ApiModelProperty(value = "物联nameKey")
private String nameKey;
@ApiModelProperty(value = "创建日期")
private Date createDate;
@ApiModelProperty(value = "更新日期")
private Date updateDate;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.excel.CommonExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "LinkageUnitVo", description = "联动单位")
public class LinkageUnitVo extends BaseDto {
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "单位名称", index = 0)
@ApiModelProperty(value = "单位名称")
private String unitName;
@ExcelIgnore
@ApiModelProperty(value = "单位code")
private String unitCode;
@ExcelIgnore
@ApiModelProperty(value = "父级单位id")
private String parentId;
@ExcelProperty(value = "服务类别", index = 1)
@ExplicitConstraint(type = "LDDWLB", indexNum = 1, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ApiModelProperty(value = "服务类别")
private String linkageUnitType;
@ExcelIgnore
@ApiModelProperty(value = "联动单位类别code")
private String linkageUnitTypeCode;
@ExcelIgnore
@ApiModelProperty(value = "行政区划")
private String administrativeDivisions;
@ExcelIgnore
@ApiModelProperty(value = "行政区划代码")
private String administrativeDivisionsCode;
@ExcelProperty(value = "地址", index = 2)
@ApiModelProperty(value = "地址")
private String address;
@ExcelProperty(value = "经度", index = 3)
@ApiModelProperty(value = "经度")
private String longitude;
@ExcelProperty(value = "纬度", index = 4)
@ApiModelProperty(value = "纬度")
private String latitude;
@ExcelProperty(value = "协议开始日期", index = 5)
@ApiModelProperty(value = "协议开始日期")
private Date agreementStartDate;
@ExcelProperty(value = "协议结束日期", index = 6)
@ApiModelProperty(value = "协议结束日期")
private Date agreementEndDate;
@ExcelProperty(value = "应急联动单位类别", index = 7)
@ExplicitConstraint(type = "YJLDDW", indexNum = 7, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ApiModelProperty(value = "应急联动单位类别")
private String emergencyLinkageUnit;
@ExcelIgnore
@ApiModelProperty(value = "应急联动单位类别code")
private String emergencyLinkageUnitCode;
@ExcelProperty(value = "联系人", index = 8)
@ApiModelProperty(value = "联系人 ")
private String contactUser;
@ExcelProperty(value = "联系人电话", index = 9)
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
@ExcelIgnore
@ApiModelProperty(value = "实例id")
private Long instanceId;
@ExcelIgnore
@ApiModelProperty(value = "组织机构代码")
private String orgCode;
@ExcelIgnore
@ApiModelProperty(value = "操作人名称")
private String recUserName;
@ExcelIgnore
@ApiModelProperty(value = "是否在协议期 ")
private String inAgreement;
@ExcelProperty(value = "消防救援能力", index = 10)
@ApiModelProperty(value = "消防救援能力")
private String fireRescueCapability;
@ExcelProperty(value = "职责_简要情况", index = 11)
@ApiModelProperty(value = "职责_简要情况")
private String responsibilitiesSituation;
@ExcelProperty(value = "应急服务内容", index = 12)
@ApiModelProperty(value = "应急服务内容")
private String emergencyServiceContent;
@ExcelProperty(value = "单位_简要情况", index = 13)
@ApiModelProperty(value = "单位_简要情况")
private String unitSituation;
@ExcelIgnore
@ApiModelProperty(value = "联动单位图片")
private List<SourceFile> image;
@ExcelIgnore
@ApiModelProperty(value = "车辆数量")
private String vehicleNumber;
@ExcelIgnore
@ApiModelProperty(value = "特岗人数")
private String personNumber;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
/**
* @author litw
* @date 2021-11-02.
*/
@Data
public class PerfQuotaIotDTO {
@ApiModelProperty(value = "分页 ")
Page<EquipmentIndexDto> page;
/**
* 分组id
*/
private String groupName;
/**
* 装备id
*/
private Long equipmentId;
}
......@@ -105,11 +105,11 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "实景图")
private String realityImg;
@ExcelProperty(value = "联系人姓名", index = 41)
@ExcelProperty(value = "联系人姓名", index = 38)
@ApiModelProperty(value = "联系人姓名")
private String contactUser;
@ExcelProperty(value = "联系人电话", index = 42)
@ExcelProperty(value = "联系人电话", index =39)
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
......@@ -289,15 +289,16 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "停车数量(个)")
private Integer parkingNum;
@ExcelProperty(value = "储水量容积", index = 38)
// 物联参数改为动态加载,原先字段作废,字段做隐藏
@ExcelIgnore
@ApiModelProperty(value = "储水量容积物联编码")
private String iotWaterStorage;
@ExcelProperty(value = "流量", index = 39)
@ExcelIgnore
@ApiModelProperty(value = "流量物联编码")
private String iotFlowRate;
@ExcelProperty(value = "状态", index = 40)
@ExcelIgnore
@ApiModelProperty(value = "状态物联编码")
private String iotStatus;
......@@ -308,7 +309,7 @@ public class WaterResourceDto extends BaseDto {
@ExcelIgnore
@ApiModelProperty(value = "物联参数")
private WaterResourceIotDto waterResourceIotDto;
private Map<String,Object> waterResourceIotDto;
@ExcelIgnore
@ApiModelProperty("设施定义id")
......@@ -339,13 +340,14 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "经度")
@ExcelProperty(value = "经度", index = 43)
@ExcelProperty(value = "经度", index = 40)
private Double longitude;
@ApiModelProperty(value = "纬度")
@ExcelProperty(value = "纬度", index = 44)
@ExcelProperty(value = "纬度", index = 41)
private Double latitude;
@ExcelIgnore
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private Map<String, List<AttachmentDto>> attachments;
......
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ltw
* @date 2021-11-02.
*/
@Data
public class WaterResourceDyDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "表单key")
private String key;
@ApiModelProperty(value = "表单名称")
private String label;
@ApiModelProperty(value = "表单类型")
private String type;
@ApiModelProperty(value = "是否一行显示")
private Boolean block;
@ApiModelProperty(value = "是否隱藏")
private Boolean hide;
@ApiModelProperty(value = "表单值")
private String data;
public WaterResourceDyDto() {
}
}
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 消防水源物联参数
*
* @author litw
* @date 2021-11-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="WaterResourceIndexDto", description="消防水源物联参数")
public class WaterResourceIndexDto extends BaseDto {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "指标拥有者ID:关联装备定义ID")
private Long equipmentId;
@ApiModelProperty(value = "消防水源id")
private Long waterId;
@ApiModelProperty(value = "名称")
private String name;
private String nameKey;
@ApiModelProperty(value = "指标值")
private String perfValue;
}
package com.yeejoin.amos.boot.module.common.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 消防水源物联参数
*
* @author litw
* @date 2021-11-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cb_water_resource_index")
public class WaterResourceIndex extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 指标拥有者ID:关联装备定义ID
*/
@TableField("equipment_id")
private Long equipmentId;
/**
* 消防水源id
*/
@TableField("water_id")
private Long waterId;
/**
* 名称
*/
@TableField("name")
private String name;
/**
*
*/
@TableField("name_key")
private String nameKey;
/**
* 指标值
*/
@TableField("perf_value")
private String perfValue;
}
package com.yeejoin.amos.boot.module.common.api.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.common.api.dto.PerfQuotaIotDTO;
import com.yeejoin.amos.boot.module.common.api.dto.VideoDto;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -85,7 +88,8 @@ public interface EquipFeignClient {
@RequestParam String code ,
@RequestParam String pageNum,
@RequestParam String pageSize,
@RequestParam Long id);
@RequestParam Long id,
@RequestParam Boolean isNo );
......@@ -303,4 +307,12 @@ public interface EquipFeignClient {
*/
@RequestMapping(value = "/confirmAlarm/getMonitorEvent", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> getMonitorEvent();
/**
* 装备定义性能参数列表分页查询
*
* @return
*/
@RequestMapping(value = "/perf-quota/listAll", method = RequestMethod.POST)
ResponseModel<List<EquipmentIndexDto>> getEquipmentIndexDto(@RequestBody PerfQuotaIotDTO perfQuotaIotDTO);
}
......@@ -19,7 +19,7 @@ import java.util.Map;
public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
String selectUpUnitByParam(@Param("id")String biz_org_code);
int selectPersonListCount(Map<String, Object> map);
int selectPersonListCount(@Param("map")Map<String, Object> map);
List<Map<String, Object>> selectPersonList(@Param("map")Map<String, Object> map);
......
package com.yeejoin.amos.boot.module.common.api.mapper;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIndex;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 消防水源物联参数 Mapper 接口
*
* @author litw
* @date 2021-11-02
*/
public interface WaterResourceIndexMapper extends BaseMapper<WaterResourceIndex> {
}
......@@ -29,5 +29,5 @@ public interface IDutyCarService extends IDutyCommonService {
* @return
*/
JSONObject isFireCarDriver();
int getDutyCarCount(Long carId);
}
......@@ -71,6 +71,6 @@ public List<OrgMenuDto> getBuildAndKeyTree(Long sequenceNbr);
public List<KeySiteDateDto> getKeySiteDate(Long id);
public List<KeySite> getKeySiteDateByNameLike();
public List<KeySite> getKeySiteDateByNameLike(Long companyId);
}
......@@ -117,7 +117,7 @@ public interface IOrgUsrService {
OrgUsrDto saveOrgPerson(OrgPersonDto OrgPersonDto) throws Exception;
void updateByIdOrgUsr(OrgUsrDto OrgUsrDto, Long id) throws Exception;
OrgUsrDto updateByIdOrgUsr(OrgUsrDto OrgUsrDto, Long id) throws Exception;
void updateByIdOrgPerson(OrgPersonDto OrgPersonDto, Long id) throws Exception;
......
package com.yeejoin.amos.boot.module.common.api.service;
/**
* 消防水源物联参数接口类
*
* @author litw
* @date 2021-11-02
*/
public interface IWaterResourceIndexService {
}
......@@ -112,6 +112,7 @@
linkageUnitTypeCode,
a.emergency_linkage_unit_code
emergencyLinkageUnitCode,
emergency_linkage_unit,
a.address ,
a.latitude,
a.longitude,
......
......@@ -57,18 +57,28 @@
on u.sequence_nbr = g.instance_id
where
u.biz_org_type = 'person'
u.biz_org_type = 'person'
AND
u.is_delete = 0
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
order by u.rec_date desc
)a where a.sequenceNbr is not null
</select>
u.is_delete = 0
<if test="map.bizOrgName != null">
AND u.biz_org_name like concat('%',#{map.bizOrgName},'%')
</if>
<if test="map.personNumber!= null">
AND v.field_value like concat('%',#{map.personNumber},'%')
</if>
<if test="map.bizOrgCode != null and map.bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{map.bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
order by u.rec_date desc
)a where a.sequenceNbr is not null
<if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item">AND a.${item} = #{map.fieldsValue[${item}]}</foreach>
</if>
</select>
<!--机场单位人员按时间倒叙排列add order by u.rec_date desc 2021-09-08 by kongfm -->
<select id="selectPersonList" resultType="Map">
......@@ -487,7 +497,7 @@ GROUP BY
AND u.biz_org_code LIKE CONCAT(#{code}, '%')
</if>
<if test="fieldCode != null and fieldCode.length > 0">
AND fi.field_code IN
AND f.field_code IN
<foreach collection="fieldCode" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceIndexMapper">
</mapper>
......@@ -27,4 +27,19 @@ public class AlertCalledObjsDto extends BaseDto{
@ApiModelProperty(value = "动态表单值")
private List<AlertFormValue> alertFormValue;
public String getRemark() {
String value="";
for (AlertFormValue al : alertFormValue) {
if (al.getFieldCode().equals("remark")) {
value=al.getFieldValue();
}
}
return value;
}
}
......@@ -101,6 +101,12 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "备注信息")
private String remark;
/*bug 2408 接警记录,按警情状态和接警时间筛选功能失效 陈召 2021-09-22 开始*/
@ApiModelProperty(value = "接警时间开始---用于列表过滤")
......
package com.yeejoin.amos.boot.module.jcs.api.service;
/**
* 消防水源物联参数接口类
*
* @author litw
* @date 2021-11-02
*/
public interface IWaterResourceIndexService {
}
......@@ -26,7 +26,7 @@
a.call_time callTime,
a.update_time updateTime,
a.rescue_grid rescueGrid,
CONCAT(a.alert_type,' ',IFNULL((select field_value from jc_alert_form_value where jc_alert_form_value.alert_called_id =a.sequence_nbr and jc_alert_form_value.field_code='remark'),"")) alertType,
CONCAT(a.alert_type,' ',IFNULL(a.remark,"")) alertType,
a.alert_type_code alarmTypeCode,
a.unit_involved unitInvolved,
a.trapped_num trappedNum,
......
......@@ -14,7 +14,7 @@
FROM
(
SELECT
a.sequence_nbr,
MD5(RAND() * 10000) sequence_nbr,
a.dispatch_type,
a.rec_date,
a.address,
......
......@@ -66,4 +66,13 @@ public enum ExecuteTypeEnum {
}
return null;
}
public static String getNameByCode(Integer code) {
for (ExecuteTypeEnum e : ExecuteTypeEnum.values()) {
if (code.equals(e.getCode())) {
return e.getName();
}
}
return null;
}
}
......@@ -56,6 +56,61 @@ public class PointClassify extends BasicEntity{
@Column(name="inspection_spec_name")
private String inspectionSpecName;
/**
* 编号
*/
@Column(name="code")
private String code;
/**
* 分类名称
*/
@Column(name="category_name")
private String categoryName;
/**
* 分类id
*/
@Column(name="category_code")
private String categoryCode;
/**
* 位置
*/
@Column(name="address")
private String address;
/**
* 数据源code(1 消防装备 2 重点部位 3 自定义)
*/
@Column(name="data_source_code")
private String dataSourceCode;
/**
* 数据源名称(冗余)
*/
@Column(name="data_source_name")
private String dataSourceName;
/**
* 是否删除( 0未删除,1已删除 )
*/
@Column(name="is_delete")
private byte isDelete;
/**
* 建筑id
*/
@Column(name="building_id")
private String buildingId;
/**
* 建筑名称
*/
@Column(name="building_name")
private String buildingName;
public String getEquipmentId() {
return equipmentId;
}
......@@ -115,4 +170,76 @@ public class PointClassify extends BasicEntity{
public void setOriginalId(String originalId) {
this.originalId = originalId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getDataSourceCode() {
return dataSourceCode;
}
public void setDataSourceCode(String dataSourceCode) {
this.dataSourceCode = dataSourceCode;
}
public String getDataSourceName() {
return dataSourceName;
}
public void setDataSourceName(String dataSourceName) {
this.dataSourceName = dataSourceName;
}
public byte getIsDelete() {
return isDelete;
}
public void setIsDelete(byte isDelete) {
this.isDelete = isDelete;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public String getCategoryCode() {
return categoryCode;
}
public void setCategoryCode(String categoryCode) {
this.categoryCode = categoryCode;
}
}
\ No newline at end of file
......@@ -24,6 +24,9 @@ public class AlertPaperInfoDto {
@ApiModelProperty(value = "警情类别code")
private String alarmTypeCode;
@ApiModelProperty(value = "警情类别")
private String alarmType;
@ApiModelProperty(value = "所属区域")
private String area;
......
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -42,4 +43,7 @@ public class RepairConsultDto extends BaseDto {
@ApiModelProperty(value = "警情阶段code")
private String alertStageCode;
@ApiModelProperty(value = "阶段附件")
private String attachment;
}
......@@ -54,4 +54,13 @@ public class VoiceRecordFileDto extends BaseDto {
@ApiModelProperty(value = "通话记录id")
private String connectId;
@ApiModelProperty(value = "关联工单编号")
private String workNum;
@ApiModelProperty(value = "通话开始时间str")
private String telStartTimeStr;
@ApiModelProperty(value = "通话结束时间str")
private String telEndTimeStr;
}
package com.yeejoin.amos.boot.module.tzs.api.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
......@@ -96,4 +97,11 @@ public class ESAlertCalled {
@Field(type = FieldType.Text)
private String emergencyCall;
/**
* 所属区域编码
*/
@Field(type = FieldType.Text)
private String regionCode;
}
......@@ -64,4 +64,10 @@ public class RepairConsult extends BaseEntity {
@TableField("alert_stage_code")
private String alertStageCode;
/**
* 阶段附件
*/
@TableField("attachment")
private String attachment;
}
......@@ -76,4 +76,11 @@ public class VoiceRecordFile extends BaseEntity {
@TableField("alert_stage_code")
private String alertStageCode;
/**
* 通话时长
*/
@TableField("tel_time")
private String telTime;
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto;
......@@ -101,4 +102,5 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
String alertSource,
String alarmType);
List<AlertPaperInfoDto> getAlertPaperInfoList(@Param("regionCodes") List<String> regionCodes,@Param("isHistory") Boolean isHistory);
}
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 通话记录附件 Mapper 接口
......@@ -11,4 +16,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface VoiceRecordFileMapper extends BaseMapper<VoiceRecordFile> {
Page<List<VoiceRecordFileDto>> queryRecordListByQueryDto(Page<VoiceRecordFileDto> page,
@Param("telStartTimeStr") String telStartTimeStr,
@Param("telEndTimeStr") String telEndTimeStr,
@Param("fileType") String fileType,
@Param("tel") String tel,
@Param("workNum") String workNum,
@Param("sortParam") String sortParam,
@Param("sortRule") String sortRule);
VoiceRecordFileDto getRecordById(@Param("sequenceNbr") Long sequenceNbr);
}
package com.yeejoin.amos.boot.module.tzs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
/**
......@@ -13,4 +14,7 @@ public interface IVoiceRecordFileService {
void publishRecord(VoiceRecordFileDto model);
Page<VoiceRecordFileDto> queryRecordListByQueryDto(Page<VoiceRecordFileDto> page, String telEndTimeStr, String telEndTimeStr1, String fileType, String tel, String workNum, String sortParam, String sortRule);
VoiceRecordFileDto getRecordById(Long sequenceNbr);
}
package com.yeejoin.amos.boot.module.tzs.api.service;
import java.util.List;
/**
* 特种设备权限服务类
*/
public interface TzsAuthService {
List<String> getUserRegionCode();
}
......@@ -519,7 +519,42 @@
</select>
<select id="getAlertPaperInfoList" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto">
SELECT
a.sequence_nbr AS alertId,
a.region_code AS regionCode,
e.rescue_code AS rescueCode,
a.alarm_type_code AS alarmTypeCode,
a.alarm_type AS alarmType,
CONCAT(e.province ,e.city ,e.district) AS area,
a.address AS address,
a.call_time AS callTime,
e.longitude AS longitude,
e.latitude AS latitude,
a.alert_stage AS alertStatus,
e.sequence_nbr AS elevatorId,
e.register_code AS elevatorCode
FROM tz_alert_called a
LEFT JOIN tcb_elevator e ON e.sequence_nbr = a.equipment_id
WHERE a.is_delete = 0
<choose>
<when test="isHistory == true">
AND a.alert_status = 1
AND
DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> date(a.call_time)
</when>
<otherwise>
AND a.alert_status = 0
</otherwise>
</choose>
<if test="regionCodes != null">
AND
<foreach collection="regionCodes" index="index" item="item" open="(" separator=" OR " close=")">
a.region_code LIKE CONCAT('%', #{item}, '%')
</foreach>
</if>
</select>
</mapper>
......
......@@ -2,4 +2,69 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordFileMapper">
<select id="queryRecordListByQueryDto" resultType="java.util.Map">
SELECT
r.sequence_nbr AS sequenceNbr,
r.file_path AS filePath,
r.file_type AS fileType,
r.tel AS tel,
r.tel_start_time AS telStartTime,
r.tel_end_time AS telEndTime,
r.alert_id AS alertId,
r.alert_stage AS alertStage,
r.alert_stage_code AS alertStageCode,
r.tel_time AS telTime,
a.work_order_number AS workNum
FROM
tz_voice_record_file r
LEFT JOIN tz_alert_called a ON a.sequence_nbr =
r.alert_id
WHERE r.is_delete = 0
<if test="workNum != null and workNum != ''">
AND a.work_order_number like
CONCAT(CONCAT('%',#{workNum}),'%')
</if>
<if test="telStartTimeStr != null ">
and #{telStartTimeStr} <![CDATA[ <= ]]>
r.tel_start_time
</if>
<if test="telEndTimeStr != null ">
and r.tel_end_time <![CDATA[ <= ]]>
#{telEndTimeStr}
</if>
<if test="tel != null and tel != ''">
AND r.tel like
CONCAT(CONCAT('%',#{tel}),'%')
</if>
<if test="fileType != null and fileType != ''">
AND r.file_type = #{fileType}
</if>
<if test="sortParam != null and sortParam != '' and sortRule != null and sortRule != '' ">
ORDER BY ${sortParam} ${sortRule}
</if>
</select>
<select id="getRecordById" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto">
SELECT
r.sequence_nbr AS sequenceNbr,
r.file_path AS filePath,
r.file_type AS fileType,
r.tel AS tel,
r.tel_start_time AS telStartTime,
r.tel_end_time AS telEndTime,
r.alert_id AS alertId,
r.alert_stage AS alertStage,
r.alert_stage_code AS alertStageCode,
r.tel_time AS telTime,
a.work_order_number AS workNum
FROM
tz_voice_record_file r
LEFT JOIN tz_alert_called a ON a.sequence_nbr =
r.alert_id
WHERE r.sequence_nbr = #{sequenceNbr}
</select>
</mapper>
......@@ -108,7 +108,8 @@ public class CommandController extends BaseController {
IDataDictionaryService dataDictionaryService;
@Autowired
IFireChemicalService fireChemicalService;
@Autowired
IDutyCarService dutyCarService;
@Autowired
IFireExpertsService fireExpertsService;
......@@ -1065,6 +1066,9 @@ public class CommandController extends BaseController {
if (e.get("carState").equals("在位")){
e.put("carState",FireCarStatusEnum.执勤.getName());
}
e.put("longitude",116.423762);
e.put("latitude",39.511552);
String sequenceNbr = e.get("sequenceNbr").toString();
//同步力量调派车辆任务状态
alertFormValue.stream().forEach(v->{
......@@ -1083,7 +1087,14 @@ public class CommandController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "车辆资源详情", notes = "车辆资源详情")
public ResponseModel<Map<String,Object>> getCarDetailById(Long id ) {
ResponseModel<Map<String, Object>> date= equipFeignClient.getCarDetailById(id);
return ResponseHelper.buildResponse(date!=null?date.getResult():null);
Map<String, Object> map= date!=null?date.getResult():null;
if(map!=null){
int num =0;
num = iDutyCarService.getDutyCarCount(id);
map.put("personNum",num);
}
return ResponseHelper.buildResponse(map);
}
......@@ -1323,10 +1334,10 @@ public class CommandController extends BaseController {
Long id =null;
//获取用户已绑定车辆id、
UserCar userCar=userCarService.selectByAmosUserId(Long.valueOf(agencyUserModel.getUserId()));
if(isNo!=null&&isNo){
id =userCar!=null?userCar.getCarId():null;
}
ResponseModel<Object> data= equipFeignClient.equipmentCarList(teamId,name,code , pageNum,pageSize,id);
id =userCar!=null?userCar.getCarId():null;
ResponseModel<Object> data= equipFeignClient.equipmentCarList(teamId,name,code , pageNum,pageSize,id,isNo);
Map map =new HashMap();
map.put("select",userCar!=null?userCar.getCarId():null);
map.put("data",data!=null?data.getResult():null);
......
......@@ -47,7 +47,6 @@ public class DutyCarController extends BaseController {
@Autowired
IDutyCarService iDutyCarService;
/**
* 值班列表视图--分页
*
......@@ -165,5 +164,4 @@ public class DutyCarController extends BaseController {
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyCarService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
}
}
\ No newline at end of file
......@@ -230,8 +230,8 @@ public class KeySiteController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "通过名称模糊查询重点部位的信息", notes = "通过名称模糊查询重点部位的信息")
@GetMapping(value = "/getKeySiteDateByNameLike")
public ResponseModel<List<KeySite>> getKeySiteDateByNameLike() {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike());
public ResponseModel<List<KeySite>> getKeySiteDateByNameLike(@RequestParam(required = false) Long companyId) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike(companyId));
}
}
......@@ -144,7 +144,7 @@ public class OrgUsrController extends BaseController {
OrgUsrVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id);
return ResponseHelper.buildResponse(null);
return ResponseHelper.buildResponse( iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id));
}
......
......@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
......@@ -13,12 +15,16 @@ import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.*;
import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.checkerframework.checker.units.qual.K;
import org.openxmlformats.schemas.drawingml.x2006.chart.STRadarStyle;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -64,6 +70,10 @@ public class WaterResourceController extends BaseController {
WaterResourceIotServiceImpl waterResourceIotService;
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
/**
* 新增
......@@ -92,7 +102,7 @@ public class WaterResourceController extends BaseController {
model.setResourceTypeName(resourceTypeEnum.get().getName());
model.setRealityImg(null);
model.setOrientationImg(JSONArray.toJSONString(model. getOrientationImgList()));
model.setOrientationImg(null);
/*2021-09-08 前端表示前端传递的address参数已经切割过,后端无需再切割获取 陈召 屏蔽代码 97-102行*/
/* if(model.getAddress()!=null){
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
......@@ -145,11 +155,17 @@ public class WaterResourceController extends BaseController {
break;
}
// 新增物联信息
if (model.getIsIot()) {
WaterResourceIotDto waterResourceIotDto = model.getWaterResourceIotDto();
waterResourceIotDto.setResourceType(model.getResourceType());
waterResourceIotDto.setResourceId(model.getSequenceNbr());
waterResourceIotService.createWithModel(waterResourceIotDto);
if (null != model.getWaterResourceIotDto() && model.getWaterResourceIotDto().size()>0) {
Map<String,Object> map = model.getWaterResourceIotDto();
List<WaterResourceIndex> list = new ArrayList<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
WaterResourceIndex waterResourceIndex1 = new WaterResourceIndex();
waterResourceIndex1.setNameKey(entry.getKey());
waterResourceIndex1.setWaterId(model.getSequenceNbr());
waterResourceIndex1.setPerfValue(entry.getValue().toString());
list.add(waterResourceIndex1);
}
waterResourceIndexServiceImpl.saveBatch(list);
}
} else {
waterResourceServiceImpl.createWithModel(model);
......@@ -160,6 +176,47 @@ public class WaterResourceController extends BaseController {
return ResponseHelper.buildResponse(model);
}
/**
* 获取关联装备定义物联参数字段
*
* @param equipmentId 设备定义id
* @return 返回结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getIotField")
@ApiOperation(httpMethod = "GET", value = "获取关联装备定义物联参数字段", notes = "获取关联装备定义物联参数字段")
public ResponseModel<Object> getIotField(Long equipmentId) {
PerfQuotaIotDTO perfQuotaIotDTO = new PerfQuotaIotDTO();
Page<EquipmentIndexDto> page = new Page<>();
page.setCurrent(1);
page.setSize(100);
perfQuotaIotDTO.setEquipmentId(equipmentId);
perfQuotaIotDTO.setGroupName("");
perfQuotaIotDTO.setPage(page);
ResponseModel<List<EquipmentIndexDto>> equipmentIndexDto = equipFeignClient.getEquipmentIndexDto(perfQuotaIotDTO);
if(equipmentIndexDto.getResult().size() == 0) {
return ResponseHelper.buildResponse(null);
}
List<EquipmentIndexDto> result = equipmentIndexDto.getResult();
List<EquipmentIndexDto> list = result.stream().filter(e-> 1== e.getIsIot()).collect(Collectors.toList());
List<WaterResourceDyDto> listWater = new LinkedList<>();
list.stream().forEach(e-> {
WaterResourceDyDto dyDto = new WaterResourceDyDto();
dyDto.setKey(e.getPerfQuotaDefinitionId());
dyDto.setBlock(false);
dyDto.setLabel(e.getPerfQuotaName());
dyDto.setType("input");
dyDto.setHide(false);
listWater.add(dyDto);
});
return ResponseHelper.buildResponse(listWater);
}
/**
* 根据sequenceNbr更新
*
......@@ -187,7 +244,7 @@ public class WaterResourceController extends BaseController {
// 更新基本信息
model.setSequenceNbr(sequenceNbr);
//model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
//model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
WaterResourceDto waterResourceDto = waterResourceServiceImpl.updateWithModel(model);
// 更新属性信息
String resourceType = model.getResourceType();
......@@ -234,12 +291,26 @@ public class WaterResourceController extends BaseController {
}
}
// 更新物联信息
if (model.getIsIot() != null){
if (model.getIsIot()) {
WaterResourceIotDto waterResourceIotDto = model.getWaterResourceIotDto();
waterResourceIotDto.setResourceId(sequenceNbr);
waterResourceIotService.updateWithModel(waterResourceIotDto);
if (null != model.getWaterResourceIotDto() && model.getWaterResourceIotDto().size() > 0){
Map<String,Object> map = model.getWaterResourceIotDto();
List<WaterResourceIndex> list = new ArrayList<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WaterResourceIndex::getNameKey,entry.getKey());
queryWrapper.eq(WaterResourceIndex::getWaterId,model.getSequenceNbr());
WaterResourceIndex waterResourceIndex = waterResourceIndexServiceImpl.getOne(queryWrapper);
if(waterResourceIndex != null) {
waterResourceIndex.setPerfValue(entry.getValue().toString());
list.add(waterResourceIndex);
} else {
WaterResourceIndex waterResourceIndex1 = new WaterResourceIndex();
waterResourceIndex1.setNameKey(entry.getKey());
waterResourceIndex1.setWaterId(model.getSequenceNbr());
waterResourceIndex1.setPerfValue(entry.getValue().toString());
list.add(waterResourceIndex1);
}
}
waterResourceIndexServiceImpl.saveOrUpdateBatch(list);
}
return ResponseHelper.buildResponse(waterResourceDto);
}
......@@ -341,14 +412,15 @@ public class WaterResourceController extends BaseController {
waterResourceDto.setSequenceNbr(sequenceNbr);
waterResourceDto.setIsDelete(isDelete);
// 查询物联参数
if (waterResourceDto.getIsIot()) {
WaterResourceIot waterResourceIot = waterResourceIotService.getOne(new QueryWrapper<WaterResourceIot>().eq(
"resource_id", sequenceNbr));
WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto();
if (!ValidationUtil.isEmpty(waterResourceIot)) {
BeanUtils.copyProperties(waterResourceIot, waterResourceIotDto);
}
waterResourceDto.setWaterResourceIotDto(waterResourceIotDto);
LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WaterResourceIndex::getWaterId,waterResourceDto.getSequenceNbr());
List<WaterResourceIndex> list = waterResourceIndexServiceImpl.list(queryWrapper);
if(list.size()>0) {
Map<String,Object> map = new HashMap<>();
list.stream().forEach(e->{
map.put(e.getNameKey(),e.getPerfValue());
});
waterResourceDto.setWaterResourceIotDto(map);
}
return ResponseHelper.buildResponse(waterResourceDto);
}
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceIndexServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceIndexDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 消防水源物联参数
*
* @author litw
* @date 2021-11-02
*/
@RestController
@Api(tags = "消防水源物联参数Api")
@RequestMapping(value = "/water-resource-index")
public class WaterResourceIndexController extends BaseController {
@Autowired
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
/**
* 新增消防水源物联参数
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增消防水源物联参数", notes = "新增消防水源物联参数")
public ResponseModel<WaterResourceIndexDto> save(@RequestBody WaterResourceIndexDto model) {
model = waterResourceIndexServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新消防水源物联参数", notes = "根据sequenceNbr更新消防水源物联参数")
public ResponseModel<WaterResourceIndexDto> updateBySequenceNbrWaterResourceIndex(@RequestBody WaterResourceIndexDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除消防水源物联参数", notes = "根据sequenceNbr删除消防水源物联参数")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个消防水源物联参数", notes = "根据sequenceNbr查询单个消防水源物联参数")
public ResponseModel<WaterResourceIndexDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "消防水源物联参数分页查询", notes = "消防水源物联参数分页查询")
public ResponseModel<Page<WaterResourceIndexDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<WaterResourceIndexDto> page = new Page<WaterResourceIndexDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.queryForWaterResourceIndexPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "消防水源物联参数列表全部数据查询", notes = "消防水源物联参数列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<WaterResourceIndexDto>> selectForList() {
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.queryForWaterResourceIndexList());
}
}
......@@ -218,5 +218,17 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
}
return detailList;
}
@Override
public int getDutyCarCount(Long carId) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(DateUtils.getDateNowShortStr(),
this.getGroupCode(), "carId", "carName", "teamName","result.carId");
int count =0;
for (Map<String, Object> map : equipmentList) {
if(map.containsKey("carId") && map.get("carId").equals(carId)) {
count++;
}
}
return count;
}
}
......@@ -319,9 +319,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
}
@Override
public List<KeySite> getKeySiteDateByNameLike() {
public List<KeySite> getKeySiteDateByNameLike(Long companyId) {
LambdaQueryWrapper<KeySite> mapper =new LambdaQueryWrapper<KeySite>();
mapper.eq(KeySite::getIsDelete, false);
if(companyId!=null && companyId.longValue()!=0) {
mapper.eq(KeySite::getBelongId, companyId);
}
return this.baseMapper.selectList(mapper);
}
}
......@@ -523,17 +523,19 @@ public class MaintenanceCompanyServiceImpl
parentCode = parent.getCode();
}
// 旧父节点的code
String oldParentCode = company.getCode().substring(0, company.getCode().length() - TreeParser.CODE_LENGTH);
List<MaintenanceCompany> children =
list(new LambdaQueryWrapper<MaintenanceCompany>().eq(MaintenanceCompany::getIsDelete, false).likeRight(MaintenanceCompany::getCode, company.getCode()).ne(MaintenanceCompany::getSequenceNbr, company.getSequenceNbr()));
if (!ValidationUtil.isEmpty(children)) {
String finalParentCode = parentCode;
children.forEach(i -> {
i.setCode(i.getCode().replaceFirst(oldParentCode, finalParentCode));
});
updateBatchById(children);
if(company.getCode() != null){
String oldParentCode = company.getCode().substring(0, company.getCode().length() - TreeParser.CODE_LENGTH);
List<MaintenanceCompany> children =
list(new LambdaQueryWrapper<MaintenanceCompany>().eq(MaintenanceCompany::getIsDelete, false).likeRight(MaintenanceCompany::getCode, company.getCode()).ne(MaintenanceCompany::getSequenceNbr, company.getSequenceNbr()));
if (!ValidationUtil.isEmpty(children)) {
String finalParentCode = parentCode;
children.forEach(i -> {
i.setCode(i.getCode().replaceFirst(oldParentCode, finalParentCode));
});
updateBatchById(children);
}
company.setCode(company.getCode().replaceFirst(oldParentCode, parentCode));
}
company.setCode(company.getCode().replaceFirst(oldParentCode, parentCode));
}
@Override
......
......@@ -738,7 +738,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public void updateByIdOrgUsr(OrgUsrDto OrgUsrVo, Long id) throws Exception {
public OrgUsrDto updateByIdOrgUsr(OrgUsrDto OrgUsrVo, Long id) throws Exception {
// 修改单位信息
OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id);
......@@ -751,7 +751,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (parent != null) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
}
// orgUsr.setSequenceNbr(id);
orgUsr.setSequenceNbr(id);
// 查询机构下的所有部门单位人员数据,进行bizOrgCode的统一修改 BUG 2880 by litw start 2021年9月16日
// String oriOrgCode = oriOrgUsr.getBizOrgCode();
// Map<String, Object> columnMap = new HashMap<>();
......@@ -774,6 +774,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
* 同步保存ES
*/
eSOrgUsrService.saveAlertCalledToES(orgUsr);
OrgUsrVo.setBizOrgCode(orgUsr.getBizOrgCode());
return OrgUsrVo;
}
@Override
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIndex;
import com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceIndexMapper;
import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceIndexService;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceIndexDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 消防水源物联参数服务实现类
*
* @author litw
* @date 2021-11-02
*/
@Service
public class WaterResourceIndexServiceImpl extends BaseService<WaterResourceIndexDto,WaterResourceIndex,WaterResourceIndexMapper> implements IWaterResourceIndexService {
/**
* 分页查询
*/
public Page<WaterResourceIndexDto> queryForWaterResourceIndexPage(Page<WaterResourceIndexDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<WaterResourceIndexDto> queryForWaterResourceIndexList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
......@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResource;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIndex;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIot;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceNatural;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourcePool;
......@@ -35,7 +37,9 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
......@@ -59,6 +63,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
WaterResourceIotServiceImpl waterResourceIotService;
@Resource
WaterResourceMapper waterResourceMapper;
@Autowired
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
/**
* 分页查询
......@@ -154,14 +160,14 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
break;
}
// 新增物联信息
if (model.getIsIot()) {
WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto();
BeanUtils.copyProperties(model, waterResourceIotDto);
waterResourceIotDto.setSequenceNbr(null);
waterResourceIotDto.setResourceType(model.getResourceType());
waterResourceIotDto.setResourceId(model.getSequenceNbr());
waterResourceIotService.createWithModel(waterResourceIotDto);
}
// if (model.getIsIot()) {
// WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto();
// BeanUtils.copyProperties(model, waterResourceIotDto);
// waterResourceIotDto.setSequenceNbr(null);
// waterResourceIotDto.setResourceType(model.getResourceType());
// waterResourceIotDto.setResourceId(model.getSequenceNbr());
// waterResourceIotService.createWithModel(waterResourceIotDto);
// }
} else {
createWithModel(model);
}
......@@ -234,12 +240,15 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
waterResourceDto.setSequenceNbr(sequenceNbr);
waterResourceDto.setIsDelete(isDelete);
// 查询物联参数
if (waterResourceDto.getIsIot()) {
WaterResourceIot waterResourceIot = waterResourceIotService.getOne(new QueryWrapper<WaterResourceIot>().eq(
"resource_id", sequenceNbr));
WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto();
BeanUtils.copyProperties(waterResourceIot, waterResourceIotDto);
waterResourceDto.setWaterResourceIotDto(waterResourceIotDto);
LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WaterResourceIndex::getWaterId,waterResourceDto.getSequenceNbr());
List<WaterResourceIndex> list = waterResourceIndexServiceImpl.list(queryWrapper);
if(list.size()>0) {
Map<String,Object> map = new HashMap<>();
list.stream().forEach(e->{
map.put(e.getNameKey(),e.getPerfValue());
});
waterResourceDto.setWaterResourceIotDto(map);
}
return waterResourceDto;
}
......
......@@ -168,7 +168,7 @@ public class AlertCalledController extends BaseController {
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{id}")
@GetMapping(value = "/find/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<Object> selectById(@PathVariable Long id) {
......@@ -343,6 +343,8 @@ public class AlertCalledController extends BaseController {
throw new RuntimeException("系统异常");
}
});
queryWrapper.or().eq("sequence_nbr",alertCalled.getFatherAlert());
return queryWrapper;
}
......@@ -403,14 +405,14 @@ public class AlertCalledController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "警情填报联系人模糊查询", notes = "警情填报联系人模糊查询")
public ResponseModel<Object> getContact() {
if (redisUtils.hasKey(RedisKey.CONTACT_USER)) {
Object obj = redisUtils.get(RedisKey.CONTACT_USER);
return ResponseHelper.buildResponse(obj);
} else {
// if (redisUtils.hasKey(RedisKey.CONTACT_USER)) {
// Object obj = redisUtils.get(RedisKey.CONTACT_USER);
// return ResponseHelper.buildResponse(obj);
// } else {
List<Map<String, String>> contactName = iAlertCalledService.getContactName();
redisUtils.set(RedisKey.CONTACT_USER, contactName, time);
// redisUtils.set(RedisKey.CONTACT_USER, contactName, time);
return ResponseHelper.buildResponse(contactName);
}
}
/**
......@@ -441,7 +443,7 @@ public class AlertCalledController extends BaseController {
AlarmGiveStatisticsDto dto = new AlarmGiveStatisticsDto();
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.isNull(AlertCalled::getFatherAlert);
queryWrapper.eq(AlertCalled::getAlertStatus, true);
queryWrapper.eq(AlertCalled::getAlertStatus, false);
queryWrapper.eq(AlertCalled::getIsDelete, false);
Integer alertNum = iAlertCalledService.getBaseMapper().selectCount(queryWrapper);
dto.setAlarmNum(alertNum);
......
......@@ -67,6 +67,8 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.TemplateMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import ch.qos.logback.core.joran.conditional.IfAction;
/**
* 警情接警记录 服务实现类
*
......@@ -257,6 +259,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
try {
// 警情基本信息
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
//主表增加备注字段
if (alertCalled.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress());
alertCalled.setAddress(address.getString(BizConstant.ADDRESS));
......@@ -290,6 +294,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode());
alertCalled.setUpdateTime(new Date());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
......@@ -307,6 +312,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
......@@ -322,12 +328,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
}
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
return alertCalledObjsDto;
} catch (Exception e) {
......@@ -845,8 +852,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// firefightersName.addAll(contactNames);
List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail();
list.stream().forEach(i->{
String phone = QRCodeUtil.generateQRCode()+"@"+ i.get("phone").toString();
i.replace("phone", phone);
String phone="";
if(i.containsKey("phone")) {
phone = QRCodeUtil.generateQRCode()+"@"+ i.get("phone").toString();
i.replace("phone", phone);
}else {
phone = QRCodeUtil.generateQRCode()+"@"+ phone;
i.put("phone", phone);
}
});
return list;
}
......@@ -861,16 +874,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束 */
public Set<Map<String, Object>> getLocationLike(String locationt) {
// Set<Map<String, Object>> set=new HashSet<Map<String, Object>>();
// List<Map<String, Object>> orgUserLocation = alertCalledMapper.getOrgUserLocation(locationt);
// List<Map<String, Object>> alertCalledLocation = alertCalledMapper.getAlertCalledLocation(locationt);
// List<Map<String, Object>> keySiteLocation = alertCalledMapper.getKeySiteLocation(locationt);
// List<Map<String, Object>> airportLocation = alertCalledMapper.getAirportLocation(locationt);
// set.addAll(alertCalledLocation);
// set.addAll(keySiteLocation);
// set.addAll(airportLocation);
// set.addAll(orgUserLocation);
// set.remove(null);
return alertCalledMapper.getLocation();
Set<Map<String, Object>> set= alertCalledMapper.getLocation();
set.remove(null);
return set;
}
}
......@@ -81,6 +81,7 @@ public class ESAlertCalledService {
Date date=new Date(currentTime);
wrapper.ge("call_time", date);
wrapper.isNull("father_alert");
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if (!ValidationUtil.isEmpty(alertCalleds))
......
......@@ -15,32 +15,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInitDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto;
import com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto;
import com.yeejoin.amos.boot.module.common.api.dto.MaintenancePersonExcleDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.RescueEquipmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.SpecialPositionStaffDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.FireChemical;
......@@ -328,26 +303,40 @@ public class ExcelServiceImpl {
List<Map<String, Object>> pageList = dynamicFormInstanceService.listAll("linkageUnit");
linkageUnitListMap.forEach(i -> {
String mainString = i.get("instanceId").toString();
pageList.stream().forEach(detail -> {
if (detail.get("instanceId").toString().equals(mainString)) {
i.putAll(detail);
}
});
if ( i.get("instanceId") != null){
String mainString = i.get("instanceId").toString();
pageList.stream().forEach(detail -> {
if (detail.get("instanceId").toString().equals(mainString)) {
i.putAll(detail);
}
});
}
});
List<LinkageUnitDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(linkageUnitListMap),
LinkageUnitDto.class);
List<LinkageUnitDto> detaiList = resultDtoList.stream().map(item -> {
Date now = new Date();
if (item.getLongitude() != null){
}
boolean isInAgreement = DateUtils.belongCalendar(now, item.getAgreementStartDate(),
item.getAgreementEndDate());
item.setInAgreement(isInAgreement ? "是" : "否");
return item;
}).filter(item -> org.apache.commons.lang3.StringUtils.isEmpty(inAgreement) || inAgreement.equals(item.getInAgreement()))
.collect(Collectors.toList());
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), detaiList,
LinkageUnitDto.class, null, false);
/*经纬度导出精度会丢失 转换成string导出 2021-11-02 陈召 开始*/
List<LinkageUnitVo> result = new ArrayList<>();
detaiList.forEach(d->{
LinkageUnitVo linkageUnitVo = new LinkageUnitVo();
BeanUtils.copyProperties(d,linkageUnitVo);
linkageUnitVo.setLatitude(d.getLatitude() != null? String.valueOf(d.getLatitude()):" ");
linkageUnitVo.setLongitude(d.getLongitude() != null?String.valueOf(d.getLongitude()):" ");
result.add(linkageUnitVo);
});
/*经纬度导出精度会丢失 转换成string导出 2021-11-02 陈召 结束*/
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), result,
LinkageUnitVo.class, null, false);
break;
default:
break;
......
......@@ -18,4 +18,9 @@ public class DangerExecuteSubmitDto extends ExecuteSubmitDto {
private Long dangerId;
private LatentDangerExecuteTypeEnum executeTypeEnum;
/**
* 检查组长userId
*/
private String checkLeaderId;
}
......@@ -288,6 +288,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setCurrentFlowRecordId(inputRecord.getId());
latentDanger.setInstanceId(instance.getString("id"));
latentDangerMapper.updateById(latentDanger);
asyncTask.sendDangerMsg(RequestContext.cloneRequestContext(), latentDanger, onSiteConfirmRole);
}
// TODO 使用远程调用替换
......@@ -1215,6 +1216,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// 4、在执行完节点后需要将检查组长id设置为下个节点执行人
Object resultObj = workflowExecuteService.setTaskAssign(latentDanger.getInstanceId(), checkLeaderId);
executeSubmitDto.setCheckLeaderId(userModel.getUserId());
if (!(Boolean) resultObj) {
executeSubmitDto.setIsOk(false);
......@@ -2087,7 +2089,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
}
this.updateById(latentDanger);
DangerExecuteSubmitDto executeSubmitDto = new DangerExecuteSubmitDto();
LatentDangerExecuteParam executeParam = new LatentDangerExecuteParam();
if (ValidationUtil.isEmpty(executeType) ||
......@@ -2108,6 +2109,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg());
}
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(), executeSubmitDto.getCheckLeaderId());
asyncTask.sendDangerSubmitMsg(RequestContext.cloneRequestContext(), latentDanger, userIds, ExecuteTypeEnum.getNameByCode(executeType));
return executeSubmitDto;
}
......
......@@ -4,12 +4,18 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.latentdanger.business.param.JPushTypeEnum;
import com.yeejoin.amos.latentdanger.business.param.PushMsgParam;
import com.yeejoin.amos.latentdanger.business.util.DateUtil;
import com.yeejoin.amos.latentdanger.business.util.Toke;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState;
import com.yeejoin.amos.latentdanger.common.enums.MsgSubscribeEnum;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import com.yeejoin.amos.latentdanger.dao.entity.Msg;
import com.yeejoin.amos.latentdanger.feign.RemoteSecurityService;
import org.slf4j.Logger;
......@@ -17,12 +23,12 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.context.RequestContextModel;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
* 异步执行任务
......@@ -33,6 +39,7 @@ import java.util.Set;
public class AsyncTask {
private static final String TAB = "\r\n";
private final Logger log = LoggerFactory.getLogger(AsyncTask.class);
private final String msgType = "danger";
// @Autowired
// private IMsgDao iMsgDao;
// @Autowired
......@@ -146,4 +153,76 @@ public class AsyncTask {
// messageService.pushMsg(toke.getToke(), toke.getProduct(), toke.getAppKey(), pushMsgParam);
}
}
/**
* 提交隐患发送消息至检查组员被检查单位确认隐患
*/
@Async
public void sendDangerMsg(RequestContextModel requestContextModel, LatentDanger latentDanger, String roleName){
RequestContext.setToken(requestContextModel.getToken());
RequestContext.setProduct(requestContextModel.getProduct());
RequestContext.setAppKey(requestContextModel.getAppKey());
MessageModel model = new MessageModel();
String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s;当前状态:%s;推送时间:%s",
latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName(), latentDanger.getDangerStateName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
getMessageModel(model, latentDanger);
try {
List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult();
if (result.size() > 0) {
List<AgencyUserModel> userModels = Privilege.agencyUserClient.queryByRoleId(String.valueOf(result.get(0).getSequenceNbr()), null).getResult();
List<String> userIds = userModels.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
model.setRecivers(userIds);
}
Systemctl.messageClient.create(model);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 确认隐患发送消息
*/
@Async
public void sendDangerSubmitMsg(RequestContextModel requestContextModel, LatentDanger latentDanger, List<String> userIds, String executeName){
RequestContext.setToken(requestContextModel.getToken());
RequestContext.setProduct(requestContextModel.getProduct());
RequestContext.setAppKey(requestContextModel.getAppKey());
MessageModel model = new MessageModel();
String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s;当前状态:%s;审核结果:%s;推送时间:%s",
latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName(), latentDanger.getDangerStateName(), executeName, DateUtil.date2LongStr(new Date()));
model.setBody(body);
model.setIsSendWeb(true);
model.setRecivers(userIds);
getMessageModel(model, latentDanger);
try {
Systemctl.messageClient.create(model);
} catch (Exception e) {
e.printStackTrace();
}
}
private MessageModel getMessageModel(MessageModel model, LatentDanger latentDanger) {
String type = null;
latentDanger.getDangerState();
LatentDangerState.SupervisionDangerStateEnum stateEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(latentDanger.getDangerState());
if (!ValidationUtil.isEmpty(stateEnum)) {
if (stateEnum.getProcessState().equals("1")) {
type = "1";
} else if (stateEnum.getProcessState().equals("4")) {
type = "2";
}
}
if (!ValidationUtil.isEmpty(type)){
Map<String, String> map = new HashMap<>();
map.put("type", type);
model.setExtras(map);
}
model.setTitle(latentDanger.getDangerName());
model.setIsSendApp(true);
model.setMsgType(msgType);
model.setRelationId(String.valueOf(latentDanger.getId()));
return model;
}
}
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.maintenance.business.param;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Data
public class PushMsgParam {
......@@ -41,54 +43,7 @@ public class PushMsgParam {
* jpush发送类型:1:广播;2:标签;3:别名
*/
private String type = "3";
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public List<String> getRecivers() {
return recivers;
}
public void setRecivers(List<String> recivers) {
this.recivers = recivers;
}
public Map<String, String> getExtras() {
return extras;
}
public void setExtras(Map<String, String> extras) {
this.extras = extras;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String[] getEmails() {
return emails;
}
public void setEmails(String[] emails) {
this.emails = emails;
}
private String relationId;
}
......@@ -233,9 +233,10 @@ public class MessageServiceImpl implements IMessageService {
extras.put("type",MsgTypeEnum.CHECK.getCode());
extras.put("id",checkMsgBo.getCheckId()+"");
pushMsgParam.setExtras(extras);
pushMsgParam.setRelationId(String.valueOf(checkMsgBo.getCheckId()));
pmps.add(pushMsgParam);
List<Msg> msgList =createMsg(jpushUser,checkMsgBo);
pushFeignServer.sendMessage( toke, product, appKey,pmps);
pushFeignServer.sendMessage(pmps);
}
}
......@@ -312,10 +313,11 @@ public class MessageServiceImpl implements IMessageService {
extras.put("type",msg.getMsgType());
extras.put("id",msg.getRelationId()==null?"0":msg.getRelationId().toString());
pushMsg.setExtras(extras);
pushMsg.setRelationId(msg.getRelationId()==null?"0":msg.getRelationId().toString());
pmps.add(pushMsg);
msg.setSendTime(new Date());
msg.setStatus(1);
pushFeignServer.sendMessage( toke, product, appKey,pmps);
pushFeignServer.sendMessage(pmps);
iMsgDao.save(msg);
return msg;
}
......
......@@ -2,49 +2,43 @@ package com.yeejoin.amos.maintenance.feign;
import java.util.List;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.maintenance.business.param.PushMsgParam;
@Service("pushFeignServer")
public class PushFeignServer {
@Autowired
private RestTemplate restTemplate;
@Value("${Push.fegin.name}")
private String RPushFeginName;
private static String sendMessage = "/api/user/sendMessage";
public String geturls(String url){
return "http://"+RPushFeginName+url;
}
public HttpHeaders getHeader(String toke,String product,String appKey){
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("token", toke);
headers.set("product",product);
headers.set("appKey", appKey);
return headers;
}
public CommonResponse sendMessage(String toke, String product, String appKey, List<PushMsgParam> pushMsgParam){
try {
HttpEntity httpEntity = new HttpEntity<>(pushMsgParam, getHeader( toke, product, appKey));
CommonResponse commonResponse1 = restTemplate.postForObject(geturls(sendMessage),httpEntity, CommonResponse.class);
return commonResponse1;
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure("发送失败");
}
}
public void sendMessage(List<PushMsgParam> pushMsgParam){
try {
pushMsgParam.forEach(action->{
sendJP(action);
});
} catch (Exception e) {
e.printStackTrace();
}
}
public void sendMessage(PushMsgParam pushMsgParam){
try {
sendJP(pushMsgParam);
} catch (Exception e) {
e.printStackTrace();
}
}
private void sendJP(PushMsgParam pushMsgParam){
MessageModel model = new MessageModel();
model.setRelationId(pushMsgParam.getRelationId());
model.setTitle(pushMsgParam.getSubject());
model.setBody(pushMsgParam.getContent());
model.setMsgType("maintenance");
model.setIsSendApp(true);
model.setIsSendWeb(true);
model.setRecivers(pushMsgParam.getRecivers());
model.setExtras(pushMsgParam.getExtras());
Systemctl.messageClient.create(model);
}
}
......@@ -30,7 +30,7 @@ public interface InputItemMapper extends BaseMapper {
public List<InputItemVo> getInputItemListByitemNos(@Param("itemNos") String[] itemNos);
public List<PointInputItemVo> queryCustomInputItemByPointId(@Param("pointId") Long pointId, @Param("equipmentId") String equipmentName );
public List<PointInputItemVo> queryCustomInputItemByPointId(@Param("classifyId") String classifyId );
public PointInputItemVo getInputItemByEquipmentName(@Param("equipmentName") String equipmentName );
}
......@@ -14,7 +14,7 @@ public interface IPointClassifyDao extends BaseDao<PointClassify, Long> {
@Modifying
@Transactional
@Query(value = "select * from p_point_classify where point_id = ?1", nativeQuery = true)
@Query(value = "select * from p_point_classify where point_id = ?1 and is_delete = 0", nativeQuery = true)
List<PointClassify> getPointClassifyByPointId(long id);
@Modifying
......@@ -27,5 +27,23 @@ public interface IPointClassifyDao extends BaseDao<PointClassify, Long> {
@Query(value = "delete from p_point_classify where point_id in (?1)", nativeQuery = true)
void deleteByPointId(List<Long> pointIds);
/**
* 根据原始id逻辑删除
* @param id 原始id
*/
@Modifying
@Transactional
@Query(value = "UPDATE p_point_classify SET is_delete = 1 WHERE original_id = (?1)", nativeQuery = true)
void deleteByOriginalId(String id);
/**
* 根据原始id查询
* @param id 原始id
* @return List<PointClassify> 返回
*/
@Query(value = "select * from p_point_classify WHERE original_id = (?1) and is_delete =0", nativeQuery = true)
List<PointClassify> selectByOriginalId(String id);
PointClassify findByOriginalId(String originalId);
}
package com.yeejoin.amos.patrol.business.dto;
import lombok.Data;
/**
* @author DELL
*/
@Data
public class PointClassifySynDto {
/**
* 原始数据id
*/
private String originalId;
/**
* 原始数据name
*/
private String name;
/**
* 编号
*/
private String code;
/**
* 分类
*/
private String categoryName;
/**
* 分类code
*/
private String categoryCode;
/**
* 位置
*/
private String address;
/**
* 建筑id
*/
private String buildingId;
/**
* 建筑名称
*/
private String buildingName;
}
......@@ -1134,32 +1134,32 @@ public class CheckServiceImpl implements ICheckService {
e.put("photoData", photoList);
});
equip.put("equipIputLsit",inputContent);
LinkedHashMap<String,Object> jsonObject = equipment.getEquipDetail(Long.parseLong(equip.get("equipmentId").toString()));
LinkedHashMap<String,Object> result = (LinkedHashMap<String, Object>) jsonObject.get("result");
if(result!=null){
if(result.get("sourceName")!=null){
equip.put("arec",result.get("sourceName").toString());
}else{
equip.put("arec","");
}
if(result.get("categoryName")!=null){
equip.put("equipType",result.get("categoryName").toString());
}else{
equip.put("equipType","");
}
if(result.get("fullName")!=null){
if(result.get("area")!=null){
equip.put("area",result.get("fullName").toString()+result.get("area"));
}else {
equip.put("area",result.get("fullName").toString());
}
}else{
equip.put("area","");
}
equip.put("place", result.get("warehouseStructureName"));
}
// LinkedHashMap<String,Object> jsonObject = equipment.getEquipDetail(Long.parseLong(equip.get("equipmentId").toString()));
// LinkedHashMap<String,Object> result = (LinkedHashMap<String, Object>) jsonObject.get("result");
// if(result!=null){
// if(result.get("sourceName")!=null){
// equip.put("arec",result.get("sourceName").toString());
// }else{
// equip.put("arec","");
// }
// if(result.get("categoryName")!=null){
// equip.put("equipType",result.get("categoryName").toString());
// }else{
// equip.put("equipType","");
// }
// if(result.get("fullName")!=null){
// if(result.get("area")!=null){
// equip.put("area",result.get("fullName").toString()+result.get("area"));
// }else {
// equip.put("area",result.get("fullName").toString());
// }
//
// }else{
// equip.put("area","");
// }
//
// equip.put("place", result.get("warehouseStructureName"));
// }
});
return equipList;
}
......
......@@ -781,9 +781,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
userNames.clear();
String[] userIds1 = e.get("userId").toString().split(",");
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
if (!ObjectUtils.isEmpty(userModelMap.get(userId))) {
userNames.add(userModelMap.get(userId));
}
}
userNames.remove(null);
if (userNames.size() > 0) {
e.put("executiveName", Joiner.on(",").join(userNames));
} else {
......
package com.yeejoin.amos.patrol.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
......@@ -11,6 +12,7 @@ import com.yeejoin.amos.patrol.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PointMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.RouteMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.dto.PointClassifySynDto;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PushTargetBo;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
......@@ -29,10 +31,13 @@ import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.safety.common.cache.PointStatusCache;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.assertj.core.util.Sets;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*;
import org.springframework.data.jpa.domain.Specification;
......@@ -46,12 +51,14 @@ import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.beans.PropertyDescriptor;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@Service("pointService")
@Slf4j
public class PointServiceImpl implements IPointService {
@Autowired
......@@ -320,6 +327,15 @@ public class PointServiceImpl implements IPointService {
newPointClassify.setCreatorId(point.getCreatorId());
newPointClassify.setPointId(pointId);
newPointClassify.setOrderNo(pointClassify.getOrderNo());
newPointClassify.setDataSourceCode(pointClassify.getDataSourceCode());
newPointClassify.setDataSourceName(pointClassify.getDataSourceName());
newPointClassify.setAddress(pointClassify.getAddress());
newPointClassify.setBuildingId(pointClassify.getBuildingId());
newPointClassify.setOriginalId(pointClassify.getOriginalId());
newPointClassify.setCategoryCode(pointClassify.getCategoryCode());
newPointClassify.setCategoryName(pointClassify.getCategoryName());
newPointClassify.setCode(pointClassify.getCode());
newPointClassify.setBuildingName(pointClassify.getBuildingName());
if(!optionalPointClassify.isPresent()) {
pointResult = iPointClassifyDao.saveAndFlush(newPointClassify);
}else{
......@@ -1502,8 +1518,8 @@ public class PointServiceImpl implements IPointService {
public List<Map<String, Object>> queryEquipPointInputItem(Long pointId) {
List<Map<String, Object>> content = pointMapper.queryEquipPointInputItem(pointId);
content.forEach(e->{
if(e.get("equipmentId")!=null && !StringUtils.isBlank(e.get("equipmentId").toString())){
List<PointInputItemVo> inputItems = inputItemMapper.queryCustomInputItemByPointId(pointId,e.get("equipmentId").toString());
if(e.get("id")!=null && !StringUtils.isBlank(e.get("id").toString())){
List<PointInputItemVo> inputItems = inputItemMapper.queryCustomInputItemByPointId(e.get("id").toString());
e.put("equipIputDetailData",inputItems);
}
});
......@@ -1628,4 +1644,52 @@ public class PointServiceImpl implements IPointService {
public LinkedHashMap<String, Object> getRegionTress() {
return equipFeign.getRegionTress();
}
@Override
public void syncPointClassify(Map<String, Object> map) {
if (ObjectUtils.isEmpty(map)) {
log.info("消息内容为空!!!");
return;
}
String method = map.get("method").toString();
PointClassifySynDto pointClassifySynDto = JSON.parseObject(map.get("data").toString(), PointClassifySynDto.class);
switch (method) {
case "DELETE":
iPointClassifyDao.deleteByOriginalId(pointClassifySynDto.getOriginalId());
break;
case "UPDATE":
List<PointClassify> pointClassifyList = iPointClassifyDao.selectByOriginalId(pointClassifySynDto.getOriginalId());
if (ObjectUtils.isEmpty(pointClassifyList)) {
log.info("数据不存在!");
}
pointClassifyList.forEach(pointClassify -> {
BeanUtils.copyProperties(pointClassifySynDto, pointClassify,getNullPropertyNames(pointClassifySynDto));
iPointClassifyDao.saveAndFlush(pointClassify);
});
break;
default:
log.info("方法参数错误!!!");
break;
}
}
/**
* 获取控制字段列表
* @param source 对象
* @return 为空数组
*/
private static String[] getNullPropertyNames(Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<String>();
for(PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
if (srcValue == null) {
emptyNames.add(pd.getName());
}
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
}
......@@ -343,4 +343,7 @@ public interface IPointService {
List queryItemList4RoutePoint(Long pointId, Long equipId);
LinkedHashMap<String,Object> getRegionTress ();
void syncPointClassify(Map<String,Object> map);
}
......@@ -65,6 +65,35 @@ public class PointInputItemNewVo{
* 序号
*/
private Integer orderNo;
/**
* 数据源名称(冗余)
*/
private String dataSourceName;
/**
* 数据源code(1 消防装备 2 重点部位 3 自定义)
*/
private String dataSourceCode;
/**
* 编号
*/
private String code;
/**
* 建筑id
*/
private String buildingId;
/**
* 建筑name
*/
private String buildingName;
/**
* 原始id
*/
private String originalId;
private List<PointInputItemVo> equipIputDetailData = new ArrayList<PointInputItemVo>();
......@@ -178,4 +207,52 @@ public class PointInputItemNewVo{
public void setMaintenanceName(String maintenanceName) {
this.maintenanceName = maintenanceName;
}
public String getDataSourceName() {
return dataSourceName;
}
public void setDataSourceName(String dataSourceName) {
this.dataSourceName = dataSourceName;
}
public String getDataSourceCode() {
return dataSourceCode;
}
public void setDataSourceCode(String dataSourceCode) {
this.dataSourceCode = dataSourceCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getBuildingId() {
return buildingId;
}
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
public String getOriginalId() {
return originalId;
}
public void setOriginalId(String originalId) {
this.originalId = originalId;
}
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
}
package com.yeejoin.amos.patrol.feign;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.yeejoin.amos.patrol.business.param.PushMsgParam;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.core.common.response.TaskInfoRespone;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.business.param.PushMsgParam;
@Service("pushFeignServer")
public class PushFeignServer {
// @Autowired
// private RestTemplate restTemplate;
//
// @Value("${Push.fegin.name}")
// private String RPushFeginName;
// private static String sendMessage = "/api/user/sendMessage";
//
// public String geturls(String url){
// return "http://"+RPushFeginName+url;
// }
// public HttpHeaders getHeader(String toke,String product,String appKey){
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON);
// headers.set("Content-Type", "application/json");
// headers.set("token", toke);
// headers.set("product",product);
// headers.set("appKey", appKey);
// return headers;
// }
public void sendMessage( String toke,String product,String appKey, List<PushMsgParam> pushMsgParam){
public void sendMessage( String toke,String product,String appKey, List<PushMsgParam> pushMsgParam){
try {
pushMsgParam.forEach(action->{
sendJP(action);
......@@ -50,7 +21,8 @@ public class PushFeignServer {
}
}
public void sendMessage( String toke,String product,String appKey, PushMsgParam pushMsgParam){
public void sendMessage( String toke,String product,String appKey, PushMsgParam pushMsgParam){
try {
sendJP(pushMsgParam);
} catch (Exception e) {
......@@ -64,6 +36,7 @@ public class PushFeignServer {
model.setTitle(pushMsgParam.getSubject());
model.setBody(pushMsgParam.getContent());
model.setMsgType("patrolSystem");
model.setIsSendApp(true);
model.setRecivers(pushMsgParam.getRecivers());
model.setExtras(pushMsgParam.getExtras());
Systemctl.messageClient.create(model);
......
package com.yeejoin.amos.patrol.mqtt;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqxListener;
import java.util.Map;
/**
* @author DELL
*/
@Component
@Slf4j
public class PatrolMqttListener extends EmqxListener {
@Value("${patrol.point.classify.topic}")
private String pointClassifyTopic;
@Autowired
private IPointService iPointService;
@Override
public void processMessage(String topic, MqttMessage message) {
if(log.isInfoEnabled()){
log.info("收到消息主题:{},消息内容:{}",topic, message.toString());
}
try {
Map<String, Object> msg = JSON.parseObject(message.toString());
if (pointClassifyTopic.equals(topic)) {
iPointService.syncPointClassify(msg);
}
log.info("巡检对象同步完成");
} catch (Exception e) {
log.info("巡检对象同步失败:{}", e.getMessage());
}
}
}
......@@ -3,6 +3,9 @@ package com.yeejoin.amos.supervision.business.param;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Data
public class PushMsgParam {
......@@ -41,6 +44,8 @@ public class PushMsgParam {
* jpush发送类型:1:广播;2:标签;3:别名
*/
private String type = "3";
private String relationId;
public String getType() {
return type;
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
......@@ -30,6 +31,7 @@ import com.yeejoin.amos.supervision.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.supervision.business.vo.CheckInfoVo;
import com.yeejoin.amos.supervision.business.vo.CheckVo;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.*;
......@@ -48,7 +50,9 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import javax.transaction.Transactional;
......@@ -99,6 +103,12 @@ public class CheckServiceImpl implements ICheckService {
IPlanTaskService planTaskService;
@Autowired
private IPlanService planService;
@Autowired
private AsyncTask asyncTask;
@Autowired
DangerFeignClient DangerFeignClient;
@Autowired
......@@ -1422,7 +1432,6 @@ public class CheckServiceImpl implements ICheckService {
if (!depName.contains(personIdentity.getCompanyName())) {
check.setDepName(depName + "," + personIdentity.getCompanyName());
}
}
List<CheckInputParam> list = recordParam.getCheckItems();
......@@ -1568,6 +1577,12 @@ public class CheckServiceImpl implements ICheckService {
planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(),
recordParam.getPlanTaskId(), mtUserSeq, userName, size, planTaskStatus);
Plan plan = planService.queryPlanById(planTask.getPlanId());
// 计划完成,发送消息
if (PlanStatusEnum.COMPLETED.getValue() == plan.getStatus()){
asyncTask.sendPlanMsgToLeadPeople(RequestContext.cloneRequestContext(), plan);
}
// p_plan_task_detail更新隐患个数
planTaskDetailMapper.updateDanger(Long.parseLong(detail.get("planTaskDetailId").toString()));
......
......@@ -233,9 +233,10 @@ public class MessageServiceImpl implements IMessageService {
extras.put("type",MsgTypeEnum.CHECK.getCode());
extras.put("id",checkMsgBo.getCheckId()+"");
pushMsgParam.setExtras(extras);
pushMsgParam.setRelationId(checkMsgBo.getCheckId()+"");
pmps.add(pushMsgParam);
List<Msg> msgList =createMsg(jpushUser,checkMsgBo);
pushFeignServer.sendMessage( toke, product, appKey,pmps);
pushFeignServer.sendMessage(pmps);
}
}
......@@ -312,10 +313,11 @@ public class MessageServiceImpl implements IMessageService {
extras.put("type",msg.getMsgType());
extras.put("id",msg.getRelationId()==null?"0":msg.getRelationId().toString());
pushMsg.setExtras(extras);
pushMsg.setRelationId(msg.getRelationId()==null?"0":msg.getRelationId().toString());
pmps.add(pushMsg);
msg.setSendTime(new Date());
msg.setStatus(1);
pushFeignServer.sendMessage( toke, product, appKey,pmps);
pushFeignServer.sendMessage(pmps);
iMsgDao.save(msg);
return msg;
}
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......@@ -22,7 +21,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -44,6 +42,9 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
@Autowired
WorkflowFeignService workflowFeignService;
@Autowired
private PlanServiceImpl planService;
@Override
@Transactional
public Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception {
......@@ -72,6 +73,7 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
planAuditLog.setFlowJson(condition);
planAuditLog.setRoleName(roleName);
planAuditLogDao.save(planAuditLog);
planService.getUserIdsByWorkflow(plan, instanceId);
return Boolean.TRUE;
}
}
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanMapper;
......@@ -15,6 +19,7 @@ import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum;
import com.yeejoin.amos.supervision.common.enums.WorkFlowBranchEnum;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
import com.yeejoin.amos.supervision.core.common.request.AddPlanRequest;
import com.yeejoin.amos.supervision.core.common.response.PlanPointRespone;
import com.yeejoin.amos.supervision.core.util.DateUtil;
......@@ -30,6 +35,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
......@@ -74,6 +80,12 @@ public class PlanServiceImpl implements IPlanService {
private IWorkflowExcuteService workflowExcuteService;
@Autowired
private AsyncTask asyncTask;
@Autowired
WorkflowFeignService workflowFeignService;
@Autowired
private IPlanAuditDao planAuditDao;
@Autowired
......@@ -132,38 +144,38 @@ public class PlanServiceImpl implements IPlanService {
public void addPlan(HashMap<String, Object> map, ReginParams reginParams) throws Exception {
// 新增路线
AddPlanRequest addPlanRequest = (AddPlanRequest) map.get("param");
Plan param = addPlanRequest.getPlan();
Plan plan = addPlanRequest.getPlan();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String orgCode = map.get("org_code") == null ? "" : map.get("org_code").toString();
String userId = personIdentity.getPersonSeq();
param.setOrgCode(orgCode);
param.setNextGenDate(DateUtil.getIntervalDate(new Date(), 0));
param.setCreateBy(userId);
addPlanRequest.setPlan(param);
plan.setOrgCode(orgCode);
plan.setNextGenDate(DateUtil.getIntervalDate(new Date(), 0));
plan.setCreateBy(userId);
addPlanRequest.setPlan(plan);
Route route = save(addPlanRequest);
if (!ObjectUtils.isEmpty(route)) {
param.setRouteId(route.getId());
plan.setRouteId(route.getId());
//编辑计划
if (param.getId() > 0) {
Plan oriPlan = planDao.findById(param.getId()).get();
param.setCreateDate(oriPlan.getCreateDate());
param.setCreateBy(oriPlan.getCreateBy());
param.setLastUpdBy(userId);
param.setFirstFlag(XJConstant.PLAN_FIRST_STATUS_YES);
if (plan.getId() > 0) {
Plan oriPlan = planDao.findById(plan.getId()).get();
plan.setCreateDate(oriPlan.getCreateDate());
plan.setCreateBy(oriPlan.getCreateBy());
plan.setLastUpdBy(userId);
plan.setFirstFlag(XJConstant.PLAN_FIRST_STATUS_YES);
}
if (XJConstant.FIX_DATE_NO.equals(param.getIsFixedDate()) && (XJConstant.PLAN_TYPE_MONTH.equals(param.getPlanType()) || XJConstant.PLAN_TYPE_YEAR.equals(param.getPlanType()))) {
param.setDayBegin(DateUtil.formatStrToTime("00:00:00"));
param.setDayEnd(DateUtil.formatStrToTime("23:59:59"));
if (XJConstant.FIX_DATE_NO.equals(plan.getIsFixedDate()) && (XJConstant.PLAN_TYPE_MONTH.equals(plan.getPlanType()) || XJConstant.PLAN_TYPE_YEAR.equals(plan.getPlanType()))) {
plan.setDayBegin(DateUtil.formatStrToTime("00:00:00"));
plan.setDayEnd(DateUtil.formatStrToTime("23:59:59"));
}
planDao.save(param);
Integer status = param.getStatus();
planDao.save(plan);
Integer status = plan.getStatus();
if (status != null && status == 1) {
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(param.getCheckTypeId());
DangerCheckTypeLevelEnum levelEnum = DangerCheckTypeLevelEnum.getEumByCode(param.getCheckLevel());
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId());
DangerCheckTypeLevelEnum levelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
String branch = workFlowExcuteBranch(levelEnum.getCondition(), checkTypeSuEnum.getCondition());
try {
String processInstanceId;
PlanAudit audit = planAuditDao.findByPlanId(param.getId());
PlanAudit audit = planAuditDao.findByPlanId(plan.getId());
if (audit != null) {
//执行一步
processInstanceId = audit.getProcessInstanceId();
......@@ -171,20 +183,22 @@ public class PlanServiceImpl implements IPlanService {
//更新时间
audit.setUpdateDate(new Date());
planAuditDao.save(audit);
this.getUserIdsByWorkflow(plan, processInstanceId);
//记录执行流水-启动节点
insertAuditLog(reginParams, param, personIdentity, audit);
insertAuditLog(reginParams, plan, personIdentity, audit);
} else {
//启动
processInstanceId = workflowExcuteService.startAndComplete(processDefinitionKey, branch);
audit = new PlanAudit();
audit.setPlanId(param.getId());
audit.setPlanId(plan.getId());
audit.setBusinessKey(String.valueOf(sequence.nextId()));
audit.setProcessDefinitionKey(processDefinitionKey);
audit.setProcessInstanceId(processInstanceId);
audit.setStartUserId(userId);
planAuditDao.save(audit);
//记录执行流水-启动节点
insertAuditLog(reginParams, param, personIdentity, audit);
insertAuditLog(reginParams, plan, personIdentity, audit);
this.getUserIdsByWorkflow(plan, processInstanceId);
}
} catch (Exception e) {
log.error("=============防火监督,计划提交,工作流启动失败!!!=============");
......@@ -193,6 +207,30 @@ public class PlanServiceImpl implements IPlanService {
}
}
/**
* 根据工作流获取下一审核人角色下的所有用户ID
* @return
*/
protected List<String> getUserIdsByWorkflow (Plan plan, String processInstanceId){
List<String> userIds = new ArrayList<>();
JSONObject teskObject = workflowFeignService.getTaskList(processInstanceId);
JSONArray taskDetailArray = teskObject.getJSONArray(WorkFlowEnum.DATA.getCode());
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
JSONArray informerList = detail.getJSONArray(WorkFlowEnum.INFORMERLIST.getCode());
if (informerList.size() > 0) {
userIds = informerList.stream().map(item -> {
JSONObject jsonItem = (JSONObject) item;
return jsonItem.getString("userId");
}).collect(Collectors.toList());
asyncTask.sendAddPlanMsg(RequestContext.cloneRequestContext(), plan, userIds, true, false);
} else {
asyncTask.sendPlanMsgToLeadPeople(RequestContext.cloneRequestContext(), plan);
}
}
return userIds;
}
private void insertAuditLog(ReginParams reginParams, Plan param, ReginParams.PersonIdentity personIdentity, PlanAudit audit) {
PlanAuditLog planAuditLog = new PlanAuditLog();
planAuditLog.setPlanAuditId(audit.getId());
......
......@@ -532,7 +532,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 2.保存执行数据明细表
planTaskDetail.saveAndFlush(planTaskDetailInstance);
// 推送消息
asyncTask.sendPlanMsg(RequestContext.cloneRequestContext(), plan, planId);
asyncTask.sendPlanMsg(RequestContext.cloneRequestContext(), plan);
}
// 定时任务监控
jobService.planTaskAddJob(planTask);
......
......@@ -14,6 +14,7 @@ import com.yeejoin.amos.supervision.business.entity.mybatis.MsgSubscribeBo;
import com.yeejoin.amos.supervision.business.param.PushMsgParam;
import com.yeejoin.amos.supervision.business.service.intfc.IMessageService;
import com.yeejoin.amos.supervision.business.service.intfc.ISafety3DDataSendService;
import com.yeejoin.amos.supervision.business.util.DateUtil;
import com.yeejoin.amos.supervision.business.util.Toke;
import com.yeejoin.amos.supervision.common.enums.JPushTypeEnum;
import com.yeejoin.amos.supervision.common.enums.MsgSubscribeEnum;
......@@ -45,6 +46,8 @@ import java.util.concurrent.Future;
public class AsyncTask {
private final Logger log = LoggerFactory.getLogger(AsyncTask.class);
private final String msgType = "supervision";
@Autowired
private ISafety3DDataSendService safety3DDataSend;
......@@ -304,15 +307,42 @@ public class AsyncTask {
}
/**
* 计划任务消息
* 提交计划任务消息
* @param requestContextModel
* @param plan
* @param userIds 发送用户id集合
* @param isSendWeb 发送web标识
* @param isSendApp 发送app标识
*/
@Async
public void sendPlanMsg(RequestContextModel requestContextModel, Plan plan, long planId){
public void sendAddPlanMsg(RequestContextModel requestContextModel, Plan plan, List<String> userIds, boolean isSendWeb, boolean isSendApp){
MessageModel model = new MessageModel();
model.setTitle(plan.getName());
String body = String.format("任务批号:%s;类型:%s;执行人:%s",
planId, plan.getCheckTypeName(), plan.getMakerUserName());
String body = String.format("计划名称:%s;检查类型:%s;推送时间:%s",
plan.getName(), plan.getCheckTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
try {
model.setIsSendWeb(isSendWeb);
model.setIsSendApp(isSendApp);
model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(userIds);
remoteSecurityService.addMessage(requestContextModel, model);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 发送消息至检查组长
* @param plan
*/
@Async
public void sendPlanMsgToLeadPeople(RequestContextModel requestContextModel, Plan plan){
MessageModel model = new MessageModel();
model.setTitle(plan.getName());
String body = String.format("计划名称:%s;检查类型:%s;推送时间:%s",
plan.getName(), plan.getCheckTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
String leadPeopleIds = plan.getLeadPeopleIds();
if (!ValidationUtil.isEmpty(plan.getUserId()) && !leadPeopleIds.contains(plan.getUserId())){
......@@ -320,9 +350,37 @@ public class AsyncTask {
}
try {
List<String> recivers = remoteSecurityService.getAmosIdListByUserIds(requestContextModel, leadPeopleIds);
model.setIsSendWeb(true);
model.setIsSendApp(true);
model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(recivers);
remoteSecurityService.addMessage(requestContextModel, model);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 发送消息至检查组员
* @param plan
*/
@Async
public void sendPlanMsg(RequestContextModel requestContextModel, Plan plan){
MessageModel model = new MessageModel();
model.setTitle(plan.getName());
String body = String.format("计划名称:%s;检查类型:%s;推送时间:%s",
plan.getName(), plan.getCheckTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
String leadPeopleIds = plan.getLeadPeopleIds();
if (!ValidationUtil.isEmpty(plan.getUserId()) && !leadPeopleIds.contains(plan.getUserId())){
leadPeopleIds += "," + plan.getUserId();
}
try {
List<String> recivers = remoteSecurityService.getAmosIdListByUserIds(requestContextModel, leadPeopleIds);
model.setIsSendApp(true);
model.setIsSendWeb(true);
model.setMsgType("supervision");
model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(recivers);
remoteSecurityService.addMessage(requestContextModel, model);
......@@ -349,5 +407,4 @@ public class AsyncTask {
}
return afterFilterUserIds;
}
}
......@@ -2,49 +2,43 @@ package com.yeejoin.amos.supervision.feign;
import java.util.List;
import com.yeejoin.amos.supervision.business.util.CommonResponse;
import com.yeejoin.amos.supervision.business.util.CommonResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.supervision.business.param.PushMsgParam;
@Service("pushFeignServer")
public class PushFeignServer {
@Autowired
private RestTemplate restTemplate;
@Value("${Push.fegin.name}")
private String RPushFeginName;
private static String sendMessage = "/api/user/sendMessage";
public String geturls(String url){
return "http://"+RPushFeginName+url;
}
public HttpHeaders getHeader(String toke,String product,String appKey){
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("token", toke);
headers.set("product",product);
headers.set("appKey", appKey);
return headers;
}
public CommonResponse sendMessage(String toke, String product, String appKey, List<PushMsgParam> pushMsgParam){
try {
HttpEntity httpEntity = new HttpEntity<>(pushMsgParam, getHeader( toke, product, appKey));
CommonResponse commonResponse1 = restTemplate.postForObject(geturls(sendMessage),httpEntity, CommonResponse.class);
return commonResponse1;
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure("发送失败");
}
}
public void sendMessage(List<PushMsgParam> pushMsgParam){
try {
pushMsgParam.forEach(action->{
sendJP(action);
});
} catch (Exception e) {
e.printStackTrace();
}
}
public void sendMessage(PushMsgParam pushMsgParam){
try {
sendJP(pushMsgParam);
} catch (Exception e) {
e.printStackTrace();
}
}
private void sendJP(PushMsgParam pushMsgParam){
MessageModel model = new MessageModel();
model.setRelationId(pushMsgParam.getRelationId());
model.setTitle(pushMsgParam.getSubject());
model.setBody(pushMsgParam.getContent());
model.setMsgType("supervision");
model.setIsSendApp(true);
model.setIsSendWeb(true);
model.setRecivers(pushMsgParam.getRecivers());
model.setExtras(pushMsgParam.getExtras());
Systemctl.messageClient.create(model);
}
}
......@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.tzs.api.service.IUseUnitService;
import com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
......@@ -44,6 +45,7 @@ import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TemplateExportServiceIm
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatRelationServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -71,7 +73,10 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -125,6 +130,10 @@ public class AlertCalledController extends BaseController {
@Value("${mqtt.topic.alertInfo.push}")
private String alertInfopushTopic;
@Autowired
TzsAuthService tzsAuthService;
/**
* 新增警情接警填报记录
*
......@@ -172,8 +181,7 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveMobile")
@ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录")
public ResponseModel<AlertCalledDto> saveMobile(@RequestBody AlertCalledDto alertCalledDto
) {
public ResponseModel<AlertCalledDto> saveMobile(@RequestBody AlertCalledDto alertCalledDto) {
if (ValidationUtil.isEmpty(alertCalledDto)) {
throw new BadRequest("参数校验失败.");
}
......@@ -207,6 +215,7 @@ public class AlertCalledController extends BaseController {
alertCalledDto.setEquipmentClassification("电梯");
alertCalledDto.setEquipmentClassificationCode("3000");
alertCalledDto.setCity(elevator.getCity());
alertCalledDto.setRegionCode(elevator.getRegionCode());
alertCalledDto.setDistrict(elevator.getDistrict());
AlertCalledDto alertCalledDtoReturn = iAlertCalledService.createAlertCalled(alertCalledDto);
return ResponseHelper.buildResponse(alertCalledDtoReturn);
......@@ -661,5 +670,84 @@ public class AlertCalledController extends BaseController {
}
/**
* 根据regionCode 获取区域内实时警情
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getActualAlert")
@ApiOperation(httpMethod = "GET", value = "根据regionCode 获取区域内实时警情", notes = "根据regionCode 获取区域内实时警情")
public ResponseModel<List<AlertPaperInfoDto>> getActualAlert(@RequestParam(name = "regionCodes", required = false) List<String> regionCodes) {
// 警情id 警情地址 警情状态 警情类型 警情发生时间
List<String> useRegionCode = tzsAuthService.getUserRegionCode();
if(regionCodes == null) {
regionCodes = useRegionCode;
} else {
// 判断传入regionCodes 是否越权
List<String> tempList = new ArrayList<>();
Iterator<String> regionIt = regionCodes.iterator();
while(regionIt.hasNext()) {
String tempCode = regionIt.next();
String districtCode = tempCode.substring(4,6);
if("00".equals(districtCode)) { // 为市
if(!useRegionCode.contains(tempCode)) { // 不包含该市权限 需要移除市搜索条件 添加 该市下区搜索条件
for(String tempUsercode : useRegionCode) {
if(tempUsercode.indexOf(tempCode.substring(0,4)) != -1) {
tempList.add(tempUsercode);
}
}
regionIt.remove();
}
} else { // 为区 不会出现越权情况
}
}
for (String t : tempList) {
regionCodes.add(t);
}
}
return ResponseHelper.buildResponse(iAlertCalledService.getAlertPaperInfoList(regionCodes,false));
}
/**
* 根据regionCode 获取区域内历史警情 七日内
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getHistoryAlert")
@ApiOperation(httpMethod = "GET", value = "根据regionCode 获取区域内七日内历史警情", notes = "根据regionCode 获取区域内七日内历史警情")
public ResponseModel<List<AlertPaperInfoDto>> getHistoryAlert(@RequestParam(name = "regionCodes", required = false) List<String> regionCodes) {
// 警情id 警情地址 警情状态 警情类型 警情发生时间
// 获取自己的regionCode
List<String> useRegionCode = tzsAuthService.getUserRegionCode();
if(regionCodes == null) {
regionCodes = useRegionCode;
} else {
// 判断传入regionCodes 是否越权
List<String> tempList = new ArrayList<>();
Iterator<String> regionIt = regionCodes.iterator();
while(regionIt.hasNext()) {
String tempCode = regionIt.next();
String districtCode = tempCode.substring(4,6);
if("00".equals(districtCode)) { // 为市
if(!useRegionCode.contains(tempCode)) { // 不包含该市权限 需要移除市搜索条件 添加 该市下区搜索条件
for(String tempUsercode : useRegionCode) {
if(tempUsercode.indexOf(tempCode.substring(0,4)) != -1) {
tempList.add(tempUsercode);
}
}
regionIt.remove();
}
} else { // 为区 不会出现越权情况
}
}
for (String t : tempList) {
regionCodes.add(t);
}
}
return ResponseHelper.buildResponse(iAlertCalledService.getAlertPaperInfoList(regionCodes,true));
}
}
......@@ -259,8 +259,7 @@ public class ElevatorController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/query_elevator_list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "分页查询电梯信息", notes = "分页查询电梯信息")
public ResponseModel<IPage<ElevatorDto>> queryElevatorList(String pageNum, String pageSize,
com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto elevatorDto) {
public ResponseModel<IPage<ElevatorDto>> queryElevatorList(String pageNum, String pageSize,com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto elevatorDto) {
Elevator elevator = BeanDtoVoUtils.convert(elevatorDto, Elevator.class);
Page<Elevator> pageBean;
QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
......
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 特种设备权限controller
*/
@RestController
@Api(tags = "特种设备权限Api")
@RequestMapping(value = "/tzs-auth-api")
public class TzsAuthController extends BaseController {
@Autowired
TzsAuthService tzsAuthService;
/**
* 判断用户是否是管理员
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/isUserAdmin")
@ApiOperation(httpMethod = "GET", value = "判断用户是否是管理员", notes = "判断用户是否是管理员")
public ResponseModel<Boolean> isUserAdmin() {
Boolean flag = false;
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
if(me.getUserName().equals("tzs_wjl")) {
flag = true;
}
return ResponseHelper.buildResponse(flag);
}
/**
* 获取用户regionCode
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegincode")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getUserRegincode() {
List<String> regionList = new ArrayList<>();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
regionList.add("610100");
regionList.add("610300");
regionList.add("610725");
regionList.add("610822");
return ResponseHelper.buildResponse(regionList);
}
/**
* 获取用户组织机构树
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserReginTree")
@ApiOperation(httpMethod = "GET", value = "获取用户组织机构树", notes = "获取用户组织机构树")
public ResponseModel<Collection<RegionModel>> getUserReginTree() {
List<String> regionList = new ArrayList<>();
regionList.add("610100");
regionList.add("610300");
regionList.add("610725");
regionList.add("610822");
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
List<RegionModel> tree = (List<RegionModel>) Systemctl.regionClient.queryForTree(null).getResult();
// 循环list 将List 封装为 省市区 SET
Set<String> city = new HashSet<>();
Set<String> district = new HashSet<>();
for(String regionCode : regionList) {
// 判断是否是某个县
String districtCode = regionCode.substring(4,6);
if("00".equals(districtCode)) { // 为市
city.add(regionCode);
} else { // 为区
district.add(regionCode);
}
}
// 判断市区是否存在区域码的市,如果存在则移除区
Iterator<String> disIt = district.iterator();
while(disIt.hasNext()) {
String regionCode = disIt.next();
String tempCity = regionCode.substring(0,4) + "00";
if(city.contains(tempCity)) {
disIt.remove();
}
}
// 将tree 转换为K-V形式便于处理
Map<Integer, RegionModel> tempMap = new HashMap<Integer, RegionModel>();
RegionModel start = tree.get(0); // 省
setMap(tempMap,start);
List<RegionModel> newTree = new ArrayList<RegionModel>();
List<RegionModel> newCity = new ArrayList<RegionModel>();
// 如果管理市 取得整个市的数据 如果管理某个县 取得某市某县数据
Map<String, RegionModel> tempCityMap = new HashMap<String, RegionModel>();
for(String regionCode : district) {
// 先拿市 再封装新的城市
String cityCode = regionCode.substring(0,4) + "00";
RegionModel tempCity = tempCityMap.get(cityCode);
if(tempCity == null) {
List<RegionModel> tempDisList = new ArrayList<RegionModel>();
tempDisList.add(tempMap.get(Integer.parseInt(regionCode)));
tempCity = tempMap.get(Integer.parseInt(cityCode));
tempCity.setChildren(tempDisList);
tempCityMap.put(cityCode,tempCity);
} else {
List<RegionModel> tempDisList = (List<RegionModel>) tempCity.getChildren();
tempDisList.add(tempMap.get(Integer.parseInt(regionCode)));
}
}
for(String regionCode : city) {// 获取城市
newCity.add(tempMap.get(Integer.parseInt(regionCode)));
}
// 拼接城市
for(Map.Entry<String, RegionModel> entries : tempCityMap.entrySet()) {
newCity.add(entries.getValue());
}
start.setChildren(newCity);
newTree.add(start);
return ResponseHelper.buildResponse(newTree);
}
private void setMap(Map<Integer, RegionModel> tempMap, RegionModel start) {
tempMap.put(start.getRegionCode(),start);
if(start.getChildren() != null) {
List<RegionModel> children = (List<RegionModel>) start.getChildren();
for (RegionModel temp : children) {
setMap(tempMap,temp);
}
}
}
}
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.VoiceRecordFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -29,13 +36,9 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
......@@ -55,36 +58,6 @@ public class VoiceRecordFileController extends BaseController {
@Autowired
AlertCalledServiceImpl iAlertCalledService;
/**
* 新增通话记录附件
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增通话记录附件", notes = "新增通话记录附件")
public ResponseModel<VoiceRecordFileDto> save(@RequestBody VoiceRecordFileDto model) {
if (ValidationUtil.isEmpty(model.getAlertId())
|| ValidationUtil.isEmpty(model.getTel())){
throw new BadRequest("参数校验失败.");
}
Calendar startTime = Calendar.getInstance();
Calendar endTime = Calendar.getInstance();
endTime.add(Calendar.MINUTE, 6);
model.setTelStartTime(startTime.getTime());
model.setTelEndTime(endTime.getTime());
model.setFilePath(UUID.randomUUID().toString().replace("-",""));
model.setFileType("");
model.setSourceId(-1l);
AlertCalledFormDto alertDto = iAlertCalledService.selectAlertCalledByIdNoCache(model.getAlertId());
if(alertDto == null || alertDto.getAlertCalledDto() == null) {
throw new BadRequest("未找到相关警情");
}
model.setAlertStage(alertDto.getAlertCalledDto().getAlertStage());
model.setAlertStageCode(alertDto.getAlertCalledDto().getAlertStageCode());
model = voiceRecordFileServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据警情id 查找通话记录信息
......@@ -104,14 +77,25 @@ public class VoiceRecordFileController extends BaseController {
VoiceRecordFileDto target = new VoiceRecordFileDto();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(voiceRecord, target);
if(voiceRecord.getTelStartTime() != null && voiceRecord.getTelEndTime() != null) {
target.setTelTime(DateUtils.getTimestr( voiceRecord.getTelEndTime(),voiceRecord.getTelStartTime()));
}
dtoList.add(target);
});
return ResponseHelper.buildResponse(dtoList);
}
/**
* 根据警情id 查找通话记录信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "根据id获取通话记录信息", notes = "根据id获取通话记录信息")
@GetMapping(value = "/{sequenceNbr}")
public ResponseModel<VoiceRecordFileDto> getRecordById(@PathVariable Long sequenceNbr) {
VoiceRecordFileDto record = voiceRecordFileServiceImpl.getRecordById(sequenceNbr);
return ResponseHelper.buildResponse(record);
}
/**
* 新增-通话记录
......@@ -132,4 +116,38 @@ public class VoiceRecordFileController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询通话记录", notes = "查询通话记录")
@GetMapping("/selectRecord")
public ResponseModel<Page<VoiceRecordFileDto>> queryVoiceCodeByPager(VoiceRecordFileDto model,
@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort ) {
Page<VoiceRecordFileDto> page = new Page<VoiceRecordFileDto>();
page.setCurrent(pageNum);
page.setSize(pageSize);
String sortParam = "";
String sortRule = "";
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
sortParam = RedisKey.humpToLine(date[0]);
sortRule = "asc";
}else {
sortParam =RedisKey.humpToLine(date[0]);
sortRule = "desc";
}
}else {
sortParam = "call_time";
sortRule = "desc";
}
Page<VoiceRecordFileDto> pageBean = voiceRecordFileServiceImpl.queryRecordListByQueryDto(page,
model.getTelStartTimeStr(),model.getTelEndTimeStr(),model.getFileType(),model.getTel(),
model.getWorkNum(),sortParam,sortRule);
Page<VoiceRecordFileDto> result = new Page<VoiceRecordFileDto>(pageNum,pageSize);
long totle = pageBean.getTotal();
result.setRecords(pageBean.getRecords());
result.setTotal(totle);
return ResponseHelper.buildResponse(result);
}
}
......@@ -486,6 +486,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled.setEquipmentId(elevator.getSequenceNbr());
alertCalled.setCity(elevator.getCity());
alertCalled.setDistrict(elevator.getDistrict());
alertCalled.setRegionCode(elevator.getRegionCode());
this.save(alertCalled);
// 动态表单
......@@ -670,4 +671,15 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// }
// }
}
public List<AlertPaperInfoDto> getAlertPaperInfoList(List<String> regionCodes, Boolean isHistory) {
List<AlertPaperInfoDto> temp = baseMapper.getAlertPaperInfoList(regionCodes, isHistory);
temp.stream().forEach(t -> {
DispatchPaper paper = dispatchPaperService.getOne(new LambdaQueryWrapper<DispatchPaper>().eq(DispatchPaper::getIsDelete,false).eq(DispatchPaper::getAlertId,t.getAlertId()));
if(paper != null) {
t.setFinishTime(paper.getFeedbackFinishTime());
}
});
return temp;
}
}
\ No newline at end of file
......@@ -7,6 +7,8 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -85,6 +87,7 @@ public class CtiServiceImpl implements ICtiService {
String token = this.getAccessToken();
// gid code extphone 目前写死 后面根据用户获取
String gid = "61,默认,0";
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
String code = "1001";
String extphone = "10001001";
String loginUrl = ctiUrl + "/cti/login" + "?accessToken=" + token;
......@@ -133,7 +136,7 @@ public class CtiServiceImpl implements ICtiService {
JSONArray loginData = response.getJSONArray("data");
return loginData;
} catch (Exception e) {
throw new BadRequest("获取loginData 出错:" + e.getMessage());
throw new BadRequest("获取话单出错: " + e.getMessage());
}
} else { //登陆失败
throw new BadRequest("获取话单出错:" + response.getString("msg"));
......
......@@ -138,13 +138,16 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
}
// 封装设备类别 使用场所 和 使用状态
EquipmentCategory equipmentCategory = equipmentCategoryServiceImpl.getOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode,elevatorDto.getCategory()));
elevatorDto.setCategoryName(equipmentCategory.getName());
if(equipmentCategory != null) {
elevatorDto.setCategoryName(equipmentCategory.getName());
}
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", "USE_SITE_CATEGORY").eq("code", elevatorDto.getUseSiteCategory());
DataDictionary useSiteCategory = iDataDictionaryService.getOne(queryWrapper);
elevatorDto.setUseSiteCategoryName(useSiteCategory.getName());
if(useSiteCategory != null) {
elevatorDto.setUseSiteCategoryName(useSiteCategory.getName());
}
if(elevatorDto.getUseStatus() == 1) {
elevatorDto.setUseStatusStr("在用");
} else {
......
......@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchPaperFormDto;
......@@ -79,6 +81,10 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
@Value("${mqtt.topic.alertMatrix.push}")
private String alertMatrixpushTopic;
@Autowired
ISourceFileService sourceFileService;
/**
* 记录处置日志同时修改案件的状态
* @param alertId
......@@ -109,6 +115,7 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
String content = template.getContent();
String createTime = DateUtils.getDateNowString();
DispatchPaperEnums CZHJ = null;
StringBuffer attach = new StringBuffer();
// 公众号生成接警记录
if(AlertStageEnums.JJ.getCode().equals(type)) {
// 接警的处置环节为已接警
......@@ -142,6 +149,15 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
throw new BadRequest("警情类型缺失");
content = content.replace("$createTime",createTime).replace("$call",emergency_call);
content = content.replace("$area",area).replace("$alertType",alertType);
// 小程序接警 记录添加图片附件 bykongfm 2021-11-02 task-4217
Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(alertId);
List<AttachmentDto> mapList = imgMap.get("imgs");
if(mapList != null && mapList.size() > 0) {
mapList.stream().forEach(m -> {
attach.append(",");
attach.append(m.getUrl());
});
}
} else if(TzsCommonParam.PQ.equals(type)) {
// 派遣的处置环节为已派遣
CZHJ = DispatchPaperEnums.dispatched;
......@@ -216,6 +232,15 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
// 反馈方式从动态表单中取得
String FKFS = tempMap.get("FKFS") == null ? "" : tempMap.get("FKFS");
content = content.replace("$FKFS",FKFS).replace("$fixResult",tempMap.get("fixResult"));
// 小程序维修反馈 记录添加图片附件 bykongfm 2021-11-02 task-4217
Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(dispatchTask.getPaperId());
List<AttachmentDto> mapList = imgMap.get("imgs");
if(mapList != null && mapList.size() > 0) {
mapList.stream().forEach(m -> {
attach.append(",");
attach.append(m.getUrl());
});
}
} else if(TzsCommonParam.WXFK_TS.equals(type)) { //从派遣单获取数据
//投诉的维修反馈修改成维保已处置
CZHJ = DispatchPaperEnums.disposed;
......@@ -235,6 +260,15 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
});
content = content.replace("$FKFS",tempMap.get(TzsCommonParam.FKFS)).replace("$fixResult",tempMap.get("fixResult"));
type = TzsCommonParam.WXFK;
// 小程序维修反馈 记录添加图片附件 bykongfm 2021-11-02 task-4217
Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(dispatchTask.getPaperId());
List<AttachmentDto> mapList = imgMap.get("imgs");
if(mapList != null && mapList.size() > 0) {
mapList.stream().forEach(m -> {
attach.append(",");
attach.append(m.getUrl());
});
}
} else if(TzsCommonParam.BXFK.equals(type)) {
//报修反馈
CZHJ = DispatchPaperEnums.reportorBack;
......@@ -249,6 +283,15 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
}
});
content = content.replace("$FKFS",dispatchPaperFormDto.getDispatchPaper().getFeedbackType()).replace("$feedbackResult",tempMap.get("feedbackResult"));
// 小程序报修人反馈 记录添加图片附件 bykongfm 2021-11-02 task-4217
Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(alertId);
List<AttachmentDto> mapList = imgMap.get("feedbacks");
if(mapList != null && mapList.size() > 0) {
mapList.stream().forEach(m -> {
attach.append(",");
attach.append(m.getUrl());
});
}
} else if(TzsCommonParam.TSRFK.equals(type)) {
//投诉人已反馈
CZHJ = DispatchPaperEnums.complainantBack;
......@@ -263,12 +306,25 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
}
});
content = content.replace("$FKFS",dispatchPaperFormDto.getDispatchPaper().getFeedbackType()).replace("$feedbackResult",tempMap.get("feedbackResult"));
// 小程序投诉人反馈记录添加图片附件 bykongfm 2021-11-02 task-4217
Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(alertId);
List<AttachmentDto> mapList = imgMap.get("feedbacks");
if(mapList != null && mapList.size() > 0) {
mapList.stream().forEach(m -> {
attach.append(",");
attach.append(m.getUrl());
});
}
}
AlertStageEnums RZHJ = AlertStageEnums.getEnumByCode(type);
repairConsult.setType(RZHJ.getCode());
repairConsult.setAlertStageCode(RZHJ.getId());
repairConsult.setAlertStatus(RZHJ.getValue());
repairConsult.setDescription(content);
if(attach.length() > 0) {
String attachment = attach.toString().substring(1);
repairConsult.setAttachment(attachment);
}
flag = this.save(repairConsult);
if(flag) {
// 记录处置记录后修改 案件状态
......@@ -296,7 +352,4 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
return flag;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DutySeatDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.FormValue;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 特种设备权限服务实现类
*/
@Service
public class TzsAuthServiceImpl implements TzsAuthService {
@Override
public List<String> getUserRegionCode() {
List<String> regionList = new ArrayList<>();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
regionList.add("610100");
regionList.add("610822");
return regionList;
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordFileMapper;
......@@ -92,6 +93,8 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
} catch (Exception e) {
logger.error("日期转换错误");
}
int times = recordInfo.getIntValue("times");
model.setTelTime(DateUtils.secondsToTimeStr(times));
model.setTelStartTime(telStartTime);
model.setTelEndTime(telEndTime);
if(1 == recordInfo.getInteger("callType")) {
......@@ -128,4 +131,24 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
}
@Override
public Page<VoiceRecordFileDto> queryRecordListByQueryDto(Page<VoiceRecordFileDto> page, String telStartTimeStr, String telEndTimeStr, String fileType, String tel, String workNum, String sortParam, String sortRule) {
Page<List<VoiceRecordFileDto>>list = baseMapper.queryRecordListByQueryDto(page,
telStartTimeStr,telEndTimeStr,fileType,tel,
workNum,sortParam,sortRule);
Page<VoiceRecordFileDto> page1 = new Page<>();
List<VoiceRecordFileDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(list.getRecords()),VoiceRecordFileDto.class);
page1.setCurrent(page.getCurrent());
page1.setSize(page.getSize());
page1.setTotal(list.getTotal());
page1.setRecords(resultDtoList);
return page1;
}
@Override
public VoiceRecordFileDto getRecordById(Long sequenceNbr) {
VoiceRecordFileDto record = baseMapper.getRecordById(sequenceNbr);
return record;
}
}
\ No newline at end of file
......@@ -1990,5 +1990,109 @@
</sql>
</changeSet>
</databaseChangeLog>
<changeSet author="chenzhao" id="2021-11-02-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template"/>
</preConditions>
<comment>update data jc_template</comment>
<sql>
UPDATE `jc_template` SET content ='【120急救】时间:callTime;地址:address;被困人数:trappedNum;伤亡人数:casualtiesNum;性别:gender;年龄段(岁):ageGroup;患者现状:patientStatus;情况说明:situation;警情阶段:alertStage' WHERE sequence_nbr=23;
</sql>
</changeSet>
<!-- <changeSet author="tw" id="2021-11-01-1">-->
<!-- <preConditions onFail="MARK_RAN">-->
<!-- <tableExists tableName="jc_alert_called"/>-->
<!-- </preConditions>-->
<!-- <comment>增加备注字段</comment>-->
<!-- <sql>-->
<!-- ALTER TABLE jc_alert_called ADD remark varchar(10000) NULL COMMENT '备注'-->
<!-- </sql>-->
<!-- </changeSet>-->
<changeSet author="chenhao" id="2021-11-02-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary"/>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions>
<comment>update data cb_data_dictionary</comment>
<sql>
INSERT INTO `cb_data_dictionary` (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1347', '1', '物联报警', 'WLBJ', NULL, NULL, NULL, NULL, NULL, '\0', '12');
INSERT INTO `cb_data_dictionary` (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1348', '1', '语音融合报警', 'YYRHBJ', NULL, NULL, NULL, NULL, NULL, '\0', '12');
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-11-02-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_firefighters" columnName="fire_team_name"/>
</not>
</preConditions>
<comment>update data cb_firefighters</comment>
<sql>
ALTER TABLE cb_firefighters ADD fire_team_name varchar(100) NULL COMMENT '消防队伍名称'
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-11-02-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_key_site" columnName="belong_name"/>
</not>
</preConditions>
<comment>update data cb_key_site</comment>
<sql>
ALTER TABLE cb_key_site ADD belong_name varchar(100) NULL COMMENT '所属单位/部门名称';
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-11-02-4">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_org_usr" columnName="parent_name"/>
</not>
</preConditions>
<comment>update data cb_org_usr</comment>
<sql>
ALTER TABLE cb_org_usr ADD parent_name varchar(100) NULL COMMENT '归属机构/部门/人员名称';
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-11-04-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_fire_team" columnName="parent_name"/>
</not>
</preConditions>
<comment>update data cb_fire_team</comment>
<sql>
ALTER TABLE cb_fire_team ADD parent_name varchar(100) NULL COMMENT '父级队伍名称';
</sql>
</changeSet>
<changeSet author="litw" id="2021-11-03-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="cb_water_resource_index"/>
</not>
</preConditions>
<comment>create table cb_water_resource_index</comment>
<sql>
CREATE TABLE `cb_water_resource_index` (
`sequence_nbr` bigint(20) NOT NULL,
`equipment_id` bigint(20) NULL COMMENT '指标拥有者ID:关联装备定义ID',
`water_id` bigint(20) NOT NULL COMMENT '消防水源id',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '名称',
`name_key` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT null,
`perf_value` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '指标值',
`rec_user_id` bigint(20) NOT NULL COMMENT '更新人id',
`rec_user_name` varchar(30) NOT NULL COMMENT '更新人名称',
`rec_date` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除(0:未删除,1:已删除)',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) COMMENT = '消防水源物联参数' ;
</sql>
</changeSet>
</databaseChangeLog>
package com.yeejoin.amos;
import com.yeejoin.amos.patrol.mqtt.PatrolMqttListener;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
......@@ -20,6 +24,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.config.JsonSerializerManage;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
......@@ -59,6 +64,15 @@ public class PatrolApplication {
return new RestTemplate();
}
@Autowired
private PatrolMqttListener patrolMqttListener;
@Autowired
private EmqKeeper emqKeeper;
@Value("${patrol.topic}")
private String patrolTopic;
/**
* 启动amosop-server
*
......@@ -81,4 +95,18 @@ public class PatrolApplication {
"----------------------------------------------------------");
}
/**
* 初始化MQTT
* @throws MqttException
*/
@Bean
void initMqtt() {
try {
emqKeeper.getMqttClient().subscribe(patrolTopic, 1, patrolMqttListener);
} catch (MqttException e) {
e.printStackTrace();
logger.error("EMQ初始化连接失败!");
}
}
}
\ No newline at end of file
spring.application.name = AMOS-PATROL-tb
spring.application.name = AMOS-PATROL
server.servlet.context-path=/patrol
server.port = 8082
......@@ -44,6 +44,8 @@ Push.fegin.name=APPMESSAGEPUSHSERVICE
amos.flowWork.topic =/STATE_GRID/hazardManagement
amosRefresh.danger.topic =patrolDangerInsertOrUpdate
amosRefresh.patrol.topic =patrolCheckInsert
patrol.point.classify.topic=patrol/point/classify
patrol.topic=patrol/#
#停止通过WEB公开所有端点
management.endpoints.web.exposure.exclude=*
## redis失效时间
......
......@@ -313,4 +313,121 @@
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-19">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="code"/>
</not>
</preConditions>
<comment>p_point_classify add column code</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `code` varchar(255) DEFAULT NULL COMMENT '编号';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-20">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="category_name"/>
</not>
</preConditions>
<comment>p_point_classify add column category_name</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `category_name` varchar(255) DEFAULT NULL COMMENT '分类名称';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-22">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="address"/>
</not>
</preConditions>
<comment>p_point_classify add column address</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `address` varchar(255) DEFAULT NULL COMMENT '位置';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-23">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="data_source_code"/>
</not>
</preConditions>
<comment>p_point_classify add column data_source_code</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `data_source_code` int(10) DEFAULT NULL COMMENT '数据源code(1 消防装备 2 重点部位 3 自定义)';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-24">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="data_source_name"/>
</not>
</preConditions>
<comment>p_point_classify add column data_source_name</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `data_source_name` varchar(255) DEFAULT NULL COMMENT '数据源名称(冗余)';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-26">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="building_id"/>
</not>
</preConditions>
<comment>p_point_classify add column building_id</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `building_id` varchar(255) DEFAULT NULL COMMENT '建筑id';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-27">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="building_name"/>
</not>
</preConditions>
<comment>p_point_classify add column building_name</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `building_name` varchar(255) DEFAULT NULL COMMENT '建筑名称';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-28">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="category_code"/>
</not>
</preConditions>
<comment>p_point_classify add column category_code</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `category_code` varchar(255) DEFAULT NULL COMMENT '分类id';
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20211102-29">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_point_classify" columnName="is_delete"/>
</not>
</preConditions>
<comment>p_point_classify add column is_delete</comment>
<sql>
ALTER TABLE `p_point_classify`
ADD COLUMN `is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除( 0未删除,1已删除 )';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -846,6 +846,15 @@
classify.id as classifyId,
classify.name as equipmentName,
classify.equipment_id as equipmentId,
classify.original_id as originalId,
classify.code,
classify.category_name as categoryName,
classify.address as area,
classify.data_source_code as dataSourceCode,
classify.data_source_name as equipType,
classify.building_id as buildingId,
classify.building_name as place,
classify.category_code as categoryCode,
(SELECT create_date FROM p_check WHERE id = #{checkID}) as createDate
FROM
p_point_classify classify
......
......@@ -188,8 +188,9 @@
LEFT JOIN p_input_item pii ON pii.id = ppi.input_item_id
lEFT JOIN p_route_point_item prpi ON prpi.point_input_item_id = pii.id
WHERE pii.is_delete = '0'
<if test="pointId!=null and pointId !='' "> AND ppc.point_id = #{pointId}</if>
<if test="equipmentId!=null and equipmentId !='' "> AND ppc.equipment_id = #{equipmentId}</if>
<if test="classifyId!=null and classifyId !='' "> AND ppc.id = #{classifyId}</if>
<!-- <if test="pointId!=null and pointId !='' "> AND ppc.point_id = #{pointId}</if>-->
<!-- <if test="equipmentId!=null and equipmentId !='' "> AND ppc.equipment_id = #{equipmentId}</if>-->
</select>
<select id="getInputItemListByitemNos" resultType="com.yeejoin.amos.patrol.business.vo.InputItemVo">
SELECT
......
......@@ -942,32 +942,57 @@
AND p.org_code = #{orgCode}
AND c.is_delete = 0
</select>
<!-- <select id="queryEquipPointInputItem" resultType="java.util.Map">-->
<!-- SELECT-->
<!-- distinct cast(spec.id as char) AS equipmentId,-->
<!-- we.name AS name,-->
<!-- structure.source_id AS sourceId,-->
<!-- structure.source_code AS sourceCode,-->
<!-- spec.system_id AS systemId,-->
<!-- spec.code AS code,-->
<!-- cast(ppc.id as char) AS id,-->
<!-- category.NAME AS categoryName,-->
<!-- category.CODE AS categoryCode,-->
<!-- equipment_detail.area AS address,-->
<!-- structure.NAME AS acre,-->
<!-- we.inspection_spec as inspectionName,-->
<!-- ppc.order_no as orderNo-->
<!-- FROM-->
<!-- p_point_classify ppc-->
<!-- LEFT JOIN wl_equipment_specific spec ON spec.id=ppc.equipment_id-->
<!-- LEFT JOIN wl_equipment_detail equipment_detail ON equipment_detail.id = spec.equipment_detail_id-->
<!-- LEFT JOIN wl_stock_detail detail ON detail.equipment_specific_id = spec.id-->
<!-- LEFT JOIN wl_warehouse_structure structure ON detail.warehouse_structure_id = structure.id-->
<!-- LEFT JOIN f_fire_fighting_system AS manage ON manage.id = spec.system_id-->
<!-- LEFT JOIN wl_equipment we ON we.id = equipment_detail.equipment_id-->
<!-- LEFT JOIN wl_equipment_category category ON category.id = we.category_id-->
<!-- WHERE-->
<!-- <if test = "pointId!=''" > ppc.point_id = #{pointId} </if>-->
<!-- </select>-->
<select id="queryEquipPointInputItem" resultType="java.util.Map">
SELECT
distinct cast(spec.id as char) AS equipmentId,
we.name AS name,
structure.source_id AS sourceId,
structure.source_code AS sourceCode,
spec.system_id AS systemId,
spec.code AS code,
cast(ppc.id as char) AS id,
category.NAME AS categoryName,
category.CODE AS categoryCode,
equipment_detail.area AS address,
structure.NAME AS acre,
we.inspection_spec as inspectionName,
ppc.order_no as orderNo
ppc.id,
ppc.point_id pointId,
ppc.name,
ppc.code,
ppc.creator_id creatorId,
ppc.create_date createDate,
ppc.order_no orderNo,
ppc.original_id originalId,
ppc.equipment_id equipmentId,
ppc.inspection_spec_name inspectionSpecName,
ppc.category_name categoryName,
ppc.address,
ppc.data_source_code dataSourceCode,
ppc.data_source_name dataSourceName,
ppc.building_id buildingId,
ppc.building_name buildingName,
ppc.category_code categoryCode
FROM
p_point_classify ppc
LEFT JOIN wl_equipment_specific spec ON spec.id=ppc.equipment_id
LEFT JOIN wl_equipment_detail equipment_detail ON equipment_detail.id = spec.equipment_detail_id
LEFT JOIN wl_stock_detail detail ON detail.equipment_specific_id = spec.id
LEFT JOIN wl_warehouse_structure structure ON detail.warehouse_structure_id = structure.id
LEFT JOIN f_fire_fighting_system AS manage ON manage.id = spec.system_id
LEFT JOIN wl_equipment we ON we.id = equipment_detail.equipment_id
LEFT JOIN wl_equipment_category category ON category.id = we.category_id
p_point_classify ppc
WHERE
<if test = "pointId!=''" > ppc.point_id = #{pointId} </if>
ppc.is_delete = 0
<if test = "pointId!=''" > AND ppc.point_id = #{pointId} </if>
</select>
<select id="queryPointCount4Route" parameterType="long" resultType="int">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment