Browse Source

修改母猪存栏变动

zhuoning 2 years ago
parent
commit
1cc2ad2659

+ 49 - 5
huimv-farm-produce/pom.xml

@@ -47,11 +47,18 @@
             <artifactId>jjwt</artifactId>
             <version>0.9.1</version>
         </dependency>
-        <dependency>
-            <groupId>com.huimv</groupId>
-            <artifactId>huimv-common</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-        </dependency>
+
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-test</artifactId>-->
+<!--            <scope>test</scope>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>junit</groupId>-->
+<!--            <artifactId>junit</artifactId>-->
+<!--            <scope>test</scope>-->
+<!--        </dependency>-->
+
 <!--        &lt;!&ndash;CloseableHttpClient&ndash;&gt;-->
 <!--        <dependency>-->
 <!--            <groupId>org.apache.httpcomponents</groupId>-->
@@ -119,7 +126,44 @@
             <classifier>jdk15</classifier>
             <!-- jdk版本 -->
         </dependency>
+        <!-- huimv.com -->
+<!--        <dependency>-->
+<!--            <groupId>com.huimv</groupId>-->
+<!--            <artifactId>huimv-common</artifactId>-->
+<!--            <version>0.0.1</version>-->
+<!--        </dependency>-->
+        <dependency>
+            <groupId>com.huimv</groupId>
+            <artifactId>huimv-common</artifactId>
+            <version>0.0.5-SNAPSHOT</version>
+            <!--            <version>0.0.2-SNAPSHOT</version>-->
+        </dependency>
 
     </dependencies>
 
+<!--    <build>-->
+<!--        <plugins>-->
+<!--            <plugin>-->
+<!--                <groupId>org.springframework.boot</groupId>-->
+<!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
+<!--                <configuration>-->
+<!--                    <includeSystemScope>true</includeSystemScope>-->
+<!--                </configuration>-->
+<!--            </plugin>-->
+<!--        </plugins>-->
+<!--    </build>-->
+    <!--	<build>-->
+    <!--		<plugins>-->
+    <!--			<plugin>-->
+    <!--				<groupId>org.springframework.boot</groupId>-->
+    <!--				<artifactId>spring-boot-maven-plugin</artifactId>-->
+    <!--			</plugin>-->
+
+    <!--			<plugin>-->
+    <!--				<groupId>org.apache.maven.plugins</groupId>-->
+    <!--				<artifactId>maven-resources-plugin</artifactId>-->
+    <!--				<version>2.6</version>-->
+    <!--			</plugin>-->
+    <!--		</plugins>-->
+    <!--	</build>-->
 </project>

+ 1 - 0
huimv-farm-produce/src/main/java/com/huimv/produce/produce/controller/ProdStockController.java

@@ -52,6 +52,7 @@ public class ProdStockController {
     public Result listStorage(@RequestParam(name = "farmId") Integer farmId){
 
         Map map = prodStockService.listStorage(farmId);
+        System.out.println(""+map.toString());
         return new Result(ResultCode.SUCCESS,map);
     }
 

+ 0 - 19
huimv-farm-produce/src/main/java/com/huimv/produce/produce/service/impl/ProdSalesServiceImpl.java

@@ -38,7 +38,6 @@ public class ProdSalesServiceImpl extends ServiceImpl<ProdSalesMapper, ProdSales
         QueryWrapper<ProdSales> wrapper = new QueryWrapper<>();
         wrapper.eq("farm_id",farmId);
         Map endMap = new HashMap();
-
         List<ProdSales> list = new ArrayList<>();
         //本周
         if (1==type){
@@ -60,38 +59,27 @@ public class ProdSalesServiceImpl extends ServiceImpl<ProdSalesMapper, ProdSales
             list = this.list(wrapper);
         }
         wrapper.clear();
-
         wrapper.eq("farm_id",farmId);
         wrapper.last("AND PERIOD_DIFF( DATE_FORMAT( NOW( ) , '%Y%m' ) , DATE_FORMAT( add_date, '%Y%m' ) ) =1  ");
         ProdSalesDto lastProdSales = salesMapper.countMonth(wrapper);
-
-
         wrapper.clear();
-
         wrapper.eq("farm_id",farmId);
         wrapper.last("AND PERIOD_DIFF( DATE_FORMAT( NOW( ) , '%Y%m' ) , DATE_FORMAT( add_date, '%Y%m' ) ) =2  ");
         ProdSalesDto lastTwoProdSales = salesMapper.countMonth(wrapper);
-
         List timeList = new ArrayList();
         List moneyList = new ArrayList();
         List quantityList = new ArrayList();
         List moneyList1 = new ArrayList();
-
-
         for (ProdSales prodSales : list) {
             timeList.add(DateUtil.format(prodSales.getAddDate(),"MM-dd"));
             moneyList.add(  prodSales.getTodayMoney());
-
             quantityList.add(  prodSales.getTodayQuantity());
             moneyList1.add( NumberUtils.format( prodSales.getTodayMoney()));
         }
-
         wrapper.clear();
         wrapper.eq("farm_id",farmId);
         wrapper.ge("add_date",DateUtil.beginOfMonth(new Date()));
         ProdSalesDto prodSalesDto = salesMapper.countMonth(wrapper);
-
-
         wrapper.clear();
         wrapper.ge("add_date",DateUtil.beginOfMonth(new Date()));
         wrapper.orderByDesc("add_date");
@@ -116,11 +104,7 @@ public class ProdSalesServiceImpl extends ServiceImpl<ProdSalesMapper, ProdSales
             endMap.put("quantityList",null);
             endMap.put("moneyList1",null);
         }
-
-
         //上月
-
-
         wrapper.clear();
         wrapper.lt("add_date",DateUtil.beginOfMonth(new Date()));
         wrapper.orderByDesc("add_date");
@@ -138,9 +122,6 @@ public class ProdSalesServiceImpl extends ServiceImpl<ProdSalesMapper, ProdSales
             endMap.put("money", null);
             endMap.put("moneyPercent", null);
         }
-
-
-
         return new Result(ResultCode.SUCCESS,endMap);
     }
 

+ 7 - 3
huimv-farm-produce/src/main/java/com/huimv/produce/produce/service/impl/ProdStockServiceImpl.java

@@ -63,6 +63,7 @@ public class ProdStockServiceImpl extends ServiceImpl<ProdStockMapper, ProdStock
         list.add("grice_stock");
         list.add("piglet_stock");
         list.add("fatpig_stock");
+        list.add("sow_stock_5");
         QueryWrapper<ProdStock> wrapper = new QueryWrapper<>();
         wrapper.in("stock_type",list);
         wrapper.eq("farm_id",farmId);
@@ -75,11 +76,11 @@ public class ProdStockServiceImpl extends ServiceImpl<ProdStockMapper, ProdStock
         List griceStock = new ArrayList();
         List pigletStock = new ArrayList();
         List fatpigStock = new ArrayList();
+        List backPigStock = new ArrayList();
         for (ProdStock prodStock : prodStockList) {
             if ( month.add(prodStock.getMonth())){
                 month1.add(prodStock.getMonth());
             }
-
             String stockType = prodStock.getStockType();
             Integer stockQuantity = prodStock.getStockQuantity();
             switch (stockType){
@@ -98,17 +99,20 @@ public class ProdStockServiceImpl extends ServiceImpl<ProdStockMapper, ProdStock
                 case "fatpig_stock":
                     fatpigStock.add(stockQuantity);
                     break;
+                case "sow_stock_5":
+                    backPigStock.add(stockQuantity);
+                    break;
                 default:
                     break;
-
             }
         }
-
         map.put("sowStock",sowStock);
         map.put("boarStock",boarStock);
         map.put("griceStock",griceStock);
         map.put("pigletStock",pigletStock);
         map.put("fatpigStock",fatpigStock);
+        // 后备
+        map.put("backPigStock",backPigStock);
         map.put("month",month1);
         return map;
     }

+ 0 - 5
huimv-farm-produce/src/main/java/com/huimv/produce/produce/service/impl/WeightImpl.java

@@ -72,7 +72,6 @@ public class WeightImpl implements IWeight {
         System.out.println("url=" + url);
         String result = restTemplate.getForObject(url, String.class);
         JSONArray resultJa = JSONArray.parseArray(result);
-        log.info("接口返回数量=" + resultJa.size());
 
         // 保存每天明细
         saveWeightDetails(resultJa, todayDate);
@@ -90,8 +89,6 @@ public class WeightImpl implements IWeight {
 
         // 获取今天数据
         String todayDate = new DateUtil().getTodayDateText();
-        // test
-//        todayDate = "2022-06-11";
         String url = weightHttp + weightPath + "?date=" + todayDate;
         System.out.println("url=" + url);
         String result = restTemplate.getForObject(url, String.class);
@@ -143,7 +140,6 @@ public class WeightImpl implements IWeight {
             BigDecimal netTotalPurchaseBg = new BigDecimal("0");
             for (int a = 0; a < purchaseJa.size(); a++) {
                 JSONObject purchaseJo = purchaseJa.getJSONObject(a);
-//            System.out.println("" + purchaseJo.getBigDecimal("grossWeight") + " " + purchaseJo.getBigDecimal("tareWeight") + " " + purchaseJo.getBigDecimal("netWeight"));
                 BigDecimal gw = purchaseJo.getBigDecimal("grossWeight");
                 if (gw == null) {
                     gw = new BigDecimal("0");
@@ -176,7 +172,6 @@ public class WeightImpl implements IWeight {
             BigDecimal netTotalSalesBg = new BigDecimal("0");
             for (int a = 0; a < salesJa.size(); a++) {
                 JSONObject salesJo = salesJa.getJSONObject(a);
-            System.out.println("" + salesJo.getBigDecimal("grossWeight") + " " + salesJo.getBigDecimal("tareWeight") + " " + salesJo.getBigDecimal("netWeight"));
                 BigDecimal gw = salesJo.getBigDecimal("grossWeight");
                 if (gw == null) {
                     gw = new BigDecimal("0");

+ 2 - 2
huimv-farm-produce/src/main/resources/application.properties

@@ -1,6 +1,6 @@
-spring.profiles.active=dev
+#spring.profiles.active=dev
 #spring.profiles.active=demo
-#spring.profiles.active=prod
+spring.profiles.active=prod
 #spring.profiles.active=prod2
 
 weight.http=http://39.171.45.196:9200