Commit c9447d36 authored by 332784038@qq.com's avatar 332784038@qq.com

当订单从无收货人改为有收货人时需要冗余创建时间与创建人,以便新增订单收货人信息

parent bb93aac5
......@@ -2079,6 +2079,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeBackVO = new OrderConsigneeBackVO();
// 会走这里,说明订单从无收货人改为有收货人
orderConsigneeBackVO.setIsCharge(true);
orderConsigneeBackVO.setCreateTime(now);
orderConsigneeBackVO.setCreator(updater);
}
orderConsigneeBackVO.setCustomerNumber(consigneeDO.getNumber());
}
......@@ -5861,7 +5863,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
//
boolean isConsignorChange = orderConsignorDO != null && !Objects.equals(consignorVO.getCustomerId(), orderConsignorDO.getCustomerId());
boolean isConsigneeChange = orderConsigneeDO != null && Objects.nonNull(consigneeVO) && !Objects.equals(consigneeVO.getCustomerId(), orderConsigneeDO.getCustomerId());
boolean isConsigneeChange = (orderBackVO.getIsChargeNoConsignee() && orderConsigneeDO != null) || (orderConsigneeDO == null && Objects.nonNull(consigneeVO)) || (orderConsigneeDO != null && Objects.nonNull(consigneeVO) && !Objects.equals(consigneeVO.getCustomerId(), orderConsigneeDO.getCustomerId()));
// 收发货人信息变更
OrderConsignorDO consignorDO = OrderConsignorConvert.INSTANCE.convert(consignorVO);
......@@ -5873,12 +5875,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 控货订单发货人无收货人属性变动,需要清空订单收货人信息
Boolean isLimitUpdateConsignee = Boolean.FALSE;
if (orderBackVO.getIsChargeNoConsignee()) {
if (Objects.nonNull(consigneeDO)) {
orderConsigneeService.removeById(consigneeDO.getId());
if (Objects.nonNull(orderConsigneeDO)) {
orderConsigneeService.removeById(orderConsigneeDO.getId());
}
} else {
if (Objects.nonNull(consigneeDO)) {
// 这里可能是由无收货人修改为有收货人,主键id为null
if (Objects.isNull(consigneeDO.getId())){
consigneeDO.setUpdateTime(consigneeVO.getCreateTime());
consigneeDO.setUpdater(consigneeVO.getCreator());
}
orderConsigneeService.saveOrUpdate(consigneeDO);
if (orderBackVO.getIsCargoControl()) {
// 控货订单有收货人则限制修改收货人
......
package cn.iocoder.yudao.module.order.vo.orderConsignee;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
......@@ -104,6 +106,12 @@ public class OrderConsigneeBackVO {
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
/**
* 创建者,目前使用 SysUser 的 id 编号
*
* 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。
*/
private String creator;
@ApiModelProperty(value = "是否变动业绩归属")
private Boolean isCharge = false;
......
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