Commit 77a62cdf authored by 332784038@qq.com's avatar 332784038@qq.com

入仓订单修改审批业务对控货订单发货人设置控货无收货人属性变动的业务修改

parent e9406f71
......@@ -1815,33 +1815,57 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
CustomerContactsDO consignorContactsDO = customerContactsService.getCustomerContacts(updateReqVO.getConsignorContactsId());
OrderConsignorBackVO orderConsignorBackVO = vo.getConsignorVO();
CustomerDO consignorDO = null;
boolean noConsignee = false;
if (Objects.nonNull(consignorContactsDO)) {
consignorDO = customerService.getById(updateReqVO.getConsignorId());
consignorDO = customerService.getById(consignorContactsDO.getCustomerId());
if (Objects.nonNull(consignorDO)) {
noConsignee = consignorDO.getNoConsignee();
if (vo.getIsCargoControl() && vo.getHasConsignee() != noConsignee) {
ApplyInfoVO infoVO = new ApplyInfoVO();
infoVO.setName("控货订单发货人控货无收货人");
infoVO.setOrgValue(vo.getHasConsignee()? "是" : "否");
infoVO.setNewValue(noConsignee ? "是" : "否");
vo.setHasConsignee(noConsignee);
applyInfoList.add(infoVO);
// 发货人控货无收货人属性设置变动,需要变动客户业绩
vo.setIsCharge(true);
}
}
this.compareConsignorInfo(updateReqVO, consignorContactsDO, orderConsignorBackVO, applyInfoList, vo);
}
vo.setConsignorVO(orderConsignorBackVO);
// 比较收货人信息
CustomerContactsDO consigneeContactsDO = customerContactsService.getCustomerContacts(updateReqVO.getConsigneeContactsId());
OrderConsigneeBackVO orderConsigneeBackVO = vo.getConsigneeVO();
CustomerDO consigneeDO = customerService.getById(updateReqVO.getConsignorId());
if (Objects.isNull(consigneeContactsDO)) {
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
CustomerDO consigneeDO = customerService.getById(updateReqVO.getConsigneeId());
if (vo.getIsCargoControl() && !noConsignee) {
if (Objects.isNull(consigneeContactsDO)) {
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
// consigneeDO = customerService.getById(updateReqVO.getConsignorId());
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if (consigneeDO == null || consigneeDO.getCustomerService() == null || consigneeDO.getCustomerService() == 0) {
consigneeContactsDO = customerService.createConsigeeCustomer(
orderConsigneeBackVO.getName(),
orderConsigneeBackVO.getCountryCode(),
orderConsigneeBackVO.getPhone(),
orderConsigneeBackVO.getCompany(),
orderConsigneeBackVO.getEmail(),
consigneeDO, vo.getOrderNo());
}
}
if (Objects.nonNull(consigneeContactsDO)) {
this.compareConsigneeInfo(updateReqVO, consigneeContactsDO, orderConsigneeBackVO, applyInfoList, vo, dictDataRespDTO);
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if (consigneeDO == null || consigneeDO.getCustomerService() == null || consigneeDO.getCustomerService() == 0) {
consigneeContactsDO = customerService.createConsigeeCustomer(
orderConsigneeBackVO.getName(),
orderConsigneeBackVO.getCountryCode(),
orderConsigneeBackVO.getPhone(),
orderConsigneeBackVO.getCompany(),
orderConsigneeBackVO.getEmail(),
consigneeDO, vo.getOrderNo());
}
}
if (Objects.nonNull(consigneeContactsDO)) {
this.compareConsigneeInfo(updateReqVO, consigneeContactsDO, orderConsigneeBackVO, applyInfoList, vo, dictDataRespDTO);
}
}else {
// 控货订单发货人设置为控货无收货人,这里需要处理掉订单的收货人信息
if (Objects.nonNull(orderConsigneeBackVO)){
ApplyInfoVO infoVO = new ApplyInfoVO();
infoVO.setName("控货订单发货人设置为控货无收货人,清除订单收货人信息/Set the shipper of the controlled goods order to no consignee, and clear the consignee information of the order");
applyInfoList.add(infoVO);
vo.setIsChargeNoConsignee(true);
}
}
if (vo.getIsCharge() || orderConsignorBackVO.getIsCharge() ||
orderConsigneeBackVO.getIsCharge()) {
......@@ -2618,7 +2642,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
infoVO.setNewValue(updateReqVO.getIsCargoControl() ? "是/yes" : "否/no");
vo.setIsCargoControl(updateReqVO.getIsCargoControl());
applyInfoList.add(infoVO);
// vo.setIsCharge(true);
}
Map<Integer, CurrencyRespDTO> currencyMap = currencyApi.getAllCurrency();
CurrencyRespDTO orgCurrencyRespDTO = currencyMap.get(vo.getCollectionProxyCurrency());
......@@ -5398,7 +5421,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsignorDO consignorDO = OrderConsignorConvert.INSTANCE.convert(consignorVO);
orderConsignorService.updateById(consignorDO);
OrderConsigneeDO consigneeDO = OrderConsigneeConvert.INSTANCE.convert(consigneeVO);
orderConsigneeService.updateById(consigneeDO);
// 控货订单发货人无收货人属性变动,需要清空订单收货人信息
if (orderBackVO.getIsChargeNoConsignee()){
orderConsigneeService.removeById(consigneeDO.getId());
}else {
orderConsigneeService.updateById(consigneeDO);
}
// 始发地目的地更新
OrderDepartureDO departureDO = OrderDepartureConvert.INSTANCE.convert(orderBackVO.getOrderDepartureVO());
orderDepartureService.updateById(departureDO);
......@@ -5605,6 +5633,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (isConsigneeChange && consigneeVO.getCustomerId() != null) {
customerService.updateCustomerStatusByExistedOrderAndOffer(consigneeVO.getCustomerId(), true);
}
} catch (Exception e) {
log.error("更新收发货人状态时出现异常", e);
}
......
......@@ -558,9 +558,14 @@ public class OrderBackVO {
@ApiModelProperty(value = "是否变动业绩归属")
private Boolean isCharge = false;
@ApiModelProperty(value = "是否变动控货状态")
private Boolean isChargeCargoControl = false;
@ApiModelProperty(value = "是否变动付款人信息")
private Boolean isDrawee = false;
@ApiModelProperty(value = "是否变动发货人设置订单控货无收货人属性")
private Boolean isChargeNoConsignee = false;
@ApiModelProperty(value = "是否需要产生未分配客户经理异常异常")
private Boolean isCreateCustomerServiceException = 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