Commit 95fb8931 authored by 332784038@qq.com's avatar 332784038@qq.com

Merge branch 'master-fix' into release

parents cd0abf69 f3b81e39
-- 增加订单产品项最后单价变更时间
alter table ecw_order_item
add COLUMN `last_charge_price_time` datetime DEFAULT NULL COMMENT '最后单价变更时间';
-- 批量更新订单产品项的最后单价变更时间
update ecw_order_item set `last_charge_price_time` = update_time where last_charge_price_time is null;
\ No newline at end of file
package cn.iocoder.yudao.framework.apollo.core.event.box;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 重置订单的提单 Event
*
* @author zhengYi
*/
@Data
@AllArgsConstructor
public class BoxCheckOrderRemoveLadingBillEvent {
/**
* 订单ID
*/
private Long orderId;
}
...@@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -447,6 +448,9 @@ public class OrderItemDO extends BaseDO { ...@@ -447,6 +448,9 @@ public class OrderItemDO extends BaseDO {
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性") @ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType; private Integer checkBrandType;
@ApiModelProperty(value = "最后单价变更时间")
private Date lastChargePriceTime;
/** /**
* 到仓信息json * 到仓信息json
*/ */
......
...@@ -3723,8 +3723,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3723,8 +3723,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
for (OrderItemDO orderItemDO : orderItemDOList) { for (OrderItemDO orderItemDO : orderItemDOList) {
for (ProdCostDto prodCostDto : resultDto.getProdCostDtoList()) { for (ProdCostDto prodCostDto : resultDto.getProdCostDtoList()) {
if (Objects.equals(prodCostDto.getItemId(), orderItemDO.getOrderItemId())) { if (Objects.equals(prodCostDto.getItemId(), orderItemDO.getOrderItemId())) {
boolean isChargePrice = false;
orderItemDO.setOriginalSeaFreight(prodCostDto.getOrgFreightPrice()); orderItemDO.setOriginalSeaFreight(prodCostDto.getOrgFreightPrice());
if ((Objects.isNull(prodCostDto.getOneFreight()) && Objects.nonNull(orderItemDO.getOneSeaFreight())) ||
(Objects.nonNull(prodCostDto.getOneFreight()) && Objects.isNull(orderItemDO.getOneSeaFreight())) ||
(Objects.nonNull(prodCostDto.getOneFreight()) && Objects.nonNull(orderItemDO.getOneSeaFreight()) && orderItemDO.getOneSeaFreight().compareTo(prodCostDto.getOneFreight()) != 0)){
isChargePrice = true;
}
orderItemDO.setOneSeaFreight(prodCostDto.getOneFreight()); orderItemDO.setOneSeaFreight(prodCostDto.getOneFreight());
orderItemDO.setDiscountFreightPrice(prodCostDto.getDiscountFreightPrice()); orderItemDO.setDiscountFreightPrice(prodCostDto.getDiscountFreightPrice());
orderItemDO.setDiscountFreightTotalPrice(prodCostDto.getDiscountFreightTotalPrice()); orderItemDO.setDiscountFreightTotalPrice(prodCostDto.getDiscountFreightTotalPrice());
...@@ -3771,6 +3776,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3771,6 +3776,11 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemDO.setMinMeteringWeight(prodCostDto.getMinMeteringWeight()); orderItemDO.setMinMeteringWeight(prodCostDto.getMinMeteringWeight());
orderItemDO.setOriginalClearanceFreight(prodCostDto.getOrgClearanceFeePrice()); orderItemDO.setOriginalClearanceFreight(prodCostDto.getOrgClearanceFeePrice());
if ((Objects.isNull(prodCostDto.getOneClearanceFee()) && Objects.nonNull(orderItemDO.getOneClearanceFreight())) ||
(Objects.nonNull(prodCostDto.getOneClearanceFee()) && Objects.isNull(orderItemDO.getOneClearanceFreight())) ||
(Objects.nonNull(prodCostDto.getOneClearanceFee()) && Objects.nonNull(orderItemDO.getOneClearanceFreight()) && orderItemDO.getOneClearanceFreight().compareTo(prodCostDto.getOneClearanceFee()) != 0)){
isChargePrice = true;
}
orderItemDO.setOneClearanceFreight(prodCostDto.getOneClearanceFee()); orderItemDO.setOneClearanceFreight(prodCostDto.getOneClearanceFee());
orderItemDO.setDiscountClearanceFeePrice(prodCostDto.getDiscountClearanceFeePrice()); orderItemDO.setDiscountClearanceFeePrice(prodCostDto.getDiscountClearanceFeePrice());
orderItemDO.setDiscountClearanceFeeTotalPrice(prodCostDto.getDiscountClearanceFeeTotalPrice()); orderItemDO.setDiscountClearanceFeeTotalPrice(prodCostDto.getDiscountClearanceFeeTotalPrice());
...@@ -3807,6 +3817,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3807,6 +3817,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
orderItemDO.setCharging(prodCostDto.getCharging()); orderItemDO.setCharging(prodCostDto.getCharging());
orderItemDO.setIsPayAdvance(prodCostDto.getIsPayAdvance()); orderItemDO.setIsPayAdvance(prodCostDto.getIsPayAdvance());
if (isChargePrice){
orderItemDO.setLastChargePriceTime(new Date());
}
} }
} }
if (Objects.isNull(orderItemDO.getItemStatus()) || if (Objects.isNull(orderItemDO.getItemStatus()) ||
......
...@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiType ...@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiType
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent; import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderAssociationOfferInfoEvent; import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderAssociationOfferInfoEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderApprovalEvent; import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderApprovalEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderRemoveLadingBillEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderDynamicEstTimeEvent; import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderDynamicEstTimeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeChannelEvent; import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeChannelEvent;
import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeTransportEvent; import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeTransportEvent;
...@@ -6015,6 +6016,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6015,6 +6016,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderDO.setContainerNumber(null); orderDO.setContainerNumber(null);
orderDO.setTidanNo(null); orderDO.setTidanNo(null);
orderMapper.updateById(orderDO); orderMapper.updateById(orderDO);
// TODO 这里修改完订单后需要对订单当前待处理的相关异常进行判断,是否需要重置
// TODO 注意:重泡货异常如果需要重置,需要调用计价接口,重新计算价格(这里计算的价格是应收总额价格)
// 处理控货信息 // 处理控货信息
handleOrderCargoControl(consignorDO, orderDO); handleOrderCargoControl(consignorDO, orderDO);
// 重新计价 // 重新计价
...@@ -6120,11 +6123,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6120,11 +6123,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (isDisassociation) { if (isDisassociation) {
orderGuanlianService.deleteRelationByOrderId(orderDO.getOrderId()); orderGuanlianService.deleteRelationByOrderId(orderDO.getOrderId());
} }
// TODO 当运输方式出现变更时需要重置入仓业务 // 当运输方式出现变更时需要重置入仓业务
if (orderBackVO.getIsTransport()) { if (orderBackVO.getIsTransport()) {
applicationContext.publishEvent( applicationContext.publishEvent(
new WarehouseInOrderChangeTransportEvent(orderDO.getOrderId())); new WarehouseInOrderChangeTransportEvent(orderDO.getOrderId()));
} }
// 订单信息修改后需要重置提单信息
applicationContext.publishEvent(new BoxCheckOrderRemoveLadingBillEvent(orderDO.getOrderId()));
} }
......
...@@ -470,6 +470,9 @@ public class OrderItemBackVO { ...@@ -470,6 +470,9 @@ public class OrderItemBackVO {
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性") @ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType; private Integer checkBrandType;
@ApiModelProperty(value = "最后单价变更时间")
private Date lastChargePriceTime;
/** /**
* 到仓信息json * 到仓信息json
*/ */
......
package cn.iocoder.yudao.module.shipment.listener;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderRemoveLadingBillEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderSchedulingEvent;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.service.box.BoxService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.util.Collections;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.WAREHOUSE_IN_BOX_EXCEPTION;
/**
* 当订单修改审批通过后,需要对已制作的提单进行重置
*
* @author zhengYi
*/
@Component("BoxOrderUpdateRemoveLadingBillListener")
@AllArgsConstructor
@Slf4j
public class BoxOrderUpdateRemoveLadingBillListener {
private final BoxService boxService;
/**
* 当订单修改审批通过后,需要对已制作的提单进行重置
*
* @param event 订单id
*/
@EventListener(BoxCheckOrderRemoveLadingBillEvent.class)
public void removeLadingBill(BoxCheckOrderRemoveLadingBillEvent event) {
Long orderId = event.getOrderId();
log.info("重置提单订单 orderId={}", orderId);
boxService.removeLadingBill(Collections.singleton(orderId));
}
}
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