yangdamao 2 лет назад
Родитель
Сommit
b56e427b86

+ 20 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -1025,9 +1025,27 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 //根据订单金额匹配成本阶梯
                 List<TopCostTpItem> tpItems = new ArrayList<>();
                 for (TopCostTpItem x : items) {
+                    BigDecimal price = goodsPrice;
+                    if (x.getDockStatus() == 1){
+                        //启用成本扣除项
+                        switch (x.getDockType()){
+                            case 1://百分比
+                                //成本扣除金额
+                                BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+                                BigDecimal multiply = goodsPrice.multiply(divide1);
+                                price = price.subtract(multiply);
+                                break;
+                            case 2://固定金额
+                                price = price.subtract(x.getDockValue());
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+
                     if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                            || (goodsPrice.compareTo(x.getMinValue()) > 0 && goodsPrice.compareTo(x.getMaxValue()) < 0)
-                            || (goodsPrice.compareTo(x.getMinValue()) == 0 && goodsPrice.compareTo(x.getMaxValue()) == 0)){
+                            || (price.compareTo(x.getMinValue()) > 0 && price.compareTo(x.getMaxValue()) < 0)
+                            || (price.compareTo(x.getMinValue()) == 0 && price.compareTo(x.getMaxValue()) == 0)){
                         tpItems.add(x);
                     }
                 }

+ 123 - 24
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java

@@ -392,9 +392,27 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 //根据订单金额匹配成本阶梯
                 List<TopCostTpItem> tpItems = new ArrayList<>();
                 for (TopCostTpItem x : items) {
+                    BigDecimal price = goodsPrice;
+                    if (x.getDockStatus() == 1){
+                        //启用成本扣除项
+                        switch (x.getDockType()){
+                            case 1://百分比
+                                //成本扣除金额
+                                BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+                                BigDecimal multiply = goodsPrice.multiply(divide1);
+                                price = price.subtract(multiply);
+                                break;
+                            case 2://固定金额
+                                price = price.subtract(x.getDockValue());
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+
                     if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                            || (goodsPrice.compareTo(x.getMinValue()) > 0 && goodsPrice.compareTo(x.getMaxValue()) < 0)
-                            || (goodsPrice.compareTo(x.getMinValue()) == 0 && goodsPrice.compareTo(x.getMaxValue()) == 0)){
+                            || (price.compareTo(x.getMinValue()) > 0 && price.compareTo(x.getMaxValue()) < 0)
+                            || (price.compareTo(x.getMinValue()) == 0 && price.compareTo(x.getMaxValue()) == 0)){
                         tpItems.add(x);
                     }
                 }
@@ -622,11 +640,8 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 if (item.getProjectId() == -1 && item.getBusinessId() == -1){
                     return true;
                 }
-//                TopCourseProjectType projectType = topCourseProjectTypeService.getById(item.getProjectId());
                 TopCourseBusiness business = topCourseBusinessService.getById(item.getBusinessId());
-//                if (businessFullName.contains(projectType.getProjectName()) && businessFullName.contains(business.getBusinessName())){
-//                    return true;
-//                }
+
                 if (businessFullName.contains(business.getOldBusinessName())){
                     return true;
                 }
@@ -639,9 +654,27 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
             //根据订单金额匹配成本阶梯
             List<TopCostTpItemVo> tpItems = new ArrayList<>();
             for (TopCostTpItemVo x : items) {
+                BigDecimal price = goodsPrice;
+                if (x.getDockStatus() == 1){
+                    //启用成本扣除项
+                    switch (x.getDockType()){
+                        case 1://百分比
+                            //成本扣除金额
+                            BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+                            BigDecimal multiply = goodsPrice.multiply(divide1);
+                            price = price.subtract(multiply);
+                            break;
+                        case 2://固定金额
+                            price = price.subtract(x.getDockValue());
+                            break;
+                        default:
+                            break;
+                    }
+                }
+
                 if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                        || (goodsPrice.compareTo(x.getMinValue()) > 0 && goodsPrice.compareTo(x.getMaxValue()) < 0)
-                        || (goodsPrice.compareTo(x.getMinValue()) == 0 && goodsPrice.compareTo(x.getMaxValue()) == 0)){
+                        || (price.compareTo(x.getMinValue()) > 0 && price.compareTo(x.getMaxValue()) < 0)
+                        || (price.compareTo(x.getMinValue()) == 0 && price.compareTo(x.getMaxValue()) == 0)){
                     tpItems.add(x);
                 }
             }
@@ -2266,9 +2299,27 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 //根据订单金额匹配成本阶梯
                 List<TopCostTpItemVo> tpItems = new ArrayList<>();
                 for (TopCostTpItemVo x : items) {
+                    BigDecimal price = goodsPrice;
+                    if (x.getDockStatus() == 1){
+                        //启用成本扣除项
+                        switch (x.getDockType()){
+                            case 1://百分比
+                                //成本扣除金额
+                                BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+                                BigDecimal multiply = goodsPrice.multiply(divide1);
+                                price = price.subtract(multiply);
+                                break;
+                            case 2://固定金额
+                                price = price.subtract(x.getDockValue());
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+
                     if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                            || (goodsPrice.compareTo(x.getMinValue()) > 0 && goodsPrice.compareTo(x.getMaxValue()) < 0)
-                            || (goodsPrice.compareTo(x.getMinValue()) == 0 && goodsPrice.compareTo(x.getMaxValue()) == 0)){
+                            || (price.compareTo(x.getMinValue()) > 0 && price.compareTo(x.getMaxValue()) < 0)
+                            || (price.compareTo(x.getMinValue()) == 0 && price.compareTo(x.getMaxValue()) == 0)){
                         tpItems.add(x);
                     }
                 }
@@ -2359,11 +2410,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                     if (x.getProjectId() == -1 && x.getBusinessId() == -1){
                         return true;
                     }
-//                    TopCourseProjectType projectType = topCourseProjectTypeService.getById(x.getProjectId());
                     TopCourseBusiness business = topCourseBusinessService.getById(x.getBusinessId());
-//                    if (businessName.contains(projectType.getProjectName()) && businessName.contains(business.getBusinessName())){
-//                        return true;
-//                    }
                     if (businessName.contains(business.getOldBusinessName())){
                         return true;
                     }
@@ -2376,9 +2423,27 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 //根据订单金额匹配成本阶梯
                 List<TopCostTpItemVo> tpItems = new ArrayList<>();
                 for (TopCostTpItemVo x : items) {
+                    BigDecimal price = goodsPrice;
+                    if (x.getDockStatus() == 1){
+                        //启用成本扣除项
+                        switch (x.getDockType()){
+                            case 1://百分比
+                                //成本扣除金额
+                                BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+                                BigDecimal multiply = goodsPrice.multiply(divide1);
+                                price = price.subtract(multiply);
+                                break;
+                            case 2://固定金额
+                                price = price.subtract(x.getDockValue());
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+
                     if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                            || (goodsPrice.compareTo(x.getMinValue()) > 0 && goodsPrice.compareTo(x.getMaxValue()) < 0)
-                            || (goodsPrice.compareTo(x.getMinValue()) == 0 && goodsPrice.compareTo(x.getMaxValue()) == 0)){
+                            || (price.compareTo(x.getMinValue()) > 0 && price.compareTo(x.getMaxValue()) < 0)
+                            || (price.compareTo(x.getMinValue()) == 0 && price.compareTo(x.getMaxValue()) == 0)){
                         tpItems.add(x);
                     }
                 }
@@ -2752,9 +2817,27 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                     //根据订单金额匹配成本阶梯
                     List<TopCostTpItemVo> tpItems = new ArrayList<>();
                     for (TopCostTpItemVo x : items) {
+                        BigDecimal price = goodsPrice;
+                        if (x.getDockStatus() == 1){
+                            //启用成本扣除项
+                            switch (x.getDockType()){
+                                case 1://百分比
+                                    //成本扣除金额
+                                    BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+                                    BigDecimal multiply = goodsPrice.multiply(divide1);
+                                    price = price.subtract(multiply);
+                                    break;
+                                case 2://固定金额
+                                    price = price.subtract(x.getDockValue());
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+
                         if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                                || (goodsPrice.compareTo(x.getMinValue()) > 0 && goodsPrice.compareTo(x.getMaxValue()) < 0)
-                                || (goodsPrice.compareTo(x.getMinValue()) == 0 && goodsPrice.compareTo(x.getMaxValue()) == 0)){
+                                || (price.compareTo(x.getMinValue()) > 0 && price.compareTo(x.getMaxValue()) < 0)
+                                || (price.compareTo(x.getMinValue()) == 0 && price.compareTo(x.getMaxValue()) == 0)){
                             tpItems.add(x);
                         }
                     }
@@ -2828,6 +2911,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                 List<TopOldOrderGoods> orderGoodsList = topOrderGoodsService
                         .list(new LambdaQueryWrapper<TopOldOrderGoods>()
                                 .eq(TopOldOrderGoods::getOrderSn, orderSn)
+                                .in(TopOldOrderGoods::getCheckStatus,Arrays.asList(0,1))
                                 .eq(TopOldOrderGoods::getStatus, 1));
                 if (ObjectUtils.isNotNull(order.getPretaxBrokerage()) && order.getPretaxBrokerage().compareTo(BigDecimal.ZERO) != 0){
                     halveBrokerage = brokerage.divide(new BigDecimal(orderGoodsList.size()),4,BigDecimal.ROUND_DOWN);
@@ -2855,11 +2939,8 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                         if (item.getProjectId() == -1 && item.getBusinessId() == -1){
                             return true;
                         }
-//                        TopCourseProjectType projectType = topCourseProjectTypeService.getById(item.getProjectId());
                         TopCourseBusiness business = topCourseBusinessService.getById(item.getBusinessId());
-//                        if (businessName.contains(projectType.getProjectName()) && businessName.contains(business.getBusinessName())){
-//                            return true;
-//                        }
+
                         if (businessName.contains(business.getOldBusinessName())){
                             return true;
                         }
@@ -2872,9 +2953,27 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                     //根据订单金额匹配成本阶梯
                     List<TopCostTpItemVo> tpItems = new ArrayList<>();
                     for (TopCostTpItemVo x : items) {
+                        BigDecimal price = goodsPrice;
+                        if (x.getDockStatus() == 1){
+                            //启用成本扣除项
+                            switch (x.getDockType()){
+                                case 1://百分比
+                                    //成本扣除金额
+                                    BigDecimal divide1 = x.getDockValue().divide(new BigDecimal("100"));
+                                    BigDecimal multiply = goodsPrice.multiply(divide1);
+                                    price = price.subtract(multiply);
+                                    break;
+                                case 2://固定金额
+                                    price = price.subtract(x.getDockValue());
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+
                         if ((ObjectUtils.isNull(x.getMinValue()) && ObjectUtils.isNull(x.getMaxValue()))
-                                || (goodsPrice.compareTo(x.getMinValue()) > 0 && goodsPrice.compareTo(x.getMaxValue()) < 0)
-                                || (goodsPrice.compareTo(x.getMinValue()) == 0 && goodsPrice.compareTo(x.getMaxValue()) == 0)){
+                                || (price.compareTo(x.getMinValue()) > 0 && price.compareTo(x.getMaxValue()) < 0)
+                                || (price.compareTo(x.getMinValue()) == 0 && price.compareTo(x.getMaxValue()) == 0)){
                             tpItems.add(x);
                         }
                     }