Commit b7b8d5f6 authored by 李秀明's avatar 李秀明

Merge branch 'refs/heads/develop_dl' into develop_dl_4.0

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IContingencyPlanInstanceRepository.java
parents 9003fc61 776b5857
...@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.rule.MethodParam; import com.yeejoin.amos.component.rule.MethodParam;
import com.yeejoin.amos.component.rule.RuleActionBean; import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod; import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.component.rule.config.ClazzUtils;
import com.yeejoin.amos.component.rule.model.FactModel;
import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext; 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;
...@@ -52,6 +54,7 @@ import java.lang.reflect.Constructor; ...@@ -52,6 +54,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
...@@ -433,6 +436,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -433,6 +436,7 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "交互动作", project = "换流站消防专项预案") @RuleMethod(methodLabel = "交互动作", project = "换流站消防专项预案")
@Transactional @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 buttonCode = contingencyRo.getButtonCode();
...@@ -474,7 +478,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -474,7 +478,6 @@ public class ContingencyAction implements CustomerAction {
log.error("optionarea 加入队列失败-->" + e.getMessage()); log.error("optionarea 加入队列失败-->" + e.getMessage());
} }
} }
} }
......
...@@ -17,7 +17,8 @@ public class ContingencyLogListener implements ApplicationListener<ContingencyEv ...@@ -17,7 +17,8 @@ public class ContingencyLogListener implements ApplicationListener<ContingencyEv
@Override @Override
public void onApplicationEvent(ContingencyEvent event) { public void onApplicationEvent(ContingencyEvent event) {
ruleRunningSnapshotService.reacordPlan(event.getTopic(), event.getMsgType(), event.getMsgBody(), event.getContingency()); // 预案启动规则回掉过慢问题注释
// ruleRunningSnapshotService.reacordPlan(event.getTopic(), event.getMsgType(), event.getMsgBody(), event.getContingency());
} }
} }
...@@ -186,6 +186,23 @@ public class ContingencyPlanController extends BaseController { ...@@ -186,6 +186,23 @@ public class ContingencyPlanController extends BaseController {
return CommonResponseUtil2.success(result); return CommonResponseUtil2.success(result);
} }
@ApiOperation(value = "执行第一步")
@RequestMapping(value = "/startFirst", method = RequestMethod.GET)
public ResponseModel startFirst(String batchNo) {
Toke toke = new Toke();
toke.setAppKey(getAppKey());
toke.setProduct(getProduct());
toke.setToke(getToken());
try {
contingencyPlanService.planStartFirst(batchNo, toke);
}catch (Exception e){
e.printStackTrace();
return CommonResponseUtil2.failure();
}
return CommonResponseUtil2.success(null);
}
@ApiOperation(value = "装备确景") @ApiOperation(value = "装备确景")
@RequestMapping(value = "/scene", method = RequestMethod.GET) @RequestMapping(value = "/scene", method = RequestMethod.GET)
public ResponseModel scene(@ApiParam(value = "装备Id", required = true) String equipmentId, public ResponseModel scene(@ApiParam(value = "装备Id", required = true) String equipmentId,
......
...@@ -71,6 +71,9 @@ public class LoginController { ...@@ -71,6 +71,9 @@ public class LoginController {
private String aProduct = "AMOS_STUDIO_WEB"; private String aProduct = "AMOS_STUDIO_WEB";
private String bProduct = "AMOS-WEB-ADMIN";
private String eProduct = "STUDIO_APP_WEB";
@ApiOperation(value = "通过userId登录", notes = "查询设备指标") @ApiOperation(value = "通过userId登录", notes = "查询设备指标")
...@@ -92,7 +95,11 @@ public class LoginController { ...@@ -92,7 +95,11 @@ public class LoginController {
RequestContext.setProduct(product); RequestContext.setProduct(product);
String cacheKey = Redis.genKey(new String[]{CacheType.ERASABLE.name(), "SESSION_TOKEN", aProduct, reginParams.getToken()}); String cacheKey = Redis.genKey(new String[]{CacheType.ERASABLE.name(), "SESSION_TOKEN", aProduct, reginParams.getToken()});
boolean hasKey = Redis.getRedisTemplate().hasKey(cacheKey); boolean hasKey = Redis.getRedisTemplate().hasKey(cacheKey);
if (hasKey) { String cacheKey1 = Redis.genKey(new String[]{CacheType.ERASABLE.name(), "SESSION_TOKEN", bProduct, reginParams.getToken()});
boolean hasKey1 = Redis.getRedisTemplate().hasKey(cacheKey1);
String cacheKey4 = Redis.genKey(new String[]{CacheType.ERASABLE.name(), "SESSION_TOKEN", eProduct, reginParams.getToken()});
boolean hasKey4 = Redis.getRedisTemplate().hasKey(cacheKey4);
if (hasKey && hasKey1 && hasKey4 ) {
return reginParams; return reginParams;
} else { } else {
logger.info("Auto自动登陆=====:{}", JSON.toJSONString(reginParams)); logger.info("Auto自动登陆=====:{}", JSON.toJSONString(reginParams));
......
...@@ -85,6 +85,9 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP ...@@ -85,6 +85,9 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
@Query(value = "SELECT * FROM `contingency_plan_instance` WHERE batch_no = ?1", nativeQuery = true) @Query(value = "SELECT * FROM `contingency_plan_instance` WHERE batch_no = ?1", nativeQuery = true)
List<ContingencyPlanInstance> findByBatchNo(String batchNo); List<ContingencyPlanInstance> findByBatchNo(String batchNo);
@Query(value = "SELECT id FROM `contingency_plan_instance` WHERE batch_no = ?1 AND record_type = ?2 ORDER BY sort DESC LIMIT 1", nativeQuery = true)
String findByBatchNoAndRecordType(String batchNo, String recordType);
@Query(value = "SELECT " + @Query(value = "SELECT " +
" *" + " *" +
" FROM " + " FROM " +
......
...@@ -6,6 +6,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -6,6 +6,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.time.Instant;
import java.util.List; import java.util.List;
/** /**
...@@ -34,6 +35,7 @@ public class ContingercyAsyncEventListener implements ApplicationListener<Contin ...@@ -34,6 +35,7 @@ public class ContingercyAsyncEventListener implements ApplicationListener<Contin
RequestContext.setAgencyCode(event.getContext().getAgencyCode()); RequestContext.setAgencyCode(event.getContext().getAgencyCode());
RequestContext.setExeUserId(event.getContext().getExcutedUserId()); RequestContext.setExeUserId(event.getContext().getExcutedUserId());
long start = Instant.now().toEpochMilli();
for(EventHandler handler : handlers) { for(EventHandler handler : handlers) {
if (handler.getEventType().equals(event.getEventType())) { if (handler.getEventType().equals(event.getEventType())) {
try { try {
...@@ -44,7 +46,8 @@ public class ContingercyAsyncEventListener implements ApplicationListener<Contin ...@@ -44,7 +46,8 @@ public class ContingercyAsyncEventListener implements ApplicationListener<Contin
} }
} }
long end = Instant.now().toEpochMilli();
System.out.println("============EventHandler"+(end - start));
RequestContext.clean(); RequestContext.clean();
} }
} }
package com.yeejoin.amos.fas.business.event; package com.yeejoin.amos.fas.business.event;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.ContingencyAction; import com.yeejoin.amos.fas.business.action.ContingencyAction;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent; import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
...@@ -58,6 +59,10 @@ public class FireContingencyHandler implements EventHandler{ ...@@ -58,6 +59,10 @@ public class FireContingencyHandler implements EventHandler{
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired
AmosRequestContext amosRequestContext;
@Autowired @Autowired
private ContingencyLogPublisher contingencyLogPublisher; private ContingencyLogPublisher contingencyLogPublisher;
@Autowired @Autowired
...@@ -194,9 +199,17 @@ public class FireContingencyHandler implements EventHandler{ ...@@ -194,9 +199,17 @@ public class FireContingencyHandler implements EventHandler{
if (StringUtils.isNotEmpty(contingencyOriginalData.getEquipmentName())) { if (StringUtils.isNotEmpty(contingencyOriginalData.getEquipmentName())) {
Map<String, Object> params = contingencyRo.getParams(); Map<String, Object> params = contingencyRo.getParams();
params.put("appKey", RequestContext.getAppKey()); RequestContext.setProduct(amosRequestContext.getProduct());
params.put("product", RequestContext.getProduct()); RequestContext.setAppKey(amosRequestContext.getAppKey());
params.put("token", RequestContext.getToken()); RequestContext.setToken(amosRequestContext.getToken());
params.put("appKey", amosRequestContext.getAppKey());
params.put("product", amosRequestContext.getProduct());
params.put("token", amosRequestContext.getToken());
log.info("appKey===,{}", amosRequestContext.getAppKey());
log.info("product====,{}", amosRequestContext.getProduct());
log.info("token====,{}", amosRequestContext.getToken());
contingencyRo.setParams(params); 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(contingencyOriginalData.getEquipmentName())); ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(contingencyOriginalData.getEquipmentName()));
......
...@@ -170,6 +170,17 @@ public class RemoteSecurityService { ...@@ -170,6 +170,17 @@ public class RemoteSecurityService {
return toke; return toke;
} }
public Toke getTokenS() {
Toke toke = new Toke();
toke.setToke(amosRequestContext.getToken());
toke.setProduct(amosRequestContext.getProduct());
toke.setAppKey(amosRequestContext.getAppKey());
return toke;
}
private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){ private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){
Toke toke = new Toke(); Toke toke = new Toke();
RequestContext.setProduct(amosRequestContext.getProduct()); RequestContext.setProduct(amosRequestContext.getProduct());
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
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.robot.AmosRequestContext;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.ContingencyAction; import com.yeejoin.amos.fas.business.action.ContingencyAction;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent; import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
...@@ -59,6 +60,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -59,6 +60,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
// public final static List<String> list = Arrays.asList("0", "1", "2", "5", "9", "10", "11"); // public final static List<String> list = Arrays.asList("0", "1", "2", "5", "9", "10", "11");
@Autowired @Autowired
private IContingencyPlanInstanceRepository repository; private IContingencyPlanInstanceRepository repository;
...@@ -269,9 +271,18 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -269,9 +271,18 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
if (equipment != null) { if (equipment != null) {
contingencyRo.setEquipmentCode(equipment.getCode()); contingencyRo.setEquipmentCode(equipment.getCode());
Map<String, Object> params = contingencyRo.getParams(); Map<String, Object> params = contingencyRo.getParams();
params.put("appKey", RequestContext.getAppKey()); Toke toke = remoteSecurityService.getTokenS();
params.put("product", RequestContext.getProduct()); RequestContext.setProduct(toke.getProduct());
params.put("token", RequestContext.getToken()); RequestContext.setAppKey(toke.getAppKey());
RequestContext.setToken(toke.getToke());
params.put("appKey", toke.getToke());
params.put("product", toke.getProduct());
params.put("token", toke.getAppKey());
log.info("appKey===11,{}", toke.getAppKey());
log.info("product====11,{}", toke.getProduct());
log.info("token====11,{}", toke.getToke());
contingencyRo.setParams(params); contingencyRo.setParams(params);
......
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.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.rule.config.ClazzUtils; import com.yeejoin.amos.component.rule.config.ClazzUtils;
...@@ -11,6 +12,7 @@ import com.yeejoin.amos.fas.business.dao.mapper.*; ...@@ -11,6 +12,7 @@ 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.param.AlarmParam; import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.service.intfc.*; import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.TreeUtil; import com.yeejoin.amos.fas.business.util.TreeUtil;
import com.yeejoin.amos.fas.business.vo.*; import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.common.enums.*; import com.yeejoin.amos.fas.common.enums.*;
...@@ -22,11 +24,9 @@ import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo; ...@@ -22,11 +24,9 @@ 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 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.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -44,7 +44,6 @@ import org.typroject.tyboot.component.emq.EmqxListener; ...@@ -44,7 +44,6 @@ import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
...@@ -284,6 +283,9 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -284,6 +283,9 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
JSONObject msgContext = new JSONObject(); JSONObject msgContext = new JSONObject();
msgContext.put("content", "startPlanFirst"); msgContext.put("content", "startPlanFirst");
if(vo.getTriggerMode().equals("automatic")) {
msgContext.put("isShowAlertBox", "true");
}
map.put("contingency", new ContingencyRo()); map.put("contingency", new ContingencyRo());
// map.put("msgContext", "{\"content\":\"startPlan\"}"); // map.put("msgContext", "{\"content\":\"startPlan\"}");
// msgContext.put("content", "startPlan"); // msgContext.put("content", "startPlan");
...@@ -291,11 +293,46 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -291,11 +293,46 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
map.put("msgContext", msgContext); map.put("msgContext", msgContext);
map.put("msgType", "refreshRecord"); map.put("msgType", "refreshRecord");
webMqttComponent.publish(topic, JSON.toJSONString(map)); webMqttComponent.publish(topic, JSON.toJSONString(map));
// if(vo.getTriggerMode().equals("automatic")) {
// logger.info("===============开始查询ButtonJson");
// getStepButtonJson(batchNo, toke);
// }
} }
return result; return result;
} }
@Override @Override
public ContingencyPlanResponseVo planStartFirst(String batchNo, Toke toke) {
logger.info("开始查询Step=============");
for (int i =0; i < 120 ; i++) {
ToipResponse planStepByBatchNo = planVisual3dService.getPlanStepByBatchNo(batchNo);
logger.info("===============1111111,{}", planStepByBatchNo);
if(null != planStepByBatchNo && null != planStepByBatchNo.getMsgContext()) {
String str = JSONObject.toJSONString(planStepByBatchNo.getMsgContext());
JSONObject obj = JSON.parseObject(str);
JSONArray arr = obj.getJSONArray("step");
JSONObject step = arr.getJSONObject(0);
if (!ObjectUtils.isEmpty(step.get("buttonJson"))) {
logger.info("===============查询到ButtonJson");
try {
iContingencyInstance.fire(batchNo, "0", step.get("buttonJson").toString(), step.get("caseId").toString(), "FIRE_CONFIRM", "CONFIRM", "0", "true", "false", toke.getToke(), toke.getProduct(), toke.getAppKey(), null);
} catch (Exception e) {
e.printStackTrace();
}
break;
}
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return null;
}
@Override
public Map<String, Object> firstGetRecord(String batchNo) { public Map<String, Object> firstGetRecord(String batchNo) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
PlanOperationRecord PlanOperationRecord = planOperationRecordDao.findByBatchNo(batchNo); PlanOperationRecord PlanOperationRecord = planOperationRecordDao.findByBatchNo(batchNo);
......
...@@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -42,6 +42,7 @@ 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 java.time.Instant;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -246,8 +247,6 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -246,8 +247,6 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public ToipResponse getPlanStepByBatchNo(String batchNo) { public ToipResponse getPlanStepByBatchNo(String batchNo) {
ToipResponse toipResponse = new ToipResponse(); ToipResponse toipResponse = new ToipResponse();
// 根据批次号查询预案步骤
// String planStep = planOperationRecordMapper.getPlanStepByBatchNo(batchNo);
String planStep = ""; String planStep = "";
if (redisTemplate.hasKey("planStep")) { if (redisTemplate.hasKey("planStep")) {
planStep = Objects.requireNonNull(redisTemplate.opsForValue().get("planStep")).toString(); planStep = Objects.requireNonNull(redisTemplate.opsForValue().get("planStep")).toString();
...@@ -259,15 +258,15 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -259,15 +258,15 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
if (StringUtil.isNotEmpty(planStep) && StringUtils.isNotBlank(batchNo)) { if (StringUtil.isNotEmpty(planStep) && StringUtils.isNotBlank(batchNo)) {
// 查询当前步骤 // 查询当前步骤
ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo); ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo);
if( null == contingencyOriginalData) {
return null;
}
msgContext.put("currentStep", contingencyOriginalData.getStep()); msgContext.put("currentStep", contingencyOriginalData.getStep());
msgContext.put("confirm", contingencyOriginalData.getConfirm()); msgContext.put("confirm", contingencyOriginalData.getConfirm());
msgContext.put("createDate", contingencyOriginalData.getCreateDate()); msgContext.put("createDate", contingencyOriginalData.getCreateDate());
List<ContingencyPlanInstance> list = contingencyPlanInstanceRepository.findByBatchNo(batchNo); String caseId = contingencyPlanInstanceRepository.findByBatchNoAndRecordType(batchNo, "OPERATE");
if (!CollectionUtils.isEmpty(list)) { if (StringUtils.isNotEmpty(caseId)) {
List<ContingencyPlanInstance> collect = list.stream().filter(x -> "OPERATE".equals(x.getRecordType())).collect(Collectors.toList()); msgContext.put("caseId", caseId);
if (!CollectionUtils.isEmpty(collect)) {
msgContext.put("caseId", collect.get(0).getId());
}
} }
toipResponse.setMsgType("steparea"); toipResponse.setMsgType("steparea");
toipResponse.setContingency(contingencyOriginalData); toipResponse.setContingency(contingencyOriginalData);
...@@ -435,6 +434,20 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -435,6 +434,20 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
redisTemplate.opsForValue().set("planStep", JSON.toJSONString(collect1)); redisTemplate.opsForValue().set("planStep", JSON.toJSONString(collect1));
if(stepCode.equals("0")) {
PlanStepJsonVO planStepJsonVO = collect1.get(0);
if(!StringUtils.isEmpty(planStepJsonVO.getButtonJson())) {
String topic = String.format("/%s/%s/%s", serviceName, stationName, "plan");
Map<String, Object> map = new HashMap<>();
JSONObject msgContext = new JSONObject();
msgContext.put("tips", "alertAlarm");
map.put("msgContext", msgContext);
map.put("msgType", "alertAlarm");
map.put("step", "0");
map.put("batchNo", planStepJsonVO.getBatchNo());
webMqttComponent.publish(topic, JSON.toJSONString(map));
}
}
} }
} }
} }
......
...@@ -31,6 +31,8 @@ public interface IContingencyPlanService { ...@@ -31,6 +31,8 @@ public interface IContingencyPlanService {
ContingencyPlanResponseVo planStart(ContingencyPlanParamVo vo, Toke toke) throws Exception; ContingencyPlanResponseVo planStart(ContingencyPlanParamVo vo, Toke toke) throws Exception;
ContingencyPlanResponseVo planStartFirst(String batchNo, Toke toke) throws Exception;
ContingencyPlanParamVo equipmentScene(Long equipmentId, String riskType); ContingencyPlanParamVo equipmentScene(Long equipmentId, String riskType);
/** /**
......
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