Commit dc2f8f48 authored by maoying's avatar maoying

预案添加模拟数据标识

parent 6dcf3211
......@@ -417,8 +417,8 @@ public class ContingencyAction implements CustomerAction {
private String instedParams(String content, ContingencyRo contingencyRo) {
Map<String, String> strengthMap = this.getStrengthMap(contingencyRo);
for (String key : strengthMap.keySet())
content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
// for (String key : strengthMap.keySet())
// content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
Field[] fields = contingencyRo.getClass().getDeclaredFields();
Method getMethod = null;
......
......@@ -98,4 +98,8 @@ public class ContingencyRo implements Serializable {
@Label("参数map")
private Map<String, Object> params = new HashMap<>();
@Label("是否模拟数据")
private Boolean isMock;
}
......@@ -181,7 +181,7 @@ public class PlanVisual3dController extends BaseController {
@GetMapping(value = "/plan/getPlaneRecord")
public ResponseModel getPlaneRecord(@RequestParam("batchNo") String batchNo) {
if (!StringUtil.isNotEmpty(batchNo)) {
batchNo = planVisual3dService.getNewestBatchNo();
batchNo = planVisual3dService.getLastBatchNo();
}
if (!StringUtil.isNotEmpty(batchNo)) {
return CommonResponseUtil.successNew(null);
......
......@@ -35,6 +35,12 @@ public interface PlanOperationRecordMapper {
* @return
*/
String getNewestBatchNo();
/**
* 获取batchNo
* @return
*/
String getLastBatchNo();
PlanRule getPlanRuleByBatchNo(String batchNo);
}
......@@ -22,7 +22,7 @@ public class AlarmParam extends BasicsRo{
/**
* 是否模拟数据
*/
private Boolean isMock = false;
private Boolean isMock;
/**
* 数据库原状态
......
......@@ -194,6 +194,7 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
deviceData.setMonitor(equipment.getName());
deviceData.setId(String.valueOf(equipmentSpecific.getId()));
deviceData.setCode(equipmentSpecific.getCode());
deviceData.setIsMock((vo.getStatus()==4 || "4".equals(vo.getStatus()))?true:false);
String batchNo = equipmentHandlerService.executeDynamicPlan(deviceData, equipment, equipmentSpecific, toke, operationRecord.getId());
//更新模型状态
PlanDetail planDetail = PlanDetailOp.get();
......
......@@ -61,6 +61,10 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
@Override
public Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value) {
Map<String, Object> map = null;
if(StringUtils.isBlank(equipCode)){
return false;
}
if (StringUtils.isBlank(type)) {
type = TYPE;
}
......
......@@ -525,14 +525,14 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
try {
alarmContingency(batchNo, equipmentSpecific, equipment, recordId);
alarmContingency(batchNo, equipmentSpecific, equipment, recordId, deviceData.getIsMock());
} catch (Exception e) {
e.printStackTrace();
}
return batchNo;
}
public void alarmContingency(String batchNo, EquipmentSpecificForRiskVo equipmentSpecific, Equipment equipment, Long recordId) throws Exception {
public void alarmContingency(String batchNo, EquipmentSpecificForRiskVo equipmentSpecific, Equipment equipment, Long recordId, Boolean isMock) throws Exception {
ContingencyRo contingencyRo = new ContingencyRo();
contingencyRo.setBatchNo(batchNo);
contingencyRo.setEquipmentId(String.valueOf(equipment.getId()));
......@@ -548,6 +548,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
contingencyRo.setEquipmentCode(equipment.getCode());
contingencyRo.setEquipmentOrgCode(equipment.getOrgCode());
contingencyRo.getParams().put("equipmentId", equipment.getId());
contingencyRo.setIsMock(isMock);
//查询重点设备关联视频点位
Map<String, Object> cameraInfo = impAndFireEquipMapper.queryCamera(String.valueOf(equipment.getId()));
if (cameraInfo != null && !cameraInfo.isEmpty()) {
......
......@@ -520,4 +520,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
return contingencyInstanceInfoMapper.selectDisposalActionList(type, status, roles, disposalId);
}
@Override
public String getLastBatchNo() {
return planOperationRecordMapper.getLastBatchNo();
}
}
......@@ -55,10 +55,17 @@ public interface IPlanVisual3dService {
void deleteTextPlanFile(Long id);
/**
* 查最新的批次号
* 查最新在执行的批次号
* @return
*/
String getNewestBatchNo();
/**
* 查最新的批次号
* @return
*/
String getLastBatchNo();
/**
* 根据批次号获取预案步骤
......
......@@ -81,7 +81,7 @@ rocketmq.producer.groupName2=groupName2
rocketmq.producer.namesrvAddr2=172.16.3.135:9876
rocket-plan-topic =topic_fire_emergency_plan
rocket-equip-alarm-topic =topic_fire_equip_alarm
rocket-equip-alarm-topic =topic_fire_equip_alarm
#规则ip配置,用于多网卡及docker镜像启动时添加
#rule.definition.local-ip=172.16.11.201
......
......@@ -128,4 +128,8 @@
<select id="getNewestBatchNo" resultType="java.lang.String">
select batch_no as batchNo from c_plan_operation_record where status = 0 and is_delete = 0 order by create_date desc limit 1
</select>
<select id="getLastBatchNo" resultType="java.lang.String">
select batch_no as batchNo from c_plan_operation_record where is_delete = 0 order by create_date desc limit 1
</select>
</mapper>
\ 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