Commit bf2bd3a4 authored by 高建强's avatar 高建强

item:应急处置同步调整提交

parent 9b11b276
...@@ -10,7 +10,6 @@ import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext; ...@@ -10,7 +10,6 @@ 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;
...@@ -29,6 +28,7 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus; ...@@ -29,6 +28,7 @@ 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.JSONUtil; import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.vo.MessageVO; import com.yeejoin.amos.fas.business.vo.MessageVO;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
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;
...@@ -62,6 +62,7 @@ import java.util.*; ...@@ -62,6 +62,7 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Component @Component
...@@ -161,16 +162,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -161,16 +162,6 @@ public class ContingencyAction implements CustomerAction {
@Autowired @Autowired
private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger; private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger;
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{
put("S1", "S1");
put("S2", "S2");
put("A1", "A1");
put("A2", "A2");
put("A3", "A3");
put("F1", "F1");
}};
*/
/** /**
* @param stepCode 当前步骤编号 * @param stepCode 当前步骤编号
...@@ -442,12 +433,23 @@ public class ContingencyAction implements CustomerAction { ...@@ -442,12 +433,23 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "交互动作", project = "换流站消防专项预案") @RuleMethod(methodLabel = "交互动作", project = "换流站消防专项预案")
@Transactional
public void operation(@MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "图标") String icon, @MethodParam(paramLabel = "提示信息") String tips, @MethodParam(paramLabel = "按钮json字符串") String buttonJson, @MethodParam(paramLabel = "预案对象") Object paramObj) { public void operation(@MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "图标") String icon, @MethodParam(paramLabel = "提示信息") String tips, @MethodParam(paramLabel = "按钮json字符串") String buttonJson, @MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
String batchNo = contingencyRo.getBatchNo(); String batchNo = contingencyRo.getBatchNo();
String buttonCode = contingencyRo.getButtonCode();
String stepCode = contingencyRo.getStep();
if (StringUtils.isBlank(buttonCode)) {
// 根据步骤,取按钮编码
List<PlanStepJsonVO> planStepJsonVOList = iContingencyInstance.getPlanStepJsonVOS();
List<PlanStepJsonVO> collect = planStepJsonVOList.stream().filter(x -> x.getStepCode().equals(stepCode)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
buttonCode = collect.get(0).getButtonCode();
}
}
if (!findByBatchNoAndStatus(batchNo)) { if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
String buttonCode = contingencyRo.getButtonCode();
//转换content中的变量 //转换content中的变量
tips = instedParams(tips, contingencyRo); tips = instedParams(tips, contingencyRo);
...@@ -464,7 +466,11 @@ public class ContingencyAction implements CustomerAction { ...@@ -464,7 +466,11 @@ public class ContingencyAction implements CustomerAction {
tempmap1.put("caseId", contingencyPlanId); tempmap1.put("caseId", contingencyPlanId);
result.add(tempmap1); result.add(tempmap1);
// 更新预案执行Json串
iPlanVisual3dService.updatePlanStep(batchNo, stepCode, contingencyPlanId, buttonCode, false);
this.sendcmd("optionarea", paramObj, result); this.sendcmd("optionarea", paramObj, result);
ContingencyPlanInstance instance = contingencyInstance.getMessageById(contingencyPlanId); ContingencyPlanInstance instance = contingencyInstance.getMessageById(contingencyPlanId);
if (instance != null) { if (instance != null) {
String roleCode = contingencyInstance.getPlanStepRoleCodeByButtonCode(buttonCode); String roleCode = contingencyInstance.getPlanStepRoleCodeByButtonCode(buttonCode);
...@@ -475,6 +481,34 @@ public class ContingencyAction implements CustomerAction { ...@@ -475,6 +481,34 @@ public class ContingencyAction implements CustomerAction {
} }
contingencyPlanInstanceMapper.updateMessageById(instance); contingencyPlanInstanceMapper.updateMessageById(instance);
} }
try {
String code = Objects.requireNonNull(redisTemplate.opsForValue().get("stepCode")).toString();
if (StringUtils.isNotBlank(code)) {
if (Integer.parseInt(stepCode) > Integer.parseInt(code)) {
redisTemplate.opsForValue().set("stepCode", stepCode);
System.out.println("======optionarea 加入队列参数信息======action=====");
System.out.println("batchNo-->" + batchNo);
System.out.println("stepCode-->" + stepCode);
System.out.println("contingencyPlanId-->" + contingencyPlanId);
System.out.println("buttonCode-->" + buttonCode);
iContingencyInstance.fire(batchNo, stepCode, contingencyPlanId, buttonCode, "CANCEL_0", "A", RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey());
}
} else if (StringUtils.isBlank(code) && "0".equals(stepCode)) {
redisTemplate.opsForValue().set("stepCode", stepCode);
System.out.println("======optionarea 加入队列参数信息======action=====");
System.out.println("batchNo-->" + batchNo);
System.out.println("stepCode-->" + stepCode);
System.out.println("contingencyPlanId-->" + contingencyPlanId);
System.out.println("buttonCode-->" + buttonCode);
iContingencyInstance.fire(batchNo, stepCode, contingencyPlanId, buttonCode, "CANCEL_0", "A", RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey());
} else if (StringUtils.isBlank(code)) {
redisTemplate.opsForValue().set("stepCode", stepCode);
}
} catch (Exception e) {
log.error("optionarea 加入队列失败-->" + e.getMessage());
}
MessageVO messageVO = new MessageVO(); MessageVO messageVO = new MessageVO();
messageVO.setTitle("应急处置事项提醒"); messageVO.setTitle("应急处置事项提醒");
...@@ -488,7 +522,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -488,7 +522,6 @@ public class ContingencyAction implements CustomerAction {
} }
} }
private boolean sendButton(String batchNo, String contingencyPlanId, String equipmentId, String actionName, String buttonJson) { private boolean sendButton(String batchNo, String contingencyPlanId, String equipmentId, String actionName, String buttonJson) {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
try { try {
......
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
...@@ -241,12 +242,12 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -241,12 +242,12 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
BeanUtils.copyProperties(contingencyOriginalData, contingencyRo); BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
contingencyRo.setStep(stepCode); contingencyRo.setStep(stepCode);
contingencyRo.setStepState(stepMap.get(stepKey)); contingencyRo.setStepState(stepMap.get(stepKey));
Object isMock = redisTemplate.opsForValue().get("isMock"); // Object isMock = redisTemplate.opsForValue().get("isMock");
if (isMock != null) { // if (isMock != null) {
contingencyRo.setIsMock("1".equals(isMock.toString())); // contingencyRo.setIsMock("1".equals(isMock.toString()));
} else { // } else {
contingencyRo.setIsMock(false); // contingencyRo.setIsMock(false);
} // }
log.info("stepstate:" + contingencyRo.getStepState()); log.info("stepstate:" + contingencyRo.getStepState());
log.info("stepCode:" + stepCode); log.info("stepCode:" + stepCode);
equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId())); equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId()));
...@@ -283,7 +284,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -283,7 +284,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
publisherPlanLog(stepCode, buttonCode, batchNo); publisherPlanLog(stepCode, buttonCode, batchNo);
// 更新预案执行Json串 // 更新预案执行Json串
planVisual3dService.updatePlanStep(batchNo, stepCode, contingencyPlanId, buttonCode); // planVisual3dService.updatePlanStep(batchNo, stepCode, contingencyPlanId, buttonCode);
} }
} else { } else {
throw new Exception("数据异常,请联系管理员."); throw new Exception("数据异常,请联系管理员.");
...@@ -328,12 +329,14 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -328,12 +329,14 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
@Transactional @Transactional
public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception { public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId); // Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
System.out.println("=========================setButtonExecuted======================");
ContingencyPlanInstance contingencyPlanInstance = contingencyPlanInstance1.get(); ContingencyPlanInstance contingencyPlanInstance = contingencyInstance.getMessageById(contingencyPlanId);
if (contingencyPlanInstance1.isPresent()) { // ContingencyPlanInstance contingencyPlanInstance = contingencyPlanInstance1.get();
if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) { System.out.println(JSON.toJSON(contingencyPlanInstance));
if (contingencyPlanInstance != null) {
if ("OPERATE".equals(contingencyPlanInstance.getRecordType())) {
String operateJson = contingencyPlanInstance.getContent(); String operateJson = contingencyPlanInstance.getContent();
OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class); OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
...@@ -450,6 +453,14 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -450,6 +453,14 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
map.put("confirm", buttonState); map.put("confirm", buttonState);
map.put("contingencyPlanId", contingencyPlanId); map.put("contingencyPlanId", contingencyPlanId);
map.put("stepState", stepStateOnbutton); map.put("stepState", stepStateOnbutton);
System.out.println("batchNo-->" + batchNo);
System.out.println("stepCode-->" + stepCode);
System.out.println("contingencyPlanId-->" + contingencyPlanId);
System.out.println("buttonCode-->" + buttonCode);
System.out.println("buttonState-->" + buttonState);
System.out.println("stepStateOnbutton-->" + stepStateOnbutton);
System.out.println("======optionarea 加入队列参数=====fire======");
if (StringUtils.isBlank(token) || StringUtils.isBlank(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());
...@@ -515,7 +526,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -515,7 +526,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return contingencyPlanInstance; return contingencyPlanInstance;
} }
private List<PlanStepJsonVO> getPlanStepJsonVOS() { public List<PlanStepJsonVO> getPlanStepJsonVOS() {
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));
...@@ -572,6 +583,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -572,6 +583,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
RequestContext.setToken(token); 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);
// 更新预案执行Json串s
planVisual3dService.updatePlanStep(batchNo, stepCode, contingencyPlanId, buttonCode, true);
} catch (Exception e) { } catch (Exception e) {
throw e; throw e;
} finally { } finally {
......
...@@ -395,8 +395,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -395,8 +395,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
@Transactional @Transactional
public void updatePlanStep(String batchNo, String stepCode, String contingencyPlanId, String buttonCode) { public void updatePlanStep(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, Boolean isExecute) {
if (StringUtils.isNotBlank(batchNo) && StringUtils.isNotBlank(contingencyPlanId)) { if (StringUtils.isNotBlank(batchNo) && StringUtils.isNotBlank(contingencyPlanId) && StringUtils.isNotBlank(buttonCode)) {
// 根据批次号查询预案步骤 // 根据批次号查询预案步骤
PlanRule planRule = planOperationRecordMapper.getPlanRuleByBatchNo(batchNo); PlanRule planRule = planOperationRecordMapper.getPlanRuleByBatchNo(batchNo);
if (planRule != null) { if (planRule != null) {
...@@ -404,20 +404,22 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -404,20 +404,22 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
List<PlanStepJsonVO> collect = list.stream().peek(x -> { List<PlanStepJsonVO> collect = list.stream().peek(x -> {
String code = x.getStepCode(); String code = x.getStepCode();
if (code.equals(stepCode)) { if (code.equals(stepCode)) {
x.setTime(DateFormatUtils.format(new Date(), "HH:mm:ss")); if (isExecute) {
x.setBatchNo(batchNo); x.setTime(DateFormatUtils.format(new Date(), "HH:mm:ss"));
x.setCaseId(contingencyPlanId); x.setBatchNo(batchNo);
if (buttonCode.endsWith("_NOT")) { x.setCaseId(contingencyPlanId);
x.setCheckYesOrNo("0"); if (buttonCode.endsWith("_NOT")) {
} else { x.setCheckYesOrNo("0");
x.setCheckYesOrNo("1"); } else {
x.setCheckYesOrNo("1");
}
} }
// 通过contingencyPlanId获取buttonJson数据 // 通过contingencyPlanId获取buttonJson数据
ContingencyPlanInstance planInstance = iContingencyPlanInstanceRepository.getOne(contingencyPlanId); ContingencyPlanInstance planInstance = iContingencyPlanInstanceRepository.getOne(contingencyPlanId);
x.setButtonJson(planInstance.getContent()); x.setButtonJson(planInstance.getContent());
// 更新进度条标志位
x.setShowLine(Integer.parseInt(x.getStepCode()) <= Integer.parseInt(stepCode));
} }
// 更新进度条标志位
x.setShowLine(Integer.parseInt(x.getStepCode()) <= Integer.parseInt(stepCode));
}).collect(Collectors.toList()); }).collect(Collectors.toList());
PlanStepVo planStepVo = new PlanStepVo(); PlanStepVo planStepVo = new PlanStepVo();
planStepVo.setBatchNo(batchNo); planStepVo.setBatchNo(batchNo);
......
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
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;
...@@ -45,4 +46,6 @@ public interface IContingencyInstance { ...@@ -45,4 +46,6 @@ public interface IContingencyInstance {
* @return * @return
*/ */
String getPlanStepRoleCodeByButtonCode(String buttonCode); String getPlanStepRoleCodeByButtonCode(String buttonCode);
List<PlanStepJsonVO> getPlanStepJsonVOS();
} }
...@@ -90,7 +90,7 @@ public interface IPlanVisual3dService { ...@@ -90,7 +90,7 @@ public interface IPlanVisual3dService {
PlanStepVo updatePlanStep(PlanStepVo planStepVo); PlanStepVo updatePlanStep(PlanStepVo planStepVo);
void updatePlanStep(String batchNo, String stepCode, String contingencyPlanId, String buttonCode); void updatePlanStep(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, Boolean isExecute);
Page<ContingencyPlanInstanceVO> selectDisposalActionPage(int current, int size, String batchNo, List<RoleModel> roleModelList, int dataType); Page<ContingencyPlanInstanceVO> selectDisposalActionPage(int current, int size, String batchNo, List<RoleModel> roleModelList, int dataType);
......
...@@ -14,10 +14,10 @@ public class PlanStepJsonVO { ...@@ -14,10 +14,10 @@ public class PlanStepJsonVO {
private String batchNo; private String batchNo;
private String caseId; private String caseId;
private String buttonJson; private String buttonJson;
private String time; private String time = "";
private boolean showLine; private boolean showLine = false;
/** /**
* 1:是,0:否 * 1:是,0:否
*/ */
private String checkYesOrNo; private String checkYesOrNo = "";
} }
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