Merge remote-tracking branch 'origin/liaoning' into liaoning
This commit is contained in:
@@ -47,6 +47,7 @@ import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -100,12 +101,13 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
private final DataLimitRateFeignClient dataLimitRateFeignClient;
|
||||
|
||||
private final DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
if(CollUtil.isEmpty(monitorIds)){
|
||||
if (CollUtil.isEmpty(monitorIds)) {
|
||||
throw new BusinessException(DeviceResponseEnum.QUERY_LINE_DATA_EMPTY);
|
||||
}
|
||||
List<DataVerify> dataVerifyList = commQuery(monitorIds, monitorBaseParam);
|
||||
@@ -135,9 +137,9 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
lambdaQueryWrapper.between(DataVerify::getTime, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
.in(DataVerify::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(DataVerify::getTime);
|
||||
if(StrUtil.isNotBlank(monitorBaseParam.getTargetKey())){
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
String[] target = monitorBaseParam.getTargetKey().split(SEPARATOR);
|
||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode,target[0]).eq(DataVerify::getIndexTable,target[1]);
|
||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode, target[0]).eq(DataVerify::getIndexTable, target[1]);
|
||||
}
|
||||
List<DataVerify> dataVerifyList = this.list(lambdaQueryWrapper);
|
||||
Map<String, List<DataVerify>> dataMap = dataVerifyList.stream().collect(Collectors.groupingBy(it -> it.getTime().format(DATE_FORMAT)));
|
||||
@@ -160,30 +162,30 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
Map<String,PqReasonableRangeDto> dtoMap = getStandRange();
|
||||
Map<String, PqReasonableRangeDto> dtoMap = getStandRange();
|
||||
|
||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<DataVerify> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(DataVerify::getTime, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())))
|
||||
.in(DataVerify::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(DataVerify::getTime);
|
||||
if(StrUtil.isNotBlank(monitorBaseParam.getTargetKey())){
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
String[] queryTarget = monitorBaseParam.getTargetKey().split(SEPARATOR);
|
||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode,queryTarget[0]).eq(DataVerify::getIndexTable,queryTarget[1]);
|
||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode, queryTarget[0]).eq(DataVerify::getIndexTable, queryTarget[1]);
|
||||
}
|
||||
|
||||
List<DataVerify> dataVerifyList = this.list(lambdaQueryWrapper);
|
||||
|
||||
Map<LocalDateTime, List<DataVerify>> listMap = dataVerifyList.stream().collect(Collectors.groupingBy(DataVerify::getTime,TreeMap::new,
|
||||
Map<LocalDateTime, List<DataVerify>> listMap = dataVerifyList.stream().collect(Collectors.groupingBy(DataVerify::getTime, TreeMap::new,
|
||||
Collectors.toList()));
|
||||
listMap.forEach((time, timeList) -> {
|
||||
Map<String, List<DataVerify>> indexMap = timeList.stream().collect(Collectors.groupingBy(it -> it.getIndexCode() + SEPARATOR + it.getIndexTable() + SEPARATOR + it.getIndexName()));
|
||||
indexMap.forEach((target, list) -> {
|
||||
String[] temKey = target.split(SEPARATOR);
|
||||
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(temKey[0] +SEPARATOR+ temKey[1]);
|
||||
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(temKey[0] + SEPARATOR + temKey[1]);
|
||||
String unit;
|
||||
if(StrUtil.isNotBlank(pqReasonableRangeDto.getUnit())){
|
||||
if (StrUtil.isNotBlank(pqReasonableRangeDto.getUnit())) {
|
||||
unit = pqReasonableRangeDto.getUnit();
|
||||
}else {
|
||||
} else {
|
||||
unit = "";
|
||||
}
|
||||
|
||||
@@ -194,7 +196,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
vo.setTargetName(temKey[2]);
|
||||
vo.setTargetKey(temKey[0] + temKey[1]);
|
||||
vo.setPhaseType(phaseKey);
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() +unit+ " ~ " + pqReasonableRangeDto.getMaxValue()+unit);
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
||||
valueList.forEach(it -> {
|
||||
switch (it.getValueType()) {
|
||||
case "AVG":
|
||||
@@ -310,6 +312,47 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(line.getVoltageDevOvertime())) {
|
||||
specialTargetList.add(line.getVoltageDevOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getFlickerOvertime())) {
|
||||
specialTargetList.add(line.getFlickerOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getUbalanceOvertime())) {
|
||||
specialTargetList.add(line.getUbalanceOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getFreqDevOvertime())) {
|
||||
specialTargetList.add(line.getFreqDevOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getINegOvertime())) {
|
||||
specialTargetList.add(line.getINegOvertime());
|
||||
}
|
||||
if (StrUtil.isNotBlank(line.getUaberranceOvertime())) {
|
||||
specialTargetList.add(line.getUaberranceOvertime());
|
||||
}
|
||||
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "uharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "iharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= 16; i++) {
|
||||
String uHarmKey = "inuharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(line, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(specialTargetList)) {
|
||||
@@ -343,77 +386,124 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
@Override
|
||||
public List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam) {
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result = new ArrayList<>();
|
||||
|
||||
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
|
||||
lineCountEvaluateParam.setLineId(Stream.of(monitorBaseParam.getMonitorIds().get(0)).collect(Collectors.toList()));
|
||||
lineCountEvaluateParam.setLineId(Collections.singletonList(monitorBaseParam.getMonitorIds().get(0)));
|
||||
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
|
||||
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchBeginTime());
|
||||
List<DataLimitRateDetailDto> dtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
|
||||
if (CollUtil.isEmpty(dtoList)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(dtoList)) {
|
||||
DataLimitRateDetailDto dto = dtoList.get(0);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
List<String> specialTargetList = new ArrayList<>();
|
||||
|
||||
if (monitorBaseParam.getTargetKey().equals(DicDataEnum.VOLTAGE_DEV.getCode())) {
|
||||
//电压偏差
|
||||
jsonArray = new JSONArray(dto.getVoltageDevOvertime());
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FLICKER.getCode())) {
|
||||
jsonArray = new JSONArray(dto.getFlickerOvertime());
|
||||
}else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.phase_Voltage.getCode())) {
|
||||
jsonArray = new JSONArray(dto.getUbalanceOvertime());
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FREQUENCY_DEV.getCode())) {
|
||||
jsonArray = new JSONArray(dto.getFreqDevOvertime());
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.NEG_CURRENT.getCode())) {
|
||||
jsonArray = new JSONArray(dto.getINegOvertime());
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.THD_V.getCode())) {
|
||||
jsonArray = new JSONArray(dto.getUaberranceOvertime());
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_VOLTAGE.getCode())) {
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "uharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(dto, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json+SEPARATOR+i);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_CURRENT.getCode())) {
|
||||
for (int i = 2; i <= 25; i++) {
|
||||
String uHarmKey = "iharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(dto, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json+SEPARATOR+i);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.INTERHARMONIC_VOLTAGE.getCode())) {
|
||||
for (int i = 1; i <= 16; i++) {
|
||||
String uHarmKey = "inuharm" + i + "Overtime";
|
||||
String json = getFieldValueForDetail(dto, uHarmKey);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
specialTargetList.add(json+SEPARATOR+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(specialTargetList)){
|
||||
for(String strJson : specialTargetList){
|
||||
String[] temStr = strJson.split(SEPARATOR);
|
||||
JSONArray jsonTem = new JSONArray(temStr[0]);
|
||||
dealJsonArr(jsonTem,result,monitorBaseParam,temStr[1]);
|
||||
}
|
||||
}else {
|
||||
dealJsonArr(jsonArray,result,monitorBaseParam,null);
|
||||
}
|
||||
DataLimitRateDetailDto dto = dtoList.get(0);
|
||||
Map<String, DictData> targetMap = getTargetMap();
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
processSingleTarget(dto, monitorBaseParam.getTargetKey(), targetMap, result);
|
||||
} else {
|
||||
processAllTargets(dto, targetMap, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, DictData> getTargetMap() {
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
return dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
||||
}
|
||||
|
||||
private void processSingleTarget(DataLimitRateDetailDto dto, String targetKey, Map<String, DictData> targetMap, List<DetailAbnormalVO.DetailLimitInnerVO> result) {
|
||||
if (!targetMap.containsKey(targetKey)) {
|
||||
throw new BusinessException("异常指标参数");
|
||||
}
|
||||
|
||||
String targetName = targetMap.get(targetKey).getName();
|
||||
List<String> specialTargetList = new ArrayList<>();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
|
||||
DicDataEnum targetEnum = DicDataEnum.getDicDataEnumValue(targetKey);
|
||||
switch (Objects.requireNonNull(targetEnum)) {
|
||||
case VOLTAGE_DEV:
|
||||
jsonArray = new JSONArray(dto.getVoltageDevOvertime());
|
||||
break;
|
||||
case FLICKER:
|
||||
jsonArray = new JSONArray(dto.getFlickerOvertime());
|
||||
break;
|
||||
case phase_Voltage:
|
||||
jsonArray = new JSONArray(dto.getUbalanceOvertime());
|
||||
break;
|
||||
case FREQUENCY_DEV:
|
||||
jsonArray = new JSONArray(dto.getFreqDevOvertime());
|
||||
break;
|
||||
case NEG_CURRENT:
|
||||
jsonArray = new JSONArray(dto.getINegOvertime());
|
||||
break;
|
||||
case THD_V:
|
||||
jsonArray = new JSONArray(dto.getUaberranceOvertime());
|
||||
break;
|
||||
case HARMONIC_VOLTAGE:
|
||||
collectHarmonicData(dto, "uharm", 2, 25, specialTargetList);
|
||||
break;
|
||||
case HARMONIC_CURRENT:
|
||||
collectHarmonicData(dto, "iharm", 2, 25, specialTargetList);
|
||||
break;
|
||||
case INTERHARMONIC_VOLTAGE:
|
||||
collectHarmonicData(dto, "inuharm", 1, 16, specialTargetList);
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("未支持的指标类型: " + targetKey);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(specialTargetList)) {
|
||||
processSpecialTargets(specialTargetList, result, targetName);
|
||||
} else {
|
||||
dealJsonArr(jsonArray, result, targetName, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void processAllTargets(DataLimitRateDetailDto dto, Map<String, DictData> targetMap,
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
|
||||
// 处理标准指标
|
||||
processStandardTarget(dto, targetMap, DicDataEnum.VOLTAGE_DEV.getCode(), dto.getVoltageDevOvertime(), result);
|
||||
processStandardTarget(dto, targetMap, DicDataEnum.FLICKER.getCode(), dto.getFlickerOvertime(), result);
|
||||
processStandardTarget(dto, targetMap, DicDataEnum.phase_Voltage.getCode(), dto.getUbalanceOvertime(), result);
|
||||
processStandardTarget(dto, targetMap, DicDataEnum.FREQUENCY_DEV.getCode(), dto.getFreqDevOvertime(), result);
|
||||
processStandardTarget(dto, targetMap, DicDataEnum.NEG_CURRENT.getCode(), dto.getINegOvertime(), result);
|
||||
processStandardTarget(dto, targetMap, DicDataEnum.THD_V.getCode(), dto.getUaberranceOvertime(), result);
|
||||
|
||||
// 处理谐波类指标
|
||||
processHarmonicTarget(dto, targetMap, DicDataEnum.HARMONIC_VOLTAGE.getCode(), "uharm", 2, 25, result);
|
||||
processHarmonicTarget(dto, targetMap, DicDataEnum.HARMONIC_CURRENT.getCode(), "iharm", 2, 25, result);
|
||||
processHarmonicTarget(dto, targetMap, DicDataEnum.INTERHARMONIC_VOLTAGE.getCode(), "inuharm", 1, 16, result);
|
||||
}
|
||||
private void processStandardTarget(DataLimitRateDetailDto dto, Map<String, DictData> targetMap,
|
||||
String targetCode, String data,
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
|
||||
if (StrUtil.isNotBlank(data)) {
|
||||
JSONArray jsonArray = new JSONArray(data);
|
||||
String targetName = targetMap.get(targetCode).getName();
|
||||
dealJsonArr(jsonArray, result, targetName, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void processHarmonicTarget(DataLimitRateDetailDto dto, Map<String, DictData> targetMap,
|
||||
String targetCode, String prefix, int start, int end,
|
||||
List<DetailAbnormalVO.DetailLimitInnerVO> result) {
|
||||
List<String> tempList = new ArrayList<>();
|
||||
String targetName = targetMap.get(targetCode).getName();
|
||||
collectHarmonicData(dto, prefix, start, end, tempList);
|
||||
processSpecialTargets(tempList, result, targetName);
|
||||
}
|
||||
|
||||
private void processSpecialTargets(List<String> specialTargetList, List<DetailAbnormalVO.DetailLimitInnerVO> result, String targetName) {
|
||||
for (String strJson : specialTargetList) {
|
||||
String[] temStr = strJson.split(SEPARATOR);
|
||||
JSONArray jsonTem = new JSONArray(temStr[0]);
|
||||
dealJsonArr(jsonTem, result, targetName, temStr[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理json数组
|
||||
*/
|
||||
private void dealJsonArr(JSONArray jsonArray,List<DetailAbnormalVO.DetailLimitInnerVO> result,MonitorBaseParam monitorBaseParam,String count){
|
||||
private void dealJsonArr(JSONArray jsonArray, List<DetailAbnormalVO.DetailLimitInnerVO> result, String targetName, String count) {
|
||||
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class);
|
||||
Map<String, List<JsonBaseVO>> jsonMap = jsonBaseVOList.stream().collect(Collectors.groupingBy(JsonBaseVO::getPhasic));
|
||||
jsonMap.forEach((phasic, list) -> {
|
||||
@@ -422,13 +512,13 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
vList.forEach(it -> {
|
||||
String[] timeArr = it.getTime().split(StrUtil.COMMA);
|
||||
String[] valArr = it.getValue().split(StrUtil.COMMA);
|
||||
for(int i = 0;i<timeArr.length;i++){
|
||||
for (int i = 0; i < timeArr.length; i++) {
|
||||
DetailAbnormalVO.DetailLimitInnerVO vo = new DetailAbnormalVO.DetailLimitInnerVO();
|
||||
vo.setTime(timeArr[i]);
|
||||
vo.setType(it.getValueType());
|
||||
vo.setVal(valArr[i]);
|
||||
vo.setPhaseType(phasic);
|
||||
vo.setTargetName(StrUtil.isNotBlank(count) ? count+monitorBaseParam.getTargetKey():monitorBaseParam.getTargetKey());
|
||||
vo.setTargetName(StrUtil.isNotBlank(count) ? count + "次" + targetName : targetName);
|
||||
result.add(vo);
|
||||
}
|
||||
});
|
||||
@@ -437,8 +527,6 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private List<DataVerify> commQuery(List<String> monitorIds, MonitorBaseParam monitorBaseParam) {
|
||||
LambdaQueryWrapper<DataVerify> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(DataVerify::getTime, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
@@ -515,13 +603,24 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
return verifyTargetVOList;
|
||||
}
|
||||
|
||||
private void collectHarmonicData(DataLimitRateDetailDto dto, String prefix, int start, int end, List<String> result) {
|
||||
for (int i = start; i <= end; i++) {
|
||||
String fieldName = prefix + i + "Overtime";
|
||||
String json = getFieldValueForDetail(dto, fieldName);
|
||||
if (StrUtil.isNotBlank(json)) {
|
||||
result.add(json + SEPARATOR + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Integer getFieldValue(DataLimitTargetDto dto, String fieldName) {
|
||||
try {
|
||||
Field field = DataLimitTargetDto.class.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
return (Integer) field.get(dto);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
logger.error("反射方法异常:{}", e.getMessage());
|
||||
logger.error("DataLimitTarget反射方法异常:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -532,7 +631,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
field.setAccessible(true);
|
||||
return (String) field.get(dto);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
logger.error("反射方法异常:{}", e.getMessage());
|
||||
logger.error("DataLimitRateDetail反射方法异常:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -547,7 +646,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
Collectors.mapping(DataLimitTargetDto::getLineId, Collectors.collectingAndThen(Collectors.toSet(), Set::size))));
|
||||
for (DateTime dateTime : ranged) {
|
||||
Map<String, Object> rangeMap = new HashMap<>();
|
||||
String time = DateUtil.format(dateTime,DATE_FORMAT);
|
||||
String time = DateUtil.format(dateTime, DATE_FORMAT);
|
||||
rangeMap.put("time", time);
|
||||
rangeMap.put("val", map.getOrDefault(time, 0));
|
||||
result.add(rangeMap);
|
||||
@@ -584,7 +683,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
Collectors.mapping(DataVerify::getLineId, Collectors.collectingAndThen(Collectors.toSet(), Set::size))));
|
||||
for (DateTime dateTime : ranged) {
|
||||
Map<String, Object> rangeMap = new HashMap<>();
|
||||
String time = DateUtil.format(dateTime,DATE_FORMAT);
|
||||
String time = DateUtil.format(dateTime, DATE_FORMAT);
|
||||
rangeMap.put("time", time);
|
||||
rangeMap.put("val", map.getOrDefault(time, 0));
|
||||
result.add(rangeMap);
|
||||
@@ -619,8 +718,8 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
*/
|
||||
public List<VerifyTargetVO> getAbnormalTarget(List<DataVerify> dataVerifyList) {
|
||||
Map<String, Set<String>> dataMap = dataVerifyList.stream().collect(Collectors.groupingBy(it ->
|
||||
it.getIndexCode() +SEPARATOR+ it.getIndexTable(), Collectors.mapping(DataVerify::getLineId, Collectors.toSet())));
|
||||
Map<String,PqReasonableRangeDto> rangeMap = getStandRange();
|
||||
it.getIndexCode() + SEPARATOR + it.getIndexTable(), Collectors.mapping(DataVerify::getLineId, Collectors.toSet())));
|
||||
Map<String, PqReasonableRangeDto> rangeMap = getStandRange();
|
||||
//正序、负序和零序电压
|
||||
List<VerifyTargetVO> result = new ArrayList<>();
|
||||
dataMap.forEach((key, num) -> {
|
||||
@@ -637,27 +736,27 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
Map.Entry<String, PqReasonableRangeDto> entry = iterator.next();
|
||||
if (!vMap.containsKey(entry.getKey())) {
|
||||
PqReasonableRangeDto dto = entry.getValue();
|
||||
assembleEntity(new HashSet<>(),dto,result);
|
||||
assembleEntity(new HashSet<>(), dto, result);
|
||||
}
|
||||
}
|
||||
return result.stream().sorted(Comparator.comparing(VerifyTargetVO::getSort)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
*组装实体
|
||||
* 组装实体
|
||||
*/
|
||||
private void assembleEntity(Set<String> ids, PqReasonableRangeDto dto, List<VerifyTargetVO> result) {
|
||||
VerifyTargetVO verifyTargetVO = new VerifyTargetVO();
|
||||
verifyTargetVO.setKey(dto.getIndexCode() +SEPARATOR+ dto.getInfluxdbTableName());
|
||||
verifyTargetVO.setKey(dto.getIndexCode() + SEPARATOR + dto.getInfluxdbTableName());
|
||||
verifyTargetVO.setTargetName(dto.getIndexName());
|
||||
verifyTargetVO.setIds(ids);
|
||||
verifyTargetVO.setRemark(dto.getRemark());
|
||||
verifyTargetVO.setSort(dto.getSort());
|
||||
String unit = "";
|
||||
if(StrUtil.isNotBlank(dto.getUnit())){
|
||||
String unit = "";
|
||||
if (StrUtil.isNotBlank(dto.getUnit())) {
|
||||
unit = dto.getUnit();
|
||||
}
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue()+unit + " ~ " + dto.getMaxValue()+unit);
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + unit);
|
||||
result.add(verifyTargetVO);
|
||||
}
|
||||
|
||||
@@ -665,11 +764,11 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
/**
|
||||
* 获取异常范围标准
|
||||
*/
|
||||
private Map<String, PqReasonableRangeDto> getStandRange(){
|
||||
private Map<String, PqReasonableRangeDto> getStandRange() {
|
||||
DataCleanParam dataCleanParam = new DataCleanParam();
|
||||
dataCleanParam.setSystemType(DataCleanEnum.Pqs.getCode());
|
||||
List<PqReasonableRangeDto> pqReasonableRangeDtoList = pqReasonableRangeFeignClient.getData(dataCleanParam).getData();
|
||||
return pqReasonableRangeDtoList.stream().collect(Collectors.toMap(it -> it.getIndexCode() +SEPARATOR+ it.getInfluxdbTableName(), Function.identity()));
|
||||
return pqReasonableRangeDtoList.stream().collect(Collectors.toMap(it -> it.getIndexCode() + SEPARATOR + it.getInfluxdbTableName(), Function.identity()));
|
||||
}
|
||||
|
||||
|
||||
@@ -678,35 +777,29 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
Map<String, List<DataVerify>> dataMap = dataVerifyList.stream().collect(Collectors.groupingBy(DataVerify::getLineId));
|
||||
dataMap.forEach((key, list) -> {
|
||||
List<LocalDate> dateList = list.stream().map(it -> it.getTime().toLocalDate()).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam,dateList,result,key);
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public List<PowerQualityIndicatorsVO> getLimitTable(List<DataLimitTargetDto> dataVerifyList, MonitorBaseParam monitorBaseParam) {
|
||||
List<PowerQualityIndicatorsVO> result = new ArrayList<>();
|
||||
Map<String, List<DataLimitTargetDto>> dataMap = dataVerifyList.stream().collect(Collectors.groupingBy(DataLimitTargetDto::getLineId));
|
||||
dataMap.forEach((key, list) -> {
|
||||
List<LocalDate> dateList = list.stream().map(DataLimitTargetDto::getTime).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList());
|
||||
processTable(monitorBaseParam,dateList,result,key);
|
||||
processTable(monitorBaseParam, dateList, result, key);
|
||||
});
|
||||
dealTableResult(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断测点是否存在连续异常数据
|
||||
*/
|
||||
private void processTable(MonitorBaseParam monitorBaseParam,List<LocalDate> dateList,List<PowerQualityIndicatorsVO> result,String lineId) {
|
||||
private void processTable(MonitorBaseParam monitorBaseParam, List<LocalDate> dateList, List<PowerQualityIndicatorsVO> result, String lineId) {
|
||||
Integer warnDay = monitorBaseParam.getWarnDayLimit();
|
||||
Integer alarmDay = monitorBaseParam.getAlarmDayLimit();
|
||||
//检查是否有连续指定天数的告警
|
||||
@@ -725,7 +818,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
}
|
||||
}
|
||||
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result){
|
||||
private void dealTableResult(List<PowerQualityIndicatorsVO> result) {
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
List<SysDicTreePO> dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData();
|
||||
Map<String, SysDicTreePO> sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||
@@ -758,6 +851,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
|
||||
/**
|
||||
* 检查日期列表中是否存在连续指定天数的异常
|
||||
*
|
||||
* @param dateList 日期列表(已排序)
|
||||
* @param day 连续天数阈值
|
||||
* @return 是否存在连续异常
|
||||
@@ -779,6 +873,4 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user