Commit 30d92b54 authored by lanbaoming's avatar lanbaoming

2024-06-26-4提交

parent 9c2be8ef
...@@ -2182,9 +2182,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2182,9 +2182,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
Long consigneeCustomerContactsId, Long consigneeCustomerContactsId,
List<OrderItemDO> orderItemDOList, List<OrderItemDO> orderItemDOList,
Integer type) { Integer type) {
//2023-7月之前应收金额没有按四舍五入取整,之后都是按四舍五入取整处理的 //2023-7月之前应收金额没有按四舍五入取整,之后都是按四舍五入取整处理的
LogisticsInfoDto logisticsInfoDto = LogisticsInfoDto logisticsInfoDto =
warehouseLineMapper.getStartInfoAndDestInfoByLineId( warehouseLineMapper.getStartInfoAndDestInfoByLineId(
orderDO.getLineId()); orderDO.getLineId());
...@@ -2256,9 +2254,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2256,9 +2254,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
//保存当前计价使用的 //保存当前计价使用的
orderDO.setUseWeightUnit(zhongPaoBestVO.getZhongEdge()); orderDO.setUseWeightUnit(zhongPaoBestVO.getZhongEdge());
orderDO.setUseVolumeUnit(zhongPaoBestVO.getPaoEdge()); orderDO.setUseVolumeUnit(zhongPaoBestVO.getPaoEdge());
this.calculationOrderItem(orderDO, orderItemDOList, zhongPaoBestVO, event.getBubbleWeightRatio()); this.calculationOrderItem(orderDO, orderItemDOList,
zhongPaoBestVO, event.getBubbleWeightRatio());
} }
// 计算订单商品项 //计算订单商品项
//计算单种运输方式的商品费用,并批量插入
CalculationItemFeeDto dto = this.insertOrderItemDOList(userId, CalculationItemFeeDto dto = this.insertOrderItemDOList(userId,
orderItemDOList, orderItemDOList,
orderDO, orderDO,
...@@ -2280,10 +2280,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2280,10 +2280,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
map(OrderItemDO::getMinMeteringVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)); map(OrderItemDO::getMinMeteringVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
orderDO.setMinMeteringWeight(newOrderItemDOList.stream(). orderDO.setMinMeteringWeight(newOrderItemDOList.stream().
map(OrderItemDO::getMinMeteringWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)); map(OrderItemDO::getMinMeteringWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
// 预计运费与清关费 //预计运费与清关费
CostVO newCostVO = dto.getCostVO(); CostVO newCostVO = dto.getCostVO();
List<FeeDto> newFeeDtoList = newCostVO.getFeeDtoList(); List<FeeDto> newFeeDtoList = newCostVO.getFeeDtoList();
// 新运费和清关费的金额与老运费和清关费的金额变动 //新运费和清关费的金额与老运费和清关费的金额变动
BigDecimal oldFreightAndClearanceFee = BigDecimal.ZERO; BigDecimal oldFreightAndClearanceFee = BigDecimal.ZERO;
BigDecimal newFreightAndClearanceFee = BigDecimal.ZERO; BigDecimal newFreightAndClearanceFee = BigDecimal.ZERO;
...@@ -2496,15 +2496,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2496,15 +2496,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
event, item, warehouseInInfoVO, event, item, warehouseInInfoVO,
type, orderNoCanShipmentChannelExceptionDOList); type, orderNoCanShipmentChannelExceptionDOList);
} else { } else {
String s = orderDO.getOrderNo() + String s = orderDO.getOrderNo() +
"不可出渠道异常逻辑点 noQuoteOrAutomaticNoQuote:" + "不可出渠道异常逻辑点 noQuoteOrAutomaticNoQuote:" +
noQuoteOrAutomaticNoQuote; noQuoteOrAutomaticNoQuote;
if (Objects.isNull(warehouseInInfoVO)) { if (Objects.isNull(warehouseInInfoVO)) {
s += " warehouseInInfoVO 为空,"; s += " warehouseInInfoVO 为空,";
} }
if(Objects.isNull(warehouseInInfoVO)==false) { if (Objects.isNull(warehouseInInfoVO) == false) {
s += "getCartonsNum:" + s += "getCartonsNum:" +
warehouseInInfoVO.getCartonsNum(); warehouseInInfoVO.getCartonsNum();
} }
...@@ -2596,7 +2594,28 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2596,7 +2594,28 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
OrderDO newOrder = orderMapper.selectById(orderDO.getOrderId()); OrderDO newOrder = orderMapper.selectById(orderDO.getOrderId());
// 判断空运已入仓订单状态如果是默认出货状态0,且无异常、无审批,那么标记为可出 // 判断空运已入仓订单状态如果是默认出货状态0,且无异常、无审批,那么标记为可出
this.airShipmentStateUpdate(type, newFeeDtoList, newOrder); this.airShipmentStateUpdate(type, newFeeDtoList, newOrder);
setWareHouseIsZero(orderDO);
}
}
//处理订单入仓数为0的单价
//先判断订单项入仓记录是否为空,为空就改为不为空的单机
private void setWareHouseIsZero(OrderDO orderDO) {
if (orderDO == null) return;
LambdaUpdateWrapper q1 =
new LambdaUpdateWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId,
orderDO.getOrderId());
List<OrderItemDO> listItem = orderItemMapper.selectList(q1);
if (CollectionUtil.isEmpty(listItem) == true) return;
for (OrderItemDO o:listItem
) {
} }
} }
private void airShipmentStateUpdate(Integer type, private void airShipmentStateUpdate(Integer type,
...@@ -2638,7 +2657,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2638,7 +2657,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 初始化判断条件,是否自动可出 // 初始化判断条件,是否自动可出
boolean isAutomaticCan = false; boolean isAutomaticCan = false;
// 每次计价都校验一遍订单的可出状态 // 每次计价都校验一遍订单的可出状态
if (isEqFreight && isEqClearance && newOrder.getAbnormalState() == 0 && newOrder.getAuditType() == 0 && Objects.equals(newOrder.getStatus(), OrderStatusEnum.IN_WAREHOUSE.getValue())) { if (isEqFreight && isEqClearance &&
newOrder.getAbnormalState() == 0 &&
newOrder.getAuditType() == 0 &&
Objects.equals(newOrder.getStatus(),
OrderStatusEnum.IN_WAREHOUSE.getValue())) {
// 关联报价单检查结果通过,且无异常、无审批的已入仓订单,那么标记为可出2 // 关联报价单检查结果通过,且无异常、无审批的已入仓订单,那么标记为可出2
newOrder.setAirShipment(2); newOrder.setAirShipment(2);
// 自动可出需要补充订单日志 // 自动可出需要补充订单日志
...@@ -2657,7 +2680,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2657,7 +2680,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
infoVO.setName("总运费、总清关费与报价单一致,自动可出"); infoVO.setName("总运费、总清关费与报价单一致,自动可出");
note = JSONObject.toJSONString(Collections.singletonList(infoVO)); note = JSONObject.toJSONString(Collections.singletonList(infoVO));
} }
this.addOrderOperateLog(newOrder.getOrderId(), "自动可出", note); this.addOrderOperateLog(newOrder.getOrderId(),
"自动可出", note);
} }
} }
} else { } else {
...@@ -2782,9 +2806,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2782,9 +2806,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
"设置价格自动处理", "设置价格自动处理",
OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED); OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED);
noQuoteOrAutomaticNoQuote = 2; noQuoteOrAutomaticNoQuote = 2;
} } else {
else
{
zTest z = new zTest(); zTest z = new zTest();
z.setTestname("orderNoQuoteExceptionDOList 为空"); z.setTestname("orderNoQuoteExceptionDOList 为空");
z.setCreatedate(new Date()); z.setCreatedate(new Date());
...@@ -3262,20 +3284,30 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3262,20 +3284,30 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
* 50 更新订单优惠信息 * 50 更新订单优惠信息
* @return 该运输方式下的报价商品列表信息 * @return 该运输方式下的报价商品列表信息
*/ */
private CalculationItemFeeDto insertOrderItemDOList(String userId, List<OrderItemDO> orderItemDOList, OrderDO orderDO, private CalculationItemFeeDto insertOrderItemDOList(String userId,
Long consignorCustomerId, Long consigneeCustomerId, Long consignorCustomerContactsId, Long consigneeCustomerContactsId, List<OrderItemDO> orderItemDOList,
OrderDO orderDO,
Long consignorCustomerId,
Long consigneeCustomerId,
Long consignorCustomerContactsId,
Long consigneeCustomerContactsId,
Integer type) { Integer type) {
List<ProdConditionParam> prodConditionParamList = new ArrayList<>(); List<ProdConditionParam> prodConditionParamList =
new ArrayList<>();
for (OrderItemDO orderItemDO : orderItemDOList) { for (OrderItemDO orderItemDO : orderItemDOList) {
ProductDO productDO = productService.info(orderItemDO.getProdId()); ProductDO productDO =
productService.info(orderItemDO.getProdId());
if (productDO == null) { if (productDO == null) {
throw exception(PROD_NOT_EXISTS); throw exception(PROD_NOT_EXISTS);
} }
if (CollectionUtil.isNotEmpty(productDO.getAttrList())) { if (CollectionUtil.isNotEmpty(productDO.getAttrList())) {
long count = productDO.getAttrList().stream().map(ProductAttrDO::getAttrCode).filter(code -> StringUtils.equals(code, NOT_ACCEPTED_PROD_CODE)).count(); long count = productDO.getAttrList().stream().map(ProductAttrDO::getAttrCode).filter(code -> StringUtils.equals(code,
NOT_ACCEPTED_PROD_CODE)).count();
if (count > 0 && type != 8 && type != 20) { if (count > 0 && type != 8 && type != 20) {
// 订单【#订单编号#】包含不接受货物【#商品名称#】,请检查 //订单【#订单编号#】包含不接受货物【#商品名称#】,请检查
throw exception(ORDER_NO_CONTAIN_NOT_ACCEPTED_PROD, orderDO.getOrderNo(), I18nMessage.getLang() == 0 ? productDO.getTitleZh() : productDO.getTitleEn()); throw exception(ORDER_NO_CONTAIN_NOT_ACCEPTED_PROD,
orderDO.getOrderNo(),
I18nMessage.getLang() == 0 ? productDO.getTitleZh() : productDO.getTitleEn());
} }
} }
if (null == orderItemDO.getNum()) { if (null == orderItemDO.getNum()) {
...@@ -3304,20 +3336,26 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3304,20 +3336,26 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 如果订单项id不存在,则先保存获得订单项id // 如果订单项id不存在,则先保存获得订单项id
orderItemMapper.insert(orderItemDO); orderItemMapper.insert(orderItemDO);
} }
//入仓信息,新建订单时入仓信息为空
WarehouseInInfoVO warehouseInInfoVO = WarehouseInInfoVO warehouseInInfoVO =
orderItemDO.getWarehouseInInfoVO(); orderItemDO.getWarehouseInInfoVO();
// if (type == 30 || type == 10) { // if (type == 30 || type == 10) {
// // 空运自动刷新价格和订单修改价格变动,需要将之前的特价、渠道/单询/超限自定义价格、拆单自定义价格等全部重置 // // 空运自动刷新价格和订单修改价格变动,需要将之前的特价、
// 渠道/单询/超限自定义价格、拆单自定义价格等全部重置
// orderItemDO.setSpecialPriceType(false); // orderItemDO.setSpecialPriceType(false);
// orderItemDO.setSplitCustomPriceType(false); // orderItemDO.setSplitCustomPriceType(false);
// orderItemDO.setChannelManualPricing(false); // orderItemDO.setChannelManualPricing(false);
// } // }
orderItemDO.setProdTitleZh(productDO.getTitleZh()); orderItemDO.setProdTitleZh(productDO.getTitleZh());
orderItemDO.setProdTitleEn(productDO.getTitleEn()); orderItemDO.setProdTitleEn(productDO.getTitleEn());
orderItemDO.setProdType(Integer.valueOf(String.valueOf(productDO.getTypeId()))); orderItemDO.setProdType(
Integer.valueOf(String.valueOf(productDO.getTypeId())));
orderItemDO.setMaterial(productDO.getMaterialType()); orderItemDO.setMaterial(productDO.getMaterialType());
// 给出商品是否为待确认商品的判断,方便后面判断是否生成未报价异常,如果是待确认商品是不用去生成未报价异常的,确认后再计价判断是否生成未报价异常 // 给出商品是否为待确认商品的判断,方便后面判断是否生成未报价异常,
//如果是待确认商品是不用去生成未报价异常的,确认后再计价判断是否生成未报价异常
orderItemDO.setIsProd(productDO.getStatus() == 1); orderItemDO.setIsProd(productDO.getStatus() == 1);
//计价参数
ProdConditionParam param = new ProdConditionParam(); ProdConditionParam param = new ProdConditionParam();
param.setItemId(orderItemDO.getOrderItemId()); param.setItemId(orderItemDO.getOrderItemId());
...@@ -3339,12 +3377,17 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3339,12 +3377,17 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
param.setHeavyCargoTotalChargeVolume(orderItemDO.getHeavyCargoTotalChargeVolume()); param.setHeavyCargoTotalChargeVolume(orderItemDO.getHeavyCargoTotalChargeVolume());
param.setCommonGoodsTotalChargeVolume(orderItemDO.getCommonGoodsTotalChargeVolume()); param.setCommonGoodsTotalChargeVolume(orderItemDO.getCommonGoodsTotalChargeVolume());
param.setPickledGoodsTotalChargeWeight(orderItemDO.getPickledGoodsTotalChargeWeight()); param.setPickledGoodsTotalChargeWeight(orderItemDO.getPickledGoodsTotalChargeWeight());
param.setCommonGoodsTotalChargeWeight(orderItemDO.getCommonGoodsTotalChargeWeight()); param.setCommonGoodsTotalChargeWeight(
orderItemDO.getCommonGoodsTotalChargeWeight());
param.setSpecialPriceType(Objects.nonNull(orderItemDO.getSpecialPriceType()) && orderItemDO.getSpecialPriceType());
param.setSplitCustomPriceType(Objects.nonNull(orderItemDO.getSplitCustomPriceType()) && orderItemDO.getSplitCustomPriceType()); param.setSpecialPriceType(
param.setChannelManualPricing(Objects.nonNull(orderItemDO.getChannelManualPricing()) && orderItemDO.getChannelManualPricing()); Objects.nonNull(orderItemDO.getSpecialPriceType()) && orderItemDO.getSpecialPriceType());
// 空运订单自动刷新价格时,需要忽略这里,一律重新定价,当type等于30时是空运每日定时刷新价格,只针对待入仓、入仓中、已入仓-待出空运订单 param.setSplitCustomPriceType(
Objects.nonNull(orderItemDO.getSplitCustomPriceType()) && orderItemDO.getSplitCustomPriceType());
param.setChannelManualPricing(
Objects.nonNull(orderItemDO.getChannelManualPricing()) && orderItemDO.getChannelManualPricing());
// 空运订单自动刷新价格时,需要忽略这里,一律重新定价,
// 当type等于30时是空运每日定时刷新价格,只针对待入仓、入仓中、已入仓-待出空运订单
if ((Objects.nonNull(orderItemDO.getSpecialPriceType()) && if ((Objects.nonNull(orderItemDO.getSpecialPriceType()) &&
orderItemDO.getSpecialPriceType() && !orderItemDO.getIsPriced()) orderItemDO.getSpecialPriceType() && !orderItemDO.getIsPriced())
|| (Objects.nonNull(orderItemDO.getSplitCustomPriceType()) && orderItemDO.getSplitCustomPriceType()) || (Objects.nonNull(orderItemDO.getSplitCustomPriceType()) && orderItemDO.getSplitCustomPriceType())
...@@ -3354,16 +3397,21 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3354,16 +3397,21 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemDO.setIsPriced(Objects.nonNull(orderItemDO.getIsPriced()) && Objects.nonNull(orderItemDO.getItemStatus()) && orderItemDO.getItemStatus() != -1 ? orderItemDO.setIsPriced(Objects.nonNull(orderItemDO.getIsPriced()) && Objects.nonNull(orderItemDO.getItemStatus()) && orderItemDO.getItemStatus() != -1 ?
orderItemDO.getIsPriced() : Boolean.FALSE); orderItemDO.getIsPriced() : Boolean.FALSE);
} }
//类型 :1 新增 2 修改 3 实测入仓信息 4 合单 5 拆单 6 处理未报价异常 7 特价申请 8 订单货值修改 //类型 :1 新增 2 修改 3 实测入仓信息 4 合单 5 拆单 6 处理未报价异常
// 9 处理重泡货异常 10 已入仓订单修改重订价 11 处理渠道异常 12 处理单询异常 13 处理超重异常 14 批量加价 15 完成入仓 // 7 特价申请 8 订单货值修改
// 20 强制重订价格 30 空运订单每日定时更新价格 40 订单异常处理完成更新计价 50 更新订单优惠信息 //9 处理重泡货异常 10 已入仓订单修改重订价 11 处理渠道异常 12 处理单询异常
// 13 处理超重异常 14 批量加价 15 完成入仓
//20 强制重订价格 30 空运订单每日定时更新价格 40 订单异常处理完成更新计价
// 50 更新订单优惠信息
if (type == 2 || (type == 4 && orderDO.getTransportId() == 3) || if (type == 2 || (type == 4 && orderDO.getTransportId() == 3) ||
type == 6 || type == 10 || type == 20 || type == 30 type == 6 || type == 10 || type == 20 || type == 30
|| (type == 15 && (Objects.isNull(orderDO.getParentOrderId()) || (type == 15 && (Objects.isNull(orderDO.getParentOrderId())
|| orderDO.getParentOrderId() == 0L || || orderDO.getParentOrderId() == 0L ||
orderDO.getSplitSeparateOrder()))) { orderDO.getSplitSeparateOrder()))) {
// 拆单后的子订单入仓不需要重新定价,但涉及了空运拆单的会标记为独立订单,走一样的逻辑 // 拆单后的子订单入仓不需要重新定价,
// 第一次入仓或后面的重新入仓都需要更新基础单价,特价需要在计价时单独判断,不去更新成交单价 // 但涉及了空运拆单的会标记为独立订单,走一样的逻辑
// 第一次入仓或后面的重新入仓都需要更新基础单价,
// 特价需要在计价时单独判断,不去更新成交单价
// 未报价异常处理需要重新定价 // 未报价异常处理需要重新定价
// 处理重泡货异常也需要重新定价 // 处理重泡货异常也需要重新定价
// 编辑修改订单重新定价 // 编辑修改订单重新定价
...@@ -3371,11 +3419,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3371,11 +3419,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 空运订单分拣反审解除价格锁定 // 空运订单分拣反审解除价格锁定
orderItemDO.setIsPriced(Boolean.FALSE); orderItemDO.setIsPriced(Boolean.FALSE);
} }
// 处理重泡货异常时,标记计价类型,如果是阶梯价格,则需要重新计价,如果是非阶梯价格,则不用重新计价 // 处理重泡货异常时,标记计价类型,如果是阶梯价格,则需要重新计价,
// 如果是非阶梯价格,则不用重新计价
if (type == 9) { if (type == 9) {
param.setIsChangeFeeValue(true); param.setIsChangeFeeValue(true);
} }
param.setSpecialCommission(Objects.nonNull(orderItemDO.getSpecialCommission()) && orderItemDO.getSpecialCommission()); param.setSpecialCommission(Objects.nonNull(
orderItemDO.getSpecialCommission()) &&
orderItemDO.getSpecialCommission());
param.setCommissionType(orderItemDO.getCommissionType()); param.setCommissionType(orderItemDO.getCommissionType());
param.setHiddenCommission(orderItemDO.getHiddenCommission()); param.setHiddenCommission(orderItemDO.getHiddenCommission());
param.setPlainCommission(orderItemDO.getPlainCommission()); param.setPlainCommission(orderItemDO.getPlainCommission());
...@@ -3403,18 +3454,21 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3403,18 +3454,21 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
param.setProdTitleZh(productDO.getTitleZh()); param.setProdTitleZh(productDO.getTitleZh());
param.setProductType(Integer.valueOf(String.valueOf(productDO.getTypeId()))); param.setProductType(Integer.valueOf(String.valueOf(productDO.getTypeId())));
// 入仓业务增加了单独的存储特性,所以这里需要区分入仓前后的品名特性字段值 // 入仓业务增加了单独的存储特性,所以这里需要区分入仓前后的品名特性字段值
if (Objects.isNull(warehouseInInfoVO) || warehouseInInfoVO.getCartonsNum() == 0) { if (Objects.isNull(warehouseInInfoVO) ||
warehouseInInfoVO.getCartonsNum() == 0) {
// 填单特性以前端传值为准, 需要排除前端传值数据正确性,对以删除的数据进行筛选 // 填单特性以前端传值为准, 需要排除前端传值数据正确性,对以删除的数据进行筛选
if (Objects.isNull(orderItemDO.getProdAttrIds())) { if (Objects.isNull(orderItemDO.getProdAttrIds())) {
// 为保证更新品名的特性值,如果特性为null,则需要默认给值空字符串,以保证更新成功 // 为保证更新品名的特性值,如果特性为null,则需要默认给值空字符串,以保证更新成功
orderItemDO.setProdAttrIds(""); orderItemDO.setProdAttrIds("");
} }
if (StringUtils.isNotBlank(orderItemDO.getProdAttrIds())) { if (StringUtils.isNotBlank(orderItemDO.getProdAttrIds())) {
orderItemDO.setProdAttrIds(this.filterProdAttrIds(orderItemDO.getProdAttrIds())); orderItemDO.setProdAttrIds(
this.filterProdAttrIds(orderItemDO.getProdAttrIds()));
} }
orderItemDO.setFillProdAttrIds(orderItemDO.getProdAttrIds()); // 将前端传值的填单特性转存入填单商品特性字段 orderItemDO.setFillProdAttrIds(orderItemDO.getProdAttrIds());
//将前端传值的填单特性转存入填单商品特性字段
param.setProdAttrIds(orderItemDO.getProdAttrIds()); param.setProdAttrIds(orderItemDO.getProdAttrIds());
// 未入仓取填单包装单位 //未入仓取填单包装单位
param.setPackages(Collections.singletonList(orderItemDO.getUnit())); param.setPackages(Collections.singletonList(orderItemDO.getUnit()));
} else { } else {
// 入仓特性以前端传值为 // 入仓特性以前端传值为
...@@ -3441,10 +3495,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3441,10 +3495,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
param.setAlreadyExistsTotalVolume(Objects.isNull(alreadyExistsTotalVolume) ? BigDecimal.ZERO : alreadyExistsTotalVolume); param.setAlreadyExistsTotalVolume(Objects.isNull(alreadyExistsTotalVolume) ? BigDecimal.ZERO : alreadyExistsTotalVolume);
} }
if (null != orderItemDO.getOneSeaFreight() && orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) > 0) { if (null != orderItemDO.getOneSeaFreight() &&
orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) > 0) {
//商品运费单价(成交)
param.setOneFreight(orderItemDO.getOneSeaFreight()); param.setOneFreight(orderItemDO.getOneSeaFreight());
} }
if (null != orderItemDO.getOneClearanceFreight() && orderItemDO.getOneClearanceFreight().compareTo(BigDecimal.ZERO) > 0) { if (null != orderItemDO.getOneClearanceFreight() &&
orderItemDO.getOneClearanceFreight().compareTo(BigDecimal.ZERO) > 0) {
//商品清关费单价(成交)
param.setOneClearanceFee(orderItemDO.getOneClearanceFreight()); param.setOneClearanceFee(orderItemDO.getOneClearanceFreight());
} }
if (Objects.nonNull(warehouseInInfoVO)) { if (Objects.nonNull(warehouseInInfoVO)) {
...@@ -3477,11 +3535,15 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3477,11 +3535,15 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} else { } else {
param.setBrandType(orderItemDO.getFeeType()); param.setBrandType(orderItemDO.getFeeType());
} }
// 价格修改只限定在报价单中,不修改原价 //价格修改只限定在报价单中,不修改原价
//商品运费单价(成交)
param.setOneFreight(orderItemDO.getOneSeaFreight()); param.setOneFreight(orderItemDO.getOneSeaFreight());
//商品运费单价(原始单价)
param.setOrgFreightPrice(orderItemDO.getOriginalSeaFreight()); param.setOrgFreightPrice(orderItemDO.getOriginalSeaFreight());
param.setFreightCurrency(Objects.isNull(orderItemDO.getSeaFreightCurrency()) ? null : Integer.valueOf(String.valueOf(orderItemDO.getSeaFreightCurrency()))); param.setFreightCurrency(Objects.isNull(orderItemDO.getSeaFreightCurrency()) ? null : Integer.valueOf(String.valueOf(orderItemDO.getSeaFreightCurrency())));
param.setFreightVolume(orderItemDO.getSeaFreightVolume()); param.setFreightVolume(orderItemDO.getSeaFreightVolume());
//商品清关费单价(成交)
param.setOneClearanceFee(orderItemDO.getOneClearanceFreight()); param.setOneClearanceFee(orderItemDO.getOneClearanceFreight());
param.setOrgClearanceFeePrice(orderItemDO.getOriginalClearanceFreight()); param.setOrgClearanceFeePrice(orderItemDO.getOriginalClearanceFreight());
param.setClearanceFeeCurrency(Objects.isNull(orderItemDO.getClearanceFreightCurrency()) ? null : Integer.valueOf(String.valueOf(orderItemDO.getClearanceFreightCurrency()))); param.setClearanceFeeCurrency(Objects.isNull(orderItemDO.getClearanceFreightCurrency()) ? null : Integer.valueOf(String.valueOf(orderItemDO.getClearanceFreightCurrency())));
...@@ -3498,26 +3560,51 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3498,26 +3560,51 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
prodConditionParamList.add(param); prodConditionParamList.add(param);
} }
boolean isWarehouseIn = false; boolean isWarehouseIn = false;
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) && !Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(orderDO.getStatus(),
OrderStatusEnum.ORDER_PLACED.getValue()) &&
!Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
isWarehouseIn = true; isWarehouseIn = true;
} }
// 定单价费用 // 定单价费用
List<ProdConditionParam> prodConditionParams = prodCostCalculation.obtainProdLineOnePrice(prodConditionParamList, orderDO.getOrderNo(), List<ProdConditionParam> prodConditionParams =
orderDO.getCustomsType(), orderDO.getCustomerId(), orderDO.getTransportId(), orderDO.getLineId(), orderDO.getChannelId(), isWarehouseIn); prodCostCalculation.obtainProdLineOnePrice(
prodConditionParamList,
orderDO.getOrderNo(),
orderDO.getCustomsType(),
orderDO.getCustomerId(),
orderDO.getTransportId(),
orderDO.getLineId(),
orderDO.getChannelId(), isWarehouseIn);
// 对订单品名的收费数据进行误差补全,单价最低的品名加上误差值 // 对订单品名的收费数据进行误差补全,单价最低的品名加上误差值
if (type != 1 && type != 2 && !Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) && !Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (type != 1 && type != 2 && !Objects.equals(orderDO.getStatus(),
OrderStatusEnum.ORDER_PLACED.getValue()) && !Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
// 只要不是草稿和待入仓订单,都会对此进行计算, 对误差值进行调整 // 只要不是草稿和待入仓订单,都会对此进行计算, 对误差值进行调整
errorValueAdjustment(orderItemDOList, orderDO, prodConditionParams); errorValueAdjustment(orderItemDOList,
orderDO,
prodConditionParams);
} }
// 计算小计费用 // 计算小计费用
CalculationCostResultDto resultDto = prodCostCalculation.calculationProdCost(prodConditionParams, orderDO.getOrderNo(), CalculationCostResultDto resultDto =
orderDO.getOrderType(), orderDO.getCustomsType(), orderDO.getIsCargoControl() ? 1 : 0, orderDO.getUserId(), prodCostCalculation.calculationProdCost(prodConditionParams,
orderDO.getCustomerId(), consignorCustomerId, consigneeCustomerId, consignorCustomerContactsId, consigneeCustomerContactsId, orderDO.getOrderNo(),
orderDO.getTransportId(), orderDO.getLineId(), orderDO.getChannelId()); orderDO.getOrderType(),
orderDO.getCustomsType(),
orderDO.getIsCargoControl() ? 1 : 0, orderDO.getUserId(),
orderDO.getCustomerId(),
consignorCustomerId,
consigneeCustomerId,
consignorCustomerContactsId,
consigneeCustomerContactsId,
orderDO.getTransportId(),
orderDO.getLineId(),
orderDO.getChannelId());
for (OrderItemDO orderItemDO : orderItemDOList) { for (OrderItemDO orderItemDO : orderItemDOList) {
for (ProdCostDto prodCostDto : resultDto.getProdCostDtoList()) { for (ProdCostDto prodCostDto : resultDto.getProdCostDtoList()) {
if (Objects.equals(prodCostDto.getItemId(), orderItemDO.getOrderItemId())) { if (Objects.equals(prodCostDto.getItemId(), orderItemDO.getOrderItemId())) {
orderItemDO.setOriginalSeaFreight(prodCostDto.getOrgFreightPrice()); orderItemDO.setOriginalSeaFreight(prodCostDto.getOrgFreightPrice());
orderItemDO.setOneSeaFreight(prodCostDto.getOneFreight()); orderItemDO.setOneSeaFreight(prodCostDto.getOneFreight());
orderItemDO.setDiscountFreightPrice(prodCostDto.getDiscountFreightPrice()); orderItemDO.setDiscountFreightPrice(prodCostDto.getDiscountFreightPrice());
...@@ -3585,7 +3672,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3585,7 +3672,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
|| Objects.equals(TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue(), orderDO.getTransportId())) { || Objects.equals(TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue(), orderDO.getTransportId())) {
// 空运 // 空运
if (type == 16 && StringUtils.isNotBlank(orderItemDO.getWarehouseInInfo()) && orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) > 0 && !orderItemDO.getIsPriced()) { if (type == 16 && StringUtils.isNotBlank(orderItemDO.getWarehouseInInfo()) && orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) > 0 && !orderItemDO.getIsPriced()) {
// 已入仓的商品项,如果未定价,且价格不为0,则标记为已定价 //已入仓的商品项,如果未定价,且价格不为0,则标记为已定价
orderItemDO.setIsPriced(Boolean.TRUE); orderItemDO.setIsPriced(Boolean.TRUE);
} else { } else {
orderItemDO.setIsPriced(Objects.nonNull(orderItemDO.getIsPriced()) ? orderItemDO.getIsPriced() : Boolean.FALSE); orderItemDO.setIsPriced(Objects.nonNull(orderItemDO.getIsPriced()) ? orderItemDO.getIsPriced() : Boolean.FALSE);
...@@ -3593,7 +3680,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3593,7 +3680,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} else { } else {
// 海运 // 海运
if (StringUtils.isNotBlank(orderItemDO.getWarehouseInInfo()) && orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) > 0 && !orderItemDO.getIsPriced()) { if (StringUtils.isNotBlank(orderItemDO.getWarehouseInInfo()) && orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) > 0 && !orderItemDO.getIsPriced()) {
// 已入仓的商品项,如果未定价,且价格不为0,则标记为已定价 //已入仓的商品项,如果未定价,且价格不为0,则标记为已定价
orderItemDO.setIsPriced(Boolean.TRUE); orderItemDO.setIsPriced(Boolean.TRUE);
} else { } else {
orderItemDO.setIsPriced(Objects.nonNull(orderItemDO.getIsPriced()) ? orderItemDO.getIsPriced() : Boolean.FALSE); orderItemDO.setIsPriced(Objects.nonNull(orderItemDO.getIsPriced()) ? orderItemDO.getIsPriced() : Boolean.FALSE);
...@@ -3603,7 +3690,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3603,7 +3690,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemDO.setIsPayAdvance(prodCostDto.getIsPayAdvance()); orderItemDO.setIsPayAdvance(prodCostDto.getIsPayAdvance());
} }
} }
if (Objects.isNull(orderItemDO.getItemStatus()) || orderItemDO.getItemStatus() != -1) { if (Objects.isNull(orderItemDO.getItemStatus()) ||
orderItemDO.getItemStatus() != -1) {
updateItem(orderItemDO); updateItem(orderItemDO);
} else { } else {
orderItemMapper.updateById(orderItemDO); orderItemMapper.updateById(orderItemDO);
......
...@@ -356,19 +356,30 @@ public class OrderSpecialNeedServiceImpl extends AbstractService<OrderSpecialNee ...@@ -356,19 +356,30 @@ public class OrderSpecialNeedServiceImpl extends AbstractService<OrderSpecialNee
List<OrderSpecialNeedDO> orderSpecialNeedDOS = List<OrderSpecialNeedDO> orderSpecialNeedDOS =
orderSpecialNeedMapper.selectList(OrderSpecialNeedDO::getOrderId, orderSpecialNeedMapper.selectList(OrderSpecialNeedDO::getOrderId,
orderId); orderId);
//垫付的内陆运输费用 getTransFee
if (CollectionUtil.isNotEmpty(orderSpecialNeedDOS)) { if (CollectionUtil.isNotEmpty(orderSpecialNeedDOS)) {
orderSpecialNeedDOS.stream().filter( orderSpecialNeedDOS.stream().filter(
item -> item.getTransFee().compareTo(BigDecimal.ZERO) == 1).forEach(item -> build(item, type)); item -> item.getTransFee().compareTo(BigDecimal.ZERO) == 1).
forEach(item -> build(item, type));
} }
} }
private void build(OrderSpecialNeedDO orderSpecialNeed, int type) { private void build(OrderSpecialNeedDO orderSpecialNeed, int type) {
// 插入应收款 // 插入应收款
// 预付在完成入仓时生成应收 // 预付在完成入仓时生成应收
DictDataRespDTO dictDto = DictFrameworkUtils.getDictDataFromCache("receivable_fee_type", orderSpecialNeed.getAdvanceType()); DictDataRespDTO dictDto =
if (type == 1 && orderSpecialNeed.getPayType() != null && orderSpecialNeed.getPayType() != 4) { DictFrameworkUtils.getDictDataFromCache("receivable_fee_type",
orderSpecialNeed.getAdvanceType());
//付款类型 getPayType 付款类型
/*
if (type == 1 && orderSpecialNeed.getPayType() != null
&& orderSpecialNeed.getPayType() != 4) {*/
if (type == 1 && orderSpecialNeed.getPayType() != null)
{
//完成入仓可多次,故先删除掉已有应收再重新生成 //完成入仓可多次,故先删除掉已有应收再重新生成
if (orderSpecialNeed.getReceivableId() != null && orderSpecialNeed.getReceivableId() > 0L) { if (orderSpecialNeed.getReceivableId() != null &&
orderSpecialNeed.getReceivableId() > 0L) {
receivableService.deleteReceivable(orderSpecialNeed.getReceivableId()); receivableService.deleteReceivable(orderSpecialNeed.getReceivableId());
} }
OrderBackVO order = orderQueryService.getOrder(orderSpecialNeed.getOrderId()); OrderBackVO order = orderQueryService.getOrder(orderSpecialNeed.getOrderId());
...@@ -387,12 +398,16 @@ public class OrderSpecialNeedServiceImpl extends AbstractService<OrderSpecialNee ...@@ -387,12 +398,16 @@ public class OrderSpecialNeedServiceImpl extends AbstractService<OrderSpecialNee
receivableCreateReqVO.setUnitPrice(orderSpecialNeed.getTransFee()); receivableCreateReqVO.setUnitPrice(orderSpecialNeed.getTransFee());
receivableCreateReqVO.setPaymentUser(String.valueOf(order.getDrawee() != 3 ? order.getDrawee() : orderQueryService.customDrawee(OrderConvert.INSTANCE.convert(order), Integer.valueOf(orderSpecialNeed.getAdvanceType())))); receivableCreateReqVO.setPaymentUser(String.valueOf(order.getDrawee() != 3 ? order.getDrawee() : orderQueryService.customDrawee(OrderConvert.INSTANCE.convert(order), Integer.valueOf(orderSpecialNeed.getAdvanceType()))));
receivableCreateReqVO.setFeeSource(3); receivableCreateReqVO.setFeeSource(3);
Long receivableId = receivableService.createReceivable(receivableCreateReqVO); Long receivableId = receivableService.createReceivable(
receivableCreateReqVO);
orderSpecialNeed.setReceivableId(receivableId); orderSpecialNeed.setReceivableId(receivableId);
orderSpecialNeedMapper.updateById(orderSpecialNeed); orderSpecialNeedMapper.updateById(orderSpecialNeed);
} else if (type == 2 && orderSpecialNeed.getPayType() != null && orderSpecialNeed.getPayType() == 4) {
} else if (type == 2 && orderSpecialNeed.getPayType() != null
&& orderSpecialNeed.getPayType() == 4) {
//装柜反审后再审批,故先删除掉已有应收再重新生成 //装柜反审后再审批,故先删除掉已有应收再重新生成
if (orderSpecialNeed.getReceivableId() != null && orderSpecialNeed.getReceivableId() > 0L) { if (orderSpecialNeed.getReceivableId() != null &&
orderSpecialNeed.getReceivableId() > 0L) {
receivableService.deleteReceivable(orderSpecialNeed.getReceivableId()); receivableService.deleteReceivable(orderSpecialNeed.getReceivableId());
} }
OrderBackVO order = orderQueryService.getOrder(orderSpecialNeed.getOrderId()); OrderBackVO order = orderQueryService.getOrder(orderSpecialNeed.getOrderId());
......
...@@ -1156,20 +1156,26 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1156,20 +1156,26 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// orderLocationService.batchOrderUpdate(orderLocationCreateReqVOList); // orderLocationService.batchOrderUpdate(orderLocationCreateReqVOList);
// } // }
// 保存特需 // 保存特需 特需应收请求列表
List<OrderSpecialNeedReceivableReqVo> orderSpecialNeedReceivableReqVoList = List<OrderSpecialNeedReceivableReqVo> orderSpecialNeedReceivableReqVoList =
finishReqVO.getOrderSpecialNeedReceivableReqVoList(); finishReqVO.getOrderSpecialNeedReceivableReqVoList();
if (CollectionUtil.isNotEmpty(orderSpecialNeedReceivableReqVoList)) { if (CollectionUtil.isNotEmpty(orderSpecialNeedReceivableReqVoList)) {
List<Long> specialNeedIds = orderSpecialNeedReceivableReqVoList.stream().map(OrderSpecialNeedReceivableReqVo::getId).collect(Collectors.toList()); List<Long> specialNeedIds =
orderSpecialNeedReceivableReqVoList.stream().map(OrderSpecialNeedReceivableReqVo::getId).collect(Collectors.toList());
List<OrderSpecialNeedDO> orderSpecialNeedList = List<OrderSpecialNeedDO> orderSpecialNeedList =
orderSpecialNeedService.getOrderSpecialNeedList(specialNeedIds); orderSpecialNeedService.getOrderSpecialNeedList(specialNeedIds);
orderSpecialNeedList.forEach(orderSpecialNeedDO -> orderSpecialNeedReceivableReqVoList.stream() orderSpecialNeedList.forEach(orderSpecialNeedDO -> orderSpecialNeedReceivableReqVoList.stream()
.filter(t -> t.getId().equals(orderSpecialNeedDO.getId())).findFirst().ifPresent(orderSpecialNeedReceivableReqVo -> { .filter(t -> t.getId().equals(orderSpecialNeedDO.getId())).findFirst().ifPresent(orderSpecialNeedReceivableReqVo -> {
BigDecimal money = orderSpecialNeedReceivableReqVo.getReceivableMoney(); //receivable_money 应收费
Integer currency = orderSpecialNeedReceivableReqVo.getReceivableMoneyCurrency(); BigDecimal money =
String advanceType = orderSpecialNeedDO.getAdvanceType(); orderSpecialNeedReceivableReqVo.getReceivableMoney();
Integer currency =
orderSpecialNeedReceivableReqVo.getReceivableMoneyCurrency();
String advanceType =
orderSpecialNeedDO.getAdvanceType();
//垫付的内陆运输费用
orderSpecialNeedDO.setTransFee(money); orderSpecialNeedDO.setTransFee(money);
orderSpecialNeedDO.setTransCurrency(currency); orderSpecialNeedDO.setTransCurrency(currency);
})); }));
...@@ -1177,9 +1183,14 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1177,9 +1183,14 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 更新 // 更新
orderSpecialNeedService.updateBatchById(orderSpecialNeedList); orderSpecialNeedService.updateBatchById(orderSpecialNeedList);
} }
else
{
}
// 生成特需应收 // 生成特需应收
orderSpecialNeedService.buildSpecialReceivable(orderId, 1); orderSpecialNeedService.buildSpecialReceivable(orderId, 1);
List<OrderWarehouseInDO> orderWarehouseInDOList = List<OrderWarehouseInDO> orderWarehouseInDOList =
orderWarehouseInMapper.selectList(OrderWarehouseInDO::getOrderId, orderWarehouseInMapper.selectList(OrderWarehouseInDO::getOrderId,
orderDO.getOrderId()); orderDO.getOrderId());
......
...@@ -156,7 +156,10 @@ public class ProdCostCalculation { ...@@ -156,7 +156,10 @@ public class ProdCostCalculation {
} }
if (Objects.nonNull(prodParam.getChargeWeight())) { if (Objects.nonNull(prodParam.getChargeWeight())) {
chargeTotalWeight = chargeTotalWeight.add(prodParam.getChargeWeight().compareTo(prodParam.getMinMeteringWeight()) > 0 ? prodParam.getChargeWeight() : prodParam.getMinMeteringWeight()); chargeTotalWeight = chargeTotalWeight.add(prodParam.getChargeWeight().compareTo(prodParam.getMinMeteringWeight()) > 0 ? prodParam.getChargeWeight() : prodParam.getMinMeteringWeight());
// 空运收费重量,总重量小于1kg,按1kg算,大于1kg的小数点后值,不足0.5按0.5加,大于0.5不足1按1.0加,如收费重量3.1=实际收费重量3.5,收费重量4.51=实际收费重量5.0 // 空运收费重量,总重量小于1kg,按1kg算,
// 大于1kg的小数点后值,不足0.5按0.5加,
// 大于0.5不足1按1.0加,如收费重量3.1=实际收费重量3.5,
// 收费重量4.51=实际收费重量5.0
if (chargeTotalWeight.compareTo(BigDecimal.ONE) < 0) { if (chargeTotalWeight.compareTo(BigDecimal.ONE) < 0) {
chargeTotalWeight = BigDecimal.ONE; chargeTotalWeight = BigDecimal.ONE;
} else { } else {
...@@ -259,12 +262,14 @@ public class ProdCostCalculation { ...@@ -259,12 +262,14 @@ public class ProdCostCalculation {
throw exception(NOT_FIND_CURRENCY); throw exception(NOT_FIND_CURRENCY);
} }
// // 美元货币ID // 美元货币ID 1
Integer usdCurrency = Integer usdCurrency =
currencyDOList.stream().filter(currencyDO -> StringUtils.equals("$", currencyDO.getFuhao())).findFirst().get().getId(); currencyDOList.stream().filter(currencyDO -> StringUtils.equals("$",
// 人民币货币ID currencyDO.getFuhao())).findFirst().get().getId();
// 人民币货币ID 3
Integer rmbCurrency = Integer rmbCurrency =
currencyDOList.stream().filter(currencyDO -> StringUtils.equals("¥", currencyDO.getFuhao())).findFirst().get().getId(); currencyDOList.stream().filter(currencyDO -> StringUtils.equals("¥",
currencyDO.getFuhao())).findFirst().get().getId();
if (CollectionUtil.isEmpty(prodConditionParamList)) { if (CollectionUtil.isEmpty(prodConditionParamList)) {
throw exception(PROD_PARAM_NOT_NULL); throw exception(PROD_PARAM_NOT_NULL);
...@@ -275,7 +280,7 @@ public class ProdCostCalculation { ...@@ -275,7 +280,7 @@ public class ProdCostCalculation {
.collect(Collectors.toMap(UnitDO::getId, .collect(Collectors.toMap(UnitDO::getId,
Function.identity(), (key1, key2) -> key2)); Function.identity(), (key1, key2) -> key2));
//prodCostDtoList 计价返回值 lanbm 2024-06-20 添加注释 //prodCostDtoList 计价返回值
List<ProdCostDto> prodCostDtoList = new ArrayList<>(); List<ProdCostDto> prodCostDtoList = new ArrayList<>();
// 统计箱规 // 统计箱规
String l = "0"; String l = "0";
...@@ -416,7 +421,7 @@ public class ProdCostCalculation { ...@@ -416,7 +421,7 @@ public class ProdCostCalculation {
Objects.nonNull(warehouseLineDO.getCurrencyUnit()) Objects.nonNull(warehouseLineDO.getCurrencyUnit())
&& warehouseLineDO.getCurrencyUnit() > 0) { && warehouseLineDO.getCurrencyUnit() > 0) {
// 当线路服务中设置了保费货币单位时,就以服务设置的为准,否则使用默认美元 //当线路服务中设置了保费货币单位时,就以服务设置的为准,否则使用默认美元
insuranceCurrencyId = warehouseLineDO.getCurrencyUnit(); insuranceCurrencyId = warehouseLineDO.getCurrencyUnit();
minInsuranceFee = warehouseLineDO.getMinPrice(); minInsuranceFee = warehouseLineDO.getMinPrice();
} }
...@@ -425,21 +430,38 @@ public class ProdCostCalculation { ...@@ -425,21 +430,38 @@ public class ProdCostCalculation {
currencyApi.getCurrencyRate(rmbCurrency.longValue(), currencyApi.getCurrencyRate(rmbCurrency.longValue(),
insuranceCurrencyId); insuranceCurrencyId);
FeeDto feeDto = new FeeDto(); FeeDto feeDto = new FeeDto();
if (costDto.getTotalWorth().compareTo(BigDecimal.ZERO) > 0) { if (costDto.getTotalWorth().compareTo(BigDecimal.ZERO) > 0) {
// 因为货值为RMB计算,保价费应换算为目标货币(默认为美元) if(insuranceCurrencyId==Long.parseLong(usdCurrency.toString()))
{
//美元币种
//因为货值为RMB计算,保价费应换算为目标货币(默认为美元)
BigDecimal insuranceFee = costDto.getTotalWorth(). BigDecimal insuranceFee = costDto.getTotalWorth().
multiply(new BigDecimal("1.1")). multiply(new BigDecimal("1.1")).
multiply(new BigDecimal("0.002")). multiply(new BigDecimal("0.002")).
multiply(exchangeRateRespDTO.getCurrencyRate()). multiply(exchangeRateRespDTO.getCurrencyRate()).
setScale(0, RoundingMode.HALF_UP); setScale(0, RoundingMode.HALF_UP);
//insuranceFee lanbm 2024-05-14 修改报价费币种BUG //insuranceFee 修改报价费币种BUG
costDto.setInsuranceFee(insuranceFee); costDto.setInsuranceFee(insuranceFee);
feeDto.setAmount(insuranceFee); feeDto.setAmount(insuranceFee);
}
if(insuranceCurrencyId==Long.parseLong(rmbCurrency.toString()))
{
//保费是人民币,不用成汇率
BigDecimal insuranceFee = costDto.getTotalWorth().
multiply(new BigDecimal("1.1")).
multiply(new BigDecimal("0.002")).
setScale(0, RoundingMode.HALF_UP);
//insuranceFee 修改报价费币种BUG
costDto.setInsuranceFee(insuranceFee);
feeDto.setAmount(insuranceFee);
}
} else { } else {
costDto.setInsuranceFee(minInsuranceFee); costDto.setInsuranceFee(minInsuranceFee);
feeDto.setAmount(minInsuranceFee); feeDto.setAmount(minInsuranceFee);
} }
if (costDto.getInsuranceFee().compareTo(minInsuranceFee) < 0) { if (costDto.getInsuranceFee().compareTo(minInsuranceFee) < 0) {
costDto.setInsuranceFee(minInsuranceFee); // 保价费最低值 costDto.setInsuranceFee(minInsuranceFee); // 保价费最低值
feeDto.setAmount(minInsuranceFee); feeDto.setAmount(minInsuranceFee);
...@@ -623,7 +645,6 @@ public class ProdCostCalculation { ...@@ -623,7 +645,6 @@ public class ProdCostCalculation {
} }
if (Objects.nonNull(prodParam.getSpecialPriceType()) && if (Objects.nonNull(prodParam.getSpecialPriceType()) &&
prodParam.getSpecialPriceType()) { prodParam.getSpecialPriceType()) {
if (Objects.isNull(prodParam.getOneFreight())) { if (Objects.isNull(prodParam.getOneFreight())) {
throw exception(SPECIAL_PRICE_ONE_FREIGHT_NOT_NULL); throw exception(SPECIAL_PRICE_ONE_FREIGHT_NOT_NULL);
} }
...@@ -640,7 +661,7 @@ public class ProdCostCalculation { ...@@ -640,7 +661,7 @@ public class ProdCostCalculation {
!prodParam.getSpecialPriceType() && !prodParam.getSpecialPriceType() &&
!prodParam.getChannelManualPricing()) { !prodParam.getChannelManualPricing()) {
// 根据商品ID与线路ID获取商品运费与清关费的单价 //根据商品ID与线路ID获取商品运费与清关费的单价
ProductPriceDO productPriceDO = ProductPriceDO productPriceDO =
productPriceService.getOne(new LambdaQueryWrapper<ProductPriceDO>() productPriceService.getOne(new LambdaQueryWrapper<ProductPriceDO>()
.eq(ProductPriceDO::getProductId, prodParam.getProdId()) .eq(ProductPriceDO::getProductId, prodParam.getProdId())
...@@ -659,6 +680,7 @@ public class ProdCostCalculation { ...@@ -659,6 +680,7 @@ public class ProdCostCalculation {
if (Objects.nonNull(productPriceDO)) { if (Objects.nonNull(productPriceDO)) {
if (Objects.nonNull(prodParam.getIsPriced()) && if (Objects.nonNull(prodParam.getIsPriced()) &&
prodParam.getIsPriced()) { prodParam.getIsPriced()) {
if (productPriceDO.getStepPrice() == 0 && if (productPriceDO.getStepPrice() == 0 &&
prodParam.getIsChangeFeeValue()) { prodParam.getIsChangeFeeValue()) {
return; return;
...@@ -666,16 +688,20 @@ public class ProdCostCalculation { ...@@ -666,16 +688,20 @@ public class ProdCostCalculation {
} }
if (StringUtils.isNotBlank(no)) { if (StringUtils.isNotBlank(no)) {
if (no.startsWith("2")) { if (no.startsWith("2")) {
log.info("===== 报价单【{}】 线路无牌无液无电价:{} =====", no, JSONObject.toJSONString(productPriceDO)); log.info("===== 报价单【{}】 线路无牌无液无电价:{} =====",
no, JSONObject.toJSONString(productPriceDO));
} else { } else {
log.info("===== 订单【{}】 线路无牌无液无电价:{} =====", no, JSONObject.toJSONString(productPriceDO)); log.info("===== 订单【{}】 线路无牌无液无电价:{} =====",
no, JSONObject.toJSONString(productPriceDO));
} }
} else { } else {
log.info("===== 线路无牌无液无电价:{} =====", JSONObject.toJSONString(productPriceDO)); log.info("===== 线路无牌无液无电价:{} =====",
JSONObject.toJSONString(productPriceDO));
} }
if (productPriceDO.getBlacklist() == 1 || productPriceDO.getAuditStatus() == 1) { if (productPriceDO.getBlacklist() == 1 || productPriceDO.getAuditStatus() == 1) {
String lineName = I18nMessage.getLang() == 1 ? "unknown to unknown" : "未知到未知"; String lineName = I18nMessage.getLang() == 1 ? "unknown to unknown" : "未知到未知";
LogisticsInfoDto logisticsInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(lineId); LogisticsInfoDto logisticsInfoDto =
warehouseLineMapper.getStartInfoAndDestInfoByLineId(lineId);
if (Objects.nonNull(logisticsInfoDto)) { if (Objects.nonNull(logisticsInfoDto)) {
String startTitle = I18nMessage.getLang() == 1 ? String startTitle = I18nMessage.getLang() == 1 ?
StringUtils.isNotBlank(logisticsInfoDto.getStartTitleEn()) ? logisticsInfoDto.getStartTitleEn() : "unknown" : StringUtils.isNotBlank(logisticsInfoDto.getStartTitleEn()) ? logisticsInfoDto.getStartTitleEn() : "unknown" :
...@@ -688,10 +714,12 @@ public class ProdCostCalculation { ...@@ -688,10 +714,12 @@ public class ProdCostCalculation {
} }
if (productPriceDO.getBlacklist() == 1) { if (productPriceDO.getBlacklist() == 1) {
// 黑名单产品不允许添加 // 黑名单产品不允许添加
throw exception(THIS_LINE_PROD_ON_BLACK_LIST, I18nMessage.getLang() == 1 ? prodParam.getProdTitleEn() : prodParam.getProdTitleZh(), lineName); throw exception(THIS_LINE_PROD_ON_BLACK_LIST,
I18nMessage.getLang() == 1 ? prodParam.getProdTitleEn() : prodParam.getProdTitleZh(), lineName);
} else { } else {
// 下架的线路产品不允许添加 // 下架的线路产品不允许添加
throw exception(THIS_LINE_PROD_OFF_SHELF, I18nMessage.getLang() == 1 ? prodParam.getProdTitleEn() : prodParam.getProdTitleZh(), lineName); throw exception(THIS_LINE_PROD_OFF_SHELF,
I18nMessage.getLang() == 1 ? prodParam.getProdTitleEn() : prodParam.getProdTitleZh(), lineName);
} }
} }
...@@ -705,7 +733,8 @@ public class ProdCostCalculation { ...@@ -705,7 +733,8 @@ public class ProdCostCalculation {
prodParam.setNeedOrderInquiry(productPriceDO.getNeedOrderInquiry()); prodParam.setNeedOrderInquiry(productPriceDO.getNeedOrderInquiry());
// 确定计量单位 // 确定计量单位
prodParam.setFreightVolume(productPriceDO.getPriceType() == 0 ? productPriceDO.getTransportVolumeUnit() : productPriceDO.getAllVolumeUnit()); prodParam.setFreightVolume(productPriceDO.getPriceType() == 0 ? productPriceDO.getTransportVolumeUnit() : productPriceDO.getAllVolumeUnit());
UnitDO unitDO = unitDOMap.get(Integer.valueOf(prodParam.getFreightVolume().toString())); UnitDO unitDO = unitDOMap.get(
Integer.valueOf(prodParam.getFreightVolume().toString()));
if (unitDO != null) { if (unitDO != null) {
if (StringUtils.equals("m³", unitDO.getFuhao())) { if (StringUtils.equals("m³", unitDO.getFuhao())) {
// 体积 // 体积
...@@ -730,8 +759,10 @@ public class ProdCostCalculation { ...@@ -730,8 +759,10 @@ public class ProdCostCalculation {
if (productPriceDO.getPriceType() == 0 && if (productPriceDO.getPriceType() == 0 &&
Objects.nonNull(productPriceDO.getClearanceVolumeUnit())) { Objects.nonNull(productPriceDO.getClearanceVolumeUnit())) {
prodParam.setClearanceFeeVolume(productPriceDO.getClearanceVolumeUnit()); prodParam.setClearanceFeeVolume(
UnitDO clearanceUnitDO = unitDOMap.get(Integer.valueOf(prodParam.getClearanceFeeVolume().toString())); productPriceDO.getClearanceVolumeUnit());
UnitDO clearanceUnitDO =
unitDOMap.get(Integer.valueOf(prodParam.getClearanceFeeVolume().toString()));
prodParam.setClearanceUnitDO(clearanceUnitDO); prodParam.setClearanceUnitDO(clearanceUnitDO);
} }
prodParam.setProductPriceDO(productPriceDO); prodParam.setProductPriceDO(productPriceDO);
...@@ -993,7 +1024,6 @@ public class ProdCostCalculation { ...@@ -993,7 +1024,6 @@ public class ProdCostCalculation {
} }
} else { } else {
zTest3 z = new zTest3(); zTest3 z = new zTest3();
z.setCreatedate(new Date()); z.setCreatedate(new Date());
String s = "产品线路价格为空"; String s = "产品线路价格为空";
......
...@@ -185,8 +185,10 @@ public class ProdConditionParam { ...@@ -185,8 +185,10 @@ public class ProdConditionParam {
@ApiModelProperty(value = "应收运费单价(原始价格(无牌无液无电)+特殊加价+明佣)") @ApiModelProperty(value = "应收运费单价(原始价格(无牌无液无电)+特殊加价+明佣)")
private BigDecimal receivableOneSeaFreight; private BigDecimal receivableOneSeaFreight;
@ApiModelProperty(value = "商品运费单价(成交)") @ApiModelProperty(value = "商品运费单价(成交)")
private BigDecimal oneFreight; private BigDecimal oneFreight;
@ApiModelProperty(value = "商品运费单价(成交)-前端传值转换字段") @ApiModelProperty(value = "商品运费单价(成交)-前端传值转换字段")
private BigDecimal oneSeaFreight; private BigDecimal oneSeaFreight;
......
...@@ -59,7 +59,7 @@ public class ProdLinePriceController { ...@@ -59,7 +59,7 @@ public class ProdLinePriceController {
peek(it -> it.setIsPriced(false)). peek(it -> it.setIsPriced(false)).
collect(Collectors.toList())); collect(Collectors.toList()));
//获取价格信息 lanbm 2024-06-20 添加注释 //获取价格信息
List<ProdConditionParam> prodConditionParams = List<ProdConditionParam> prodConditionParams =
prodCostCalculation.obtainProdLineOnePrice( prodCostCalculation.obtainProdLineOnePrice(
param.getProdConditionParamList(), param.getProdConditionParamList(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment