Commit 0d5f9725 authored by 332784038@qq.com's avatar 332784038@qq.com

订单有无收货人的选择由前端选择确定

parent 26c696cf
......@@ -523,7 +523,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.eq(CustomerContactsDO::getPhoneNew, memberUserDO.getMobile())
.eq(CustomerContactsDO::getAreaCode, memberUserDO.getAreaCode())).eq(CustomerContactsDO::getDeleted, 0).last("limit 1"));
}
boolean noConsignee = false;
boolean hasConsignee = Objects.nonNull(createReqVO.getHasConsignee()) ? createReqVO.getHasConsignee() : true;
if (Objects.nonNull(customerContacts)) {
//发货人联系人
consignorCustomerDO = customerService.getCustomer(customerContacts.getCustomerId());
......@@ -535,7 +535,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (consignorCountryDO != null) {
orderConsignorDO.setCountryAbbreviation(consignorCountryDO.getNameShort());
}
noConsignee = Objects.nonNull(consignorCustomerDO.getNoConsignee()) && consignorCustomerDO.getNoConsignee();
}
if (StringUtils.isBlank(customerContacts.getPhoneNew())) {
throw exception(CONSIGNOR_PHONE_NOT_NULL);
......@@ -593,7 +592,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
OrderConsigneeDO orderConsigneeDO = null;
// 当订单为控货订单,且发货人客户档案未设置控货无收货人,则需要校验收货人信息
if (!order.getIsCargoControl() || !noConsignee) {
if (!order.getIsCargoControl() || hasConsignee) {
// 控货订单有收货人则限制修改收货人
if (order.getIsCargoControl()) {
order.setIsLimitUpdateConsignee(Boolean.TRUE);
......@@ -710,7 +709,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO.setUpdater(creator);
CustomerDO consignorDO =
customerService.getCustomer(createReqVO.getConsignorId());
boolean noConsignee = false;
boolean hasConsignee = Objects.nonNull(createReqVO.getHasConsignee()) ? createReqVO.getHasConsignee() : true;
if (Objects.nonNull(consignorDO)) {
orderConsignorDO.setCompany(consignorDO.getCompany());
orderConsignorDO.setCompanyEn(consignorDO.getCompanyEn());
......@@ -718,7 +717,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.nonNull(consignorCountryDO)) {
orderConsignorDO.setCountryAbbreviation(consignorCountryDO.getNameShort());
}
noConsignee = consignorDO.getNoConsignee();
orderConsignorDO.setCustomerNumber(consignorDO.getNumber());
}
CustomerContactsDO consignorContactsDO =
......@@ -814,7 +812,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderBusinessService.createOrderControlLog(orderCargoControlDO.getOrderId(), 1, "创建控货信息", msg, 0L);
}
OrderConsigneeDO orderConsigneeDO = null;
if (!order.getIsCargoControl() || !noConsignee) {
if (!order.getIsCargoControl() || hasConsignee) {
// 控货订单有收货人则限制修改收货人
if (order.getIsCargoControl()) {
order.setIsLimitUpdateConsignee(Boolean.TRUE);
......@@ -1858,7 +1856,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (vo.getShipmentState() == 0 || vo.getShipmentState() == 305 || vo.getShipmentState() == 307) {
if (vo.getTransportId() == TransportTypeShortEnum.SEA_CONTAINER.getValue()) {
throw exception(ORDER_PRE_INSTALLATION_UNPACKAGED_CONTAINER_NOT_UPDATE);
}else {
} else {
// TODO 当前不是海运就是空运
throw exception(ORDER_SORTING_NOT_SHIPMENT_NOT_UPDATE);
}
......@@ -1879,29 +1877,29 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(NOT_UPDATE_DEST_COUNTRY);
}
// 海外仓业务变动申请
if (!vo.getType().contains("2") && updateReqVO.getType().contains("2")){
if (!vo.getType().contains("2") && updateReqVO.getType().contains("2")) {
// TODO 订单如果转海外仓需要单独申请, 订单如果是海外仓改为非海外仓呢?
throw exception(ORDER_OVERSEAS_WAREHOUSE_UPDATE_NEED_APPLY);
}
// 当是否控货从是修改成否,需校验订单是否有放货记录状态≠已取消,有则弹出提示“订单已放货,无法修改为不控货”
if (vo.getIsCargoControl() && !updateReqVO.getIsCargoControl()){
if (vo.getIsCargoControl() && !updateReqVO.getIsCargoControl()) {
// TODO 校验订单是否有放货记录
long pickCount = orderCargoControlPickMapper.selectCount(new LambdaQueryWrapper<OrderCargoControlPickDO>()
long pickCount = orderCargoControlPickMapper.selectCount(new LambdaQueryWrapper<OrderCargoControlPickDO>()
.eq(OrderCargoControlPickDO::getOrderId, updateReqVO.getOrderId())
.in(OrderCargoControlPickDO::getStatus, 1,2,3,4,5,6));
if(pickCount > 0){
// 订单存在放货记录,不能取消控货
throw exception(ORDER_EXISTS_PICK_NOT_CANCEL_CARGO_CONTROL);
}
.in(OrderCargoControlPickDO::getStatus, 1, 2, 3, 4, 5, 6));
if (pickCount > 0) {
// 订单存在放货记录,不能取消控货
throw exception(ORDER_EXISTS_PICK_NOT_CANCEL_CARGO_CONTROL);
}
}
// 当是否控货从否修改成是,校验订单是否有提货记录,有则弹出提示“订单已有提货记录,无法修改成控货”
if (!vo.getIsCargoControl() && updateReqVO.getIsCargoControl()){
if (!vo.getIsCargoControl() && updateReqVO.getIsCargoControl()) {
// TODO 校验订单是否有提货记录
long pickupCount = orderPickupMapper.selectCount(new LambdaQueryWrapper<OrderPickupDO>()
.eq(OrderPickupDO::getOrderId, vo.getOrderNo()));
if(pickupCount > 0){
if (pickupCount > 0) {
// 订单存在提货记录,不能进行控货
throw exception(ORDER_EXISTS_PICKUP_NOT_CARGO_CONTROL);
throw exception(ORDER_EXISTS_PICKUP_NOT_CARGO_CONTROL);
}
}
// 执行订单审批申请业务
......@@ -1918,8 +1916,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
*/
private void orderAuditApplyUpdate(OrderUpdateReqVO updateReqVO, OrderBackVO vo, LogisticsInfoDto logisticsInfoDto,
DictDataRespDTO dictDataRespDTO, boolean isShipment) {
String statusName = "";
if (isShipment){
String statusName = "";
if (isShipment) {
if (!Objects.equals(vo.getTransportId(), TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue()) && !Objects.equals(vo.getTransportId(), TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue())) {
statusName = OrderStatusEnum.valueOf(vo.getStatus()).getNameZh();
} else {
......@@ -1987,17 +1985,17 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
CustomerContactsDO consignorContactsDO = customerContactsService.getCustomerContacts(updateReqVO.getConsignorContactsId());
OrderConsignorBackVO orderConsignorBackVO = vo.getConsignorVO();
CustomerDO consignorDO = null;
boolean noConsignee = false;
boolean hasConsignee = Objects.nonNull(updateReqVO.getHasConsignee()) ? updateReqVO.getHasConsignee() : true;
if (Objects.nonNull(consignorContactsDO)) {
consignorDO = customerService.getById(consignorContactsDO.getCustomerId());
if (Objects.nonNull(consignorDO)) {
noConsignee = consignorDO.getNoConsignee();
if (vo.getIsCargoControl() && vo.getHasConsignee() != noConsignee) {
// TODO 非控货订单是否必须有收货人
if (vo.getIsCargoControl() && vo.getHasConsignee() != hasConsignee) {
ApplyInfoVO infoVO = new ApplyInfoVO();
infoVO.setName("控货订单发货人控货无收货人");
infoVO.setOrgValue(vo.getHasConsignee() ? "有" : "无");
infoVO.setNewValue(noConsignee ? "无" : "有");
vo.setHasConsignee(noConsignee);
infoVO.setNewValue(hasConsignee ? "有" : "无");
vo.setHasConsignee(hasConsignee);
applyInfoList.add(infoVO);
// 发货人控货无收货人属性设置变动,需要变动客户业绩
vo.setIsCharge(true);
......@@ -2014,7 +2012,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.nonNull(consigneeDO)) {
orderConsigneeBackVO.setCustomerNumber(consigneeDO.getNumber());
}
if (vo.getIsCargoControl() && !noConsignee) {
if (vo.getIsCargoControl() && hasConsignee) {
if (Objects.isNull(consigneeContactsDO)) {
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
// consigneeDO = customerService.getById(updateReqVO.getConsignorId());
......@@ -2125,7 +2123,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(ORDER_UPDATE_APPROVAL_MUST_BE_WAREHOUSE_IN);
}
}
if (isShipment){
if (isShipment) {
// TODO 出货阶段的修改,需要将当前订单状态值标出,放首位
ApplyInfoVO applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName(statusName);
......@@ -3100,7 +3098,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.eq(CustomerContactsDO::getAreaCode, memberUserDO.getAreaCode())).eq(CustomerContactsDO::getDeleted, 0).last("limit 1"));
}
CustomerDO consignorCustomerDO = null;
boolean noConsignee = false;
boolean hasConsignee = Objects.nonNull(updateReqVO.getHasConsignee()) ? updateReqVO.getHasConsignee() : true;
if (Objects.nonNull(customerContacts)) {
consignorCustomerDO = customerService.getCustomer(customerContacts.getCustomerId());
if (consignorCustomerDO != null) {
......@@ -3111,7 +3109,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (consignorCountryDO != null) {
orderConsignorDO.setCountryAbbreviation(consignorCountryDO.getNameShort());
}
noConsignee = consignorCustomerDO.getNoConsignee();
}
if (StringUtils.isBlank(customerContacts.getPhoneNew())) {
throw exception(CONSIGNOR_PHONE_NOT_NULL);
......@@ -3188,7 +3185,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, updateObj.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
if (!updateObj.getIsCargoControl() || !noConsignee) {
if (!updateObj.getIsCargoControl() || hasConsignee) {
// 控货订单有收货人则限制修改收货人
if (updateObj.getIsCargoControl()) {
updateObj.setIsLimitUpdateConsignee(Boolean.TRUE);
......@@ -3310,14 +3307,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.isNull(orderConsignorDO)) {
orderConsignorDO = new OrderConsignorDO();
}
boolean noConsignee = false;
boolean hasConsignee = Objects.nonNull(updateReqVO.getHasConsignee()) ? updateReqVO.getHasConsignee() : true;
if (Objects.nonNull(consignorDO)) {
orderConsignorDO.setCompany(consignorDO.getCompany());
orderConsignorDO.setCompanyEn(consignorDO.getCompanyEn());
orderConsignorDO.setCustomerNumber(consignorDO.getNumber());
CountryDO consignorCountryDO = countryService.getById(consignorDO.getCountry());
orderConsignorDO.setCountryAbbreviation(Objects.isNull(consignorCountryDO) ? null : consignorCountryDO.getNameShort());
noConsignee = consignorDO.getNoConsignee();
}
if (Objects.nonNull(consignorContactsDO)) {
......@@ -3423,7 +3419,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, updateObj.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
if (!updateObj.getIsCargoControl() || !noConsignee) {
if (!updateObj.getIsCargoControl() || hasConsignee) {
// 控货订单有收货人则限制修改收货人
if (updateObj.getIsCargoControl()) {
updateObj.setIsLimitUpdateConsignee(Boolean.TRUE);
......@@ -6419,7 +6415,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
consigneeDO.setUpdateTime(now);
orderConsigneeService.save(consigneeDO);
newOrder.setHasConsignee(true);
}else {
} else {
newOrder.setHasConsignee(false);
}
if (newOrder.getIsCargoControl()) {
......
......@@ -386,6 +386,9 @@ public class OrderBaseVO {
@ApiModelProperty(value = "放货箱数")
private Integer releaseNum;
@ApiModelProperty(value = "是否有收货人,1-是,0-否")
private Boolean hasConsignee = true;
public void setExceptionReason(String exceptionReason) {
this.exceptionReason = StringUtils.isNotBlank(exceptionReason) ? I18nMessage.getMessage(exceptionReason) : exceptionReason;
}
......
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