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

item:扩展应急预案流程索引index

parent 6180e459
...@@ -15,7 +15,6 @@ import com.yeejoin.amos.fas.business.action.result.ActionResult; ...@@ -15,7 +15,6 @@ 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.IContingencyPlanInstanceRepository; import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
...@@ -124,19 +123,16 @@ public class ContingencyAction implements CustomerAction { ...@@ -124,19 +123,16 @@ public class ContingencyAction implements CustomerAction {
private PlanDetailMapper planDetailMapper; private PlanDetailMapper planDetailMapper;
@Autowired @Autowired
private IPlanRuleService planRuleService;
@Autowired
private IPlanVisual3dService planVisual3dService; private IPlanVisual3dService planVisual3dService;
@Autowired @Autowired
private ContingencyInstanceInfoService contingencyInstanceInfoService; private ContingencyInstanceInfoService contingencyInstanceInfoService;
@Autowired @Autowired
private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper; private IContingencyPlanInstanceRepository contingencyPlanInstanceRepository;
@Autowired @Autowired
private IContingencyPlanInstanceRepository contingencyPlanInstanceRepository; private IPlanStepService planStepService;
@Value("${rocket-plan-topic}") @Value("${rocket-plan-topic}")
private String rocketTopic; private String rocketTopic;
...@@ -441,7 +437,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -441,7 +437,7 @@ public class ContingencyAction implements CustomerAction {
if (StringUtils.isBlank(buttonCode)) { if (StringUtils.isBlank(buttonCode)) {
// 根据步骤,取按钮编码 // 根据步骤,取按钮编码
List<PlanStepJsonVO> planStepJsonVOList = iContingencyInstance.getPlanStepJsonVOS(); List<PlanStepJsonVO> planStepJsonVOList = planStepService.getPlanStepJsonVOS();
List<PlanStepJsonVO> collect = planStepJsonVOList.stream().filter(x -> x.getStepCode().equals(stepCode)).collect(Collectors.toList()); List<PlanStepJsonVO> collect = planStepJsonVOList.stream().filter(x -> x.getStepCode().equals(stepCode)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) { if (!CollectionUtils.isEmpty(collect)) {
buttonCode = collect.get(0).getButtonCode(); buttonCode = collect.get(0).getButtonCode();
...@@ -863,9 +859,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -863,9 +859,9 @@ public class ContingencyAction implements CustomerAction {
try { try {
// ContingencyPlanInstance instance = contingencyInstance.getMessageById(contingencyPlanId); // ContingencyPlanInstance instance = contingencyInstance.getMessageById(contingencyPlanId);
// if (contingencyPlanInstance != null) { // if (contingencyPlanInstance != null) {
contingencyPlanInstance.setRoleCode(contingencyInstance.getPlanStepRoleCodeByButtonCode(buttonCode)); contingencyPlanInstance.setRoleCode(planStepService.getPlanStepRoleCodeByButtonCode(buttonCode));
// contingencyPlanInstanceMapper.updateMessageById(contingencyPlanInstance); // contingencyPlanInstanceMapper.updateMessageById(contingencyPlanInstance);
contingencyPlanInstanceRepository.save(contingencyPlanInstance); contingencyPlanInstanceRepository.save(contingencyPlanInstance);
// } // }
contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, buttonJson, contingencyPlanId, buttonCode, confirm, stepState, "true", RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), null); contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, buttonJson, contingencyPlanId, buttonCode, confirm, stepState, "true", RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), null);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -28,7 +28,6 @@ import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; ...@@ -28,7 +28,6 @@ import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
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 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;
...@@ -37,7 +36,6 @@ import org.slf4j.LoggerFactory; ...@@ -37,7 +36,6 @@ 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;
...@@ -45,10 +43,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -45,10 +43,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 org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.context.RequestContextEntityType;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -99,9 +94,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -99,9 +94,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
private ContingencyOriginalMapper contingencyOriginalMapper; private ContingencyOriginalMapper contingencyOriginalMapper;
@Autowired @Autowired
private IPlanRuleService planRuleService;
@Autowired
private ContingencyInstanceInfoService contingencyInstanceInfoService; private ContingencyInstanceInfoService contingencyInstanceInfoService;
@Autowired @Autowired
...@@ -116,8 +108,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -116,8 +108,8 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
@Autowired @Autowired
private IPlanVisual3dService planVisual3dService; private IPlanVisual3dService planVisual3dService;
@Value("classpath:/json/plan-step.json") @Autowired
private Resource planStepResource; private IPlanStepService planStepService;
private static Map<String, String> stepMap = new HashMap<>(); private static Map<String, String> stepMap = new HashMap<>();
...@@ -489,7 +481,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -489,7 +481,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
if ("OPERATE".equals(recordType)) { if ("OPERATE".equals(recordType)) {
ButtonJsonVO buttonJsonVO = JSONObject.parseObject(contingencyPlanInstance.getContent(), ButtonJsonVO.class); ButtonJsonVO buttonJsonVO = JSONObject.parseObject(contingencyPlanInstance.getContent(), ButtonJsonVO.class);
Map<String, Object> map = buttonJsonVO.getOperate().get(buttonJsonVO.getOperate().size() - 1); Map<String, Object> map = buttonJsonVO.getOperate().get(buttonJsonVO.getOperate().size() - 1);
contingencyPlanInstance.setRoleCode(getPlanStepRoleCodeByButtonCode(map.get("code").toString())); contingencyPlanInstance.setRoleCode(planStepService.getPlanStepRoleCodeByButtonCode(map.get("code").toString()));
} else { } else {
String appKey = redisTemplate.opsForValue().get("action:appKey").toString(); String appKey = redisTemplate.opsForValue().get("action:appKey").toString();
String product = redisTemplate.opsForValue().get("action:product").toString(); String product = redisTemplate.opsForValue().get("action:product").toString();
...@@ -509,7 +501,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -509,7 +501,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.getme(); FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.getme();
AgencyUserModel user = (AgencyUserModel) feignClientResult.getResult(); AgencyUserModel user = (AgencyUserModel) feignClientResult.getResult();
List<PlanStepJsonVO> result = getPlanStepJsonVOS(); List<PlanStepJsonVO> result = planStepService.getPlanStepJsonVOS();
List<String> roleCode = result.stream().map(PlanStepJsonVO::getRoleCode).distinct().collect(Collectors.toList()); List<String> roleCode = result.stream().map(PlanStepJsonVO::getRoleCode).distinct().collect(Collectors.toList());
List<RoleModel> roleModelList = new ArrayList<>(); List<RoleModel> roleModelList = new ArrayList<>();
...@@ -544,17 +536,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -544,17 +536,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return contingencyPlanInstance; return contingencyPlanInstance;
} }
public 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>();
...@@ -618,15 +599,4 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -618,15 +599,4 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return contingencyPlanInstanceMapper.getMessageById(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.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.rule.RuleTrigger;
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.ContingencyRo;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo;
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.IContingencyPlanInstanceRepository;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.service.model.Operate;
import com.yeejoin.amos.fas.business.service.model.OperateGroup;
import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.vo.ButtonJsonVO;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.common.enums.PlanReplyMessageEnum;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment;
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.StringUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class PlanStepServiceImpl implements IPlanStepService {
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
@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;
}
@Override
public int getPlanStepIndexByStepCode(String stepCode) {
if (StringUtils.isNotBlank(stepCode)) {
List<PlanStepJsonVO> result = getPlanStepJsonVOS();
List<PlanStepJsonVO> collect = result.stream().filter(x -> stepCode.equalsIgnoreCase(x.getStepCode())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
return collect.get(0).getIndex();
}
}
return -1;
}
@Override
public 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;
}
@Override
public String getPlanStep() {
try {
return IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案初始化planStep信息失败!");
}
}
}
...@@ -15,6 +15,7 @@ import com.yeejoin.amos.fas.business.feign.IMaasVisualServer; ...@@ -15,6 +15,7 @@ import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
import com.yeejoin.amos.fas.business.feign.PrivilegeFeign; import com.yeejoin.amos.fas.business.feign.PrivilegeFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
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.IPlanStepService;
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;
...@@ -91,8 +92,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -91,8 +92,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private WebMqttComponent webMqttComponent;
@Value("classpath:/json/plan-step.json") @Autowired
private Resource planStepResource; private IPlanStepService planStepService;
@Autowired @Autowired
private IContingencyPlanInstanceRepository repository; private IContingencyPlanInstanceRepository repository;
...@@ -112,7 +113,6 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -112,7 +113,6 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
@Value("${plan.instance.personImg}") @Value("${plan.instance.personImg}")
private String personImg; private String personImg;
...@@ -321,7 +321,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -321,7 +321,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
ToipResponse toipResponse = new ToipResponse(); ToipResponse toipResponse = new ToipResponse();
// 根据批次号查询预案步骤 // 根据批次号查询预案步骤
// String planStep = planOperationRecordMapper.getPlanStepByBatchNo(batchNo); // String planStep = planOperationRecordMapper.getPlanStepByBatchNo(batchNo);
String planStep = Objects.requireNonNull(redisTemplate.opsForValue().get("planStep")).toString(); String planStep = "";
if (redisTemplate.hasKey("planStep")) {
planStep = Objects.requireNonNull(redisTemplate.opsForValue().get("planStep")).toString();
} else {
planStep = planStepService.getPlanStep();
}
JSONArray objects = JSON.parseArray(planStep); JSONArray objects = JSON.parseArray(planStep);
Map<String, Object> msgContext = new HashMap<>(2); Map<String, Object> msgContext = new HashMap<>(2);
if (StringUtil.isNotEmpty(planStep) && StringUtils.isNotBlank(batchNo)) { if (StringUtil.isNotEmpty(planStep) && StringUtils.isNotBlank(batchNo)) {
...@@ -392,12 +397,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -392,12 +397,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public void initPlanStep() { public void initPlanStep() {
try { redisTemplate.opsForValue().set("planStep", planStepService.getPlanStep());
redisTemplate.opsForValue().set("planStep", IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8))); redisTemplate.delete("isMock");
redisTemplate.delete("isMock");
} catch (IOException e) {
throw new RuntimeException("预案redis初始化planStep信息失败!");
}
} }
@Override @Override
...@@ -454,7 +455,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -454,7 +455,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
List<PlanStepJsonVO> collect = list.stream().peek(x -> { List<PlanStepJsonVO> collect = list.stream().peek(x -> {
if ("true".equals(isExecute)) { if ("true".equals(isExecute)) {
// 更新进度条标志位 // 更新进度条标志位
if (StringUtils.isBlank(x.getTime()) && Integer.parseInt(x.getStepCode()) <= Integer.parseInt(stepCode)) { // 根据stepCode查找对应的索引index
int index = planStepService.getPlanStepIndexByStepCode(stepCode);
if (StringUtils.isBlank(x.getTime()) && index > -1 && x.getIndex() <= index) {
x.setShowLine(true); x.setShowLine(true);
} }
} }
...@@ -473,11 +476,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -473,11 +476,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
x.setTime(DateFormatUtils.format(new Date(), "HH:mm:ss")); x.setTime(DateFormatUtils.format(new Date(), "HH:mm:ss"));
} }
// 通过contingencyPlanId获取buttonJson数据
x.setBatchNo(batchNo); x.setBatchNo(batchNo);
x.setCaseId(contingencyPlanId); x.setCaseId(contingencyPlanId);
// ContingencyPlanInstance planInstance = iContingencyPlanInstanceRepository.getOne(contingencyPlanId);
// x.setButtonJson(planInstance.getContent());
x.setButtonJson(buttonJson); x.setButtonJson(buttonJson);
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -512,12 +512,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -512,12 +512,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public ContingencyPlanInstance replyMessage(AgencyUserModel user, ContingencyPlanInstance dto) { public ContingencyPlanInstance replyMessage(AgencyUserModel user, ContingencyPlanInstance dto) {
String json = ""; String json = planStepService.getPlanStep();
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); List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
List<String> roleCode = result.stream().map(PlanStepJsonVO::getRoleCode).distinct().collect(Collectors.toList()); List<String> roleCode = result.stream().map(PlanStepJsonVO::getRoleCode).distinct().collect(Collectors.toList());
...@@ -700,12 +695,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -700,12 +695,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return contingencyPlanInstance; return contingencyPlanInstance;
} }
private List<String> getUserIds(String buttonCode) { private List<String> getUserIds(String buttonCode) {
String planStepJson = ""; String planStepJson = planStepService.getPlanStep();
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<PlanStepJsonVO> planStepJsonList = JSONObject.parseArray(planStepJson, PlanStepJsonVO.class);
List<String> collect = planStepJsonList.stream().filter(code -> code.getButtonCode().equals(buttonCode)).map(PlanStepJsonVO::getRoleCode).collect(Collectors.toList()); List<String> collect = planStepJsonList.stream().filter(code -> code.getButtonCode().equals(buttonCode)).map(PlanStepJsonVO::getRoleCode).collect(Collectors.toList());
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
......
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;
...@@ -40,12 +39,4 @@ public interface IContingencyInstance { ...@@ -40,12 +39,4 @@ public interface IContingencyInstance {
*/ */
ContingencyPlanInstance getMessageById(String id); ContingencyPlanInstance getMessageById(String id);
/**
* 通过buttonCode获取执行角色编码
* @param buttonCode
* @return
*/
String getPlanStepRoleCodeByButtonCode(String buttonCode);
List<PlanStepJsonVO> getPlanStepJsonVOS();
} }
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import java.util.List;
public interface IPlanStepService {
/**
* 通过buttonCode获取执行角色编码
*
* @param buttonCode
* @return
*/
String getPlanStepRoleCodeByButtonCode(String buttonCode);
/**
* 通过stepCode获取当前索引index
*
* @param stepCode
* @return
*/
int getPlanStepIndexByStepCode(String stepCode);
List<PlanStepJsonVO> getPlanStepJsonVOS();
String getPlanStep();
}
...@@ -20,4 +20,9 @@ public class PlanStepJsonVO { ...@@ -20,4 +20,9 @@ public class PlanStepJsonVO {
* 1:是,0:否 * 1:是,0:否
*/ */
private String checkYesOrNo = ""; private String checkYesOrNo = "";
/**
* 进度索引
*/
private int index;
} }
[
{
"stepCode": "0",
"stepName": "确认灾情",
"stepStatus": "0",
"buttonCode": "FIRE_CONFIRM",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "1",
"stepName": "停运换流阀",
"stepStatus": "0",
"buttonCode": "STOP_COMMUTATION",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "2",
"stepName": "拨打报警电话",
"stepStatus": "0",
"buttonCode": "CALL_PHONE",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "3",
"stepName": "确认油枕排油系统已开启",
"stepStatus": "0",
"buttonCode": "DRAIN_OIL_CONFIRM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "4",
"stepName": "确认水喷雾系统已开启",
"stepStatus": "0",
"buttonCode": "OPEN_WATERSYSTEM",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "5",
"stepName": "断开上级电源",
"stepStatus": "0",
"buttonCode": "OFF_POWER",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "6",
"stepName": "停运阀厅空调系统",
"stepStatus": "0",
"buttonCode": "STOP_AIRCON",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "7",
"stepName": "一键开启消防炮",
"stepStatus": "0",
"buttonCode": "MONITOR_START",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A"
},
{
"stepCode": "8",
"stepName": "驻站消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_COMMAND",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "9",
"stepName": "确认本体排油已开启",
"stepStatus": "0",
"buttonCode": "OWNER_DRAIN_OIL",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "10",
"stepName": "启动阀厅应急预案",
"stepStatus": "0",
"buttonCode": "START_VALVE_HALL_CONTINGENCY",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "11",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"buttonCode": "PLUG_CABLETRENCH",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "12",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_FIGTHHING",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "13",
"stepName": "确认明火扑灭",
"stepStatus": "0",
"buttonCode": "FIRE_EXTINCT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "14",
"stepName": "应急处置结束",
"stepStatus": "0",
"buttonCode": "END_EMERGENCY",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B"
}
]
\ No newline at end of file
...@@ -5,39 +5,53 @@ ...@@ -5,39 +5,53 @@
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "FIRE_CONFIRM", "buttonCode": "FIRE_CONFIRM",
"isParallel": "1", "isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_A",
"index": 0
}, },
{ {
"stepCode": "1", "stepCode": "2",
"stepName": "停运换流阀", "stepName": "拨打报警电话",
"stepStatus": "0", "stepStatus": "1",
"buttonCode": "STOP_COMMUTATION", "buttonCode": "CALL_PHONE",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_A",
"index": 1
}, },
{ {
"stepCode": "2", "stepCode": "1",
"stepName": "拨打报警电话", "stepName": "停运换流阀",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "CALL_PHONE", "buttonCode": "STOP_COMMUTATION",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_A",
"index": 2
}, },
{ {
"stepCode": "3", "stepCode": "3",
"stepName": "确认油枕排油系统已开启", "stepName": "确认排油系统已开启",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "DRAIN_OIL_CONFIRM", "buttonCode": "DRAIN_OIL_CONFIRM",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_A",
"index": 3
}, },
{ {
"stepCode": "4", "stepCode": "4",
"stepName": "确认水喷雾系统已开启", "stepName": "确认泡沫喷淋系统已开启",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "OPEN_WATERSYSTEM", "buttonCode": "OPEN_WATERSYSTEM",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 4
},
{
"stepCode": "7",
"stepName": "一键开启消防炮",
"stepStatus": "1",
"buttonCode": "MONITOR_START",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_A",
"index": 5
}, },
{ {
"stepCode": "5", "stepCode": "5",
...@@ -45,63 +59,35 @@ ...@@ -45,63 +59,35 @@
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "OFF_POWER", "buttonCode": "OFF_POWER",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_A",
"index": 6
}, },
{ {
"stepCode": "6", "stepCode": "11",
"stepName": "停运阀厅空调系统", "stepName": "电缆沟封堵",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "STOP_AIRCON", "buttonCode": "PLUG_CABLETRENCH",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_B",
"index": 7
}, },
{ {
"stepCode": "7", "stepCode": "6",
"stepName": "一键开启消防炮", "stepName": "停运阀厅空调系统",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "MONITOR_START", "buttonCode": "STOP_AIRCON",
"isParallel": "0", "isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A" "roleCode": "Digital_Responsing_Plan_A",
"index": 8
}, },
{ {
"stepCode": "8", "stepCode": "8",
"stepName": "驻站消防队指挥权交接", "stepName": "驻站消防队指挥权交接",
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "HANDOVER_COMMAND", "buttonCode": "HANDOVER_COMMAND",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "9",
"stepName": "确认本体排油已开启",
"stepStatus": "0",
"buttonCode": "OWNER_DRAIN_OIL",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "10",
"stepName": "启动阀厅应急预案",
"stepStatus": "0",
"buttonCode": "START_VALVE_HALL_CONTINGENCY",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "11",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"buttonCode": "PLUG_CABLETRENCH",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B"
},
{
"stepCode": "12",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_FIGTHHING",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B" "roleCode": "Digital_Responsing_Plan_B",
"index": 9
}, },
{ {
"stepCode": "13", "stepCode": "13",
...@@ -109,7 +95,8 @@ ...@@ -109,7 +95,8 @@
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "FIRE_EXTINCT", "buttonCode": "FIRE_EXTINCT",
"isParallel": "0", "isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B" "roleCode": "Digital_Responsing_Plan_B",
"index": 10
}, },
{ {
"stepCode": "14", "stepCode": "14",
...@@ -117,6 +104,7 @@ ...@@ -117,6 +104,7 @@
"stepStatus": "0", "stepStatus": "0",
"buttonCode": "END_EMERGENCY", "buttonCode": "END_EMERGENCY",
"isParallel": "1", "isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B" "roleCode": "Digital_Responsing_Plan_B",
"index": 11
} }
] ]
\ 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