Commit f5afd28e authored by maoying's avatar maoying

merge代码

parent 40051baa
......@@ -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.message.AbstractActionResultMessage;
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.IPlanOperationRecordDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
......@@ -238,36 +237,36 @@ public class ContingencyAction implements CustomerAction {
stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
SetpEnum[] stepArr = SetpEnum.values();
ArrayList list = new ArrayList();
HashMap preStep = new HashMap();
StepComparator comparator = new StepComparator();
Arrays.sort(stepArr, comparator);
boolean flage = false;
SetpEnum pstep = null;
for (SetpEnum step : stepArr) {
if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) {
if (!ObjectUtils.isEmpty(pstep)) {
preStep.put("stepCode", pstep.getValue());
preStep.put("stepName", pstep.getTitle());
}
flage = true;
}
if (flage) {
HashMap map = new HashMap();
map.put("stepCode", step.getValue());
map.put("stepName", step.getTitle());
list.add(map);
}
pstep = step;
}
tempmap1.put("step", list);
tempmap1.put("preStep", preStep);
result.add(tempmap1);
log.info("巡检消息发送规则" + JSONObject.toJSONString(result));
// Map<String, Object> tempmap1 = new HashMap<>();
// SetpEnum[] stepArr = SetpEnum.values();
// ArrayList list = new ArrayList();
// HashMap preStep = new HashMap();
// StepComparator comparator = new StepComparator();
// Arrays.sort(stepArr, comparator);
//
// boolean flage = false;
// SetpEnum pstep = null;
// for (SetpEnum step : stepArr) {
// if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) {
// if (!ObjectUtils.isEmpty(pstep)) {
// preStep.put("stepCode", pstep.getValue());
// preStep.put("stepName", pstep.getTitle());
// }
// flage = true;
// }
// if (flage) {
// HashMap map = new HashMap();
// map.put("stepCode", step.getValue());
// map.put("stepName", step.getTitle());
// list.add(map);
// }
// pstep = step;
// }
//
// tempmap1.put("step", list);
// tempmap1.put("preStep", preStep);
// result.add(tempmap1);
// log.info("巡检消息发送规则" + JSONObject.toJSONString(result));
this.sendcmd("steparea", contingencyRo, result);
}
......
......@@ -10,13 +10,16 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
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.ImpEquipMapper;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
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.response.CommonPage;
import com.yeejoin.amos.fas.dao.entity.FireEquipment;
@Service("fireEquipService")
public class FireEquipServiceImpl implements IFireEquipService {
......@@ -32,44 +35,44 @@ public class FireEquipServiceImpl implements IFireEquipService {
@Autowired
ImpEquipMapper impEquipMapper;
@Autowired
IWaterResourceDao iWaterResourceDao;
@Autowired
IFireStationDao iFireStationDao;
// @Autowired
// IWaterResourceDao iWaterResourceDao;
//
// @Autowired
// IFireStationDao iFireStationDao;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
public FireEquipment save(FireEquipment fireEquipment) {
Long id = fireEquipment.getId();
iFireEquipmentDao.save(fireEquipment);
return fireEquipment;
}
public FireEquipment queryOne(Long id) {
Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(id);
if (fireEquipment1.isPresent()) {
return fireEquipment1.get();
}
return null;
}
// public FireEquipment save(FireEquipment fireEquipment) {
// Long id = fireEquipment.getId();
// iFireEquipmentDao.save(fireEquipment);
// return fireEquipment;
// }
//
//
// public FireEquipment queryOne(Long id) {
// Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(id);
// if (fireEquipment1.isPresent()) {
// return fireEquipment1.get();
// }
// return null;
// }
public String[] delete(String[] idArray) throws Exception {
for (String id : idArray) {
Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(Long.parseLong(id));
FireEquipment fireEquipment = null;
if (fireEquipment1.isPresent()) {
fireEquipment = fireEquipment1.get();
}
if (fireEquipment != null) {
this.iFireEquipmentDao.deleteById(Long.parseLong(id));
} else {
throw new Exception("找不到指定的对象:" + id);
}
}
// for (String id : idArray) {
// Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(Long.parseLong(id));
// FireEquipment fireEquipment = null;
// if (fireEquipment1.isPresent()) {
// fireEquipment = fireEquipment1.get();
// }
//
// if (fireEquipment != null) {
// this.iFireEquipmentDao.deleteById(Long.parseLong(id));
// } else {
// throw new Exception("找不到指定的对象:" + id);
// }
// }
return idArray;
}
......
......@@ -6,11 +6,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.yeejoin.amos.component.rule.RuleTrigger;
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;
>>>>>>> CSFAS_V2.1.3.3
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.dao.mapper.*;
......@@ -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.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
<<<<<<< HEAD
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
=======
>>>>>>> CSFAS_V2.1.3.3
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
......@@ -48,11 +42,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
<<<<<<< HEAD
=======
import java.math.BigDecimal;
>>>>>>> CSFAS_V2.1.3.3
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -123,21 +113,22 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Autowired
private IEvaluationModelDao iEvaluationModelDao;
@Autowired
private FmeaMapper fmeaMapper;
@Value("${station.name}")
private String stationName;
@Value("${spring.application.name}")
private String serviceName;
<<<<<<< HEAD
@Autowired
private IPlanOperationRecordDao planOperationRecordDao;
=======
@Value("${autoSys.alarm.nameKeys}")
private String nameKeys;
>>>>>>> CSFAS_V2.1.3.3
@Override
public void handlerMqttMessage(String topic, String data) {
......@@ -165,10 +156,15 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
deviceData.setMonitor(equipment != null ? equipment.getName() : "");
deviceData.setId(String.valueOf(equipmentSpecific.getId()));
deviceData.setCode(equipmentSpecific.getCode());
<<<<<<< HEAD
//设备告警处理逻辑
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(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());
......@@ -185,55 +181,26 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
//故障恢复
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;
if(StringUtil.isNotEmpty(equipment)) {
equipId = equipment.getId();
// 是否关联风险点
List<FmeaEquipmentPoint> list = fmeaEquipmentPointMapper.listFmeaByEquipIndexIdAndEquipId(equipmentSpecificIndex.getId(), equipId);
if(list.size() > 0) {
// 关联风险点进行rpn,rpni值的修改
list.forEach(fmeaEqPoint -> {
long fmeaId = fmeaEqPoint.getFmeaId();
updateFmeaRpn(fmeaId);
});
} else {
// 没有关联风险点,三维页面消息推送
fireEquipRuleMessagePush(deviceData, toke);
}
}
long specificIndexId = equipmentSpecificIndex.getId();
notifyAlarm(equipmentSpecificIndex, 1);
// 是否关联风险点
List<FmeaEquipmentPoint> list = fmeaEquipmentPointMapper.listFmeaByEquipIndexIdAndEquipId(specificIndexId, equipId);
if(list.size() > 0) {
// 关联风险点进行rpn,rpni值的修改
list.forEach(fmeaEqPoint -> {
long fmeaId = fmeaEqPoint.getFmeaId();
updateFmeaRpn(fmeaId);
});
} else {
// 没有关联风险点,三维页面消息推送
fireEquipRuleMessagePush(deviceData, toke);
}
} else { // 向三维推送实时值修改
log.info("(监测)Message type is: " + specificIndexType);
// 是否关联风险点
notifyAlarm(equipmentSpecificIndex, 0);
>>>>>>> CSFAS_V2.1.3.3
} else {
// 监测数据逻辑
log.info("(监测)Message type is: " + equipmentSpecificIndex.getType());
Map<String, Object> content = new HashMap<>();
content.put("id", equipmentSpecific.getId());
content.put("label", equipmentSpecific.getName()+" "+equipmentSpecificIndex.getEquipmentIndexName());
......@@ -242,12 +209,53 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
content.put("orgCode", equipmentSpecific.getOrgCode());
content.put("indexKey", equipmentSpecificIndex.getNameKey());
content.put("status", equipmentSpecificIndex.getValue());
// iDataRefreshService.sendRefreshDataWithArea(View3dRefreshAreaEum.monitor_data.getCode(), content);
String title = String.format("/%s/%s/%s", serviceName, stationName,"data/refresh/monitorData");
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
public void subscribeTopic() {
// 若登录系统则订阅装备数据
......
......@@ -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.enums.NumberEnum;
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.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException;
......
......@@ -34,14 +34,9 @@
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<<<<<<< HEAD
<version>1.4.4-SNAPSHOT</version>
</dependency>
=======
<version>1.4.3-SNAPSHOT</version>
</dependency>
>>>>>>> CSFAS_V2.1.3.3
<dependency>
<groupId>org.springframework.cloud</groupId>
<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