Commit 370dc895 authored by lanbaoming's avatar lanbaoming

2024-06-21提交

parent 22776506
package cn.iocoder.yudao.framework.toolkit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ZTestMapper extends BaseMapper<zTest> {
}
......@@ -661,8 +661,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
if (freightCurrencyId.equals(it.getSeaFreightCurrency())) {
sR += " freightCurrencyId=it.getSeaFreightCurrency";
} else {
sR += " freightCurrencyId"+freightCurrencyId
+"<>it.getSeaFreightCurrency"+it.getSeaFreightCurrency();
sR += " freightCurrencyId" + freightCurrencyId
+ "<>it.getSeaFreightCurrency" + it.getSeaFreightCurrency();
return sR;
}
......@@ -672,9 +672,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
if (freightUnitId.equals(it.getSeaFreightVolume())) {
sR+="freightUnitId=it.getSeaFreightVolume";
sR += "freightUnitId=it.getSeaFreightVolume";
} else {
sR+="freightUnitId"+freightUnitId+"<>it.getSeaFreightVolume"+
sR += "freightUnitId" + freightUnitId + "<>it.getSeaFreightVolume" +
it.getSeaFreightVolume();
}
return sR;
......@@ -727,7 +727,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
currencyApi.getAllCurrency();
List<ApplyInfoVO> applyInfoVOList = new ArrayList<>();
for (OrderItemDO it : orderItemDOList) {
String sLog = getLog(it,freightFee,freightCurrencyId,freightUnitId);
String sLog = getLog(it, freightFee, freightCurrencyId, freightUnitId);
// 只针对已入仓的品名进行加价处理
if (Objects.nonNull(it.getWarehouseInInfoVO()) &&
it.getWarehouseInInfoVO().getCartonsNum() > 0) {
......@@ -956,12 +956,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
return newOrderNo;
}
//费用来源:1 订单计算 2 费用申请 3 特需费用
@Override
public boolean addOrderReceivable(OrderDO orderDO, Integer type) {
boolean isPayAdvanceException = false;
// 查询订单已添加的费用类型
List<ReceivableDO> receivableDOList = receivableService.list(new LambdaQueryWrapper<ReceivableDO>().eq(ReceivableDO::getOrderId, orderDO.getOrderId()).eq(ReceivableDO::getDeleted, false));
List<ReceivableDO> receivableDOList =
receivableService.list(
new LambdaQueryWrapper<ReceivableDO>().eq(ReceivableDO::getOrderId, orderDO.getOrderId()).eq(ReceivableDO::getDeleted, false));
// TODO 处理订单项
CostVO costVO = JSONObject.parseObject(orderDO.getCost(), CostVO.class);
FeeDto premiumFeeDto = null;
......@@ -973,7 +975,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
worthFeeDto = costVO.getFeeDtoList().stream().filter(fee -> Objects.equals(fee.getFeeType(), FeeTypeEnum.WORTH.getType())).findFirst().orElse(null);
}
}
List<OrderItemDO> itemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderDO.getOrderId()));
List<OrderItemDO> itemDOList =
orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderDO.getOrderId()));
if (CollectionUtil.isNotEmpty(receivableDOList)) {
// TODO 处理保价费
ReceivableDO premiumReceivable = receivableDOList.stream().filter(r -> r.getFeeType() == 6 && Objects.nonNull(r.getFeeSource()) && 1 == r.getFeeSource()).findFirst().orElse(null);
......@@ -987,12 +990,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
reqVO.setPaymentUser(String.valueOf(orderDO.getDrawee() != 3 ? orderDO.getDrawee() : orderQueryService.customDrawee(orderDO, 6)));
reqVO.setIsPayAdvance(0);
reqVO.setCollectionType(4);// 到付
reqVO.setFeeType(6);
reqVO.setFeeSource(1);
reqVO.setFeeType(6);//保价费
reqVO.setFeeSource(1);//费用来源,订单计算
if (Objects.nonNull(premiumFeeDto)) {
reqVO.setAmountWorth(Objects.isNull(worthFeeDto) ? BigDecimal.ZERO : worthFeeDto.getAmount());
reqVO.setUnitPrice(premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
reqVO.setTotalAmount(premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
reqVO.setTotalAmount(
premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
reqVO.setTaxAmount(premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
reqVO.setCurrencyId(Long.valueOf(premiumFeeDto.getCurrencyId()));
receivableService.createReceivable(reqVO);
......@@ -1000,20 +1004,24 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
} else {
// TODO 已经付款的应收单不允许修改
if (Objects.nonNull(premiumFeeDto) && premiumReceivable.getState() == 0) {
if (Objects.nonNull(premiumFeeDto) &&
premiumReceivable.getState() == 0) {
premiumReceivable.setTitleZh(null);
premiumReceivable.setTitleEn(null);
premiumReceivable.setPaymentUser(String.valueOf(orderDO.getDrawee() != 3 ? orderDO.getDrawee() : orderQueryService.customDrawee(orderDO, 6)));
premiumReceivable.setAmountWorth(Objects.isNull(worthFeeDto) ? BigDecimal.ZERO : worthFeeDto.getAmount());
premiumReceivable.setUnitPrice(premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
premiumReceivable.setTotalAmount(premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
premiumReceivable.setTotalAmount(
premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
premiumReceivable.setTaxAmount(premiumFeeDto.getAmount().setScale(0, RoundingMode.HALF_UP));
premiumReceivable.setCurrencyId(Long.valueOf(premiumFeeDto.getCurrencyId()));
premiumReceivable.setFeeSource(1);
premiumReceivable.setFeeSource(1);//费用来源,订单计算
try {
receivableService.updateReceivableById(premiumReceivable);
} catch (Exception e) {
log.error(String.format("订单号[%s]的保价费应收单更新失败,失败原因:%s", orderDO.getOrderNo(), e.getMessage()));
log.error(String.format("订单号[%s]的保价费应收单更新失败,失败原因:%s",
orderDO.getOrderNo(),
e.getMessage()));
}
}
}
......@@ -1044,7 +1052,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
continue;
}
}
this.createReceivable(orderDO, orderItemDO, 1, orderItemDO.getOneSeaFreight(), orderItemDO.getSeaFreight(), orderItemDO.getSeaFreightCurrency());
//运费
this.createReceivable(orderDO,
orderItemDO, 1,
orderItemDO.getOneSeaFreight(),
orderItemDO.getSeaFreight(),
orderItemDO.getSeaFreightCurrency());
}
} else {
if (freightReceivable.getState() == 0) {
......@@ -1055,7 +1068,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
freightReceivable.setPaymentUser(String.valueOf(orderDO.getDrawee() != 3 ? orderDO.getDrawee() : orderQueryService.customDrawee(orderDO, 1)));
freightReceivable.setAmountWorth(orderItemDO.getWorth());
freightReceivable.setUnitPrice(orderItemDO.getOneSeaFreight());
freightReceivable.setTotalAmount(orderItemDO.getSeaFreight().setScale(0, RoundingMode.HALF_UP));
freightReceivable.setTotalAmount(
orderItemDO.getSeaFreight().setScale(0, RoundingMode.HALF_UP));
freightReceivable.setTaxAmount(orderItemDO.getSeaFreight().setScale(0, RoundingMode.HALF_UP));
freightReceivable.setFeeSource(1);
if (Objects.isNull(orderItemDO.getWarehouseInInfoVO()) || orderItemDO.getWarehouseInInfoVO().getCartonsNum() == 0) {
......@@ -1077,9 +1091,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
}
}
ReceivableDO clearanceFeeReceivable = receivableDOList.stream().filter(r -> r.getFeeType() == 2 &&
ReceivableDO clearanceFeeReceivable =
receivableDOList.stream().filter(r -> r.getFeeType() == 2 &&
Objects.nonNull(r.getFeeSource()) && 1 == r.getFeeSource() && Objects.equals(r.getOrderItemId(),
orderItemDO.getOrderItemId())).findFirst().orElse(null);
if (orderItemDO.getCharging() == 0) {
// 清关费
if (Objects.isNull(clearanceFeeReceivable)) {
......@@ -1126,9 +1142,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
clearanceFeeReceivable.setAmountWorth(orderItemDO.getWorth());
clearanceFeeReceivable.setUnitPrice(orderItemDO.getOneClearanceFreight());
clearanceFeeReceivable.setTotalAmount(orderItemDO.getClearanceFreight().setScale(0, RoundingMode.HALF_UP));
clearanceFeeReceivable.setTaxAmount(orderItemDO.getClearanceFreight().setScale(0, RoundingMode.HALF_UP));
clearanceFeeReceivable.setCurrencyId(Long.valueOf(orderItemDO.getClearanceFreightCurrency()));
clearanceFeeReceivable.setTotalAmount(
orderItemDO.getClearanceFreight().setScale(0, RoundingMode.HALF_UP));
clearanceFeeReceivable.setTaxAmount(
orderItemDO.getClearanceFreight().setScale(0, RoundingMode.HALF_UP));
clearanceFeeReceivable.setCurrencyId(
Long.valueOf(orderItemDO.getClearanceFreightCurrency()));
try {
receivableService.updateReceivableById(clearanceFeeReceivable);
} catch (Exception e) {
......@@ -1202,7 +1221,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
* @param totalAmount 总额
* @param currencyId 货币ID
*/
private void createReceivable(OrderDO orderDO, OrderItemDO orderItemDO, Integer feeType, BigDecimal
private void createReceivable(OrderDO orderDO,
OrderItemDO orderItemDO,
Integer feeType, BigDecimal
unitPrice, BigDecimal totalAmount, Integer currencyId) {
if (Objects.nonNull(orderItemDO.getWarehouseInInfoVO()) && orderItemDO.getWarehouseInInfoVO().getCartonsNum() > 0) {
if (Objects.isNull(orderItemDO.getIsPayAdvance())) {
......@@ -1239,8 +1260,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
reqVO.setAmountWorth(orderItemDO.getWorth());
reqVO.setUnitPrice(unitPrice);
reqVO.setTotalAmount(totalAmount.setScale(0, RoundingMode.HALF_UP));
reqVO.setTaxAmount(totalAmount.setScale(0, RoundingMode.HALF_UP));
//四舍五入取整数
reqVO.setTotalAmount(totalAmount.setScale(0,
RoundingMode.HALF_UP));
reqVO.setTaxAmount(totalAmount.setScale(0,
RoundingMode.HALF_UP));
reqVO.setCurrencyId(Long.valueOf(currencyId));
receivableService.createReceivable(reqVO);
}
......@@ -2144,6 +2168,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
//14 是批量加价
//15 是费用计算
public void costCalculation(String userId,
OrderDO orderDO,
Long consignorCustomerId,
......@@ -2152,6 +2177,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
Long consigneeCustomerContactsId,
List<OrderItemDO> orderItemDOList,
Integer type) {
//2023-7月之前应收金额没有按四舍五入取整,之后都是按四舍五入取整处理的
//lanbm 2024-06-20 添加注释说明逻辑
LogisticsInfoDto logisticsInfoDto =
warehouseLineMapper.getStartInfoAndDestInfoByLineId(
......@@ -2213,10 +2240,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderDO.setVWeight(vWeight);
} else {
// 当订单开始入仓时,对订单进行原始重泡货基数初始化
if (Objects.isNull(orderDO.getOrgWeightUnit()) || orderDO.getOrgWeightUnit().compareTo(BigDecimal.ZERO) == 0) {
if (Objects.isNull(orderDO.getOrgWeightUnit()) ||
orderDO.getOrgWeightUnit().compareTo(BigDecimal.ZERO) == 0) {
orderDO.setOrgWeightUnit(orgZhongPaoBestVO.getZhongEdge());
}
if (Objects.isNull(orderDO.getOrgVolumeUnit()) || orderDO.getOrgVolumeUnit().compareTo(BigDecimal.ZERO) == 0) {
if (Objects.isNull(orderDO.getOrgVolumeUnit()) ||
orderDO.getOrgVolumeUnit().compareTo(BigDecimal.ZERO) == 0) {
orderDO.setOrgVolumeUnit(orgZhongPaoBestVO.getPaoEdge());
}
// 保存当前计价使用的
......@@ -2251,40 +2280,61 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
// 新运费和清关费的金额与老运费和清关费的金额变动
BigDecimal oldFreightAndClearanceFee = BigDecimal.ZERO;
BigDecimal newFreightAndClearanceFee = BigDecimal.ZERO;
if (StringUtils.isNotBlank(orderDO.getCost())) {
CostVO oldCostVO = JSONObject.parseObject(orderDO.getCost(), CostVO.class);
CostVO oldCostVO = JSONObject.parseObject(orderDO.getCost(),
CostVO.class);
List<FeeDto> oldFeeDtoList = oldCostVO.getFeeDtoList();
Map<Long, ExchangeRateRespDTO> oldExchangeRateRespDTOMap = null;
Map<Long, ExchangeRateRespDTO> newExchangeRateRespDTOMap = null;
if (CollectionUtil.isNotEmpty(oldFeeDtoList) && CollectionUtil.isNotEmpty(newFeeDtoList)) {
Set<Long> oldCurrencyIdList = oldFeeDtoList.stream().filter(feeDto -> Objects.equals(feeDto.getFeeType(), FeeTypeEnum.FREIGHT.getType()) || Objects.equals(feeDto.getFeeType(), FeeTypeEnum.CLEARANCE_FEE.getType())).map(FeeDto::getCurrencyId).map(c -> Long.parseLong(String.valueOf(c))).collect(Collectors.toSet());
Set<Long> newCurrencyIdList = newFeeDtoList.stream().filter(feeDto -> Objects.equals(feeDto.getFeeType(), FeeTypeEnum.FREIGHT.getType()) || Objects.equals(feeDto.getFeeType(), FeeTypeEnum.CLEARANCE_FEE.getType())).map(FeeDto::getCurrencyId).map(c -> Long.parseLong(String.valueOf(c))).collect(Collectors.toSet());
if (type == 10 && (oldCurrencyIdList.size() > 1 || newCurrencyIdList.size() > 1)) {
List<ExchangeRateRespDTO> oldExchangeRateRespDTOList = currencyApi.getCurrencyRateList(oldCurrencyIdList, 1L);
if (CollectionUtil.isNotEmpty(oldFeeDtoList) &&
CollectionUtil.isNotEmpty(newFeeDtoList)) {
Set<Long> oldCurrencyIdList = oldFeeDtoList.stream().filter(
feeDto -> Objects.equals(feeDto.getFeeType(),
FeeTypeEnum.FREIGHT.getType()) || Objects.equals(feeDto.getFeeType(), FeeTypeEnum.CLEARANCE_FEE.getType())).map(FeeDto::getCurrencyId).map(c -> Long.parseLong(String.valueOf(c))).collect(Collectors.toSet());
Set<Long> newCurrencyIdList = newFeeDtoList.stream().filter(
feeDto -> Objects.equals(feeDto.getFeeType(),
FeeTypeEnum.FREIGHT.getType()) || Objects.equals(feeDto.getFeeType(), FeeTypeEnum.CLEARANCE_FEE.getType())).map(FeeDto::getCurrencyId).map(c -> Long.parseLong(String.valueOf(c))).collect(Collectors.toSet());
if (type == 10 && (oldCurrencyIdList.size() > 1 ||
newCurrencyIdList.size() > 1)) {
List<ExchangeRateRespDTO> oldExchangeRateRespDTOList =
currencyApi.getCurrencyRateList(oldCurrencyIdList,
1L);
if (CollectionUtil.isNotEmpty(oldExchangeRateRespDTOList)) {
oldExchangeRateRespDTOMap = oldExchangeRateRespDTOList.stream().collect(Collectors.toMap(ExchangeRateRespDTO::getSourceCurrencyId, v -> v, (v1, v2) -> v2));
oldExchangeRateRespDTOMap =
oldExchangeRateRespDTOList.stream().collect(Collectors.toMap(ExchangeRateRespDTO::getSourceCurrencyId, v -> v, (v1, v2) -> v2));
}
List<ExchangeRateRespDTO> newExchangeRateRespDTOList = currencyApi.getCurrencyRateList(newCurrencyIdList, 1L);
List<ExchangeRateRespDTO> newExchangeRateRespDTOList =
currencyApi.getCurrencyRateList(newCurrencyIdList,
1L);
if (CollectionUtil.isNotEmpty(newExchangeRateRespDTOList)) {
newExchangeRateRespDTOMap = newExchangeRateRespDTOList.stream().collect(Collectors.toMap(ExchangeRateRespDTO::getSourceCurrencyId, v -> v, (v1, v2) -> v2));
}
}
}
if (CollectionUtil.isNotEmpty(oldFeeDtoList)) {
Map<Integer, CurrencyRespDTO> currencyRespDTOMap = currencyApi.getAllCurrency();
Map<Integer, CurrencyRespDTO> currencyRespDTOMap =
currencyApi.getAllCurrency();
for (FeeDto feeDto : oldFeeDtoList) {
if (type == 10 && (Objects.equals(feeDto.getFeeType(), FeeTypeEnum.FREIGHT.getType()) || Objects.equals(feeDto.getFeeType(), FeeTypeEnum.CLEARANCE_FEE.getType()))) {
if (Objects.nonNull(oldExchangeRateRespDTOMap)) {
ExchangeRateRespDTO exchangeRateRespDTO = oldExchangeRateRespDTOMap.get(Long.parseLong(String.valueOf(feeDto.getCurrencyId())));
ExchangeRateRespDTO exchangeRateRespDTO =
oldExchangeRateRespDTOMap.get(Long.parseLong(String.valueOf(feeDto.getCurrencyId())));
if (Objects.isNull(exchangeRateRespDTO)) {
throw exception(EXCHANGE_RATE_NOT_EXISTS_PARAM, currencyRespDTOMap.get(feeDto.getCurrencyId()).getFuhao(), currencyRespDTOMap.get(1).getFuhao());
}
oldFreightAndClearanceFee = oldFreightAndClearanceFee.add(feeDto.getAmount().multiply(exchangeRateRespDTO.getCurrencyRate()));
oldFreightAndClearanceFee =
oldFreightAndClearanceFee.add(feeDto.getAmount().multiply(exchangeRateRespDTO.getCurrencyRate()));
} else {
oldFreightAndClearanceFee = oldFreightAndClearanceFee.add(feeDto.getAmount());
oldFreightAndClearanceFee =
oldFreightAndClearanceFee.add(feeDto.getAmount());
}
}
if (!Objects.equals(feeDto.getFeeType(), FeeTypeEnum.FREIGHT.getType()) && !Objects.equals(feeDto.getFeeType(), FeeTypeEnum.CLEARANCE_FEE.getType()) && !Objects.equals(feeDto.getFeeType(), FeeTypeEnum.INSURANCE_FEE.getType()) && !Objects.equals(feeDto.getFeeType(), FeeTypeEnum.WORTH.getType())) {
if (!Objects.equals(feeDto.getFeeType(), FeeTypeEnum.FREIGHT.getType()) &&
!Objects.equals(feeDto.getFeeType(), FeeTypeEnum.CLEARANCE_FEE.getType())
&& !Objects.equals(feeDto.getFeeType(), FeeTypeEnum.INSURANCE_FEE.getType()) &&
!Objects.equals(feeDto.getFeeType(), FeeTypeEnum.WORTH.getType())) {
newFeeDtoList.add(feeDto);
}
}
......@@ -2340,10 +2390,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
// }
newCostVO.setFeeDtoList(newFeeDtoList);
newCostVO.setTotalVolume(newOrderItemDOList.stream().map(OrderItemDO::getVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
newCostVO.setTotalWeight(newOrderItemDOList.stream().map(OrderItemDO::getWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
newCostVO.setTotalNum(newOrderItemDOList.stream().mapToInt(OrderItemDO::getNum).filter(Objects::nonNull).sum());
newCostVO.setTotalQuantity(newOrderItemDOList.stream().mapToInt(OrderItemDO::getQuantity).filter(Objects::nonNull).sum());
newCostVO.setTotalVolume(newOrderItemDOList.stream().map(
OrderItemDO::getVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
newCostVO.setTotalWeight(newOrderItemDOList.stream().map(
OrderItemDO::getWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
newCostVO.setTotalNum(newOrderItemDOList.stream().mapToInt(
OrderItemDO::getNum).filter(Objects::nonNull).sum());
newCostVO.setTotalQuantity(newOrderItemDOList.stream().mapToInt(
OrderItemDO::getQuantity).filter(Objects::nonNull).sum());
if (typeSet.size() > 0) {
......@@ -2486,9 +2540,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} else {
if (type == 6 && Objects.equals(orderDO.getInWarehouseState(), OrderWarehouseInStatusEnum.warehouse_finished.getValue())) {
// 处理未报价时,如果是已入仓产品去生成应收
isPayAdvanceException = this.addOrderReceivable(orderDO, 1);
isPayAdvanceException = this.addOrderReceivable(orderDO,
1);
} else {
isPayAdvanceException = this.addOrderReceivable(orderDO, 2);
isPayAdvanceException = this.addOrderReceivable(orderDO,
2);
}
}
}
......
......@@ -6271,7 +6271,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
// 更新所属客户经理(业务员)
if (Objects.isNull(orderDO.getParentOrderId()) || orderDO.getParentOrderId() == 0 || orderDO.getSplitSeparateOrder()) {
if (Objects.isNull(orderDO.getParentOrderId()) ||
orderDO.getParentOrderId() == 0 ||
orderDO.getSplitSeparateOrder()) {
// 拆单子订单不执行客户经理分配规则,以原单为主
if (Objects.nonNull(orderDO.getCustomerId()) && orderDO.getCustomerId() > 0) {
addOrderCustomerService(orderDO,
......@@ -6279,8 +6281,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderDO.getCustomerId()) ? 1 : 2);
}
}
orderBusinessService.costCalculation(userId, orderDO, orderConsignorDO.getCustomerId(), orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(), orderConsigneeDO.getCustomerContactsId(), orderItemDOList, 15);
orderBusinessService.costCalculation(userId,
orderDO,
orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, 15);
}
@Override
......@@ -6297,8 +6305,14 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
addOrderCustomerService(orderDO, Objects.equals(orderConsignorDO.getCustomerId(), orderDO.getCustomerId()) ? 1 : 2);
}
}
orderBusinessService.costCalculation(userId, orderDO, orderConsignorDO.getCustomerId(), orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(), orderConsigneeDO.getCustomerContactsId(), orderItemDOList, 10);
orderBusinessService.costCalculation(userId,
orderDO,
orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
orderItemDOList,
10);
}
@Override
......
......@@ -353,9 +353,12 @@ public class OrderSpecialNeedServiceImpl extends AbstractService<OrderSpecialNee
@Override
@Transactional(rollbackFor = Exception.class)
public void buildSpecialReceivable(Long orderId, int type) {
List<OrderSpecialNeedDO> orderSpecialNeedDOS = orderSpecialNeedMapper.selectList(OrderSpecialNeedDO::getOrderId, orderId);
List<OrderSpecialNeedDO> orderSpecialNeedDOS =
orderSpecialNeedMapper.selectList(OrderSpecialNeedDO::getOrderId,
orderId);
if (CollectionUtil.isNotEmpty(orderSpecialNeedDOS)) {
orderSpecialNeedDOS.stream().filter(item -> item.getTransFee().compareTo(BigDecimal.ZERO) == 1).forEach(item -> build(item, type));
orderSpecialNeedDOS.stream().filter(
item -> item.getTransFee().compareTo(BigDecimal.ZERO) == 1).forEach(item -> build(item, type));
}
}
......
......@@ -1074,9 +1074,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
@Override
@Transactional(rollbackFor = Exception.class)
public boolean finishWarehouseIn(OrderWarehouseInFinishReqVO finishReqVO) {
String msg = "完成入仓";
Long orderId = finishReqVO.getOrderId();
OrderDO orderDO = orderService.getById(orderId);
if (orderDO == null) {
......@@ -1283,6 +1281,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
boolean firstRucang = orderDO.getRucangTime() == null;
if (firstRucang) {
//在下面的函数中弯沉费用计算 lanbm 2024-06-20 添加注释
orderService.finishOrderWarehouseIn(orderDO.getOrderId());
} else {
orderService.finishOrderWarehouseInUpdate(orderDO.getOrderId());
......
......@@ -138,7 +138,11 @@ public class OrderCommissionPayableJob implements JobHandler {
return "";
}
private void addCommissionPayable(CommissionPayableDO commissionPayable, OrderItemDO orderItemDO, OrderDO orderDO, Integer feeType, BigDecimal amount) {
private void addCommissionPayable(CommissionPayableDO commissionPayable,
OrderItemDO orderItemDO,
OrderDO orderDO,
Integer feeType,
BigDecimal amount) {
commissionPayable.setOrderId(orderItemDO.getOrderId());
commissionPayable.setOrderNo(orderItemDO.getOrderNo());
commissionPayable.setPayableNo(orderDO.getContainerNumber());
......@@ -168,7 +172,8 @@ public class OrderCommissionPayableJob implements JobHandler {
commissionPayable.setTotalAmount(amount.multiply(orderItemDO.getChargeVolume()).setScale(2, RoundingMode.HALF_UP));
} else if (StringUtils.equals("kg", unitDO.getFuhao())) {
// 重量
commissionPayable.setTotalAmount(amount.multiply(orderItemDO.getChargeWeight()).setScale(2, RoundingMode.HALF_UP));
commissionPayable.setTotalAmount(
amount.multiply(orderItemDO.getChargeWeight()).setScale(2, RoundingMode.HALF_UP));
} else if (StringUtils.equals("a", unitDO.getFuhao())) {
// 数量
commissionPayable.setTotalAmount(amount.multiply(orderItemDO.getChargeQuantity()).setScale(2, RoundingMode.HALF_UP));
......
......@@ -22,8 +22,10 @@ import cn.iocoder.yudao.module.ecw.dal.dataobject.currency.CurrencyDO;
import cn.iocoder.yudao.module.customer.dto.CustomerCommissionDto;
import cn.iocoder.yudao.module.customer.dto.CustomerCommissionQueryDto;
import cn.iocoder.yudao.module.customer.service.customer.commission.CustomerCommissionInfoService;
import cn.iocoder.yudao.module.product.dal.dataobject.coupon.zTest3;
import cn.iocoder.yudao.module.product.dal.dataobject.product.*;
import cn.iocoder.yudao.module.ecw.dal.dataobject.unit.UnitDO;
import cn.iocoder.yudao.module.product.dal.mysql.coupon.ZTestMapper3;
import cn.iocoder.yudao.module.product.dal.mysql.product.ProductAttrMapper;
import cn.iocoder.yudao.module.ecw.service.currency.CurrencyService;
import cn.iocoder.yudao.module.product.dal.mysql.product.ProductPricePackagingMapper;
......@@ -47,6 +49,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
......@@ -79,13 +82,25 @@ public class ProdCostCalculation {
private final WarehouseLineMapper warehouseLineMapper;
private final CustomerCommissionInfoService customerCommissionInfoService;
private final DictDataApi dictDataApi;
private final LineChannelPackagingService lineChannelPackagingService;
private final LineChannelPriceStepClearanceMapper lineChannelPriceStepClearanceMapper;
public List<ProdConditionParam> obtainProdLineOnePrice(List<ProdConditionParam> prodConditionParamList, String no,
Integer customsType, Long customerId, Integer transportId, Long lineId,
Long channelId, Boolean isWarehouseIn) {
private final LineChannelPackagingService
lineChannelPackagingService;
private final LineChannelPriceStepClearanceMapper
lineChannelPriceStepClearanceMapper;
//lanbm 2024-06-21 add
@Resource
private ZTestMapper3 zTestMapper;
public List<ProdConditionParam> obtainProdLineOnePrice(
List<ProdConditionParam> prodConditionParamList,
String no,
Integer customsType,
Long customerId,
Integer transportId,
Long lineId,
Long channelId,
Boolean isWarehouseIn) {
if (CollectionUtil.isEmpty(prodConditionParamList)) {
throw exception(PROD_PARAM_NOT_NULL);
......@@ -93,7 +108,9 @@ public class ProdCostCalculation {
// 获取所有单位
List<UnitDO> unitDOList = unitService.list();
Map<Integer, UnitDO> unitDOMap = unitDOList.stream()
.collect(Collectors.toMap(UnitDO::getId, Function.identity(), (key1, key2) -> key2));
.collect(Collectors.toMap(UnitDO::getId,
Function.identity(),
(key1, key2) -> key2));
// 单价查询计算
long index = 1;
......@@ -115,7 +132,14 @@ public class ProdCostCalculation {
prodParam.setItemId(index++);
}
// 查询价格
this.queryPrice(no, customsType, customerId, transportId, lineId, channelId, unitDOMap, prodParam);
this.queryPrice(no,
customsType,
customerId,
transportId,
lineId,
channelId,
unitDOMap, prodParam);
if (transportId == 3) {
// 空运的阶梯价格需要计算出订单的所有品名总收费值来匹配价格-->统计品名的总值
BigDecimal quantity = BigDecimal.valueOf(prodParam.getQuantity());
......@@ -123,10 +147,12 @@ public class ProdCostCalculation {
totalVolume = totalVolume.add(prodParam.getVolume().compareTo(prodParam.getMinMeteringVolume()) > 0 ? prodParam.getVolume() : prodParam.getMinMeteringVolume());
totalWeight = totalWeight.add(prodParam.getWeight().compareTo(prodParam.getMinMeteringWeight()) > 0 ? prodParam.getWeight() : prodParam.getMinMeteringWeight());
if (Objects.nonNull(prodParam.getChargeQuantity())) {
chargeTotalQuantity = chargeTotalQuantity.add(prodParam.getChargeQuantity().compareTo(prodParam.getMinMeteringQuantity()) > 0 ? prodParam.getChargeQuantity() : prodParam.getMinMeteringQuantity());
chargeTotalQuantity =
chargeTotalQuantity.add(prodParam.getChargeQuantity().compareTo(prodParam.getMinMeteringQuantity()) > 0 ? prodParam.getChargeQuantity() : prodParam.getMinMeteringQuantity());
}
if (Objects.nonNull(prodParam.getChargeVolume())) {
chargeTotalVolume = chargeTotalVolume.add(prodParam.getChargeVolume().compareTo(prodParam.getMinMeteringVolume()) > 0 ? prodParam.getChargeVolume() : prodParam.getMinMeteringVolume());
chargeTotalVolume =
chargeTotalVolume.add(prodParam.getChargeVolume().compareTo(prodParam.getMinMeteringVolume()) > 0 ? prodParam.getChargeVolume() : prodParam.getMinMeteringVolume());
}
if (Objects.nonNull(prodParam.getChargeWeight())) {
chargeTotalWeight = chargeTotalWeight.add(prodParam.getChargeWeight().compareTo(prodParam.getMinMeteringWeight()) > 0 ? prodParam.getChargeWeight() : prodParam.getMinMeteringWeight());
......@@ -148,15 +174,24 @@ public class ProdCostCalculation {
param.setChargeTotalQuantity(chargeTotalQuantity);
param.setChargeTotalVolume(chargeTotalVolume);
param.setChargeTotalWeight(chargeTotalWeight);
//param.setOneClearanceFee();
}
}
// 定价计算
for (ProdConditionParam prodParam : prodConditionParamList) {
// 品名定价
this.fixPrice(no, customsType, customerId, transportId, lineId, channelId, unitDOMap, prodParam);
this.fixPrice(no,
customsType,
customerId,
transportId,
lineId,
channelId,
unitDOMap,
prodParam);
// 应收运费单价(原始价格(无牌无液无电)+特殊加价+明佣)
BigDecimal receivableOneSeaFreight = prodParam.getOrgFreightPrice().add(prodParam.getElectrifiedFreightPrice())
BigDecimal receivableOneSeaFreight =
prodParam.getOrgFreightPrice().add(prodParam.getElectrifiedFreightPrice())
.add(prodParam.getLiquidFreightPrice()).add(prodParam.getBrandFreightPrice()).add(prodParam.getPlainCommission());
prodParam.setReceivableOneSeaFreight(receivableOneSeaFreight);
// 应收运费
......@@ -164,17 +199,23 @@ public class ProdCostCalculation {
if (prodParam.getCharging() == 0) {
// 应收清关费
// 应收清关费单价(原始价格(无牌无液无电)+特殊加价)")
BigDecimal receivableOneClearanceFreight = prodParam.getOrgClearanceFeePrice().add(prodParam.getElectrifiedClearanceFeePrice())
.add(prodParam.getLiquidClearanceFeePrice()).add(prodParam.getBrandClearanceFeePrice());
prodParam.setReceivableOneClearanceFreight(receivableOneClearanceFreight);
this.setReceivableClearancePrice(unitDOMap, prodParam, transportId);
BigDecimal receivableOneClearanceFreight =
prodParam.getOrgClearanceFeePrice().add(
prodParam.getElectrifiedClearanceFeePrice())
.add(prodParam.getLiquidClearanceFeePrice()).
add(prodParam.getBrandClearanceFeePrice());
prodParam.setReceivableOneClearanceFreight(
receivableOneClearanceFreight);
this.setReceivableClearancePrice(unitDOMap,
prodParam, transportId);
} else {
// 全价计算,都以运费计算完成,不再计算清关费
if (!prodParam.getSpecialPriceType()) {
prodParam.setOneClearanceFee(BigDecimal.ZERO);
prodParam.setReceivableOneClearanceFreight(BigDecimal.ZERO);
}
prodParam.setReceivableClearanceFreight(prodParam.getReceivableOneClearanceFreight());
prodParam.setReceivableClearanceFreight(
prodParam.getReceivableOneClearanceFreight());
}
}
return prodConditionParamList;
......@@ -199,12 +240,19 @@ public class ProdCostCalculation {
* @param channelId 渠道ID
* @return 商品列表计费后信息
*/
public CalculationCostResultDto calculationProdCost(List<ProdConditionParam> prodConditionParamList, String no,
Integer orderType, Integer customsType, Integer isControl,
Long userId, Long customerId,
Long consignorCustomerId, Long consigneeCustomerId,
Long consignorCustomerContactsId, Long consigneeCustomerContactsId,
Integer transportId, Long lineId, Long channelId) {
public CalculationCostResultDto calculationProdCost(List<ProdConditionParam> prodConditionParamList,
String no,
Integer orderType,
Integer customsType,
Integer isControl,
Long userId,
Long customerId,
Long consignorCustomerId,
Long consigneeCustomerId,
Long consignorCustomerContactsId,
Long consigneeCustomerContactsId,
Integer transportId,
Long lineId, Long channelId) {
//获取所有货币
List<CurrencyDO> currencyDOList = currencyService.list();
if (CollectionUtil.isEmpty(currencyDOList)) {
......@@ -224,7 +272,10 @@ public class ProdCostCalculation {
// // 获取所有单位
List<UnitDO> unitDOList = unitService.list();
Map<Integer, UnitDO> unitDOMap = unitDOList.stream()
.collect(Collectors.toMap(UnitDO::getId, Function.identity(), (key1, key2) -> key2));
.collect(Collectors.toMap(UnitDO::getId,
Function.identity(), (key1, key2) -> key2));
//prodCostDtoList 计价返回值 lanbm 2024-06-20 添加注释
List<ProdCostDto> prodCostDtoList = new ArrayList<>();
// 统计箱规
String l = "0";
......@@ -232,7 +283,13 @@ public class ProdCostCalculation {
String h = "0";
List<CouponAvailableGroupDto> couponAvailableGroupDtoList = new ArrayList<>();
couponService.getCouponUserAvailableDto(transportId, orderType, customsType, isControl, userId, consignorCustomerContactsId, consigneeCustomerContactsId, lineId, channelId, prodConditionParamList, rmbCurrency, unitDOMap);
couponService.getCouponUserAvailableDto(transportId,
orderType, customsType, isControl,
userId, consignorCustomerContactsId,
consigneeCustomerContactsId,
lineId, channelId,
prodConditionParamList,
rmbCurrency, unitDOMap);
// 计算订单费用
for (ProdConditionParam prodParam : prodConditionParamList) {
// 优惠金额:优惠活动减免
......@@ -418,7 +475,9 @@ public class ProdCostCalculation {
* @param prodParam 品名
* @param groupDto 优惠信息
*/
private void costEncapsulation(List<ProdCostDto> prodCostDtoList, ProdConditionParam prodParam, CouponAvailableGroupDto groupDto) {
private void costEncapsulation(List<ProdCostDto> prodCostDtoList,
ProdConditionParam prodParam,
CouponAvailableGroupDto groupDto) {
ProdCostDto prodCostDto = new ProdCostDto();
BeanUtils.copyProperties(prodParam, prodCostDto);
prodCostDto.setProdId(prodParam.getProdId());
......@@ -444,6 +503,7 @@ public class ProdCostCalculation {
prodCostDto.setHiddenCommission(prodParam.getHiddenCommission());
prodCostDto.setOneClearanceFee(prodParam.getOneClearanceFee());
prodCostDto.setOrgClearanceFeePrice(prodParam.getOrgClearanceFeePrice());
//清关费
prodCostDto.setClearanceFee(prodParam.getClearanceFee());
prodCostDto.setProductPriceEmptyType(prodParam.getProductPriceEmptyType());
prodCostDto.setChannelPriceEmptyType(prodParam.getChannelPriceEmptyType());
......@@ -458,6 +518,7 @@ public class ProdCostCalculation {
prodCostDto.setClearanceFeeCurrency(prodParam.getClearanceFeeCurrency());
prodCostDto.setOneFreight(prodParam.getOneFreight());
prodCostDto.setOrgFreightPrice(prodParam.getOrgFreightPrice());
//运费
prodCostDto.setFreight(prodParam.getFreight());
prodCostDto.setReceivableSeaFreight(prodParam.getReceivableSeaFreight());
prodCostDto.setDiscountFreightPrice(prodParam.getDiscountFreightPrice());
......@@ -469,6 +530,7 @@ public class ProdCostCalculation {
prodCostDto.setCharging(prodParam.getCharging());
prodCostDto.setNeedOrderInquiry(prodParam.getNeedOrderInquiry());
prodCostDto.setItemId(prodParam.getItemId());
prodCostDtoList.add(prodCostDto);
}
......@@ -478,7 +540,8 @@ public class ProdCostCalculation {
* @param prodParam 商品信息
* @param groupDto 可用优惠信息
*/
private void discountCalculation(ProdConditionParam prodParam, CouponAvailableGroupDto groupDto) {
private void discountCalculation(ProdConditionParam prodParam,
CouponAvailableGroupDto groupDto) {
// 没有定价或者指定更新订单品名优惠,并且成交单价大于0时,去实时更新品名的优惠信息
if ((Objects.isNull(prodParam.getIsPriced()) || !prodParam.getIsPriced() || prodParam.getCalculationType() == 6) && !prodParam.getSplitCustomPriceType() && !prodParam.getSpecialPriceType() && !prodParam.getChannelManualPricing() && prodParam.getOneFreight().compareTo(BigDecimal.ZERO) > 0) {
BigDecimal orgFreightReduceAmount = BigDecimal.ZERO;
......@@ -526,13 +589,23 @@ public class ProdCostCalculation {
prodParam.setDiscountClearanceFeePrice(BigDecimal.ZERO);
}
if (!prodParam.getSpecialPriceType()) {
prodParam.setOneClearanceFee(prodParam.getOneClearanceFee().add(orgClearanceReduceAmount).subtract(prodParam.getDiscountClearanceFeePrice()));
prodParam.setOneClearanceFee(
prodParam.getOneClearanceFee().
add(orgClearanceReduceAmount).
subtract(prodParam.getDiscountClearanceFeePrice()));
}
}
}
}
private void queryPrice(String no, Integer customsType, Long customerId, Integer transportId, Long lineId, Long channelId, Map<Integer, UnitDO> unitDOMap, ProdConditionParam prodParam) {
private void queryPrice(String no,
Integer customsType,
Long customerId,
Integer transportId,
Long lineId,
Long channelId,
Map<Integer, UnitDO> unitDOMap,
ProdConditionParam prodParam) {
if (null == prodParam.getWorth()) {
prodParam.setWorth(BigDecimal.ZERO);
}
......@@ -548,7 +621,9 @@ public class ProdCostCalculation {
if (null == prodParam.getNum()) {
prodParam.setNum(0);
}
if (Objects.nonNull(prodParam.getSpecialPriceType()) && prodParam.getSpecialPriceType()) {
if (Objects.nonNull(prodParam.getSpecialPriceType()) &&
prodParam.getSpecialPriceType()) {
if (Objects.isNull(prodParam.getOneFreight())) {
throw exception(SPECIAL_PRICE_ONE_FREIGHT_NOT_NULL);
}
......@@ -559,9 +634,15 @@ public class ProdCostCalculation {
}
}
if ((Objects.isNull(prodParam.getIsPriced()) || !prodParam.getIsPriced() || prodParam.getIsChangeFeeValue()) && !prodParam.getSplitCustomPriceType() && !prodParam.getSpecialPriceType() && !prodParam.getChannelManualPricing()) {
if ((Objects.isNull(prodParam.getIsPriced()) ||
!prodParam.getIsPriced() || prodParam.getIsChangeFeeValue())
&& !prodParam.getSplitCustomPriceType() &&
!prodParam.getSpecialPriceType() &&
!prodParam.getChannelManualPricing()) {
// 根据商品ID与线路ID获取商品运费与清关费的单价
ProductPriceDO productPriceDO = productPriceService.getOne(new LambdaQueryWrapper<ProductPriceDO>()
ProductPriceDO productPriceDO =
productPriceService.getOne(new LambdaQueryWrapper<ProductPriceDO>()
.eq(ProductPriceDO::getProductId, prodParam.getProdId())
.eq(ProductPriceDO::getWarehouseLineId, lineId)
.and(we -> we.le(ProductPriceDO::getValidateStartDate, DateUtil.date())
......@@ -576,8 +657,10 @@ public class ProdCostCalculation {
.last("limit 1"));
if (Objects.nonNull(productPriceDO)) {
if (Objects.nonNull(prodParam.getIsPriced()) && prodParam.getIsPriced()) {
if (productPriceDO.getStepPrice() == 0 && prodParam.getIsChangeFeeValue()) {
if (Objects.nonNull(prodParam.getIsPriced()) &&
prodParam.getIsPriced()) {
if (productPriceDO.getStepPrice() == 0 &&
prodParam.getIsChangeFeeValue()) {
return;
}
}
......@@ -644,7 +727,9 @@ public class ProdCostCalculation {
}
prodParam.setUnitDO(unitDO);
}
if (productPriceDO.getPriceType() == 0 && Objects.nonNull(productPriceDO.getClearanceVolumeUnit())) {
if (productPriceDO.getPriceType() == 0 &&
Objects.nonNull(productPriceDO.getClearanceVolumeUnit())) {
prodParam.setClearanceFeeVolume(productPriceDO.getClearanceVolumeUnit());
UnitDO clearanceUnitDO = unitDOMap.get(Integer.valueOf(prodParam.getClearanceFeeVolume().toString()));
prodParam.setClearanceUnitDO(clearanceUnitDO);
......@@ -666,19 +751,41 @@ public class ProdCostCalculation {
* @param unitDOMap 计量单位map
* @param prodParam 品名信息
*/
private void fixPrice(String no, Integer customsType, Long customerId, Integer transportId, Long lineId, Long channelId, Map<Integer, UnitDO> unitDOMap, ProdConditionParam prodParam) {
private void fixPrice(String no,
Integer customsType,
Long customerId,
Integer transportId,
Long lineId,
Long channelId,
Map<Integer, UnitDO> unitDOMap,
ProdConditionParam prodParam) {
BigDecimal transportPrice = BigDecimal.ZERO;// 初始化商品单价运费
BigDecimal clearancePrice = BigDecimal.ZERO;// 初始化商品单价清关费
if ((Objects.isNull(prodParam.getIsPriced()) || !prodParam.getIsPriced()) && !prodParam.getSplitCustomPriceType() && !prodParam.getSpecialPriceType() && !prodParam.getChannelManualPricing()) {
if ((Objects.isNull(prodParam.getIsPriced()) || !prodParam.getIsPriced())
&& !prodParam.getSplitCustomPriceType() &&
!prodParam.getSpecialPriceType() &&
!prodParam.getChannelManualPricing()) {
// 根据商品ID与线路ID获取商品运费与清关费的单价
ProductPriceDO productPriceDO = prodParam.getProductPriceDO();
if (Objects.nonNull(productPriceDO)) {
if (productPriceDO.getStepPrice() == 1) {
// 阶梯价格查询
if (transportId == 1 || transportId == 2) {
//海运拼柜
this.stepSelect(unitDOMap, prodParam, productPriceDO);
} else {
this.airStepSelect(unitDOMap, prodParam, productPriceDO, lineId, channelId);
//专线空运
zTest3 z = new zTest3();
z.setCreatedate(new Date());
String s = "开始计算空运清关价 airStepSelect,lineId=" + lineId +
" 渠道channelId=" + channelId;
z.setTestname(s);
zTestMapper.insert(z);
this.airStepSelect(unitDOMap, prodParam,
productPriceDO, lineId, channelId);
}
}
......@@ -694,62 +801,22 @@ public class ProdCostCalculation {
prodParam.setFreightCurrency(Math.toIntExact(productPriceDO.getPriceType() == 0 ? productPriceDO.getTransportPriceUnit() : productPriceDO.getAllPriceUnit()));
// 清关费
if (productPriceDO.getPriceType() == 0) {
//如果是运费加清关费
if (!prodParam.getSpecialPriceType()) {
prodParam.setOneClearanceFee(productPriceDO.getClearancePrice());
}
prodParam.setOrgClearanceFeePrice(productPriceDO.getClearancePrice());
prodParam.setClearanceFeeCurrency(Math.toIntExact(productPriceDO.getClearancePriceUnit()));
prodParam.setClearanceFeeVolume(productPriceDO.getClearanceVolumeUnit());
//不是特价
prodParam.setOneClearanceFee(
productPriceDO.getClearancePrice());
}
prodParam.setOrgClearanceFeePrice(
productPriceDO.getClearancePrice());
prodParam.setClearanceFeeCurrency(
Math.toIntExact(productPriceDO.getClearancePriceUnit()));
prodParam.setClearanceFeeVolume(
productPriceDO.getClearanceVolumeUnit());
if (transportId == 3) {
prodParam.setProductPriceEmptyType(productPriceDO.getProductPriceEmptyType());
}
// if (productPriceDO.getProductPriceEmptyType() == 0 && Objects.nonNull(productPriceDO.getClearancePrice()) && productPriceDO.getClearancePrice().compareTo(BigDecimal.ZERO) > 0 && transportId == 3) {
// prodParam.setAirClearanceSource(1);// 默认先获取的商品线路清关费
// prodParam.setAirClearanceInfo(productPriceDO.getAirClearanceInfo());// 默认先获取的商品线路清关费
// // TODO 获取线路设置的空运清关费
// List<LineChannelPackagingDO> packagingDOList = lineChannelPackagingService.queryAirClearancePrice(CollectionUtil.isNotEmpty(prodParam.getPackages()) ? prodParam.getPackages() : Collections.singletonList(prodParam.getPackaging()), lineId, channelId);
// if (CollectionUtil.isNotEmpty(packagingDOList)) {
//
// }
// }
// if (transportId == 1 || transportId == 2) {
// if (!prodParam.getSpecialPriceType()) {
// prodParam.setOneClearanceFee(productPriceDO.getClearancePrice());
// }
// prodParam.setOrgClearanceFeePrice(productPriceDO.getClearancePrice());
// prodParam.setClearanceFeeCurrency(Math.toIntExact(productPriceDO.getClearancePriceUnit()));
// prodParam.setClearanceFeeVolume(productPriceDO.getClearanceVolumeUnit());
//
// } else
// if (transportId == 3) {
// //空运清关费
// AirClearancePriceResultDto airClearancePriceResultDto = new AirClearancePriceResultDto();
// if (CollectionUtil.isNotEmpty(prodParam.getPackages())) {
// airClearancePriceResultDto = productPriceService.queryAirClearancePrice(prodParam.getProdId(), prodParam.getPackages(), channelId,
// prodParam.getTotalWeight(), prodParam.getTotalVolume(), Objects.isNull(prodParam.getTotalQuantity()) ? BigDecimal.ZERO : prodParam.getTotalQuantity());
// } else {
// airClearancePriceResultDto = productPriceService.queryAirClearancePrice(prodParam.getProdId(), prodParam.getPackaging(), channelId,
// prodParam.getTotalWeight(), prodParam.getTotalVolume(), Objects.isNull(prodParam.getTotalQuantity()) ? BigDecimal.ZERO : prodParam.getTotalQuantity());
// }
// BasePrice basePrice = airClearancePriceResultDto.getClearancePrice();
// log.info("空运渠道清关费:{}", Objects.nonNull(basePrice) ? JSONObject.toJSONString(basePrice) : null);
// prodParam.setProductPriceEmptyType(airClearancePriceResultDto.getProductPriceEmptyType());
// prodParam.setChannelPriceEmptyType(airClearancePriceResultDto.getChannelPriceEmptyType());
// if (Objects.nonNull(basePrice)) {
// prodParam.setOneClearanceFee(basePrice.getClearancePrice());
// prodParam.setOrgClearanceFeePrice(basePrice.getClearancePrice());
// prodParam.setClearanceFeeVolume(basePrice.getClearanceVolumeUnit());
// prodParam.setClearanceFeeCurrency(Math.toIntExact(basePrice.getClearancePriceUnit()));
// prodParam.setAirClearanceSource(basePrice.getAirClearanceSource());
// prodParam.setAirClearanceInfo(basePrice.getAirClearanceInfo());
// } else {
// prodParam.setClearanceFee(BigDecimal.ZERO);
// prodParam.setOneClearanceFee(BigDecimal.ZERO);
// prodParam.setOrgClearanceFeePrice(BigDecimal.ZERO);
// prodParam.setClearanceFeeVolume(0L);
// prodParam.setClearanceFeeCurrency(0);
// }
// }
prodParam.setProductPriceEmptyType(
productPriceDO.getProductPriceEmptyType());
}
} else {
prodParam.setClearanceFee(BigDecimal.ZERO);
prodParam.setOneClearanceFee(BigDecimal.ZERO);
......@@ -782,7 +849,8 @@ public class ProdCostCalculation {
} else {
// TODO 指定包装类型的包装加价
if (CollectionUtil.isNotEmpty(prodParam.getPackages())) {
List<ProductPricePackagingDO> pricePackagingDOList = pricePackagingMapper.selectList(new LambdaQueryWrapper<ProductPricePackagingDO>()
List<ProductPricePackagingDO> pricePackagingDOList =
pricePackagingMapper.selectList(new LambdaQueryWrapper<ProductPricePackagingDO>()
.eq(ProductPricePackagingDO::getDeleted, 0)
.eq(ProductPricePackagingDO::getProductPriceId, productPriceDO.getId()));
// 筛选匹配包装类型,并比较金额大小,取最大值
......@@ -813,7 +881,8 @@ public class ProdCostCalculation {
}
if (CollectionUtil.isNotEmpty(packagingDOList)) {
// 运费、全包价包装价格计算最大值
ProductPricePackagingDO packagingDO = packagingDOList.stream().max(Comparator.comparing(ProductPricePackagingDO::getPackagingPrice)).orElse(null);
ProductPricePackagingDO packagingDO =
packagingDOList.stream().max(Comparator.comparing(ProductPricePackagingDO::getPackagingPrice)).orElse(null);
if (Objects.nonNull(packagingDO)) {
prodParam.setPackagingFreightPrice(packagingDO.getPackagingPrice());
if (!prodParam.getSpecialPriceType()) {
......@@ -825,7 +894,8 @@ public class ProdCostCalculation {
}
if (CollectionUtil.isNotEmpty(clearancePackagingDOList)) {
// 清关费包装价格计算最大值
ProductPricePackagingDO clearancePackagingDO = clearancePackagingDOList.stream().max(Comparator.comparing(ProductPricePackagingDO::getPackagingPrice)).orElse(null);
ProductPricePackagingDO clearancePackagingDO =
clearancePackagingDOList.stream().max(Comparator.comparing(ProductPricePackagingDO::getPackagingPrice)).orElse(null);
if (Objects.nonNull(clearancePackagingDO)) {
prodParam.setPackagingClearanceFeePrice(clearancePackagingDO.getPackagingPrice());
if (!prodParam.getSpecialPriceType()) {
......@@ -912,7 +982,6 @@ public class ProdCostCalculation {
}
} else {
if (!prodParam.getSpecialPriceType()) {
prodParam.setOneFreight(transportPrice);
prodParam.setOneClearanceFee(clearancePrice);
......@@ -1176,70 +1245,164 @@ public class ProdCostCalculation {
* @param lineId 线路ID
* @param channelId 渠道ID
*/
private void airStepSelect(Map<Integer, UnitDO> unitDOMap, ProdConditionParam prodParam, ProductPriceDO
productPriceDO, Long lineId, Long channelId) {
private void airStepSelect(Map<Integer, UnitDO> unitDOMap,
ProdConditionParam prodParam,
ProductPriceDO productPriceDO,
Long lineId, Long channelId) {
if (prodParam.getUnitDO() == null) {
//运费计量单位信息
if (productPriceDO.getPriceType() == 0) {
//单价模式,0-运费+清关费,1-全包价
productPriceDO.setTransportPrice(BigDecimal.ZERO);
} else {
productPriceDO.setAllPrice(BigDecimal.ZERO);
}
// if (!prodParam.getSpecialPriceType()) {
// prodParam.setOneFreight(productPriceDO.getPriceType() == 0 ? productPriceDO.getTransportPrice() : productPriceDO.getAllPrice());
// }
} else {
BigDecimal num = this.calculationUnitAsValue(prodParam, productPriceDO, prodParam.getUnitDO(), 1);
return;
}
BigDecimal num = this.calculationUnitAsValue(prodParam,
productPriceDO,
prodParam.getUnitDO(),
1);
if (productPriceDO.getPriceType() == 0) {
BasePrice transportBasePrice = productPriceStepService.getProductPriceStep(productPriceDO.getId(), num, 0);
//lanbm 2024-06-21 添加的逻辑
if (productPriceDO.getPriceType() == null) return;
//全包价
if (productPriceDO.getPriceType() == 1) {
BasePrice allBasePrice =
productPriceStepService.getProductPriceStep(
productPriceDO.getId(), num, 1);
if (Objects.nonNull(allBasePrice)) {
log.info("===== 线路无牌无液无电全包阶梯价:{} =====",
JSONObject.toJSONString(allBasePrice));
productPriceDO.setAllPrice(allBasePrice.getAllPrice());
productPriceDO.setAllStepPriceId(allBasePrice.getAllStepPriceId());
} else {
log.info("===== 线路无牌无液无电全包阶梯价不存在【{} {}】该档次 =====",
num, prodParam.getUnitDO().getFuhao());
productPriceDO.setNeedPay(null);
productPriceDO.setAllPrice(BigDecimal.ZERO);
}
return;
}
//0-运费+清关费 才走下面的逻辑
//单价模式,0-运费+清关费,1-全包价
BasePrice transportBasePrice =
productPriceStepService.getProductPriceStep(
productPriceDO.getId(), num, 0);
if (Objects.nonNull(transportBasePrice)) {
log.info("===== 线路无牌无液无电运费阶梯价:{} =====", JSONObject.toJSONString(transportBasePrice));
log.info("===== 线路无牌无液无电运费阶梯价:{} =====",
JSONObject.toJSONString(transportBasePrice));
productPriceDO.setTransportPrice(transportBasePrice.getTransportPrice());
productPriceDO.setTransportStepPriceId(transportBasePrice.getTransportStepPriceId());
} else {
log.info("===== 线路无牌无液无电运费阶梯价不存在【{} {}】该档次 =====", num, prodParam.getUnitDO().getFuhao());
log.info("===== 线路无牌无液无电运费阶梯价不存在【{} {}】该档次 =====",
num, prodParam.getUnitDO().getFuhao());
productPriceDO.setNeedPay(null);
productPriceDO.setTransportPrice(BigDecimal.ZERO);
}
if (prodParam.getClearanceUnitDO() == null) {
//清关费单位为空,设置清关费为0
productPriceDO.setClearancePrice(BigDecimal.ZERO);
} else {
return;
}
// 清关费以实际入仓值来匹配
// 2024-1-17 空运清关费改为和空运运费一样使用订单总收费值来匹配
// BigDecimal clearanceNum = this.calculationUnitAsValue(prodParam, productPriceDO, prodParam.getClearanceUnitDO(), 0);
//BigDecimal clearanceNum = this.calculationUnitAsValue(prodParam, productPriceDO, prodParam.getClearanceUnitDO(), 0);
BigDecimal clearanceNum = num;
BasePrice clearanceBasePrice = productPriceStepService.getProductPriceStep(productPriceDO.getId(), clearanceNum, 2);
clearanceBasePrice.setClearancePriceUnit(productPriceDO.getClearancePriceUnit());
clearanceBasePrice.setClearanceVolumeUnit(productPriceDO.getClearanceVolumeUnit());
log.info("===== 线路无牌无液无电清关费阶梯价:{} =====", JSONObject.toJSONString(clearanceBasePrice));
//获取阶梯价
BasePrice clearanceBasePrice =
productPriceStepService.getProductPriceStep(
productPriceDO.getId(),
clearanceNum, 2);
clearanceBasePrice.setClearancePriceUnit(
productPriceDO.getClearancePriceUnit());
clearanceBasePrice.setClearanceVolumeUnit(
productPriceDO.getClearanceVolumeUnit());
log.info("===== 线路无牌无液无电清关费阶梯价:{} =====",
JSONObject.toJSONString(clearanceBasePrice));
int airClearanceSource = 3;
BasePrice clearancePrice;
if (clearanceBasePrice.getProductPriceEmptyType() == 0 && Objects.nonNull(lineId) && lineId > 0
&& Objects.nonNull(productPriceDO.getClearancePrice()) && productPriceDO.getClearancePrice().compareTo(BigDecimal.ZERO) > 0) {
// TODO 获取线路设置的空运清关费
List<LineChannelPackagingDO> lineChannelPackagingDOList = lineChannelPackagingService.queryAirClearancePrice(CollectionUtil.isNotEmpty(prodParam.getPackages()) ? prodParam.getPackages() : Collections.singletonList(prodParam.getPackaging()), channelId, lineId);
//clearanceBasePrice 阶梯价
//线路存在,产品路线价格存在清关价
if (clearanceBasePrice.getProductPriceEmptyType() == 0 &&
Objects.nonNull(lineId) && lineId > 0
&& Objects.nonNull(productPriceDO.getClearancePrice())
&& productPriceDO.getClearancePrice().compareTo(BigDecimal.ZERO) > 0) {
if (CollectionUtil.isNotEmpty(prodParam.getPackages())) {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("产品包装类型为:"+prodParam.getPackages().toString());
zTestMapper.insert(z);
}
//TODO 获取线路设置的空运清关费
//线路渠道清关费包装类型表 ecw_line_channel_packaging
List<LineChannelPackagingDO> lineChannelPackagingDOList =
lineChannelPackagingService.queryAirClearancePrice(
CollectionUtil.isNotEmpty(prodParam.getPackages()) ?
prodParam.getPackages() :
Collections.singletonList(prodParam.getPackaging()),
channelId, lineId);
if (CollectionUtil.isNotEmpty(lineChannelPackagingDOList)) {
//如果线路渠道的包装类型为空,就取阶梯价的清关价 lanbm 2024-06-21 添加注释
BasePrice lineClearanceBasePrice = null;
for (LineChannelPackagingDO lineChannelPackagingDO : lineChannelPackagingDOList) {
UnitDO lineClearanceUnitDO = unitDOMap.get(Integer.valueOf(lineChannelPackagingDO.getClearanceVolumeUnit().toString()));
for (LineChannelPackagingDO lineChannelPackagingDO :
lineChannelPackagingDOList) {
//计量单位
UnitDO lineClearanceUnitDO =
unitDOMap.get(Integer.valueOf(
lineChannelPackagingDO.getClearanceVolumeUnit().toString()));
if (lineClearanceUnitDO == null) {
continue;
}
if (Objects.isNull(lineClearanceBasePrice)) {
lineClearanceBasePrice = new BasePrice();
lineClearanceBasePrice.setClearancePrice(BigDecimal.ZERO);
lineClearanceBasePrice.setProductClearanceAsExchangePrice(BigDecimal.ZERO);
}
lineClearanceBasePrice.setClearancePriceUnit(lineChannelPackagingDO.getClearancePriceUnit());
lineClearanceBasePrice.setClearanceVolumeUnit(lineChannelPackagingDO.getClearanceVolumeUnit());
BigDecimal lineClearanceNum = this.calculationUnitAsValue(prodParam, productPriceDO, lineClearanceUnitDO, 0);
List<LineChannelPriceStepClearanceDO> packagingStepPriceDOList = lineChannelPackagingDO.getLineChannelPriceStepClearanceDOList();
ExchangeRateRespDTO productExchangeRate = currencyApi.getCurrencyRate(lineClearanceBasePrice.getClearancePriceUnit(), 1L);
lineClearanceBasePrice.setClearancePriceUnit(
lineChannelPackagingDO.getClearancePriceUnit());
lineClearanceBasePrice.setClearanceVolumeUnit(
lineChannelPackagingDO.getClearanceVolumeUnit());
BigDecimal lineClearanceNum =
this.calculationUnitAsValue(prodParam,
productPriceDO, lineClearanceUnitDO, 0);
//ecw_line_channel_price_step_clearance
//线路渠道清关费阶梯价格
List<LineChannelPriceStepClearanceDO>
packagingStepPriceDOList =
lineChannelPackagingDO.getLineChannelPriceStepClearanceDOList();
//币种
ExchangeRateRespDTO productExchangeRate =
currencyApi.getCurrencyRate(
lineClearanceBasePrice.getClearancePriceUnit(),
1L);
//线路渠道清关费阶梯价格
if (CollectionUtil.isNotEmpty(packagingStepPriceDOList)) {
LineChannelPriceStepClearanceDO priceStepDO = packagingStepPriceDOList.stream().filter(priceStep -> priceStep.getStartNum().compareTo(lineClearanceNum) <= 0 && priceStep.getEndNum().compareTo(lineClearanceNum) >= 0).findFirst().orElse(null);
LineChannelPriceStepClearanceDO priceStepDO =
packagingStepPriceDOList.stream().
filter(priceStep -> priceStep.getStartNum().
compareTo(lineClearanceNum) <= 0
&& priceStep.getEndNum().compareTo(lineClearanceNum) >= 0).findFirst().orElse(null);
if (Objects.nonNull(priceStepDO)) {
BigDecimal productClearancePrice = productExchangeRate.getCurrencyRate().multiply(priceStepDO.getClearancePrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal productClearancePrice =
productExchangeRate.getCurrencyRate().multiply(priceStepDO.getClearancePrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
if (lineClearanceBasePrice.getClearancePrice().compareTo(BigDecimal.ZERO) > 0) {
if (productClearancePrice.compareTo(lineClearanceBasePrice.getProductClearanceAsExchangePrice()) > 0) {
lineClearanceBasePrice.setClearanceStepPriceId(priceStepDO.getId());
......@@ -1256,17 +1419,30 @@ public class ProdCostCalculation {
lineClearanceBasePrice.setProductClearanceAsExchangePrice(productClearancePrice);
}
}
} else {
//线路渠道清关费阶梯价格 为空
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("线路渠道清关费阶梯价格 为空");
zTestMapper.insert(z);
}
}
if (lineClearanceBasePrice != null) {
int result = 0;
if (!clearanceBasePrice.getClearancePriceUnit().equals(lineClearanceBasePrice.getClearancePriceUnit())) {
ExchangeRateRespDTO productExchangeRate = currencyApi.getCurrencyRate(clearanceBasePrice.getClearancePriceUnit(), 1L);
BigDecimal productClearancePrice = productExchangeRate.getCurrencyRate().multiply(clearanceBasePrice.getClearancePrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal lineClearancePrice = lineClearanceBasePrice.getProductClearanceAsExchangePrice();
if (!clearanceBasePrice.getClearancePriceUnit().
equals(lineClearanceBasePrice.getClearancePriceUnit())) {
ExchangeRateRespDTO productExchangeRate =
currencyApi.getCurrencyRate(
clearanceBasePrice.getClearancePriceUnit(), 1L);
BigDecimal productClearancePrice =
productExchangeRate.getCurrencyRate().
multiply(clearanceBasePrice.getClearancePrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal lineClearancePrice =
lineClearanceBasePrice.getProductClearanceAsExchangePrice();
result = productClearancePrice.compareTo(lineClearancePrice);
} else {
result = clearanceBasePrice.getClearancePrice().compareTo(lineClearanceBasePrice.getClearancePrice());
result = clearanceBasePrice.getClearancePrice().
compareTo(lineClearanceBasePrice.getClearancePrice());
}
airClearanceSource = result >= 0 ? 3 : 4;
clearancePrice = result >= 0 ? clearanceBasePrice : lineClearanceBasePrice;
......@@ -1274,34 +1450,39 @@ public class ProdCostCalculation {
clearancePrice = clearanceBasePrice;
}
} else {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("线路渠道包装类型为空");
zTestMapper.insert(z);
clearancePrice = clearanceBasePrice;
}
productPriceDO.setClearancePrice(clearancePrice.getClearancePrice());
productPriceDO.setClearanceStepPriceId(clearancePrice.getClearanceStepPriceId());
productPriceDO.setProductPriceEmptyType(clearancePrice.getProductPriceEmptyType());
productPriceDO.setAirClearanceInfo(clearancePrice.getAirClearanceInfo());// 清关费详情
//设置清关价
//lanbm 2024-06-21 注释此处
productPriceDO.setClearancePrice(
clearancePrice.getClearancePrice());
productPriceDO.setClearanceStepPriceId(
clearancePrice.getClearanceStepPriceId());
productPriceDO.setProductPriceEmptyType(
clearancePrice.getProductPriceEmptyType());
productPriceDO.setAirClearanceInfo(
clearancePrice.getAirClearanceInfo());// 清关费详情
prodParam.setAirClearanceSource(airClearanceSource);// 清关费来源
prodParam.setAirClearanceInfo(productPriceDO.getAirClearanceInfo());// 清关费详情
prodParam.setAirClearanceInfo(
productPriceDO.getAirClearanceInfo());// 清关费详情
} else {
log.info("===== 线路无牌无液无电清关费阶梯价不存在【{} {}】该档次 =====", num, prodParam.getClearanceUnitDO().getFuhao());
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("线路无牌无液无电清关费阶梯价不存在【"
+ num +
prodParam.getClearanceUnitDO().getFuhao() + "】该档次"
);
zTestMapper.insert(z);
productPriceDO.setClearancePrice(BigDecimal.ZERO);
}
}
} else {
BasePrice allBasePrice = productPriceStepService.getProductPriceStep(productPriceDO.getId(), num, 1);
if (Objects.nonNull(allBasePrice)) {
log.info("===== 线路无牌无液无电全包阶梯价:{} =====", JSONObject.toJSONString(allBasePrice));
productPriceDO.setAllPrice(allBasePrice.getAllPrice());
productPriceDO.setAllStepPriceId(allBasePrice.getAllStepPriceId());
} else {
log.info("===== 线路无牌无液无电全包阶梯价不存在【{} {}】该档次 =====", num, prodParam.getUnitDO().getFuhao());
productPriceDO.setNeedPay(null);
productPriceDO.setAllPrice(BigDecimal.ZERO);
}
}
}
}
private void getCustomerCommission(Integer customsType, Long customerId, Long lineId, ProdConditionParam
prodParam) {
......
package cn.iocoder.yudao.framework.toolkit;
package cn.iocoder.yudao.module.product.dal.dataobject.coupon;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@TableName("z_test")
@Data
public class zTest {
public class zTest3 {
private Long id;
private String testname;
......
......@@ -67,6 +67,7 @@ public class BasePrice extends BaseDO {
* 全包价金额单位
*/
private Long allPriceUnit;
/**
* 全包价体积单位
*/
......
package cn.iocoder.yudao.module.product.dal.mysql.coupon;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.product.dal.dataobject.coupon.zTest3;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ZTestMapper3 extends AbstractMapper<zTest3> {
}
......@@ -81,6 +81,7 @@ public class ProdCostDto {
*/
private Long freightVolume;
//返回给前端页面的清关价
@ApiModelProperty(value = "商品清关费单价(成交)")
private BigDecimal oneClearanceFee;
......
......@@ -58,9 +58,15 @@ public class ProductPriceStepServiceImpl extends AbstractService<ProductPriceSte
);
}
//获取阶梯价
@Override
public BasePrice getProductPriceStep(Long productPriceId, BigDecimal num, Integer priceType) {
List<ProductPriceStepDO> list = this.list(new LambdaQueryWrapperX<ProductPriceStepDO>()
public BasePrice getProductPriceStep(Long productPriceId,
BigDecimal num,
Integer priceType) {
//0-运费,1-全包价, 2-清关费
List<ProductPriceStepDO> list = this.list(
new LambdaQueryWrapperX<ProductPriceStepDO>()
.eq(ProductPriceStepDO::getProductPriceId, productPriceId)
.eq(ProductPriceStepDO::getPriceType, priceType)
.eq(ProductPriceStepDO::getDeleted, 0)
......@@ -72,7 +78,10 @@ public class ProductPriceStepServiceImpl extends AbstractService<ProductPriceSte
if (CollectionUtil.isEmpty(list)){
productPriceEmptyType = 1;
}else {
ProductPriceStepDO priceStepDO = list.stream().filter(priceStep -> priceStep.getStartNum().compareTo(num) <= 0 && priceStep.getEndNum().compareTo(num) >= 0).findFirst().orElse(null);
ProductPriceStepDO priceStepDO =
list.stream().filter(priceStep ->
priceStep.getStartNum().compareTo(num) <= 0 &&
priceStep.getEndNum().compareTo(num) >= 0).findFirst().orElse(null);
basePrice = new BasePrice();
if (Objects.isNull(priceStepDO)){
productPriceEmptyType = 2;
......
......@@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.product.controller.admin.prod;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.product.component.ProdCostCalculation;
import cn.iocoder.yudao.module.product.dto.CalculationCostResultDto;
import cn.iocoder.yudao.module.product.param.ConditionParam;
import cn.iocoder.yudao.module.product.param.ProdConditionParam;
import cn.iocoder.yudao.module.product.service.coupon.CouponService;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -44,11 +46,20 @@ public class ProdLinePriceController {
public CommonResult<CalculationCostResultDto> calculationProdCost(
@RequestBody ConditionParam param) {
//lanbm 2024-06-20 记录的参数日志
//String listToString = JSON.toJSONString(param);
//JsonUtils.SaveLog(listToString);
if (CollectionUtil.isEmpty(param.getProdConditionParamList())) {
return error(ORDER_ITEM_PROD_NOT_EXISTS);
}
// 前端实时计价时需要将订单的固定价格参数进行格式化,转为未定价,否则不会去查询当前实时价格
param.setProdConditionParamList(param.getProdConditionParamList().stream().peek(it -> it.setIsPriced(false)).collect(Collectors.toList()));
param.setProdConditionParamList(
param.getProdConditionParamList().stream().
peek(it -> it.setIsPriced(false)).
collect(Collectors.toList()));
//获取价格信息 lanbm 2024-06-20 添加注释
List<ProdConditionParam> prodConditionParams =
prodCostCalculation.obtainProdLineOnePrice(
param.getProdConditionParamList(),
......@@ -59,6 +70,7 @@ public class ProdLinePriceController {
param.getLineId(),
param.getChannelId(),
false);
CalculationCostResultDto dto =
prodCostCalculation.calculationProdCost(prodConditionParams,
"",
......
......@@ -63,7 +63,9 @@ public class ReceivableController {
@GetMapping("/getReceivableListByOrderId")
@ApiOperation("根据订单ID获得应收款列表")
@ApiImplicitParam(name = "id", value = "订单ID", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<List<ReceivableBackVO>> getReceivableListByOrderId(@RequestParam("id") Long id) {
public CommonResult<List<ReceivableBackVO>> getReceivableListByOrderId(
@RequestParam("id") Long id) {
//lanbm 2024-06-20 添加注释
return success(receivableService.getReceivableListByOrderId(id));
}
......
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