Commit 42a577ae authored by 吴江's avatar 吴江

Merge branch 'dev_upgrade' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into dev_upgrade

parents 15db6f25 bc956768
...@@ -7,6 +7,7 @@ public class SafetyExecuteBo { ...@@ -7,6 +7,7 @@ public class SafetyExecuteBo {
private String label; private String label;
private String pointId; private String pointId;
private String type; private String type;
private String status;//指标状态
private String changeDate; private String changeDate;
public Long getId() { public Long getId() {
return id; return id;
...@@ -44,4 +45,10 @@ public class SafetyExecuteBo { ...@@ -44,4 +45,10 @@ public class SafetyExecuteBo {
public void setChangeDate(String changeDate) { public void setChangeDate(String changeDate) {
this.changeDate = changeDate; this.changeDate = changeDate;
} }
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
} }
...@@ -100,7 +100,7 @@ public class FireEquimtPointController extends BaseController { ...@@ -100,7 +100,7 @@ public class FireEquimtPointController extends BaseController {
@ApiParam(value = "监测点编号或者监测点名称模糊匹配") @RequestParam(required = false) String searchValue, @ApiParam(value = "监测点编号或者监测点名称模糊匹配") @RequestParam(required = false) String searchValue,
@ApiParam(value = "类型(模拟量:ANALOGUE;开关量:SWITCH)") @RequestParam(required = false) String type) { @ApiParam(value = "类型(模拟量:ANALOGUE;开关量:SWITCH)") @RequestParam(required = false) String type) {
Map<String, Object> queryMap = Maps.newHashMap(); Map<String, Object> queryMap = Maps.newHashMap();
queryMap.put("pageNumber", pageNumber); queryMap.put("offset", pageNumber*pageSize);
queryMap.put("pageSize", pageSize); queryMap.put("pageSize", pageSize);
if (isBindDevice != null && isBindDevice == 0) { if (isBindDevice != null && isBindDevice == 0) {
queryMap.put("fireEquipmentId", 0); queryMap.put("fireEquipmentId", 0);
......
...@@ -12,6 +12,8 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil; ...@@ -12,6 +12,8 @@ import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.annotations.Authorization;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -73,6 +73,14 @@ public interface View3dMapper extends BaseMapper{ ...@@ -73,6 +73,14 @@ public interface View3dMapper extends BaseMapper{
* @return list * @return list
*/ */
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params); List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
/**
* 今日安全指数故障告警详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllFaultAlarm(Map<String, Object> params);
/** /**
* 今日巡检统计接口 * 今日巡检统计接口
...@@ -94,6 +102,20 @@ public interface View3dMapper extends BaseMapper{ ...@@ -94,6 +102,20 @@ public interface View3dMapper extends BaseMapper{
* @return * @return
*/ */
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode); List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
/**
* 火灾告警最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getFireAlarmTop5(String orgCode);
/**
* 设备状态最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getEquipStatusTop5(String orgCode);
/** /**
* 按照类型查询点 * 按照类型查询点
......
...@@ -67,8 +67,6 @@ import com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao; ...@@ -67,8 +67,6 @@ import com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDataDao; import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDataDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentPointDao; import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentPointDao;
import com.yeejoin.amos.fas.business.dao.repository.IFmeaDao;
import com.yeejoin.amos.fas.business.dao.repository.IPPointDao;
import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao; import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao; import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao; import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
...@@ -102,6 +100,7 @@ import com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum; ...@@ -102,6 +100,7 @@ import com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum;
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.RegionTreeResponse; 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.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.Alarm; import com.yeejoin.amos.fas.dao.entity.Alarm;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData; import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.Dict; import com.yeejoin.amos.fas.dao.entity.Dict;
...@@ -122,7 +121,6 @@ import com.yeejoin.amos.fas.exception.YeeException; ...@@ -122,7 +121,6 @@ import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
@Service("riskSourceService") @Service("riskSourceService")
public class RiskSourceServiceImpl implements IRiskSourceService { public class RiskSourceServiceImpl implements IRiskSourceService {
...@@ -144,8 +142,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -144,8 +142,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private AppMessagePushService appMessagePushService; private AppMessagePushService appMessagePushService;
@Autowired
private IFmeaDao iFmeaDao;
@Autowired @Autowired
private IRiskLevelDao riskLevelDao; private IRiskLevelDao riskLevelDao;
...@@ -177,8 +173,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -177,8 +173,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private IRiskLevelDao iRiskLevelDao; private IRiskLevelDao iRiskLevelDao;
@Autowired
private IPPointDao iPPointDao;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
...@@ -775,71 +769,72 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -775,71 +769,72 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
Equipment equipment = null; Equipment equipment = null;
if (fireEquipment != null) { if (fireEquipment != null) {
deviceData.setCode(fireEquipment.getCode()); deviceData.setCode(fireEquipment.getCode());
equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(fireEquipmentPoint.getFireEquipmentId()); //保存实时数据
//报警数据存库
saveFireEquipmentData(fireEquipmentPoint, fireEquipment, deviceData, fireEquipmentPointType); saveFireEquipmentData(fireEquipmentPoint, fireEquipment, deviceData, fireEquipmentPointType);
List<AlarmParam> list = new ArrayList<>(); equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(fireEquipmentPoint.getFireEquipmentId());
list.add(deviceData);
//保存到mongo
saveData(list, "soe");
if (equipment != null) { if (equipment != null) {
String batchNo = null; //动态预案执行
Object batch = null; dynamicPlan(deviceData, equipment, fireEquipment, fireEquipmentPointType);
Dict dict = null; }
if (fireEquipmentPointType != null) { }
if ("alarm_type_fire".equals(fireEquipmentPointType)) { }
redisTemplate.opsForHash().put("currentContingency", "batchNo", null);
} else { /**
batch = redisTemplate.opsForHash().get("currentContingency", "batchNo"); * 预案执行
} * @param deviceData
if (batch != null) { * @param equipment
* @param fireEquipment
batchNo = batch.toString(); * @param fireEquipmentPointType
} else { */
batchNo = UUID.randomUUID().toString(); @Async
} private void dynamicPlan(AlarmParam deviceData, Equipment equipment, FireEquipment fireEquipment, String fireEquipmentPointType){
} else { String batchNo = null;
batchNo = UUID.randomUUID().toString(); Object batch = null;
} Dict dict = null;
if (ObjectUtils.isEmpty(batchNo)) { if (fireEquipmentPointType != null) {
return; if ("alarm_type_fire".equals(fireEquipmentPointType)) {
} redisTemplate.opsForHash().put("currentContingency", "batchNo", null);
deviceData.setBatchNo(batchNo); } else {
deviceData.setMonitor(equipment.getName()); batch = redisTemplate.opsForHash().get("currentContingency", "batchNo");
deviceData.setEquimentId(String.valueOf(equipment.getId())); }
if ("alarm_type_fire".equals(fireEquipmentPointType)) { if (batch != null) {
if (deviceData.getIsMock()) {
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
}
Object canBeRunning = redisTemplate.opsForValue().get(cacheKeyForCanBeRunning());
if (canBeRunning == null) {
try { batchNo = batch.toString();
alermContingency(batchNo, fireEquipment, equipment); } else {
} catch (Exception e) { batchNo = UUID.randomUUID().toString();
log.error("调用规则失败", e); }
} } else {
} else { batchNo = UUID.randomUUID().toString();
redisTemplate.expire(cacheKeyForCanBeRunning(), 24 * 60 * 60, TimeUnit.SECONDS); }
} if (ObjectUtils.isEmpty(batchNo)) {
redisTemplate.opsForHash().put("currentContingency", "batchNo", batchNo); return;
redisTemplate.opsForHash().put("currentContingency", "contingencyPlan", null); }
redisTemplate.opsForHash().put("currentContingency", "alarmType", null); deviceData.setBatchNo(batchNo);
//通知刷新3d页面告警数据 deviceData.setMonitor(equipment.getName());
iDataRefreshService.refreshViewData(DataRefreshTypeEum.alarm.getCode()); deviceData.setEquimentId(String.valueOf(equipment.getId()));
} else { if ("alarm_type_fire".equals(fireEquipmentPointType)) {
if ("alarm_type_trouble".equals(fireEquipmentPointType)) { if (deviceData.getIsMock()) {
notifyAlarm(fireEquipmentPoint, deviceData); redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
//通知刷新3d页面相关故障数据 }
iDataRefreshService.refreshViewData(DataRefreshTypeEum.trouble.getCode()); Object canBeRunning = redisTemplate.opsForValue().get(cacheKeyForCanBeRunning());
} if (canBeRunning == null) {
String alarmType = (String) redisTemplate.opsForHash().get("currentContingency", "alarmType"); try {
if (!ObjectUtils.isEmpty(alarmType) && dict.getDictValue().equals(alarmType)) { alermContingency(batchNo, fireEquipment, equipment);
ContingencyDeviceStatus contingencyDeviceStatus = (ContingencyDeviceStatus) redisTemplate.opsForHash().get("currentContingency", "contingencyPlan"); } catch (Exception e) {
contingencyDeviceStatus.setNeedStatus("true"); log.error("调用规则失败", e);
autoProcessContingency(contingencyDeviceStatus, alarmType);
}
} }
} else {
redisTemplate.expire(cacheKeyForCanBeRunning(), 24 * 60 * 60, TimeUnit.SECONDS);
}
redisTemplate.opsForHash().put("currentContingency", "batchNo", batchNo);
redisTemplate.opsForHash().put("currentContingency", "contingencyPlan", null);
redisTemplate.opsForHash().put("currentContingency", "alarmType", null);
} else {
String alarmType = (String) redisTemplate.opsForHash().get("currentContingency", "alarmType");
if (!ObjectUtils.isEmpty(alarmType) && dict.getDictValue().equals(alarmType)) {
ContingencyDeviceStatus contingencyDeviceStatus = (ContingencyDeviceStatus) redisTemplate.opsForHash().get("currentContingency", "contingencyPlan");
contingencyDeviceStatus.setNeedStatus("true");
autoProcessContingency(contingencyDeviceStatus, alarmType);
} }
} }
} }
...@@ -853,7 +848,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -853,7 +848,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
private void saveFireEquipmentData(FireEquipmentPoint fireEquipmentPoint, FireEquipment fireEquipment, AlarmParam deviceData, String fireEquipmentPointType) { private void saveFireEquipmentData(FireEquipmentPoint fireEquipmentPoint, FireEquipment fireEquipment, AlarmParam deviceData, String fireEquipmentPointType) {
if("alarm_type_fire".equals(fireEquipmentPointType) || "alarm_type_trouble".equals(fireEquipmentPointType)){ if("alarm_type_fire".equals(fireEquipmentPointType) || "alarm_type_trouble".equals(fireEquipmentPointType)){
Alarm alarm = iAlarmDao.findByStatusTrueAndFireEquipmentPointCode(deviceData.getPointCode()); Alarm alarm = iAlarmDao.findByStatusTrueAndFireEquipmentPointCode(deviceData.getPointCode());
if(alarm != null){ if(alarm != null){
...@@ -865,41 +859,65 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -865,41 +859,65 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
alarm.setFrequency((alarm.getFrequency()+1)); alarm.setFrequency((alarm.getFrequency()+1));
alarm.setUpdateDate(new Date()); alarm.setUpdateDate(new Date());
} }
iAlarmDao.save(alarm);
}else{ }else{
alarm = new Alarm(); if("true".equals(deviceData.getState())){
alarm.setFireEquipmentCode(fireEquipment.getCode()); alarm = new Alarm();
alarm.setFireEquipmentId(fireEquipment.getId()); alarm.setFireEquipmentCode(fireEquipment.getCode());
alarm.setFireEquipmentName(fireEquipment.getName()); alarm.setFireEquipmentId(fireEquipment.getId());
alarm.setFireEquipmentPointCode(fireEquipmentPoint.getCode()); alarm.setFireEquipmentName(fireEquipment.getName());
alarm.setFireEquipmentPointId(fireEquipmentPoint.getId()); alarm.setFireEquipmentPointCode(fireEquipmentPoint.getCode());
alarm.setFireEquipmentPointName(fireEquipmentPoint.getName()); alarm.setFireEquipmentPointId(fireEquipmentPoint.getId());
alarm.setFireEquipmentPointValue(deviceData.getState()); alarm.setFireEquipmentPointName(fireEquipmentPoint.getName());
alarm.setOrgCode(fireEquipment.getOrgCode()); alarm.setFireEquipmentPointValue(deviceData.getState());
alarm.setType(fireEquipmentPointType); alarm.setOrgCode(fireEquipment.getOrgCode());
alarm.setType(fireEquipmentPointType);
iAlarmDao.save(alarm);
}
} }
iAlarmDao.save(alarm); if(alarm != null){
if ("alarm_type_trouble".equals(fireEquipmentPointType)) {
//通知刷新3d页面相关故障数据
if(alarm.getFrequency()==1 || alarm.getStatus() == false){
notifyAlarm(fireEquipmentPoint, deviceData);
iDataRefreshService.refreshViewData(DataRefreshTypeEum.trouble.getCode());
}
}else{
//通知刷新3d页面告警数据
iDataRefreshService.refreshViewData(DataRefreshTypeEum.alarm.getCode());
}
}
}else{ }else{
FireEquipmentData fireEquipmentData = new FireEquipmentData(); if("SWITCH".equals(fireEquipmentPoint.getType())){ //保存遥信信号数据到mysql中
fireEquipmentData.setEqPointCode(deviceData.getPointCode()); FireEquipmentData fireEquipmentData = new FireEquipmentData();
fireEquipmentData.seteValue(deviceData.getState()); fireEquipmentData.setEqPointCode(deviceData.getPointCode());
fireEquipmentData.setInformationAddress(deviceData.getInformationAddress()); fireEquipmentData.seteValue(deviceData.getState());
fireEquipmentData.setSoe(deviceData.getSoe()); fireEquipmentData.setInformationAddress(deviceData.getInformationAddress());
fireEquipmentData.setIsInvalid(deviceData.getIsInvalid()); fireEquipmentData.setSoe(deviceData.getSoe());
fireEquipmentData.setEqPointName(fireEquipmentPoint.getName()); fireEquipmentData.setIsInvalid(deviceData.getIsInvalid());
fireEquipmentData.setEqPointUnit(fireEquipmentPoint.getUnit()); fireEquipmentData.setEqPointName(fireEquipmentPoint.getName());
fireEquipmentData.setFireEquipmentPointId(fireEquipmentPoint.getId()); fireEquipmentData.setEqPointUnit(fireEquipmentPoint.getUnit());
fireEquipmentData.setFireEquipmentId(fireEquipmentPoint.getFireEquipmentId()); fireEquipmentData.setFireEquipmentPointId(fireEquipmentPoint.getId());
fireEquipmentData.setType("monitor"); fireEquipmentData.setFireEquipmentId(fireEquipmentPoint.getFireEquipmentId());
iFireEquipmentDataDao.save(fireEquipmentData); fireEquipmentData.setType("monitor");
Map<String, Object> content = new HashMap<>(); iFireEquipmentDataDao.save(fireEquipmentData);
content.put("id", fireEquipmentData.getId()); Map<String, Object> content = new HashMap<>();
content.put("label", fireEquipmentData.getEqPointName()); content.put("id", fireEquipmentData.getId());
content.put("changeDate", fireEquipmentData.getCreateDate()); content.put("label", fireEquipmentData.getEqPointName());
content.put("orgCode", fireEquipment.getOrgCode()); content.put("changeDate", fireEquipmentData.getCreateDate());
iDataRefreshService.sendRefreshDataWithArea(DataRefreshTypeEum.monitor.getCode(), content); content.put("orgCode", fireEquipment.getOrgCode());
content.put("status", deviceData.getSoe());
iDataRefreshService.sendRefreshDataWithArea(DataRefreshTypeEum.monitor.getCode(), content);
}
} }
List<AlarmParam> list = new ArrayList<>();
list.add(deviceData);
//保存所有数据(遥测,遥信)到mongo
saveData(list, "soe");
} }
@Override @Override
public void saveData(List<AlarmParam> deviceDatas, String type) { public void saveData(List<AlarmParam> deviceDatas, String type) {
List<EquipCommunicationData> list = deviceDatas.stream().map(param -> { List<EquipCommunicationData> list = deviceDatas.stream().map(param -> {
...@@ -1072,26 +1090,26 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1072,26 +1090,26 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
List<Map> list = riskSourceMapper.queryContingencyWater(); List<Map> list = riskSourceMapper.queryContingencyWater();
HashOperations hashOperations = redisTemplate.opsForHash(); HashOperations hashOperations = redisTemplate.opsForHash();
for (Map map : list) { for (Map map : list) {
double area = 0;
if (!ObjectUtils.isEmpty(map.get("area"))) {
area = Double.valueOf(map.get("area").toString());
}
String maxlevel = map.get("max_level") !=null?map.get("max_level").toString():"0.0";
String level = map.get("value") !=null&& StringUtil.isNumeric(map.get("value").toString())?String.format("%.2f", (Double.valueOf(map.get("value").toString()))):maxlevel;
String volume = String.format("%.2f", Double.valueOf(level) * area);
if (hashOperations.size("Analogue") > 0) { if (hashOperations.size("Analogue") > 0) {
if (ObjectUtils.isEmpty(map.get("CODE")) || !hashOperations.hasKey("Analogue", map.get("CODE"))) { if (ObjectUtils.isEmpty(map.get("CODE")) || !hashOperations.hasKey("Analogue", map.get("CODE"))) {
map.put("level", 0); map.put("level", level);
map.put("volume", 0); map.put("volume", volume);
continue; continue;
} }
EquipCommunicationData data = (EquipCommunicationData) hashOperations.get("Analogue", map.get("CODE")); EquipCommunicationData data = (EquipCommunicationData) hashOperations.get("Analogue", map.get("CODE"));
map.put("level", String.format("%.2f", Double.valueOf(data.getState()))); map.put("level", StringUtil.isNumeric(data.getState())?data.getState():level);
if (!ObjectUtils.isEmpty(map.get("level"))) { map.put("volume", String.format("%.2f", (Double.valueOf(map.get("level").toString())* area)));
double area = 0;
if (!ObjectUtils.isEmpty(map.get("area"))) {
area = Double.valueOf(map.get("area").toString());
}
map.put("volume", String.format("%.2f", Double.valueOf(map.get("level").toString()) * area));
} else {
map.put("volume", 0);
}
} else { } else {
map.put("level", 0); map.put("level", level);
map.put("volume", 0); map.put("volume", volume);
} }
} }
return list; return list;
......
...@@ -307,8 +307,7 @@ public class View3dServiceImpl implements IView3dService { ...@@ -307,8 +307,7 @@ public class View3dServiceImpl implements IView3dService {
Long checkExceptionNum = this.getCheckExceptionNum(orgCode,date); Long checkExceptionNum = this.getCheckExceptionNum(orgCode,date);
vo.setCheckExceptionNum(checkExceptionNum); vo.setCheckExceptionNum(checkExceptionNum);
//4.统计故障数量-日期+机构 //4.统计故障数量-日期+机构
//TODO:待毛颖确认调整完成后继续 vo.setFireExceptionNum(getFireExceptionNum(orgCode,date));
vo.setFireExceptionNum(0L);
} else { } else {
throw new YeeException("机构:"+orgCode+" 不存在"); throw new YeeException("机构:"+orgCode+" 不存在");
} }
...@@ -350,6 +349,15 @@ public class View3dServiceImpl implements IView3dService { ...@@ -350,6 +349,15 @@ public class View3dServiceImpl implements IView3dService {
}); });
} else if(StatisticsErrorTypeEum.equip.getCode().equals(type)){ } else if(StatisticsErrorTypeEum.equip.getCode().equals(type)){
//TODO:待毛颖确认调整完成后继续 //TODO:待毛颖确认调整完成后继续
List<CheckErrorBo> checkErrorBoList = view3dMapper.getAllFaultAlarm(params);
Map<String,List<CheckErrorBo>> map = checkErrorBoList.stream().collect(Collectors.groupingBy(CheckErrorBo::getStatus));
map.forEach((k,v)->{
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(k);
safetyIndexDetailVo.setTypeName(k);
safetyIndexDetailVo.setContent(getErrorContentVos(v));
resultList.add(safetyIndexDetailVo);
});
} }
return resultList; return resultList;
} }
...@@ -411,9 +419,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -411,9 +419,8 @@ public class View3dServiceImpl implements IView3dService {
if (optional.isPresent()) { if (optional.isPresent()) {
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode()); List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> { exceptionList = regionList.stream().filter(riskSource -> {
//TODO:待毛颖确认,增加判断故障的规则(统计数据:故障或者rpn上升) BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
BigDecimal rpnBig = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn(); return rpn.subtract(riskSource.getRpni()).doubleValue() > 0;
return rpnBig.subtract(riskSource.getRpni()).doubleValue() > 0;
}).map(riskSource -> { }).map(riskSource -> {
ExceptionRegionVo regionVo = new ExceptionRegionVo(); ExceptionRegionVo regionVo = new ExceptionRegionVo();
regionVo.setId(riskSource.getId()); regionVo.setId(riskSource.getId());
...@@ -421,7 +428,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -421,7 +428,8 @@ public class View3dServiceImpl implements IView3dService {
regionVo.setUe4Rotation(getInitJSONArray(riskSource.getUe4Rotation())); regionVo.setUe4Rotation(getInitJSONArray(riskSource.getUe4Rotation()));
regionVo.setUe4Extent(getInitJSONArray(riskSource.getUe4Extent())); regionVo.setUe4Extent(getInitJSONArray(riskSource.getUe4Extent()));
regionVo.setSafetyIndex(changeRpnToSafetyIndex(riskSource.getRpn())); regionVo.setSafetyIndex(changeRpnToSafetyIndex(riskSource.getRpn()));
regionVo.setBreakdown(isBreakDown(riskSource.getId())); regionVo.setBreakdown(isBreakDown(riskSource.getId()));//待后期去掉,前端图标显示统一不在细分
regionVo.setRoutePath(this.changeStringToJson(riskSource.getRoutePath()));
return regionVo; return regionVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
...@@ -436,8 +444,15 @@ public class View3dServiceImpl implements IView3dService { ...@@ -436,8 +444,15 @@ public class View3dServiceImpl implements IView3dService {
} }
} }
private JSONObject changeStringToJson(String str){
if(StringUtil.isNotEmpty(str)){
return JSON.parseObject(str);
}else {
return new JSONObject();
}
}
private Boolean isBreakDown(Long id){ private Boolean isBreakDown(Long id){
//TODO:判断是否故障,待毛颖确认
return true; return true;
} }
...@@ -471,23 +486,24 @@ public class View3dServiceImpl implements IView3dService { ...@@ -471,23 +486,24 @@ public class View3dServiceImpl implements IView3dService {
case "check"://巡检异常 case "check"://巡检异常
return view3dMapper.getCheckErrorTop5(orgCode); return view3dMapper.getCheckErrorTop5(orgCode);
case "fire": case "fire":
return JSON.parseArray(" [\r\n" + return view3dMapper.getFireAlarmTop5(orgCode);
" {\r\n" + // return JSON.parseArray(" [\r\n" +
" \"id\": 35781,\r\n" + // " {\r\n" +
" \"code\": \"s001\",\r\n" + // " \"id\": 35781,\r\n" +
" \"label\": \"设备test\",\r\n" + // " \"code\": \"s001\",\r\n" +
" \"pointId\": \"1\",\r\n" + // " \"label\": \"设备test\",\r\n" +
" \"type\": \"check\",\r\n" + // " \"pointId\": \"1\",\r\n" +
" \"changeDate\": \"2020-04-23 14:31:31\"\r\n" + // " \"type\": \"check\",\r\n" +
" },\r\n" + // " \"changeDate\": \"2020-04-23 14:31:31\"\r\n" +
" {\r\n" + // " },\r\n" +
" \"id\": 35780,\r\n" + // " {\r\n" +
" \"code\": \"s002\",\r\n" + // " \"id\": 35780,\r\n" +
" \"label\": \"设备002\",\r\n" + // " \"code\": \"s002\",\r\n" +
" \"pointId\": \"23123\",\r\n" + // " \"label\": \"设备002\",\r\n" +
" \"type\": \"check\",\r\n" + // " \"pointId\": \"23123\",\r\n" +
" \"changeDate\": \"2020-04-23 14:31:27\"\r\n" + // " \"type\": \"check\",\r\n" +
" }]", SafetyExecuteBo.class); // " \"changeDate\": \"2020-04-23 14:31:27\"\r\n" +
// " }]", SafetyExecuteBo.class);
default: default:
throw new YeeException("不支持的类型 -->"+ type); throw new YeeException("不支持的类型 -->"+ type);
} }
...@@ -503,9 +519,10 @@ public class View3dServiceImpl implements IView3dService { ...@@ -503,9 +519,10 @@ public class View3dServiceImpl implements IView3dService {
} }
@Override @Override
public Object getEquipStatusList(String orgCode) { public List<SafetyExecuteBo> getEquipStatusList(String orgCode) {
return JSON.parseArray("[{\"id\":1,\"label\":\"设备1 label\",\"changeDate\":\"2020-04-26 10:00:00\"}" return view3dMapper.getEquipStatusTop5(orgCode);
+ ",{\"id\":2,\"label\":\"设备2 label\",\"changeDate\":\"2020-04-25 10:00:00\"}]"); // return JSON.parseArray("[{\"id\":1,\"label\":\"设备1 label\",\"changeDate\":\"2020-04-26 10:00:00\"}"
// + ",{\"id\":2,\"label\":\"设备2 label\",\"changeDate\":\"2020-04-25 10:00:00\"}]");
} }
@Override @Override
......
...@@ -112,7 +112,7 @@ public interface IView3dService { ...@@ -112,7 +112,7 @@ public interface IView3dService {
* @param orgCode * @param orgCode
* @return * @return
*/ */
Object getEquipStatusList(String orgCode); List<SafetyExecuteBo> getEquipStatusList(String orgCode);
/** /**
* 左侧菜单(异常点) * 左侧菜单(异常点)
......
package com.yeejoin.amos.fas.business.vo; package com.yeejoin.amos.fas.business.vo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import springfox.documentation.spring.web.json.Json;
/** /**
* @author suhg * @author suhg
*/ */
...@@ -32,6 +36,11 @@ public class ExceptionRegionVo { ...@@ -32,6 +36,11 @@ public class ExceptionRegionVo {
*/ */
private JSONArray ue4Extent; private JSONArray ue4Extent;
/**
* 自研3维区域参数
*/
private JSONObject routePath;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -68,6 +77,14 @@ public class ExceptionRegionVo { ...@@ -68,6 +77,14 @@ public class ExceptionRegionVo {
return ue4Extent; return ue4Extent;
} }
public JSONObject getRoutePath() {
return routePath;
}
public void setRoutePath(JSONObject routePath) {
this.routePath = routePath;
}
public void setUe4Extent(JSONArray ue4Extent) { public void setUe4Extent(JSONArray ue4Extent) {
this.ue4Extent = ue4Extent; this.ue4Extent = ue4Extent;
} }
......
...@@ -61,20 +61,21 @@ public class StringUtil { ...@@ -61,20 +61,21 @@ public class StringUtil {
* @return 是否数字的标志 * @return 是否数字的标志
*/ */
public static boolean isNumeric(String str) { public static boolean isNumeric(String str) {
// 该正则表达式可以匹配所有的数字 包括负数 // 该正则表达式可以匹配所有的数字 包括负数
String bigStr; Pattern pattern = Pattern.compile("-?[0-9]+(\\.[0-9]+)?");
try { String bigStr;
bigStr = new BigDecimal(str).toString(); try {
} catch (Exception e) { bigStr = new BigDecimal(str).toString();
return false;// 异常 说明包含非数字。 } catch (Exception e) {
} return false;//异常 说明包含非数字。
}
Matcher isNum = numericPattern.matcher(bigStr); // matcher是全匹配 Matcher isNum = pattern.matcher(bigStr); // matcher是全匹配
if (!isNum.matches()) { if (!isNum.matches()) {
return false; return false;
} }
return true; return true;
} }
public static int toInt(String s) { public static int toInt(String s) {
if (s != null && !"".equals(s.trim())) { if (s != null && !"".equals(s.trim())) {
......
...@@ -152,8 +152,8 @@ ...@@ -152,8 +152,8 @@
</if> </if>
</where> </where>
order by a.create_date desc order by a.create_date desc
<if test="pageSize!=null and pageSize!=-1 and pageNumber!=null"> <if test="pageSize!=null and pageSize!=-1 and offset!=null">
limit #{pageNumber},#{pageSize} limit #{offset},#{pageSize}
</if> </if>
</select> </select>
......
...@@ -609,7 +609,8 @@ ...@@ -609,7 +609,8 @@
wr.max_level, wr.max_level,
wr.area, wr.area,
ep.CODE, ep.CODE,
wr.`name` wr.`name`,
ep.value
FROM FROM
f_fire_equipment_point ep f_fire_equipment_point ep
INNER JOIN f_water_resource_equipment wre ON wre.fire_equipment_id = ep.fire_equipment_id AND ep.type = 'ANALOGUE' INNER JOIN f_water_resource_equipment wre ON wre.fire_equipment_id = ep.fire_equipment_id AND ep.type = 'ANALOGUE'
......
...@@ -438,7 +438,15 @@ ...@@ -438,7 +438,15 @@
</select> </select>
<select id="countFireException" resultType="long"> <select id="countFireException" resultType="long">
SELECT
count(1)
FROM
f_alarm a
WHERE
`status` = TRUE
AND org_code = #{orgCode}
AND type = 'alarm_type_trouble'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select> </select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" > <select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
...@@ -473,6 +481,23 @@ ...@@ -473,6 +481,23 @@
and a.org_code = #{orgCode} and a.org_code = #{orgCode}
</select> </select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
a.id,
a.fire_equipment_point_name as `name`,
fe.equip_type as status,
a.update_date as changeDate
FROM
f_alarm a
LEFT JOIN f_fire_equipment fe ON fe.id = a.fire_equipment_id
WHERE
`status` = TRUE
AND type = 'alarm_type_trouble'
AND a.org_code = #{orgCode}
AND date_format(a.update_date, '%Y-%m-%d') =#{date}
</select>
<select id="getStatisticsCheck" resultType="java.util.HashMap"> <select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[ <![CDATA[
SELECT d.status as type, count(1) as value SELECT d.status as type, count(1) as value
...@@ -503,11 +528,42 @@ ...@@ -503,11 +528,42 @@
left join p_point I ON I.id = p.point_id left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3') where p.is_ok IN ('2', '3')
AND I.is_delete = 0 AND I.is_delete = 0
AND p.org_code = #{org_code} or p.org_code like CONCAT(#{orgCode},'-','%') AND p.org_code = #{orgCode} or p.org_code like CONCAT(#{orgCode},'-','%')
ORDER BY p.check_time desc ORDER BY p.check_time desc
limit 0,5 limit 0,5
</select> </select>
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
a.fire_equipment_id id,
a.fire_equipment_code code,
a.fire_equipment_point_name as `label`,
a.update_date as changeDate,
"monitorEquipment" type
FROM
f_alarm a
WHERE
a.org_code = #{orgCode}
AND a.`status` = TRUE
AND a.type = 'alarm_type_fire'
ORDER BY a.update_date DESC
limit 0,5
</select>
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
fed.id,
fed.eq_point_name label,
fed.e_value status,
fed.create_date changeDate
FROM
f_fire_equipment_data fed
WHERE
fed.org_code = #{orgCode}
ORDER BY fed.create_date DESC
limit 0,5
</select>
<select id="getPintsByType" resultType="hashmap"> <select id="getPintsByType" resultType="hashmap">
select CONCAT(type,'-',id) as `key`,sp.* from select CONCAT(type,'-',id) as `key`,sp.* from
(select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode, (select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,
......
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