Commit f8b583d3 authored by KeYong's avatar KeYong

预案修改

parent e16b6900
......@@ -35,4 +35,16 @@ public class EquipmentFireEquipmentController {
return equipmentFireEquipmentService.automaticExecute(equipmentId, equipCode, equipSpeCode, type, indexKeys, value);
}
@ApiOperation(value = "判断节点是否自动执行", notes = "判断节点是否自动执行")
@GetMapping("/automaticExecutePoint")
public Object automaticExecutePoint(@RequestParam(required = false) String equipmentId,
@RequestParam(required = false) String equipCode,
@RequestParam(required = false) String equipSpeCode,
@RequestParam(required = false) String type,
@RequestParam(required = false) String indexKeys,
@RequestParam(required = false) String value,
@RequestParam(required = false) String index) {
return equipmentFireEquipmentService.automaticExecutePoint(equipmentId, equipCode, equipSpeCode, type, indexKeys, value, index);
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService;
import com.yeejoin.amos.fas.business.vo.PlanStepJsonVO;
import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -43,6 +50,9 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
@Autowired
private IEquipmentFireEquipmentDao equipmentFireEquipmentDao;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
@Override
public List<EquipmentFireEquipment> findByEquipmentId(Long equipmentId) {
return equipmentFireEquipmentDao.findAllByEquipmentId(equipmentId);
......@@ -119,4 +129,81 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
}
return false;
}
@Override
public Object automaticExecutePoint(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value, String index) {
String json;
try {
json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取预案节点信息失败!");
}
List<PlanStepJsonVO> result = JSONObject.parseArray(json, PlanStepJsonVO.class);
if (!CollectionUtils.isEmpty(result)) {
}
Map<String, Object> map = null;
if(StringUtils.isBlank(equipCode)){
return false;
}
if (StringUtils.isBlank(type)) {
type = TYPE;
}
if (StringUtils.isBlank(value)) {
value = VALUE;
}
if (StringUtils.isNotBlank(equipmentId)) {
// 1. 查询重点设备绑定的消防设备
List<EquipmentFireEquipment> list = null;
if (StringUtils.isBlank(equipSpeCode)) {
if (StringUtils.isBlank(equipCode)) {
list = equipmentFireEquipmentService.findByEquipmentId(Long.parseLong(equipmentId));
} else {
list = equipmentFireEquipmentService.findByEquipIdAndEquipCodeIn(Long.parseLong(equipmentId), equipCode.split(","));
}
} else {
list = equipmentFireEquipmentService.findByEquipIdAndEquipSpeCodeIn(Long.parseLong(equipmentId), equipSpeCode.split(","));
}
if (!CollectionUtils.isEmpty(list)) {
List<Long> equipSpecificIdList = list.stream().map(EquipmentFireEquipment::getFireEquipmentId).collect(Collectors.toList());
// 2 获取消防设备满足条件的集合
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(equipSpecificIdList, null, null, indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(equipSpecificIdList, null, null, null, value);
}
}
} else {
// 不存在重点设备,直接查消防设备
if (StringUtils.isNotBlank(equipSpeCode)) {
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, null, equipSpeCode.split(","), indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, null, equipSpeCode.split(","), null, value);
}
} else if (StringUtils.isNotBlank(equipCode)) {
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, equipCode.split(","), null, indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, equipCode.split(","), null, null, value);
}
}
}
if (!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.get("total").toString());
Integer count = Integer.parseInt(map.get("count").toString());
if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) {
return total.equals(count);
} else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) {
return count != 0;
}
}
return false;
}
}
......@@ -21,4 +21,6 @@ public interface IEquipmentFireEquipmentService {
List<EquipmentFireEquipment> findByEquipIdAndEquipSpeCodeIn(Long equipmentId, String[] equipSpeCodes);
Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value);
Object automaticExecutePoint(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value, String index);
}
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
import java.util.List;
@Data
public class PlanStepJsonVO {
private String stepCode;
......@@ -25,4 +27,24 @@ public class PlanStepJsonVO {
* 进度索引
*/
private int index;
/**
* 节点物联动作判断条件
*/
private List condition;
/**
* 节点物联设备指标之间关系
*/
private String inAndOr;
/**
* 节点物联设备之间关系
*/
private String outAndOr;
/**
* 1自动,0非自动
*/
private Integer isAuto;
}
......@@ -19,7 +19,7 @@ amos.system.user.product=STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone=http://172.16.11.201:10001/eureka/
eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true
eureka.client.healthcheck.enabled = false
eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
......
......@@ -6,29 +6,42 @@
"buttonCode": "FIRE_CONFIRM",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 0
"index": 0,
"condition": [
{
"equipName": "ONL-直流电源",
"equipCode": "92100300MNL44",
"equipSpeName": "ONL-直流电源",
"equipSpeCode": "SBMC0001",
"equipSpeIndexKey": "ONL_DCPower_Fault",
"standardValue": "true",
"inAndOr": "and"
}
],
"outAndOr": "and",
"isAuto": 0
},
{
"stepCode": "1",
"stepName": "停运换流阀",
"stepStatus": "0",
"buttonCode": "STOP_COMMUTATION",
"stepCode": "2",
"stepName": "拨打报警电话",
"stepStatus": "1",
"buttonCode": "CALL_PHONE",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 1
},
{
"stepCode": "2",
"stepName": "拨打报警电话",
"stepCode": "1",
"stepName": "停运换流阀",
"stepStatus": "0",
"buttonCode": "CALL_PHONE",
"buttonCode": "STOP_COMMUTATION",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 2
},
{
"stepCode": "3",
"stepName": "确认油枕排油系统已开启",
"stepName": "确认排油系统已开启",
"stepStatus": "0",
"buttonCode": "DRAIN_OIL_CONFIRM",
"isParallel": "0",
......@@ -37,93 +50,66 @@
},
{
"stepCode": "4",
"stepName": "确认水喷雾系统已开启",
"stepName": "确认泡沫喷淋系统已开启",
"stepStatus": "0",
"buttonCode": "OPEN_WATERSYSTEM",
"isParallel": "0",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_A",
"index": 4
},
{
"stepCode": "5",
"stepName": "断开上级电源",
"stepStatus": "0",
"buttonCode": "OFF_POWER",
"stepCode": "7",
"stepName": "一键开启消防炮",
"stepStatus": "1",
"buttonCode": "MONITOR_START",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 5
},
{
"stepCode": "6",
"stepName": "停运阀厅空调系统",
"stepCode": "5",
"stepName": "断开上级电源",
"stepStatus": "0",
"buttonCode": "STOP_AIRCON",
"buttonCode": "OFF_POWER",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"index": 6
},
{
"stepCode": "7",
"stepName": "一键开启消防炮",
"stepCode": "11",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"buttonCode": "MONITOR_START",
"buttonCode": "PLUG_CABLETRENCH",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_A",
"roleCode": "Digital_Responsing_Plan_B",
"index": 7
},
{
"stepCode": "8",
"stepName": "驻站消防队指挥权交接",
"stepCode": "6",
"stepName": "停运阀厅空调系统",
"stepStatus": "0",
"buttonCode": "HANDOVER_COMMAND",
"buttonCode": "STOP_AIRCON",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B",
"roleCode": "Digital_Responsing_Plan_A",
"index": 8
},
{
"stepCode": "9",
"stepName": "确认本体排油已开启",
"stepCode": "8",
"stepName": "驻站消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "OWNER_DRAIN_OIL",
"buttonCode": "HANDOVER_COMMAND",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 9
},
{
"stepCode": "10",
"stepName": "启动阀厅应急预案",
"stepStatus": "0",
"buttonCode": "START_VALVE_HALL_CONTINGENCY",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 10
},
{
"stepCode": "11",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"buttonCode": "PLUG_CABLETRENCH",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 11
},
{
"stepCode": "12",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_FIGTHHING",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 12
},
{
"stepCode": "13",
"stepName": "确认明火扑灭",
"stepStatus": "0",
"buttonCode": "FIRE_EXTINCT",
"isParallel": "0",
"roleCode": "Digital_Responsing_Plan_B",
"index": 13
"index": 10
},
{
"stepCode": "14",
......@@ -132,6 +118,6 @@
"buttonCode": "END_EMERGENCY",
"isParallel": "1",
"roleCode": "Digital_Responsing_Plan_B",
"index": 14
"index": 11
}
]
\ 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