Commit 309750f6 authored by maoying's avatar maoying

合并代码

parents dc2f8f48 c4b43c74
package com.yeejoin.amos.fas.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author gaojianqiang
*/
public enum PlanReplyMessageEnum {
TEXT("文本","text"),
IMAGE("图片","image"),
VIDEO("视频","video");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
private PlanReplyMessageEnum(String name, String code){
this.name = name;
this.code = code;
}
public static PlanReplyMessageEnum getEnum(String code) {
PlanReplyMessageEnum checkStatusEnum = null;
for(PlanReplyMessageEnum type: PlanReplyMessageEnum.values()) {
if (type.getCode().equals(code)) {
checkStatusEnum = type;
break;
}
}
return checkStatusEnum;
}
public static List<Map<String,Object>> getEnumList() {
List<Map<String,Object>> nameList = new ArrayList<>();
for (PlanReplyMessageEnum c: PlanReplyMessageEnum.values()) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", c.getName());
map.put("code", c.getCode());
nameList.add(map);
}
return nameList;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
package com.yeejoin.amos.fas.dao.entity; package com.yeejoin.amos.fas.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
...@@ -42,6 +43,8 @@ public class ContingencyInstanceInfo extends Model<ContingencyInstanceInfo>{ ...@@ -42,6 +43,8 @@ public class ContingencyInstanceInfo extends Model<ContingencyInstanceInfo>{
private String orgCode; private String orgCode;
@TableField
private String duration;
} }
package com.yeejoin.amos.fas.dao.entity; package com.yeejoin.amos.fas.dao.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package com.yeejoin.amos.fas.dao.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 货架结构
*
* @author wujiang
* @date 2020-07-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wl_warehouse_structure")
@ApiModel(value = "WarehouseStructure对象", description = "货架结构")
public class WarehouseStructure extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "位置编码")
private String code;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "全称")
private String fullName;
@ApiModelProperty(value = "父ID")
private Long parentId;
@ApiModelProperty(value = "位置类型")
private Long cellType;
@ApiModelProperty(value = "货位code")
private String cellCode;
@ApiModelProperty(value = "仓库ID")
private Long warehouseId;
//新加
@ApiModelProperty(value = "机构/部门名称")
@TableField("biz_org_name")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
@TableField("biz_org_code")
private String bizOrgCode;
private String remark;
@ApiModelProperty(value = "预控系统中的ID字段")
private Long sourceId;
@ApiModelProperty(value = "预控系统中的code字段")
private String sourceCode;
@TableField(exist = false)
private List<WarehouseStructure> children;
}
...@@ -140,7 +140,12 @@ ...@@ -140,7 +140,12 @@
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-security</artifactId> <artifactId>amos-component-security</artifactId>
<version>1.7.13-SNAPSHOT</version> <version>1.7.13-SNAPSHOT</version>
</dependency> </dependency>
<!-- kafka -->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.yeejoin.amos.fas.business.action; package com.yeejoin.amos.fas.business.action;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.component.rule.MethodParam; import com.yeejoin.amos.component.rule.MethodParam;
...@@ -12,44 +10,45 @@ import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext; ...@@ -12,44 +10,45 @@ import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent; import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo; import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.model.DeviceRo; import com.yeejoin.amos.fas.business.action.model.DeviceRo;
//import com.yeejoin.amos.fas.business.action.mq.IKafkaProducer;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent; import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.result.ActionResult; import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult; import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult;
import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage; import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage;
import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher; import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanDetailMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanDetailMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.JcsFeign; import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl; import com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl;
import com.yeejoin.amos.fas.business.service.intfc.*; import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus; import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.ToipResponse; import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.CacheFactory;
import com.yeejoin.amos.fas.business.util.CacheMap;
import com.yeejoin.amos.fas.business.util.JSONUtil; import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.vo.MessageVO;
import com.yeejoin.amos.fas.business.vo.Toke; import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum; import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum; import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import com.yeejoin.amos.fas.core.enums.NumberEnum; import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.DateUtil; import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail; import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord; import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo;
import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -98,9 +97,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -98,9 +97,6 @@ public class ContingencyAction implements CustomerAction {
private IRiskSourceService riskSourceService; private IRiskSourceService riskSourceService;
@Autowired @Autowired
private IDutyModeServer dutyModeServer;
@Autowired
private IEquipmentService equipmentService; private IEquipmentService equipmentService;
@Autowired @Autowired
...@@ -109,6 +105,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -109,6 +105,9 @@ public class ContingencyAction implements CustomerAction {
@Autowired @Autowired
IRocketMQService rocketMQService; IRocketMQService rocketMQService;
// @Autowired
// IKafkaProducer iKafkaProducer;
@Autowired @Autowired
private IContingencyInstance contingencyInstance; private IContingencyInstance contingencyInstance;
...@@ -127,12 +126,24 @@ public class ContingencyAction implements CustomerAction { ...@@ -127,12 +126,24 @@ public class ContingencyAction implements CustomerAction {
@Autowired @Autowired
private IPlanRuleService planRuleService; private IPlanRuleService planRuleService;
@Autowired
private IPlanVisual3dService iPlanVisual3dService;
@Autowired
private ContingencyInstanceInfoService contingencyInstanceInfoService;
@Autowired
private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Value("${rocket-plan-topic}") @Value("${rocket-plan-topic}")
private String rocketTopic; private String rocketTopic;
@Value("${maparea.action.is-area}") @Value("${maparea.action.is-area}")
private String isArea; private String isArea;
@Value("${plan.default.roleCode}")
private String defaultRoleCode;
private static Map<String, String> OPERATE_RECORD_ID = new HashMap<>(); private static Map<String, String> OPERATE_RECORD_ID = new HashMap<>();
private static Map<String, Map<String, String>> stringStringMap = new HashMap<>(); private static Map<String, Map<String, String>> stringStringMap = new HashMap<>();
...@@ -140,9 +151,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -140,9 +151,6 @@ public class ContingencyAction implements CustomerAction {
public static ConcurrentHashMap<String, Map<String, Object>> pointCache = new ConcurrentHashMap<>(); public static ConcurrentHashMap<String, Map<String, Object>> pointCache = new ConcurrentHashMap<>();
private static CacheMap cacheMap = CacheFactory.newChacheMap();
private static final String TOKE = "TOKE";
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
...@@ -165,47 +173,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -165,47 +173,6 @@ public class ContingencyAction implements CustomerAction {
*/ */
/** /**
* 预案文件中值为和数据字典中的对应关系
* 消防
* F1 消防队长 fireLeader
* F2..F6 队员 firePerson 规则配置中队员1...6:firePerson1...firePerson6
* FD .... 司机 fireDriver 规则配置中司机 1..6:fireDriver1...fireDriver6
* 运维
* S1 值班长 dutyLeader
* S2 副值班长 deputyDutyLeader
* B1..B6 值班员 dutyCivilian 规则配置中值班员1...6:dutyCivilian1...dutyCivilian6
* A1...A6 副值班员 deputyDutyCivilian 规则配置中副值班员1...6:deputyDutyCivilian1...deputyDutyCivilian6
*/
public Map<String, String> getStrengthMap(ContingencyRo contingencyRo) {
String batchNo = contingencyRo.getBatchNo();
String orgCode = contingencyRo.getEquipmentOrgCode();
Map<String, String> returnMap = stringStringMap.get(contingencyRo.getBatchNo());
if (CollectionUtils.isEmpty(returnMap)) {
stringStringMap = new HashMap<>();
returnMap = new HashMap<>();
ResponseModel responseModel = jcsFeign.dutyPersonList();
if ("SUCCESS".equals(responseModel.getDevMessage())) {
String JSONStr = JSON.toJSONString(responseModel.getResult());
JSONArray dataList = JSONObject.parseArray(JSONStr);
if (!ObjectUtils.isEmpty(dataList)) {
Map<String, String> finalReturnMap = returnMap;
dataList.forEach(x -> {
Map<String, Object> resultMap = new HashMap<>();
JSONObject obj = (JSONObject) x;
finalReturnMap.put(obj.getString("postTypeName"), obj.getString("userName"));
});
}
}
stringStringMap.put(batchNo, returnMap);
}
log.info(String.format("returnMap:【 %s 】", returnMap));
return returnMap;
}
/**
* @param stepCode 当前步骤编号 * @param stepCode 当前步骤编号
* @param stepName 当前步骤名称 * @param stepName 当前步骤名称
* @param nextStepCode 下一步编号 * @param nextStepCode 下一步编号
...@@ -278,13 +245,21 @@ public class ContingencyAction implements CustomerAction { ...@@ -278,13 +245,21 @@ public class ContingencyAction implements CustomerAction {
// 将预案的确认消息发送至中心级 // 将预案的确认消息发送至中心级
if ("CONFIRM".equals(ro.getConfirm())) { if ("CONFIRM".equals(ro.getConfirm())) {
log.info("RocketMQ发送的主题是: " + rocketTopic + ", 消息体是: " + toipResponse.toJsonStr() + "!"); log.info("RocketMQ与Kafka发送的主题是: " + rocketTopic + ", 消息体是: " + toipResponse.toJsonStr() + "!");
try { try {
rocketMQService.sendMsg(rocketTopic, "plan_process", toipResponse); rocketMQService.sendMsg(rocketTopic, "plan_process", toipResponse);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new RuntimeException("RocketMQ消息发送失败!"); throw new RuntimeException("RocketMQ消息发送失败!");
} }
// kafka消息发送至南瑞平台
// try {
// iKafkaProducer.sendMessage(rocketTopic, "plan_process", toipResponse);
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// throw new RuntimeException("Kafka消息发送失败!");
// }
} }
} else if ("websocket".equals(pushType.toLowerCase())) { } else if ("websocket".equals(pushType.toLowerCase())) {
action.execute(msgType, contingency); action.execute(msgType, contingency);
...@@ -338,11 +313,22 @@ public class ContingencyAction implements CustomerAction { ...@@ -338,11 +313,22 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "执行记录", project = "换流站消防专项预案") @RuleMethod(methodLabel = "执行记录", project = "换流站消防专项预案")
@Transactional
public void messageRecord(@MethodParam(paramLabel = "消息内容") String content, @MethodParam(paramLabel = "对象") Object paramObj) { public void messageRecord(@MethodParam(paramLabel = "消息内容") String content, @MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
String batchNo = contingencyRo.getBatchNo(); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) { if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
Map<String, Object> params = contingencyRo.getParams();
RequestContext.setAppKey(params.getOrDefault("appKey", "").toString());
RequestContext.setProduct(params.getOrDefault("product", "").toString());
RequestContext.setToken(params.getOrDefault("token", "").toString());
redisTemplate.opsForValue().set("action:appKey", params.getOrDefault("appKey", "").toString());
redisTemplate.opsForValue().set("action:product", params.getOrDefault("product", "").toString());
redisTemplate.opsForValue().set("action:token", params.getOrDefault("token", "").toString());
//转换content中的变量 //转换content中的变量
content = instedParams(content, contingencyRo); content = instedParams(content, contingencyRo);
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", ""); iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", "");
...@@ -368,9 +354,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -368,9 +354,9 @@ public class ContingencyAction implements CustomerAction {
e.printStackTrace(); e.printStackTrace();
} }
result.add(tempmap1); result.add(tempmap1);
System.out.println("--------------------messageRecord----------------------" + result); System.out.printf("=========recordarea=====396====%s=========%s=========%n", JSONObject.toJSONString(paramObj), JSONObject.toJSONString(result));
this.sendcmd("recordarea", paramObj, result); sendcmd("recordarea", paramObj, result);
this.sendweb("recordarea", paramObj, result); sendweb("recordarea", paramObj, result);
} }
} }
...@@ -415,11 +401,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -415,11 +401,6 @@ public class ContingencyAction implements CustomerAction {
private String instedParams(String content, ContingencyRo contingencyRo) { private String instedParams(String content, ContingencyRo contingencyRo) {
Map<String, String> strengthMap = this.getStrengthMap(contingencyRo);
// for (String key : strengthMap.keySet())
// content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
Field[] fields = contingencyRo.getClass().getDeclaredFields(); Field[] fields = contingencyRo.getClass().getDeclaredFields();
Method getMethod = null; Method getMethod = null;
try { try {
...@@ -466,6 +447,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -466,6 +447,7 @@ public class ContingencyAction implements CustomerAction {
String batchNo = contingencyRo.getBatchNo(); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) { if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
String buttonCode = contingencyRo.getButtonCode();
//转换content中的变量 //转换content中的变量
tips = instedParams(tips, contingencyRo); tips = instedParams(tips, contingencyRo);
...@@ -483,6 +465,26 @@ public class ContingencyAction implements CustomerAction { ...@@ -483,6 +465,26 @@ public class ContingencyAction implements CustomerAction {
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("optionarea", paramObj, result); this.sendcmd("optionarea", paramObj, result);
ContingencyPlanInstance instance = contingencyInstance.getMessageById(contingencyPlanId);
if (instance != null) {
String roleCode = contingencyInstance.getPlanStepRoleCodeByButtonCode(buttonCode);
if (StringUtils.isNotBlank(roleCode)) {
instance.setRoleCode(roleCode);
} else {
instance.setRoleCode(defaultRoleCode);
}
contingencyPlanInstanceMapper.updateMessageById(instance);
}
MessageVO messageVO = new MessageVO();
messageVO.setTitle("应急处置事项提醒");
messageVO.setBody("【" + actionName + "】" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
messageVO.setMsgType("emergencyPlan");
messageVO.setCategory(1);
messageVO.setIsSendApp(true);
messageVO.setIsSendWeb(true);
messageVO.setRelationId(batchNo);
iPlanVisual3dService.sendMessage(buttonCode, messageVO);
} }
} }
...@@ -672,6 +674,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -672,6 +674,7 @@ public class ContingencyAction implements CustomerAction {
public void stopPlan(@MethodParam(paramLabel = "对象") Object paramObj) { public void stopPlan(@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
String batchNo = contingencyRo.getBatchNo();
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
...@@ -697,7 +700,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -697,7 +700,7 @@ public class ContingencyAction implements CustomerAction {
} }
// 结束预案 更新预案记录表,预案状态 // 结束预案 更新预案记录表,预案状态
PlanOperationRecord PlanOperationRecord = planOperationRecordDao.findByBatchNo(contingencyRo.getBatchNo()); PlanOperationRecord PlanOperationRecord = planOperationRecordDao.findByBatchNo(batchNo);
if (PlanOperationRecord != null && PlanOperationRecord.getStatus() == PlanRecordStatusEnum.OPERATION.getCode()) { if (PlanOperationRecord != null && PlanOperationRecord.getStatus() == PlanRecordStatusEnum.OPERATION.getCode()) {
PlanOperationRecord.setStatus(PlanRecordStatusEnum.COMPLETE.getCode()); PlanOperationRecord.setStatus(PlanRecordStatusEnum.COMPLETE.getCode());
PlanOperationRecord.setEndTime(new Date()); PlanOperationRecord.setEndTime(new Date());
...@@ -716,6 +719,8 @@ public class ContingencyAction implements CustomerAction { ...@@ -716,6 +719,8 @@ public class ContingencyAction implements CustomerAction {
this.sendweb("recordarea", paramObj, result); this.sendweb("recordarea", paramObj, result);
} }
// 结束预案,更新预案信息表结束时间
contingencyInstanceInfoService.updateEndTimeById(batchNo);
} }
private void planDetailDataSync(PlanDetail detail) { private void planDetailDataSync(PlanDetail detail) {
...@@ -841,7 +846,12 @@ public class ContingencyAction implements CustomerAction { ...@@ -841,7 +846,12 @@ public class ContingencyAction implements CustomerAction {
if (!findByBatchNoAndStatus(batchNo)) { if (!findByBatchNoAndStatus(batchNo)) {
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson); String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
try { try {
contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanId, buttonCode, confirm, stepState, RequestContext.getToken(), RequestContext.getProduct()); ContingencyPlanInstance instance = contingencyInstance.getMessageById(contingencyPlanId);
if (instance != null) {
instance.setRoleCode(contingencyInstance.getPlanStepRoleCodeByButtonCode(buttonCode));
contingencyPlanInstanceMapper.updateMessageById(instance);
}
contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanId, buttonCode, confirm, stepState, RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -895,8 +905,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -895,8 +905,9 @@ public class ContingencyAction implements CustomerAction {
//数字预案业务屏web端发送消息 //数字预案业务屏web端发送消息
this.sendweb("recordarea", contingencyRo, result); this.sendweb("recordarea", contingencyRo, result);
updateNumberPlan(batchNo); updateNumberPlan(batchNo);
// 应急处置中断,初始化planStep,json数据 // 应急处置中断,初始化planStep,json数据;更新预案结束时间
planRuleService.updatePlanRuleByBatchNo(batchNo); planRuleService.updatePlanRuleByBatchNo(batchNo);
contingencyInstanceInfoService.updateEndTimeById(batchNo);
} }
/** /**
...@@ -924,6 +935,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -924,6 +935,7 @@ public class ContingencyAction implements CustomerAction {
/** /**
* 通过batchNo获取预案的状态 * 通过batchNo获取预案的状态
*
* @param batchNo * @param batchNo
* @return * @return
*/ */
......
package com.yeejoin.amos.fas.business.action.mq;
/**
* @author keyong
* @title: IKafkaProducer
* <pre>
* @description:
* </pre>
* @date 2022/10/14 15:16
*/
public interface IKafkaProducer {
void sendMessage(String topic, String key, Object message);
}
package com.yeejoin.amos.fas.business.action.mq;
import com.alibaba.fastjson.JSON;
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.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.SendResult;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback;
/**
* @author keyong
* @title: KafkaProducer
* <pre>
* @description:
* </pre>
* @date 2022/10/14 10:59
*/
@Configuration
@EnableKafka
public class KafkaProducer implements IKafkaProducer {
private final Logger log = LoggerFactory.getLogger(KafkaProducer.class);
@Value("${kafka.producer.sysIsUsed}")
private String sysIsUsed;
@Autowired
private KafkaTemplate<String, Object> kafkaTemplate;
private static class KafkaFutureCallback implements ListenableFutureCallback<SendResult> {
private final Logger log = LoggerFactory.getLogger(KafkaProducer.class);
@Override
public void onFailure(Throwable ex) {
log.error("send kafka failed: {}", ex);
}
@Override
public void onSuccess(SendResult result) {
log.info("send kafka success: {}", result.getProducerRecord());
}
}
@Override
public void sendMessage(String topic, String key, Object message) {
if("on".equalsIgnoreCase(sysIsUsed)){
log.info("Kafka Topic===="+topic);
log.info("Kafka msg===="+ JSON.toJSONString(message));
kafkaTemplate.send(topic, key, message).addCallback(new KafkaFutureCallback());
}else{
log.info("Kafka SendResult====kafka.producer.sysIsUsed is not open !!!");
}
}
}
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.ContingencyInstanceInfoService;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
import com.yeejoin.amos.fas.exception.YeeException;
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.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;
@RestController
@RequestMapping(value = "/plan/record")
@Api(tags = "应急预案执行记录实例")
public class ContingencyInstanceInfoController extends BaseController {
@Autowired
private ContingencyInstanceInfoService contingencyInstanceInfoService;
@Permission
@ApiOperation(value = "应急预案执行记录信息", notes = "应急预案执行记录信息")
@GetMapping(value = "/selectDisposalDetails")
public ResponseModel selectDisposalDetails(@RequestParam("batchNo") String batchNo) {
return CommonResponseUtil.successNew(contingencyInstanceInfoService.selectDisposalDetails(batchNo));
}
@Permission
@ApiOperation(httpMethod = "GET", value = "分页查询应急预案执行记录信息", notes = "分页查询应急预案执行记录信息")
@GetMapping(value = "/selectDisposalListPage")
public ResponseModel selectDisposalListPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
) {
if (current < 1 || size < 1) {
throw new YeeException("分页参数有误");
}
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
return CommonResponseUtil2.success(contingencyInstanceInfoService.selectDisposalListPage(current, size, orgCode));
}
@Permission
@ApiOperation(value = "新增应急预案执行记录", notes = "新增应急预案执行记录")
@PostMapping(value = "/addDisposalDetails")
public ResponseModel addDisposalDetails(@RequestBody ContingencyInstanceInfo contingencyInstanceInfo) {
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
contingencyInstanceInfo.setOrgCode(orgCode);
return CommonResponseUtil.successNew(contingencyInstanceInfoService.addDisposalDetails(contingencyInstanceInfo));
}
@Permission
@ApiOperation(value = "修改应急预案执行记录信息", notes = "修改应急预案执行记录信息")
@PostMapping(value = "/updateDisposalDetails")
public ResponseModel updateDisposalDetails(@RequestBody ContingencyInstanceInfo contingencyInstanceInfo) {
return CommonResponseUtil.successNew(contingencyInstanceInfoService.updateDisposalDetails(contingencyInstanceInfo));
}
}
...@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
...@@ -236,7 +237,13 @@ public class ContingencyPlanController extends BaseController { ...@@ -236,7 +237,13 @@ public class ContingencyPlanController extends BaseController {
@ApiOperation(value = "获取预案状态") @ApiOperation(value = "获取预案状态")
@RequestMapping(value = "/getPlanStatus", method = RequestMethod.GET) @RequestMapping(value = "/getPlanStatus", method = RequestMethod.GET)
public ResponseModel getPlanStatus() { public ResponseModel getPlanStatus() {
return CommonResponseUtil2.success(contingencyPlanService.getPlanStatus()); return CommonResponseUtil2.success(CollectionUtils.isEmpty(contingencyPlanService.getPlanStatus()));
}
@ApiOperation(value = "获取执行预案序列号")
@RequestMapping(value = "/getPlanBatchNo", method = RequestMethod.GET)
public ResponseModel getPlanBatchNo() {
return CommonResponseUtil2.success(contingencyPlanService.getPlanBatchNo());
} }
@ApiOperation(value = "获取当前登录人待处置任务及预案信息") @ApiOperation(value = "获取当前登录人待处置任务及预案信息")
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.util.StringUtil; import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO;
import com.yeejoin.amos.fas.business.vo.PlanStepVo; import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.business.vo.ReginParams; import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.config.Permission; import com.yeejoin.amos.fas.config.Permission;
...@@ -201,55 +202,17 @@ public class PlanVisual3dController extends BaseController { ...@@ -201,55 +202,17 @@ public class PlanVisual3dController extends BaseController {
} }
@Permission @Permission
@ApiOperation(value = "处置详情信息", notes = "处置详情信息")
@GetMapping(value = "/plan/selectDisposalDetails")
public ResponseModel selectDisposalDetails(@RequestParam("disposalId") String disposalId) {
return CommonResponseUtil.successNew(planVisual3dService.selectDisposalDetails(disposalId));
}
@Permission
@ApiOperation(httpMethod = "GET", value = "分页查询处置详情信息", notes = "分页查询处置详情信息")
@GetMapping(value = "/plan/selectDisposalListPage")
public ResponseModel selectDisposalListPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
) {
if (current < 1 || size < 1) {
throw new YeeException("分页参数有误");
}
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
return CommonResponseUtil2.success(planVisual3dService.selectDisposalListPage(current, size, orgCode));
}
@Permission
@ApiOperation(value = "新增处置信息", notes = "新增处置信息")
@PostMapping(value = "/plan/addDisposalDetails")
public ResponseModel addDisposalDetails(@RequestBody ContingencyInstanceInfo contingencyInstanceInfo) {
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
contingencyInstanceInfo.setOrgCode(orgCode);
return CommonResponseUtil.successNew(planVisual3dService.addDisposalDetails(contingencyInstanceInfo));
}
@Permission
@ApiOperation(value = "修改处置信息", notes = "修改处置信息")
@PostMapping(value = "/plan/updateDisposalDetails")
public ResponseModel updateDisposalDetails(@RequestBody ContingencyInstanceInfo contingencyInstanceInfo) {
return CommonResponseUtil.successNew(planVisual3dService.updateDisposalDetails(contingencyInstanceInfo));
}
@Permission
@ApiOperation(value = "根据批次号获取预案的消息等记录", notes = "根据批次号获取预案的消息等记录") @ApiOperation(value = "根据批次号获取预案的消息等记录", notes = "根据批次号获取预案的消息等记录")
@GetMapping(value = "/plan/getPlaneRecordByNew") @GetMapping(value = "/plan/getPlaneRecordByNew")
public ResponseModel getPlaneRecordByNew(@RequestParam Integer pageNum, @RequestParam Integer size, @RequestParam(required = false) String batchNo) { public ResponseModel<ContingencyPlanInstanceVO> getPlaneRecordByNew(@RequestParam Integer pageNum, @RequestParam Integer size, @RequestParam(required = false) String batchNo) {
AgencyUserModel user = getUserInfo();
if (!StringUtil.isNotEmpty(batchNo)) { if (!StringUtil.isNotEmpty(batchNo)) {
batchNo = planVisual3dService.getNewestBatchNo(); batchNo = planVisual3dService.getNewestBatchNo();
} }
if (!StringUtil.isNotEmpty(batchNo)) { if (!StringUtil.isNotEmpty(batchNo)) {
return CommonResponseUtil.successNew(null); return CommonResponseUtil.successNew(null);
} }
return CommonResponseUtil.successNew(planVisual3dService.getPlaneRecordByNew(pageNum, size, batchNo)); return CommonResponseUtil.successNew(planVisual3dService.getPlaneRecordByNew(pageNum, size, batchNo, user));
} }
@Permission @Permission
...@@ -257,16 +220,15 @@ public class PlanVisual3dController extends BaseController { ...@@ -257,16 +220,15 @@ public class PlanVisual3dController extends BaseController {
@PostMapping(value = "/plan/replyMessage") @PostMapping(value = "/plan/replyMessage")
public ResponseModel replyMessage(@RequestBody ContingencyPlanInstance dto) { public ResponseModel replyMessage(@RequestBody ContingencyPlanInstance dto) {
AgencyUserModel user = getUserInfo(); AgencyUserModel user = getUserInfo();
planVisual3dService.replyMessage(user, dto); return CommonResponseUtil.successNew(planVisual3dService.replyMessage(user, dto));
return CommonResponseUtil.successNew(null);
} }
@Permission @Permission
@ApiOperation(httpMethod = "GET", value = "分页查询处置详情信息", notes = "分页查询处置详情信息") @ApiOperation(httpMethod = "GET", value = "分页查询预案下处置动作列表", notes = "分页查询预案下处置动作列表")
@GetMapping(value = "/plan/selectDisposalActionPage") @GetMapping(value = "/plan/selectDisposalActionPage")
public ResponseModel selectDisposalActionPage(@RequestParam(value = "current") int current, public ResponseModel selectDisposalActionPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @RequestParam(value = "size") int size,
@RequestParam(value = "disposalId") String disposalId, @RequestParam(value = "batchNo") String batchNo,
@RequestParam(value = "dataType") int dataType @RequestParam(value = "dataType") int dataType
) { ) {
if (current < 1 || size < 1) { if (current < 1 || size < 1) {
...@@ -278,6 +240,27 @@ public class PlanVisual3dController extends BaseController { ...@@ -278,6 +240,27 @@ public class PlanVisual3dController extends BaseController {
for (Long key : user.getOrgRoles().keySet()) { for (Long key : user.getOrgRoles().keySet()) {
roleModelList.addAll(user.getOrgRoles().get(key)); roleModelList.addAll(user.getOrgRoles().get(key));
} }
return CommonResponseUtil2.success(planVisual3dService.selectDisposalActionPage(current, size, disposalId, roleModelList, dataType)); return CommonResponseUtil2.success(planVisual3dService.selectDisposalActionPage(current, size, batchNo, roleModelList, dataType));
}
@Permission
@ApiOperation(httpMethod = "GET", value = "查询预案下处置动作列表", notes = "查询预案下处置动作列表")
@GetMapping(value = "/plan/selectDisposalActionList")
public ResponseModel selectDisposalActionList(@RequestParam(value = "batchNo") String batchNo,
@RequestParam(value = "dataType") int dataType
) {
AgencyUserModel user = getUserInfo();
List<RoleModel> roleModelList = new ArrayList<>();
for (Long key : user.getOrgRoles().keySet()) {
roleModelList.addAll(user.getOrgRoles().get(key));
}
return CommonResponseUtil2.success(planVisual3dService.selectDisposalActionList(batchNo, roleModelList, dataType));
}
@Permission
@ApiOperation(value = "修改动作执行状态", notes = "修改动作执行状态")
@PostMapping(value = "/updateStatusById")
public ResponseModel updateStatusById(@RequestParam("id") String id) {
return CommonResponseUtil.successNew(planVisual3dService.updateStatusById(id));
} }
} }
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.action.model.ProtalDataRo; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.action.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.bo.DangerResultBo; import com.yeejoin.amos.fas.business.bo.DangerResultBo;
import com.yeejoin.amos.fas.business.bo.PlanFlagBo; import com.yeejoin.amos.fas.business.bo.PlanFlagBo;
import com.yeejoin.amos.fas.business.bo.RiskSourceSynBo; import com.yeejoin.amos.fas.business.bo.RiskSourceSynBo;
import com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper;
import com.yeejoin.amos.fas.business.param.AlarmParam; import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService; import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService;
...@@ -16,10 +17,7 @@ import com.yeejoin.amos.fas.config.Permission; ...@@ -16,10 +17,7 @@ import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse; import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.enums.ReserveEnum; import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.*;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -48,6 +46,9 @@ public class RiskSourceController extends BaseController { ...@@ -48,6 +46,9 @@ public class RiskSourceController extends BaseController {
@Autowired @Autowired
IRiskSourceService riskSourceService; IRiskSourceService riskSourceService;
@Autowired
ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Permission @Permission
//@Authorization(ingore = true) //@Authorization(ingore = true)
@ApiOperation(httpMethod = "GET", value = "查询风险点子项", notes = "查询风险点子项") @ApiOperation(httpMethod = "GET", value = "查询风险点子项", notes = "查询风险点子项")
...@@ -719,6 +720,27 @@ public class RiskSourceController extends BaseController { ...@@ -719,6 +720,27 @@ public class RiskSourceController extends BaseController {
return CommonResponseUtil.success(riskSourceService.queryContingencyWater()); return CommonResponseUtil.success(riskSourceService.queryContingencyWater());
} }
@ApiOperation(value = "概览水源信息")
@GetMapping("/getWaterInfo")
@Permission
public CommonResponse getWaterInfo(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
String bizOrgCode = null;
if (StringUtil.isNotEmpty(orgCode)) {
bizOrgCode = contingencyPlanInstanceMapper.getBizOrgCode(orgCode);
if (!StringUtil.isNotEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
} else {
return CommonResponseUtil.success(null);
}
return CommonResponseUtil.success(riskSourceService.getWaterInfo(commonPageable, bizOrgCode));
}
/** /**
* 获取危险因素树二级节点 * 获取危险因素树二级节点
* *
......
...@@ -75,7 +75,7 @@ public class TimeLineController extends BaseController { ...@@ -75,7 +75,7 @@ public class TimeLineController extends BaseController {
@RequestParam("confirm") String confirm, @RequestParam("confirm") String confirm,
@RequestParam("contingencyPlanId") String contingencyPlanId, @RequestParam("contingencyPlanId") String contingencyPlanId,
@RequestParam("stepState") String stepState) throws Exception { @RequestParam("stepState") String stepState) throws Exception {
iContingencyInstance.fire(batchNo, stepCode, contingencyPlanId, buttonCode, confirm, stepState, getToken(), getProduct()); iContingencyInstance.fire(batchNo, stepCode, contingencyPlanId, buttonCode, confirm, stepState, getToken(), getProduct(), getAppKey());
return CommonResponseUtil.success("SUCCESS"); return CommonResponseUtil.success("SUCCESS");
} }
......
...@@ -7,6 +7,7 @@ import static com.yeejoin.amos.fas.business.constants.FasConstant.token; ...@@ -7,6 +7,7 @@ import static com.yeejoin.amos.fas.business.constants.FasConstant.token;
import java.util.List; import java.util.List;
import com.yeejoin.amos.fas.business.action.mq.IKafkaProducer;
import org.apache.rocketmq.client.producer.DefaultMQProducer; import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.common.message.Message;
...@@ -335,8 +336,11 @@ public class View3dController extends BaseController { ...@@ -335,8 +336,11 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(view3dService.dutyList(orgCode)); return CommonResponseUtil.success(view3dService.dutyList(orgCode));
} }
@Autowired @Autowired
IRocketMQService rocketMQService; IRocketMQService rocketMQService;
@Autowired
IKafkaProducer iKafkaProducer;
@ApiOperation(value = "rocketMQ消息推送测试", notes = "rocketMQ消息推送测试") @ApiOperation(value = "rocketMQ消息推送测试", notes = "rocketMQ消息推送测试")
@PostMapping(value="rocketMQ/send") @PostMapping(value="rocketMQ/send")
...@@ -351,5 +355,18 @@ public class View3dController extends BaseController { ...@@ -351,5 +355,18 @@ public class View3dController extends BaseController {
} }
return CommonResponseUtil.success(msg); return CommonResponseUtil.success(msg);
} }
@ApiOperation(value = "kafka消息推送测试", notes = "kafka消息推送测试")
@PostMapping(value="kafka/send")
public CommonResponse kafkaMsgSendTest(@RequestParam(name = "topic", required = false) String topic,
@RequestBody Object msg) {
try {
iKafkaProducer.sendMessage(topic, "kafka_msg_test", JSON.toJSONString(msg));
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure(e.getMessage());
}
return CommonResponseUtil.success(msg);
}
} }
package com.yeejoin.amos.fas.business.dao.mapper; package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo; import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
...@@ -12,7 +14,7 @@ import java.util.List; ...@@ -12,7 +14,7 @@ import java.util.List;
@Repository @Repository
public interface ContingencyInstanceInfoMapper extends BaseMapper<ContingencyInstanceInfo> { public interface ContingencyInstanceInfoMapper extends BaseMapper<ContingencyInstanceInfo> {
ContingencyInstanceInfo selectDisposalDetails(@Param("id") String id); ContingencyInstanceInfoVO selectDisposalDetails(@Param("id") String id);
Boolean addDisposalDetails(@Param("dto") ContingencyInstanceInfo contingencyInstanceInfo); Boolean addDisposalDetails(@Param("dto") ContingencyInstanceInfo contingencyInstanceInfo);
...@@ -20,12 +22,12 @@ public interface ContingencyInstanceInfoMapper extends BaseMapper<ContingencyIns ...@@ -20,12 +22,12 @@ public interface ContingencyInstanceInfoMapper extends BaseMapper<ContingencyIns
int selectCount(@Param("orgCode") String orgCode); int selectCount(@Param("orgCode") String orgCode);
List<ContingencyInstanceInfo> selectDisposalListPage(@Param("current") int current, @Param("size") int size, @Param("orgCode") String orgCode); List<ContingencyInstanceInfoVO> selectDisposalListPage(@Param("current") int current, @Param("size") int size, @Param("orgCode") String orgCode);
List<ContingencyPlanInstance> selectDisposalActionPage(@Param("current") int current, @Param("size") int size,@Param("type") String type, @Param("status") String status,@Param("list") List<String> roles ,@Param("batchNo") String batchNo); List<ContingencyPlanInstanceVO> selectDisposalActionPage(@Param("current") int current, @Param("size") int size,@Param("type") String type, @Param("status") String status,@Param("list") List<String> roles ,@Param("batchNo") String batchNo);
int selectCountDisposalActionPage(@Param("type") String type, @Param("status") String status,@Param("list") List<String> roles ,@Param("batchNo") String batchNo); int selectCountDisposalActionPage(@Param("type") String type, @Param("status") String status,@Param("list") List<String> roles ,@Param("batchNo") String batchNo);
List<ContingencyPlanInstance> selectDisposalActionList(@Param("type") String type, @Param("status") String status,@Param("list") List<String> roles ,@Param("batchNo") String batchNo); List<ContingencyPlanInstanceVO> selectDisposalActionList(@Param("type") String type, @Param("status") String status, @Param("list") List<String> roles , @Param("batchNo") String batchNo);
} }
package com.yeejoin.amos.fas.business.dao.mapper; package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -17,4 +18,27 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla ...@@ -17,4 +18,27 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla
Integer getPlanInstanceCount(@Param("batchNo") String batchNo); Integer getPlanInstanceCount(@Param("batchNo") String batchNo);
Map<String, String> getUserByUserId(@Param("userId") String userId); Map<String, String> getUserByUserId(@Param("userId") String userId);
/**
* 修改动作执行状态
* @param id
* @return
*/
Boolean updateStatusById(@Param("id") String id, @Param("content") String content);
ContingencyPlanInstance getMessageById(@Param("id") String id);
/**
* 信息更新
* @param contingencyPlanInstance
* @return
*/
Boolean updateMessageById(@Param("dto") ContingencyPlanInstance contingencyPlanInstance);
String getBizOrgCode(@Param("amosOrgCode") String amosOrgCode);
List<Map<String, Object>> getWaterInfo(@Param("current") Integer current, @Param("size") Integer size, @Param("bizOrgCode") String bizOrgCode);
long countWater(@Param("bizOrgCode") String bizOrgCode);
} }
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.dao.entity.WarehouseStructure;
import org.apache.ibatis.annotations.Param;
/**
* 货架结构 Mapper 接口
*
* @author wujiang
* @date 2020-07-07
*/
public interface WarehouseStructureMapper extends BaseMapper<WarehouseStructure> {
WarehouseStructure getMessageById(@Param("id")Long id);
}
...@@ -32,4 +32,10 @@ public interface PrivilegeFeign { ...@@ -32,4 +32,10 @@ public interface PrivilegeFeign {
@RequestHeader(name = "product", required = true) String product, @RequestHeader(name = "product", required = true) String product,
@RequestHeader(name = "token", required = true) String token, @RequestHeader(name = "token", required = true) String token,
@RequestParam(value = "roleIds", required = true) String roleIds); @RequestParam(value = "roleIds", required = true) String roleIds);
@RequestMapping(value = "/privilege/v1/role/list", method = RequestMethod.GET)
FeignClientResult getRoleList(@RequestHeader(name = "appKey", required = true) String appKey,
@RequestHeader(name = "product", required = true) String product,
@RequestHeader(name = "token", required = true) String token,
@RequestParam(value = "roleName", required = true) String roleName);
} }
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -7,9 +9,18 @@ import java.util.LinkedList; ...@@ -7,9 +9,18 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import com.yeejoin.amos.fas.business.service.intfc.IPlanRuleService; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.common.enums.PlanReplyMessageEnum;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
...@@ -18,6 +29,7 @@ import org.slf4j.LoggerFactory; ...@@ -18,6 +29,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -36,9 +48,6 @@ import com.yeejoin.amos.fas.business.dao.mapper.*; ...@@ -36,9 +48,6 @@ import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao; import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository; import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IDataSyncService;
import com.yeejoin.amos.fas.business.service.intfc.IRocketMQService;
import com.yeejoin.amos.fas.business.service.model.Operate; import com.yeejoin.amos.fas.business.service.model.Operate;
import com.yeejoin.amos.fas.business.service.model.OperateGroup; import com.yeejoin.amos.fas.business.service.model.OperateGroup;
import com.yeejoin.amos.fas.business.util.DateUtils; import com.yeejoin.amos.fas.business.util.DateUtils;
...@@ -48,7 +57,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; ...@@ -48,7 +57,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
@Service @Service
public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPlanInstance, String>*/ implements IContingencyInstance { public class ContingencyInstanceImpl implements IContingencyInstance {
private static final Logger log = LoggerFactory.getLogger(ContingencyInstanceImpl.class); private static final Logger log = LoggerFactory.getLogger(ContingencyInstanceImpl.class);
...@@ -96,6 +105,23 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -96,6 +105,23 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Autowired @Autowired
private IPlanRuleService planRuleService; private IPlanRuleService planRuleService;
@Autowired
private ContingencyInstanceInfoService contingencyInstanceInfoService;
@Autowired
private IContingencyInstance contingencyInstance;
@Autowired
private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Autowired
private WebMqttComponent webMqttComponent;
@Autowired
private IPlanVisual3dService planVisual3dService;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
private static Map<String, String> stepMap = new HashMap<>(); private static Map<String, String> stepMap = new HashMap<>();
...@@ -105,10 +131,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -105,10 +131,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
/* public ContingencyInstanceImpl(IContingencyPlanInstanceRepository repository) { @Value("${plan.instance.personImg}")
super(repository); private String personImg;
this.repository = repository;
}*/
@Autowired @Autowired
ContingencyAction contingencyAction; ContingencyAction contingencyAction;
...@@ -128,7 +153,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -128,7 +153,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
*/ */
public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) { public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) {
ContingencyPlanInstance planInstance = new ContingencyPlanInstance(); ContingencyPlanInstance planInstance = new ContingencyPlanInstance();
if ("MESSAGE".equalsIgnoreCase(recordType)) {
planInstance.setFileType(PlanReplyMessageEnum.TEXT.getCode());
}
planInstance.setContent(content); planInstance.setContent(content);
planInstance.setIcon(icon); planInstance.setIcon(icon);
planInstance.setRecordType(recordType); planInstance.setRecordType(recordType);
...@@ -138,7 +165,8 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -138,7 +165,8 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
//计算序号 //计算序号
int count = repository.countByBatchNo(instanceNo); int count = repository.countByBatchNo(instanceNo);
planInstance.setSort(++count); planInstance.setSort(++count);
ContingencyPlanInstance instance = this.repository.save(planInstance); ContingencyPlanInstance contingencyPlanInstance = contingencyInstance.updateExtendColumn(planInstance);
ContingencyPlanInstance instance = this.repository.save(contingencyPlanInstance);
// 异步数据同步之消息发送 // 异步数据同步之消息发送
contingencyPlanInstanceDataSync(instance); contingencyPlanInstanceDataSync(instance);
return instance; return instance;
...@@ -241,9 +269,15 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -241,9 +269,15 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
} }
contingencyRo.setTelemetryMap(telemetryMap); contingencyRo.setTelemetryMap(telemetryMap);
contingencyRo.setEquipmentCode(equipment.getCode()); contingencyRo.setEquipmentCode(equipment.getCode());
Map<String, Object> params = contingencyRo.getParams();
params.put("appKey", RequestContext.getAppKey());
params.put("product", RequestContext.getProduct());
params.put("token", RequestContext.getToken());
contingencyRo.setParams(params);
List<String> plan = this.getNumberPlan(Long.parseLong(contingencyRo.getEquipmentId())); List<String> plan = this.getNumberPlan(Long.parseLong(contingencyRo.getEquipmentId()));
ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(equipment.getName())); ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(equipment.getName()));
...@@ -313,16 +347,15 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -313,16 +347,15 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
throw new Exception("请勿重复操作."); throw new Exception("请勿重复操作.");
} }
if ("CONFIRM".equals(buttonState)) { if ("CONFIRM".equals(buttonState)) {
if (code.equals(operate.getCode())) { if (code.equals(operate.getCode())) {
operate.setState("executed"); operate.setState("executed");
if ("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)) { if ("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)) {
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning()); redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
}
if ("END_EMERGENCY".equals(code)) {
// 应急处置中断,初始化planStep,json数据 // 应急处置中断,初始化planStep,json数据
planRuleService.updatePlanRuleByBatchNo(batchNo); planRuleService.updatePlanRuleByBatchNo(batchNo);
// 应急处置中断,更新预案信息表结束时间
contingencyInstanceInfoService.updateEndTimeById(batchNo);
} }
} else { } else {
operate.setState("disable"); operate.setState("disable");
...@@ -331,13 +364,18 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -331,13 +364,18 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
} }
} }
operateJson = objectMapper.writeValueAsString(operateGroup);
contingencyPlanInstance.setContent(operateJson);
if (buttonState.equals("CONFIRM")) { if (buttonState.equals("CONFIRM")) {
contingencyPlanInstance.setRunstate(true); contingencyPlanInstance.setRunstate(true);
String topic = String.format("/%s/%s/%s", serviceName, stationName, "plan");
webMqttComponent.publish(topic, "{\"msgType\":\"replayMessage\"}");
} }
operateJson = objectMapper.writeValueAsString(operateGroup);
contingencyPlanInstance.setContent(operateJson);
ContingencyPlanInstance instance = repository.save(contingencyPlanInstance); ContingencyPlanInstance instance = repository.save(contingencyPlanInstance);
if (buttonState.equals("CONFIRM")) {
// 满足移动端确认按钮展示,确认后,多按钮json只保留最后一个按钮
planVisual3dService.updateStatusById(contingencyPlanId);
}
// 异步数据同步之消息发送 // 异步数据同步之消息发送
contingencyPlanInstanceDataSync(instance); contingencyPlanInstanceDataSync(instance);
} }
...@@ -387,7 +425,7 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -387,7 +425,7 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
} }
@Override @Override
public Optional<Equipment> fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String token, String product) throws Exception { public Optional<Equipment> fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String token, String product, String appKey) throws Exception {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("batchNo", batchNo); map.put("batchNo", batchNo);
map.put("stepCode", stepCode); map.put("stepCode", stepCode);
...@@ -395,13 +433,15 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -395,13 +433,15 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
map.put("confirm", buttonState); map.put("confirm", buttonState);
map.put("contingencyPlanId", contingencyPlanId); map.put("contingencyPlanId", contingencyPlanId);
map.put("stepState", stepStateOnbutton); map.put("stepState", stepStateOnbutton);
if (StringUtils.isNotBlank(token) || StringUtils.isNotBlank(product)) { if (StringUtils.isBlank(token) || StringUtils.isBlank(product)) {
Toke serverToken = remoteSecurityService.getServerToken(); Toke serverToken = remoteSecurityService.getServerToken();
map.put("token", serverToken.getToke()); map.put("token", serverToken.getToke());
map.put("product", serverToken.getProduct()); map.put("product", serverToken.getProduct());
map.put("appKey", serverToken.getAppKey());
} else { } else {
map.put("token", token); map.put("token", token);
map.put("product", product); map.put("product", product);
map.put("appKey", appKey);
} }
fireQueue.addLast(map); fireQueue.addLast(map);
//应急指挥给总部推送消息 //应急指挥给总部推送消息
...@@ -409,6 +449,66 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -409,6 +449,66 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
return Optional.empty(); return Optional.empty();
} }
@Override
public ContingencyPlanInstance updateExtendColumn(ContingencyPlanInstance contingencyPlanInstance) {
String appKey = redisTemplate.opsForValue().get("action:appKey").toString();
String product = redisTemplate.opsForValue().get("action:product").toString();
String token = redisTemplate.opsForValue().get("action:token").toString();
if (StringUtils.isBlank(appKey) || StringUtils.isBlank(product) || StringUtils.isBlank(token)) {
Toke toke = remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
RequestContext.setAppKey(toke.getAppKey());
} else {
RequestContext.setAppKey(appKey);
RequestContext.setProduct(product);
RequestContext.setToken(token);
}
FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.getme();
AgencyUserModel user = (AgencyUserModel) feignClientResult.getResult();
List<PlanStepJsonVO> result = getPlanStepJsonVOS();
List<String> roleCode = result.stream().map(PlanStepJsonVO::getRoleCode).distinct().collect(Collectors.toList());
List<RoleModel> roleModelList = new ArrayList<>();
for (Long key : user.getOrgRoles().keySet()) {
roleModelList.addAll(user.getOrgRoles().get(key));
}
List<String> roleCodeList = new ArrayList<>();
List<String> roleNameList = new ArrayList<>();
List<String> realRoleCode = roleModelList.stream().map(RoleModel::getRoleName).distinct().collect(Collectors.toList());
realRoleCode.forEach(item -> {
if (roleCode.contains(item)) {
roleCodeList.add(item);
}
});
roleModelList.forEach(item -> {
if (!roleNameList.contains(item.getRoleDesc()) && roleCode.contains(item.getRoleName())) {
roleNameList.add(item.getRoleDesc());
}
});
contingencyPlanInstance.setRoleCode(String.join("-", roleCodeList));
contingencyPlanInstance.setRoleName(String.join("-", roleNameList));
contingencyPlanInstance.setStartUserId(user.getUserId());
contingencyPlanInstance.setStartUserName(user.getRealName());
Map<String, String> userInfo = contingencyPlanInstanceMapper.getUserByUserId(user.getUserId());
contingencyPlanInstance.setPersonImg(ObjectUtils.isEmpty(userInfo) ? personImg : userInfo.getOrDefault("personImg", personImg));
return contingencyPlanInstance;
}
private List<PlanStepJsonVO> getPlanStepJsonVOS() {
String json = "";
try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案相关角色信息失败!");
}
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
return result;
}
private void sendPlanAlarm(String batchNo, String buttonCode) { private void sendPlanAlarm(String batchNo, String buttonCode) {
//确警后推送报警数据 //确警后推送报警数据
List<FirePlanAlarmBo> list = new ArrayList<FirePlanAlarmBo>(); List<FirePlanAlarmBo> list = new ArrayList<FirePlanAlarmBo>();
...@@ -441,16 +541,18 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -441,16 +541,18 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
String confirm = map.get("confirm"); String confirm = map.get("confirm");
String contingencyPlanId = map.get("contingencyPlanId"); String contingencyPlanId = map.get("contingencyPlanId");
String stepState = map.get("stepState"); String stepState = map.get("stepState");
String token = map.get("token"); String appKey = map.get("appKey");
String product = map.get("product"); String product = map.get("product");
String token = map.get("token");
try { try {
log.info("fireQueue-size:" + fireQueue.size()); log.info("fireQueue-size:" + fireQueue.size());
log.info("stepCode:" + map.get("stepCode")); log.info("stepCode:" + map.get("stepCode"));
log.info("buttonCode:" + map.get("buttonCode")); log.info("buttonCode:" + map.get("buttonCode"));
log.info("confirm:" + map.get("confirm")); log.info("confirm:" + map.get("confirm"));
log.info("stepState:" + map.get("stepState")); log.info("stepState:" + map.get("stepState"));
RequestContext.setToken(token); RequestContext.setAppKey(appKey);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setToken(token);
setButtonExecuted(batchNo, contingencyPlanId, buttonCode, confirm); setButtonExecuted(batchNo, contingencyPlanId, buttonCode, confirm);
fire(batchNo, stepCode, contingencyPlanId, buttonCode, confirm, stepState); fire(batchNo, stepCode, contingencyPlanId, buttonCode, confirm, stepState);
} catch (Exception e) { } catch (Exception e) {
...@@ -464,4 +566,21 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -464,4 +566,21 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
List<String> ruleId = planDetailMapper.getRuleIdByEquipment(id); List<String> ruleId = planDetailMapper.getRuleIdByEquipment(id);
return ruleId; return ruleId;
} }
@Override
public ContingencyPlanInstance getMessageById(String id) {
return contingencyPlanInstanceMapper.getMessageById(id);
}
@Override
public String getPlanStepRoleCodeByButtonCode(String buttonCode) {
if (StringUtils.isNotBlank(buttonCode)) {
List<PlanStepJsonVO> result = getPlanStepJsonVOS();
List<PlanStepJsonVO> collect = result.stream().filter(x -> buttonCode.equalsIgnoreCase(x.getButtonCode())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
return collect.get(0).getRoleCode();
}
}
return null;
}
} }
package com.yeejoin.amos.fas.business.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.dao.mapper.ContingencyInstanceInfoMapper;
import com.yeejoin.amos.fas.business.service.intfc.ContingencyInstanceInfoService;
import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO;
import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
@Service("contingencyInstanceInfoService")
public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceInfoService {
@Autowired
private ContingencyInstanceInfoMapper contingencyInstanceInfoMapper;
@Override
public ContingencyInstanceInfoVO selectDisposalDetails(String disposalId) {
ContingencyInstanceInfoVO instanceInfo = contingencyInstanceInfoMapper.selectDisposalDetails(disposalId);
if (!ObjectUtils.isEmpty(instanceInfo.getStartTime()) && !ObjectUtils.isEmpty(instanceInfo.getEndTime())){
String datePoorToMin = getDatePoorToMin(instanceInfo.getEndTime(), instanceInfo.getStartTime());
instanceInfo.setDuration(datePoorToMin);
}
return instanceInfo;
}
@Override
public Page<ContingencyInstanceInfoVO> selectDisposalListPage(int current, int size, String orgCode) {
Page<ContingencyInstanceInfoVO> page = new Page<>(current, size);
int total = contingencyInstanceInfoMapper.selectCount(orgCode);
page.setTotal(total);
long start = (page.getCurrent() - 1) * page.getSize();
if (total == 0) {
page.setCurrent(1);
} else {
if (total < start) {
page.setCurrent(1);
start = 0;
}
List<ContingencyInstanceInfoVO> infoList = contingencyInstanceInfoMapper.selectDisposalListPage((int) start, size, orgCode);
for (ContingencyInstanceInfoVO instanceInfo : infoList) {
if (!ObjectUtils.isEmpty(instanceInfo.getStartTime()) && !ObjectUtils.isEmpty(instanceInfo.getEndTime())){
String datePoorToMin = getDatePoorToMin(instanceInfo.getEndTime(), instanceInfo.getStartTime());
instanceInfo.setDuration(datePoorToMin);
}
}
page.setRecords(infoList);
}
return page;
}
@Override
public Boolean addDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo) {
contingencyInstanceInfo.setIsDelete(false);
contingencyInstanceInfo.setCreateDate(DateUtil.getDateNow());
return contingencyInstanceInfoMapper.addDisposalDetails(contingencyInstanceInfo);
}
@Override
public Boolean updateDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo) {
return contingencyInstanceInfoMapper.updateDisposalDetails(contingencyInstanceInfo);
}
@Override
public Boolean updateEndTimeById(String id) {
ContingencyInstanceInfoVO instanceInfoVO = selectDisposalDetails(id);
ContingencyInstanceInfo instanceInfo = new ContingencyInstanceInfo();
BeanUtils.copyProperties(instanceInfoVO, instanceInfo);
if (instanceInfo != null) {
instanceInfo.setEndTime(new Date());
return contingencyInstanceInfoMapper.updateDisposalDetails(instanceInfo);
}
return false;
}
public static String getDatePoorToMin(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff / nh;
// 计算差多少分钟
long min = diff % nh / nm;
// 计算差多少秒//输出结果
long sec = diff % nd % nh % nm / ns;
return hour + "小时" + min + "分钟 " + sec + "秒";
}
}
...@@ -61,6 +61,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -61,6 +61,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Autowired @Autowired
private EquipmentSpecificMapper equipmentSpecificMapper; private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired @Autowired
private WarehouseStructureMapper warehouseStructureMapper;
@Autowired
private IEquipmentHandlerService equipmentHandlerService; private IEquipmentHandlerService equipmentHandlerService;
@Autowired @Autowired
private IContingencyPlanInstanceRepository repository; private IContingencyPlanInstanceRepository repository;
...@@ -69,6 +71,9 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -69,6 +71,9 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Qualifier("contingencyAction") @Qualifier("contingencyAction")
@Autowired @Autowired
private CustomerAction customerAction; private CustomerAction customerAction;
@Autowired
private ContingencyInstanceInfoService contingencyInstanceInfoService;
@Value("${systemctl.sync.switch}") @Value("${systemctl.sync.switch}")
...@@ -167,18 +172,25 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -167,18 +172,25 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
return result; return result;
} }
} }
String specificCode = equipmentSpecific.getCode();
String specificName = equipmentSpecific.getName();
Date date = new Date();
// 插入预案基本信息
ContingencyInstanceInfo instanceInfo = new ContingencyInstanceInfo();
instanceInfo.setStartTime(date);
instanceInfo.setEquipmentCode(specificCode);
instanceInfo.setEquipmentName(specificName);
//插入运行记录表 //插入运行记录表
PlanOperationRecord PlanOperationRecord = new PlanOperationRecord(); PlanOperationRecord PlanOperationRecord = new PlanOperationRecord();
PlanOperationRecord.setStatus(PlanRecordStatusEnum.OPERATION.getCode()); PlanOperationRecord.setStatus(PlanRecordStatusEnum.OPERATION.getCode());
PlanOperationRecord.setPlanId(PlanDetailOp.get().getId()); PlanOperationRecord.setPlanId(PlanDetailOp.get().getId());
PlanOperationRecord.setIsDelete(false); PlanOperationRecord.setIsDelete(false);
PlanOperationRecord.setStartTime(new Date()); PlanOperationRecord.setStartTime(date);
PlanOperationRecord.setPlanPattern(vo.getStatus()); PlanOperationRecord.setPlanPattern(vo.getStatus());
PlanOperationRecord.setStartUserId(vo.getUserId()); PlanOperationRecord.setStartUserId(vo.getUserId());
PlanOperationRecord.setStartUserName(vo.getUserName()); PlanOperationRecord.setStartUserName(vo.getUserName());
PlanOperationRecord.setEquipmentCode(equipmentSpecific.getCode()); PlanOperationRecord.setEquipmentCode(specificCode);
PlanOperationRecord.setEquipmentName(equipmentSpecific.getName()); PlanOperationRecord.setEquipmentName(specificName);
PlanOperationRecord.setEquipmentId(equipmentSpecific.getId()); PlanOperationRecord.setEquipmentId(equipmentSpecific.getId());
PlanOperationRecord.setFireEquipmentId(equipment.getId()); PlanOperationRecord.setFireEquipmentId(equipment.getId());
if (ContingencyPlanStatusEnum.SIMULATION_START.getCode().equals(vo.getStatus())) { if (ContingencyPlanStatusEnum.SIMULATION_START.getCode().equals(vo.getStatus())) {
...@@ -205,6 +217,16 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -205,6 +217,16 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
//更新预案执行记录表的批次号 //更新预案执行记录表的批次号
operationRecord.setBatchNo(batchNo); operationRecord.setBatchNo(batchNo);
PlanOperationRecord record = planOperationRecordDao.save(operationRecord); PlanOperationRecord record = planOperationRecordDao.save(operationRecord);
// 保存预案基本信息
instanceInfo.setId(batchNo);
instanceInfo.setName(detail.getPlanName());
instanceInfo.setOrgCode(detail.getOrgCode());
WarehouseStructure warehouseStructure = warehouseStructureMapper.getMessageById(equipmentSpecific.getWarehouseStructureId());
if (warehouseStructure != null) {
instanceInfo.setPosition(warehouseStructure.getName());
}
contingencyInstanceInfoService.addDisposalDetails(instanceInfo);
// 异步数据同步之消息发送 // 异步数据同步之消息发送
planOperationRecordDataSync(record); planOperationRecordDataSync(record);
result.setMessage(ReserveEnum.RUN.getText()); result.setMessage(ReserveEnum.RUN.getText());
...@@ -774,6 +796,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -774,6 +796,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
if (!planList.isEmpty()) { if (!planList.isEmpty()) {
planList.forEach(PlanOperationRecord -> { planList.forEach(PlanOperationRecord -> {
String batchNo = PlanOperationRecord.getBatchNo(); String batchNo = PlanOperationRecord.getBatchNo();
customerAction.intreeuptPlan(batchNo);
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning()); redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
Optional<Equipment> equipment; Optional<Equipment> equipment;
try { try {
...@@ -786,7 +809,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -786,7 +809,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
equip.setStatus(NumberEnum.ONE.getValue()); equip.setStatus(NumberEnum.ONE.getValue());
equipmentService.save(equip); equipmentService.save(equip);
}); });
customerAction.intreeuptPlan(batchNo);
} catch (Exception e) { } catch (Exception e) {
logger.info("预案重置失败batchNo:{}", batchNo, e); logger.info("预案重置失败batchNo:{}", batchNo, e);
e.printStackTrace(); e.printStackTrace();
...@@ -820,8 +842,18 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -820,8 +842,18 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
} }
@Override @Override
public Boolean getPlanStatus() { public List<PlanOperationRecord> getPlanStatus() {
return CollectionUtils.isEmpty(planOperationRecordDao.findByStatus(0)); return planOperationRecordDao.findByStatus(0);
// return CollectionUtils.isEmpty(planOperationRecordDao.findByStatus(0));
}
@Override
public String getPlanBatchNo() {
List<PlanOperationRecord> records = planOperationRecordDao.findByStatus(0);
if (!CollectionUtils.isEmpty(records)) {
return records.get(0).getBatchNo();
}
return "";
} }
@Override @Override
...@@ -830,9 +862,14 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -830,9 +862,14 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
List<PlanOperationRecord> recordList = planOperationRecordDao.findByStatus(0); List<PlanOperationRecord> recordList = planOperationRecordDao.findByStatus(0);
if (!CollectionUtils.isEmpty(recordList)) { if (!CollectionUtils.isEmpty(recordList)) {
PlanOperationRecord record = recordList.get(0); PlanOperationRecord record = recordList.get(0);
map.put("planName", record.getBatchNo()); String batchNo = record.getBatchNo();
List<ContingencyPlanInstance> list = planVisual3dService.selectDisposalActionList(record.getBatchNo(), roleModelList, 1); ContingencyInstanceInfoVO instanceInfo = contingencyInstanceInfoService.selectDisposalDetails(batchNo);
map.put("taskNum", list.size()); if (instanceInfo != null) {
map.put("planName", instanceInfo.getName());
map.put("batchNo", batchNo);
List<ContingencyPlanInstanceVO> list = planVisual3dService.selectDisposalActionList(batchNo, roleModelList, 1);
map.put("taskNum", list.size());
}
} }
return map; return map;
} }
......
...@@ -112,13 +112,9 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -112,13 +112,9 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
Integer total = Integer.parseInt(map.get("total").toString()); Integer total = Integer.parseInt(map.get("total").toString());
Integer count = Integer.parseInt(map.get("count").toString()); Integer count = Integer.parseInt(map.get("count").toString());
if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) { if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) {
if (total.equals(count)) { return total.equals(count);
return true;
}
} else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) { } else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) {
if (count != 0) { return count != 0;
return true;
}
} }
} }
return false; return false;
......
...@@ -2,29 +2,40 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,29 +2,40 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.*; import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.*; import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer; import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
import com.yeejoin.amos.fas.business.feign.PushFeign; import com.yeejoin.amos.fas.business.feign.PrivilegeFeign;
import com.yeejoin.amos.fas.business.jpush.JPushTypeEnum; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import com.yeejoin.amos.fas.business.service.intfc.IDictService; import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.service.model.ToipResponse; import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.JSONUtil; import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.util.StringUtil; import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.business.vo.ButtonJsonVO;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO;
import com.yeejoin.amos.fas.business.vo.MessageVO;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.business.vo.PlanStepVo; import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -32,6 +43,7 @@ import org.springframework.stereotype.Service; ...@@ -32,6 +43,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
...@@ -77,18 +89,39 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -77,18 +89,39 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired @Autowired
IContingencyPlanInstanceRepository iContingencyPlanInstanceRepository; IContingencyPlanInstanceRepository iContingencyPlanInstanceRepository;
@Autowired @Autowired
private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper; private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Autowired
private WebMqttComponent webMqttComponent;
@Value("classpath:/json/plan-step.json") @Value("classpath:/json/plan-step.json")
private Resource planStepResource; private Resource planStepResource;
@Autowired @Autowired
private PushFeign pushFeign; private IContingencyPlanInstanceRepository repository;
@Value("${spring.application.name}")
private String serviceName;
@Value("${station.name}")
private String stationName;
@Autowired @Autowired
private IContingencyPlanInstanceRepository repository; private PrivilegeFeign privilegeFeign;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Value("${plan.instance.personImg}")
private String personImg;
@Value("${plan.instance.playImg}")
private String playImg;
@Value("${aurora.push.switch}")
private Boolean auroraPushSwitch;
@Override @Override
...@@ -360,72 +393,39 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -360,72 +393,39 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
@Override @Override
public ContingencyInstanceInfo selectDisposalDetails(String disposalId) { public Page<ContingencyPlanInstanceVO> getPlaneRecordByNew(Integer pageNum, Integer size, String batchNo, AgencyUserModel user) {
return contingencyInstanceInfoMapper.selectDisposalDetails(disposalId);
}
@Override
public Page<ContingencyInstanceInfo> selectDisposalListPage(int current, int size, String orgCode) {
Page<ContingencyInstanceInfo> page = new Page<>(current, size);
int total = contingencyInstanceInfoMapper.selectCount(orgCode);
page.setTotal(total);
long start = (page.getCurrent() - 1) * page.getSize();
if (total == 0) {
page.setCurrent(1);
} else {
if (total < start) {
page.setCurrent(1);
start = 0;
}
List<ContingencyInstanceInfo> infoList = contingencyInstanceInfoMapper.selectDisposalListPage((int) start, size, orgCode);
page.setRecords(infoList);
}
return page;
}
@Override
public Boolean addDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo) {
contingencyInstanceInfo.setIsDelete(false);
contingencyInstanceInfo.setCreateDate(DateUtil.getDateNow());
return contingencyInstanceInfoMapper.addDisposalDetails(contingencyInstanceInfo);
}
@Override
public Boolean updateDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo) {
return contingencyInstanceInfoMapper.updateDisposalDetails(contingencyInstanceInfo);
}
@Override
public Page<ContingencyPlanInstance> getPlaneRecordByNew(Integer pageNum, Integer size, String batchNo) {
Integer planInstanceCount = contingencyPlanInstanceMapper.getPlanInstanceCount(batchNo); Integer planInstanceCount = contingencyPlanInstanceMapper.getPlanInstanceCount(batchNo);
// 根据批次号获取预案记录 // 根据批次号获取预案记录
List<ContingencyPlanInstance> planInstanceListByPage = contingencyPlanInstanceMapper.getPlanInstanceListByPage(batchNo, (pageNum - 1) * size, size); List<ContingencyPlanInstance> planInstanceListByPage = contingencyPlanInstanceMapper.getPlanInstanceListByPage(batchNo, (pageNum - 1) * size, size);
List<ContingencyPlanInstanceVO> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(planInstanceListByPage)) { if (!CollectionUtils.isEmpty(planInstanceListByPage)) {
planInstanceListByPage.stream().sorted(Comparator.comparing(ContingencyPlanInstance::getCreateDate)).collect(Collectors.toList()); planInstanceListByPage.stream().forEach(item -> {
ContingencyPlanInstanceVO instanceVO = new ContingencyPlanInstanceVO();
BeanUtils.copyProperties(item, instanceVO);
instanceVO.setLoginUserId(user.getUserId());
instanceVO.setPlayImg(playImg);
list.add(instanceVO);
});
} }
Page<ContingencyPlanInstance> page = new Page<>(); List<ContingencyPlanInstanceVO> collect = list.stream().sorted(Comparator.comparing(ContingencyPlanInstanceVO::getCreateDate)).collect(Collectors.toList());
Page<ContingencyPlanInstanceVO> page = new Page<>();
page.setTotal(planInstanceCount); page.setTotal(planInstanceCount);
page.setCurrent(pageNum); page.setCurrent(pageNum);
page.setSize(size); page.setSize(size);
page.setRecords(planInstanceListByPage); page.setRecords(collect);
return page; return page;
} }
@Override @Override
public void replyMessage(AgencyUserModel user, ContingencyPlanInstance dto) { public ContingencyPlanInstance replyMessage(AgencyUserModel user, ContingencyPlanInstance dto) {
String json = ""; String json = "";
try { try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8)); json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("获取预案相关角色信息失败!"); throw new RuntimeException("获取预案相关角色信息失败!");
} }
List<Object> list = JSON.parseArray(json); List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
List<Map<String, String>> result = new ArrayList<Map<String, String>>(); List<String> roleCode = result.stream().map(PlanStepJsonVO::getRoleCode).distinct().collect(Collectors.toList());
for (Object object : list) {
Map<String, String> ret = (Map<String, String>) object;
result.add(ret);
}
List<String> roleCode = result.stream().map(t -> t.get("roleCode")).distinct().collect(Collectors.toList());
List<RoleModel> roleModelList = new ArrayList<>(); List<RoleModel> roleModelList = new ArrayList<>();
for (Long key : user.getOrgRoles().keySet()) { for (Long key : user.getOrgRoles().keySet()) {
...@@ -444,29 +444,27 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -444,29 +444,27 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
roleNameList.add(item.getRoleDesc()); roleNameList.add(item.getRoleDesc());
} }
}); });
dto.setRoleCode(String.join(",", roleCodeList)); dto.setRoleCode(String.join("-", roleCodeList));
dto.setRoleName(String.join(",", roleNameList)); dto.setRoleName(String.join("-", roleNameList));
dto.setStartUserId(user.getUserId()); dto.setStartUserId(user.getUserId());
dto.setStartUserId(user.getRealName()); dto.setStartUserName(user.getRealName());
dto.setRecordType("REPLYMESSAGE"); dto.setRecordType("REPLYMESSAGE");
dto.setCreateDate(new Date());
Map<String, String> userInfo = contingencyPlanInstanceMapper.getUserByUserId(user.getUserId()); Map<String, String> userInfo = contingencyPlanInstanceMapper.getUserByUserId(user.getUserId());
dto.setPersonImg(userInfo.get("personImg")); dto.setPersonImg(ObjectUtils.isEmpty(userInfo) ? personImg : userInfo.getOrDefault("personImg", personImg));
dto.setContent(StringUtil.isNotEmpty(dto.getContent()) ? dto.getContent() : "");
repository.save(dto); repository.save(dto);
PushMsgParam pushMsgParam = new PushMsgParam(); String topic = String.format("/%s/%s/%s", serviceName, stationName, "plan");
// TODO: 2022/10/18 接收人需从平台获取 webMqttComponent.publish(topic, "{\"msgType\":\"replayMessage\"}");
pushMsgParam.setRecivers(Lists.newArrayList("")); return dto;
pushMsgParam.setContent(JSONUtil.toJson(dto));
pushMsgParam.setSubject("REPLYMESSAGE");
pushMsgParam.setType(JPushTypeEnum.REPLY_MESSAGE.getCode());
pushFeign.sendMessageone(pushMsgParam);
} }
@Override @Override
public Page<ContingencyPlanInstance> selectDisposalActionPage(int current, int size, String disposalId, List<RoleModel> roleModelList, int dataType) { public Page<ContingencyPlanInstanceVO> selectDisposalActionPage(int current, int size, String disposalId, List<RoleModel> roleModelList, int dataType) {
List<String> roles = new ArrayList<>(); List<String> roles = new ArrayList<>();
String type = "OPERATE"; String type = "OPERATE";
String status = ""; String status = "";
Page<ContingencyPlanInstance> page = new Page<>(current, size); Page<ContingencyPlanInstanceVO> page = new Page<>(current, size);
if ("1".equals(String.valueOf(dataType))) { if ("1".equals(String.valueOf(dataType))) {
for (RoleModel roleModel : roleModelList) { for (RoleModel roleModel : roleModelList) {
roles.add(roleModel.getRoleName()); roles.add(roleModel.getRoleName());
...@@ -494,7 +492,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -494,7 +492,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
page.setCurrent(1); page.setCurrent(1);
start = 0; start = 0;
} }
List<ContingencyPlanInstance> list = contingencyInstanceInfoMapper.selectDisposalActionPage((int) start, size, type, status, roles, disposalId); List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.selectDisposalActionPage((int) start, size, type, status, roles, disposalId);
page.setRecords(list); page.setRecords(list);
page.setTotal(total); page.setTotal(total);
} }
...@@ -502,7 +500,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -502,7 +500,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
@Override @Override
public List<ContingencyPlanInstance> selectDisposalActionList(String disposalId, List<RoleModel> roleModelList, int dataType) { public List<ContingencyPlanInstanceVO> selectDisposalActionList(String batchNo, List<RoleModel> roleModelList, int dataType) {
List<String> roles = new ArrayList<>(); List<String> roles = new ArrayList<>();
String type = "OPERATE"; String type = "OPERATE";
String status = ""; String status = "";
...@@ -518,7 +516,121 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -518,7 +516,121 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
roles.add(roleModel.getRoleName()); roles.add(roleModel.getRoleName());
} }
} }
return contingencyInstanceInfoMapper.selectDisposalActionList(type, status, roles, disposalId); return contingencyInstanceInfoMapper.selectDisposalActionList(type, status, roles, batchNo);
}
@Override
public void sendMessage(String buttonCode, MessageVO messageVO) {
// 添加极光推送开关
if (auroraPushSwitch) {
List<String> userIds = getUserIds(buttonCode);
if (!CollectionUtils.isEmpty(userIds)) {
messageVO.setRecivers(userIds);
sendMessage(messageVO);
}
}
}
private void sendMessage(MessageVO messageVO){
try {
MessageModel model = new MessageModel();
model.setMsgType(messageVO.getMsgType());
// 关联id
if (!ObjectUtils.isEmpty(messageVO.getRelationId())){
model.setRelationId(messageVO.getRelationId());
}
// 发送人ids
model.setRecivers(messageVO.getRecivers());
model.setIsSendApp(messageVO.getIsSendApp());
model.setIsSendWeb(messageVO.getIsSendWeb());
if (!ObjectUtils.isEmpty(messageVO) && !ObjectUtils.isEmpty(messageVO.getTitle())){
model.setTitle(messageVO.getTitle());
}
if (!ObjectUtils.isEmpty(messageVO) && !ObjectUtils.isEmpty(messageVO.getBody())){
model.setBody(messageVO.getBody());
}
model.setTerminal(messageVO.getTerminal());
model.setCategory(messageVO.getCategory());
if (StringUtils.isBlank(model.getBody()) || StringUtils.isBlank(model.getTitle())) {
return;
}
model.setRelationId(String.valueOf(System.currentTimeMillis()));
Systemctl.messageClient.create(model);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean updateStatusById(String id) {
// 按钮去除
ContingencyPlanInstance instance = contingencyPlanInstanceMapper.getMessageById(id);
String content = null;
ButtonJsonVO buttonJsonVO;
if (!ObjectUtils.isEmpty(instance.getContent())){
buttonJsonVO = JSONObject.parseObject(instance.getContent(), ButtonJsonVO.class);
if (!ObjectUtils.isEmpty(buttonJsonVO.getOperate()) && buttonJsonVO.getOperate().size() > 1){
ArrayList<Map<String, Object>> maps = new ArrayList<>();
// 取最后一个按钮
maps.add(buttonJsonVO.getOperate().get(buttonJsonVO.getOperate().size() - 1));
buttonJsonVO.setOperate(maps);
content = JSONObject.toJSONString(buttonJsonVO);
}
}
return contingencyPlanInstanceMapper.updateStatusById(id, content);
}
private List<String> getUserIds(String buttonCode) {
String planStepJson = "";
try {
planStepJson = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案相关角色信息失败!");
}
List<PlanStepJsonVO> planStepJsonList = JSONObject.parseArray(planStepJson, PlanStepJsonVO.class);
List<String> collect = planStepJsonList.stream().filter(code -> code.getButtonCode().equals(buttonCode)).map(PlanStepJsonVO::getRoleCode).collect(Collectors.toList());
Toke toke = remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.product);
RequestContext.setAppKey(toke.appKey);
ArrayList<String> userIds = new ArrayList<>();
ArrayList<String> roleIds = new ArrayList<>();
// 查询按钮下角色id
for (String roleName : collect) {
FeignClientResult roleList;
List<Map> roleModelList = null;
try {
roleList = privilegeFeign.getRoleList(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), roleName);
roleModelList = (List<Map>) roleList.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
if (!CollectionUtils.isEmpty(roleModelList)) {
for (Map map : roleModelList) {
roleIds.add(String.valueOf(map.get("sequenceNbr")));
}
}
}
// 查询角色下用户
FeignClientResult userResult;
List<Map> userList = null;
try {
userResult = privilegeFeign.getUserByRoleIds(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), String.join(",", roleIds));
userList = (List<Map>) userResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
if (!CollectionUtils.isEmpty(userList)) {
for (Map map : userList) {
userIds.add(String.valueOf(map.get("userId")));
}
}
return userIds;
} }
@Override @Override
......
...@@ -193,6 +193,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -193,6 +193,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private WebMqttComponent webMqttComponent;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Override @Override
public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception { public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception {
RiskSource riskSource = (RiskSource) map.get("param"); RiskSource riskSource = (RiskSource) map.get("param");
...@@ -2010,6 +2013,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -2010,6 +2013,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return riskSource; return riskSource;
} }
@Autowired
private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Override
public Page<Map<String, Object>> getWaterInfo(CommonPageable commonPageable, String bizOrgCode) {
List<Map<String, Object>> content = Lists.newArrayList();
long total = contingencyPlanInstanceMapper.countWater(bizOrgCode);
if (total <= 0) {
return new PageImpl<>(content, commonPageable, total);
}
Integer start = (commonPageable.getPageNumber() - 1) * commonPageable.getPageSize();
content = contingencyPlanInstanceMapper.getWaterInfo(start, commonPageable.getPageSize(), bizOrgCode);
return new PageImpl<>(content, commonPageable, total);
}
} }
...@@ -17,7 +17,6 @@ import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao; ...@@ -17,7 +17,6 @@ import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao; import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao; import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao;
import com.yeejoin.amos.fas.business.dao.repository.ISafetyIndexChangeLogDao; import com.yeejoin.amos.fas.business.dao.repository.ISafetyIndexChangeLogDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.JcsFeign; import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService; import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService;
...@@ -57,10 +56,6 @@ import java.util.*; ...@@ -57,10 +56,6 @@ import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao;
//import com.yeejoin.amos.fas.dao.entity.FireStation;
//import com.yeejoin.amos.fas.dao.entity.WaterResource;
/** /**
* @author DELL * @author DELL
*/ */
...@@ -74,11 +69,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -74,11 +69,9 @@ public class View3dServiceImpl implements IView3dService {
@Autowired @Autowired
private IRiskSourceDao iRiskSourceDao; private IRiskSourceDao iRiskSourceDao;
@Autowired @Autowired
private IEquipmentDao iEquipmentDao; private IEquipmentDao iEquipmentDao;
// @Autowired
// private IWaterResourceDao iWaterResourceDao;
@Autowired @Autowired
private PatrolMapper patrolMapper; private PatrolMapper patrolMapper;
@Autowired @Autowired
...@@ -87,9 +80,6 @@ public class View3dServiceImpl implements IView3dService { ...@@ -87,9 +80,6 @@ public class View3dServiceImpl implements IView3dService {
private ISafetyIndexChangeLogDao iSafetyIndexChangeLogDao; private ISafetyIndexChangeLogDao iSafetyIndexChangeLogDao;
@Autowired @Autowired
private IDutyModeServer dutyModeServer;
@Autowired
private JcsFeign jcsFeign; private JcsFeign jcsFeign;
@Value("${param.system.online.date}") @Value("${param.system.online.date}")
...@@ -134,11 +124,7 @@ public class View3dServiceImpl implements IView3dService { ...@@ -134,11 +124,7 @@ public class View3dServiceImpl implements IView3dService {
this.updateFireCarPosition(pointBo); this.updateFireCarPosition(pointBo);
case "fireChamber": case "fireChamber":
case "fireFoamRoom": case "fireFoamRoom":
// this.updateFireStationPosition(pointBo);
// break;
case "hydrant": case "hydrant":
// case "pool":
// this.updateWaterSourcePosition(pointBo);
break; break;
default: default:
log.error("不支持的类型-->" + pointType); log.error("不支持的类型-->" + pointType);
...@@ -160,34 +146,6 @@ public class View3dServiceImpl implements IView3dService { ...@@ -160,34 +146,6 @@ public class View3dServiceImpl implements IView3dService {
// } // }
} }
// public void updateWaterSourcePosition(BindPointBo pointBo) {
// Optional<WaterResource> data = iWaterResourceDao.findById(pointBo.getPointId());
// if(data.isPresent()){
// WaterResource waterResource = data.get();
// String ue4Location = pointBo.getUe4Location();
// String ue4Rotation = pointBo.getUe4Rotation();
// String position3d = pointBo.getPosition3d();
// if(ue4Location != null) waterResource.setUe4Location(ue4Location);
// if(ue4Rotation != null) waterResource.setUe4Rotation(ue4Rotation);
// if(position3d != null) waterResource.setPosition3d(position3d);
// iWaterResourceDao.save(waterResource);
// }
// }
// public void updateFireStationPosition(BindPointBo pointBo) {
// Optional<FireStation> data = iFireStationDao.findById(pointBo.getPointId());
// if(data.isPresent()){
// FireStation fireStation = data.get();
// String ue4Location = pointBo.getUe4Location();
// String ue4Rotation = pointBo.getUe4Rotation();
// String position3d = pointBo.getPosition3d();
// if(ue4Location != null) fireStation.setUe4Location(ue4Location);
// if(ue4Rotation != null) fireStation.setUe4Rotation(ue4Rotation);
// if(position3d != null) fireStation.setPosition3d(position3d);
// iFireStationDao.save(fireStation);
// }
// }
public void updateFireEquipmentPosition(BindPointBo pointBo) { public void updateFireEquipmentPosition(BindPointBo pointBo) {
// Optional<FireEquipment> data = iFireEquipmentDao.findById(pointBo.getPointId()); // Optional<FireEquipment> data = iFireEquipmentDao.findById(pointBo.getPointId());
// if(data.isPresent()){ // if(data.isPresent()){
......
package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
public interface ContingencyInstanceInfoService {
ContingencyInstanceInfoVO selectDisposalDetails(String batchNo);
Page<ContingencyInstanceInfoVO> selectDisposalListPage(int current, int size, String orgCode);
Boolean addDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo);
Boolean updateDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo);
/**
* 通过ID更新预案的结束时间
* @param id
* @return
*/
Boolean updateEndTimeById(String id);
}
...@@ -23,5 +23,26 @@ public interface IContingencyInstance { ...@@ -23,5 +23,26 @@ public interface IContingencyInstance {
void updateStep(String step, String batchNo); void updateStep(String step, String batchNo);
Optional<Equipment> fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String token, String product) throws Exception; Optional<Equipment> fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String token, String product, String appKey) throws Exception;
/**
* 扩展属性赋值
* @param contingencyPlanInstance
* @return
*/
ContingencyPlanInstance updateExtendColumn(ContingencyPlanInstance contingencyPlanInstance);
/**
* 根据id 查询信息
* @param id
* @return
*/
ContingencyPlanInstance getMessageById(String id);
/**
* 通过buttonCode获取执行角色编码
* @param buttonCode
* @return
*/
String getPlanStepRoleCodeByButtonCode(String buttonCode);
} }
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.vo.ContingencyPlanResponseVo; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.vo.ContingencyPlanResponseVo;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo; import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.business.vo.Toke; import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.dao.entity.PlanDetail; import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -136,7 +137,9 @@ public interface IContingencyPlanService { ...@@ -136,7 +137,9 @@ public interface IContingencyPlanService {
AtomicBoolean planReset(); AtomicBoolean planReset();
Boolean getPlanStatus(); List<PlanOperationRecord> getPlanStatus();
Map<String, Object> getUserOperateCountAndPlanName(List<RoleModel> roleModelList); Map<String, Object> getUserOperateCountAndPlanName(List<RoleModel> roleModelList);
String getPlanBatchNo();
} }
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.service.model.ToipResponse; import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO;
import com.yeejoin.amos.fas.business.vo.MessageVO;
import com.yeejoin.amos.fas.business.vo.PlanStepVo; import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.PlanRule;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.web.bind.annotation.RequestParam;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import java.util.List; import java.util.List;
...@@ -31,7 +26,8 @@ public interface IPlanVisual3dService { ...@@ -31,7 +26,8 @@ public interface IPlanVisual3dService {
/** /**
* 上传文字预案 * 上传文字预案
* @param appId 预案ID *
* @param appId 预案ID
* @param pathNameMap 文字预案文件路径:文件名称map * @param pathNameMap 文字预案文件路径:文件名称map
*/ */
void uploadTextPlan(String appId, Map<String, String> pathNameMap); void uploadTextPlan(String appId, Map<String, String> pathNameMap);
...@@ -46,13 +42,13 @@ public interface IPlanVisual3dService { ...@@ -46,13 +42,13 @@ public interface IPlanVisual3dService {
CommonResponse getResourceListByType(String type); CommonResponse getResourceListByType(String type);
List<Map<String,Object>> getResourceById(String type,Long id); List<Map<String, Object>> getResourceById(String type, Long id);
List<Map<String,Object>> getResourceTypeList(); List<Map<String, Object>> getResourceTypeList();
List<TreeSubjectVo> getTextPlanBySubjectId(String appId); List<TreeSubjectVo> getTextPlanBySubjectId(String appId);
void deleteTextPlanFile(Long id); void deleteTextPlanFile(Long id);
/** /**
* 查最新在执行的批次号 * 查最新在执行的批次号
...@@ -67,8 +63,10 @@ public interface IPlanVisual3dService { ...@@ -67,8 +63,10 @@ public interface IPlanVisual3dService {
*/ */
String getLastBatchNo(); String getLastBatchNo();
/** /**
* 根据批次号获取预案步骤 * 根据批次号获取预案步骤
*
* @param batchNo 批次号 * @param batchNo 批次号
* @return 预案步骤 * @return 预案步骤
*/ */
...@@ -76,6 +74,7 @@ public interface IPlanVisual3dService { ...@@ -76,6 +74,7 @@ public interface IPlanVisual3dService {
/** /**
* 根据批次号获取预案记录 * 根据批次号获取预案记录
*
* @param batchNo 批次号 * @param batchNo 批次号
* @return 预案记录 * @return 预案记录
*/ */
...@@ -83,6 +82,7 @@ public interface IPlanVisual3dService { ...@@ -83,6 +82,7 @@ public interface IPlanVisual3dService {
/** /**
* 根据批次号获取预案记录 * 根据批次号获取预案记录
*
* @param batchNo 批次号 * @param batchNo 批次号
* @return 预案记录 * @return 预案记录
*/ */
...@@ -90,25 +90,34 @@ public interface IPlanVisual3dService { ...@@ -90,25 +90,34 @@ public interface IPlanVisual3dService {
PlanStepVo updatePlanStep(PlanStepVo planStepVo); PlanStepVo updatePlanStep(PlanStepVo planStepVo);
ContingencyInstanceInfo selectDisposalDetails(String disposalId); Page<ContingencyPlanInstanceVO> selectDisposalActionPage(int current, int size, String batchNo, List<RoleModel> roleModelList, int dataType);
Page<ContingencyInstanceInfo> selectDisposalListPage(int current, int size, String orgCode);
Boolean addDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo);
Boolean updateDisposalDetails(ContingencyInstanceInfo contingencyInstanceInfo);
Page<ContingencyPlanInstance> selectDisposalActionPage(int current, int size, String disposalId , List<RoleModel> roleModelList, int dataType);
/** /**
* 根据批次号获取预案的消息等记录 * 根据批次号获取预案的消息等记录
*
* @param batchNo * @param batchNo
* @return * @return
*/ */
Page<ContingencyPlanInstance> getPlaneRecordByNew(Integer pageNum, Integer size, String batchNo); Page<ContingencyPlanInstanceVO> getPlaneRecordByNew(Integer pageNum, Integer size, String batchNo, AgencyUserModel user);
ContingencyPlanInstance replyMessage(AgencyUserModel user, ContingencyPlanInstance dto);
List<ContingencyPlanInstanceVO> selectDisposalActionList(String batchNo, List<RoleModel> roleModelList, int dataType);
void replyMessage(AgencyUserModel user, ContingencyPlanInstance dto); /**
* 极光推送消息
*
* @param buttonCode
* @param messageVO
*/
void sendMessage(String buttonCode, MessageVO messageVO);
List<ContingencyPlanInstance> selectDisposalActionList(String disposalId , List<RoleModel> roleModelList, int dataType);
/**
* 修改动作执行状态
*
* @param id
* @return
*/
boolean updateStatusById(String id);
} }
...@@ -220,4 +220,6 @@ public interface IRiskSourceService { ...@@ -220,4 +220,6 @@ public interface IRiskSourceService {
void processProtalDataFromDanger(DangerResultBo dangerResultBo) throws Exception; void processProtalDataFromDanger(DangerResultBo dangerResultBo) throws Exception;
RiskSource updateAreaSyn(String code, String compCode, RiskSourceSynBo synBo); RiskSource updateAreaSyn(String code, String compCode, RiskSourceSynBo synBo);
Page<Map<String, Object>> getWaterInfo(CommonPageable commonPageable, String bizOrgCode);
} }
package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class ButtonJsonVO {
String type;
String stepCode;
List<Map<String, Object>> operate;
}
package com.yeejoin.amos.fas.business.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "应急预案执行记录实例", description = "应急预案执行记录实例")
public class ContingencyInstanceInfoVO {
private String id;
private String name;
private String position;
private String equipmentCode;
private String equipmentName;
private Date startTime;
private Date endTime;
private Boolean isDelete = false;
private Date createDate;
private String orgCode;
private String duration;
}
package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
import java.util.Date;
@Data
public class ContingencyPlanInstanceVO {
protected String id;
private String recordType;// 记录类型:消息MESSAGE,操作OPERATE ,回复消息REPLYMESSAGE
private String content ;// 记录内容:文本信息或者json数据
private String category;//一级分类
private String icon ; //图标,url,或者文件名
private Integer sort ;// 所有节点一起的排序号
private String sequenceNum ;// 用于显示的序号
private String batchNo ;// 预案实例编号,暂时无法区分多个火灾,暂时存储报警设备id
private String tips;
private Boolean runstate;
private String filePath; //文件名称
private String fileType;// 文件类型
private String roleName; //角色名称
private String roleCode; //角色编码
private String startUserName; //人员名称
private String startUserId; //人员ID
private String personImg;
private String playImg;
private String loginUserId;
private String name;
private Date createDate;
private String createUser;
private Date updateDate;
private String updateUser;
private Boolean isDelete = false;
}
...@@ -29,6 +29,9 @@ public class EquipmentSpecificForRiskVo { ...@@ -29,6 +29,9 @@ public class EquipmentSpecificForRiskVo {
@ApiModelProperty(value = "detailid") @ApiModelProperty(value = "detailid")
private Long equipmentDetailId; private Long equipmentDetailId;
@ApiModelProperty(value = "warehouseStructureId")
private Long warehouseStructureId;
@ApiModelProperty(value = "二维码") @ApiModelProperty(value = "二维码")
private String qrCode; private String qrCode;
......
package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
import java.util.List;
@Data
public class MessageVO {
/**
* 接收人ids
*/
private List<String> recivers;
/**
* 关联id
*/
private String relationId;
private String title;
private String body;
/**
* 任务 0 通知 1
*/
private Integer category;
private String msgType;
private String terminal;
private Boolean isRead;
private Boolean isSendApp;
private Boolean isSendWeb;
}
package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
@Data
public class PlanStepJsonVO {
private String stepCode;
private String stepName;
private String stepStatus;
private String isParallel;
private String roleCode;
private String buttonCode;
}
...@@ -57,6 +57,13 @@ emqx.password=public ...@@ -57,6 +57,13 @@ emqx.password=public
#文件服务器地址 #文件服务器地址
file.downLoad.url=http://172.16.11.201:9000/ file.downLoad.url=http://172.16.11.201:9000/
#应急处置移动端默认头像地址
plan.instance.personImg=upload/3dview_icon/plan_via.png
plan.instance.playImg=upload/3dview_icon/plan_play.png
#应急预案动作执行默认角色编码
plan.default.roleCode=Digital_Responsing_Plan_A
# 是否使用rocketmq on/off # 是否使用rocketmq on/off
rocketmq.producer.sysIsUsed=off rocketmq.producer.sysIsUsed=off
#rocketmq生产者配置 #rocketmq生产者配置
...@@ -104,3 +111,22 @@ sso.client.secret=6t5oDDKhEODXa++UNUxxLHSF5kVqECq6j+wahtCbv8c= ...@@ -104,3 +111,22 @@ sso.client.secret=6t5oDDKhEODXa++UNUxxLHSF5kVqECq6j+wahtCbv8c=
sso.login.type=server_auth sso.login.type=server_auth
sso.login.client=dce sso.login.client=dce
sso.client.url=https://198.87.103.88:30443/oauth2/oauth/rest_token sso.client.url=https://198.87.103.88:30443/oauth2/oauth/rest_token
#Kafka 相关配置
kafka.producer.sysIsUsed = on
spring.kafka.bootstrap-servers=172.16.3.51:9092
###########【初始化生产者配置】###########
# 重试次数
spring.kafka.producer.retries=0
# 应答级别:多少个分区副本备份完成时向生产者发送ack确认(可选0、1、all/-1)
spring.kafka.producer.acks=1
# 批量大小
spring.kafka.producer.batch-size=16384
# 提交延时
spring.kafka.producer.properties.linger.ms=0
# 生产端缓冲区大小
spring.kafka.producer.buffer-memory = 33554432
# Kafka提供的序列化和反序列化类
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
...@@ -62,6 +62,8 @@ number.plan.projectName=换流站消防专项预案 ...@@ -62,6 +62,8 @@ number.plan.projectName=换流站消防专项预案
#站端名称使用全拼 与三维iotree 消息用到了,暂时统一设置为yinan #站端名称使用全拼 与三维iotree 消息用到了,暂时统一设置为yinan
station.name = yinan station.name = yinan
#极光推送开关
aurora.push.switch=false
param.safetyIndexChange.cron = 0 0 2 * * ? param.safetyIndexChange.cron = 0 0 2 * * ?
......
...@@ -746,13 +746,13 @@ ...@@ -746,13 +746,13 @@
ALTER TABLE `toip_rm_snapshot` MODIFY COLUMN `method_param` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '方法参数' AFTER `equipment_id`; ALTER TABLE `toip_rm_snapshot` MODIFY COLUMN `method_param` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '方法参数' AFTER `equipment_id`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="gaojianqiang" id="20221017-01"> <changeSet author="gaojianqiang" id="20221028-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<columnExists tableName="c_plan_rule" columnName="plan_step"/> <columnExists tableName="c_plan_rule" columnName="plan_step"/>
</preConditions> </preConditions>
<comment>修改属性字段值 plan_step</comment> <comment>修改属性字段值 plan_step</comment>
<sql> <sql>
UPDATE c_plan_rule SET plan_step = '[{"stepCode": "0", "stepName": "确认灾情", "buttonCode": "FIRE_CONFIRM", "isParallel": "1", "stepStatus": "0"}, {"stepCode": "1", "stepName": "停运换流阀", "buttonCode": "STOP_COMMUTATION", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "2", "stepName": "拨打报警电话", "buttonCode": "CALL_PHONE", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "3", "stepName": "确认油枕排油系统已开启", "buttonCode": "DRAIN_OIL_CONFIRM", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "4", "stepName": "确认水喷雾系统已开启", "buttonCode": "OPEN_WATERSYSTEM", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "5", "stepName": "断开上级电源", "buttonCode": "OFF_POWER", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "6", "stepName": "停运阀厅空调系统", "buttonCode": "STOP_AIRCON", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "7", "stepName": "一键开启消防炮", "buttonCode": "MONITOR_START", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "8", "stepName": "驻站消防队指挥权交接", "buttonCode": "HANDOVER_COMMAND", "isParallel": "1", "stepStatus": "0"}, {"stepCode": "9", "stepName": "确认本体排油已开启", "buttonCode": "OWNER_DRAIN_OIL", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "10", "stepName": "启动阀厅应急预案", "buttonCode": "START_VALVE_HALL_CONTINGENCY", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "11", "stepName": "电缆沟封堵", "buttonCode": "PLUG_CABLETRENCH", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "12", "stepName": "政府消防队指挥权交接", "buttonCode": "HANDOVER_FIGTHHING", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "13", "stepName": "确认明火扑灭", "buttonCode": "FIRE_EXTINCT", "isParallel": "0", "stepStatus": "0"}, {"stepCode": "14", "stepName": "应急处置结束", "buttonCode": "END_EMERGENCY", "isParallel": "1", "stepStatus": "0"}]'; UPDATE c_plan_rule SET plan_step = '[{"roleCode": "Digital_Responsing_Plan_A", "stepCode": "0", "stepName": "确认灾情", "buttonCode": "FIRE_CONFIRM", "isParallel": "1", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "1", "stepName": "停运换流阀", "buttonCode": "STOP_COMMUTATION", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "2", "stepName": "拨打报警电话", "buttonCode": "CALL_PHONE", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "3", "stepName": "确认油枕排油系统已开启", "buttonCode": "DRAIN_OIL_CONFIRM", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "4", "stepName": "确认水喷雾系统已开启", "buttonCode": "OPEN_WATERSYSTEM", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "5", "stepName": "断开上级电源", "buttonCode": "OFF_POWER", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "6", "stepName": "停运阀厅空调系统", "buttonCode": "STOP_AIRCON", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_A", "stepCode": "7", "stepName": "一键开启消防炮", "buttonCode": "MONITOR_START", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "8", "stepName": "驻站消防队指挥权交接", "buttonCode": "HANDOVER_COMMAND", "isParallel": "1", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "9", "stepName": "确认本体排油已开启", "buttonCode": "OWNER_DRAIN_OIL", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "10", "stepName": "启动阀厅应急预案", "buttonCode": "START_VALVE_HALL_CONTINGENCY", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "11", "stepName": "电缆沟封堵", "buttonCode": "PLUG_CABLETRENCH", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "12", "stepName": "政府消防队指挥权交接", "buttonCode": "HANDOVER_FIGTHHING", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "13", "stepName": "确认明火扑灭", "buttonCode": "FIRE_EXTINCT", "isParallel": "0", "stepStatus": "0"}, {"roleCode": "Digital_Responsing_Plan_B", "stepCode": "14", "stepName": "应急处置结束", "buttonCode": "END_EMERGENCY", "isParallel": "1", "stepStatus": "0"}]';
</sql> </sql>
</changeSet> </changeSet>
...@@ -811,4 +811,14 @@ ...@@ -811,4 +811,14 @@
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '应急预案执行记录实例' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '应急预案执行记录实例' ROW_FORMAT = Dynamic;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="gaojianqiang" id="20221026-01">
<preConditions onFail="MARK_RAN">
<columnExists tableName="contingency_plan_instance" columnName="update_date"/>
</preConditions>
<comment>修改属性字段 update_date</comment>
<sql>
ALTER TABLE `contingency_plan_instance`
MODIFY COLUMN `update_date` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) AFTER `create_user`;
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
</update> </update>
<select id="selectDisposalDetails" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo"> <select id="selectDisposalDetails" resultType="com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO">
select * from contingency_instance_info where id=#{id} select * from contingency_instance_info where id=#{id}
</select> </select>
<select id="selectDisposalListPage" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo"> <select id="selectDisposalListPage" resultType="com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO">
select * from contingency_instance_info where is_delete = 0 select * from contingency_instance_info where is_delete = 0
and org_code = #{orgCode} and org_code = #{orgCode}
ORDER BY create_date DESC ORDER BY create_date DESC
...@@ -34,25 +34,34 @@ ...@@ -34,25 +34,34 @@
select count(1) from contingency_instance_info select count(1) from contingency_instance_info
where is_delete = 0 and org_code = #{orgCode} where is_delete = 0 and org_code = #{orgCode}
</select> </select>
<select id="selectDisposalActionPage" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance"> <select id="selectDisposalActionPage" resultType="com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO">
select * from contingency_plan_instance select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num`
, cpi.`batch_no`, cpi.`create_date`, cpi.`create_user`, cpi.`update_date`
, cpi.`update_user`, cpi.`is_delete`, cpi.`tips`, IFNULL(cpi.`runstate`, 0) AS runstate, cpi.`file_path`
, `file_type`, `role_name`, `role_code`, `start_user_name`
, cpi.`start_user_id`, cpi.`person_img`,cii.name
from contingency_plan_instance cpi left join contingency_instance_info cii
on cpi.batch_no = cii.id
<where> <where>
<if test="batchNo != null and batchNo != ''"> <if test="batchNo != null and batchNo != ''">
batch_no = #{batchNo} cpi.batch_no = #{batchNo}
</if> </if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and record_type = #{type} and cpi.record_type = #{type}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and runstate = #{status} and cpi.runstate is null
</if> </if>
<if test="list != null and list.size() >0"> <if test="list != null and list.size() >0">
<foreach collection="list" item="role" index="index" open="and (" close=") " separator="or"> <foreach collection="list" item="role" index="index" open="and (" close=") " separator="or">
role_code like concat('%',#{role},'%') cpi.role_code like concat('%',#{role},'%')
</foreach> </foreach>
</if> </if>
</where> </where>
order by cpi.`create_date`
LIMIT #{current}, #{size} LIMIT #{current}, #{size}
</select> </select>
<select id="selectCountDisposalActionPage" resultType="java.lang.Integer"> <select id="selectCountDisposalActionPage" resultType="java.lang.Integer">
...@@ -65,7 +74,7 @@ ...@@ -65,7 +74,7 @@
and record_type = #{type} and record_type = #{type}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and runstate = #{status} and runstate is null
</if> </if>
<if test="list != null and list.size() >0"> <if test="list != null and list.size() >0">
...@@ -76,25 +85,32 @@ ...@@ -76,25 +85,32 @@
</where> </where>
</select> </select>
<select id="selectDisposalActionList" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance"> <select id="selectDisposalActionList" resultType="com.yeejoin.amos.fas.business.vo.ContingencyPlanInstanceVO">
select * from contingency_plan_instance select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num`
, cpi.`batch_no`, cpi.`create_date`, cpi.`create_user`, cpi.`update_date`
, cpi.`update_user`, cpi.`is_delete`, cpi.`tips`, IFNULL(cpi.`runstate`, 0) AS runstate, cpi.`file_path`
, `file_type`, `role_name`, `role_code`, `start_user_name`
, cpi.`start_user_id`, cpi.`person_img`,cii.name
from contingency_plan_instance cpi left join contingency_instance_info cii
on cpi.batch_no = cii.id
<where> <where>
<if test="batchNo != null and batchNo != ''"> <if test="batchNo != null and batchNo != ''">
batch_no = #{batchNo} cpi.batch_no = #{batchNo}
</if> </if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and record_type = #{type} and cpi.record_type = #{type}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and runstate = #{status} and cpi.runstate is null
</if> </if>
<if test="list != null and list.size() >0"> <if test="list != null and list.size() >0">
<foreach collection="list" item="role" index="index" open="and (" close=") " separator="or"> <foreach collection="list" item="role" index="index" open="and (" close=") " separator="or">
role_code like concat('%',#{role},'%') cpi.role_code like concat('%',#{role},'%')
</foreach> </foreach>
</if> </if>
</where> </where>
order by cpi.`create_date`
</select> </select>
</mapper> </mapper>
...@@ -2,12 +2,54 @@ ...@@ -2,12 +2,54 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper"> <mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper">
<update id="updateStatusById">
UPDATE
contingency_plan_instance
SET
runstate = 1
<if test="content != null and content != ''">
, content = #{content}
</if>
where id = #{id}
</update>
<update id="updateMessageById">
UPDATE `contingency_plan_instance`
SET
<if test="dto.recordType != null and dto.recordType != ''">
`record_type` = #{dto.recordType},
</if>
<if test="dto.content != null and dto.content != ''">
`content` = #{dto.content},
</if>
`category` = #{dto.category},
`icon` = #{dto.icon},
`sort` = #{dto.sort},
`sequence_num` = #{dto.sequenceNum},
<if test="dto.batchNo != null and dto.batchNo != ''">
`batch_no` = #{dto.batchNo},
</if>
`update_date` = NOW(),
`update_user` = #{dto.updateUser},
`tips` = #{dto.tips},
`runstate` = #{dto.runstate},
`file_path` = #{dto.filePath},
`file_type` = #{dto.fileType},
`role_name` = #{dto.roleName},
`role_code` = #{dto.roleCode},
`start_user_name` = #{dto.startUserName},
`start_user_id` = #{dto.startUserId},
`person_img` = #{dto.personImg}
WHERE
`id` = #{dto.id};
<select id="getPlanInstanceListByPage" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance"> </update>
<select id="getPlanInstanceListByPage" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance">
select * from select * from
contingency_plan_instance contingency_plan_instance
where batch_no = #{batchNo} where batch_no = #{batchNo}
AND record_type in ('REPLYMESSAGE', 'MESSAGE') AND record_type in ('REPLYMESSAGE', 'MESSAGE')
AND is_delete = 0
order by create_date DESC order by create_date DESC
limit #{pageNum}, #{size} limit #{pageNum}, #{size}
</select> </select>
...@@ -17,6 +59,7 @@ ...@@ -17,6 +59,7 @@
contingency_plan_instance contingency_plan_instance
where batch_no = #{batchNo} where batch_no = #{batchNo}
AND record_type in ('REPLYMESSAGE', 'MESSAGE') AND record_type in ('REPLYMESSAGE', 'MESSAGE')
AND is_delete = 0
</select> </select>
<select id="getUserByUserId" resultType="java.util.Map"> <select id="getUserByUserId" resultType="java.util.Map">
...@@ -25,4 +68,339 @@ ...@@ -25,4 +68,339 @@
ifnull(personImg, "") as personImg ifnull(personImg, "") as personImg
from cb_org_usr where amos_org_id = #{userId} and is_delete = 0 limit 1 from cb_org_usr where amos_org_id = #{userId} and is_delete = 0 limit 1
</select> </select>
<select id="getMessageById" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance">
select * from contingency_plan_instance where id = #{id}
</select>
<select id="getBizOrgCode" resultType="java.lang.String">
select
biz_org_code
from cb_org_usr where amos_org_code = #{amosOrgCode} and is_delete = 0 limit 1
</select>
<select id="getWaterInfo" resultType="java.util.Map">
select * from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
a.nowLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.volume,
<!-- a.image,-->
a.resource_type,
a.sequence_nbr
<!-- ,a.`code` AS systemCode-->
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
FORMAT(avg(IFNULL(ei.`value`,0)), 2)
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr,
rp.level_device_id
<!-- ,fs.`code` AS systemCode-->
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
ORDER BY
levelStatus DESC,sequence_nbr DESC
limit #{current},#{size}
</select>
<select id="countWater" resultType="long">
select count(1) from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
a.nowLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.volume,
<!-- a.image,-->
a.resource_type,
a.sequence_nbr
<!-- ,a.`code` AS systemCode-->
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
FORMAT(avg(IFNULL(ei.`value`,0)), 2)
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr,
rp.level_device_id
<!-- ,fs.`code` AS systemCode-->
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
</select>
</mapper> </mapper>
\ No newline at end of file
<?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.fas.business.dao.mapper.WarehouseStructureMapper">
<select id="getMessageById" resultType="com.yeejoin.amos.fas.dao.entity.WarehouseStructure">
select * from wl_warehouse_structure where id = #{id}
</select>
</mapper>
\ No newline at end of file
...@@ -220,6 +220,7 @@ ...@@ -220,6 +220,7 @@
wes.code as code, wes.code as code,
wes.org_code as orgCode, wes.org_code as orgCode,
wes.equipment_code as equipmentCode, wes.equipment_code as equipmentCode,
wes.warehouse_structure_id,
IF(substr(wes.equipment_code ,1,4) = '9204','true','false') as push3D IF(substr(wes.equipment_code ,1,4) = '9204','true','false') as push3D
from from
wl_equipment_specific wes wl_equipment_specific wes
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<if test="name !=null and name != ''"> and (eq.name like concat(concat("%",#{name}),"%") or eq.code like concat(concat("%",#{name}),"%"))</if> <if test="name !=null and name != ''"> and (eq.name like concat(concat("%",#{name}),"%") or eq.code like concat(concat("%",#{name}),"%"))</if>
<if test="id != null and id != ''"> and eq.id = #{id}</if> <if test="id != null and id != ''"> and eq.id = #{id}</if>
</trim> </trim>
order by eq.id order by eq.id desc
<choose> <choose>
<when test="pageSize==-1"></when> <when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when> <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
......
...@@ -117,6 +117,6 @@ ...@@ -117,6 +117,6 @@
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "END_EMERGENCY", "buttonCode": "END_EMERGENCY",
"isParallel": "1", "isParallel": "1",
"roleCode": "Digital_Responsing_Plan_C" "roleCode": "Digital_Responsing_Plan_B"
} }
] ]
\ No newline at end of file
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