Commit eaf0b25b authored by lanbaoming's avatar lanbaoming

2024-06-22提交

parent 370dc895
......@@ -93,17 +93,23 @@ public class LineChannelPackagingServiceImpl extends AbstractService<LineChannel
}
@Override
public List<LineChannelPackagingDO> queryAirClearancePrice(List<String> packages, Long channelId, Long lineId) {
public List<LineChannelPackagingDO> queryAirClearancePrice(
List<String> packages,
Long channelId,
Long lineId) {
List<LineChannelPackagingDO> list = new ArrayList<>();
if (CollectionUtil.isNotEmpty(packages)) {
for (String packageType : packages) {
List<LineChannelPackagingDO> packagingDOList = lineChannelPackagingMapper.queryAirClearancePrice(packageType, channelId, lineId);
List<LineChannelPackagingDO> packagingDOList =
lineChannelPackagingMapper.queryAirClearancePrice(packageType,
channelId, lineId);
if (CollectionUtil.isNotEmpty(packagingDOList)){
list.addAll(packagingDOList);
}
}
} else {
list = lineChannelPackagingMapper.queryAirClearancePrice(null, channelId, lineId);
list = lineChannelPackagingMapper.queryAirClearancePrice(null,
channelId, lineId);
}
return list;
}
......
......@@ -613,13 +613,16 @@ public class OrderQueryServiceImpl implements OrderQueryService {
initialLogisticsInfoDto.setLineId(dto.getLineId());
initialLogisticsInfoDto.setTransportId(dto.getTransportId());
initialLogisticsInfoDto.setChannelId(dto.getChannelId());
// 保存初始物流信息,该信息为收费信息
//保存初始物流信息,该信息为收费信息
dto.setInitialLogisticsInfoDto(initialLogisticsInfoDto);
LogisticsInfoDto logisticsInfoDto = new LogisticsInfoDto();
BeanUtils.copyProperties(initialLogisticsInfoDto, logisticsInfoDto);
if (Objects.nonNull(dto.getAdjustToDestWarehouseId()) && dto.getAdjustToDestWarehouseId() > 0L) {
if (Objects.nonNull(dto.getAdjustToDestWarehouseId()) &&
dto.getAdjustToDestWarehouseId() > 0L) {
// 如果有始发仓调仓记录id,则获取最新的调仓仓库信息
WarehouseRegionVO startWarehouseRegionVO = warehouseMapper.findWarehouseRegion(dto.getAdjustToDestWarehouseId());
WarehouseRegionVO startWarehouseRegionVO =
warehouseMapper.findWarehouseRegion(dto.getAdjustToDestWarehouseId());
if (Objects.nonNull(startWarehouseRegionVO)) {
logisticsInfoDto.setStartWarehouseId(dto.getAdjustToDestWarehouseId());
logisticsInfoDto.setStartCityId(startWarehouseRegionVO.getShi());
......@@ -632,7 +635,8 @@ public class OrderQueryServiceImpl implements OrderQueryService {
logisticsInfoDto.setStartVolume(startWarehouseRegionVO.getVolume());
}
}
if (Objects.nonNull(dto.getDestAdjustToDestWarehouseId()) && dto.getDestAdjustToDestWarehouseId() > 0L) {
if (Objects.nonNull(dto.getDestAdjustToDestWarehouseId()) &&
dto.getDestAdjustToDestWarehouseId() > 0L) {
// 如果有目的地的目的仓调仓记录id,则获取最新的调仓仓库信息
WarehouseRegionVO destWarehouseRegionVO = warehouseMapper.findWarehouseRegion(dto.getDestAdjustToDestWarehouseId());
if (Objects.nonNull(destWarehouseRegionVO)) {
......
......@@ -4894,7 +4894,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
@Override
public List<OrderWarehouseInWithAttrVO> getOrderWarehouseInCommonAttrList(Long orderId, Long excludeOrderWarehouseInId) {
public List<OrderWarehouseInWithAttrVO> getOrderWarehouseInCommonAttrList(
Long orderId, Long excludeOrderWarehouseInId) {
// 根据订单id获取入库详情
OrderDO orderDO = orderService.getById(orderId);
......@@ -4902,13 +4903,19 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_NOT_EXISTS);
}
List<OrderItemDO> orderItemDOList = orderItemService.list(new LambdaQueryWrapper<OrderItemDO>()
//订单明细
List<OrderItemDO> orderItemDOList =
orderItemService.list(new LambdaQueryWrapper<OrderItemDO>()
.eq(OrderItemDO::getOrderId, orderId).orderByAsc(OrderItemDO::getOrderItemId));
List<OrderWarehouseInDO> orderWarehouseInDOList = orderWarehouseInMapper.selectList(new LambdaQueryWrapper<OrderWarehouseInDO>()
//ecw_order_warehouse_in 入仓货物详情表
List<OrderWarehouseInDO> orderWarehouseInDOList =
orderWarehouseInMapper.selectList(
new LambdaQueryWrapper<OrderWarehouseInDO>()
.eq(OrderWarehouseInDO::getOrderId, orderId).orderByAsc(OrderWarehouseInDO::getId));
if (excludeOrderWarehouseInId != null) {
orderWarehouseInDOList = orderWarehouseInDOList.stream().filter(t -> !t.getId().equals(excludeOrderWarehouseInId)).collect(Collectors.toList());
orderWarehouseInDOList =
orderWarehouseInDOList.stream().filter(t -> !t.getId().equals(excludeOrderWarehouseInId)).collect(Collectors.toList());
}
List<OrderWarehouseInWithAttrVO> resultList = new ArrayList<>();
......
......@@ -762,6 +762,10 @@ public class ProdCostCalculation {
BigDecimal transportPrice = BigDecimal.ZERO;// 初始化商品单价运费
BigDecimal clearancePrice = BigDecimal.ZERO;// 初始化商品单价清关费
//是否拆单自定义价格 getIsPriced
//是否特价 getSpecialPriceType
//是否为渠道/单询手动定价 getChannelManualPricing
//是否已定价 getIsPriced
if ((Objects.isNull(prodParam.getIsPriced()) || !prodParam.getIsPriced())
&& !prodParam.getSplitCustomPriceType() &&
!prodParam.getSpecialPriceType() &&
......@@ -779,7 +783,7 @@ public class ProdCostCalculation {
//专线空运
zTest3 z = new zTest3();
z.setCreatedate(new Date());
String s = "开始计算空运清关价 airStepSelect,lineId=" + lineId +
String s = "1开始计算空运清关价 airStepSelect,lineId=" + lineId +
" 渠道channelId=" + channelId;
z.setTestname(s);
zTestMapper.insert(z);
......@@ -787,6 +791,13 @@ public class ProdCostCalculation {
this.airStepSelect(unitDOMap, prodParam,
productPriceDO, lineId, channelId);
}
} else {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
String s = "不是阶梯价 airStepSelect,lineId=" + lineId +
" 渠道channelId=" + channelId;
z.setTestname(s);
zTestMapper.insert(z);
}
prodParam.setIsPayAdvance(productPriceDO.getNeedPay());
......@@ -982,6 +993,13 @@ public class ProdCostCalculation {
}
} else {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
String s = "产品线路价格为空";
z.setTestname(s);
zTestMapper.insert(z);
if (!prodParam.getSpecialPriceType()) {
prodParam.setOneFreight(transportPrice);
prodParam.setOneClearanceFee(clearancePrice);
......@@ -1010,6 +1028,12 @@ public class ProdCostCalculation {
prodParam.setPlainCommission(BigDecimal.ZERO);
prodParam.setHiddenCommission(BigDecimal.ZERO);
}
} else {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
String s = "不符合定价条件";
z.setTestname(s);
zTestMapper.insert(z);
}
}
......@@ -1175,8 +1199,11 @@ public class ProdCostCalculation {
* @param type 类型:0 空运清关费入仓值为准 1 空运运费收费值为准 2 海运计算
* @return 计量值
*/
private BigDecimal calculationUnitAsValue(ProdConditionParam prodParam, ProductPriceDO productPriceDO, UnitDO
unitDO, Integer type) {
private BigDecimal calculationUnitAsValue(ProdConditionParam prodParam,
ProductPriceDO productPriceDO,
UnitDO unitDO,
Integer type) {
BigDecimal num;
if (StringUtils.equals("m³", unitDO.getFuhao())) {
// 体积
......@@ -1258,16 +1285,28 @@ public class ProdCostCalculation {
} else {
productPriceDO.setAllPrice(BigDecimal.ZERO);
}
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("2运费计量单位 为空");
zTestMapper.insert(z);
return;
}
//计量单位符号
BigDecimal num = this.calculationUnitAsValue(prodParam,
productPriceDO,
prodParam.getUnitDO(),
1);
//lanbm 2024-06-21 添加的逻辑
if (productPriceDO.getPriceType() == null) return;
if (productPriceDO.getPriceType() == null) {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("3价格类型 为空");
zTestMapper.insert(z);
return;
}
//全包价
if (productPriceDO.getPriceType() == 1) {
......@@ -1285,6 +1324,10 @@ public class ProdCostCalculation {
productPriceDO.setNeedPay(null);
productPriceDO.setAllPrice(BigDecimal.ZERO);
}
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("4价格类型 为全包价,无需计算清关费");
zTestMapper.insert(z);
return;
}
......@@ -1294,27 +1337,38 @@ public class ProdCostCalculation {
productPriceStepService.getProductPriceStep(
productPriceDO.getId(), num, 0);
if (Objects.nonNull(transportBasePrice)) {
log.info("===== 线路无牌无液无电运费阶梯价:{} =====",
log.info("线路无牌无液无电运费阶梯价:{} =====",
JSONObject.toJSONString(transportBasePrice));
productPriceDO.setTransportPrice(transportBasePrice.getTransportPrice());
productPriceDO.setTransportStepPriceId(transportBasePrice.getTransportStepPriceId());
productPriceDO.setTransportPrice(
transportBasePrice.getTransportPrice());
productPriceDO.setTransportStepPriceId(
transportBasePrice.getTransportStepPriceId());
} else {
log.info("===== 线路无牌无液无电运费阶梯价不存在【{} {}】该档次 =====",
num, prodParam.getUnitDO().getFuhao());
productPriceDO.setNeedPay(null);
productPriceDO.setTransportPrice(BigDecimal.ZERO);
String s = "5线路无牌无液无电运费阶梯价不存在【" + num +
prodParam.getUnitDO().getFuhao() + "】该档次";
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname(s);
zTestMapper.insert(z);
}
if (prodParam.getClearanceUnitDO() == null) {
//清关费单位为空,设置清关费为0
productPriceDO.setClearancePrice(BigDecimal.ZERO);
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("6清关费单位为空");
zTestMapper.insert(z);
return;
}
// 清关费以实际入仓值来匹配
// 2024-1-17 空运清关费改为和空运运费一样使用订单总收费值来匹配
//BigDecimal clearanceNum = this.calculationUnitAsValue(prodParam, productPriceDO, prodParam.getClearanceUnitDO(), 0);
//清关价计量单位
BigDecimal clearanceNum = num;
//获取阶梯价
BasePrice clearanceBasePrice =
......@@ -1326,7 +1380,7 @@ public class ProdCostCalculation {
clearanceBasePrice.setClearanceVolumeUnit(
productPriceDO.getClearanceVolumeUnit());
log.info("===== 线路无牌无液无电清关费阶梯价:{} =====",
log.info("线路无牌无液无电清关费阶梯价:{}",
JSONObject.toJSONString(clearanceBasePrice));
int airClearanceSource = 3;
......@@ -1338,14 +1392,31 @@ public class ProdCostCalculation {
&& 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());
z.setTestname("7产品包装类型list为:" +
prodParam.getPackages().toString());
zTestMapper.insert(z);
} else {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
String s = "8产品包装类型List为空";
if (prodParam.getPackaging() == null) {
s += ",包装类型也为空";
} else {
s += ",包装类型" + prodParam.getPackaging();
}
z.setTestname(s);
zTestMapper.insert(z);
}
//TODO 获取线路设置的空运清关费
//PACKAGING_TYPE 包装要求 数据字典中的数据
// 1箱,2编织袋,3木架,4木箱,5托,6航空箱,7桶,8压缩包,9铁架
//线路渠道清关费包装类型表 ecw_line_channel_packaging
//ecw_line_channel_price_step_clearance 清关费阶梯价
List<LineChannelPackagingDO> lineChannelPackagingDOList =
lineChannelPackagingService.queryAirClearancePrice(
CollectionUtil.isNotEmpty(prodParam.getPackages()) ?
......@@ -1380,6 +1451,13 @@ public class ProdCostCalculation {
BigDecimal lineClearanceNum =
this.calculationUnitAsValue(prodParam,
productPriceDO, lineClearanceUnitDO, 0);
if (lineClearanceNum != null) {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("99lineClearanceNum=" + lineClearanceNum);
zTestMapper.insert(z);
}
//ecw_line_channel_price_step_clearance
//线路渠道清关费阶梯价格
List<LineChannelPriceStepClearanceDO>
......@@ -1398,24 +1476,40 @@ public class ProdCostCalculation {
packagingStepPriceDOList.stream().
filter(priceStep -> priceStep.getStartNum().
compareTo(lineClearanceNum) <= 0
&& priceStep.getEndNum().compareTo(lineClearanceNum) >= 0).findFirst().orElse(null);
&& 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);
if (lineClearanceBasePrice.getClearancePrice().compareTo(BigDecimal.ZERO) > 0) {
if (productClearancePrice.compareTo(lineClearanceBasePrice.getProductClearanceAsExchangePrice()) > 0) {
lineClearanceBasePrice.setClearanceStepPriceId(priceStepDO.getId());
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());
lineClearanceBasePrice.setAirClearanceSource(4);
lineClearanceBasePrice.setClearancePrice(priceStepDO.getClearancePrice());
lineClearanceBasePrice.setAirClearanceInfo(JSONObject.toJSONString(priceStepDO));
lineClearanceBasePrice.setClearancePrice(
priceStepDO.getClearancePrice());
lineClearanceBasePrice.setAirClearanceInfo(
JSONObject.toJSONString(priceStepDO));
}
} else {
BeanUtils.copyProperties(priceStepDO, lineClearanceBasePrice);
lineClearanceBasePrice.setClearanceStepPriceId(priceStepDO.getId());
lineClearanceBasePrice.setClearanceStepPriceId(
priceStepDO.getId());
lineClearanceBasePrice.setAirClearanceSource(4);
lineClearanceBasePrice.setClearancePrice(priceStepDO.getClearancePrice());
lineClearanceBasePrice.setAirClearanceInfo(JSONObject.toJSONString(priceStepDO));
lineClearanceBasePrice.setClearancePrice(
priceStepDO.getClearancePrice());
lineClearanceBasePrice.setAirClearanceInfo(
JSONObject.toJSONString(priceStepDO));
lineClearanceBasePrice.setProductClearanceAsExchangePrice(productClearancePrice);
}
}
......@@ -1423,20 +1517,28 @@ public class ProdCostCalculation {
//线路渠道清关费阶梯价格 为空
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("线路渠道清关费阶梯价格 为空");
z.setTestname("9线路渠道清关费阶梯价格 为空lineId="
+ lineId + "channelId=" + channelId + "lineClearanceNum=" +
lineClearanceNum);
zTestMapper.insert(z);
}
}
if (lineClearanceBasePrice != null) {
/*
int result = 0;
if (!clearanceBasePrice.getClearancePriceUnit().
equals(lineClearanceBasePrice.getClearancePriceUnit())) {
ExchangeRateRespDTO productExchangeRate =
currencyApi.getCurrencyRate(
clearanceBasePrice.getClearancePriceUnit(), 1L);
clearanceBasePrice.getClearancePriceUnit(),
1L);
BigDecimal productClearancePrice =
productExchangeRate.getCurrencyRate().
multiply(clearanceBasePrice.getClearancePrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
multiply(clearanceBasePrice.getClearancePrice()).
setScale(2,
BigDecimal.ROUND_HALF_UP);
BigDecimal lineClearancePrice =
lineClearanceBasePrice.getProductClearanceAsExchangePrice();
result = productClearancePrice.compareTo(lineClearancePrice);
......@@ -1445,19 +1547,33 @@ public class ProdCostCalculation {
compareTo(lineClearanceBasePrice.getClearancePrice());
}
airClearanceSource = result >= 0 ? 3 : 4;
clearancePrice = result >= 0 ? clearanceBasePrice : lineClearanceBasePrice;
clearancePrice = result >= 0 ? clearanceBasePrice :
lineClearanceBasePrice;
*/
clearancePrice=lineClearanceBasePrice;
} else {
clearancePrice = clearanceBasePrice;
}
} else {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("线路渠道包装类型为空");
z.setTestname("10线路渠道包装类型为空lineId="
+ lineId + "channelId=" + channelId);
zTestMapper.insert(z);
//产品阶梯价的清关价
clearancePrice = clearanceBasePrice;
}
//设置清关价
//lanbm 2024-06-21 注释此处
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("计算出的清关价为:" +
clearancePrice.getClearancePrice());
zTestMapper.insert(z);
productPriceDO.setClearancePrice(
clearancePrice.getClearancePrice());
......@@ -1466,15 +1582,16 @@ public class ProdCostCalculation {
productPriceDO.setProductPriceEmptyType(
clearancePrice.getProductPriceEmptyType());
productPriceDO.setAirClearanceInfo(
clearancePrice.getAirClearanceInfo());// 清关费详情
clearancePrice.getAirClearanceInfo()); // 清关费详情
prodParam.setAirClearanceSource(airClearanceSource);// 清关费来源
prodParam.setAirClearanceInfo(
productPriceDO.getAirClearanceInfo());// 清关费详情
productPriceDO.getAirClearanceInfo()); // 清关费详情
} else {
zTest3 z = new zTest3();
z.setCreatedate(new Date());
z.setTestname("线路无牌无液无电清关费阶梯价不存在【"
z.setTestname("线路无牌无液无电清关费阶梯价不存在,不符合逻辑条件【"
+ num +
prodParam.getClearanceUnitDO().getFuhao() + "】该档次"
);
......
......@@ -64,7 +64,6 @@ public class ProductPriceStepServiceImpl extends AbstractService<ProductPriceSte
BigDecimal num,
Integer priceType) {
//0-运费,1-全包价, 2-清关费
List<ProductPriceStepDO> list = this.list(
new LambdaQueryWrapperX<ProductPriceStepDO>()
.eq(ProductPriceStepDO::getProductPriceId, productPriceId)
......
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