From 033e696ffd783f3d78a16c1a359353ec6a7aeec2 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期三, 08 一月 2025 11:31:38 +0800
Subject: [PATCH] 预测参数查询调整

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/admin/ApiDataController.java |   30 +++++++++++++-----------------
 1 files changed, 13 insertions(+), 17 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..339c042 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
@@ -4,7 +4,7 @@
 import com.iailab.framework.common.util.date.DateUtils;
 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 +18,28 @@
 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 +149,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);
@@ -285,8 +280,8 @@
     @PostMapping("/export-plan/history-value")
     @Operation(summary = "导出计划数据")
     public void exportPlanHistoryValue(HttpServletResponse response, HttpServletRequest
-            request, @RequestBody ApiDataQueryDTO dto) throws IOException {
-        //apiSecurityUtils.validate(request);
+            request, @RequestBody ApiDataQueryDTO dto) throws Exception {
+        apiSecurityUtils.validate(request);
         Calendar calendar = Calendar.getInstance();
         calendar.set(Calendar.MILLISECOND, 0);
         calendar.set(Calendar.SECOND, 0);
@@ -300,7 +295,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);
@@ -309,8 +304,9 @@
     @PermitAll
     @GetMapping("/query-ind/default-value")
     @Operation(summary = "查询指标默认值")
-    public CommonResult<List<ApiIndItemValueDTO>> queryIndItemDefaultValue(@RequestParam String itemNo) {
-        TenantContextHolder.setTenantId(161L);
+    public CommonResult<List<ApiIndItemValueDTO>> queryIndItemDefaultValue(HttpServletResponse response, HttpServletRequest
+            request,@RequestParam String itemNo) throws Exception {
+        apiSecurityUtils.validate(request);
         List<IndItemValueVO> list = indItemCollector.queryValue(itemNo);
         List<ApiIndItemValueDTO> dtoList = new ArrayList<>();
         list.forEach(item -> {

--
Gitblit v1.9.3