From 1f9784a448efb59210ac1c8eec3809c028c76aa1 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 14 十一月 2024 16:54:10 +0800 Subject: [PATCH] 预测结果展示 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java | 2 +- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java index 0236bb7..15daa2d 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java @@ -211,6 +211,13 @@ calendar.add(Calendar.HOUR_OF_DAY, 1); endTime = calendar.getTime(); } + if (endTime.getTime() <= startTime.getTime()) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(startTime); + calendar.add(Calendar.HOUR_OF_DAY, 1); + endTime = calendar.getTime(); + } + List<String> categories = DateUtils.getTimeScale(startTime, endTime, predictItem.getGranularity()); List<String> legend = new ArrayList<>(); LinkedHashMap<String, PreDataSampleViewRespDTO> viewMap = new LinkedHashMap<>(); @@ -255,7 +262,7 @@ valueDTOS.forEach(item -> { Object[] values = new Object[2]; values[0] = DateUtils.format(item.getDataTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); - values[1] = item.getDataValue(); + values[1] = new BigDecimal(item.getDataValue()).setScale(2, BigDecimal.ROUND_HALF_UP); result.add(values); }); return result; diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java index a953fe5..b60eec7 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemResultServiceImpl.java @@ -156,7 +156,7 @@ list.forEach(item -> { Object[] dataItem = new Object[2]; dataItem[0] = DateUtils.format(item.getDatatime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); - dataItem[1] = item.getDatavalue(); + dataItem[1] = item.getDatavalue().setScale(2, BigDecimal.ROUND_HALF_UP); result.add(dataItem); }); return result; -- Gitblit v1.9.3