فهرست منبع

修改查询每月数据接口

523096025 2 سال پیش
والد
کامیت
8cfcf66d5e

+ 5 - 7
huimv-hy-production/huimv.hy.autoGetData/src/main/java/com/huimv/production/autoGetData/config/SaticScheduleTask.java

@@ -1,4 +1,3 @@
-/*
 package com.huimv.production.autoGetData.config;
 
 import com.huimv.production.autoGetData.service.IAutoGetErpData;
@@ -18,7 +17,6 @@ import java.text.ParseException;
 import java.time.LocalDateTime;
 import java.util.List;
 
-*/
 /**
  * @Project : huimv.shiwan
  * @Package : com.huimv.biosafety.uface.controller
@@ -26,7 +24,7 @@ import java.util.List;
  * @Version : 1.0
  * @Author : ZhuoNing
  * @Create : 2020-12-25
- **//*
+ **/
 
 @Configuration      //1.主要用于标记配置类,兼备Component的效果。
 @EnableScheduling   // 2.开启定时任务
@@ -46,8 +44,8 @@ public class SaticScheduleTask  {
 
 //    @Scheduled(cron = "0/5 * * * * ?")
 //    @Scheduled(cron = "0 * * * * ? ")
-  */
-/*  private void getPsyTask(){
+/*
+  private void getPsyTask(){
         System.err.println("执行 getPsyTask 执行静态定时任务时间: " + LocalDateTime.now());
         iAutoGetErpData.getPsy();
     }
@@ -106,8 +104,9 @@ public class SaticScheduleTask  {
     private List findAll(){
 
         return iAutoGetErpData.findAll();
-    }*//*
+    }
 
+*/
 
     //ok
     //
@@ -192,4 +191,3 @@ public class SaticScheduleTask  {
         iAutoGetErpData.getManyFarmStock2();
     }
 }
-*/

+ 24 - 6
huimv-hy-production/huimv.hy.autoGetData/src/main/java/com/huimv/production/autoGetData/service/impl/AutoGetErpDataImpl.java

@@ -1024,7 +1024,16 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
                                 prodStockEntity2.setYear(Integer.parseInt(format.substring(0,4)));
                                 prodStockEntity2.setFarmId(prodFarmNameEntity.getFarmId());
                                 prodStockEntity2.setMonth(Integer.parseInt(format.substring(5,7)));
-                                prodStockEntity2.setStockQuantity(dataList.get(4)+"");
+                               Integer jichuBongZhu = (Integer)dataList.get(4);
+                               Integer houbeiZhu = (Integer)dataList.get(5);
+                               int count2 = 0 ;
+                               if (jichuBongZhu != null ){
+                                   count2 +=jichuBongZhu;
+                               }
+                               if (houbeiZhu != null ){
+                                   count2 +=houbeiZhu;
+                               }
+                                prodStockEntity2.setStockQuantity(count2+"");
                                 prodStockEntity2.setStockName("公猪存栏");
                                 prodStockEntity2.setStockType("boar_stock");
                                prodStockRepo.save( prodStockEntity2);
@@ -1081,7 +1090,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
                                prodStockEntity7.setFarmId(prodFarmNameEntity.getFarmId());
                                prodStockEntity7.setMonth(Integer.parseInt(format.substring(5,7)));
                                Integer muZhu = (Integer)dataList.get(3);
-                               Integer gongZhu = (Integer)dataList.get(5);
+                               Integer gongZhu = (Integer)dataList.get(9);
                                int count1 = 0 ;
                                if (muZhu != null ){
                                    count1 +=muZhu;
@@ -1152,7 +1161,16 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
                                            break;
                                        case "boar_stock":
                                            //公猪存栏
-                                           stockEntity.setStockQuantity( dataList.get(4)+"");
+                                           Integer gongZhu = (Integer)dataList.get(4);
+                                           Integer houbei = (Integer)dataList.get(5);
+                                           int count2= 0 ;
+                                           if (gongZhu != null ){
+                                               count2 +=gongZhu;
+                                           }
+                                           if (houbei != null ){
+                                               count2 +=houbei;
+                                           }
+                                           stockEntity.setStockQuantity( count2+"");
                                            prodStockRepo.save(stockEntity);
                                            break;
                                        case "grice_stock":
@@ -1189,13 +1207,13 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
                                        case "sow_stock_5":
                                            //后备猪存栏
                                            Integer muZhu = (Integer)dataList.get(3);
-                                           Integer gongZhu = (Integer)dataList.get(5);
+                                           Integer shangBin = (Integer)dataList.get(9);
                                            int count1 = 0 ;
                                            if (muZhu != null ){
                                                count1 +=muZhu;
                                            }
-                                           if (gongZhu != null ){
-                                               count1 +=gongZhu;
+                                           if (shangBin != null ){
+                                               count1 +=shangBin;
                                            }
 
                                            stockEntity.setStockQuantity( count1+"");

+ 1 - 1
huimv-hy-production/huimv.hy.autoGetData/src/test/java/com/huimv/production/autoGetData/utils/AutoGetDataTEst.java

@@ -42,7 +42,7 @@ public class AutoGetDataTEst {
     @Test
     public void testGetManyFarmStock() throws IOException {
         //
-        autoGetErpData.getManyFarmStock();
+        autoGetErpData.getManyFarmStock2();
     }
 
     //测试生产