Ver código fonte

订单同步完善单价和包材

24282 1 ano atrás
pai
commit
941290fe53

+ 42 - 0
sd-business/src/main/java/com/sd/business/entity/bom/bo/BomBo.java

@@ -0,0 +1,42 @@
+package com.sd.business.entity.bom.bo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class BomBo {
+
+    /**
+     * sku规格id
+     */
+    private Long skuSpecId;
+
+    /**
+     * bomId
+     */
+    private Long bomId;
+
+    /**
+     * bom规格id
+     */
+    private Long bomSpecId;
+
+    /**
+     * 加工面板 字典:charge_item
+     */
+    private String machinedPanel;
+
+    /**
+     * 对内销售价(含税)
+     */
+    private BigDecimal internalSellingPrice;
+
+    /**
+     * 对外销售价(含税)
+     */
+    private BigDecimal externalSellingPrice;
+
+}

+ 5 - 0
sd-business/src/main/java/com/sd/business/entity/department/po/Department.java

@@ -95,4 +95,9 @@ public class Department extends BasePo {
      */
     private String wlnBrand;
 
+    /**
+     * 加工计费标准id
+     */
+    private Long priceBillingStandardId;
+
 }

+ 0 - 5
sd-business/src/main/java/com/sd/business/entity/order/po/OrderSkuBom.java

@@ -45,9 +45,4 @@ public class OrderSkuBom extends BasePo {
      */
     private BigDecimal quantity;
 
-    /**
-     * 总数量
-     */
-    private BigDecimal totalQuantity;
-
 }

+ 2 - 2
sd-business/src/main/java/com/sd/business/entity/price/po/PriceBillingStandardDetail.java

@@ -43,13 +43,13 @@ public class PriceBillingStandardDetail extends BasePo {
      * 收费模式数值区间最小值
      */
     @NotNull(message = "收费模式数值区间最小值不能为空")
-    private Integer sectionMin;
+    private BigDecimal sectionMin;
 
     /**
      * 收费模式数值区间最大值
      */
     @NotNull(message = "收费模式数值区间最大值不能为空")
-    private Integer sectionMax;
+    private BigDecimal sectionMax;
 
     /**
      * 收费价格

+ 1 - 1
sd-business/src/main/java/com/sd/business/entity/sku/po/SkuSpec.java

@@ -56,7 +56,7 @@ public class SkuSpec extends BasePo {
     private String name;
 
     /**
-     * 加工面板 字典:skuSpec_machinedPanel
+     * 加工面板 字典:charge_item
      */
     private String machinedPanel;
 

+ 2 - 1
sd-business/src/main/java/com/sd/business/entity/sku/po/SkuSpecLink.java

@@ -7,6 +7,7 @@ import lombok.Setter;
 
 import javax.validation.constraints.DecimalMin;
 import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
 
 /**
  * <p>
@@ -52,6 +53,6 @@ public class SkuSpecLink extends BasePo {
      */
     @NotNull(message = "数量不能为空")
     @DecimalMin(value = "0.01", message = "必须大于0")
-    private Integer quantity;
+    private BigDecimal quantity;
 
 }

+ 9 - 0
sd-business/src/main/java/com/sd/business/mapper/sku/SkuSpecMapper.java

@@ -1,12 +1,16 @@
 package com.sd.business.mapper.sku;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.bom.bo.BomBo;
 import com.sd.business.entity.sku.po.SkuSpec;
 import com.sd.business.entity.sku.vo.SkuSpecVo;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 
 /**
  * <p>
@@ -23,4 +27,9 @@ public interface SkuSpecMapper extends BaseMapper<SkuSpec> {
      */
     Page<SkuSpecVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<SkuSpec> wrapper);
 
+    /**
+     * 根据sku规格id获取bomId和bom规格id
+     */
+    List<BomBo> getBomBoList(@Param("ew") QueryWrapper<Object> in);
+
 }

+ 9 - 0
sd-business/src/main/java/com/sd/business/service/sku/SkuSpecService.java

@@ -2,11 +2,15 @@ package com.sd.business.service.sku;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.bom.bo.BomBo;
 import com.sd.business.entity.sku.dto.SkuSpecDto;
 import com.sd.business.entity.sku.dto.SkuSpecSelectDto;
 import com.sd.business.entity.sku.po.SkuSpec;
 import com.sd.business.entity.sku.vo.SkuSpecVo;
 
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * <p>
@@ -43,4 +47,9 @@ public interface SkuSpecService extends BaseService<SkuSpec> {
      */
     void delete(Long id);
 
+    /**
+     * 根据sku规格id获取bomId和bom规格id
+     */
+    Map<Long, BomBo> getBomBoByIdList(List<Long> skuSpecIdList);
+
 }

+ 27 - 0
sd-business/src/main/java/com/sd/business/service/sku/impl/SkuSpecServiceImpl.java

@@ -1,9 +1,12 @@
 package com.sd.business.service.sku.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.bom.bo.BomBo;
 import com.sd.business.entity.sku.dto.SkuSpecDto;
 import com.sd.business.entity.sku.dto.SkuSpecSelectDto;
 import com.sd.business.entity.sku.po.SkuSpec;
@@ -12,6 +15,12 @@ import com.sd.business.mapper.sku.SkuSpecMapper;
 import com.sd.business.service.sku.SkuSpecService;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
 
 /**
  * <p>
@@ -54,4 +63,22 @@ public class SkuSpecServiceImpl extends ServiceImpl<SkuSpecMapper, SkuSpec> impl
         this.removeById(id);
     }
 
+    @Override
+    public Map<Long, BomBo> getBomBoByIdList(List<Long> skuSpecIdList) {
+
+        if (ObjectUtil.isEmpty(skuSpecIdList)) {
+            return Collections.emptyMap();
+        }
+
+        skuSpecIdList = skuSpecIdList.stream().filter(ObjectUtil::isNotNull).distinct().collect(Collectors.toList());
+
+        if (ObjectUtil.isEmpty(skuSpecIdList)) {
+            return Collections.emptyMap();
+        }
+
+        List<BomBo> list = baseMapper.getBomBoList(Wrappers.query().in("ss.id", skuSpecIdList));
+
+        return list.stream().collect(Collectors.toMap(BomBo::getSkuSpecId, Function.identity()));
+    }
+
 }

+ 0 - 1
sd-business/src/main/resources/mapper/order/OrderSkuBomMapper.xml

@@ -8,7 +8,6 @@
                osb.bom_spec_id,
                osb.unit_price,
                osb.quantity,
-               osb.total_quantity,
                osb.create_user,
                osb.create_time,
                osb.update_user,

+ 14 - 1
sd-business/src/main/resources/mapper/sku/SkuSpecMapper.xml

@@ -12,7 +12,7 @@
                ss.length,
                ss.width,
                ss.height,
-               ss.netWeight,
+               ss.net_weight,
                ss.shared_folder,
                ss.bom_spec_id,
                ss.create_user,
@@ -23,4 +23,17 @@
             ${ew.customSqlSegment}
     </select>
 
+    <select id="getBomBoList" resultType="com.sd.business.entity.bom.bo.BomBo">
+        SELECT ss.id skuSpecId,
+               ss.machined_panel,
+               bs.id bomSpecId,
+               bs.internal_selling_price,
+               bs.external_selling_price,
+               b.id  bomId
+        FROM sku_spec ss
+                 INNER JOIN bom_spec bs ON ss.bom_spec_id = bs.id
+                 INNER JOIN bom b ON bs.bom_id = b.id
+            ${ew.customSqlSegment}
+    </select>
+
 </mapper>

+ 28 - 0
sd-framework/src/main/java/com/sd/framework/controller/SdDictController.java

@@ -0,0 +1,28 @@
+package com.sd.framework.controller;
+
+import com.fjhx.tenant.entity.dict.po.DictCommonData;
+import com.fjhx.tenant.service.dict.DictCommonDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@Controller
+public class SdDictController {
+
+    @Autowired
+    private DictCommonDataService dictCommonDataService;
+
+    /**
+     * 申购单分页
+     */
+    @PostMapping("/allDictMap")
+    public Map<String, DictCommonData> allDictMap() {
+        return dictCommonDataService.list(q -> q.orderByAsc(DictCommonData::getSort)).stream()
+                .collect(Collectors.toMap(DictCommonData::getDictCode, Function.identity()));
+    }
+
+}

+ 236 - 25
sd-wln/src/main/java/com/sd/wln/service/impl/WlnOrderServiceImpl.java

@@ -7,15 +7,23 @@ import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.fjhx.tenant.entity.dict.po.DictCommonData;
 import com.fjhx.tenant.service.dict.DictCommonDataService;
+import com.ruoyi.common.core.domain.BaseIdPo;
 import com.ruoyi.framework.mybatis.holder.LogicHolder;
+import com.sd.business.entity.bom.bo.BomBo;
 import com.sd.business.entity.department.po.Department;
 import com.sd.business.entity.order.enums.OrderStatusEnum;
 import com.sd.business.entity.order.po.OrderInfo;
 import com.sd.business.entity.order.po.OrderSku;
+import com.sd.business.entity.order.po.OrderSkuBom;
+import com.sd.business.entity.price.po.PriceBillingStandardDetail;
 import com.sd.business.entity.sku.po.SkuSpec;
+import com.sd.business.entity.sku.po.SkuSpecLink;
 import com.sd.business.service.department.DepartmentService;
 import com.sd.business.service.order.OrderService;
+import com.sd.business.service.order.OrderSkuBomService;
 import com.sd.business.service.order.OrderSkuService;
+import com.sd.business.service.price.PriceBillingStandardDetailService;
+import com.sd.business.service.sku.SkuSpecLinkService;
 import com.sd.business.service.sku.SkuSpecService;
 import com.sd.wln.service.WlnOrderService;
 import com.sd.wln.util.WlnUtil;
@@ -53,8 +61,17 @@ public class WlnOrderServiceImpl implements WlnOrderService {
     private OrderSkuService orderSkuService;
 
     @Autowired
+    private OrderSkuBomService orderSkuBomService;
+
+    @Autowired
     private SkuSpecService skuSpecService;
 
+    @Autowired
+    private PriceBillingStandardDetailService priceBillingStandardDetailService;
+
+    @Autowired
+    private SkuSpecLinkService skuSpecLinkService;
+
     @Override
     public boolean syncOrder() {
 
@@ -67,6 +84,8 @@ public class WlnOrderServiceImpl implements WlnOrderService {
         List<OrderInfo> updateOrderList = new ArrayList<>();
         // 保存订单明细列表
         List<OrderSku> saveOrderSkuList = new ArrayList<>();
+        // 保存订单包材
+        List<OrderSkuBom> saveOrderSkuBomList = new ArrayList<>();
 
         // 查询近3天万里牛订单
         List<JSONObject> wlnOrderList = getWlnOrderList(endDate);
@@ -117,13 +136,25 @@ public class WlnOrderServiceImpl implements WlnOrderService {
 
             // 创建订单sku
             for (JSONObject wlnOrderSku : wlnOrder.getJSONArray("orders").toJavaList(JSONObject.class)) {
-                SkuSpec skuSpec = skuSpecMap.get(wlnOrderSku.getString("sys_spec_uid"));
+                String sysSpecUid = wlnOrderSku.getString("sys_spec_uid");
+                SkuSpec skuSpec = skuSpecMap.get(sysSpecUid);
+                if (skuSpec == null) {
+                    log.error("没有通过万里牛sys_spec_uid找到sku规格");
+                    continue;
+                }
+
                 OrderSku orderSku = createOrderSku(wlnOrderSku, orderInfo, skuSpec);
                 saveOrderSkuList.add(orderSku);
+
+                List<OrderSkuBom> orderSkuBomList = createOrderSkuBoom(orderInfo, orderSku);
+                saveOrderSkuBomList.addAll(orderSkuBomList);
             }
 
         }
 
+        // 赋值订单价格
+        setOrderPrice(departmentMap, saveOrderList, saveOrderSkuList, saveOrderSkuBomList, skuSpecMap);
+
         // 开启事务
         TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
         try {
@@ -136,6 +167,9 @@ public class WlnOrderServiceImpl implements WlnOrderService {
             if (saveOrderSkuList.size() > 0) {
                 orderSkuService.saveBatch(saveOrderSkuList);
             }
+            if (saveOrderSkuBomList.size() > 0) {
+                orderSkuBomService.saveBatch(saveOrderSkuBomList);
+            }
             // 提交事务
             platformTransactionManager.commit(transactionStatus);
             return true;
@@ -152,8 +186,7 @@ public class WlnOrderServiceImpl implements WlnOrderService {
      * 查询近3天万里牛订单
      */
     private List<JSONObject> getWlnOrderList(Date endDate) {
-        List<DictCommonData> warehouseCodeList = dictCommonDataService.list(q -> q
-                .eq(DictCommonData::getDictCode, "warehouse_code"));
+        List<DictCommonData> warehouseCodeList = dictCommonDataService.list(q -> q.eq(DictCommonData::getDictCode, "warehouse_code"));
         if (warehouseCodeList.size() == 0) {
             log.error("订单同步失败,仓库字典:warehouse_code 为空");
             return null;
@@ -164,25 +197,25 @@ public class WlnOrderServiceImpl implements WlnOrderService {
         long endTime = endDate.getTime();
         long startTime = endTime - 1000 * 60 * 60 * 24;
 
-        for (int i = 0; i < 3; i++) {
-            for (DictCommonData dictCommonData : warehouseCodeList) {
-                int page = 1;
-                int size;
-                do {
-                    try {
-                        List<JSONObject> itemList = WlnUtil.getOrderList(page, 200, startTime, endTime, dictCommonData.getDictValue());
-                        page++;
-                        size = itemList.size();
-                        list.addAll(itemList);
-                    } catch (Exception e) {
-                        log.error("订单同步失败", e);
-                        return null;
-                    }
-                } while (size >= 200);
-            }
-            startTime -= 1000 * 60 * 60 * 24;
-            endTime -= 1000 * 60 * 60 * 24;
+        // for (int i = 0; i < 3; i++) {
+        for (DictCommonData dictCommonData : warehouseCodeList) {
+            int page = 1;
+            int size;
+            do {
+                try {
+                    List<JSONObject> itemList = WlnUtil.getOrderList(page, 200, startTime, endTime, dictCommonData.getDictValue());
+                    page++;
+                    size = itemList.size();
+                    list.addAll(itemList);
+                } catch (Exception e) {
+                    log.error("订单同步失败", e);
+                    return null;
+                }
+            } while (size >= 200);
         }
+        //     startTime -= 1000 * 60 * 60 * 24;
+        //     endTime -= 1000 * 60 * 60 * 24;
+        // }
 
         return list;
     }
@@ -278,11 +311,189 @@ public class WlnOrderServiceImpl implements WlnOrderService {
         orderSku.setWlnSkuId(wlnOrderSku.getString("sys_goods_uid"));
         orderSku.setWlnSkuSpecId(wlnOrderSku.getString("sys_spec_uid"));
         orderSku.setWlnSkuName(wlnOrderSku.getString("oln_sku_name"));
-        if (skuSpec != null) {
-            orderSku.setSkuId(skuSpec.getSkuId());
-            orderSku.setSkuSpecId(skuSpec.getId());
-        }
+        orderSku.setSkuId(skuSpec.getSkuId());
+        orderSku.setSkuSpecId(skuSpec.getId());
         return orderSku;
     }
 
+    /**
+     * 创建订单包材
+     */
+    private List<OrderSkuBom> createOrderSkuBoom(OrderInfo orderInfo, OrderSku orderSku) {
+        List<SkuSpecLink> list = skuSpecLinkService.list(q -> q
+                .eq(SkuSpecLink::getSkuSpecId, orderSku.getSkuSpecId())
+                .eq(SkuSpecLink::getType, 1)
+                .eq(SkuSpecLink::getDepartmentId, orderInfo.getDepartmentId())
+        );
+
+        // 根据sku规格id获取bomId和bom规格id
+        Map<Long, BomBo> bomBoMap = skuSpecService.getBomBoByIdList(
+                list.stream().map(SkuSpecLink::getSkuSpecId).collect(Collectors.toList()));
+
+        return list.stream().map(item -> {
+            BomBo bomBo = bomBoMap.get(item.getBomSpecId());
+
+            OrderSkuBom orderSkuBom = new OrderSkuBom();
+            orderSkuBom.setId(IdWorker.getId());
+            orderSkuBom.setOrderId(orderInfo.getId());
+            orderSkuBom.setOrderSkuId(orderSku.getId());
+            orderSkuBom.setBomSpecId(item.getBomSpecId());
+            orderSkuBom.setQuantity(item.getQuantity());
+            orderSkuBom.setUnitPrice(bomBo == null ? BigDecimal.ZERO :
+                    ObjectUtil.defaultIfNull(bomBo.getInternalSellingPrice(), BigDecimal.ZERO));
+            return orderSkuBom;
+        }).collect(Collectors.toList());
+    }
+
+    /**
+     * 赋值订单价格
+     */
+    private void setOrderPrice(Map<String, Department> departmentMap,
+                               List<OrderInfo> orderList,
+                               List<OrderSku> orderSkuList,
+                               List<OrderSkuBom> saveOrderSkuBomList,
+                               Map<String, SkuSpec> skuSpecMap) {
+
+        if (orderList.size() == 0 || orderSkuList.size() == 0) {
+            return;
+        }
+
+        // 部门id、加工计费标准id map
+        Map<Long, Long> departmentIdPriceBillingStandardIdMap = departmentMap.values().stream()
+                .collect(Collectors.toMap(BaseIdPo::getId, Department::getPriceBillingStandardId));
+
+        // 加工计费标准id 报价规则列表 map
+        Map<Long, List<PriceBillingStandardDetail>> priceBillingStandardMap = priceBillingStandardDetailService.list()
+                .stream().collect(Collectors.groupingBy(PriceBillingStandardDetail::getPriceBillingStandardId));
+
+        // 根据sku规格id获取bomId和bom规格id
+        Map<Long, BomBo> bomBoMap = skuSpecService.getBomBoByIdList(
+                orderSkuList.stream().map(OrderSku::getSkuSpecId).collect(Collectors.toList()));
+
+        // 订单明细
+        Map<Long, List<OrderSku>> orderSkuGroup = orderSkuList.stream().collect(Collectors.groupingBy(OrderSku::getOrderId));
+
+        for (OrderInfo orderInfo : orderList) {
+
+            orderInfo.setProductTotalAmount(BigDecimal.ZERO);
+            orderInfo.setCustomProcessingFee(BigDecimal.ZERO);
+            orderInfo.setLssueFee(BigDecimal.ZERO);
+            orderInfo.setDeliveryMaterialsFee(BigDecimal.ZERO);
+            orderInfo.setPackingLabor(BigDecimal.ZERO);
+            orderInfo.setPackagingMaterialCost(BigDecimal.ZERO);
+
+            List<OrderSku> itemOrderSkuList = orderSkuGroup.get(orderInfo.getId());
+            if (ObjectUtil.isEmpty(itemOrderSkuList)) {
+                continue;
+            }
+
+            for (OrderSku orderSku : itemOrderSkuList) {
+
+                // 赋值单价
+                assignedUnitPrice(bomBoMap, orderSku);
+
+                // 赋值其他价格
+                assignedOtherPrice(orderSku, orderInfo.getDepartmentId(),
+                        departmentIdPriceBillingStandardIdMap, priceBillingStandardMap, skuSpecMap);
+
+                // 添加订单金额
+                addOrderInfoPrice(orderInfo, orderSku, saveOrderSkuBomList);
+            }
+
+        }
+    }
+
+    /**
+     * 赋值单价
+     */
+    private void assignedUnitPrice(Map<Long, BomBo> bomBoMap, OrderSku orderSku) {
+        BomBo bomBo = bomBoMap.get(orderSku.getSkuSpecId());
+        if (bomBo != null) {
+            orderSku.setUnitPrice(ObjectUtil.defaultIfNull(bomBo.getInternalSellingPrice(), BigDecimal.ZERO));
+        } else {
+            orderSku.setUnitPrice(BigDecimal.ZERO);
+        }
+    }
+
+    /**
+     * 赋值其他价格
+     */
+    private void assignedOtherPrice(OrderSku orderSku,
+                                    Long departmentId,
+                                    Map<Long, Long> departmentIdPriceBillingStandardIdMap,
+                                    Map<Long, List<PriceBillingStandardDetail>> priceBillingStandardMap,
+                                    Map<String, SkuSpec> skuSpecMap) {
+
+        orderSku.setCustomProcessingFee(BigDecimal.ZERO);
+        orderSku.setLssueFee(BigDecimal.ZERO);
+        orderSku.setDeliveryMaterialsFee(BigDecimal.ZERO);
+        orderSku.setPackingLabor(BigDecimal.ZERO);
+
+        // 获取加工计费标准id
+        Long priceBillingStandardId = departmentIdPriceBillingStandardIdMap.get(departmentId);
+        if (priceBillingStandardId == null) {
+            return;
+        }
+
+        // 报价规则列表
+        List<PriceBillingStandardDetail> priceBillingStandardDetailList = priceBillingStandardMap.get(priceBillingStandardId);
+        if (ObjectUtil.isEmpty(priceBillingStandardDetailList)) {
+            return;
+        }
+
+        for (PriceBillingStandardDetail priceBillingStandardDetail : priceBillingStandardDetailList) {
+
+            String chargeItem = priceBillingStandardDetail.getChargeItem();
+            BigDecimal chargePrice = priceBillingStandardDetail.getChargePrice();
+
+            switch (chargeItem) {
+                case "3":
+                    orderSku.setPackingLabor(chargePrice);
+                    break;
+                case "4":
+                    orderSku.setLssueFee(chargePrice);
+                    break;
+                case "5":
+                    orderSku.setDeliveryMaterialsFee(chargePrice);
+                    break;
+                default:
+                    SkuSpec skuSpec = skuSpecMap.get(orderSku.getWlnSkuSpecId());
+                    if (skuSpec != null
+                            && Objects.equals(chargeItem, skuSpec.getMachinedPanel())
+                            && priceBillingStandardDetail.getSectionMin().compareTo(orderSku.getQuantity()) >= 0
+                            && priceBillingStandardDetail.getSectionMax().compareTo(orderSku.getQuantity()) < 0) {
+                        orderSku.setCustomProcessingFee(chargePrice);
+                    }
+            }
+        }
+    }
+
+    /**
+     * 添加订单价格
+     */
+    private void addOrderInfoPrice(OrderInfo orderInfo, OrderSku orderSku, List<OrderSkuBom> saveOrderSkuBomList) {
+        BigDecimal productTotalAmount = orderSku.getQuantity().multiply(orderSku.getUnitPrice());
+        BigDecimal customProcessingFee = orderSku.getQuantity().multiply(orderSku.getCustomProcessingFee());
+        BigDecimal lssueFee = orderSku.getQuantity().multiply(orderSku.getLssueFee());
+        BigDecimal deliveryMaterialsFee = orderSku.getQuantity().multiply(orderSku.getDeliveryMaterialsFee());
+        BigDecimal packingLabor = orderSku.getQuantity().multiply(orderSku.getPackingLabor());
+        BigDecimal totalAmount = productTotalAmount.add(customProcessingFee).add(lssueFee).add(deliveryMaterialsFee).add(packingLabor);
+
+        BigDecimal packagingMaterialCost = saveOrderSkuBomList.stream()
+                .filter(item -> Objects.equals(item.getOrderId(), orderInfo.getId()))
+                .filter(item -> Objects.equals(item.getOrderSkuId(), orderSku.getId()))
+                .map(item -> item.getUnitPrice().multiply(item.getQuantity()))
+                .reduce(BigDecimal.ZERO, BigDecimal::add)
+                .multiply(orderSku.getQuantity());
+
+        orderInfo.setProductTotalAmount(orderInfo.getProductTotalAmount().add(productTotalAmount));
+        orderInfo.setCustomProcessingFee(orderInfo.getCustomProcessingFee().add(customProcessingFee));
+        orderInfo.setLssueFee(orderInfo.getLssueFee().add(lssueFee));
+        orderInfo.setDeliveryMaterialsFee(orderInfo.getDeliveryMaterialsFee().add(deliveryMaterialsFee));
+        orderInfo.setPackingLabor(orderInfo.getPackingLabor().add(packingLabor));
+        orderInfo.setPackagingMaterialCost(packagingMaterialCost);
+        orderInfo.setTotalAmount(orderInfo.getTotalAmount().add(totalAmount));
+
+    }
+
 }