Commit 8fb9d1e3 authored by 高建强's avatar 高建强

item:预案自动执行提交

parent 9c567eaa
...@@ -470,7 +470,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -470,7 +470,7 @@ public class ContingencyAction implements CustomerAction {
try { try {
ButtonJsonVO buttonJsonVO = JSONObject.parseObject(buttonJson, ButtonJsonVO.class); ButtonJsonVO buttonJsonVO = JSONObject.parseObject(buttonJson, ButtonJsonVO.class);
Map<String, Object> map = buttonJsonVO.getOperate().get(buttonJsonVO.getOperate().size() - 1); Map<String, Object> map = buttonJsonVO.getOperate().get(buttonJsonVO.getOperate().size() - 1);
iContingencyInstance.fire(batchNo, buttonJsonVO.getStepCode(), buttonJson, contingencyPlanId, map.get("code").toString(), "CANCEL_0", "A", "false", RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), null); iContingencyInstance.fire(batchNo, buttonJsonVO.getStepCode(), buttonJson, contingencyPlanId, map.get("code").toString(), "CANCEL_0", "A", "false", "false",RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), null);
} catch (Exception e) { } catch (Exception e) {
log.error("optionarea 加入队列失败-->" + e.getMessage()); log.error("optionarea 加入队列失败-->" + e.getMessage());
} }
...@@ -861,7 +861,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -861,7 +861,7 @@ public class ContingencyAction implements CustomerAction {
try { try {
contingencyPlanInstance.setRoleCode(planStepService.getPlanStepRoleCodeByButtonCode(buttonCode)); contingencyPlanInstance.setRoleCode(planStepService.getPlanStepRoleCodeByButtonCode(buttonCode));
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", "true", RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -81,7 +81,7 @@ public class TimeLineController extends BaseController { ...@@ -81,7 +81,7 @@ public class TimeLineController extends BaseController {
public CommonResponse fire(@RequestBody PlanExecuteVo vo) throws Exception { public CommonResponse fire(@RequestBody PlanExecuteVo vo) throws Exception {
AgencyUserModel userInfo = getUserInfo(); AgencyUserModel userInfo = getUserInfo();
String user = userInfo.getRealName(); String user = userInfo.getRealName();
iContingencyInstance.fire(vo.getBatchNo(), vo.getStepCode(), vo.getButtonJson(), vo.getContingencyPlanId(), vo.getButtonCode(), vo.getConfirm(), vo.getStepState(), "true", getToken(), getProduct(), getAppKey(), user); iContingencyInstance.fire(vo.getBatchNo(), vo.getStepCode(), vo.getButtonJson(), vo.getContingencyPlanId(), vo.getButtonCode(), vo.getConfirm(), vo.getStepState(), "true", "false", getToken(), getProduct(), getAppKey(), user);
return CommonResponseUtil.success("SUCCESS"); return CommonResponseUtil.success("SUCCESS");
} }
......
...@@ -353,19 +353,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -353,19 +353,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
} }
throw new Exception("请勿重复操作."); throw new Exception("请勿重复操作.");
} }
// if ("CONFIRM".equals(buttonState)) {
// if (code.equals(operate.getCode())) {
// operate.setState("executed");
// if ("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)) {
// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// // 应急处置中断,初始化planStep,json数据
// planRuleService.updatePlanRuleByBatchNo(batchNo);
// // 应急处置中断,更新预案信息表结束时间
// contingencyInstanceInfoService.updateEndTimeById(batchNo);
// }
// }
// }
} }
} }
...@@ -397,7 +384,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -397,7 +384,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
if ("CONFIRM".equals(buttonState) && ("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code))) { if ("CONFIRM".equals(buttonState) && ("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code))) {
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning()); redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// 应急处置中断,初始化planStep,json数据 // 应急处置中断,初始化planStep,json数据
// planRuleService.updatePlanRuleByBatchNo(batchNo);
planStepService.initPlanStep(); planStepService.initPlanStep();
// 应急处置中断,更新预案信息表结束时间 // 应急处置中断,更新预案信息表结束时间
contingencyInstanceInfoService.updateEndTimeById(batchNo); contingencyInstanceInfoService.updateEndTimeById(batchNo);
...@@ -452,7 +438,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -452,7 +438,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
} }
@Override @Override
public Optional<Equipment> fire(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String isExecute, String token, String product, String appKey,String startUserName) throws Exception { public Optional<Equipment> fire(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String isExecute, String isAuto, String token, String product, String appKey,String startUserName) 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);
...@@ -461,6 +447,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -461,6 +447,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
map.put("contingencyPlanId", contingencyPlanId); map.put("contingencyPlanId", contingencyPlanId);
map.put("stepState", stepStateOnbutton); map.put("stepState", stepStateOnbutton);
map.put("isExecute", isExecute); map.put("isExecute", isExecute);
map.put("isAuto", isAuto);
if(startUserName != null) { if(startUserName != null) {
map.put("startUserName", startUserName); map.put("startUserName", startUserName);
} }
...@@ -576,6 +563,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -576,6 +563,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
String contingencyPlanId = map.get("contingencyPlanId"); String contingencyPlanId = map.get("contingencyPlanId");
String stepState = map.get("stepState"); String stepState = map.get("stepState");
String isExecute = map.get("isExecute"); String isExecute = map.get("isExecute");
String isAuto = map.get("isAuto");
String buttonJson = map.get("buttonJson"); String buttonJson = map.get("buttonJson");
String appKey = map.get("appKey"); String appKey = map.get("appKey");
String product = map.get("product"); String product = map.get("product");
...@@ -585,7 +573,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -585,7 +573,7 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setToken(token); RequestContext.setToken(token);
planVisual3dService.updatePlanStepToRedis(batchNo, stepCode, buttonJson, contingencyPlanId, buttonCode, isExecute); planVisual3dService.updatePlanStepToRedis(batchNo, stepCode, buttonJson, contingencyPlanId, buttonCode, isExecute, isAuto);
setButtonExecuted(batchNo, contingencyPlanId, buttonCode, confirm, user); setButtonExecuted(batchNo, contingencyPlanId, buttonCode, confirm, user);
fire(batchNo, stepCode, contingencyPlanId, buttonCode, confirm, stepState); fire(batchNo, stepCode, contingencyPlanId, buttonCode, confirm, stepState);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -381,7 +381,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -381,7 +381,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
@Override @Override
public void updatePlanStepToRedis(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String isExecute) { public void updatePlanStepToRedis(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String isExecute, String isAuto) {
if (StringUtils.isNotBlank(batchNo) && StringUtils.isNotBlank(contingencyPlanId) && StringUtils.isNotBlank(buttonCode)) { if (StringUtils.isNotBlank(batchNo) && StringUtils.isNotBlank(contingencyPlanId) && StringUtils.isNotBlank(buttonCode)) {
// 根据批次号查询预案步骤 // 根据批次号查询预案步骤
String planStep = Objects.requireNonNull(redisTemplate.opsForValue().get("planStep")).toString(); String planStep = Objects.requireNonNull(redisTemplate.opsForValue().get("planStep")).toString();
...@@ -405,10 +405,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -405,10 +405,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
x.setCheckYesOrNo("0"); x.setCheckYesOrNo("0");
} else { } else {
x.setCheckYesOrNo("1"); x.setCheckYesOrNo("1");
x.setIsAuto(1);
if (StringUtils.isNotBlank(x.getTime())) { if (StringUtils.isNotBlank(x.getTime())) {
x.setShowLine(true); x.setShowLine(true);
} }
if (StringUtils.isNotBlank(isAuto) && "true".equalsIgnoreCase(isAuto)) {
x.setIsAuto(1);
}
} }
x.setTime(DateFormatUtils.format(new Date(), "HH:mm:ss")); x.setTime(DateFormatUtils.format(new Date(), "HH:mm:ss"));
} }
......
...@@ -23,7 +23,7 @@ public interface IContingencyInstance { ...@@ -23,7 +23,7 @@ public interface IContingencyInstance {
void updateStep(String step, String batchNo); void updateStep(String step, String batchNo);
Optional<Equipment> fire(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String isExecute, String token, String product, String appKey,String startUserName) throws Exception; Optional<Equipment> fire(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton, String isExecute, String isAuto, String token, String product, String appKey,String startUserName) throws Exception;
/** /**
* 扩展属性赋值 * 扩展属性赋值
......
...@@ -95,7 +95,7 @@ public interface IPlanVisual3dService { ...@@ -95,7 +95,7 @@ public interface IPlanVisual3dService {
void updatePlanStep(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String isExecute); void updatePlanStep(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String isExecute);
void updatePlanStepToRedis(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String isExecute); void updatePlanStepToRedis(String batchNo, String stepCode, String buttonJson, String contingencyPlanId, String buttonCode, String isExecute, String isAuto);
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);
......
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