Commit 7925dc0c authored by KeYong's avatar KeYong

Merge branch 'dev_upgrade' into develop_dl_3.7.0.8

parents 782e3e97 cb3a48f1
...@@ -40,12 +40,14 @@ import com.yeejoin.amos.fas.dao.entity.PlanDetail; ...@@ -40,12 +40,14 @@ import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord; import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo; 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 org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -59,6 +61,7 @@ import java.io.IOException; ...@@ -59,6 +61,7 @@ import java.io.IOException;
import java.lang.reflect.Constructor; 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.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -66,6 +69,8 @@ import java.util.regex.Matcher; ...@@ -66,6 +69,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.typroject.tyboot.core.foundation.context.RequestContext.*;
@Component @Component
@RuleActionBean(beanLabel = "动态预案") @RuleActionBean(beanLabel = "动态预案")
...@@ -156,7 +161,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -156,7 +161,10 @@ public class ContingencyAction implements CustomerAction {
private IPlanOperationRecordDao planOperationRecordDao; private IPlanOperationRecordDao planOperationRecordDao;
@Autowired @Autowired
private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger; private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger;
@Autowired
private IEquipmentFireEquipmentService equipmentFireEquipmentService;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
/** /**
* @param stepCode 当前步骤编号 * @param stepCode 当前步骤编号
...@@ -463,7 +471,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -463,7 +471,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", "false",RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), null); iContingencyInstance.fire(batchNo, buttonJsonVO.getStepCode(), buttonJson, contingencyPlanId, map.get("code").toString(), "CANCEL_0", "A", "false", "false", getToken(), getProduct(), getAppKey(), null);
} catch (Exception e) { } catch (Exception e) {
log.error("optionarea 加入队列失败-->" + e.getMessage()); log.error("optionarea 加入队列失败-->" + e.getMessage());
} }
...@@ -805,7 +813,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -805,7 +813,7 @@ public class ContingencyAction implements CustomerAction {
} }
@RuleMethod(methodLabel = "清除步骤执行", project = "换流站消防专项预案") @RuleMethod(methodLabel = "清除步骤执行", project = "换流站消防专项预案")
public void clearExecute(@MethodParam(paramLabel = "步骤编号") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "重点设备ID") String fireEquipmentId) { public void clearExecute(@MethodParam(paramLabel = "步骤编号") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "重点设备ID") String fireEquipmentId, @MethodParam(paramLabel = "步骤状态") String stepState, @MethodParam(paramLabel = "按钮状态") String buttonState, @MethodParam(paramLabel = "按钮json字符串") String buttonJson, @MethodParam(paramLabel = "步骤名称") String stepName) throws Exception {
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
Map<String, Object> content = new HashMap<>(); Map<String, Object> content = new HashMap<>();
...@@ -824,7 +832,22 @@ public class ContingencyAction implements CustomerAction { ...@@ -824,7 +832,22 @@ public class ContingencyAction implements CustomerAction {
tempmap1.put("type", "buttonCache"); tempmap1.put("type", "buttonCache");
tempmap1.put("content", content); tempmap1.put("content", content);
result.add(tempmap1); result.add(tempmap1);
String instanceId = iContingencyInstance.getInstanceIdByBatchNOAndCategory("OPERATE", stepName, batchNo);
String json;
try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案节点信息失败!");
}
List<PlanStepJsonVO> res = JSONObject.parseArray(json, PlanStepJsonVO.class);
PlanStepJsonVO vo = res.stream().filter(x -> x.getStepCode().equals(stepCode)).collect(Collectors.toList()).get(0);
Object obj = equipmentFireEquipmentService.automaticExecutePoint(vo.getIndex());
if (Boolean.TRUE == obj) {
iContingencyInstance.fire(batchNo, stepCode, buttonJson, instanceId,
buttonCode, buttonState, stepState, "true", "true", getToken(),
getProduct(), getAppKey(), "系统执行自动步骤");
}
this.sendcmd("message", result); this.sendcmd("message", result);
} }
...@@ -855,7 +878,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -855,7 +878,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", "true", RequestContext.getToken(), RequestContext.getProduct(), RequestContext.getAppKey(), null); contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, buttonJson, contingencyPlanId, buttonCode, confirm, stepState, "true", "true", getToken(), getProduct(), getAppKey(), null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -44,4 +44,6 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla ...@@ -44,4 +44,6 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla
long countWater(@Param("bizOrgCode") String bizOrgCode); long countWater(@Param("bizOrgCode") String bizOrgCode);
Integer getPlanInstanceCountByCondition(@Param("category") String category, @Param("recordType") String recordType, @Param("batchNo") String batchNo, @Param("content") String content); Integer getPlanInstanceCountByCondition(@Param("category") String category, @Param("recordType") String recordType, @Param("batchNo") String batchNo, @Param("content") String content);
String getInstanceIdByBatchNOAndCategory(@Param("recordType") String recordType, @Param("category") String category, @Param("batchNo") String batchNo);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.dao.entity.PlanMessage; import com.yeejoin.amos.fas.dao.entity.PlanMessage;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -17,4 +18,6 @@ import java.util.Map; ...@@ -17,4 +18,6 @@ import java.util.Map;
public interface PlanMessageMapper extends BaseMapper<PlanMessage> { public interface PlanMessageMapper extends BaseMapper<PlanMessage> {
List<Map<String, String>> getPlanMessageList(String batchNo, Integer stepIndex); List<Map<String, String>> getPlanMessageList(String batchNo, Integer stepIndex);
int getPlanMessageCount(String batchNo, Integer stepIndex, Date indexUpdateTime);
} }
...@@ -623,4 +623,9 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -623,4 +623,9 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
return contingencyPlanInstanceMapper.getMessageById(id); return contingencyPlanInstanceMapper.getMessageById(id);
} }
@Override
public String getInstanceIdByBatchNOAndCategory(String type, String name, String batchNo) {
return contingencyPlanInstanceMapper.getInstanceIdByBatchNOAndCategory(type, name, batchNo);
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper; import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper; import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanMessageMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanMessageMapper;
...@@ -223,7 +224,13 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen ...@@ -223,7 +224,13 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
planMessage.setStepIndex(vo.getIndex()); planMessage.setStepIndex(vo.getIndex());
return planMessage; return planMessage;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
planMessageDao.saveAll(messages); for (PlanMessage message : messages) {
int count = planMessageMapper.getPlanMessageCount(String.valueOf(map.get("batchNo")), index, message.getIndexCreateTime());
if (0 <count) {
continue;
}
planMessageDao.save(message);
}
} }
if (pumpStepIndex == index) { if (pumpStepIndex == index) {
return 0 < resultSize; return 0 < resultSize;
......
...@@ -39,4 +39,5 @@ public interface IContingencyInstance { ...@@ -39,4 +39,5 @@ public interface IContingencyInstance {
*/ */
ContingencyPlanInstance getMessageById(String id); ContingencyPlanInstance getMessageById(String id);
String getInstanceIdByBatchNOAndCategory(String type, String name, String batchNo);
} }
...@@ -95,4 +95,4 @@ outSystem.user.password=a1234560 ...@@ -95,4 +95,4 @@ outSystem.user.password=a1234560
privilege.fegin.name=AMOS-API-PRIVILEGE privilege.fegin.name=AMOS-API-PRIVILEGE
#\u9884\u6848\u6307\u6807\u914D\u7F6E #\u9884\u6848\u6307\u6807\u914D\u7F6E
plan.index =ONL_OilDischargeDeviceOilPillowDischargeOpen,CAFS_CAFSFireGunEquipmentValveStatus,DCCP_DCCPStreamTransformerCharged,WSS_DelugeValve_Start,ONL_OilDischargeDeviceOilyPillowDischargeOpen plan.index =ONL_OilDischargeDeviceOilPillowDischargeOpen,CAFS_CAFSFireGunEquipmentValveStatus,DCCP_DCCPStreamTransformerCharged,WSS_DelugeValve_Start,ONL_OilDischargeDeviceOilyPillowDischargeOpen,Running_Alarm,ONL_DrainOilValve_Open,CAFS_CompAirFoamHost_Outfire,CAFS_GunValve_Open,FHS_FirePump_Start,normal_running_state,AIRCS_Fan_Start
\ No newline at end of file \ No newline at end of file
...@@ -408,4 +408,23 @@ ...@@ -408,4 +408,23 @@
AND content = #{content} AND content = #{content}
</if> </if>
</select> </select>
<select id="getInstanceIdByBatchNOAndCategory" resultType="String">
select
id
from
contingency_plan_instance
where
is_delete = 0
<if test="category!=null and category!=''">
AND category = #{category}
</if>
<if test="recordType!=null and recordType!=''">
AND record_type = #{recordType}
</if>
<if test="batchNo!=null and batchNo!=''">
AND batch_no = #{batchNo}
</if>
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -24,4 +24,21 @@ ...@@ -24,4 +24,21 @@
ORDER BY ORDER BY
m.index_create_time DESC m.index_create_time DESC
</select> </select>
<select id="getPlanMessageCount" resultType="int">
SELECT
count(m.id)
FROM
c_plan_message m
where
<if test="batchNo != null and batchNo != ''">
m.batch_no = #{batchNo}
</if>
<if test="stepIndex != null">
AND m.step_index = ${stepIndex}
</if>
<if test="indexUpdateTime != null">
AND m.index_create_time = #{indexUpdateTime}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -143,14 +143,14 @@ ...@@ -143,14 +143,14 @@
<when test = "outAndOr != null and outAndOr != '' and outAndOr == 'and'"> <when test = "outAndOr != null and outAndOr != '' and outAndOr == 'and'">
<if test="list != null and list.size() > 0"> <if test="list != null and list.size() > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="and"> <foreach collection="list" item="item" index="index" open="(" close=")" separator="and">
esi.equipment_index_key = #{item.equipSpeIndexKey} and es.equipment_code = #{item.equipCode} and esi.`value` = #{item.standardValue} esi.equipment_index_key = #{item.equipSpeIndexKey} and es.equipment_code = #{item.equipCode}
</foreach> </foreach>
</if> </if>
</when> </when>
<otherwise> <otherwise>
<if test="list != null and list.size() > 0"> <if test="list != null and list.size() > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="or"> <foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
esi.equipment_index_key = #{item.equipSpeIndexKey} and es.equipment_code = #{item.equipCode} and esi.`value` = #{item.standardValue} esi.equipment_index_key = #{item.equipSpeIndexKey} and es.equipment_code = #{item.equipCode}
</foreach> </foreach>
</if> </if>
</otherwise> </otherwise>
......
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