Commit 870bdbd9 authored by tangwei's avatar tangwei

解决冲突

parents 4656ba5e d352e924
package com.yeejoin.amos.boot.module.jxiop.biz.constants; package com.yeejoin.amos.boot.module.jxiop.biz.constants;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import java.util.HashMap; import java.util.HashMap;
public class CommonConstans { public class CommonConstans {
...@@ -100,7 +103,7 @@ public class CommonConstans { ...@@ -100,7 +103,7 @@ public class CommonConstans {
public static final String Fourdecimalplaces = "%.4f"; public static final String Fourdecimalplaces = "%.4f";
public static final String QueryStringFrontMoudleNotKeyWord = "frontModule"; public static final String QueryStringFrontMoudleNotKeyWord = "frontModule";
public static final HashMap<String, String> waringPeriodS = new HashMap<String, String>() { public static final HashMap<String, String> waringPeriodStatus = new HashMap<String, String>() {
{ {
put("按时刻", "按10分钟周期"); put("按时刻", "按10分钟周期");
...@@ -108,4 +111,13 @@ public class CommonConstans { ...@@ -108,4 +111,13 @@ public class CommonConstans {
put("按天", "按1天周期"); put("按天", "按1天周期");
} }
}; };
public static final HashMap<String, String> waringPeriodDateFormate = new HashMap<String, String>() {
{
put("按时刻", DatePattern.NORM_DATETIME_PATTERN);
put("按小时", DatePattern.NORM_DATETIME_PATTERN);
put("按天", DatePattern.NORM_DATE_PATTERN);
}
};
} }
...@@ -235,14 +235,14 @@ public class AnalyseController extends BaseController { ...@@ -235,14 +235,14 @@ public class AnalyseController extends BaseController {
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ; return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "post", value = "预警详情信息-风机", notes = "预警详情信息-风机") @ApiOperation(httpMethod = "GET", value = "预警详情信息-风机", notes = "预警详情信息-风机")
@PostMapping(value = "/getAlramInfoDetailOfFan") @GetMapping(value = "/getAlramInfoDetailOfFan")
public ResponseModel<Map<String, Object>> getAlramInfoDetailOfFan(@RequestParam(required = true) String id){ public ResponseModel<Map<String, Object>> getAlramInfoDetailOfFan(@RequestParam(required = true) String id){
return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfFan(id)); return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfFan(id));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "post", value = "预警详情信息-光伏", notes = "预警详情信息-光伏") @ApiOperation(httpMethod = "GET", value = "预警详情信息-光伏", notes = "预警详情信息-光伏")
@PostMapping(value = "/getAlramInfoDetailOfPv") @GetMapping(value = "/getAlramInfoDetailOfPv")
public ResponseModel<Map<String, Object>> getAlramInfoDetailOfPv(@RequestParam(required = true) String id){ public ResponseModel<Map<String, Object>> getAlramInfoDetailOfPv(@RequestParam(required = true) String id){
return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfPv(id)); return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfPv(id));
} }
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
...@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -61,31 +64,44 @@ public class TestController extends BaseController { ...@@ -61,31 +64,44 @@ public class TestController extends BaseController {
QueryWrapper<FanHealthIndex> fanHealthIndexQueryWrapper = new QueryWrapper<>(); QueryWrapper<FanHealthIndex> fanHealthIndexQueryWrapper = new QueryWrapper<>();
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectList(fanHealthIndexQueryWrapper); List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectList(fanHealthIndexQueryWrapper);
FanHealthIndex fanHealthIndex = new FanHealthIndex(); List<IdxBizFanHealthIndex> list = new ArrayList<>();
IdxBizFanHealthIndex fanHealthIndex = new IdxBizFanHealthIndex();
fanHealthIndex.setHealthIndex(2.0); fanHealthIndex.setHealthIndex(2.0);
fanHealthIndex.setTs(System.currentTimeMillis()); // fanHealthIndex.setTs(System.currentTimeMillis());
fanHealthIndex.setArea("区域"); fanHealthIndex.setArae("区域");
fanHealthIndex.setAnalysisEndTime(DateUtil.now()); fanHealthIndex.setAnalysisEndTime(DateUtil.date());
fanHealthIndex.setAnalysisObjSeq("2"); fanHealthIndex.setAnalysisObjSeq("2");
fanHealthIndex.setHealthLevel("2321"); fanHealthIndex.setHealthLevel("2321");
fanHealthIndex.setHealthIndex(25.0); fanHealthIndex.setHealthIndex(25.0);
fanHealthIndex.setAnalysisStartTime(DateUtil.now()); fanHealthIndex.setAnalysisStartTime(DateUtil.date());
fanHealthIndex.setAnalysisObjType("21"); fanHealthIndex.setAnalysisObjType("21");
fanHealthIndex.setAnalysisTime("21"); fanHealthIndex.setANALYSISTIME("21");
fanHealthIndex.setAnomaly(2.0); fanHealthIndex.setANOMALY(2.0);
fanHealthIndex.setEquipmentName("21"); fanHealthIndex.setEquipmentName("21");
fanHealthIndex.setGatewayId("213412"); fanHealthIndex.setGatewayId("213412");
fanHealthIndex.setPointName("21312"); fanHealthIndex.setPointName("21312");
fanHealthIndex.setNumber("213"); fanHealthIndex.setNumber("213");
fanHealthIndex.setKks("213"); fanHealthIndex.setKks("213");
fanHealthIndex.setRecDate(DateUtil.now()); fanHealthIndex.setRecDate(DateUtil.date());
fanHealthIndex.setSubSystem("213421"); fanHealthIndex.setSubSystem("213421");
fanHealthIndex.setWeight(2.2); fanHealthIndex.setWeigth(2.2);
fanHealthIndex.setAnalysisType("21"); fanHealthIndex.setAnalysisType("按时刻");
fanHealthIndex.setStation("rwwrrw"); fanHealthIndex.setStation("rwwrrw");
fanHealthIndex.setIndexAddress("2321"); fanHealthIndex.setIndexAddress("2321");
FanHealthIndex fanHealthIndex1 = new FanHealthIndex();
BeanUtil.copyProperties(fanHealthIndex, fanHealthIndex1);
fanHealthIndex1.setWeight(fanHealthIndex.getWeigth());
fanHealthIndex1.setAnomaly(fanHealthIndex.getANOMALY());
fanHealthIndex1.setRecDate(DateUtil.now());
fanHealthIndex1.setArea(fanHealthIndex.getArae());
fanHealthIndex1.setAnalysisTime(DateUtil.now());
fanHealthIndex1.setHealthLevel(fanHealthIndex.getHealthLevel());
fanHealthIndex1.setKks("123456");
ArrayList<FanHealthIndex> fanHealthIndices1 = new ArrayList<>();
fanHealthIndices1.add(fanHealthIndex1);
list.add(fanHealthIndex);
// commonService.healthWarningMinuteByFJ(); // commonService.healthWarningMinuteByFJ();
fanHealthIndexMapper.insert(fanHealthIndex); fanHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "fan_health_index_moment");
} }
} }
...@@ -138,5 +138,15 @@ public class IdxBizFanPointVarCorrelation{ ...@@ -138,5 +138,15 @@ public class IdxBizFanPointVarCorrelation{
*/ */
@TableField("EQUIPMENT_NAME") @TableField("EQUIPMENT_NAME")
private String equipmentName; private String equipmentName;
/**
* 分析变量名称
*/
@TableField("ANALYSIS_POINT_NAME")
private String analysisPointName;
/**
* 工况变量名称
*/
@TableField("PROCESS_POINT_NAME")
private String processPointName;
} }
...@@ -139,4 +139,16 @@ public class IdxBizPvPointVarCorrelation{ ...@@ -139,4 +139,16 @@ public class IdxBizPvPointVarCorrelation{
@TableField("EQUIPMENT_NAME") @TableField("EQUIPMENT_NAME")
private String equipmentName; private String equipmentName;
/**
* 分析变量名称
*/
@TableField("ANALYSIS_POINT_NAME")
private String analysisPointName;
/**
* 工况变量名称
*/
@TableField("PROCESS_POINT_NAME")
private String processPointName;
} }
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IAlarmInfoDetailService; import com.yeejoin.amos.boot.module.jxiop.biz.service.IAlarmInfoDetailService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
@Autowired @Autowired
IndicatorDataMapper indicatorDataMapper;
@Autowired
IdxBizFanWarningRecordMapper idxBizFanWarningRecordMapper; IdxBizFanWarningRecordMapper idxBizFanWarningRecordMapper;
@Autowired
IdxBizPvWarningRecordMapper idxBizPvWarningRecordMapper;
@Autowired @Autowired
IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper; IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper;
@Autowired
IdxBizPvHealthIndexMapper idxBizPvHealthIndexMapper;
@Autowired @Autowired
IdxBizFanPointVarCentralValueMapper idxBizFanPointVarCentralValueMapper; IdxBizFanPointVarCentralValueMapper idxBizFanPointVarCentralValueMapper;
@Autowired
IdxBizPvPointVarCentralValueMapper idxBizPvPointVarCentralValueMapper;
@Autowired @Autowired
IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper; IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper;
@Autowired @Autowired
IdxBizPvWarningRecordMapper idxBizPvWarningRecordMapper; IdxBizPvPointProcessVariableClassificationMapper idxBizPvPointProcessVariableClassificationMapper;
@Autowired
IdxBizFanPointVarCorrelationMapper idxBizFanPointVarCorrelationMapper;
@Autowired
IdxBizPvPointVarCorrelationMapper idxBizPvPointVarCorrelationMapper;
@Override @Override
public Map<String, Object> getAlramInfoDetailOfFan(String id) { public Map<String, Object> getAlramInfoDetailOfFan(String id) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
IdxBizFanWarningRecord idxBizFanWarningRecord = idxBizFanWarningRecordMapper.selectById(id); IdxBizFanWarningRecord idxBizFanWarningRecord = idxBizFanWarningRecordMapper.selectById(id);
//------------预警信息 result.put("warningInfo", getFanAlarmInfoMap(idxBizFanWarningRecord));
// -----------预警趋势
HashMap<String, Object> alarmTrendAndAlarmAbnormalityListResult = getFanAlarmTrendAndAlarmAbnormalityList(idxBizFanWarningRecord);
result.put("alarmTrend", alarmTrendAndAlarmAbnormalityListResult.get("alarmTrend"));
result.put("alarmAbnormalityList", alarmTrendAndAlarmAbnormalityListResult.get("alarmAbnormalityList"));
String startTime = (String) alarmTrendAndAlarmAbnormalityListResult.get("startTime");
String endTime = (String) alarmTrendAndAlarmAbnormalityListResult.get("endTime");
//----健康指数来源
List<IdxBizFanPointVarCentralValue> idxBizFanPointVarCentralValueList = idxBizFanPointVarCentralValueMapper
.selectList(new QueryWrapper<IdxBizFanPointVarCentralValue>()
.eq("ANALYSIS_POINT_ID", idxBizFanWarningRecord.getAnalysisPointId()));
IdxBizFanPointVarCentralValue idxBizFanPointVarCentralValue = new IdxBizFanPointVarCentralValue();
if (idxBizFanPointVarCentralValueList.size() <= 0) {
return result;
}
idxBizFanPointVarCentralValue = idxBizFanPointVarCentralValueList.get(0);
handlerIdxBizFanPointVarCentralValue(idxBizFanPointVarCentralValueList);
//健康指数来源测点信息
HashMap<String, String> healthPointInfoMap = new HashMap<>();
healthPointInfoMap.put("analysisPointName", idxBizFanPointVarCentralValue.getAnalysisPointName());
healthPointInfoMap.put("processPoint1Name", idxBizFanPointVarCentralValue.getProcessPoint1Name());
healthPointInfoMap.put("processPoint2Name", idxBizFanPointVarCentralValue.getProcessPoint2Name());
healthPointInfoMap.put("processPoint3Name", idxBizFanPointVarCentralValue.getProcessPoint3Name());
result.put("healthPointInfo", healthPointInfoMap);
List<IdxBizFanPointProcessVariableClassification> idxBizFanPointProcessVariableClassificationList = idxBizFanPointProcessVariableClassificationMapper
.selectList(new QueryWrapper<IdxBizFanPointProcessVariableClassification>()
.in("SEQUENCE_NBR", Arrays.asList(idxBizFanPointVarCentralValue.getAnalysisPointId(), idxBizFanPointVarCentralValue.getProcessPoint1Id(), idxBizFanPointVarCentralValue.getProcessPoint2Id(), idxBizFanPointVarCentralValue.getProcessPoint3Id())));
String addresss = idxBizFanPointProcessVariableClassificationList.stream()
.map(idxBizFanPointProcessVariableClassification -> "'" + idxBizFanPointProcessVariableClassification.getIndexAddress() + "'")
.collect(Collectors.joining(","));
Map<String, String> idAddressMap = idxBizFanPointProcessVariableClassificationList.stream()
.collect(Collectors.toMap(IdxBizFanPointProcessVariableClassification::getSequenceNbr, IdxBizFanPointProcessVariableClassification::getIndexAddress));
//查询固化数据---------------------
List<IndicatorData> indicatorDataList = indicatorDataMapper.selectDataByGatewayIdAndAddressForAlarmInfoDetail(idxBizFanPointProcessVariableClassificationList.get(0).getGatewayId(), addresss, startTime, endTime);
Map<String, Double> indicatorDataListMap = new HashMap<>(indicatorDataList.size());
TreeSet<String> timesindicatorDataList = new TreeSet<>();
indicatorDataList.forEach(indicatorData -> {
String time = DateUtil.format(indicatorData.getCreatedTime(), DatePattern.NORM_DATETIME_MINUTE_PATTERN) + ":00";
indicatorDataListMap.put(time + "_" + indicatorData.getAddress(), Double.valueOf(indicatorData.getValueF()));
timesindicatorDataList.add(time);
});
//当前值
List<HashMap<String, String>> currentValue = new ArrayList<>();
//训练值
List<HashMap<String, String>> trainValue = new ArrayList<>();
String analyseValueAddress = idAddressMap.get(idxBizFanPointVarCentralValue.getAnalysisPointId());
String process1Address = idAddressMap.get(idxBizFanPointVarCentralValue.getProcessPoint1Id());
String process2Address = idAddressMap.get(idxBizFanPointVarCentralValue.getProcessPoint2Id());
String process3Address = idAddressMap.get(idxBizFanPointVarCentralValue.getProcessPoint3Id());
timesindicatorDataList.forEach(
s -> {
HashMap<String, String> currentValueMap = new HashMap<>();
currentValueMap.put("time", s);
Double analyseValue = indicatorDataListMap.get(s + "_" + analyseValueAddress);
Double processValue1 = indicatorDataListMap.get(s + "_" + process1Address);
Double processValue2 = indicatorDataListMap.get(s + "_" + process2Address);
Double processValue3 = indicatorDataListMap.get(s + "_" + process3Address);
currentValueMap.put("analyseValue", String.valueOf(analyseValue));
currentValueMap.put("processValue1", String.valueOf(processValue1));
currentValueMap.put("processValue2", String.valueOf(processValue2));
currentValueMap.put("processValue3", String.valueOf(processValue3));
HashMap<String, String> trainValueMap = getWorkingConditionCombinationIntervalFan(processValue1, processValue2, processValue3, idxBizFanPointVarCentralValueList);
trainValueMap.put("time", s);
currentValue.add(currentValueMap);
trainValue.add(trainValueMap);
}
);
result.put("currentValue", currentValue);
result.put("trainValue", trainValue);
//---------------工况组合来源
result.put("sourceInfo", getSourceInfoMapFan(idxBizFanWarningRecord));
return result;
}
@Override
public Map<String, Object> getAlramInfoDetailOfPv(String id) {
Map<String, Object> result = new HashMap<>();
IdxBizPvWarningRecord idxBizPvWarningRecord = idxBizPvWarningRecordMapper.selectById(id);
result.put("warningInfo", getPvAlarmInfoMap(idxBizPvWarningRecord));
// -----------预警趋势
HashMap<String, Object> alarmTrendAndAlarmAbnormalityListResult = getPvAlarmTrendAndAlarmAbnormalityList(idxBizPvWarningRecord);
result.put("alarmTrend", alarmTrendAndAlarmAbnormalityListResult.get("alarmTrend"));
result.put("alarmAbnormalityList", alarmTrendAndAlarmAbnormalityListResult.get("alarmAbnormalityList"));
String startTime = (String) alarmTrendAndAlarmAbnormalityListResult.get("startTime");
String endTime = (String) alarmTrendAndAlarmAbnormalityListResult.get("endTime");
//----健康指数来源
List<IdxBizPvPointVarCentralValue> idxBizPvPointVarCentralValueList = idxBizPvPointVarCentralValueMapper
.selectList(new QueryWrapper<IdxBizPvPointVarCentralValue>()
.eq("ANALYSIS_POINT_ID", idxBizPvWarningRecord.getAnalysisPointId()));
IdxBizPvPointVarCentralValue idxBizPvPointVarCentralValue = new IdxBizPvPointVarCentralValue();
if (idxBizPvPointVarCentralValueList.size() <= 0) {
return result;
}
idxBizPvPointVarCentralValue = idxBizPvPointVarCentralValueList.get(0);
handlerIdxBizPvPointVarCentralValue(idxBizPvPointVarCentralValueList);
//健康指数来源测点信息
HashMap<String, String> healthPointInfoMap = new HashMap<>();
healthPointInfoMap.put("analysisPointName", idxBizPvPointVarCentralValue.getAnalysisPointIdName());
healthPointInfoMap.put("processPoint1Name", idxBizPvPointVarCentralValue.getProcessPoint1IdName());
healthPointInfoMap.put("processPoint2Name", idxBizPvPointVarCentralValue.getProcessPoint2IdName());
healthPointInfoMap.put("processPoint3Name", idxBizPvPointVarCentralValue.getProcessPoint3IdName());
result.put("healthPointInfo", healthPointInfoMap);
List<IdxBizPvPointProcessVariableClassification> idxBizPvPointProcessVariableClassificationList = idxBizPvPointProcessVariableClassificationMapper
.selectList(new QueryWrapper<IdxBizPvPointProcessVariableClassification>()
.in("SEQUENCE_NBR", Arrays.asList(idxBizPvPointVarCentralValue.getAnalysisPointId(), idxBizPvPointVarCentralValue.getProcessPoint1Id(), idxBizPvPointVarCentralValue.getProcessPoint2Id(), idxBizPvPointVarCentralValue.getProcessPoint3Id())));
String addresss = idxBizPvPointProcessVariableClassificationList.stream()
.map(idxBizFanPointProcessVariableClassification -> "'" + idxBizFanPointProcessVariableClassification.getIndexAddress() + "'")
.collect(Collectors.joining(","));
Map<String, String> idAddressMap = idxBizPvPointProcessVariableClassificationList.stream()
.collect(Collectors.toMap(IdxBizPvPointProcessVariableClassification::getSequenceNbr, IdxBizPvPointProcessVariableClassification::getIndexAddress));
//查询固化数据---------------------
List<IndicatorData> indicatorDataList = indicatorDataMapper.selectDataByGatewayIdAndAddressForAlarmInfoDetail(idxBizPvPointProcessVariableClassificationList.get(0).getGatewayId(), addresss, startTime, endTime);
Map<String, Double> indicatorDataListMap = new HashMap<>(indicatorDataList.size());
TreeSet<String> timesindicatorDataList = new TreeSet<>();
indicatorDataList.forEach(indicatorData -> {
String time = DateUtil.format(indicatorData.getCreatedTime(), DatePattern.NORM_DATETIME_MINUTE_PATTERN) + ":00";
indicatorDataListMap.put(time + "_" + indicatorData.getAddress(), Double.valueOf(indicatorData.getValueF()));
timesindicatorDataList.add(time);
});
//当前值
List<HashMap<String, String>> currentValue = new ArrayList<>();
//训练值
List<HashMap<String, String>> trainValue = new ArrayList<>();
String analyseValueAddress = idAddressMap.get(idxBizPvPointVarCentralValue.getAnalysisPointId());
String process1Address = idAddressMap.get(idxBizPvPointVarCentralValue.getProcessPoint1Id());
String process2Address = idAddressMap.get(idxBizPvPointVarCentralValue.getProcessPoint2Id());
String process3Address = idAddressMap.get(idxBizPvPointVarCentralValue.getProcessPoint3Id());
timesindicatorDataList.forEach(
s -> {
HashMap<String, String> currentValueMap = new HashMap<>();
currentValueMap.put("time", s);
Double analyseValue = indicatorDataListMap.get(s + "_" + analyseValueAddress);
Double processValue1 = indicatorDataListMap.get(s + "_" + process1Address);
Double processValue2 = indicatorDataListMap.get(s + "_" + process2Address);
Double processValue3 = indicatorDataListMap.get(s + "_" + process3Address);
currentValueMap.put("analyseValue", String.valueOf(analyseValue));
currentValueMap.put("processValue1", String.valueOf(processValue1));
currentValueMap.put("processValue2", String.valueOf(processValue2));
currentValueMap.put("processValue3", String.valueOf(processValue3));
HashMap<String, String> trainValueMap = getWorkingConditionCombinationIntervalPv(processValue1, processValue2, processValue3, idxBizPvPointVarCentralValueList);
trainValueMap.put("time", s);
currentValue.add(currentValueMap);
trainValue.add(trainValueMap);
}
);
result.put("currentValue", currentValue);
result.put("trainValue", trainValue);
//---------------工况组合来源
result.put("sourceInfo", getSourceInfoMapPv(idxBizPvWarningRecord));
return result;
}
// 获取风机告警信息
public HashMap<String, String> getFanAlarmInfoMap(IdxBizFanWarningRecord idxBizFanWarningRecord) {
HashMap<String, String> alarmInfoMap = new HashMap<>(); HashMap<String, String> alarmInfoMap = new HashMap<>();
//测点名称 //测点名称
alarmInfoMap.put("pointName", idxBizFanWarningRecord.getPointName()); alarmInfoMap.put("pointName", idxBizFanWarningRecord.getPointName());
//告警周期 //告警周期
alarmInfoMap.put("waringPeriod", idxBizFanWarningRecord.getWarningPeriod()); alarmInfoMap.put("waringPeriod", CommonConstans.waringPeriodStatus.get(idxBizFanWarningRecord.getWarningPeriod()));
//告警时间 //告警时间
alarmInfoMap.put("waringTime", idxBizFanWarningRecord.getRecDate().toString()); alarmInfoMap.put("waringTime", DateUtil.format(idxBizFanWarningRecord.getRecDate(), CommonConstans.waringPeriodDateFormate.get(idxBizFanWarningRecord.getWarningPeriod())));
//预警等级 //预警等级
alarmInfoMap.put("waringLevel", idxBizFanWarningRecord.getWarningName()); alarmInfoMap.put("waringLevel", idxBizFanWarningRecord.getWarningName());
//预警触发规则 //预警触发规则
alarmInfoMap.put("waringRule", idxBizFanWarningRecord.getCONTENT()); alarmInfoMap.put("waringRule", idxBizFanWarningRecord.getCONTENT());
result.put("warningInfo", alarmInfoMap); return alarmInfoMap;
// -----------预警趋势 }
// 获取光伏告警信息
public HashMap<String, String> getPvAlarmInfoMap(IdxBizPvWarningRecord idxBizPvWarningRecord) {
HashMap<String, String> alarmInfoMap = new HashMap<>();
//测点名称
alarmInfoMap.put("pointName", idxBizPvWarningRecord.getPointName());
//告警周期
alarmInfoMap.put("waringPeriod", CommonConstans.waringPeriodStatus.get(idxBizPvWarningRecord.getWarningPeriod()));
//告警时间
alarmInfoMap.put("waringTime", DateUtil.format(idxBizPvWarningRecord.getRecDate(), CommonConstans.waringPeriodDateFormate.get(idxBizPvWarningRecord.getWarningPeriod())));
//预警等级
alarmInfoMap.put("waringLevel", idxBizPvWarningRecord.getWarningName());
//预警触发规则
alarmInfoMap.put("waringRule", idxBizPvWarningRecord.getCONTENT());
return alarmInfoMap;
}
// 获取风机趋势图与异常度
public HashMap<String, Object> getFanAlarmTrendAndAlarmAbnormalityList(IdxBizFanWarningRecord idxBizFanWarningRecord) {
HashMap<String, Object> result = new HashMap<>();
HashMap<String, List<String>> alarmTrendMap = new HashMap<>(); HashMap<String, List<String>> alarmTrendMap = new HashMap<>();
List<HashMap<String,String>> alarmAbnormalityList = new ArrayList<>(); List<HashMap<String, String>> alarmAbnormalityList = new ArrayList<>();
Long analysisDate = idxBizFanWarningRecord.getRecDate().getTime()+1000*60; Long analysisDate = idxBizFanWarningRecord.getRecDate().getTime() + 1000 * 60;
List<IdxBizFanHealthIndex> idxBizFanHealthIndexList = idxBizFanHealthIndexMapper.selectList(new QueryWrapper<IdxBizFanHealthIndex>() List<IdxBizFanHealthIndex> idxBizFanHealthIndexList = idxBizFanHealthIndexMapper.selectList(new QueryWrapper<IdxBizFanHealthIndex>()
.eq("GATEWAY_ID", idxBizFanWarningRecord.getGatewayId()) .eq("GATEWAY_ID", idxBizFanWarningRecord.getGatewayId())
.eq("INDEX_ADDRESS", idxBizFanWarningRecord.getIndexAddress()) .eq("INDEX_ADDRESS", idxBizFanWarningRecord.getIndexAddress())
...@@ -53,49 +244,197 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService { ...@@ -53,49 +244,197 @@ public class AlarmInfoDetailServiceImpl implements IAlarmInfoDetailService {
.last("limit 30")); .last("limit 30"));
List<String> xDatas = new ArrayList<>(); List<String> xDatas = new ArrayList<>();
List<String> yDatas = new ArrayList<>(); List<String> yDatas = new ArrayList<>();
for (int i = idxBizFanHealthIndexList.size() - 1; i > 0; i--) { String startTime = "";
HashMap<String,String> alarmAbnormalityItem = new HashMap<>(); String endTime = "";
for (int i = idxBizFanHealthIndexList.size() - 1; i >= 0; i--) {
HashMap<String, String> alarmAbnormalityItem = new HashMap<>();
IdxBizFanHealthIndex idxBizFanHealthIndex = idxBizFanHealthIndexList.get(i); IdxBizFanHealthIndex idxBizFanHealthIndex = idxBizFanHealthIndexList.get(i);
xDatas.add(idxBizFanHealthIndex.getANALYSISTIME()); xDatas.add(idxBizFanHealthIndex.getANALYSISTIME());
yDatas.add(String.valueOf(idxBizFanHealthIndex.getHealthIndex())); yDatas.add(String.valueOf(idxBizFanHealthIndex.getHealthIndex()));
alarmAbnormalityItem.put("time",idxBizFanHealthIndex.getANALYSISTIME()); alarmAbnormalityItem.put("time", idxBizFanHealthIndex.getANALYSISTIME());
alarmAbnormalityItem.put("abnormal", String.valueOf(idxBizFanHealthIndex.getANOMALY())); alarmAbnormalityItem.put("abnormal", String.valueOf(idxBizFanHealthIndex.getANOMALY()));
alarmAbnormalityItem.put("healthValue",String.valueOf(idxBizFanHealthIndex.getHealthIndex())); alarmAbnormalityItem.put("healthValue", String.valueOf(idxBizFanHealthIndex.getHealthIndex()));
if (i == 0) {
endTime = idxBizFanHealthIndex.getANALYSISTIME();
}
if (i == 2) {
startTime = idxBizFanHealthIndex.getANALYSISTIME();
}
alarmAbnormalityList.add(alarmAbnormalityItem); alarmAbnormalityList.add(alarmAbnormalityItem);
} }
alarmTrendMap.put("xDatas",xDatas); alarmTrendMap.put("xDatas", xDatas);
alarmTrendMap.put("yDatas",yDatas); alarmTrendMap.put("yDatas", yDatas);
result.put("alarmTrend",alarmTrendMap); result.put("alarmTrend", alarmTrendMap);
// 异常度 alarmAbnormality // 异常度 alarmAbnormality
result.put("alarmAbnormalityList",alarmAbnormalityList.subList(alarmAbnormalityList.size()-3,alarmAbnormalityList.size())); result.put("alarmAbnormalityList", alarmAbnormalityList.subList(alarmAbnormalityList.size() - 3, alarmAbnormalityList.size()));
//----健康指数来源 result.put("startTime", startTime);
List<IdxBizFanPointVarCentralValue> idxBizFanPointVarCentralValueList = idxBizFanPointVarCentralValueMapper.selectList(new QueryWrapper<IdxBizFanPointVarCentralValue>().eq("ANALYSIS_POINT_ID",idxBizFanWarningRecord.getAnalysisPointId())); result.put("endTime", endTime);
IdxBizFanPointVarCentralValue idxBizFanPointVarCentralValue =new IdxBizFanPointVarCentralValue();
if(idxBizFanPointVarCentralValueList.size()<=0){
return result; return result;
} }
idxBizFanPointVarCentralValue = idxBizFanPointVarCentralValueList.get(0); // 获取光伏趋势图与异常度
//健康指数来源测点信息 public HashMap<String, Object> getPvAlarmTrendAndAlarmAbnormalityList(IdxBizPvWarningRecord idxBizPvWarningRecord) {
HashMap<String,String> healthPointInfoMap = new HashMap<>(); HashMap<String, Object> result = new HashMap<>();
healthPointInfoMap.put("analysisPointName",idxBizFanPointVarCentralValue.getAnalysisPointName()); HashMap<String, List<String>> alarmTrendMap = new HashMap<>();
healthPointInfoMap.put("processPoint1Name",idxBizFanPointVarCentralValue.getProcessPoint1Name()); List<HashMap<String, String>> alarmAbnormalityList = new ArrayList<>();
healthPointInfoMap.put("processPoint2Name",idxBizFanPointVarCentralValue.getProcessPoint2Name()); Long analysisDate = idxBizPvWarningRecord.getRecDate().getTime() + 1000 * 60;
healthPointInfoMap.put("processPoint3Name",idxBizFanPointVarCentralValue.getProcessPoint3Name()); List<IdxBizPvHealthIndex> idxBizPvHealthIndexList = idxBizPvHealthIndexMapper.selectList(new QueryWrapper<IdxBizPvHealthIndex>()
result.put("healthPointInfo",healthPointInfoMap); .eq("GATEWAY_ID", idxBizPvWarningRecord.getGatewayId())
List<IdxBizFanPointProcessVariableClassification> idxBizFanPointProcessVariableClassificationList = idxBizFanPointProcessVariableClassificationMapper.selectList(new QueryWrapper<IdxBizFanPointProcessVariableClassification>().in("SEQUENCE_NBR",Arrays.asList(idxBizFanPointVarCentralValue.getAnalysisPointId(),idxBizFanPointVarCentralValue.getProcessPoint1Id(),idxBizFanPointVarCentralValue.getProcessPoint2Id(),idxBizFanPointVarCentralValue.getProcessPoint3Id()))); .eq("INDEX_ADDRESS", idxBizPvWarningRecord.getIndexAddress())
// List<IndicatorData> indicatorDataList = .le("ANALYSIS_TIME", DateUtil.formatDateTime(new Date(analysisDate)))
//当前值 .orderByDesc("ANALYSIS_TIME")
.last("limit 30"));
List<String> xDatas = new ArrayList<>();
List<String> yDatas = new ArrayList<>();
String startTime = "";
String endTime = "";
for (int i = idxBizPvHealthIndexList.size() - 1; i >= 0; i--) {
HashMap<String, String> alarmAbnormalityItem = new HashMap<>();
IdxBizPvHealthIndex idxBizPvHealthIndex = idxBizPvHealthIndexList.get(i);
xDatas.add(idxBizPvHealthIndex.getANALYSISTIME());
yDatas.add(String.valueOf(idxBizPvHealthIndex.getHealthIndex()));
alarmAbnormalityItem.put("time", idxBizPvHealthIndex.getANALYSISTIME());
alarmAbnormalityItem.put("abnormal", String.valueOf(idxBizPvHealthIndex.getANOMALY()));
alarmAbnormalityItem.put("healthValue", String.valueOf(idxBizPvHealthIndex.getHealthIndex()));
if (i == 0) {
endTime = idxBizPvHealthIndex.getANALYSISTIME();
}
if (i == 2) {
startTime = idxBizPvHealthIndex.getANALYSISTIME();
}
alarmAbnormalityList.add(alarmAbnormalityItem);
}
alarmTrendMap.put("xDatas", xDatas);
alarmTrendMap.put("yDatas", yDatas);
result.put("alarmTrend", alarmTrendMap);
// 异常度 alarmAbnormality
result.put("alarmAbnormalityList", alarmAbnormalityList.subList(alarmAbnormalityList.size() - 3, alarmAbnormalityList.size()));
result.put("startTime", startTime);
result.put("endTime", endTime);
return result;
}
//处理风机-相关性区间
public void handlerIdxBizFanPointVarCentralValue(List<IdxBizFanPointVarCentralValue> idxBizFanPointVarCentralValueList) {
idxBizFanPointVarCentralValueList.forEach(idxBizFanPointVarCentralValue1 -> {
if (ObjectUtils.isEmpty(idxBizFanPointVarCentralValue1.getProcess1Min())) {
idxBizFanPointVarCentralValue1.setProcess1Min(Double.NEGATIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizFanPointVarCentralValue1.getProcess2Min())) {
idxBizFanPointVarCentralValue1.setProcess2Min(Double.NEGATIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizFanPointVarCentralValue1.getProcess3Min())) {
idxBizFanPointVarCentralValue1.setProcess3Min(Double.NEGATIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizFanPointVarCentralValue1.getProcess1Max())) {
idxBizFanPointVarCentralValue1.setProcess1Max(Double.POSITIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizFanPointVarCentralValue1.getPorcess2Max())) {
idxBizFanPointVarCentralValue1.setPorcess2Max(Double.POSITIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizFanPointVarCentralValue1.getProcess3Max())) {
idxBizFanPointVarCentralValue1.setProcess3Max(Double.POSITIVE_INFINITY);
}
});
}
//处理光伏-相关性区间
public void handlerIdxBizPvPointVarCentralValue(List<IdxBizPvPointVarCentralValue> idxBizPvPointVarCentralValueList) {
idxBizPvPointVarCentralValueList.forEach(idxBizPvPointVarCentralValue1 -> {
if (ObjectUtils.isEmpty(idxBizPvPointVarCentralValue1.getProcess1Min())) {
idxBizPvPointVarCentralValue1.setProcess1Min(Double.NEGATIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizPvPointVarCentralValue1.getProcess2Min())) {
idxBizPvPointVarCentralValue1.setProcess2Min(Double.NEGATIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizPvPointVarCentralValue1.getProcess3Min())) {
idxBizPvPointVarCentralValue1.setProcess3Min(Double.NEGATIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizPvPointVarCentralValue1.getProcess1Max())) {
idxBizPvPointVarCentralValue1.setProcess1Max(Double.POSITIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizPvPointVarCentralValue1.getProcess2Max())) {
idxBizPvPointVarCentralValue1.setProcess2Max(Double.POSITIVE_INFINITY);
}
if (ObjectUtils.isEmpty(idxBizPvPointVarCentralValue1.getProcess3Max())) {
idxBizPvPointVarCentralValue1.setProcess3Max(Double.POSITIVE_INFINITY);
}
});
}
//训练值 //根据工况变量值获取分析变量的中心值、标准值、以及工况组合区间值-风机
public HashMap<String, String> getWorkingConditionCombinationIntervalFan(Double processPoint1Value, Double processPoint2Value, Double processPoint3Value, List<IdxBizFanPointVarCentralValue> idxBizFanPointVarCentralValueList) {
HashMap<String, String> result = new HashMap<>();
IdxBizFanPointVarCentralValue idxBizFanPointVarCentralValue = idxBizFanPointVarCentralValueList
.stream()
.filter(
idxBizFanPointVarCentralValue1 -> processPoint1Value >= idxBizFanPointVarCentralValue1.getProcess1Min() && processPoint1Value <= idxBizFanPointVarCentralValue1.getProcess1Max()
&& processPoint2Value >= idxBizFanPointVarCentralValue1.getProcess2Min() && processPoint2Value <= idxBizFanPointVarCentralValue1.getPorcess2Max()
&& processPoint3Value >= idxBizFanPointVarCentralValue1.getProcess3Min() && processPoint3Value <= idxBizFanPointVarCentralValue1.getProcess3Max()
).collect(Collectors.toList()).get(0);
//异常度 result.put("analysisCenterValue", String.valueOf(idxBizFanPointVarCentralValue.getAnalysisCenterValue()));
result.put("analysisStdDev", String.valueOf(idxBizFanPointVarCentralValue.getAnalysisStdDev()));
result.put("WorkingConditionCombinationInterval", (idxBizFanPointVarCentralValue.getProcess1Min() + ":" + idxBizFanPointVarCentralValue.getProcess1Max() + "," + idxBizFanPointVarCentralValue.getProcess2Min() + ":" + idxBizFanPointVarCentralValue.getPorcess2Max() + "," + idxBizFanPointVarCentralValue.getProcess3Min() + ":" + idxBizFanPointVarCentralValue.getProcess3Max()).
replace("Infinity", "∞"));
return result;
}
//根据工况变量值获取分析变量的中心值、标准值、以及工况组合区间值-光伏
public HashMap<String, String> getWorkingConditionCombinationIntervalPv(Double processPoint1Value, Double processPoint2Value, Double processPoint3Value, List<IdxBizPvPointVarCentralValue> idxBizPvPointVarCentralValueList) {
HashMap<String, String> result = new HashMap<>();
IdxBizPvPointVarCentralValue idxBizPvPointVarCentralValue = idxBizPvPointVarCentralValueList
.stream()
.filter(
idxBizFanPointVarCentralValue1 -> processPoint1Value >= idxBizFanPointVarCentralValue1.getProcess1Min() && processPoint1Value <= idxBizFanPointVarCentralValue1.getProcess1Max()
&& processPoint2Value >= idxBizFanPointVarCentralValue1.getProcess2Min() && processPoint2Value <= idxBizFanPointVarCentralValue1.getProcess2Max()
&& processPoint3Value >= idxBizFanPointVarCentralValue1.getProcess3Min() && processPoint3Value <= idxBizFanPointVarCentralValue1.getProcess3Max()
).collect(Collectors.toList()).get(0);
result.put("analysisCenterValue", String.valueOf(idxBizPvPointVarCentralValue.getAnalysisCenterValue()));
result.put("analysisStdDev", String.valueOf(idxBizPvPointVarCentralValue.getAnalysisStdDev()));
result.put("WorkingConditionCombinationInterval", (idxBizPvPointVarCentralValue.getProcess1Min() + ":" + idxBizPvPointVarCentralValue.getProcess1Max() + "," + idxBizPvPointVarCentralValue.getProcess2Min() + ":" + idxBizPvPointVarCentralValue.getProcess2Max() + "," + idxBizPvPointVarCentralValue.getProcess3Min() + ":" + idxBizPvPointVarCentralValue.getProcess3Max()).
replace("Infinity", "∞"));
return result; return result;
} }
//获取sourceInfoMap-风机
public HashMap<String, Object> getSourceInfoMapFan(IdxBizFanWarningRecord idxBizFanWarningRecord) {
List<IdxBizFanPointVarCorrelation> idxBizFanPointVarCorrelationList = idxBizFanPointVarCorrelationMapper
.selectList(new QueryWrapper<IdxBizFanPointVarCorrelation>().eq("EQUIPMENT_NAME", idxBizFanWarningRecord.getEquipmentName()));
Map<String, Double> idxBizFanPointVarCorrelationListValues = new HashMap<>();
TreeSet<String> anaylysisPonites = new TreeSet<>();
TreeSet<String> processPointes = new TreeSet<>();
idxBizFanPointVarCorrelationList.forEach(
idxBizFanPointVarCorrelation -> {
anaylysisPonites.add(idxBizFanPointVarCorrelation.getAnalysisPointName());
processPointes.add(idxBizFanPointVarCorrelation.getProcessPointName());
idxBizFanPointVarCorrelationListValues.put(idxBizFanPointVarCorrelation
.getAnalysisPointName() + "_" + idxBizFanPointVarCorrelation.getProcessPointName(), idxBizFanPointVarCorrelation.getCorrelationCoefficient());
}
);
HashMap<String, Object> sourceInfoMap = new HashMap<>();
sourceInfoMap.put("xDatas", processPointes);
sourceInfoMap.put("yDatas", anaylysisPonites);
sourceInfoMap.put("values", idxBizFanPointVarCorrelationListValues);
return sourceInfoMap;
}
@Override //获取sourceInfoMap-光伏
public Map<String, Object> getAlramInfoDetailOfPv(String id) { public HashMap<String, Object> getSourceInfoMapPv(IdxBizPvWarningRecord idxBizPvWarningRecord) {
return null; List<IdxBizPvPointVarCorrelation> idxBizPvPointVarCorrelationList = idxBizPvPointVarCorrelationMapper
.selectList(new QueryWrapper<IdxBizPvPointVarCorrelation>().eq("EQUIPMENT_NAME", idxBizPvWarningRecord.getEquipmentName()));
Map<String, Double> idxBizPvPointVarCorrelationListValues = new HashMap<>();
TreeSet<String> anaylysisPonites = new TreeSet<>();
TreeSet<String> processPointes = new TreeSet<>();
idxBizPvPointVarCorrelationList.forEach(
idxBizPvPointVarCorrelation -> {
anaylysisPonites.add(idxBizPvPointVarCorrelation.getAnalysisPointName());
processPointes.add(idxBizPvPointVarCorrelation.getProcessPointName());
idxBizPvPointVarCorrelationListValues.put(idxBizPvPointVarCorrelation
.getAnalysisPointName() + "_" + idxBizPvPointVarCorrelation.getProcessPointName(), idxBizPvPointVarCorrelation.getCorrelationCoefficient());
}
);
HashMap<String, Object> sourceInfoMap = new HashMap<>();
sourceInfoMap.put("xDatas", processPointes);
sourceInfoMap.put("yDatas", anaylysisPonites);
sourceInfoMap.put("values", idxBizPvPointVarCorrelationListValues);
return sourceInfoMap;
} }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
...@@ -17,6 +20,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableC ...@@ -17,6 +20,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableC
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvPointProcessVariableClassificationDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvPointProcessVariableClassificationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
...@@ -34,6 +41,7 @@ import org.springframework.data.elasticsearch.core.SearchHit; ...@@ -34,6 +41,7 @@ import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.SearchHits; import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.elasticsearch.core.query.Query; import org.springframework.data.elasticsearch.core.query.Query;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,6 +54,7 @@ import tech.tablesaw.api.Table; ...@@ -46,6 +54,7 @@ import tech.tablesaw.api.Table;
import java.io.File; import java.io.File;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -136,6 +145,12 @@ public class CommonServiceImpl { ...@@ -136,6 +145,12 @@ public class CommonServiceImpl {
@Autowired @Autowired
private ElasticsearchRestTemplate elasticsearchTemplate; private ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
private FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
private PvHealthIndexMapper pvHealthIndexMapper;
/** /**
* @return * @return
* @deprecated 获取工况变量列表风机 * @deprecated 获取工况变量列表风机
...@@ -1439,6 +1454,7 @@ public class CommonServiceImpl { ...@@ -1439,6 +1454,7 @@ public class CommonServiceImpl {
return; return;
} }
Date time = new Date(); Date time = new Date();
String format = DateUtil.format(time, DatePattern.NORM_DATETIME_PATTERN);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData();
Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId)); Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId));
...@@ -1622,7 +1638,7 @@ public class CommonServiceImpl { ...@@ -1622,7 +1638,7 @@ public class CommonServiceImpl {
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点"); query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点");
query.in(IdxBizFanHealthLevel::getStatus, stations); query.in(IdxBizFanHealthLevel::getStatus, stations);
List<IdxBizFanHealthLevel> idxBizFanHealthLevels = idxBizFanHealthLevelMapper.selectList(query); List<IdxBizFanHealthLevel> idxBizFanHealthLevels = idxBizFanHealthLevelMapper.selectList(query);
ArrayList<FanHealthIndex> fanHealthIndices1 = new ArrayList<>();
for (IdxBizFanPointProcessVariableClassification obj : list) { for (IdxBizFanPointProcessVariableClassification obj : list) {
for (int i = 0; i < analysisVariableIdArray.size(); i++) { for (int i = 0; i < analysisVariableIdArray.size(); i++) {
if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) { if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) {
...@@ -1654,10 +1670,22 @@ public class CommonServiceImpl { ...@@ -1654,10 +1670,22 @@ public class CommonServiceImpl {
} }
idxBizFanHealthIndex.setANALYSISTIME(DateUtils.getDateNowString()); idxBizFanHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizFanHealthIndexs.add(idxBizFanHealthIndex); idxBizFanHealthIndexs.add(idxBizFanHealthIndex);
FanHealthIndex fanHealthIndex = new FanHealthIndex();
BeanUtil.copyProperties(idxBizFanHealthIndex, fanHealthIndex);
fanHealthIndex.setWeight(idxBizFanHealthIndex.getWeigth());
fanHealthIndex.setAnomaly(idxBizFanHealthIndex.getANOMALY());
fanHealthIndex.setRecDate(DateUtil.now());
fanHealthIndex.setArea(idxBizFanHealthIndex.getArae());
fanHealthIndex.setAnalysisTime(DateUtil.now());
fanHealthIndex.setHealthLevel(fanHealthIndex.getHealthLevel());
fanHealthIndex.setKks(idxBizFanHealthIndex.getKks());
fanHealthIndex.setRecDate(format);
fanHealthIndices1.add(fanHealthIndex);
} }
} }
} }
idxBizFanHealthIndexService.saveBatch(idxBizFanHealthIndexs); idxBizFanHealthIndexService.saveBatch(idxBizFanHealthIndexs);
fanHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "fan_health_index_moment");
} }
try { try {
...@@ -1682,6 +1710,7 @@ public class CommonServiceImpl { ...@@ -1682,6 +1710,7 @@ public class CommonServiceImpl {
} }
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Date time = new Date(); Date time = new Date();
String format = DateUtil.format(time, DatePattern.NORM_DATETIME_PATTERN);
List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData();
Map<String, List<IdxBizPvPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizPvPointProcessVariableClassificationDto::getGatewayId)); Map<String, List<IdxBizPvPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizPvPointProcessVariableClassificationDto::getGatewayId));
// BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery(); // BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
...@@ -1843,6 +1872,7 @@ public class CommonServiceImpl { ...@@ -1843,6 +1872,7 @@ public class CommonServiceImpl {
List<IdxBizPvHealthIndex> idxBizPvHealthIndexs = new ArrayList<>(); List<IdxBizPvHealthIndex> idxBizPvHealthIndexs = new ArrayList<>();
ArrayList<PvHealthIndex> fanHealthIndices1 = new ArrayList<>();
for (IdxBizPvPointProcessVariableClassification obj : list) { for (IdxBizPvPointProcessVariableClassification obj : list) {
for (int i = 0; i < analysisVariableIdArray.size(); i++) { for (int i = 0; i < analysisVariableIdArray.size(); i++) {
if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) { if (analysisVariableIdArray.get(i).toString().equals(obj.getSequenceNbr())) {
...@@ -1868,10 +1898,22 @@ public class CommonServiceImpl { ...@@ -1868,10 +1898,22 @@ public class CommonServiceImpl {
idxBizPvHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i)); idxBizPvHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i));
idxBizPvHealthIndex.setANALYSISTIME(DateUtils.getDateNowString()); idxBizPvHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizPvHealthIndexs.add(idxBizPvHealthIndex); idxBizPvHealthIndexs.add(idxBizPvHealthIndex);
PvHealthIndex pvHealthIndex = new PvHealthIndex();
BeanUtil.copyProperties(idxBizPvHealthIndex, pvHealthIndex);
pvHealthIndex.setWeight(idxBizPvHealthIndex.getWeigth());
pvHealthIndex.setAnomaly(idxBizPvHealthIndex.getANOMALY());
pvHealthIndex.setRecDate(DateUtil.now());
pvHealthIndex.setArea(idxBizPvHealthIndex.getArae());
pvHealthIndex.setAnalysisTime(DateUtil.now());
pvHealthIndex.setHealthLevel(idxBizPvHealthIndex.getHealthLevel());
pvHealthIndex.setKks(idxBizPvHealthIndex.getKks());
pvHealthIndex.setRecDate(format);
fanHealthIndices1.add(pvHealthIndex);
} }
} }
} }
idxBizPvHealthIndexService.saveBatch(idxBizPvHealthIndexs); idxBizPvHealthIndexService.saveBatch(idxBizPvHealthIndexs);
pvHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "pv_health_index_moment");
} }
try { try {
logger.info("--------------------response: " + response); logger.info("--------------------response: " + response);
...@@ -1879,7 +1921,6 @@ public class CommonServiceImpl { ...@@ -1879,7 +1921,6 @@ public class CommonServiceImpl {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
healthStatusIndicatorService.healthWarningMinuteGF(calendar, time); healthStatusIndicatorService.healthWarningMinuteGF(calendar, time);
} }
......
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2; package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName);
} }
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2; package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> { public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
} }
...@@ -7,7 +7,7 @@ import java.io.Serializable; ...@@ -7,7 +7,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "fan_health_index", autoResultMap = true) @TableName(value = "fan_health_index_data", autoResultMap = true)
public class FanHealthIndex implements Serializable { public class FanHealthIndex implements Serializable {
private Long ts; private Long ts;
private String recDate; private String recDate;
......
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
* @date 2023-08-15 * @date 2023-08-15
*/ */
@Data @Data
@TableName(value = "pv_health_index", autoResultMap = true) @TableName(value = "pv_health_index_data", autoResultMap = true)
public class PvHealthIndex { public class PvHealthIndex {
private Long ts; private Long ts;
private String recDate; private String recDate;
......
...@@ -49,5 +49,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { ...@@ -49,5 +49,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select `value`,`value_f`, address, gateway_id from iot_data.indicator_data where ts > NOW()-10m and gateway_id = #{gatewayId}") @Select("select `value`,`value_f`, address, gateway_id from iot_data.indicator_data where ts > NOW()-10m and gateway_id = #{gatewayId}")
List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId); List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId);
@Select("select created_time,`value`,`value_f`, address, gateway_id from iot_data.indicator_data where gateway_id = #{gatewayId} and `address` in ( ${addresses} ) and ts >= #{startTime} and ts <= #{endTime}")
List<IndicatorData> selectDataByGatewayIdAndAddressForAlarmInfoDetail(@Param("gatewayId") String gatewayId,@Param("addresses") String addresses,@Param("startTime") String startTime, @Param("endTime") String endTime);
} }
...@@ -79,7 +79,7 @@ spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver ...@@ -79,7 +79,7 @@ spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
# 分析专用td数据库 analyse_data # 分析专用td数据库 analyse_data
#spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource #spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db4.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/analyse_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true spring.db4.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root spring.db4.datasource.username=root
spring.db4.datasource.password=taosdata spring.db4.datasource.password=taosdata
spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
......
...@@ -2,4 +2,34 @@ ...@@ -2,4 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper">
<insert id="saveBatchHealthIndexList">
insert into
<foreach collection="list" separator="," item="item" index="index">
${tableName}
using fan_health_index_data TAGS (#{item.analysisType})
values
(
now + #{index}a,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subSystem, jdbcType=VARCHAR},
#{item.number, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper> </mapper>
...@@ -2,4 +2,35 @@ ...@@ -2,4 +2,35 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper">
<insert id="saveBatchHealthIndexList">
insert into
<foreach collection="list" separator="," item="item" index="index">
${tableName}
using pv_health_index_data TAGS (#{item.analysisType})
values
(
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subarray, jdbcType=VARCHAR},
#{item.manufacturer, jdbcType=VARCHAR},
#{item.deviceType, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
)
</foreach>
</insert>
</mapper> </mapper>
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