Commit f5afd28e authored by maoying's avatar maoying

merge代码

parent 40051baa
...@@ -44,7 +44,6 @@ import com.yeejoin.amos.fas.business.action.result.ActionResult; ...@@ -44,7 +44,6 @@ import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult; import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult;
import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage; import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage;
import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher; import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import com.yeejoin.amos.fas.business.action.util.StepComparator;
import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer; import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
...@@ -238,36 +237,36 @@ public class ContingencyAction implements CustomerAction { ...@@ -238,36 +237,36 @@ public class ContingencyAction implements CustomerAction {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); // Map<String, Object> tempmap1 = new HashMap<>();
SetpEnum[] stepArr = SetpEnum.values(); // SetpEnum[] stepArr = SetpEnum.values();
ArrayList list = new ArrayList(); // ArrayList list = new ArrayList();
HashMap preStep = new HashMap(); // HashMap preStep = new HashMap();
StepComparator comparator = new StepComparator(); // StepComparator comparator = new StepComparator();
Arrays.sort(stepArr, comparator); // Arrays.sort(stepArr, comparator);
//
boolean flage = false; // boolean flage = false;
SetpEnum pstep = null; // SetpEnum pstep = null;
for (SetpEnum step : stepArr) { // for (SetpEnum step : stepArr) {
if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) { // if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) {
if (!ObjectUtils.isEmpty(pstep)) { // if (!ObjectUtils.isEmpty(pstep)) {
preStep.put("stepCode", pstep.getValue()); // preStep.put("stepCode", pstep.getValue());
preStep.put("stepName", pstep.getTitle()); // preStep.put("stepName", pstep.getTitle());
} // }
flage = true; // flage = true;
} // }
if (flage) { // if (flage) {
HashMap map = new HashMap(); // HashMap map = new HashMap();
map.put("stepCode", step.getValue()); // map.put("stepCode", step.getValue());
map.put("stepName", step.getTitle()); // map.put("stepName", step.getTitle());
list.add(map); // list.add(map);
} // }
pstep = step; // pstep = step;
} // }
//
tempmap1.put("step", list); // tempmap1.put("step", list);
tempmap1.put("preStep", preStep); // tempmap1.put("preStep", preStep);
result.add(tempmap1); // result.add(tempmap1);
log.info("巡检消息发送规则" + JSONObject.toJSONString(result)); // log.info("巡检消息发送规则" + JSONObject.toJSONString(result));
this.sendcmd("steparea", contingencyRo, result); this.sendcmd("steparea", contingencyRo, result);
} }
......
...@@ -10,13 +10,16 @@ import org.springframework.data.domain.Page; ...@@ -10,13 +10,16 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.yeejoin.amos.fas.business.bo.FireEquipmentBo;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper; import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper; import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IFireEquipService; import com.yeejoin.amos.fas.business.service.intfc.IFireEquipService;
import com.yeejoin.amos.fas.business.util.FireEquipmentType;
import com.yeejoin.amos.fas.common.enums.EquipClassifyEnum;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.CommonPage; import com.yeejoin.amos.fas.core.common.response.CommonPage;
import com.yeejoin.amos.fas.dao.entity.FireEquipment;
@Service("fireEquipService") @Service("fireEquipService")
public class FireEquipServiceImpl implements IFireEquipService { public class FireEquipServiceImpl implements IFireEquipService {
...@@ -32,44 +35,44 @@ public class FireEquipServiceImpl implements IFireEquipService { ...@@ -32,44 +35,44 @@ public class FireEquipServiceImpl implements IFireEquipService {
@Autowired @Autowired
ImpEquipMapper impEquipMapper; ImpEquipMapper impEquipMapper;
@Autowired // @Autowired
IWaterResourceDao iWaterResourceDao; // IWaterResourceDao iWaterResourceDao;
//
@Autowired // @Autowired
IFireStationDao iFireStationDao; // IFireStationDao iFireStationDao;
@Autowired @Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
public FireEquipment save(FireEquipment fireEquipment) { // public FireEquipment save(FireEquipment fireEquipment) {
Long id = fireEquipment.getId(); // Long id = fireEquipment.getId();
iFireEquipmentDao.save(fireEquipment); // iFireEquipmentDao.save(fireEquipment);
return fireEquipment; // return fireEquipment;
} // }
//
//
public FireEquipment queryOne(Long id) { // public FireEquipment queryOne(Long id) {
Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(id); // Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(id);
if (fireEquipment1.isPresent()) { // if (fireEquipment1.isPresent()) {
return fireEquipment1.get(); // return fireEquipment1.get();
} // }
return null; // return null;
} // }
public String[] delete(String[] idArray) throws Exception { public String[] delete(String[] idArray) throws Exception {
for (String id : idArray) { // for (String id : idArray) {
Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(Long.parseLong(id)); // Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(Long.parseLong(id));
FireEquipment fireEquipment = null; // FireEquipment fireEquipment = null;
if (fireEquipment1.isPresent()) { // if (fireEquipment1.isPresent()) {
fireEquipment = fireEquipment1.get(); // fireEquipment = fireEquipment1.get();
} // }
//
if (fireEquipment != null) { // if (fireEquipment != null) {
this.iFireEquipmentDao.deleteById(Long.parseLong(id)); // this.iFireEquipmentDao.deleteById(Long.parseLong(id));
} else { // } else {
throw new Exception("找不到指定的对象:" + id); // throw new Exception("找不到指定的对象:" + id);
} // }
} // }
return idArray; return idArray;
} }
......
...@@ -6,11 +6,7 @@ import com.google.common.collect.Lists; ...@@ -6,11 +6,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo; import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
<<<<<<< HEAD
import com.yeejoin.amos.fas.business.action.model.SetpEnum;
=======
import com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo; import com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo;
>>>>>>> CSFAS_V2.1.3.3
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent; import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe; import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.dao.mapper.*; import com.yeejoin.amos.fas.business.dao.mapper.*;
...@@ -31,10 +27,8 @@ import com.yeejoin.amos.fas.business.vo.Toke; ...@@ -31,10 +27,8 @@ import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.business.vo.TopicEntityVo; import com.yeejoin.amos.fas.business.vo.TopicEntityVo;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue; import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum; import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
<<<<<<< HEAD
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum; import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
======= import com.yeejoin.amos.fas.core.util.StringUtil;
>>>>>>> CSFAS_V2.1.3.3
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -48,11 +42,7 @@ import org.springframework.stereotype.Service; ...@@ -48,11 +42,7 @@ import org.springframework.stereotype.Service;
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;
<<<<<<< HEAD
=======
import java.math.BigDecimal; import java.math.BigDecimal;
>>>>>>> CSFAS_V2.1.3.3
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -124,20 +114,21 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -124,20 +114,21 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Autowired @Autowired
private IEvaluationModelDao iEvaluationModelDao; private IEvaluationModelDao iEvaluationModelDao;
@Autowired
private FmeaMapper fmeaMapper;
@Value("${station.name}") @Value("${station.name}")
private String stationName; private String stationName;
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
<<<<<<< HEAD
@Autowired @Autowired
private IPlanOperationRecordDao planOperationRecordDao; private IPlanOperationRecordDao planOperationRecordDao;
=======
@Value("${autoSys.alarm.nameKeys}") @Value("${autoSys.alarm.nameKeys}")
private String nameKeys; private String nameKeys;
>>>>>>> CSFAS_V2.1.3.3
@Override @Override
public void handlerMqttMessage(String topic, String data) { public void handlerMqttMessage(String topic, String data) {
...@@ -165,10 +156,15 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -165,10 +156,15 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
deviceData.setMonitor(equipment != null ? equipment.getName() : ""); deviceData.setMonitor(equipment != null ? equipment.getName() : "");
deviceData.setId(String.valueOf(equipmentSpecific.getId())); deviceData.setId(String.valueOf(equipmentSpecific.getId()));
deviceData.setCode(equipmentSpecific.getCode()); deviceData.setCode(equipmentSpecific.getCode());
<<<<<<< HEAD
//设备告警处理逻辑 //设备告警处理逻辑
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(equipmentSpecificIndex.getType())) { if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(equipmentSpecificIndex.getType())) {
log.info("(报警)Message type is: " + equipmentSpecificIndex.getType()); log.info("(报警)Message type is: " + equipmentSpecificIndex.getType());
/**
* 推送告警数据
* 影响区域:消防安全=>火灾告警
*/
String title = String.format("/%s/%s/%s/%s", serviceName, stationName,"data/refresh","fireSafety");
webMqttComponent.publish(title, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("fire", equipmentSpecific.getOrgCode())));
// 报警触发调用规则服务 // 报警触发调用规则服务
//注释自动触发预案 //注释自动触发预案
//executeDynamicPlan(deviceData, equipment, equipmentSpecific, toke,topicEntity.getRecordId()); //executeDynamicPlan(deviceData, equipment, equipmentSpecific, toke,topicEntity.getRecordId());
...@@ -185,39 +181,11 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -185,39 +181,11 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
//故障恢复 //故障恢复
notifyAlarm(equipmentSpecificIndex, 0); notifyAlarm(equipmentSpecificIndex, 0);
} }
//三维页面消息推送
fireEquipRuleMessagePush(deviceData, toke);
} else {
// 监测数据逻辑
log.info("(监测)Message type is: " + equipmentSpecificIndex.getType());
=======
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(specificIndexType)) { //设备告警处理逻辑
log.info("(报警)Message type is: " + specificIndexType);
//通知刷新3d页面告警数据
// iDataRefreshService.refreshViewData(DataRefreshTypeEum.alarm.getCode());
/**
* 推送告警数据
* 影响区域:消防安全=>火灾告警
*/
String title = String.format("/%s/%s/%s/%s", serviceName, stationName,"data/refresh","fireSafety");
webMqttComponent.publish(title, JSON.toJSONString(view3dService.getSafetyExecuteListTop5("fire", equipmentSpecific.getOrgCode())));
// 报警触发调用规则服务
if(!ObjectUtils.isEmpty(equipment) && !ObjectUtils.isEmpty(equipment.getReservePlan())){
executeDynamicPlan(deviceData, equipment, equipmentSpecific, toke);
}
} else if (EquipmentRiskTypeEnum.GZ.getCode().equals(specificIndexType)) { // 设备故障处理逻辑
log.info("(故障)Message type is: " + specificIndexType);
long equipId = 0; long equipId = 0;
if(StringUtil.isNotEmpty(equipment)) { if(StringUtil.isNotEmpty(equipment)) {
equipId = equipment.getId(); equipId = equipment.getId();
}
long specificIndexId = equipmentSpecificIndex.getId();
notifyAlarm(equipmentSpecificIndex, 1);
// 是否关联风险点 // 是否关联风险点
List<FmeaEquipmentPoint> list = fmeaEquipmentPointMapper.listFmeaByEquipIndexIdAndEquipId(specificIndexId, equipId); List<FmeaEquipmentPoint> list = fmeaEquipmentPointMapper.listFmeaByEquipIndexIdAndEquipId(equipmentSpecificIndex.getId(), equipId);
if(list.size() > 0) { if(list.size() > 0) {
// 关联风险点进行rpn,rpni值的修改 // 关联风险点进行rpn,rpni值的修改
list.forEach(fmeaEqPoint -> { list.forEach(fmeaEqPoint -> {
...@@ -228,12 +196,11 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -228,12 +196,11 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
// 没有关联风险点,三维页面消息推送 // 没有关联风险点,三维页面消息推送
fireEquipRuleMessagePush(deviceData, toke); fireEquipRuleMessagePush(deviceData, toke);
} }
}
} else { // 向三维推送实时值修改 } else {
log.info("(监测)Message type is: " + specificIndexType); // 监测数据逻辑
// 是否关联风险点 log.info("(监测)Message type is: " + equipmentSpecificIndex.getType());
notifyAlarm(equipmentSpecificIndex, 0);
>>>>>>> CSFAS_V2.1.3.3
Map<String, Object> content = new HashMap<>(); Map<String, Object> content = new HashMap<>();
content.put("id", equipmentSpecific.getId()); content.put("id", equipmentSpecific.getId());
content.put("label", equipmentSpecific.getName()+" "+equipmentSpecificIndex.getEquipmentIndexName()); content.put("label", equipmentSpecific.getName()+" "+equipmentSpecificIndex.getEquipmentIndexName());
...@@ -242,12 +209,53 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -242,12 +209,53 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
content.put("orgCode", equipmentSpecific.getOrgCode()); content.put("orgCode", equipmentSpecific.getOrgCode());
content.put("indexKey", equipmentSpecificIndex.getNameKey()); content.put("indexKey", equipmentSpecificIndex.getNameKey());
content.put("status", equipmentSpecificIndex.getValue()); content.put("status", equipmentSpecificIndex.getValue());
// iDataRefreshService.sendRefreshDataWithArea(View3dRefreshAreaEum.monitor_data.getCode(), content);
String title = String.format("/%s/%s/%s", serviceName, stationName,"data/refresh/monitorData"); String title = String.format("/%s/%s/%s", serviceName, stationName,"data/refresh/monitorData");
webMqttComponent.publish(title, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode()))); webMqttComponent.publish(title, JSON.toJSONString(view3dService.getEquipStatusList(equipmentSpecific.getOrgCode())));
} }
} }
/**
* <pre>
* @Description: rpn,rpni值修改
* </pre>
*
* @MethodName:
* @Param: [fmeaId]
* @Return: void
* @Throws
* @Author keyong
* @Date 2020/11/16 18:26
*/
public void updateFmeaRpn(long fmeaId) {
Fmea fmea = fmeaMapper.getById(fmeaId);
BigDecimal oidValue = new BigDecimal(fmea.getOidValue());
BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue());
// 计算rpni
BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rpn;
if (fmea.getNewEvaluationOid() == null) {
EvaluationModel evaluationModel = this.getEvaluationModel(fmeaId);
if (evaluationModel != null) { // 已经绑定点位或者巡检点项且匹配到风险模型,则更新为计算后的结果
BigDecimal newOidValue = new BigDecimal(evaluationModel.getCoefficient());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
fmea.setNewEvaluationOid(evaluationModel.getId());
} else { // 未绑定点位或者巡检点项或者匹配不到风险模型,则更新为rpn与rpni一致
fmea.setNewEvaluationOid(fmea.getEvaluationOid());
rpn = rpni;
}
} else {
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue());
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
}
fmea.setRpni(rpni);
fmea.setRpn(rpn);
// 更新fmea
fmeaMapper.updateRpn(fmea);
}
@Override @Override
public void subscribeTopic() { public void subscribeTopic() {
// 若登录系统则订阅装备数据 // 若登录系统则订阅装备数据
......
...@@ -112,6 +112,7 @@ import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse; ...@@ -112,6 +112,7 @@ import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse; import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.enums.NumberEnum; import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.enums.ReserveEnum; import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
......
...@@ -34,14 +34,9 @@ ...@@ -34,14 +34,9 @@
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId> <artifactId>amos-component-rule</artifactId>
<<<<<<< HEAD
<version>1.4.4-SNAPSHOT</version> <version>1.4.4-SNAPSHOT</version>
</dependency> </dependency>
=======
<version>1.4.3-SNAPSHOT</version>
</dependency>
>>>>>>> CSFAS_V2.1.3.3
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
......
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