Commit 3a59225c authored by 高建强's avatar 高建强

item:应急处置流程执行修改

parent 1b0dbc75
...@@ -52,6 +52,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -52,6 +52,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
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;
...@@ -370,30 +372,36 @@ public class ContingencyAction implements CustomerAction { ...@@ -370,30 +372,36 @@ public class ContingencyAction implements CustomerAction {
content = instedParams(content, contingencyRo); content = instedParams(content, contingencyRo);
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", ""); iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", "");
SafteyPlanResult result = new SafteyPlanResult(); TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
Map<String, Object> tempmap1 = new HashMap<>(); @Override
try { public void afterCommit() {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 事物提交后业务逻辑
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE"); SafteyPlanResult result = new SafteyPlanResult();
ArrayList records = new ArrayList<>(); Map<String, Object> tempmap1 = new HashMap<>();
if (!ObjectUtils.isEmpty(list)) { try {
list.forEach(action -> { SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HashMap map = new HashMap(); List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
map.put("time", sdf1.format(action.getCreateDate().getTime())); ArrayList records = new ArrayList<>();
map.put("stepName", action.getContent()); if (!ObjectUtils.isEmpty(list)) {
records.add(map); list.forEach(action -> {
}); HashMap map = new HashMap();
map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent());
records.add(map);
});
}
tempmap1.put("content", records);
tempmap1.put("status", PlanRecordStatusEnum.OPERATION.getCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result.add(tempmap1);
System.out.println("--------------------messageRecord----------------------" + result);
sendcmd("recordarea", paramObj, result);
sendweb("recordarea", paramObj, result);
} }
tempmap1.put("content", records); });
tempmap1.put("status", PlanRecordStatusEnum.OPERATION.getCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result.add(tempmap1);
System.out.println("--------------------messageRecord----------------------" + result);
this.sendcmd("recordarea", paramObj, result);
this.sendweb("recordarea", paramObj, result);
} }
} }
......
...@@ -391,12 +391,6 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -391,12 +391,6 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public Page<ContingencyPlanInstanceVO> getPlaneRecordByNew(Integer pageNum, Integer size, String batchNo, AgencyUserModel user) { public Page<ContingencyPlanInstanceVO> getPlaneRecordByNew(Integer pageNum, Integer size, String batchNo, AgencyUserModel user) {
try {
// TODO 为了配合流程,前端获取执行记录消息的数据,后续处理
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Integer planInstanceCount = contingencyPlanInstanceMapper.getPlanInstanceCount(batchNo); Integer planInstanceCount = contingencyPlanInstanceMapper.getPlanInstanceCount(batchNo);
// 根据批次号获取预案记录 // 根据批次号获取预案记录
List<ContingencyPlanInstance> planInstanceListByPage = contingencyPlanInstanceMapper.getPlanInstanceListByPage(batchNo, (pageNum - 1) * size, size); List<ContingencyPlanInstance> planInstanceListByPage = contingencyPlanInstanceMapper.getPlanInstanceListByPage(batchNo, (pageNum - 1) * size, size);
......
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