huangfuli 1 년 전
부모
커밋
ed21d1c432

+ 55 - 60
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java

@@ -490,7 +490,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         }
         boolean one = this.insert(warehouseBaseInfo);
         boolean two = warehousePositionInfoService.insertBatch(warehousePositionInfoList);
-        cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE,warehouseBaseInfo.getCompId());
+        cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE, warehouseBaseInfo.getCompId());
         // 假如 都成功返回ok
         if (one && two) {
             return "OK";
@@ -547,7 +547,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
             throw new YException(YExceptionEnum.WAREHOUSE_NAME_ERROR);
         }
         this.insert(warehouseBaseInfo);
-        cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE,warehouseBaseInfo.getCompId());
+        cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE, warehouseBaseInfo.getCompId());
         return warehouseBaseInfo.getId();
     }
 
@@ -562,20 +562,20 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         String otherPhone = warehouseBaseInfo.getOtherPersonPhone();
         if (personPhone != null) {
             if (!personPhone.equals(warehouseBaseInfo1.getPersonPhone())) {
-                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE,warehouseBaseInfo1.getCompId());
+                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE, warehouseBaseInfo1.getCompId());
             }
         } else {
             if (warehouseBaseInfo1.getPersonPhone() != null) {
-                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE,warehouseBaseInfo1.getCompId());
+                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE, warehouseBaseInfo1.getCompId());
             }
         }
         if (otherPhone != null) {
             if (!otherPhone.equals(warehouseBaseInfo1.getOtherPersonPhone())) {
-                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE,warehouseBaseInfo1.getCompId());
+                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE, warehouseBaseInfo1.getCompId());
             }
         } else {
             if (warehouseBaseInfo1.getOtherPersonPhone() != null) {
-                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE,warehouseBaseInfo1.getCompId());
+                cacheComponent.delPrefixKey(Const.SELF_WAREHOUSE, warehouseBaseInfo1.getCompId());
             }
         }
         this.updateById(warehouseBaseInfo);
@@ -1711,8 +1711,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                 }
             }
 
-        }
-        else{
+        } else {
             List<WarehouseBaseInfo> warehouseBaseInfoList1 = this.selectList(new EntityWrapper<WarehouseBaseInfo>()
                     .eq("comp_id", compId)
                     .eq("delete_flag", "0")
@@ -1812,8 +1811,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                 }
             }
 
-        }
-        else{
+        } else {
             List<WarehouseBaseInfo> warehouseBaseInfoList1 = this.selectList(new EntityWrapper<WarehouseBaseInfo>()
                     .eq("comp_id", compId)
                     .eq("delete_flag", "0")
@@ -2405,7 +2403,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                         && !StringUtils.isEmpty(exportVView.getImperfectGrain())
                         && !StringUtils.isEmpty(exportVView.getBulkDensity())
                         && !StringUtils.isEmpty(exportVView.getJiaorenli())) {
-                    //水分累计和
+                    //净重累计和
                     netWeightTmp = netWeightTmp + (Double.valueOf(String.valueOf(exportVView.getNetWeight() != null ? exportVView.getNetWeight() : "0")));
                 }
                 //水分累计和
@@ -2452,50 +2450,44 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         cell.setCellStyle(styleDetail);
         //水分平均值
         cell = rowp.createCell(14);
-        if (bulkDensityTotal!=0){
+        if (bulkDensityTotal != 0) {
             cell.setCellValue(Double.parseDouble(df.format(bulkDensityTotal / netWeightTmp)));
-        }
-        else {
+        } else {
             cell.setCellValue(bulkDensityTotal / netWeightTmp);
         }
         cell.setCellStyle(contextstyle2);
         cell = rowp.createCell(15);
-        if (waterContentTotal!=0){
+        if (waterContentTotal != 0) {
             cell.setCellValue(Double.parseDouble(df.format(waterContentTotal / netWeightTmp)));
-        }
-        else {
+        } else {
             cell.setCellValue(waterContentTotal / netWeightTmp);
         }
         cell.setCellStyle(contextstyle2);
         cell = rowp.createCell(16);
-        if (mildewGrainTotal!=0){
+        if (mildewGrainTotal != 0) {
             cell.setCellValue(Double.parseDouble(df.format(mildewGrainTotal / netWeightTmp)));
-        }
-        else {
+        } else {
             cell.setCellValue(mildewGrainTotal / netWeightTmp);
         }
         cell.setCellStyle(contextstyle2);
         cell = rowp.createCell(17);
-        if (impurityTotal!=0){
+        if (impurityTotal != 0) {
             cell.setCellValue(Double.parseDouble(df.format(impurityTotal / netWeightTmp)));
-        }
-        else {
+        } else {
             cell.setCellValue(impurityTotal / netWeightTmp);
         }
         cell.setCellStyle(contextstyle2);
         cell = rowp.createCell(18);
-        if (jiaorenliTotal!=0){
+        if (jiaorenliTotal != 0) {
             cell.setCellValue(Double.parseDouble(df.format(jiaorenliTotal / netWeightTmp)));
-        }
-        else {
+        } else {
             cell.setCellValue(jiaorenliTotal / netWeightTmp);
         }
         cell.setCellStyle(contextstyle2);
         cell = rowp.createCell(19);
-        if (imperfectGrainTotal!=0){
+        if (imperfectGrainTotal != 0) {
             cell.setCellValue(Double.parseDouble(df.format(imperfectGrainTotal / netWeightTmp)));
-        }
-        else {
+        } else {
             cell.setCellValue(imperfectGrainTotal / netWeightTmp);
         }
         cell.setCellStyle(contextstyle2);
@@ -2512,7 +2504,11 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         cell = rowp.createCell(25);
         cell.setCellStyle(styleDetail);
         cell = rowp.createCell(26);
-        cell.setCellValue(Double.parseDouble(df.format(amountIngPayableTotal / netWeightTotal)));
+        if (amountIngPayableTotal != 0) {
+            cell.setCellValue(Double.parseDouble(df.format(amountIngPayableTotal / netWeightTotal)));
+        } else {
+            cell.setCellValue(amountIngPayableTotal / netWeightTmp);
+        }
         cell.setCellStyle(contextstyle2);
         cell = rowp.createCell(27);
         cell.setCellStyle(styleDetail);
@@ -4280,50 +4276,50 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
             //水分平均值
             cell = rowp.createCell(17);
             cell.setCellStyle(contextstyle2);
-            if (waterContentTotal != 0){
+            if (waterContentTotal != 0) {
                 cell.setCellValue(Double.parseDouble(df.format(waterContentTotal / netWeightTmp)));
-            }else {
+            } else {
                 cell.setCellValue(waterContentTotal / netWeightTmp);
             }
             cell = rowp.createCell(18);
-            if (impurityTotal != 0){
+            if (impurityTotal != 0) {
                 cell.setCellValue(Double.parseDouble(df.format(impurityTotal / netWeightTmp)));
-            }else {
+            } else {
                 cell.setCellValue(impurityTotal / netWeightTmp);
             }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(19);
-            if (mildewGrainTotal != 0){
+            if (mildewGrainTotal != 0) {
                 cell.setCellValue(Double.parseDouble(df.format(mildewGrainTotal / netWeightTmp)));
-            }else {
+            } else {
                 cell.setCellValue(mildewGrainTotal / netWeightTmp);
             }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(20);
-            if (imperfectGrainTotal != 0){
+            if (imperfectGrainTotal != 0) {
                 cell.setCellValue(Double.parseDouble(df.format(imperfectGrainTotal / netWeightTmp)));
-            }else {
+            } else {
                 cell.setCellValue(imperfectGrainTotal / netWeightTmp);
             }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(21);
-            if (bulkDensityTotal != 0){
+            if (bulkDensityTotal != 0) {
                 cell.setCellValue(Double.parseDouble(df.format(bulkDensityTotal / netWeightTmp)));
-            }else {
+            } else {
                 cell.setCellValue(bulkDensityTotal / netWeightTmp);
             }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(22);
-            if (jiaorenliTotal != 0){
+            if (jiaorenliTotal != 0) {
                 cell.setCellValue(Double.parseDouble(df.format(jiaorenliTotal / netWeightTmp)));
-            }else {
+            } else {
                 cell.setCellValue(jiaorenliTotal / netWeightTmp);
             }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(23);
-            if (protrinTotal != 0){
+            if (protrinTotal != 0) {
                 cell.setCellValue(Double.parseDouble(df.format(protrinTotal / netWeightTmp)));
-            }else {
+            } else {
                 cell.setCellValue(protrinTotal / netWeightTmp);
             }
             cell.setCellStyle(contextstyle2);
@@ -5649,7 +5645,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
     }
 
     private String addDateOneDay(Date date) {
-        if(date == null){
+        if (date == null) {
             return "";
         }
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -5835,9 +5831,9 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         pageView.put("endDate", warehouseBaseInfo.getWarehouseEndDate());
         pageView.put("pageSize", warehouseBaseInfo.getPageSize());
         pageView.put("currentPage", warehouseBaseInfo.getCurrentPage());
-        List<WarehouseBaseInfo> listRedis = cacheComponent.getObjList(Const.ADMIN_WAREHOUSEINFO+JSONObject.toJSONString(pageView),WarehouseBaseInfo.class);
-        if(listRedis != null && listRedis.size() > 0 ){
-            Long countRedis = Long.parseLong(cacheComponent.getRaw(Const.ADMIN_WAREHOUSEINFO_NUM+JSONObject.toJSONString(pageView)));
+        List<WarehouseBaseInfo> listRedis = cacheComponent.getObjList(Const.ADMIN_WAREHOUSEINFO + JSONObject.toJSONString(pageView), WarehouseBaseInfo.class);
+        if (listRedis != null && listRedis.size() > 0) {
+            Long countRedis = Long.parseLong(cacheComponent.getRaw(Const.ADMIN_WAREHOUSEINFO_NUM + JSONObject.toJSONString(pageView)));
             Page<WarehouseBaseInfo> page = new Page<>();
             page.setRecords(listRedis == null ? Lists.newArrayList() : listRedis);
             page.setTotal(countRedis == null ? 0 : countRedis);
@@ -5849,8 +5845,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         Integer dataCount = baseMapper.getBaseCountByCondition(pageView);
         List<WarehouseBaseInfo> dataList = baseMapper.getBaseListByCondition(pageView);
 
-        cacheComponent.putRaw(Const.ADMIN_WAREHOUSEINFO+JSONObject.toJSONString(pageView), JSONObject.toJSONString(dataList),60*60*24);
-        cacheComponent.putRaw(Const.ADMIN_WAREHOUSEINFO_NUM+JSONObject.toJSONString(pageView), dataCount+"",60*60*24);
+        cacheComponent.putRaw(Const.ADMIN_WAREHOUSEINFO + JSONObject.toJSONString(pageView), JSONObject.toJSONString(dataList), 60 * 60 * 24);
+        cacheComponent.putRaw(Const.ADMIN_WAREHOUSEINFO_NUM + JSONObject.toJSONString(pageView), dataCount + "", 60 * 60 * 24);
 
         Page<WarehouseBaseInfo> page = new Page<>();
         page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
@@ -5876,13 +5872,12 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         pageView.put("endDate", warehouseBaseInfo.getWarehouseEndDate());
         List<WarehouseBaseInfo> dataList = new ArrayList<>();
         List<WarehouseBaseInfo> dataList1 = new ArrayList<>();
-        dataList = cacheComponent.getObjList(Const.ADMIN_WAREHOUSEINFOCHAR+JSONObject.toJSONString(pageView), WarehouseBaseInfo.class);
-        dataList1 = cacheComponent.getObjList(Const.ADMIN_WAREHOUSEINFOFORM+JSONObject.toJSONString(pageView), WarehouseBaseInfo.class);
-        if(dataList != null){
+        dataList = cacheComponent.getObjList(Const.ADMIN_WAREHOUSEINFOCHAR + JSONObject.toJSONString(pageView), WarehouseBaseInfo.class);
+        dataList1 = cacheComponent.getObjList(Const.ADMIN_WAREHOUSEINFOFORM + JSONObject.toJSONString(pageView), WarehouseBaseInfo.class);
+        if (dataList != null) {
             warehouseBaseInfo1.setChartList(dataList);
             warehouseBaseInfo1.setFormList(dataList1);
-        }
-        else{
+        } else {
 //            dataList = baseMapper.getWarehouseChartByCondition(pageView);
 //            dataList1 = baseMapper.getWarehouseFormByCondition(pageView);
 //            cacheComponent.putRaw(Const.ADMIN_WAREHOUSEINFOCHAR+JSONObject.toJSONString(pageView), JSONObject.toJSONString(dataList),60*60*24);
@@ -5895,8 +5890,8 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
     @Override
     public WarehouseBaseInfo getQuantityZhe(String compId, String baseId) {
         String seachMonth = "2022-10-01";
-        List<WarehouseNumView> warehouseNumViewList = warehousePositionStorageInfoMapper.getQuantityZhe(compId,baseId, "2", seachMonth);
-        List<WarehouseNumView> warehouseNumViewList1 = warehousePositionStorageInfoMapper.getQuantityZhe( compId,baseId, "1", seachMonth);
+        List<WarehouseNumView> warehouseNumViewList = warehousePositionStorageInfoMapper.getQuantityZhe(compId, baseId, "2", seachMonth);
+        List<WarehouseNumView> warehouseNumViewList1 = warehousePositionStorageInfoMapper.getQuantityZhe(compId, baseId, "1", seachMonth);
         WarehouseBaseInfo warehouseBaseInfo = new WarehouseBaseInfo();
         List<WarehouseNumView> list = new ArrayList<>();
         if (org.apache.commons.collections.CollectionUtils.isNotEmpty(warehouseNumViewList)) {
@@ -5907,9 +5902,9 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                 if (org.apache.commons.collections.CollectionUtils.isNotEmpty(warehouseNumViewList1)) {
                     for (int j = 0; j < warehouseNumViewList1.size(); j++) {
                         if (warehouseNumViewList.get(i).getGoodsName().equals(warehouseNumViewList1.get(j).getGoodsName())) {
-                            if(warehouseNumViewList.get(i).getPureWeight() - warehouseNumViewList1.get(j).getPureWeight() <= 0){
+                            if (warehouseNumViewList.get(i).getPureWeight() - warehouseNumViewList1.get(j).getPureWeight() <= 0) {
                                 biViewInfo.setPureWeight(0d);
-                            }else{
+                            } else {
                                 biViewInfo.setPureWeight(warehouseNumViewList.get(i).getPureWeight() - warehouseNumViewList1.get(j).getPureWeight());
                             }
                             break;
@@ -5918,7 +5913,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                     }
 
                 }
-                if(biViewInfo.getPureWeight() == 0){
+                if (biViewInfo.getPureWeight() == 0) {
                     continue;
                 }
                 list.add(biViewInfo);