diff --git a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/assess/impl/SecondaryEvaluationServiceImpl.java b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/assess/impl/SecondaryEvaluationServiceImpl.java index 1105601bc..bf2bb81d9 100644 --- a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/assess/impl/SecondaryEvaluationServiceImpl.java +++ b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/assess/impl/SecondaryEvaluationServiceImpl.java @@ -565,7 +565,7 @@ public class SecondaryEvaluationServiceImpl implements SecondaryEvaluationServic unblance.add(evaluationResult); evaluationResult = new AssessResultVO.EvaluationResult(); - evaluationResult.setData(result.getApproUnblance().multiply(BigDecimal.valueOf(200))); + evaluationResult.setData(result.getApproUnblance()); evaluationResult.setLimitData(overLimit.getUnblance()); evaluationResult.setIsQualified(NumberUtil.isLess(evaluationResult.getData(), evaluationResult.getLimitData())); unblance.add(evaluationResult); diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/dataClean/MonitorBaseParam.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/dataClean/MonitorBaseParam.java index c989fd082..94dbda7c7 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/dataClean/MonitorBaseParam.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/dataClean/MonitorBaseParam.java @@ -41,4 +41,6 @@ public class MonitorBaseParam extends BaseParam { @ApiModelProperty(value = "监测点运行状态") private Integer lineRunFlag; + @ApiModelProperty(value = "异常天数时间") + private List time; } diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/DetailAbnormalVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/DetailAbnormalVO.java index a5b4769ac..2cd12db7b 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/DetailAbnormalVO.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/dataClean/DetailAbnormalVO.java @@ -17,6 +17,8 @@ public class DetailAbnormalVO { private String date; + private List dateList; + private String monitorName; private String bdName; @@ -58,6 +60,15 @@ public class DetailAbnormalVO { } + @Data + public static class DetailAbnormalCountVO { + + private Integer timeSum; + private Integer errCount; + private List time; + } + + @Data public static class DetailLimitInnerVO{ diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DataVerifyController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DataVerifyController.java index 5d40a8433..6fef50296 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DataVerifyController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DataVerifyController.java @@ -86,9 +86,9 @@ public class DataVerifyController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/monitorAbnormalTableDetail") @ApiOperation("弹框-获取异常监测点列表详情") - public HttpResult> monitorAbnormalTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){ + public HttpResult monitorAbnormalTableDetail(@RequestBody MonitorBaseParam monitorBaseParam) { String methodDescribe = getMethodDescribe("monitorAbnormalTableDetail"); - List list = iPqDataVerifyBakService.monitorAbnormalTableDetail(monitorBaseParam); + DetailAbnormalVO.DetailAbnormalCountVO list = iPqDataVerifyBakService.monitorAbnormalTableDetail(monitorBaseParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqDataVerifyBakService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqDataVerifyBakService.java index 7df6823d3..84ba58c83 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqDataVerifyBakService.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/IPqDataVerifyBakService.java @@ -27,8 +27,7 @@ public interface IPqDataVerifyBakService extends IService { List monitorAbnormalTable(MonitorBaseParam monitorBaseParam); - - List monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam); + DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam); diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java index 5c970d491..477b58d69 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DataVerifyServiceImpl.java @@ -672,6 +672,7 @@ public class DataVerifyServiceImpl extends ServiceImpl targetMap, String targetCode, String data, List result) { @@ -976,7 +977,7 @@ public class DataVerifyServiceImpl extends ServiceImpl dateList = list.stream().map(it -> it.getTime().toLocalDate()).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList()); processTable(monitorBaseParam, dateList, result, key); }); - dealTableResult(result); + dealTableResult(result, monitorBaseParam.getSearchValue()); return result; } @@ -988,7 +989,7 @@ public class DataVerifyServiceImpl extends ServiceImpl dateList = list.stream().map(DataLimitTargetDto::getTime).distinct().sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList()); processTable(monitorBaseParam, dateList, result, key); }); - dealTableResult(result); + dealTableResult(result, monitorBaseParam.getSearchValue()); return result; } @@ -1015,34 +1016,40 @@ public class DataVerifyServiceImpl extends ServiceImpl result) { + private void dealTableResult(List result, String searchValue) { if (CollUtil.isNotEmpty(result)) { - List dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData(); - Map sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity())); +// List dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData(); +// Map sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity())); List ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList()); - List areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null); - Map areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity())); + List areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null); + Map areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity())); - List objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList()); - List userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData(); - Map userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity())); - result.forEach(it -> { - if (areaMap.containsKey(it.getMonitorId())) { - AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId()); - it.setMonitorName(areaLineInfoVO.getLineName()); - it.setStationName(areaLineInfoVO.getSubName()); - it.setDevName(areaLineInfoVO.getDeviceName()); - it.setVoltageLevel(areaLineInfoVO.getVoltageScale()); - it.setIp(Base64.encode(areaLineInfoVO.getIp())); - it.setManufacturer(areaLineInfoVO.getManufacturer()); - if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) { - it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName()); - } - if (userMap.containsKey(areaLineInfoVO.getObjId())) { - it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName()); - } +// List objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList()); +// List userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData(); +// Map userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity())); + List info = new ArrayList<>(); + for (AreaLineInfoVO lineDetail : areaLineInfoVOList) { + if (areaMap.containsKey(lineDetail.getLineId())) { + PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId()); + it.setMonitorName(lineDetail.getLineName()); + it.setStationName(lineDetail.getSubName()); + it.setDevName(lineDetail.getDeviceName()); + it.setVoltageLevel(lineDetail.getVoltageScale()); + it.setIp(Base64.encode(lineDetail.getIp())); + it.setManufacturer(lineDetail.getManufacturer()); + it.setObjType(lineDetail.getLoadType()); + it.setObjName(lineDetail.getObjName()); + info.add(it); +// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) { +// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName()); +// } +// if (userMap.containsKey(areaLineInfoVO.getObjId())) { +// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName()); +// } } - }); + } + result.clear(); + result.addAll(info); } } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java index 55cd46824..aa874f0f8 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqDataVerifyBakServiceImpl.java @@ -33,10 +33,7 @@ import com.njcn.device.pq.service.CommTerminalService; import com.njcn.device.pq.service.IPqDataVerifyBakService; import com.njcn.oss.utils.FileStorageUtil; import com.njcn.supervision.api.UserLedgerFeignClient; -import com.njcn.supervision.pojo.vo.user.NewUserReportVO; import com.njcn.system.api.DictTreeFeignClient; -import com.njcn.system.enums.DicDataEnum; -import com.njcn.system.pojo.po.SysDicTreePO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -94,7 +91,6 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl())); verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>())); verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(new ArrayList<>(), monitorBaseParam)); @@ -111,7 +107,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl dateList = list.stream().map(PqDataVerifyBak::getTimeId).sorted(Comparator.comparing(Function.identity())).collect(Collectors.toList()); processTable(monitorBaseParam, dateList, result, key); }); - dealTableResult(result); + dealTableResult(result, monitorBaseParam.getSearchValue()); return result; } @@ -137,34 +133,40 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl result) { + private void dealTableResult(List result, String searchValue) { if (CollUtil.isNotEmpty(result)) { - List dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData(); - Map sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity())); +// List dicTreePOList = dictTreeFeignClient.queryAllByType(Integer.valueOf(DicDataEnum.Obj_Type.getCode())).getData(); +// Map sysDicTreePOMap = dicTreePOList.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity())); List ids = result.stream().map(PowerQualityIndicatorsVO::getMonitorId).distinct().collect(Collectors.toList()); - List areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null); - Map areaMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity())); + List areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, searchValue, null); + Map areaMap = result.stream().collect(Collectors.toMap(PowerQualityIndicatorsVO::getMonitorId, Function.identity())); - List objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList()); - List userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData(); - Map userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity())); - result.forEach(it -> { - if (areaMap.containsKey(it.getMonitorId())) { - AreaLineInfoVO areaLineInfoVO = areaMap.get(it.getMonitorId()); - it.setMonitorName(areaLineInfoVO.getLineName()); - it.setStationName(areaLineInfoVO.getSubName()); - it.setDevName(areaLineInfoVO.getDeviceName()); - it.setVoltageLevel(areaLineInfoVO.getVoltageScale()); - it.setIp(Base64.encode(areaLineInfoVO.getIp())); - it.setManufacturer(areaLineInfoVO.getManufacturer()); - if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) { - it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName()); - } - if (userMap.containsKey(areaLineInfoVO.getObjId())) { - it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName()); - } +// List objIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getObjId).distinct().collect(Collectors.toList()); +// List userLedgerVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData(); +// Map userMap = userLedgerVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity())); + List info = new ArrayList<>(); + for (AreaLineInfoVO lineDetail : areaLineInfoVOList) { + if (areaMap.containsKey(lineDetail.getLineId())) { + PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId()); + it.setMonitorName(lineDetail.getLineName()); + it.setStationName(lineDetail.getSubName()); + it.setDevName(lineDetail.getDeviceName()); + it.setVoltageLevel(lineDetail.getVoltageScale()); + it.setIp(Base64.encode(lineDetail.getIp())); + it.setManufacturer(lineDetail.getManufacturer()); + it.setObjType(lineDetail.getLoadType()); + it.setObjName(lineDetail.getObjName()); + info.add(it); +// if (sysDicTreePOMap.containsKey(areaLineInfoVO.getSmallObjType())) { +// it.setObjType(sysDicTreePOMap.get(areaLineInfoVO.getSmallObjType()).getName()); +// } +// if (userMap.containsKey(areaLineInfoVO.getObjId())) { +// it.setObjName(userMap.get(areaLineInfoVO.getObjId()).getProjectName()); +// } } - }); + } + result.clear(); + result.addAll(info); } } @@ -267,97 +269,29 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl dataVerifyList = this.list(lambdaQueryWrapper); - for (PqDataVerifyBak pqDataVerifyBak : dataVerifyList) { - LineDetailDataVO lineDevGetDTO = lineDetailMap.get(pqDataVerifyBak.getLineId()); + Map> VerifyMap = dataVerifyList.stream().collect(Collectors.groupingBy(PqDataVerifyBak::getLineId)); + VerifyMap.forEach((key, value) -> { + LineDetailDataVO lineDevGetDTO = lineDetailMap.get(key); String temBgName = ""; if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG.getCode())) { temBgName = lineDevGetDTO.getBdName(); } else if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())) { temBgName = lineDevGetDTO.getObjName(); } - try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) { - JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig())); - String[] errorTimeCount = {"0"}; - Long[] errAllCount = {0L}; - jsonArray.forEach(it -> { - JSONObject targetJson = (JSONObject) it; - if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) { - if (targetJson.containsKey(monitorBaseParam.getTargetKey())) { - JSONArray innerJson = targetJson.getJSONArray(monitorBaseParam.getTargetKey()); - PqReasonableRangeDto dto = rangeMap.get(monitorBaseParam.getTargetKey()); - if (Objects.nonNull(dto.getHarmStart()) && Objects.nonNull(dto.getHarmEnd())) { - errorTimeCount[0] = targetJson.get("errorTimes").toString(); - for (Object oJson : innerJson) { - JSONObject jsonObjectTem = (JSONObject) oJson; - JSONArray list = jsonObjectTem.getJSONArray("list"); - list.forEach(listItem -> { - JSONObject object = (JSONObject) listItem; - long errCount = Long.parseLong(object.get("errorCounts").toString()); - errAllCount[0] += errCount; - }); - } - } else { - for (Object oJson : innerJson) { - JSONObject jsonObjectTem = (JSONObject) oJson; - JSONArray list = jsonObjectTem.getJSONArray("list"); - list.forEach(listItem -> { - JSONObject object = (JSONObject) listItem; - long errCount = Long.parseLong(object.get("errorCounts").toString()); - errAllCount[0] += errCount; - }); - errorTimeCount[0] = jsonObjectTem.get("errorTimes").toString(); - } - } - } - } else { - rangeMap.forEach((rangeKey, val) -> { - if (targetJson.containsKey(rangeKey)) { - JSONArray innerJson = targetJson.getJSONArray(rangeKey); - for (Object oJson : innerJson) { - JSONObject jsonObjectTem = (JSONObject) oJson; - JSONArray list = jsonObjectTem.getJSONArray("list"); - list.forEach(listItem -> { - JSONObject object = (JSONObject) listItem; - long errCount = Long.parseLong(object.get("errorCounts").toString()); - errAllCount[0] += errCount; - }); - } - } - }); - if (targetJson.containsKey("lineErrorTimes")) { - errorTimeCount[0] = targetJson.get("lineErrorTimes").toString(); - } - } - }); - DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO(); - detailAbnormalVO.setTimeSum(errorTimeCount[0]); - detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))); - detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName()); - detailAbnormalVO.setBdName(temBgName); - detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId()); - detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey()); - detailAbnormalVO.setErrCount(errAllCount[0].toString()); - result.add(detailAbnormalVO); - } catch (BusinessException b) { - //文件为空时候的特殊处理 - DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO(); - detailAbnormalVO.setTimeSum("/"); - detailAbnormalVO.setDate(pqDataVerifyBak.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))); - detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName()); - detailAbnormalVO.setBdName(temBgName); - detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId()); - detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey()); - result.add(detailAbnormalVO); - } catch (Exception e) { - throw new BusinessException("数据异常"); - } - } + DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO(); + detailAbnormalVO.setDateList(value.stream().map(x -> x.getTimeId().format(DatePattern.NORM_DATE_FORMATTER)).collect(Collectors.toList())); + detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName()); + detailAbnormalVO.setBdName(temBgName); + detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId()); + detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey()); + result.add(detailAbnormalVO); + }); return result; } @Override - public List monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) { + public DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) { Map dtoMap = getStandRange(); if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) { if (!dtoMap.containsKey(monitorBaseParam.getTargetKey())) { @@ -366,44 +300,50 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl result = new ArrayList<>(); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime()))) - .in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(PqDataVerifyBak::getTimeId); + lambdaQueryWrapper.in(PqDataVerifyBak::getTimeId, monitorBaseParam.getTime()) + .in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds()); - PqDataVerifyBak pqDataVerifyBak = this.getOne(lambdaQueryWrapper); - try (InputStream fileStream = fileStorageUtil.getFileStream(pqDataVerifyBak.getPath())) { - JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig())); - for (Object it : jsonArray) { - JSONObject targetJson = (JSONObject) it; - if (targetJson.containsKey("lineErrorTimes")) { - continue; - } - if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) { - if (targetJson.containsKey(monitorBaseParam.getTargetKey())) { - resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result); - break; - } - } else { - String tarKey = ""; - for (Map.Entry entry : dtoMap.entrySet()) { - String key = entry.getKey(); - if (targetJson.containsKey(key)) { - tarKey = key; - break; + List pqDataVerifyBak = this.list(lambdaQueryWrapper); + Integer[] errorTimeCount = {0}; + Integer[] errAllCount = {0}; + for (PqDataVerifyBak dataVerifyBak : pqDataVerifyBak) { + try (InputStream fileStream = fileStorageUtil.getFileStream(dataVerifyBak.getPath())) { + JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig())); + jsonArray.forEach(it->{ + JSONObject targetJson = (JSONObject) it; + if (targetJson.containsKey("lineErrorTimes")) { + errorTimeCount[0] += Integer.valueOf(targetJson.get("lineErrorTimes").toString()); + }else{ + if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) { + if (targetJson.containsKey(monitorBaseParam.getTargetKey())) { + resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result, dataVerifyBak.getTimeId().toString(), errAllCount); + } + } else { + String tarKey = ""; + for (Map.Entry entry : dtoMap.entrySet()) { + String key = entry.getKey(); + if (targetJson.containsKey(key)) { + tarKey = key; + } + } + resultDeal(dtoMap, tarKey, targetJson, result, dataVerifyBak.getTimeId().toString(), errAllCount); } } - resultDeal(dtoMap, tarKey, targetJson, result); - } + }); + } catch (Exception e) { + throw new BusinessException("数据异常" + e); } - } catch (Exception e) { - throw new BusinessException("数据异常"); } // 排序实现 - result = result.stream() - .sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime) + DetailAbnormalVO.DetailAbnormalCountVO info = new DetailAbnormalVO.DetailAbnormalCountVO(); + info.setTimeSum(errorTimeCount[0]); + info.setErrCount(errAllCount[0]); + info.setTime(result.stream() + .sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName) .thenComparing(vo -> extractHarmonicOrder(vo.getTargetName())) - .thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName)) - .collect(Collectors.toList()); - return result; + .thenComparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTime)) + .collect(Collectors.toList())); + return info; } @@ -431,12 +371,13 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl dtoMap, String targetKey, JSONObject targetJson, List result) { + private void resultDeal(Map dtoMap, String targetKey, JSONObject targetJson, List result, String date, Integer[] errorCounts) { PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(targetKey); JSONArray innerJson = targetJson.getJSONArray(targetKey); innerJson.forEach(oo -> { JSONObject jsonObjectTem = (JSONObject) oo; String targetName = jsonObjectTem.get("targetName").toString(); + errorCounts[0] += Integer.valueOf(jsonObjectTem.get("errorCounts").toString()); JSONArray list = jsonObjectTem.getJSONArray("list"); List temList = new ArrayList<>(); list.forEach(listItem -> { @@ -447,7 +388,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl { switch (ites.getType()) { case "AVG": @@ -686,12 +627,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl