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