Commit c524fa30 authored by maoying's avatar maoying

优化预案接口查询

parent b1cf2f73
...@@ -25,7 +25,9 @@ public class ContingencyOriginalData extends BusinessEntity { ...@@ -25,7 +25,9 @@ public class ContingencyOriginalData extends BusinessEntity {
@Column(name = "fire_Equipment_Id") @Column(name = "fire_Equipment_Id")
private String fireEquipmentId;//消防设备id private String fireEquipmentId;//消防设备id
@Column(name = "layer")
@Column(name = "layer")
private Integer layer;//显示图层 private Integer layer;//显示图层
//当前探测器 //当前探测器
...@@ -68,8 +70,6 @@ public class ContingencyOriginalData extends BusinessEntity { ...@@ -68,8 +70,6 @@ public class ContingencyOriginalData extends BusinessEntity {
@Column(name = "batch_No") @Column(name = "batch_No")
private String batchNo; private String batchNo;
@Column(name = "picture1") @Column(name = "picture1")
private String picture1; private String picture1;
...@@ -93,6 +93,19 @@ public class ContingencyOriginalData extends BusinessEntity { ...@@ -93,6 +93,19 @@ public class ContingencyOriginalData extends BusinessEntity {
@Column(name = "step_state") @Column(name = "step_state")
private String stepState;//步骤的操作状态,由所有按钮的步骤状态拼接而成 private String stepState;//步骤的操作状态,由所有按钮的步骤状态拼接而成
@Column(name = "fire_equipment_code")
private String fireEquipmentCode;
@Column(name = "equipment_code")
private String equipmentCode;
/**
* 位置
*/
@Transient
private String position;
public String getPosition() { public String getPosition() {
return position; return position;
...@@ -102,12 +115,6 @@ public class ContingencyOriginalData extends BusinessEntity { ...@@ -102,12 +115,6 @@ public class ContingencyOriginalData extends BusinessEntity {
this.position = position; this.position = position;
} }
/**
* 位置
*/
@Transient
private String position;
public String getEquipmentPosition3d() { public String getEquipmentPosition3d() {
return equipmentPosition3d; return equipmentPosition3d;
...@@ -301,4 +308,20 @@ public class ContingencyOriginalData extends BusinessEntity { ...@@ -301,4 +308,20 @@ public class ContingencyOriginalData extends BusinessEntity {
public void setConfirm(String confirm) { public void setConfirm(String confirm) {
this.confirm = confirm; this.confirm = confirm;
} }
public String getFireEquipmentCode() {
return fireEquipmentCode;
}
public void setFireEquipmentCode(String fireEquipmentCode) {
this.fireEquipmentCode = fireEquipmentCode;
}
public String getEquipmentCode() {
return equipmentCode;
}
public void setEquipmentCode(String equipmentCode) {
this.equipmentCode = equipmentCode;
}
} }
...@@ -108,12 +108,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -108,12 +108,6 @@ public class ContingencyAction implements CustomerAction {
@Autowired @Autowired
private IContingencyInstance contingencyInstance; private IContingencyInstance contingencyInstance;
@Value("${systemctl.sync.switch}")
private Boolean dataSyncSwitch;
@Autowired
private IDataSyncService dataSyncService;
@Autowired @Autowired
private PlanOperationRecordMapper planOperationRecordMapper; private PlanOperationRecordMapper planOperationRecordMapper;
...@@ -706,15 +700,11 @@ public class ContingencyAction implements CustomerAction { ...@@ -706,15 +700,11 @@ public class ContingencyAction implements CustomerAction {
PlanOperationRecord.setStatus(PlanRecordStatusEnum.COMPLETE.getCode()); PlanOperationRecord.setStatus(PlanRecordStatusEnum.COMPLETE.getCode());
PlanOperationRecord.setEndTime(new Date()); PlanOperationRecord.setEndTime(new Date());
PlanOperationRecord record = planOperationRecordDao.save(PlanOperationRecord); PlanOperationRecord record = planOperationRecordDao.save(PlanOperationRecord);
// 异步数据同步之消息发送
planOperationRecordDataSync(record);
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(PlanOperationRecord.getPlanId()); Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(PlanOperationRecord.getPlanId());
if (optionalPlanDetail.get() != null) { if (optionalPlanDetail.get() != null) {
PlanDetail planDetail = optionalPlanDetail.get(); PlanDetail planDetail = optionalPlanDetail.get();
planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode()); planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
PlanDetail detail = planDetailDao.save(planDetail); PlanDetail detail = planDetailDao.save(planDetail);
// 异步数据同步之消息发送
planDetailDataSync(detail);
} }
//数字预案业务屏web端发送消息 //数字预案业务屏web端发送消息
this.sendweb("recordarea", paramObj, result); this.sendweb("recordarea", paramObj, result);
...@@ -727,37 +717,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -727,37 +717,6 @@ public class ContingencyAction implements CustomerAction {
redisTemplate.delete("contingencyRo"); redisTemplate.delete("contingencyRo");
} }
private void planDetailDataSync(PlanDetail detail) {
if (dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("id", detail.getId());
List<PlanDetailSyncBo> planDetailSyncBoList = planDetailMapper.getPlanDetailSyncBoList(map);
dataSyncService.syncCreatedPlanDetailSyncBo(planDetailSyncBoList);
});
} catch (Exception e) {
log.info("数据同步之消息发送. [method='{}']", "stopPlan==>syncCreatedPlanDetailSyncBo", e);
}
}
}
private void planOperationRecordDataSync(PlanOperationRecord record) {
// 异步数据同步之消息发送
if (dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("id", record.getId());
List<PlanOperationRecordSyncBo> planOperationRecordSyncBoList = planOperationRecordMapper.getPlanOperationRecordSyncBoList(map);
dataSyncService.syncCreatedPlanOperationRecordSyncBo(planOperationRecordSyncBoList);
});
} catch (Exception e) {
log.info("数据同步之消息发送. [method='{}']", "stopPlan==>syncCreatedPlanOperationRecordSyncBo", e);
}
}
}
@RuleMethod(methodLabel = "自动执行步骤", project = "换流站消防专项预案") @RuleMethod(methodLabel = "自动执行步骤", project = "换流站消防专项预案")
public void autoExecute(@MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "步骤编号") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "步骤状态") String stepState, @MethodParam(paramLabel = "预案对象") Object paramObj) { public void autoExecute(@MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "步骤编号") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "步骤状态") String stepState, @MethodParam(paramLabel = "预案对象") Object paramObj) {
...@@ -927,15 +886,11 @@ public class ContingencyAction implements CustomerAction { ...@@ -927,15 +886,11 @@ public class ContingencyAction implements CustomerAction {
PlanOperationRecord.setStatus(PlanRecordStatusEnum.INTERRUPT.getCode()); PlanOperationRecord.setStatus(PlanRecordStatusEnum.INTERRUPT.getCode());
PlanOperationRecord.setEndTime(new Date()); PlanOperationRecord.setEndTime(new Date());
PlanOperationRecord record = planOperationRecordDao.save(PlanOperationRecord); PlanOperationRecord record = planOperationRecordDao.save(PlanOperationRecord);
// 异步数据同步之消息发送
planOperationRecordDataSync(record);
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(PlanOperationRecord.getPlanId()); Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(PlanOperationRecord.getPlanId());
if (optionalPlanDetail.get() != null) { if (optionalPlanDetail.get() != null) {
PlanDetail planDetail = optionalPlanDetail.get(); PlanDetail planDetail = optionalPlanDetail.get();
planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode()); planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
PlanDetail detail = planDetailDao.save(planDetail); PlanDetail detail = planDetailDao.save(planDetail);
// 异步数据同步之消息发送
planDetailDataSync(detail);
} }
} }
} }
......
...@@ -12,6 +12,8 @@ import com.yeejoin.amos.fas.business.service.intfc.*; ...@@ -12,6 +12,8 @@ import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO; import com.yeejoin.amos.fas.business.vo.ContingencyInstanceInfoVO;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData; import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -133,10 +135,13 @@ public class FireContingencyHandler implements EventHandler{ ...@@ -133,10 +135,13 @@ public class FireContingencyHandler implements EventHandler{
contingencyRo.setButtonCode(buttonCode); contingencyRo.setButtonCode(buttonCode);
contingencyRo.setButtonState(buttonState); contingencyRo.setButtonState(buttonState);
ContingencyInstanceInfoVO infoVO = contingencyInstanceInfoService.selectDisposalDetails(batchNo); // //需要优化
if (!ObjectUtils.isEmpty(infoVO.getPosition())) { // ContingencyInstanceInfoVO infoVO = contingencyInstanceInfoService.selectDisposalDetails(batchNo);
contingencyOriginalData.setPosition(infoVO.getPosition()); // if (!ObjectUtils.isEmpty(infoVO.getPosition())) {
} // contingencyOriginalData.setPosition(infoVO.getPosition());
// }
contingencyOriginalData.setPosition(contingencyOriginalData.getFireEquipmentPosition());
BeanUtils.copyProperties(contingencyOriginalData, contingencyRo); BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
contingencyRo.setStep(stepCode); contingencyRo.setStep(stepCode);
...@@ -149,21 +154,29 @@ public class FireContingencyHandler implements EventHandler{ ...@@ -149,21 +154,29 @@ public class FireContingencyHandler implements EventHandler{
} }
log.info("stepstate:" + contingencyRo.getStepState()); log.info("stepstate:" + contingencyRo.getStepState());
log.info("stepCode:" + stepCode); log.info("stepCode:" + stepCode);
equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId())); // equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId()));
if (equipment != null) { // if (equipment != null) {
contingencyRo.setEquipmentCode(equipment.getCode()); // contingencyRo.setEquipmentCode(equipment.getCode());
// Map<String, Object> params = contingencyRo.getParams();
// params.put("appKey", RequestContext.getAppKey());
// params.put("product", RequestContext.getProduct());
// params.put("token", RequestContext.getToken());
//
// contingencyRo.setParams(params);
//
// List<String> plan = this.getNumberPlan(Long.parseLong(contingencyRo.getEquipmentId()));
//
// ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(equipment.getName()));
// }
if (StringUtils.isNotEmpty(contingencyOriginalData.getEquipmentName())) {
Map<String, Object> params = contingencyRo.getParams(); Map<String, Object> params = contingencyRo.getParams();
params.put("appKey", RequestContext.getAppKey()); params.put("appKey", RequestContext.getAppKey());
params.put("product", RequestContext.getProduct()); params.put("product", RequestContext.getProduct());
params.put("token", RequestContext.getToken()); params.put("token", RequestContext.getToken());
contingencyRo.setParams(params); contingencyRo.setParams(params);
List<String> plan = this.getNumberPlan(Long.parseLong(contingencyRo.getEquipmentId())); List<String> plan = this.getNumberPlan(Long.parseLong(contingencyRo.getEquipmentId()));
ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(contingencyOriginalData.getEquipmentName()));
ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(equipment.getName()));
} }
iContingencyOriginalDataDao.updateByButton( iContingencyOriginalDataDao.updateByButton(
...@@ -173,7 +186,7 @@ public class FireContingencyHandler implements EventHandler{ ...@@ -173,7 +186,7 @@ public class FireContingencyHandler implements EventHandler{
batchNo batchNo
); );
if (equipment != null) { if (StringUtils.isNotEmpty(contingencyOriginalData.getEquipmentName())) {
publisherPlanLog(stepCode, buttonCode, batchNo); publisherPlanLog(stepCode, buttonCode, batchNo);
} }
} else { } else {
......
...@@ -86,9 +86,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -86,9 +86,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
@Value("${station.name}") @Value("${station.name}")
private String stationName; private String stationName;
@Value("${systemctl.sync.switch}")
private Boolean dataSyncSwitch;
@Autowired @Autowired
private IDataSyncService dataSyncService; private IDataSyncService dataSyncService;
...@@ -168,22 +165,10 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -168,22 +165,10 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
if (0 == num) { if (0 == num) {
instance = this.repository.save(contingencyPlanInstance); instance = this.repository.save(contingencyPlanInstance);
} }
// 异步数据同步之消息发送
// contingencyPlanInstanceDataSync(instance);
return instance; return instance;
} }
// private void contingencyPlanInstanceDataSync(ContingencyPlanInstance instance) {
// if (dataSyncSwitch) {
// try {
// dataSyncService.asyncInvoke(() -> {
// dataSyncService.syncCreatedContingencyPlanInstance(instance);
// });
// } catch (Exception e) {
// log.info("数据同步之消息发送. [method='{}']", "createInstanceRecord==>syncCreatedContingencyPlanInstance", e);
// }
// }
// }
/** /**
...@@ -283,21 +268,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -283,21 +268,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance {
} }
return Optional.ofNullable(equipment); return Optional.ofNullable(equipment);
} }
// 异步数据同步之消息发送 暂时屏蔽 原数字化1.0 同步数据
private void contingencyOriginalDataDataSync(String batchNo, int update) {
if (update > 0 && dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("batchNo", batchNo);
List<ContingencyOriginalDataSyncBo> contingencyOriginalDataBoList = contingencyOriginalMapper.getContingencyOriginalDataBoList(map);
dataSyncService.syncCreatedContingencyOriginalDataSyncBo(contingencyOriginalDataBoList);
});
} catch (Exception e) {
log.info("数据同步之消息发送. [method='{}']", "fire==>syncCreatedContingencyOriginalDataSyncBo", e);
}
}
}
private void publisherPlanLog(String stepCode, String buttonCode, String batchNo) { private void publisherPlanLog(String stepCode, String buttonCode, String batchNo) {
ContingencyEvent event = new ContingencyEvent(this); ContingencyEvent event = new ContingencyEvent(this);
...@@ -432,25 +402,6 @@ public class ContingencyInstanceImpl implements IContingencyInstance { ...@@ -432,25 +402,6 @@ 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 isAuto, 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.put("batchNo", batchNo);
// map.put("stepCode", stepCode);
// map.put("buttonCode", buttonCode);
// map.put("confirm", buttonState);
// map.put("contingencyPlanId", contingencyPlanId);
// map.put("stepState", stepStateOnbutton);
// // 是否执行
// map.put("isExecute", isExecute);
// // 是否自动执行
// map.put("isAuto", isAuto);
// if(startUserName != null) {
// map.put("startUserName", startUserName);
// }
// map.put("buttonJson", buttonJson);
// map.put("appKey", RequestContext.getAppKey());
// map.put("token", RequestContext.getToken());
// map.put("product", RequestContext.getProduct());
PlanExecuteVo vo = new PlanExecuteVo(); PlanExecuteVo vo = new PlanExecuteVo();
vo.setConfirm(buttonState); vo.setConfirm(buttonState);
......
...@@ -88,9 +88,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -88,9 +88,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
@Value("${systemctl.sync.switch}")
private Boolean dataSyncSwitch;
@Autowired @Autowired
private IDataSyncService dataSyncService; private IDataSyncService dataSyncService;
private final PlanOperationRecordMapper planOperationRecordMapper; private final PlanOperationRecordMapper planOperationRecordMapper;
...@@ -212,8 +209,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -212,8 +209,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
PlanOperationRecord.setExecutionType(ExecutionTypeEnum.FIREMANAGEMENT.getCode()); PlanOperationRecord.setExecutionType(ExecutionTypeEnum.FIREMANAGEMENT.getCode());
} }
PlanOperationRecord operationRecord = planOperationRecordDao.save(PlanOperationRecord); PlanOperationRecord operationRecord = planOperationRecordDao.save(PlanOperationRecord);
// 异步数据同步之消息发送
planOperationRecordDataSync(operationRecord);
//预案启动 //预案启动
AlarmParam deviceData = new AlarmParam(); AlarmParam deviceData = new AlarmParam();
deviceData.setMonitor(equipment.getName()); deviceData.setMonitor(equipment.getName());
...@@ -229,8 +224,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -229,8 +224,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
PlanDetail planDetail = PlanDetailOp.get(); PlanDetail planDetail = PlanDetailOp.get();
planDetail.setStatus(vo.getStatus()); planDetail.setStatus(vo.getStatus());
PlanDetail detail = planDetailDao.save(planDetail); PlanDetail detail = planDetailDao.save(planDetail);
// 异步数据同步之消息发送
planDetailDataSync(detail);
//更新预案执行记录表的批次号 //更新预案执行记录表的批次号
operationRecord.setBatchNo(batchNo); operationRecord.setBatchNo(batchNo);
PlanOperationRecord record = planOperationRecordDao.save(operationRecord); PlanOperationRecord record = planOperationRecordDao.save(operationRecord);
...@@ -241,39 +234,13 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -241,39 +234,13 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
instanceInfo.setPosition(equipmentSpecific.getPosition()); instanceInfo.setPosition(equipmentSpecific.getPosition());
contingencyInstanceInfoService.addDisposalDetails(instanceInfo); contingencyInstanceInfoService.addDisposalDetails(instanceInfo);
// 异步数据同步之消息发送
planOperationRecordDataSync(record);
result.setMessage(ReserveEnum.RUN.getText()); result.setMessage(ReserveEnum.RUN.getText());
result.setBatchNo(batchNo); result.setBatchNo(batchNo);
equipmentHandlerService.executeDynamicPlan(batchNo, deviceData, equipment, equipmentSpecific, toke, operationRecord.getId()); equipmentHandlerService.executeDynamicPlan(batchNo, deviceData, equipment, equipmentSpecific, toke, operationRecord.getId());
// String topic = String.format("/%s/%s/%s", serviceName, stationName, "plan");
// Map<String, Object> map = new HashMap<>();
// JSONObject msgContext = new JSONObject();
// msgContext.put("content", "startPlan");
// map.put("contingency", new ContingencyRo());
//// map.put("msgContext", "{\"content\":\"startPlan\"}");
// map.put("msgContext", msgContext);
// map.put("msgType", "refreshRecord");
// webMqttComponent.publish(topic, JSON.toJSONString(map));
} }
return result; return result;
} }
private void planOperationRecordDataSync(PlanOperationRecord operationRecord) {
if (dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("id", operationRecord.getId());
List<PlanOperationRecordSyncBo> planOperationRecordSyncBoList = planOperationRecordMapper.getPlanOperationRecordSyncBoList(map);
dataSyncService.syncCreatedPlanOperationRecordSyncBo(planOperationRecordSyncBoList);
});
} catch (Exception e) {
logger.info("数据同步之消息发送. [method='{}']", "planStart==>syncCreatedPlanOperationRecordSyncBo", e);
}
}
}
@Override @Override
public Map<String, Object> firstGetRecord(String batchNo) { public Map<String, Object> firstGetRecord(String batchNo) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
...@@ -480,8 +447,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -480,8 +447,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
PlanDetail planEntity = new PlanDetail(); PlanDetail planEntity = new PlanDetail();
BeanUtils.copyProperties(planDetail, planEntity); BeanUtils.copyProperties(planDetail, planEntity);
PlanDetail detail = planDetailDao.save(planEntity); PlanDetail detail = planDetailDao.save(planEntity);
// 异步数据同步之消息发送
planDetailDataSync(detail);
long planId = detail.getId(); long planId = detail.getId();
planDetail.setId(planId); planDetail.setId(planId);
planDoc.setPlanId(planId); planDoc.setPlanId(planId);
...@@ -534,9 +499,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -534,9 +499,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
planEntity.setOrgCode(oldPlan.getOrgCode()); planEntity.setOrgCode(oldPlan.getOrgCode());
planEntity.setCreator(oldPlan.getCreator()); planEntity.setCreator(oldPlan.getCreator());
PlanDetail detail = planDetailDao.saveAndFlush(planEntity); PlanDetail detail = planDetailDao.saveAndFlush(planEntity);
// 异步数据同步之消息发送
planDetailDataSync(detail);
planDoc.setPlanId(planId); planDoc.setPlanId(planId);
planDoc.setIsDelete(false); planDoc.setIsDelete(false);
planDocDao.deleteByPlanId(planId); planDocDao.deleteByPlanId(planId);
...@@ -597,8 +559,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -597,8 +559,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
plan.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode()); plan.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
}); });
int update = planDetailMapper.updatePlanStatusByIdList(idList, ContingencyPlanStatusEnum.AVAILABLE.getCode()); int update = planDetailMapper.updatePlanStatusByIdList(idList, ContingencyPlanStatusEnum.AVAILABLE.getCode());
// 异步数据同步之消息发送
planDetailDataSync(idList, update);
} }
return planDetailList; return planDetailList;
} }
...@@ -615,42 +575,10 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -615,42 +575,10 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
plan.setStatus(ContingencyPlanStatusEnum.NOAVAILABLE.getCode()); plan.setStatus(ContingencyPlanStatusEnum.NOAVAILABLE.getCode());
}); });
int update = planDetailMapper.updatePlanStatusByIdList(idList, ContingencyPlanStatusEnum.NOAVAILABLE.getCode()); int update = planDetailMapper.updatePlanStatusByIdList(idList, ContingencyPlanStatusEnum.NOAVAILABLE.getCode());
// 异步数据同步之消息发送
planDetailDataSync(idList, update);
} }
return planDetailList; return planDetailList;
} }
private void planDetailDataSync(PlanDetail planDetail) {
// 异步数据同步之消息发送
if (dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("id", planDetail.getId());
List<PlanDetailSyncBo> planDetailSyncBoList = planDetailMapper.getPlanDetailSyncBoList(map);
dataSyncService.syncCreatedPlanDetailSyncBo(planDetailSyncBoList);
});
} catch (Exception e) {
logger.info("数据同步之消息发送. [method='{}']", "planDetailDataSync==>syncCreatedPlanDetailSyncBo", e);
}
}
}
private void planDetailDataSync(List<Long> idList, int update) {
if (update > 0 && dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("idList", idList);
List<PlanDetailSyncBo> planDetailSyncBoList = planDetailMapper.getPlanDetailSyncBoList(map);
dataSyncService.syncCreatedPlanDetailSyncBo(planDetailSyncBoList);
});
} catch (Exception e) {
logger.info("数据同步之消息发送. [method='{}']", "planDetailDataSync==>syncCreatedPlanDetailSyncBo", e);
}
}
}
@Override @Override
public Boolean delete(List<Long> idList) { public Boolean delete(List<Long> idList) {
...@@ -658,8 +586,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -658,8 +586,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
planDocMapper.updateIsDeleteByPlanIdList(idList, true); planDocMapper.updateIsDeleteByPlanIdList(idList, true);
planEquipmentMapper.updateIsDeleteByPlanIdList(idList, true); planEquipmentMapper.updateIsDeleteByPlanIdList(idList, true);
planRuleMapper.updateIsDeleteByPlanIdList(idList, true); planRuleMapper.updateIsDeleteByPlanIdList(idList, true);
// 异步数据同步之消息发送
planDetailDataSync(idList, update);
return true; return true;
} }
...@@ -840,24 +766,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -840,24 +766,6 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
}); });
} }
// 异步数据同步之消息发送
if (!planList.isEmpty() && dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("status", "2");
List<PlanDetailSyncBo> planDetailSyncBoList = planDetailMapper.getPlanDetailSyncBoList(map);
dataSyncService.syncCreatedPlanDetailSyncBo(planDetailSyncBoList);
Map<String, Object> mapRecord = new HashMap<>();
mapRecord.put("status", "1");
List<PlanOperationRecordSyncBo> planOperationRecordSyncBoList = planOperationRecordMapper.getPlanOperationRecordSyncBoList(mapRecord);
dataSyncService.syncCreatedPlanOperationRecordSyncBo(planOperationRecordSyncBoList);
});
} catch (Exception e) {
logger.info("数据同步之消息发送. [method='{}']", "activatePlan==>syncCreatedPlanDetailSyncBo==>syncCreatedPlanOperationRecordSyncBo", e);
}
}
} catch (Exception e) { } catch (Exception e) {
bool.set(false); bool.set(false);
e.printStackTrace(); e.printStackTrace();
......
...@@ -151,9 +151,6 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -151,9 +151,6 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Autowired @Autowired
IContingencyPlanService iContingencyPlanService; IContingencyPlanService iContingencyPlanService;
@Value("${systemctl.sync.switch}")
private Boolean dataSyncSwitch;
@Autowired @Autowired
private IDataSyncService dataSyncService; private IDataSyncService dataSyncService;
...@@ -557,72 +554,14 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -557,72 +554,14 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
contingencyRo.setIsMock(isMock); contingencyRo.setIsMock(isMock);
contingencyRo.setPosition(equipmentSpecific.getPosition()); contingencyRo.setPosition(equipmentSpecific.getPosition());
//查询重点设备关联视频点位
// Map<String, Object> cameraInfo = impAndFireEquipMapper.queryCamera(String.valueOf(equipment.getId()));
// if (cameraInfo != null && !cameraInfo.isEmpty()) {
// contingencyRo.setCameraCodes(String.valueOf(cameraInfo.get("codes")));
// contingencyRo.setCameraIds(String.valueOf(cameraInfo.get("ids")));
// }
//查询重点设备关联消防炮
// Map fireMonitorInfo = equipmentSpecificMapper.queryFireMonitor(String.valueOf(equipment.getId()), fireMonitor);
// if (fireMonitorInfo != null && !fireMonitorInfo.isEmpty()) {
// contingencyRo.setFireMonitorCodes(String.valueOf(fireMonitorInfo.get("codes")));
// contingencyRo.setFireMonitorIds(String.valueOf(fireMonitorInfo.get("ids")));
// }
// List<PreplanPicture> pictures = iPreplanPictureDao.findByEquipmentId(Long.valueOf(equipment.getId()));
// if (!CollectionUtils.isEmpty(pictures)) {
// for (PreplanPicture picture : pictures) {
// if (1 == picture.getType()) {
// contingencyRo.setPicture1(picture.getPicture());
// }
// if (2 == picture.getType()) {
// contingencyRo.setPicture2(picture.getPicture());
// }
// if (3 == picture.getType()) {
// contingencyRo.setPicture3(picture.getPicture());
// }
// if (4 == picture.getType()) {
// contingencyRo.setPicture4(picture.getPicture());
// }
// }
// }
// 获取遥信指标,暂不处理 code = 设备编码iot_code-指标项name_key
// List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH");//物联属性指标 and 为true或false
// Map<String, Integer> telesignallingMap = new HashMap<>();
// for (Map map : points) {
// telesignallingMap.put(map.get("code") + "", (ObjectUtils.isEmpty(map.get("value")) || "false".equals(map.get("value").toString())) ? 0 : 1);
// }
// contingencyRo.setTelesignallingMap(telesignallingMap);
// // 获取遥测指标
// points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "ANALOGUE"); //物联指标 非 true false
// Map<String, Double> telemetryMap = new HashMap<>();
// for (Map map : points) {
// telemetryMap.put(map.get("code") + "", Double.valueOf(ObjectUtils.isEmpty(map.get("value")) ? "0" : map.get("value").toString()));
// }
// contingencyRo.setTelemetryMap(telemetryMap);
log.info("开始调用规则 参数 contingencyRo{},reservePlan{},equipmentNames" + contingencyRo.toString() + "," + equipment.getReservePlan() + "," + ArrayUtils.toArray(equipment.getName())); log.info("开始调用规则 参数 contingencyRo{},reservePlan{},equipmentNames" + contingencyRo.toString() + "," + equipment.getReservePlan() + "," + ArrayUtils.toArray(equipment.getName()));
Object result = ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName())); Object result = ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName()));
log.info("规则调用返回==", result); log.info("规则调用返回==", result);
ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData(); ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData();
BeanUtils.copyProperties(contingencyRo, contingencyOriginalData); BeanUtils.copyProperties(contingencyRo, contingencyOriginalData);
ContingencyOriginalData originalData = iContingencyOriginalDataDao.save(contingencyOriginalData); contingencyOriginalData.setFireEquipmentPosition(contingencyRo.getPosition());
// 异步数据同步之消息发送 iContingencyOriginalDataDao.save(contingencyOriginalData);
if (dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("id", originalData.getId());
List<ContingencyOriginalDataSyncBo> contingencyOriginalDataBoList = contingencyOriginalMapper.getContingencyOriginalDataBoList(map);
dataSyncService.syncCreatedContingencyOriginalDataSyncBo(contingencyOriginalDataBoList);
});
} catch (Exception e) {
log.info("数据同步之消息发送. [method='{}']", "alarmContingency==>syncCreatedContingencyOriginalDataSyncBo", e);
}
}
} }
} }
...@@ -137,9 +137,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -137,9 +137,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
IContingencyOriginalDataDao iContingencyOriginalDataDao; IContingencyOriginalDataDao iContingencyOriginalDataDao;
@Value("${systemctl.sync.switch}")
private Boolean dataSyncSwitch;
@Autowired @Autowired
private IDataSyncService dataSyncService; private IDataSyncService dataSyncService;
...@@ -613,19 +610,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -613,19 +610,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData(); ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData();
BeanUtils.copyProperties(contingencyRo, contingencyOriginalData); BeanUtils.copyProperties(contingencyRo, contingencyOriginalData);
ContingencyOriginalData originalData = iContingencyOriginalDataDao.save(contingencyOriginalData); ContingencyOriginalData originalData = iContingencyOriginalDataDao.save(contingencyOriginalData);
// 异步数据同步之消息发送
if ( dataSyncSwitch) {
try {
dataSyncService.asyncInvoke(() -> {
Map<String, Object> map = new HashMap<>();
map.put("id", originalData.getId());
List<ContingencyOriginalDataSyncBo> contingencyOriginalDataBoList = contingencyOriginalMapper.getContingencyOriginalDataBoList(map);
dataSyncService.syncCreatedContingencyOriginalDataSyncBo(contingencyOriginalDataBoList);
});
} catch (Exception e) {
log.info("数据同步之消息发送. [method='{}']", "alermContingency==>syncCreatedContingencyOriginalDataSyncBo", e);
}
}
} }
} }
......
...@@ -843,4 +843,33 @@ ...@@ -843,4 +843,33 @@
ADD INDEX `INDEX_BATCH_NO`(`batch_No`) USING BTREE; ADD INDEX `INDEX_BATCH_NO`(`batch_No`) USING BTREE;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="maoy" id="1682216014-001">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="contingency_original_data" columnName="fire_equipment_code"/>
</not>
</preConditions>
<comment>contingency_original_data add column fire_equipment_code</comment>
<sql>
ALTER TABLE `contingency_original_data`
ADD COLUMN `fire_equipment_code` varchar(255) NULL DEFAULT '' COMMENT '消防设备编码';
</sql>
</changeSet>
<changeSet author="maoy" id="1682216014-002">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="contingency_original_data" columnName="equipment_code"/>
</not>
</preConditions>
<comment>contingency_original_data add column equipment_code</comment>
<sql>
ALTER TABLE `contingency_original_data`
ADD COLUMN `equipment_code` varchar(255) NULL DEFAULT '' COMMENT '电力设备编码';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ 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