gongdecai %!s(int64=2) %!d(string=hai) anos
pai
achega
466cdab6bc

+ 62 - 9
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/BiInfoController.java

@@ -19,6 +19,7 @@ import jxl.Workbook;
 import jxl.read.biff.BiffException;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.aggregation.ArrayOperators;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -1151,7 +1152,7 @@ public class BiInfoController {
         biViewInfoList = userGrowth(compId,seachMoth,biViewInfoList);
         // 粮脉入驻
         biViewInfoList = settled(compId,seachMoth,biViewInfoList);
-
+        biViewInfoList = quantityZhe(compId, seachMoth, biViewInfoList);
         return biViewInfoList;
 
     }
@@ -1285,15 +1286,17 @@ public class BiInfoController {
 
     }
 
+
+
     /**
-     * 库存数量
+     * 折干
      *
      * @param compId
      * @param biViewInfoList
      * @return
      */
-    @GetMapping("/quantity")
-    public List<BiViewInfo> quantity(String compId, String seachMonth, List<BiViewInfo> biViewInfoList) {
+    @GetMapping("/quantityZhe")
+    public List<BiViewInfo> quantityZhe(String compId, String seachMonth, List<BiViewInfo> biViewInfoList) {
         String userId = "";
         if (AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null) {
             userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
@@ -1361,10 +1364,6 @@ public class BiInfoController {
             }
         }
 
-        List<BiViewInfo> biViewInfos2 = new ArrayList<>(biViewInfos);
-        BiViewInfo biViewInfo = new BiViewInfo();
-        biViewInfo.setName("库存储量");
-        biViewInfo.setBiViewInfoList(biViewInfos2);
 
 
         if(CollectionUtils.isNotEmpty(biViewInfos)){
@@ -1388,7 +1387,61 @@ public class BiInfoController {
         BiViewInfo biViewInfo1 = new BiViewInfo();
         biViewInfo1.setName("折算存重");
         biViewInfo1.setBiViewInfoList(biViewInfos);
-        biViewInfo.setBiViewInfo(biViewInfo1);
+        biViewInfoList.add(biViewInfo1);
+        return biViewInfoList;
+    }
+
+
+    /**
+     * 库存数量
+     *
+     * @param compId
+     * @param biViewInfoList
+     * @return
+     */
+    @GetMapping("/quantity")
+    public List<BiViewInfo> quantity(String compId, String seachMonth, List<BiViewInfo> biViewInfoList) {
+        String userId = "";
+        if (AuthSecurityUtils.getCurrentUserInfo() != null && AuthSecurityUtils.getCurrentUserInfo().getUserId() != null) {
+            userId = AuthSecurityUtils.getCurrentUserInfo().getUserId();
+        }
+        String jointVentureParties = null;
+        if ("647b84ee01044e2a8d4fdc1943ce3d01,ec7024427b7347b98bcad422761e5bfc,23eff8bab2ed4af38a1be1315ce7046d,d958ef5aa62849039802356a63f6e7ca".contains(userId)) {
+            jointVentureParties = "洮南市鸿胜粮贸有限公司";
+        }
+        List<BiViewInfo> biViewInfoList1 = warehousePositionStorageInfoMapper.selectSumWareNewByGoods(companyId, null, "2", seachMonth, jointVentureParties);
+        List<BiViewInfo> biViewInfoList2 = warehousePositionStorageInfoMapper.selectSumWareNewByGoods(companyId, null, "1", seachMonth, jointVentureParties);
+        List<BiViewInfo> biViewInfos = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(biViewInfoList1)) {
+            for (int i = 0; i < biViewInfoList1.size(); i++) {
+                BiViewInfo biViewInfo = new BiViewInfo();
+                biViewInfo.setName(biViewInfoList1.get(i).getName());
+                biViewInfo.setWeight(biViewInfoList1.get(i).getWeight());
+                if (CollectionUtils.isNotEmpty(biViewInfoList2)) {
+                    for (int j = 0; j < biViewInfoList2.size(); j++) {
+                        if (biViewInfoList1.get(i).getName().equals(biViewInfoList2.get(j).getName())) {
+                            if(biViewInfoList1.get(i).getWeight() - biViewInfoList2.get(j).getWeight() <= 0){
+                                biViewInfo.setWeight(0d);
+                            }else{
+                                biViewInfo.setWeight(biViewInfoList1.get(i).getWeight() - biViewInfoList2.get(j).getWeight());
+                            }
+                            break;
+                        }
+
+                    }
+
+                }
+                if(biViewInfo.getWeight() == 0){
+                    continue;
+                }
+                biViewInfos.add(biViewInfo);
+            }
+        }
+
+
+        BiViewInfo biViewInfo = new BiViewInfo();
+        biViewInfo.setName("库存储量");
+        biViewInfo.setBiViewInfoList(biViewInfos);
         biViewInfoList.add(biViewInfo);
         return biViewInfoList;
     }