潘志宝
2025-01-14 8fd9f6efcb6575d68d39302efe046558d8b1534c
预测值
已修改2个文件
23 ■■■■■ 文件已修改
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataViewRespDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/dto/PreDataViewRespDTO.java
@@ -110,4 +110,7 @@
    @Schema(description = "预警信息")
    private List<AlarmMessageRespDTO> alarmList;
    @Schema(description = "预警信息")
    private String alarmMessage;
}
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -318,10 +318,10 @@
        }
        String timeFormat = StringUtils.isBlank(reqVO.getTimeFormat()) ? DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND : reqVO.getTimeFormat();
        PreLineTypeEnum lineType = chartParams.get(CommonConstant.LINE_TYPE) == null ? PreLineTypeEnum.TN : PreLineTypeEnum.getEumByCode(chartParams.get(CommonConstant.LINE_TYPE));
        BigDecimal rangeH = chartParams.get(CommonConstant.RANGE_H) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.RANGE_H));
        BigDecimal rangeL = chartParams.get(CommonConstant.RANGE_L) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.RANGE_L));
        BigDecimal limitH = chartParams.get(CommonConstant.LIMIT_H) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.LIMIT_H));
        BigDecimal limitL = chartParams.get(CommonConstant.LIMIT_L) == null ? BigDecimal.ZERO : new BigDecimal(chartParams.get(CommonConstant.LIMIT_L));
        BigDecimal rangeH = chartParams.get(CommonConstant.RANGE_H) == null ? null : new BigDecimal(chartParams.get(CommonConstant.RANGE_H));
        BigDecimal rangeL = chartParams.get(CommonConstant.RANGE_L) == null ? null : new BigDecimal(chartParams.get(CommonConstant.RANGE_L));
        BigDecimal limitH = chartParams.get(CommonConstant.LIMIT_H) == null ? null : new BigDecimal(chartParams.get(CommonConstant.LIMIT_H));
        BigDecimal limitL = chartParams.get(CommonConstant.LIMIT_L) == null ? null : new BigDecimal(chartParams.get(CommonConstant.LIMIT_L));
        int lengthLeft = chartParams.get(CommonConstant.LENGTH_LEFT) == null ? predictItem.getPredictLength() : new BigDecimal(chartParams.get(CommonConstant.LENGTH_LEFT)).intValue();
        int lengthRight = chartParams.get(CommonConstant.LENGTH_RIGHT) == null ? predictItem.getPredictLength() : new BigDecimal(chartParams.get(CommonConstant.LENGTH_RIGHT)).intValue();
@@ -346,7 +346,7 @@
        } else {
            dataView.setRealData(new ArrayList<>());
        }
        dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat));
        // dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat));
        switch (lineType) {
            case TN:
                dataView.setPreDataN(mmItemResultService.getData(outPut.getId(), startTime, endTime, timeFormat));
@@ -359,18 +359,24 @@
                break;
        }
        if (!CollectionUtils.isEmpty(dataView.getCurData())) {
            List<Double> curList = dataView.getCurData().stream().map(t -> {
        if (!CollectionUtils.isEmpty(dataView.getPreDataN())) {
            List<Double> curList = dataView.getPreDataN().stream().map(t -> {
                return new Double(t[1].toString());
            }).collect(Collectors.toList());
            dataView.setPreMax(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP));
            dataView.setPreMin(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP));
            dataView.setPreLast(new BigDecimal(curList.get(curList.size() - 1)));
        }
        String alarmObj = chartParams.get(CommonConstant.ALARM_OBJ);
        if (StringUtils.isNotBlank(alarmObj)) {
            List<AlarmMessageRespDTO> alarmList = ConvertUtils.sourceToTarget(mmPredictAlarmMessageService.getList(alarmObj, predictTime), AlarmMessageRespDTO.class);
            dataView.setAlarmList(alarmList);
            if (CollectionUtils.isEmpty(alarmList)) {
                dataView.setAlarmMessage("暂无预警信息");
            } else {
                dataView.setAlarmMessage(alarmList.get(0).getContent());
            }
        }
        result.setPredictTime(predictTime);