Commit 9e373d99 authored by lanbaoming's avatar lanbaoming

2024-05-27-4

parent 7958bb32
package cn.iocoder.yudao.framework.apollo.core.event.Customer;
import lombok.Data;
/*
发货人代码的客户去向处理逻辑
lanbm 2024-05-27 add
*/
@Data
public class CustomerGoEvent {
}
......@@ -2883,12 +2883,16 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
}
@Override
public void updateCustomerByFinishWarehouseIn(Long customerId, Long orderId, String orderNo, Date rucangTime) {
public void updateCustomerByFinishWarehouseIn(Long customerId,
Long orderId,
String orderNo,
Date rucangTime) {
//更新客户状态
CustomerDO customer = customerMapper.selectById(customerId);
if (customer != null) {
Date oldEstimateEnterOpenSeaTime = customer.getEstimateEnterOpenSeaTime();
Date oldEstimateEnterOpenSeaTime =
customer.getEstimateEnterOpenSeaTime();
boolean isFcl = isFcl(customer);
//海运整柜 不掉入公海
......@@ -2941,7 +2945,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
//转成成交客户
if (CustomerStatusEnum.CLUE.getValue().equals(customer.getStatus()) || CustomerStatusEnum.INTENTION.getValue().equals(customer.getStatus())) {
if (CustomerStatusEnum.CLUE.getValue().equals(customer.getStatus()) ||
CustomerStatusEnum.INTENTION.getValue().equals(customer.getStatus())) {
this.updateCustomerStatus(customerId, CustomerStatusEnum.DEAL);
}
}
......
......@@ -42,16 +42,25 @@ public class CalculateOrderVValueListener {
@EventListener(CalculateOrderVValueEvent.class)
public void CalculateOrderVValuePushEvent(
CalculateOrderVValueEvent event) {
zTest m=new zTest();
String sMsg="计算V值";
zTest m = new zTest();
String sMsg = "计算V值";
OrderDO orderDO = orderService.getById(event.getOrderId());
if (orderDO == null) {
throw exception(ORDER_NOT_EXISTS);
}
if (orderDO.getRucangTime() == null) {
sMsg += ",订单入仓时间为空,暂不处理。";
m.setTestname(sMsg);
m.setCreatedate(new Date());
zTestService.save(m);
return;
}
//订单状态为已入仓之后的状态,其他状态是否排除,后续和客户确认,先按此逻辑处理
int nS = orderDO.getStatus();
if (nS >= 5) {
sMsg+=",已入仓";
sMsg += ",已入仓";
//查询配置参数信息
EcwVz temp = null;
BigDecimal CalVvalue = new BigDecimal(0);
......@@ -62,7 +71,12 @@ public class CalculateOrderVValueListener {
if (temp == null) {
throw exception(VCONFIG_NOT_EXISTS);
}
if (orderDO.getSumVolume() == null ||
orderDO.getSumVolume().equals(new BigDecimal(0)) == true) {
CalVvalue = new BigDecimal(0);
} else {
CalVvalue = new BigDecimal(temp.getVz()).divide(orderDO.getSumVolume());
}
} else if (orderDO.getTransportId() == 3) {
//空运计算V值
temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>()
......@@ -70,8 +84,13 @@ public class CalculateOrderVValueListener {
if (temp == null) {
throw exception(VCONFIG_NOT_EXISTS);
}
if (orderDO.getSumWeight() == null ||
orderDO.getSumWeight().equals(new BigDecimal(0)) == true) {
CalVvalue = new BigDecimal(0);
} else {
CalVvalue = new BigDecimal(temp.getVz()).divide(orderDO.getSumWeight());
}
}
//计算业绩产生时间
if (orderDO.getRucangTime() == null) {
......@@ -81,10 +100,8 @@ public class CalculateOrderVValueListener {
}
orderService.UpdateOrderVValue(event.getOrderId(), CalVvalue,
event.getYejiCreateDate());
}
else
{
sMsg+=",未入仓";
} else {
sMsg += ",未入仓";
}
m.setTestname(sMsg);
......
......@@ -55,7 +55,12 @@ public class CalculateOrderYeJiTypeListener {
event.setCustomerId(orderDO.getCustomerId());
CustomerDO customerDO = customerService.getById(event.getCustomerId());
if (customerDO == null) {
throw exception(CUSTOMER_NOT_EXISTS);
//throw exception(CUSTOMER_NOT_EXISTS);
sMsg+=",客户不存在先不计算业绩类型";
m.setTestname(sMsg);
m.setCreatedate(new Date());
zTestService.save(m);
return;
}
int isNew = 0;
......
package cn.iocoder.yudao.module.delivery.listener;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/*
发货人带来的客户的去向处理逻辑
lanbm 2024-05-27 add
*/
@Component("CustomerGoListener")
@AllArgsConstructor
@Slf4j
public class CustomerGoListener {
}
......@@ -185,9 +185,15 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
private final OrderOperateLogService orderOperateLogService;
/*
后台创建订单 memberUserDO 信息为空
lanbm 2024-05-27 添加注释
ecw_admin_client 临时放置创建的收货人,发货人联系人信息
*/
@Override
@Transactional(rollbackFor = Exception.class)
public OrderDO createOrder(OrderCreateReqVO createReqVO, MemberUserDO memberUserDO) {
public OrderDO createOrder(OrderCreateReqVO createReqVO,
MemberUserDO memberUserDO) {
int type = 1;
// 获取功能开关
List<DictDataRespDTO> dictList = dictDataApi.getDictDatas("part_function_switch");
......@@ -331,7 +337,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
this.adminSaveConsignorAndConsignee(createReqVO, order, creator, now, dictDataRespDTO);
} else {
// app-web添加的订单
this.appSaveConsignorAndConsignee(createReqVO, order, creator, now, memberUserDO, dictDataRespDTO);
this.appSaveConsignorAndConsignee(createReqVO, order,
creator, now, memberUserDO, dictDataRespDTO);
}
if (Objects.isNull(createReqVO.getDisplayBillLadingPrice())) {
// 查询订单归属客户的默认档案设置
......@@ -358,7 +365,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (memberUserDO != null && null != createReqVO.getUserId()) {
// app-web添加的订单
AdminClientCreateEvent adminClientCreateEvent = new AdminClientCreateEvent();
AdminClientCreateEvent adminClientCreateEvent =
new AdminClientCreateEvent();
//下单用户
adminClientCreateEvent.setUid(createReqVO.getUserId());
......@@ -427,10 +435,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
return order;
}
private void appSaveConsignorAndConsignee(OrderCreateReqVO createReqVO, OrderDO order, String creator, Date now,
MemberUserDO memberUserDO, DictDataRespDTO dictDataRespDTO) {
/*
处理发货人和收货人信息
*/
private void appSaveConsignorAndConsignee(OrderCreateReqVO createReqVO,
OrderDO order,
String creator,
Date now,
MemberUserDO memberUserDO,
DictDataRespDTO dictDataRespDTO) {
// 根据会员ID获取客户联系人ID与客户ID
CustomerContactsDO customerContacts = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>()
CustomerContactsDO customerContacts =
customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>()
.and(we -> we.eq(CustomerContactsDO::getUserid, memberUserDO.getId())
.or()
.eq(CustomerContactsDO::getPhoneNew, memberUserDO.getMobile())
......@@ -443,7 +459,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
CustomerDO consignorCustomerDO = null;
if (Objects.isNull(customerContacts)) {
// 如果客户联系人为空,则创建新的客户信息,重新查询
customerApi.associateCustomerAuto(memberUserDO.getAreaCode(), memberUserDO.getMobile(), memberUserDO.getId(), memberUserDO.getNickname());
customerApi.associateCustomerAuto(memberUserDO.getAreaCode(),
memberUserDO.getMobile(), memberUserDO.getId(),
memberUserDO.getNickname());
customerContacts = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>()
.and(we -> we.eq(CustomerContactsDO::getUserid, memberUserDO.getId())
.or()
......@@ -451,6 +469,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.eq(CustomerContactsDO::getAreaCode, memberUserDO.getAreaCode())).eq(CustomerContactsDO::getDeleted, 0).last("limit 1"));
}
if (Objects.nonNull(customerContacts)) {
//发货人联系人
consignorCustomerDO = customerService.getCustomer(customerContacts.getCustomerId());
if (consignorCustomerDO != null) {
orderConsignorDO.setCompany(consignorCustomerDO.getCompany());
......@@ -501,7 +520,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
orderConsignorService.save(orderConsignorDO);
if (order.getIsCargoControl()) {
// 控货订单 添加控货人信息
// 控货订单 添加控货人信息 ecw_order_cargo_control
OrderCargoControlDO orderCargoControlDO = new OrderCargoControlDO();
BeanUtils.copyProperties(orderConsignorDO, orderCargoControlDO);
orderCargoControlDO.setId(null); // 置空主键ID
......@@ -563,15 +582,29 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
CustomerContactsDO consignee = customerService.getUniqueOneAndValidate(orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), null);
if (Objects.nonNull(consignee) && Objects.nonNull(consignee.getCustomerId())) {
if (Objects.nonNull(consignee) &&
Objects.nonNull(consignee.getCustomerId())) {
orderConsigneeDO.setCustomerId(consignee.getCustomerId());
orderConsigneeDO.setCustomerContactsId(consignee.getId());
} else {
// 客户不存在,新增客户联系人信息 orderConsigneeDO中有值
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if (consignorCustomerDO == null || consignorCustomerDO.getCustomerService() == null || consignorCustomerDO.getCustomerService() == 0) {
CustomerContactsDO consigeeCustomer = customerService.createConsigeeCustomer(orderConsigneeDO.getName(),
orderConsigneeDO.getCountryCode(), orderConsigneeDO.getPhone(), orderConsigneeDO.getCompany(), orderConsigneeDO.getEmail(), consignorCustomerDO, order.getOrderNo());
// 20230511 收货人无客户档案时 判断发货人有无客户经理,没有 生成客户档案,进入待分配。
// 有客户经理,则暂时不生成客户档案。(放在入仓时处理)
if (consignorCustomerDO == null ||
consignorCustomerDO.getCustomerService() == null ||
consignorCustomerDO.getCustomerService() == 0) {
//ecw_customer_contacts 客户联系人
CustomerContactsDO consigeeCustomer =
customerService.createConsigeeCustomer(
orderConsigneeDO.getName(),
orderConsigneeDO.getCountryCode(),
orderConsigneeDO.getPhone(),
orderConsigneeDO.getCompany(),
orderConsigneeDO.getEmail(),
consignorCustomerDO,
order.getOrderNo());
if (consigeeCustomer != null) {
orderConsigneeDO.setCustomerId(consigeeCustomer.getCustomerId());
orderConsigneeDO.setCustomerContactsId(consigeeCustomer.getId());
......@@ -599,58 +632,62 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
// 补充业绩规则判断
if(!consignorCustomerDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (!consignorCustomerDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
}
if(createReqVO.getOfferId()!=null && order.getDrawee()==1){//订单关联报价单 && 发货人付款
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (createReqVO.getOfferId() != null && order.getDrawee() == 1) {
//订单关联报价单 && 发货人付款
order.setCustomerId(orderConsignorDO.getCustomerId());
}
if(createReqVO.getOfferId()!=null && order.getDrawee()==3 ){//订单关联报价单 && 自定义付款
if (createReqVO.getOfferId() != null && order.getDrawee() == 3) {
//订单关联报价单 && 自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if(CollectionUtil.isNotEmpty(list)){
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;
if (CollectionUtil.isNotEmpty(list)) {
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();
int clearanceFee = clearanceFeeList.get(0).getValue();
if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && freight == 1)) {//订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
}
if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
}
}
}
if(consignorCustomerDO.getDefaultPay() && (order.getDrawee()==2 || order.getDrawee()==3)){//发货人档案设置默认付运费 --层级4
if (consignorCustomerDO.getDefaultPay() && (order.getDrawee() == 2 || order.getDrawee() == 3)) {//发货人档案设置默认付运费 --层级4
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if(CollectionUtil.isNotEmpty(list)){
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;
if (CollectionUtil.isNotEmpty(list)) {
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();
int clearanceFee = clearanceFeeList.get(0).getValue();
if(order.getDrawee()==1 || ( order.getDrawee()==3 && freight==1 ) || ( order.getDrawee()==3 && clearanceFee==1 )){//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (order.getDrawee() == 1 || (order.getDrawee() == 3 && freight == 1) || (order.getDrawee() == 3 && clearanceFee == 1)) {//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
}
}
}
if(order.getDrawee()==2 || order.getDrawee()==3){//如果是收货人付款或是自定义付款 --层级5
if(order.getDrawee()==2){//订单收货人付款,业绩归属收货人
if (order.getDrawee() == 2 || order.getDrawee() == 3) {
//如果是收货人付款或是自定义付款 --层级5
if (order.getDrawee() == 2) {
//订单收货人付款,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
}else if(order.getDrawee()==3){
} else if (order.getDrawee() == 3) {
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if(CollectionUtil.isNotEmpty(list)){
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;
if (CollectionUtil.isNotEmpty(list)) {
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();
int clearanceFee = clearanceFeeList.get(0).getValue();
if((order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
if ((order.getDrawee() == 3 && freight == 2) || (order.getDrawee() == 3 && clearanceFee == 2)) {//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
}
}
......@@ -884,36 +921,36 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
// 补充业绩规则判断
if(!consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
}
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId()) ;
order.setCustomerId(orderConsigneeDO.getCustomerId());
} else if (order.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if(CollectionUtil.isNotEmpty(list)){
if (CollectionUtil.isNotEmpty(list)) {
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;//运费
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();//运费
int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (!consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 2) || (order.getDrawee() == 3 && clearanceFee == 2)) {//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(orderConsigneeDO.getCustomerId());
......@@ -923,13 +960,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
//业绩归属公司
order.setCustomerId(0L) ;
order.setCustomerId(0L);
order.setSalesmanId(0L);
}
//end
// if(createReqVO.getOfferId()!=null && order.getDrawee()==1){//订单关联报价单 && 发货人付款
// order.setCustomerId(orderConsignorDO.getCustomerId()) ;
// }
......@@ -1074,38 +1110,38 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
private void setOrderCustomerServiceCustomerId(OrderCreateReqVO createReqVO,OrderDO order, CustomerDO consignorDO,OrderConsignorDO orderConsignorDO,OrderConsigneeDO orderConsigneeDO){
private void setOrderCustomerServiceCustomerId(OrderCreateReqVO createReqVO, OrderDO order, CustomerDO consignorDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) {
// 补充业绩规则判断
if(!consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
}
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId()) ;
order.setCustomerId(orderConsigneeDO.getCustomerId());
} else if (order.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if(CollectionUtil.isNotEmpty(list)){
if (CollectionUtil.isNotEmpty(list)) {
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;//运费
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();//运费
int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (!consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 2) || (order.getDrawee() == 3 && clearanceFee == 2)) {//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(orderConsigneeDO.getCustomerId());
......@@ -1115,7 +1151,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
//业绩归属公司
order.setCustomerId(0L) ;
order.setCustomerId(0L);
order.setSalesmanId(0L);
}
}
......@@ -1672,7 +1708,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
//end lanbm 2024-04-13 修改,在创建完订单号,计算订单业绩类型
//入仓完成,计算V值 lanbm 2024-05-13 add
CalculateOrderVValueEvent event=new CalculateOrderVValueEvent();
CalculateOrderVValueEvent event = new CalculateOrderVValueEvent();
event.setOrderId(updateObj.getOrderId());
applicationContext.publishEvent(event);
//end 入仓完成,计算V值 lanbm 2024-05-13 add
......@@ -2982,50 +3018,50 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
// 补充业绩规则判断
if(!consignorCustomerDO.getNoConsignee() && !updateObj.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (!consignorCustomerDO.getNoConsignee() && !updateObj.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
}
if(updateReqVO.getOfferId()!=null && updateObj.getDrawee()==1){//订单关联报价单 && 发货人付款
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (updateReqVO.getOfferId() != null && updateObj.getDrawee() == 1) {//订单关联报价单 && 发货人付款
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
}
if(updateReqVO.getOfferId()!=null && updateObj.getDrawee()==3 ){//订单关联报价单 && 自定义付款
if (updateReqVO.getOfferId() != null && updateObj.getDrawee() == 3) {//订单关联报价单 && 自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();
int clearanceFee = clearanceFeeList.get(0).getValue();
if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && freight==1 )){//订单关联报价单 && 自定义付款 且发货人付运费
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (updateReqVO.getOfferId() != null && (updateObj.getDrawee() == 3 && freight == 1)) {//订单关联报价单 && 自定义付款 且发货人付运费
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
}
if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && clearanceFee==1 )){//订单关联报价单 && 自定义付款 且发货人付清关费
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (updateReqVO.getOfferId() != null && (updateObj.getDrawee() == 3 && clearanceFee == 1)) {//订单关联报价单 && 自定义付款 且发货人付清关费
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
}
}
if(consignorCustomerDO.getDefaultPay() ){//发货人档案设置默认付运费 --层级4
if (consignorCustomerDO.getDefaultPay()) {//发货人档案设置默认付运费 --层级4
List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();
int clearanceFee = clearanceFeeList.get(0).getValue();
if(updateObj.getDrawee()==1 || ( updateObj.getDrawee()==3 && freight==1 ) || ( updateObj.getDrawee()==3 && clearanceFee==1 )){//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
if (updateObj.getDrawee() == 1 || (updateObj.getDrawee() == 3 && freight == 1) || (updateObj.getDrawee() == 3 && clearanceFee == 1)) {//如果是发货人付款 或自定义付款且发货人付运费 或自定义付款且发货人付清关费,业绩归属发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
}
}
if(updateObj.getDrawee()==2 || updateObj.getDrawee()==3){//如果是收货人付款或是自定义付款 --层级5
if(updateObj.getDrawee()==2){//订单收货人付款,业绩归属收货人
if (updateObj.getDrawee() == 2 || updateObj.getDrawee() == 3) {//如果是收货人付款或是自定义付款 --层级5
if (updateObj.getDrawee() == 2) {//订单收货人付款,业绩归属收货人
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
}else if(updateObj.getDrawee()==3){
} else if (updateObj.getDrawee() == 3) {
List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();
int clearanceFee = clearanceFeeList.get(0).getValue();
if((updateObj.getDrawee()==3 && freight==2 ) || (updateObj.getDrawee()==3 && clearanceFee==2)){//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
if ((updateObj.getDrawee() == 3 && freight == 2) || (updateObj.getDrawee() == 3 && clearanceFee == 2)) {//自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
}
}
......@@ -3264,36 +3300,37 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (updateObj.getIsCargoControl()) {
// 控货订单归属发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else {if(!consignorDO.getNoConsignee() && !updateObj.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
} else {
if (!consignorDO.getNoConsignee() && !updateObj.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
}
if (updateObj.getDrawee() == 1) {//发货人付款
if (updateObj.getDrawee() == 1 && updateReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(updateObj.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else if (updateObj.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
}
} else if (updateObj.getDrawee() == 2) {//收货人付款 层级5 第一个
updateObj.setCustomerId(orderConsigneeDO.getCustomerId()) ;
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
} else if (updateObj.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(updateObj.getCustomDrawee(), CustomDraweeVO.class);
if(CollectionUtil.isNotEmpty(list)){
if (CollectionUtil.isNotEmpty(list)) {
List<CustomDraweeVO> freightList = list.stream().filter(s-> s.getName().equals("freight") ).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s-> s.getName().equals("clearanceFee") ).collect(Collectors.toList());
int freight = freightList.get(0).getValue() ;//运费
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();//运费
int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(updateReqVO.getOfferId()!=null && ( updateObj.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(consignorDO.getDefaultPay() && ( updateObj.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if (consignorDO.getDefaultPay() && ( updateObj.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId()) ;
}else if(!consignorDO.getDefaultPay() && (updateObj.getDrawee()==3 && freight==2 ) || (updateObj.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
if (updateReqVO.getOfferId() != null && (updateObj.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else if (updateReqVO.getOfferId() != null && (updateObj.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (updateObj.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (updateObj.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
updateObj.setCustomerId(orderConsignorDO.getCustomerId());
} else if (!consignorDO.getDefaultPay() && (updateObj.getDrawee() == 3 && freight == 2) || (updateObj.getDrawee() == 3 && clearanceFee == 2)) {//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
updateObj.setCustomerId(orderConsigneeDO.getCustomerId());
updateObj.setSalesmanId(orderConsigneeDO.getCustomerId());
......@@ -3303,7 +3340,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
//业绩归属公司
updateObj.setCustomerId(0L) ;
updateObj.setCustomerId(0L);
updateObj.setSalesmanId(0L);
}
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
......@@ -6123,7 +6160,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
*/
public void UpdateOrderVValue(Long orderId, BigDecimal calVvalue, Date
yejiCreateDate) {
orderMapper.UpdateOrderVValue(orderId,calVvalue,yejiCreateDate);
orderMapper.UpdateOrderVValue(orderId, calVvalue, yejiCreateDate);
}
}
......@@ -911,7 +911,9 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
List<CustomerDO> list = new ArrayList<>();
list.add(customerService.getCustomer(orderExceptionDO.getCustomerId()));
customerService.assignedCustomer(list, Long.parseLong(vo.getCustomerService()), CustomerOperateTypeEnum.ASSIGN, "处理未分配客户经理异常时分配", null);
customerService.assignedCustomer(list,
Long.parseLong(vo.getCustomerService()),
CustomerOperateTypeEnum.ASSIGN, "处理未分配客户经理异常时分配", null);
} else if (vo.getOrderExceptionHandlerResult().equals(OrderExceptionResult.NOT_CUSTOMER_SERVICE_EXCEPTION_RESULT.NOT)) {
orderExceptionDO.setOrderExceptionStatus(2);
}
......
......@@ -1043,7 +1043,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 判断是否有未处理的审核单
throwProcessingApproval(orderDO);
boolean isSplitOrderChildren = orderQueryService.isSplitOrderChildren(orderDO);
boolean isSplitOrderChildren =
orderQueryService.isSplitOrderChildren(orderDO);
// 没有入仓数据则提示
Long inCount = orderWarehouseInMapper.selectCount(OrderWarehouseInDO::getOrderId, orderId);
......@@ -1056,7 +1057,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
.eq(BaseDO::getDeleted, false));
if (CollectionUtil.isNotEmpty(orderItemDOList)) {
for (OrderItemDO orderItemDO : orderItemDOList) {
this.validateProdAttrAccess(orderItemDO.getProdId(), orderItemDO.getOrderNo());
this.validateProdAttrAccess(orderItemDO.getProdId(),
orderItemDO.getOrderNo());
}
}
......@@ -1102,7 +1104,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// }
// 保存特需
List<OrderSpecialNeedReceivableReqVo> orderSpecialNeedReceivableReqVoList = finishReqVO.getOrderSpecialNeedReceivableReqVoList();
List<OrderSpecialNeedReceivableReqVo> orderSpecialNeedReceivableReqVoList =
finishReqVO.getOrderSpecialNeedReceivableReqVoList();
if (CollectionUtil.isNotEmpty(orderSpecialNeedReceivableReqVoList)) {
List<Long> specialNeedIds = orderSpecialNeedReceivableReqVoList.stream().map(OrderSpecialNeedReceivableReqVo::getId).collect(Collectors.toList());
List<OrderSpecialNeedDO> orderSpecialNeedList = orderSpecialNeedService.getOrderSpecialNeedList(specialNeedIds);
......@@ -1124,7 +1127,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 生成特需应收
orderSpecialNeedService.buildSpecialReceivable(orderId, 1);
List<OrderWarehouseInDO> orderWarehouseInDOList = orderWarehouseInMapper.selectList(OrderWarehouseInDO::getOrderId, orderDO.getOrderId());
List<OrderWarehouseInDO> orderWarehouseInDOList =
orderWarehouseInMapper.selectList(OrderWarehouseInDO::getOrderId, orderDO.getOrderId());
//入仓修改或完成备货,入仓重量、备货重量变化后,按最新入仓或备货重量,重新计算泡重,按最新入仓重量与订单泡货标准重新计算泡重。
// 清空之前申请的固定泡重优惠,之前申请泡货标准还原到初始泡货标准。
......@@ -1132,14 +1136,19 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
List<ChannelPackagingOverWeightAdditionalBo> channelPackagingOverWeightAdditionalBoList = new ArrayList<>();
if (!isSplitOrderChildren && isNotRollbackIn) {
channelPackagingOverWeightAdditionalBoList = genChannelPackagingOverweightAdditionalBoList(orderDO, orderWarehouseInDOList);
channelPackagingOverWeightAdditionalBoList =
genChannelPackagingOverweightAdditionalBoList(orderDO, orderWarehouseInDOList);
}
// 重泡货配置
ZhongPaoBestVO zhongPaoBest = getZhongPaoBest(orderDO);
// 根据订单项产生异常,多箱,少箱,新增商品异常,入仓特性不符异常
processOrderItemException(orderId, orderDO, orderItemDOList, isNotRollbackIn, orderWarehouseInDOList, zhongPaoBest, channelPackagingOverWeightAdditionalBoList);
processOrderItemException(orderId, orderDO,
orderItemDOList,
isNotRollbackIn, orderWarehouseInDOList,
zhongPaoBest,
channelPackagingOverWeightAdditionalBoList);
if (CollectionUtil.isNotEmpty(channelPackagingOverWeightAdditionalBoList)) {
channelPackagingOverWeightAdditionalBoList = channelPackagingOverWeightAdditionalBoList.stream().filter(t -> !t.isMerged()).collect(Collectors.toList());
......@@ -1292,7 +1301,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
}
warehouseInSendSms(orderDO, finishReqVO.getIsAppend(), appendInTime);
}else {
} else {
exceptionContent = orderUnProcessExceptionList.stream().map(ex -> OrderExceptionEnum.getEnumByKey(ex.getOrderExceptionType()).getZhValueDesc()).collect(Collectors.joining(StrUtil.COMMA));
}
// 发送站内信
......@@ -1310,12 +1319,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
OrderConsigneeDO orderConsigneeDO2 = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId())
.orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
if(orderConsignorDO2 != null && orderConsignorDO2.getCustomerId() != null &&
orderConsigneeDO2 != null && orderConsigneeDO2.getCustomerId() != null){
if (orderConsignorDO2 != null && orderConsignorDO2.getCustomerId() != null &&
orderConsigneeDO2 != null && orderConsigneeDO2.getCustomerId() != null) {
//获取发货人客户经理
CustomerDO consignorCustomer = customerService.getById(orderConsignorDO2.getCustomerId()) ;
CustomerDO consignorCustomer = customerService.getById(orderConsignorDO2.getCustomerId());
//获取收货人客户经理
CustomerDO consigneeCustomer = customerService.getById(orderConsigneeDO2.getCustomerId()) ;
CustomerDO consigneeCustomer = customerService.getById(orderConsigneeDO2.getCustomerId());
//订单的发货人、收货人同属一个客户经理,则两个客户经理都延期,
// 否则只延期订单中业绩归属方客户
if (consignorCustomer != null && consigneeCustomer != null &&
......@@ -1349,7 +1358,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
//入仓完成,计算V值 lanbm 2024-05-13 add
CalculateOrderVValueEvent event=new CalculateOrderVValueEvent();
CalculateOrderVValueEvent event = new CalculateOrderVValueEvent();
event.setOrderId(orderId);
applicationContext.publishEvent(event);
//end 入仓完成,计算V值 lanbm 2024-05-13 add
......@@ -2155,7 +2164,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
} else {
// 入仓短信 发送给发货人与收货人
String templateCode = SmsSceneEnum.WAREHOUSE_IN.getTemplateCode();
if (orderDO.getTransportId() == 3){
if (orderDO.getTransportId() == 3) {
templateCode = SmsSceneEnum.AIR_WAREHOUSE_IN.getTemplateCode();
}
log.info("warehouseInSendSms入仓短信 orderNo={}", orderDO.getOrderNo());
......@@ -2196,9 +2205,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// cargoControlParamMap.put("collectofgoods", orderDO.getCollectionProxy() + currencyName);
// templateCode = SmsSceneEnum.WAREHOUSE_IN_CONTROL_COLLECT_OF_GOODS.getTemplateCode();
// } else {
if (orderDO.getTransportId() == 3){
if (orderDO.getTransportId() == 3) {
templateCode = SmsSceneEnum.AIR_WAREHOUSE_IN_CONTROL.getTemplateCode();
}else {
} else {
templateCode = SmsSceneEnum.WAREHOUSE_IN_CONTROL.getTemplateCode();
}
// }
......@@ -2249,9 +2258,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
consignorParamMap.put("collectofgoods", orderDO.getCollectionProxy() + currencyName);
consigneeParamMap.put("collectofgoods", orderDO.getCollectionProxy() + currencyName);
// 入仓通知
if (orderDO.getTransportId() == 3){
if (orderDO.getTransportId() == 3) {
templateCode = SmsSceneEnum.AIR_WAREHOUSE_IN_COLLECT_OF_GOODS.getTemplateCode();
}else {
} else {
templateCode = SmsSceneEnum.WAREHOUSE_IN_COLLECT_OF_GOODS.getTemplateCode();
}
......@@ -2356,14 +2365,14 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (user != null && StringUtils.isNotEmpty(user.getNickname())) {
String title = "";
String content = "";
if (orderDO.getTransportId() == 3){
if (StringUtils.isNotBlank(exceptionContent)){
if (orderDO.getTransportId() == 3) {
if (StringUtils.isNotBlank(exceptionContent)) {
// 空运有异常入仓
title = String.format(I18nMessage.getMessage("app.message.air.exception.warehousein.title"), orderDO.getOrderNo());
// 订单号:%s(唛头:%s)已入仓,存在异常:%s 请联系售前客服协助处理。如有疑问请于工作时间内(9:00--18:00)与我司客服联系:400-900-9962
content = String.format(I18nMessage.getMessage("app.message.air.exception.warehousein.content"),
orderDO.getOrderNo(), orderDO.getMarks(), exceptionContent);
}else {
} else {
// 空运无异常入仓
title = String.format(I18nMessage.getMessage("app.message.air.warehousein.title"), orderDO.getOrderNo());
// 尊敬的 %s(先生/女士),捷道货运通知您:您的唛头为%s,%s箱, %sCBM, %sKg, 入仓号为%s的货物已于%s 送到%s(起运港仓库),如有疑问请于工作时间内(9:00--18:00)与我司客服联系:400-900-9962
......@@ -2372,7 +2381,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderDO.getSumWeight().toPlainString(), orderDO.getOrderNo(), DateUtil.format(ruchang, "yyyy年MM月dd日"),
startWarehouseName);
}
}else {
} else {
title = String.format(I18nMessage.getMessage("app.message.warehousein.title"), orderDO.getOrderNo());
content = String.format(I18nMessage.getMessage("app.message.warehousein.content"),
user.getNickname(), orderDO.getMarks(), orderDO.getSumNum(), orderDO.getSumVolume().toPlainString(),
......@@ -3348,7 +3357,6 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderBusinessService.addOrderTimeLog(orderDO.getStatus(), orderDO, 8);
orderDO = orderQueryService.getOrderById(orderId);
//更新订单统计数据
List<OrderWarehouseInDO> orderWarehouseInDOList = orderWarehouseInMapper.selectList(OrderWarehouseInDO::getOrderId, orderDO.getOrderId());
......
......@@ -151,7 +151,7 @@ public class OrderController {
}
}
//lanbm 2024-05-13 添加注释
//lanbm 2024-05-13 添加注释 member_user 注册会员用户
Long orderId = orderService.createOrder(createReqVO, null).getOrderId();
return success(orderId);
}
......
......@@ -107,7 +107,8 @@ public class OrderExceptionController {
@ApiOperation("根据订单ID获取所有的订单异常列表")
@ApiImplicitParam(name = "orderId", value = "订单ID", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<List<OrderExceptionBackVO>> getOrderExceptionListByOrderId(@RequestParam("orderId") Long orderId) {
List<OrderExceptionBackVO> list = orderExceptionService.getOrderExceptionListByOrderId(orderId);
List<OrderExceptionBackVO> list =
orderExceptionService.getOrderExceptionListByOrderId(orderId);
return success(list);
}
......
......@@ -69,7 +69,8 @@ public class OrderWarehouseInController {
/**
* 订单完成入仓操作的放重复提交缓存key
*/
private static final String ORDER_FINISH_WAREHOUSE_IN_KEY = "jiedao:order:finish:warehouse:in:{0}";
private static final String ORDER_FINISH_WAREHOUSE_IN_KEY =
"jiedao:order:finish:warehouse:in:{0}";
@PostMapping("/create")
......
......@@ -137,13 +137,16 @@ public class MyOrderController {
Long userId = loginUser.getId();
createReqVO.setUserId(userId);
MemberUserDO memberUserDO = memberUserService.info(userId);
if (Objects.isNull(memberUserDO) || memberUserDO.getStatus() == 1 || memberUserDO.getDeleted()) {
if (Objects.isNull(memberUserDO) ||
memberUserDO.getStatus() == 1 ||
memberUserDO.getDeleted()) {
return error(MEMBER_NOT_EXISTS);
}
if (null == createReqVO.getStatus()) {
createReqVO.setStatus(2);
}
if (StringUtils.isNotBlank(createReqVO.getType()) && createReqVO.getType().contains("4")) {
if (StringUtils.isNotBlank(createReqVO.getType()) &&
createReqVO.getType().contains("4")) {
// TODO 客户端下单处理未知的类型
String type = Arrays.stream(createReqVO.getType().split(StrUtil.COMMA)).filter(s -> !StringUtils.equals("4", s)).filter(StringUtils::isNotBlank).collect(Collectors.joining(StrUtil.COMMA));
createReqVO.setType(type);
......
......@@ -2224,7 +2224,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Long deptId = SecurityFrameworkUtils.getLoginUser().getDeptId();
DeptWarehouseBaseVO deptWarehouseBaseVO = new DeptWarehouseBaseVO();
deptWarehouseBaseVO.setDeptId(deptId);
List<DeptWarehouseDO> deptWarehouseDOS = warehouseService.deptList(deptWarehouseBaseVO);
List<DeptWarehouseDO> deptWarehouseDOS =
warehouseService.deptList(deptWarehouseBaseVO);
if (CollectionUtil.isEmpty(deptWarehouseDOS)) {
throw exception(DEPT_NOT_FOUND);
......@@ -2319,11 +2320,11 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
return boxInfoQuery1(result, searchDcDate);
}
private PageResult<BoxBackVO> boxInfoQuery1(PageResult<BoxBackVO> result, boolean searchDcDate) {
private PageResult<BoxBackVO> boxInfoQuery1(PageResult<BoxBackVO> result,
boolean searchDcDate) {
List<BoxBackVO> boxBackList = result.getList();
if (CollectionUtil.isNotEmpty(boxBackList)) {
List<Long> idList = boxBackList.stream()
.map(BoxBaseBackVO::getId)
.collect(Collectors.toList());
......@@ -2361,12 +2362,14 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.collect(Collectors.toList());
Map<Long, ChannelDO> channelMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(channelIdList)) {
List<ChannelDO> channelDOList = channelService.getChannelList(channelIdList);
List<ChannelDO> channelDOList =
channelService.getChannelList(channelIdList);
channelMap = channelDOList.stream()
.collect(Collectors.toMap(ChannelDO::getChannelId, v -> v));
}
List<BoxApprovalDO> approvalDOList = boxApprovalService.getBackApprovalList(idList);
List<BoxApprovalDO> approvalDOList =
boxApprovalService.getBackApprovalList(idList);
Map<Long, List<BoxApprovalDO>> shipmentApprovalMap = approvalDOList.stream()
.collect(Collectors.groupingBy(BoxApprovalDO::getShipmentId));
......@@ -2411,7 +2414,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
}
List<BoxApprovalDO> itemApprovalList = shipmentApprovalMap.get(shipmentId);
List<BoxApprovalDO> itemApprovalList =
shipmentApprovalMap.get(shipmentId);
if (CollectionUtils.isNotEmpty(itemApprovalList)) {
BoxApprovalDO boxApprovalDO = itemApprovalList.get(0);
//查询反审信息
......@@ -2507,7 +2511,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.likeIfPresent(BoxDO::getSelfNo,
query.getSelfNo())
//已出仓 222
.eq(BoxDO::getCheckoutStatus, AirCheckoutStatusEnum.CHECKOUT.getStatus())
.eq(BoxDO::getCheckoutStatus,
AirCheckoutStatusEnum.CHECKOUT.getStatus())
.and(
i -> i.and(t ->
t.eq(BoxDO::getDcCustomsStatus, 3)
......@@ -2544,7 +2549,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
);
boxBackVO.setOrderNum(orderNum);
long orderExitNum = boxOrderExitService.count(new LambdaQueryWrapper<BoxOrderExitDO>()
long orderExitNum = boxOrderExitService.count(
new LambdaQueryWrapper<BoxOrderExitDO>()
.eq(BoxOrderExitDO::getShipmentId, shipmentId)
);
boxBackVO.setOrderExitNum(orderExitNum);
......
......@@ -75,6 +75,8 @@ public class MyBoxController {
@PostMapping("/exitPageAir")
@ApiOperation("获得退场出货分页, use this")
public CommonResult<PageResult<BoxBackVO>> getBoxExitPageAir(@Valid @RequestBody MyBoxExitQueryVO query) {
//空运退场到仓列表 lanbm 2024-05-27 添加注释
//此出有个仓库权限的限制,管来没有权限,数据符合逻辑也是显示不出来信息的
PageResult<BoxBackVO> pageResult = boxService.getBoxExitPageAir(query);
return success(pageResult);
}
......
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