Sfoglia il codice sorgente

Merge branch 'master' of http://47.100.3.209:3000/gdc/yiliangyiyun

gongdecai 1 anno fa
parent
commit
89e4f4ca45

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ExpenseInfo.java

@@ -158,7 +158,7 @@ public class ExpenseInfo extends BaseModel<ExpenseInfo> {
      */
     private String expensesPurpose;
     /**
-     * 是否自动分配(1不自动分配3仓储费自动分配5燃料费自动分配)
+     * 是否自动分配(1不自动分配5燃料费自动分配)
      */
     private String autoAssign;
     /**

+ 163 - 163
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehousingOrderServiceImpl.java

@@ -820,39 +820,39 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
 //                    .eq("function_type", "2"));
 //            if (!CollectionUtils.isEmpty(enabledInfoList)) {
 //                for (EnabledInfo enabledInfo : enabledInfoList) {
-            Double value=0d;
-            //查剩余重量>0的入库单
-            List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
-//                            .eq("comp_id", enabledInfo.getCompId())
-                    .ne("temporary_flag", "1")
-                    .gt("surplus_weight", 0));
-            if (!CollectionUtils.isEmpty(warehousingOrderList)) {
-                for (WarehousingOrder warehousingOrder : warehousingOrderList) {
-                    Double distributionMoney = 0d;
-                    List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
-                            .eq("order_id", warehousingOrder.getId())
-                            .ne("status", "已驳回"));
-                    if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
-                        distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
-                    }
-                    distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
-                    if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
-                        WarehouseBaseInfo warehouseBaseInfo=warehouseBaseInfoService.selectById(warehousingOrder.getBaseId());
-                        //取当前入库单仓库利率
-                        if (warehouseBaseInfo.getInterestRate()!=null){
-                            value=warehouseBaseInfo.getInterestRate();
-                        }
-                        if (warehousingOrder.getSurplusWeight() > 1) {
-                            warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * value / 30) * warehousingOrder.getSurplusWeight());
-                            warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * value / 30);
-                        } else {
-                            warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * value * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
-                            warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * value * warehousingOrder.getSurplusWeight() / 30);
-                        }
-                    }
-                    this.updateById(warehousingOrder);
-                }
-            }
+//            Double value=0d;
+//            //查剩余重量>0的入库单
+//            List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
+////                            .eq("comp_id", enabledInfo.getCompId())
+//                    .ne("temporary_flag", "1")
+//                    .gt("surplus_weight", 0));
+//            if (!CollectionUtils.isEmpty(warehousingOrderList)) {
+//                for (WarehousingOrder warehousingOrder : warehousingOrderList) {
+//                    Double distributionMoney = 0d;
+//                    List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
+//                            .eq("order_id", warehousingOrder.getId())
+//                            .ne("status", "已驳回"));
+//                    if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
+//                        distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
+//                    }
+//                    distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
+//                    if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
+//                        WarehouseBaseInfo warehouseBaseInfo=warehouseBaseInfoService.selectById(warehousingOrder.getBaseId());
+//                        //取当前入库单仓库利率
+//                        if (warehouseBaseInfo.getInterestRate()!=null){
+//                            value=warehouseBaseInfo.getInterestRate();
+//                        }
+//                        if (warehousingOrder.getSurplusWeight() > 1) {
+//                            warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * value / 30) * warehousingOrder.getSurplusWeight());
+//                            warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * value / 30);
+//                        } else {
+//                            warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * value * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
+//                            warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * value * warehousingOrder.getSurplusWeight() / 30);
+//                        }
+//                    }
+//                    this.updateById(warehousingOrder);
+//                }
+//            }
 //                }
 //            }
             return "OK";
@@ -1292,39 +1292,39 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
             }
             //利率对成本的影响
             //查入库单利率
-            List<EnabledInfo> enabledInfoList = enabledInfoService.selectList(new EntityWrapper<EnabledInfo>()
-                    .eq("function_type", "2"));
-            if (!CollectionUtils.isEmpty(enabledInfoList)) {
-                for (EnabledInfo enabledInfo : enabledInfoList) {
-                    //查剩余重量>0的入库单
-                    List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
-                            .eq("comp_id", enabledInfo.getCompId())
-//                            .eq("warehouse_name","甘南宏旗库")
-                            .gt("surplus_weight", 0));
-                    if (!CollectionUtils.isEmpty(warehousingOrderList)) {
-                        for (WarehousingOrder warehousingOrder : warehousingOrderList) {
-                            Double distributionMoney = 0d;
-                            List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
-                                    .eq("order_id", warehousingOrder.getId())
-                                    .ne("status", "已驳回"));
-                            if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
-                                distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
-                            }
-                            distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
-                            if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
-                                if (warehousingOrder.getSurplusWeight() > 1) {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30) * warehousingOrder.getSurplusWeight());
-                                    warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30);
-                                } else {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
-                                    warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30);
-                                }
-                            }
-                            this.updateById(warehousingOrder);
-                        }
-                    }
-                }
-            }
+//            List<EnabledInfo> enabledInfoList = enabledInfoService.selectList(new EntityWrapper<EnabledInfo>()
+//                    .eq("function_type", "2"));
+//            if (!CollectionUtils.isEmpty(enabledInfoList)) {
+//                for (EnabledInfo enabledInfo : enabledInfoList) {
+//                    //查剩余重量>0的入库单
+//                    List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
+//                            .eq("comp_id", enabledInfo.getCompId())
+////                            .eq("warehouse_name","甘南宏旗库")
+//                            .gt("surplus_weight", 0));
+//                    if (!CollectionUtils.isEmpty(warehousingOrderList)) {
+//                        for (WarehousingOrder warehousingOrder : warehousingOrderList) {
+//                            Double distributionMoney = 0d;
+//                            List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
+//                                    .eq("order_id", warehousingOrder.getId())
+//                                    .ne("status", "已驳回"));
+//                            if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
+//                                distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
+//                            }
+//                            distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
+//                            if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
+//                                if (warehousingOrder.getSurplusWeight() > 1) {
+//                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30) * warehousingOrder.getSurplusWeight());
+//                                    warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30);
+//                                } else {
+//                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
+//                                    warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30);
+//                                }
+//                            }
+//                            this.updateById(warehousingOrder);
+//                        }
+//                    }
+//                }
+//            }
             return "OK";
         }
         return "NG";
@@ -2795,103 +2795,103 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
      * @param
      * @return
      */
-    @Transactional(rollbackFor = Exception.class)
-//    @Scheduled(cron = "30 30 16 * * ?")
-    public String editAvgCostInfo() {
-        //获取当天16:00
-        SimpleDateFormat now = new SimpleDateFormat("yyyy-MM-dd 16:00:00");
-        Calendar c = Calendar.getInstance();
-        c.setTime(new Date());
-        c.add(Calendar.DATE, 0);
-        String theDay = now.format(c.getTime());
-        Map<String, Object> pageView = new HashMap<>();
-        pageView.put("theDay", theDay);
-        List<WarehousingOrder> dataList = baseMapper.getWarehousingCostByCondition(pageView);
-        if (!CollectionUtils.isEmpty(dataList)) {
-            for (WarehousingOrder warehousingOrder1 : dataList) {
-                //定义未分配金额总和
-                Double totalUnallocatedAmount = 0d;
-                //定义当天分摊仓储费总和
-                Double inTarDayTotal = 0d;
-                //定义入库单剩余库存总量
-                Double totalSurplusWeight = 0d;
-                //查询仓储费用
-                List<ExpenseInfo> expenseInfoList = expenseInfoService.selectList(new EntityWrapper<ExpenseInfo>()
-                        .eq("warehouse_id", warehousingOrder1.getBaseId())
-                        .eq("delete_flag", "0")
-                        .eq("storage_fee_flag", "1")
-                        .eq("comp_id", warehousingOrder1.getCompId())
-                        .eq("status_flag", "4")
-                        .gt("unallocated_amount", 0d));
-                if (!CollectionUtils.isEmpty(expenseInfoList)) {
-                    for (int i = 0; i < expenseInfoList.size(); i++) {
-                        totalUnallocatedAmount += expenseInfoList.get(i).getUnallocatedAmount();
-                    }
-                }
-                //查询分摊金额
-                EnabledInfo enabledInfo = enabledInfoService.selectOne(new EntityWrapper<EnabledInfo>()
-                        .eq("comp_id", warehousingOrder1.getCompId())
-                        .eq("function_type", "3")
-                        .eq("delete_flag", "0"));
-                //查询入库单
-                List<WarehousingOrder> warehousingOrderList = selectList(new EntityWrapper<WarehousingOrder>()
-                        .eq("base_id", warehousingOrder1.getBaseId())
-                        .eq("delete_flag", "0")
-                        .eq("comp_id", warehousingOrder1.getCompId())
-                        .gt("surplus_weight", 0d)
-                        .ne("status", "待付款"));
-                if (!CollectionUtils.isEmpty(warehousingOrderList)) {
-                    for (int i = 0; i < warehousingOrderList.size(); i++) {
-                        totalSurplusWeight += warehousingOrderList.get(i).getSurplusWeight();
-                    }
-                }
-                Double distributionMoney = 0d;
-                List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
-                        .eq("order_id", warehousingOrder1.getId())
-                        .ne("status", "已驳回"));
-                if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
-                    distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
-                }
-                distributionMoney = distributionMoney + warehousingOrder1.getInterest() + warehousingOrder1.getStorageFee();
-                if (distributionMoney / warehousingOrder1.getInWarehouseWeight() < 100) {
-                    //计算当天分摊仓储费总和
-                    inTarDayTotal = totalSurplusWeight * enabledInfo.getValue();
-                    for (ExpenseInfo expenseInfo1 : expenseInfoList) {
-                        ExpenseInfo expenseInfo = expenseInfoService.selectById(expenseInfo1.getId());
-
-                        //判断,未分配的仓储费总和 > 当天分摊仓储费总和
-                        if (totalUnallocatedAmount > inTarDayTotal) {
-
-                            Double totalUnallocatedAmount1 = totalUnallocatedAmount - inTarDayTotal;
-                            //修改平均成本:分摊平均成本+分摊金额
-                            warehousingOrder1.setAvgCost(warehousingOrder1.getAvgCost() + enabledInfo.getValue());
-                            warehousingOrder1.setStorageFee(warehousingOrder1.getStorageFee() + warehousingOrder1.getSurplusWeight() * enabledInfo.getValue());
-                            this.updateById(warehousingOrder1);
-                            //修改仓储费用未分配金额
-                            if (expenseInfo1.getUnallocatedAmount() > inTarDayTotal) {
-                                expenseInfo.setUnallocatedAmount(expenseInfo1.getUnallocatedAmount() - inTarDayTotal);
-                            } else {
-                                expenseInfo.setUnallocatedAmount(0d);
-                            }
-                            expenseInfoService.updateById(expenseInfo);
-                            totalUnallocatedAmount = totalUnallocatedAmount1;
-                        } else {
-                            //修改平均成本:分摊前平均成本+未分配金额总和÷入库单剩余库存总量
-                            warehousingOrder1.setAvgCost(warehousingOrder1.getAvgCost() + totalUnallocatedAmount / totalSurplusWeight);
-                            warehousingOrder1.setStorageFee(warehousingOrder1.getStorageFee() + warehousingOrder1.getSurplusWeight() * (totalUnallocatedAmount / totalSurplusWeight));
-                            this.updateById(warehousingOrder1);
-                            //修改仓储费用未分配金额
-                            expenseInfo.setUnallocatedAmount(0d);
-                            expenseInfoService.updateById(expenseInfo);
-
-                        }
-                    }
-                }
-            }
-            cacheComponent.delPrefixKey(Const.ADMIN_REPEATLIST,dataList.get(0).getCompId());
-        }
-        return "OK";
-    }
+//    @Transactional(rollbackFor = Exception.class)
+////    @Scheduled(cron = "30 30 16 * * ?")
+//    public String editAvgCostInfo() {
+//        //获取当天16:00
+//        SimpleDateFormat now = new SimpleDateFormat("yyyy-MM-dd 16:00:00");
+//        Calendar c = Calendar.getInstance();
+//        c.setTime(new Date());
+//        c.add(Calendar.DATE, 0);
+//        String theDay = now.format(c.getTime());
+//        Map<String, Object> pageView = new HashMap<>();
+//        pageView.put("theDay", theDay);
+//        List<WarehousingOrder> dataList = baseMapper.getWarehousingCostByCondition(pageView);
+//        if (!CollectionUtils.isEmpty(dataList)) {
+//            for (WarehousingOrder warehousingOrder1 : dataList) {
+//                //定义未分配金额总和
+//                Double totalUnallocatedAmount = 0d;
+//                //定义当天分摊仓储费总和
+//                Double inTarDayTotal = 0d;
+//                //定义入库单剩余库存总量
+//                Double totalSurplusWeight = 0d;
+//                //查询仓储费用
+//                List<ExpenseInfo> expenseInfoList = expenseInfoService.selectList(new EntityWrapper<ExpenseInfo>()
+//                        .eq("warehouse_id", warehousingOrder1.getBaseId())
+//                        .eq("delete_flag", "0")
+//                        .eq("storage_fee_flag", "1")
+//                        .eq("comp_id", warehousingOrder1.getCompId())
+//                        .eq("status_flag", "4")
+//                        .gt("unallocated_amount", 0d));
+//                if (!CollectionUtils.isEmpty(expenseInfoList)) {
+//                    for (int i = 0; i < expenseInfoList.size(); i++) {
+//                        totalUnallocatedAmount += expenseInfoList.get(i).getUnallocatedAmount();
+//                    }
+//                }
+//                //查询分摊金额
+//                EnabledInfo enabledInfo = enabledInfoService.selectOne(new EntityWrapper<EnabledInfo>()
+//                        .eq("comp_id", warehousingOrder1.getCompId())
+//                        .eq("function_type", "3")
+//                        .eq("delete_flag", "0"));
+//                //查询入库单
+//                List<WarehousingOrder> warehousingOrderList = selectList(new EntityWrapper<WarehousingOrder>()
+//                        .eq("base_id", warehousingOrder1.getBaseId())
+//                        .eq("delete_flag", "0")
+//                        .eq("comp_id", warehousingOrder1.getCompId())
+//                        .gt("surplus_weight", 0d)
+//                        .ne("status", "待付款"));
+//                if (!CollectionUtils.isEmpty(warehousingOrderList)) {
+//                    for (int i = 0; i < warehousingOrderList.size(); i++) {
+//                        totalSurplusWeight += warehousingOrderList.get(i).getSurplusWeight();
+//                    }
+//                }
+//                Double distributionMoney = 0d;
+//                List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
+//                        .eq("order_id", warehousingOrder1.getId())
+//                        .ne("status", "已驳回"));
+//                if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
+//                    distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
+//                }
+//                distributionMoney = distributionMoney + warehousingOrder1.getInterest() + warehousingOrder1.getStorageFee();
+//                if (distributionMoney / warehousingOrder1.getInWarehouseWeight() < 100) {
+//                    //计算当天分摊仓储费总和
+//                    inTarDayTotal = totalSurplusWeight * enabledInfo.getValue();
+//                    for (ExpenseInfo expenseInfo1 : expenseInfoList) {
+//                        ExpenseInfo expenseInfo = expenseInfoService.selectById(expenseInfo1.getId());
+//
+//                        //判断,未分配的仓储费总和 > 当天分摊仓储费总和
+//                        if (totalUnallocatedAmount > inTarDayTotal) {
+//
+//                            Double totalUnallocatedAmount1 = totalUnallocatedAmount - inTarDayTotal;
+//                            //修改平均成本:分摊平均成本+分摊金额
+//                            warehousingOrder1.setAvgCost(warehousingOrder1.getAvgCost() + enabledInfo.getValue());
+//                            warehousingOrder1.setStorageFee(warehousingOrder1.getStorageFee() + warehousingOrder1.getSurplusWeight() * enabledInfo.getValue());
+//                            this.updateById(warehousingOrder1);
+//                            //修改仓储费用未分配金额
+//                            if (expenseInfo1.getUnallocatedAmount() > inTarDayTotal) {
+//                                expenseInfo.setUnallocatedAmount(expenseInfo1.getUnallocatedAmount() - inTarDayTotal);
+//                            } else {
+//                                expenseInfo.setUnallocatedAmount(0d);
+//                            }
+//                            expenseInfoService.updateById(expenseInfo);
+//                            totalUnallocatedAmount = totalUnallocatedAmount1;
+//                        } else {
+//                            //修改平均成本:分摊前平均成本+未分配金额总和÷入库单剩余库存总量
+//                            warehousingOrder1.setAvgCost(warehousingOrder1.getAvgCost() + totalUnallocatedAmount / totalSurplusWeight);
+//                            warehousingOrder1.setStorageFee(warehousingOrder1.getStorageFee() + warehousingOrder1.getSurplusWeight() * (totalUnallocatedAmount / totalSurplusWeight));
+//                            this.updateById(warehousingOrder1);
+//                            //修改仓储费用未分配金额
+//                            expenseInfo.setUnallocatedAmount(0d);
+//                            expenseInfoService.updateById(expenseInfo);
+//
+//                        }
+//                    }
+//                }
+//            }
+//            cacheComponent.delPrefixKey(Const.ADMIN_REPEATLIST,dataList.get(0).getCompId());
+//        }
+//        return "OK";
+//    }
 
     /**
      * 入库单导出