|
@@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.ruoyi.common.constant.StatusConstant;
|
|
|
-import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.sd.business.entity.bom.bo.BomBo;
|
|
|
import com.sd.business.entity.department.po.Department;
|
|
|
import com.sd.business.entity.order.enums.OrderStatusEnum;
|
|
@@ -20,7 +19,6 @@ import com.sd.business.service.order.OrderPackageBomService;
|
|
|
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.context.OrderContext;
|
|
@@ -62,9 +60,6 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
private SkuSpecService skuSpecService;
|
|
|
|
|
|
@Autowired
|
|
|
- private PriceBillingStandardDetailService priceBillingStandardDetailService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private SkuSpecLinkService skuSpecLinkService;
|
|
|
|
|
|
@Override
|
|
@@ -368,25 +363,12 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
List<OrderSku> saveOrderSkuList = context.getSaveOrderSkuList();
|
|
|
List<OrderSkuBom> saveOrderSkuBomList = context.getSaveOrderSkuBomList();
|
|
|
Map<String, SkuSpec> skuSpecMap = context.getSkuSpecMap();
|
|
|
- Map<String, Department> departmentMap = context.getDepartmentMap();
|
|
|
+ Map<Long, List<PriceBillingStandardDetail>> priceBillingStandardMap = context.getPriceBillingStandardMap();
|
|
|
|
|
|
if (saveOrderList.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 部门id、加工计费标准id map
|
|
|
- Map<Long, Long> departmentIdPriceBillingStandardIdMap = departmentMap.values()
|
|
|
- .stream()
|
|
|
- .filter(ObjectUtil::isNotNull)
|
|
|
- .filter(item -> ObjectUtil.isNotNull(item.getPriceBillingStandardId()))
|
|
|
- .collect(Collectors.toMap(BaseIdPo::getId, Department::getPriceBillingStandardId, (t1, t2) -> t1));
|
|
|
-
|
|
|
- // 加工计费标准id 报价规则列表 map
|
|
|
- Map<Long, List<PriceBillingStandardDetail>> priceBillingStandardMap = priceBillingStandardDetailService.list()
|
|
|
- .stream()
|
|
|
- .filter(item -> ObjectUtil.isNotNull(item.getPriceBillingStandardId()))
|
|
|
- .collect(Collectors.groupingBy(PriceBillingStandardDetail::getPriceBillingStandardId));
|
|
|
-
|
|
|
// 根据sku规格id获取bomId和bom规格id
|
|
|
Map<Long, BomBo> bomBoMap = skuSpecService.getBomBySkuSpecIdList(
|
|
|
saveOrderSkuList.stream().map(OrderSku::getSkuSpecId).collect(Collectors.toList()));
|
|
@@ -404,6 +386,11 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
orderInfo.setPackingLabor(BigDecimal.ZERO);
|
|
|
orderInfo.setPackagingMaterialCost(BigDecimal.ZERO);
|
|
|
|
|
|
+ // 加工计费标准
|
|
|
+ Long departmentId = orderInfo.getDepartmentId();
|
|
|
+ List<PriceBillingStandardDetail> priceBillingStandardDetailList = priceBillingStandardMap.get(departmentId);
|
|
|
+
|
|
|
+ // 订单明细
|
|
|
List<OrderSku> itemOrderSkuList = orderSkuGroup.get(orderInfo.getId());
|
|
|
|
|
|
for (OrderSku orderSku : itemOrderSkuList) {
|
|
@@ -415,11 +402,11 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
assignedPackagingMaterialCost(orderSku, saveOrderSkuBomList);
|
|
|
|
|
|
// 赋值其他价格
|
|
|
- assignedOtherPrice(orderSku, orderInfo.getDepartmentId(), bomBoMap,
|
|
|
- departmentIdPriceBillingStandardIdMap, priceBillingStandardMap, skuSpecMap);
|
|
|
+ assignedOtherPrice(orderSku, bomBoMap, priceBillingStandardDetailList, skuSpecMap);
|
|
|
|
|
|
// 添加订单金额
|
|
|
addOrderInfoPrice(orderInfo, orderSku);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -452,11 +439,8 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
/**
|
|
|
* 赋值其他价格
|
|
|
*/
|
|
|
- private void assignedOtherPrice(OrderSku orderSku,
|
|
|
- Long departmentId,
|
|
|
- Map<Long, BomBo> bomBoMap,
|
|
|
- Map<Long, Long> departmentIdPriceBillingStandardIdMap,
|
|
|
- Map<Long, List<PriceBillingStandardDetail>> priceBillingStandardMap,
|
|
|
+ private void assignedOtherPrice(OrderSku orderSku, Map<Long, BomBo> bomBoMap,
|
|
|
+ List<PriceBillingStandardDetail> priceBillingStandardDetailList,
|
|
|
Map<String, SkuSpec> skuSpecMap) {
|
|
|
|
|
|
orderSku.setCustomProcessingFee(BigDecimal.ZERO);
|
|
@@ -464,6 +448,11 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
orderSku.setDeliveryMaterialsFee(BigDecimal.ZERO);
|
|
|
orderSku.setPackingLabor(BigDecimal.ZERO);
|
|
|
|
|
|
+ // 报价规则列表
|
|
|
+ if (ObjectUtil.isEmpty(priceBillingStandardDetailList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 没绑定bom规格,不赋值价格
|
|
|
BomBo bomBo = bomBoMap.get(orderSku.getSkuSpecId());
|
|
|
if (bomBo == null) {
|
|
@@ -475,18 +464,6 @@ public class WlnOrderServiceImpl implements WlnOrderService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 获取加工计费标准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();
|