wangmiaomiao 11 kuukautta sitten
vanhempi
commit
70e79ba895

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

@@ -313,4 +313,77 @@ public class HandleDataController extends BaseController
         }
         }
         return "ok";
         return "ok";
     }
     }
+
+    //下面是新的 将一个小时的数据 更新到一个小时之内的所有的数据中
+    @GetMapping("/dateUpdateCLMinute")
+    public String dateUpdateCLMinute() {
+        String fileName = "除磷加药瞬时流量";
+        //输入目录
+        ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\新程序\\" + fileName + ".xls");
+        //解析数据
+        List<List<Object>> readAll = reader.read();
+        int i = 0;
+        if(!CollectionUtils.isEmpty(readAll)){
+            for (List<Object> objects : readAll) {
+                if(!Objects.isNull(objects.get(0)) && !Objects.isNull(objects.get(1))){
+                    String beginTime = "20" + objects.get(0) + " " + objects.get(1).toString().substring(0, 5);
+                    System.out.println("beginTime = " + beginTime);
+                    String endTime = "20" + objects.get(0) + " " + objects.get(1).toString().substring(0, 3) + "59";
+                    System.out.println("endTime = " + endTime);
+                    //更新数据
+                    System.out.println(objects.get(2));
+                    //有特殊情况
+                    if(Objects.isNull(objects.get(2)) || objects.get(2).toString().contains("-")){
+                        System.out.println("存在特殊的情况,值包含-,不做更新");
+                        i++;
+                    }else{
+                    this.xinyiIndustryMapper.updateTXinyiIndustryCLByBetweenTime(beginTime, endTime, new BigDecimal(String.valueOf(objects.get(2))));
+                    }
+                }
+            }
+        }
+        System.out.println("i = " + i);
+        return "ok";
+    }
+
+
+    @GetMapping("/dateUpdateSJTYMinute")
+    public String dateUpdateSJTYMinute() {
+        String fileName = "信义污水厂实际碳源加药量";
+        //输入目录
+        ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\新程序\\" + fileName + ".xls");
+        //解析数据
+        List<List<Object>> readAll = reader.read();
+        if(!CollectionUtils.isEmpty(readAll)){
+            int i = 0;
+            for (List<Object> objects : readAll) {
+                String beginTime = "";
+                if(objects.get(0) instanceof String){
+                    System.out.println("----------是字符串类型的");
+                    String time = ((String) objects.get(0));
+//                    System.out.println("time = " + time);
+                    beginTime = time.replaceAll("-", "/").substring(0, 16);
+                }else if (objects.get(0) instanceof cn.hutool.core.date.DateTime){
+                    System.out.println("++++++++++是日期类型的");
+                    cn.hutool.core.date.DateTime time = (DateTime) objects.get(0);
+//                    System.out.println("time = " + time);
+                    beginTime = DateUtil.format(time, DateUtils.YYYYMMDDHHMM_TS);
+                    System.out.println("beginTime = " + beginTime);
+                }else {
+                    System.out.println(JSON.toJSONString(objects));
+                    beginTime = "";
+                    i++;
+                }
+                //endTime
+                String endTime = beginTime.substring(0, 14) + "59";
+                System.out.println("endTime = " + endTime);
+                //更新数据
+                BigDecimal sjtyjly = Objects.isNull(objects.get(1)) ? null : new BigDecimal(String.valueOf(objects.get(1)));
+                this.xinyiIndustryMapper.updateTXinyiIndustrySJByBetweenTime(beginTime, endTime, sjtyjly);
+            }
+            System.out.println("i =" + i);
+        }
+        return "ok";
+    }
+
 }
 }

+ 4 - 0
slibra-system/src/main/java/com/slibra/business/mapper/TXinyiIndustryMapper.java

@@ -1,8 +1,10 @@
 package com.slibra.business.mapper;
 package com.slibra.business.mapper;
 
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 import com.slibra.business.domain.TXinyiIndustry;
 import com.slibra.business.domain.TXinyiIndustry;
+import org.apache.ibatis.annotations.Param;
 
 
 /**
 /**
  * 信义工业数据Mapper接口
  * 信义工业数据Mapper接口
@@ -63,4 +65,6 @@ public interface TXinyiIndustryMapper
     //通过时间获取唯一的一条记录
     //通过时间获取唯一的一条记录
     TXinyiIndustry getUniqueTXinyiIndustry(String testTime);
     TXinyiIndustry getUniqueTXinyiIndustry(String testTime);
 
 
+    Integer updateTXinyiIndustryCLByBetweenTime(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("cljyssll") BigDecimal cljyssll);
+    Integer updateTXinyiIndustrySJByBetweenTime(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("sjtyjly") BigDecimal sjtyjly);
 }
 }

+ 11 - 0
slibra-system/src/main/resources/mapper/business/TXinyiIndustryMapper.xml

@@ -308,4 +308,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTXinyiIndustryVo"/>
         <include refid="selectTXinyiIndustryVo"/>
         where TEST_TIME = #{testTime}
         where TEST_TIME = #{testTime}
     </select>
     </select>
+
+    <update id="updateTXinyiIndustryCLByBetweenTime" >
+        update t_xinyi_industry set CLJYSSLL = #{cljyssll}
+        where TEST_TIME between #{beginTime} and #{endTime}
+    </update>
+
+
+    <update id="updateTXinyiIndustrySJByBetweenTime" >
+        update t_xinyi_industry set SJTYJLY = #{sjtyjly}
+        where TEST_TIME between #{beginTime} and #{endTime}
+    </update>
 </mapper>
 </mapper>