潘志宝
9 天以前 a24de973ac4965ae4239e4fdbf155ec2ac96f24a
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -386,6 +386,7 @@
        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();
        int decimalPlaces = chartParams.get(CommonConstant.DECIMAL_PLACES) == null ? 3 : new BigDecimal(chartParams.get(CommonConstant.DECIMAL_PLACES)).intValue();
        Date[] timeArray = calResultTime(predictItem, reqVO.getStartTime(), reqVO.getEndTime(), lengthLeft, lengthRight);
        Date predictTime = timeArray[0];
@@ -403,30 +404,35 @@
        dataView.setRangeL(rangeL);
        dataView.setLimitH(limitH);
        dataView.setLimitL(limitL);
        Map<String, Object> realDataMap = new HashMap<>();
        if (StringUtils.isNotBlank(outPut.getPointid())) {
            dataView.setRealData(getHisData(outPut.getPointid(), startTime, endTime, timeFormat));
            dataView.getRealData().forEach(item -> {
                realDataMap.put(item[0].toString(), item[1]);
            });
        } else {
            dataView.setRealData(new ArrayList<>());
        }
        if (!CollectionUtils.isEmpty(realDataMap)) {
            Object curReal = realDataMap.get(DateUtils.format(predictTime, timeFormat)) == null ?
                    dataView.getRealData().get(dataView.getRealData().size() - 1) : realDataMap.get(DateUtils.format(predictTime, timeFormat));
            // 当前值T0 + 当前预测值 20250409
            dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat, decimalPlaces, true, curReal));
        } else {
            dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat, decimalPlaces));
        }
        Map<String, Object> realDataMap = new HashMap<>();
        dataView.getRealData().forEach(item -> {
            realDataMap.put(item[0].toString(), item[1]);
        });
        Object curReal = realDataMap.get(DateUtils.format(predictTime, timeFormat)) == null ? dataView.getPreDataL().get(dataView.getPreDataL().size() - 1) : realDataMap.get(DateUtils.format(predictTime, timeFormat));
        // 当前值T0 + 当前预测值 20250409
        dataView.setCurData(mmItemResultJsonService.getData(outPut.getId(), predictTime, timeFormat, 3, true, curReal));
        // 调整预测值
        dataView.setAdjData(stAdjustResultService.getData(outPut.getId(),predictTime,timeFormat));
        dataView.setLineType(lineType.getCode());
        switch (lineType) {
            case TN:
                dataView.setPreDataN(mmItemResultService.getData(outPut.getId(), startTime, endTime, timeFormat));
                dataView.setPreDataN(mmItemResultService.getData(outPut.getId(), startTime, endTime, timeFormat, decimalPlaces));
                break;
            case TL:
                dataView.setPreDataN(mmItemResultService.getData(outPut.getId(), predictTime, endTime, timeFormat));
                dataView.setPreDataL(mmItemResultLastPointService.getData(outPut.getId(), startTime, endTime, timeFormat));
                dataView.setPreDataN(mmItemResultService.getData(outPut.getId(), predictTime, endTime, timeFormat, decimalPlaces));
                dataView.setPreDataL(mmItemResultLastPointService.getData(outPut.getId(), startTime, endTime, timeFormat, decimalPlaces));
                break;
            default:
                break;