From 4be7d863a161b64f8592a789d699e807545e7dc6 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 15 十一月 2024 16:46:12 +0800
Subject: [PATCH] 计划数据

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/admin/ApiDataController.java |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/admin/ApiDataController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/admin/ApiDataController.java
index c44bb02..3ed05e1 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/admin/ApiDataController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/admin/ApiDataController.java
@@ -5,6 +5,7 @@
 import com.iailab.framework.common.util.object.ConvertUtils;
 import com.iailab.framework.excel.core.util.ExcelUtils;
 import com.iailab.framework.tenant.core.context.TenantContextHolder;
+import com.iailab.module.data.api.dto.DeviceValueDTO;
 import com.iailab.module.data.api.dto.IndexQueryDTO;
 import com.iailab.module.data.api.dto.echarts.BarLineDTO;
 import com.iailab.module.data.api.dto.echarts.SeriesItem;
@@ -18,33 +19,29 @@
 import com.iailab.module.data.api.point.dto.ApiPointsValueQueryDTO;
 import com.iailab.module.data.common.ApiDataQueryDTO;
 import com.iailab.module.data.common.ApiDataValueDTO;
+import com.iailab.module.data.common.utils.ApiSecurityUtils;
 import com.iailab.module.data.ind.collection.IndItemCollector;
 import com.iailab.module.data.ind.item.vo.IndItemValueVO;
 import com.iailab.module.data.plan.item.entity.PlanItemEntity;
+import com.iailab.module.data.plan.item.service.PlanItemService;
 import com.iailab.module.data.plan.item.vo.PlanItemValueExportVO;
 import com.iailab.module.data.point.common.PointDataTypeEnum;
 import com.iailab.module.data.point.dto.DaPointDTO;
 import com.iailab.module.data.point.service.DaPointService;
-import com.iailab.module.data.api.dto.DeviceValueDTO;
-import com.iailab.module.data.common.utils.ApiSecurityUtils;
-import com.iailab.module.data.plan.item.service.PlanItemService;
-import com.iailab.module.data.point.vo.DaPointExcelVO;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.annotation.security.PermitAll;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -154,8 +151,8 @@
                 queryDto.setPointNo(item.getPointNo());
                 List<ApiPointValueDTO> list = dataPointApi.queryPointHistoryValue(queryDto);
                 List<Object[]> sData = list.stream().map(dataItem -> {
-                    Object[] valueArray = new Object[]{DateUtils.format(dataItem.getDataTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND),
-                            getFormatValue(item.getDataType(), dataItem.getDataValue())};
+                    Object[] valueArray = new Object[]{DateUtils.format(dataItem.getT(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND),
+                            getFormatValue(item.getDataType(), dataItem.getV())};
                     return valueArray;
                 }).collect(Collectors.toList());
                 seriesItem.setData(sData);
@@ -300,7 +297,7 @@
         List<PlanItemValueExportVO> exportList = list.stream().map(item -> {
             PlanItemValueExportVO exportVO = new PlanItemValueExportVO();
             exportVO.setDataTime(DateUtils.format(item.getDataTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
-            exportVO.setDataValue(new BigDecimal(item.getDataValue()).setScale(0, BigDecimal.ROUND_HALF_UP).toString());
+            exportVO.setDataValue(BigDecimal.valueOf(item.getDataValue()).setScale(0, RoundingMode.HALF_UP).toString());
             return exportVO;
         }).collect(Collectors.toList());
         ExcelUtils.write(response, "计划数据.xls", "计划数据", PlanItemValueExportVO.class, exportList);

--
Gitblit v1.9.3