Bladeren bron

新增更新工业库的两个字段

wangmiaomiao 11 maanden geleden
bovenliggende
commit
29c50eba2d

+ 49 - 0
slibra-admin/src/main/java/com/slibra/web/controller/business/HandleDataController.java

@@ -1,7 +1,10 @@
 package com.slibra.web.controller.business;
 
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.http.HttpRequest;
+import cn.hutool.poi.excel.ExcelReader;
+import cn.hutool.poi.excel.ExcelUtil;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.slibra.business.domain.TXinyiIndustry;
@@ -9,6 +12,7 @@ import com.slibra.business.mapper.TXinyiIndustryMapper;
 import com.slibra.common.core.controller.BaseController;
 import com.slibra.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
@@ -246,4 +250,49 @@ public class HandleDataController extends BaseController
         }
 
     }
+
+    @GetMapping("/dateUpdateCL")
+    public void dateUpdateCL() {
+        String fileName = "除磷加药瞬时流量";
+        //输入目录
+        ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\parse-data\\AdvertiseGen\\" + fileName + ".xls");
+        //解析数据
+        List<List<Object>> readAll = reader.read();
+        if(!CollectionUtils.isEmpty(readAll)){
+            for (List<Object> objects : readAll) {
+                String time = objects.get(0) + " " + objects.get(1).toString().substring(0, 5);
+                System.out.println("time = " + time);
+                TXinyiIndustry uniqueTXinyiIndustry = this.xinyiIndustryMapper.getUniqueTXinyiIndustry(time);
+                if(!Objects.isNull(uniqueTXinyiIndustry)){
+                    BigDecimal CLJYSSLL = Objects.isNull(objects.get(2)) ? null : (BigDecimal) objects.get(2);
+                    uniqueTXinyiIndustry.setCLJYSSLL(CLJYSSLL);
+                    this.xinyiIndustryMapper.updateTXinyiIndustry(uniqueTXinyiIndustry);
+                }
+            }
+        }
+    }
+
+
+    @GetMapping("/dateUpdateSJTY")
+    public void dateUpdateSJTY() {
+        String fileName = "信义污水厂实际碳源加药量";
+        //输入目录
+        ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\parse-data\\AdvertiseGen\\" + fileName + ".xls");
+        //解析数据
+        List<List<Object>> readAll = reader.read();
+        if(!CollectionUtils.isEmpty(readAll)){
+            for (List<Object> objects : readAll) {
+                cn.hutool.core.date.DateTime time = (DateTime) objects.get(0);
+                System.out.println("time = " + time);
+                String format = DateUtil.format(time, DateUtils.YYYYMMDDHHMM_TS);
+                System.out.println("format = " + format);
+                TXinyiIndustry uniqueTXinyiIndustry = this.xinyiIndustryMapper.getUniqueTXinyiIndustry(format);
+                if(!Objects.isNull(uniqueTXinyiIndustry)){
+                    BigDecimal SJTYJLY = Objects.isNull(objects.get(1)) ? null : (BigDecimal) objects.get(1);
+                    uniqueTXinyiIndustry.setSJTYJLY(SJTYJLY);
+                    this.xinyiIndustryMapper.updateTXinyiIndustry(uniqueTXinyiIndustry);
+                }
+            }
+        }
+    }
 }