Commit 1ef547f9 authored by KeYong's avatar KeYong

修复应急4.0预案卡片bug

parent 2e5862e3
......@@ -4,9 +4,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyPlanService;
import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService;
import com.yeejoin.amos.fas.business.vo.*;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
......@@ -329,4 +333,10 @@ public class ContingencyPlanController extends BaseController {
return CommonResponseUtil2.success(contingencyPlanService.getPlanInfo(planId));
}
@ApiOperation(value = "获取当前预案信息")
@GetMapping(value = "/plan/current")
public ResponseModel getPlanCurrentInfo() {
return CommonResponseUtil2.success(contingencyPlanService.getPlanCurrentInfo());
}
}
......@@ -10,7 +10,6 @@ import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentEntity;
import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
......@@ -40,7 +39,6 @@ import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -288,7 +286,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
Map<String, Object> map = new HashMap<>();
JSONObject msgContext = new JSONObject();
msgContext.put("content", "startPlanFirst");
if(vo.getTriggerMode().equals("automatic")) {
if (vo.getTriggerMode().equals("automatic")) {
msgContext.put("isShowAlertBox", "true");
}
map.put("contingency", new ContingencyRo());
......@@ -310,10 +308,10 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Override
public ContingencyPlanResponseVo planStartFirst(String batchNo, Toke toke) {
logger.info("开始查询Step=============");
for (int i =0; i < 120 ; i++) {
for (int i = 0; i < 120; i++) {
ToipResponse planStepByBatchNo = planVisual3dService.getPlanStepByBatchNo(batchNo);
logger.info("===============1111111,{}", planStepByBatchNo);
if(null != planStepByBatchNo && null != planStepByBatchNo.getMsgContext()) {
if (null != planStepByBatchNo && null != planStepByBatchNo.getMsgContext()) {
String str = JSONObject.toJSONString(planStepByBatchNo.getMsgContext());
JSONObject obj = JSON.parseObject(str);
JSONArray arr = obj.getJSONArray("step");
......@@ -702,31 +700,46 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
allChildren.forEach(e -> classifyIdList.add(e.getId()));
}
}
if (category.equals(ImportantEquipCodeEnum.ZB.getCode())) {
try {
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.ZB.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.ZB.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
}
} else if (category.equals(ImportantEquipCodeEnum.GK.getCode())) {
try {
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.GK.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.GK.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
List<String> idList = new ArrayList();
if (StringUtils.isNotEmpty(category)) {
String planType = null;
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
} else {
try {
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.HLB.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.HLB.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
String[] idArr = category.split(",");
for (String id : idArr) {
if (id.trim().length() > 0) {
idList.add(id.trim());
}
}
}
String[] idArr = category.split(",");
List<String> idList = new ArrayList();
for (String id : idArr) {
if (id.trim().length() > 0) {
idList.add(id.trim());
String typeStr = idList.get(0);
if (StringUtils.isNotEmpty(planType) && !PlanTypeEnum.MAINTRANSFORM.getKey().equalsIgnoreCase(planType) && typeStr.equals(ImportantEquipCodeEnum.ZB.getCode())) {
redisTemplate.delete("planStep");
try {
redisTemplate.opsForValue().set("planType", PlanTypeEnum.MAINTRANSFORM.getKey());
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.ZB.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.ZB.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
}
} else if (StringUtils.isNotEmpty(planType) && !PlanTypeEnum.HIGHRESISTANCE.getKey().equalsIgnoreCase(planType) && typeStr.equals(ImportantEquipCodeEnum.GK.getCode())) {
redisTemplate.delete("planStep");
try {
redisTemplate.opsForValue().set("planType", PlanTypeEnum.HIGHRESISTANCE.getKey());
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.GK.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.GK.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
}
} else if (StringUtils.isNotEmpty(planType) && !PlanTypeEnum.NORMAL.getKey().equalsIgnoreCase(planType) && (-1 != typeStr.indexOf("1850") || -1 != typeStr.indexOf("183"))) {
redisTemplate.delete("planStep");
try {
redisTemplate.opsForValue().set("planType", PlanTypeEnum.NORMAL.getKey());
emqKeeper.getMqttClient().publish(ImportantEquipCodeEnum.HLB.getTopic(), JSON.toJSONString(ImportantEquipCodeEnum.HLB.getName()).getBytes(), 0, false);
} catch (Exception e) {
e.printStackTrace();
}
}
planStepService.getPlanStep();
}
int total = planDetailMapper.filterCount(planName, classifyIdList, planRange, editOrgName, implementationTimeLeft, implementationTimeRight, equipmentId, idList);
page.setTotal(total);
......@@ -818,17 +831,17 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
try {
emqKeeper.subscript(DELETE_SYNC_PLAN_DOC, 1, new EmqxListener() {
@Override
public void processMessage(String topic, MqttMessage message) {
public void processMessage(String topic, MqttMessage message) {
byte[] payload = message.getPayload();
try {
List<Long> ids = (List<Long>) ClazzUtils.deserializableObject(payload);
if (!ValidationUtil.isEmpty(ids)) {
planDocMapper.logicDeleteByDocIdList(ids);
}
} catch (Exception e) {
logger.error("预案文档删除同步出错", e);
byte[] payload = message.getPayload();
try {
List<Long> ids = (List<Long>) ClazzUtils.deserializableObject(payload);
if (!ValidationUtil.isEmpty(ids)) {
planDocMapper.logicDeleteByDocIdList(ids);
}
} catch (Exception e) {
logger.error("预案文档删除同步出错", e);
}
}
});
} catch (Exception e) {
......@@ -837,16 +850,16 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
try {
emqKeeper.subscript(DELETE_SYNC_PLAN_RULE, 1, new EmqxListener() {
@Override
public void processMessage(String topic, MqttMessage message) {
byte[] payload = message.getPayload();
try {
String[] ids = new String(payload).split(",");
if (!ValidationUtil.isEmpty(ids)) {
planRuleMapper.logicDeleteByRuleIdList(Arrays.asList(ids));
}
} catch (Exception e) {
logger.error("预案规则删除同步出错", e);
public void processMessage(String topic, MqttMessage message) {
byte[] payload = message.getPayload();
try {
String[] ids = new String(payload).split(",");
if (!ValidationUtil.isEmpty(ids)) {
planRuleMapper.logicDeleteByRuleIdList(Arrays.asList(ids));
}
} catch (Exception e) {
logger.error("预案规则删除同步出错", e);
}
}
});
} catch (Exception e) {
......@@ -855,7 +868,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
try {
emqKeeper.subscript(VIEW_3D_OPEN_STATUS, 1, new EmqxListener() {
@Override
public void processMessage(String topic, MqttMessage message) {
public void processMessage(String topic, MqttMessage message) {
Map msg = JSON.parseObject(message.toString());
if (msg.containsKey("status") && msg.containsKey("seq")) {
String seq = msg.get("seq").toString();
......@@ -963,8 +976,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
start = 0;
}
List<ContingencyPlanInstanceVO> list = contingencyInstanceInfoMapper.getTaskActionPage((int) start, size, batchNo, type, runState, updateDate, roleList, steps);
list.stream().forEach(e->{
if(ObjectUtils.isEmpty(e.getCreateUser())) {
list.stream().forEach(e -> {
if (ObjectUtils.isEmpty(e.getCreateUser())) {
List<String> userName = planVisual3dService.getUserName(e.getRoleCode());
String[] objects = new String[userName.size()];
String[] strings = userName.toArray(objects);
......@@ -994,6 +1007,25 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
}
@Override
public Map<String, Object> getPlanCurrentInfo() {
Map<String, Object> map = new HashMap<>();
Integer[] statusArray = (Integer[]) Arrays.asList(ContingencyPlanStatusEnum.SIMULATION_START.getCode(), ContingencyPlanStatusEnum.ONGOING.getCode()).toArray();
List<PlanDetail> count = planDetailDao.findByStatus(statusArray);
if (count.size() > NumberEnum.ZERO.getValue()) {
map.put("run", "true");
} else {
map.put("run", "false");
}
map.put("planDetailsList", count);
String planType = "";
if (redisTemplate.hasKey("planType")) {
planType = redisTemplate.boundValueOps("planType").get(0, -1);
}
map.put("planType", planType);
return map;
}
@Override
public Map<String, Object> getUserOperateCountAndPlanName(List<RoleModel> roleModelList) {
Map<String, Object> map = new HashMap<>();
List<PlanOperationRecord> recordList = planOperationRecordDao.findByStatus(0);
......
......@@ -148,4 +148,6 @@ public interface IContingencyPlanService {
Page<ContingencyPlanInstanceVO> selectTaskActionPage(int current, int size, String batchNo, String runState, String updateDate, List<String> roleList, List<String> steps);
Map<String, Object> getPlanInfo(Long planId);
Map<String, Object> getPlanCurrentInfo();
}
......@@ -38,4 +38,6 @@ public class PlanDetailVo extends PlanDetail {
private String zid;
private String category;
}
......@@ -84,6 +84,8 @@
, (SELECT classify_name FROM c_plan_classify_tree cpct WHERE id = cpd.classify_id) classifyName
, (SELECT count(1) FROM c_plan_operation_record cpor WHERE plan_id = cpd.id) executionTimes
,fpp.picture
, (CASE WHEN c.category='1850' OR c.category='1830' OR c.category='1831' OR c.category='1832' OR c.category='1833' THEN '换流变'
WHEN c.category='1851' THEN '主变' WHEN c.category='1852' THEN '高抗' ELSE '换流变' END) AS category
FROM
c_plan_detail cpd
left join c_plan_equipment as cpe on cpd.id = cpe.plan_id and cpe.is_delete = 0
......
......@@ -108,30 +108,13 @@
}
},
{
"buttonCode": "DRAIN_OIL_CONFIRM",
"checkYesOrNo": "",
"index": 5,
"isAuto": 0,
"isParallel": "0",
"outAndOr": "and",
"roleCode": "Digital_Responsing_Plan_A",
"showLine": false,
"stepCode": "5",
"stepName": "启动应急排油",
"stepStatus": "0",
"time": "",
"videos": {
}
},
{
"buttonCode": "START_TURBOFAN_ROBOT",
"checkYesOrNo": "",
"index": 6,
"index": 5,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"showLine": false,
"stepCode": "6",
"stepCode": "5",
"stepName": "启动CAFS举高灭火机器人",
"stepStatus": "0",
"time": "",
......@@ -142,11 +125,11 @@
{
"buttonCode": "APPLY_FOR_OVERHAUL",
"checkYesOrNo": "",
"index": 7,
"index": 6,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"showLine": false,
"stepCode": "7",
"stepCode": "6",
"stepName": "申请调检修",
"stepStatus": "0",
"time": "",
......@@ -194,11 +177,11 @@
{
"buttonCode": "OFF_POWER",
"checkYesOrNo": "",
"index": 8,
"index": 7,
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"showLine": false,
"stepCode": "8",
"stepCode": "7",
"stepName": "断开交、直流电源",
"stepStatus": "0",
"time": "",
......@@ -209,11 +192,11 @@
{
"buttonCode": "FIRE_TRANSVERTER_TO_OVERHAUL",
"checkYesOrNo": "",
"index": 9,
"index": 8,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"showLine": false,
"stepCode": "9",
"stepCode": "8",
"stepName": "执行转检修操作",
"stepStatus": "0",
"time": "",
......@@ -224,11 +207,11 @@
{
"buttonCode": "PLUG_CABLETRENCH",
"checkYesOrNo": "",
"index": 10,
"index": 9,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"showLine": false,
"stepCode": "10",
"stepCode": "9",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"time": "",
......@@ -239,11 +222,11 @@
{
"buttonCode": "HANDOVER_FIGTHHING",
"checkYesOrNo": "",
"index": 11,
"index": 10,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"showLine": false,
"stepCode": "11",
"stepCode": "10",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"time": "",
......@@ -254,11 +237,11 @@
{
"buttonCode": "FIRE_EXTINCT",
"checkYesOrNo": "",
"index": 12,
"index": 11,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"showLine": false,
"stepCode": "12",
"stepCode": "11",
"stepName": "确认明火扑灭,确认着火设备温度降为环境温度",
"stepStatus": "0",
"time": "",
......@@ -269,11 +252,11 @@
{
"buttonCode": "ACCIDENT_REPORT",
"checkYesOrNo": "",
"index": 13,
"index": 12,
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"showLine": false,
"stepCode": "13",
"stepCode": "12",
"stepName": "检查现场情况,汇报调度",
"stepStatus": "0",
"time": "",
......@@ -284,11 +267,11 @@
{
"buttonCode": "END_EMERGENCY",
"checkYesOrNo": "",
"index": 14,
"index": 13,
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B",
"showLine": false,
"stepCode": "14",
"stepCode": "13",
"stepName": "退出预案",
"stepStatus": "0",
"time": "",
......
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