Commit 96e27c3b authored by lanbaoming's avatar lanbaoming

2024-06-04

parent c03e4afa
......@@ -112,6 +112,9 @@ public class CustomerUpdateReqVO extends CustomerBaseVO {
private String remarks;
/*
lanbm 2024-06-03 处理开启到仓确认,就报发货人异常的BUG
*/
@ApiModelProperty(value = "到仓确认")
private Integer arrivalConfirm;
......
......@@ -204,9 +204,13 @@ public class CustomerController {
@ApiOperation("更新客户")
@PreAuthorize("@ss.hasAnyPermissions('ecw:customer:update', 'ecw:customer:dep-update', 'ecw:customer:my-update', 'ecw:customer:distribution-update')")
@Idempotent(timeout = 5)
public CommonResult<Boolean> updateCustomer(@Valid @RequestBody CustomerUpdateReqVO updateReqVO) {
public CommonResult<Boolean> updateCustomer(
@Valid @RequestBody CustomerUpdateReqVO updateReqVO) {
List<CustomerContactsUpdateReqVO> customerContacts = updateReqVO.getCustomerContacts();
//SELECT arrival_confirm from ecw_customer 到仓确认
List<CustomerContactsUpdateReqVO> customerContacts =
updateReqVO.getCustomerContacts();
if (!CollectionUtils.isEmpty(customerContacts)) {
long count = customerContacts.stream().filter(t -> CustomerContactsDefaultEnum.IS_DEFAULT.getValue().equals(t.getIsDefault())).count();
if (count <= 0) {
......
......@@ -64,6 +64,8 @@ public class EcwVzController {
private final String HYPG = "海运拼柜";
private final String ZXKY = "专线空运";
/**
* 新增数据
*
......
......@@ -166,4 +166,16 @@ public class WarehouseDO extends BaseDO implements Serializable {
@TableField(exist = false)
private String tempTitleZh;
/*
仓库免租期,单位为天数
*/
private int rentFreeDays;
/*
锁定收货人天数
*/
private int lockRecipientDays;
}
......@@ -81,4 +81,17 @@ public class WarehouseBaseVO {
@ApiModelProperty(value = "会员控货下单要求")
private String kycStatus;
/*
仓库免租期,单位为天数
*/
@ApiModelProperty(value = "仓库免租期")
private int rentFreeDays;
/*
锁定收货人天数
*/
@ApiModelProperty(value = "锁定收货人天数")
private int lockRecipientDays;
}
......@@ -2,12 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.depository.dal.mysql.warehouse.WarehouseLineMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
<resultMap id="warehouseLineEntity" type="cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseLineDO">
<!-- <result property="id" column="id" />-->
......
......@@ -2,6 +2,10 @@ package cn.iocoder.yudao.module.order.enums;
import lombok.Getter;
/*
订单异常枚举类型
lanbm 2024-06-03 添加注释
*/
@Getter
public enum OrderExceptionEnum {
ORDER_NO_QUOTE_EXCEPTION("order_no_quote_exception", "未报价异常", "no quote"),
......@@ -34,6 +38,7 @@ public enum OrderExceptionEnum {
GOODS_OVERWEIGHT_EXCEPTION("overweight_exception", "商品重量超限异常", "overweight exception"),
CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION("channel_packaging_overweight_exception", "渠道包装重量超限异常", "channel packaging overweight exception"),
//不可出渠道异常,lanbm 2024-06-03 处理异常添加注释
NOT_SHIPPING_CHANNEL_EXCEPTION("not_shipping_channel_exception", "不可出渠道异常", "not shipping channel exception"),
GOODS_WEIGHT_EXCEPTION("goods_weight_exception", "货物重量异常", "goods weight exception"),
......
......@@ -217,7 +217,8 @@ public class OrderAirServiceImpl extends AbstractService<OrderMapper, OrderDO> i
@Override
public void inspectWarehouseInOrderChannelNoCan(QueryChannelInfoEvent event) {
// 获取已入仓的渠道相关空运订单
List<OrderDO> orderDOList = orderService.selectList(new LambdaQueryWrapper<OrderDO>()
List<OrderDO> orderDOList = orderService.selectList(
new LambdaQueryWrapper<OrderDO>()
.eq(OrderDO::getStatus, OrderStatusEnum.IN_WAREHOUSE.getValue())
.eq(OrderDO::getTransportId, TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue())
.eq(OrderDO::getChannelId, event.getChannelId()));
......@@ -226,7 +227,10 @@ public class OrderAirServiceImpl extends AbstractService<OrderMapper, OrderDO> i
// 检查订单的不可出特性渠道异常情况,如果有则判断是否自动处理,如果没有则判断是否生成
// 更新完订单所有计价信息后,对未报价的订单项去生成未报价异常(待确认商品不予生成未报价异常)
// 只对非拆单子订单进行校验
if (Objects.isNull(orderDO.getParentOrderId()) || orderDO.getParentOrderId() == 0 || orderDO.getSplitSeparateOrder()) {
if (Objects.isNull(orderDO.getParentOrderId()) ||
orderDO.getParentOrderId() == 0 ||
orderDO.getSplitSeparateOrder()) {
orderBusinessService.addOrderOperateLog(orderDO.getOrderId(), "订单操作", "渠道特性修改自动检查订单不可出渠道特性", "");
List<OrderItemDO> orderItemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderDO.getOrderId()));
// 查询待处理的不可出渠道异常
......
......@@ -221,13 +221,25 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
@Override
public void createNoCanShipmentChannelException(OrderDO orderDO, QueryChannelInfoEvent event, OrderItemDO orderItemDO,
WarehouseInInfoVO warehouseInInfoVO, Integer type, List<OrderExceptionDO> orderExceptionDOList) {
// 入仓订单才判断是否产生不可出渠道异常 bug-view-4783 时间2023-09-24 , type为null时,是单独检查订单的不可出特效信息,订单状态必定是5已入仓
if (Objects.nonNull(warehouseInInfoVO) && warehouseInInfoVO.getCartonsNum() > 0 && (orderDO.getStatus() == 5 || type == 15)
&& Objects.nonNull(orderDO.getChannelId()) && orderDO.getChannelId() > 0
&& (Objects.isNull(orderDO.getHandlerChannelAttrException()) || !orderDO.getHandlerChannelAttrException()
|| Objects.isNull(orderItemDO.getHandlerChannelAttrException()) || !orderItemDO.getHandlerChannelAttrException())) {
public void createNoCanShipmentChannelException(OrderDO orderDO,
QueryChannelInfoEvent event,
OrderItemDO orderItemDO,
WarehouseInInfoVO warehouseInInfoVO,
Integer type,
List<OrderExceptionDO> orderExceptionDOList) {
// 入仓订单才判断是否产生不可出渠道异常 bug-view-4783 时间2023-09-24 ,
// type为null时,是单独检查订单的不可出特效信息,订单状态必定是5已入仓
if (Objects.nonNull(warehouseInInfoVO) &&
warehouseInInfoVO.getCartonsNum() > 0
&& (orderDO.getStatus() == 5 || type == 15)
&& Objects.nonNull(orderDO.getChannelId())
&& orderDO.getChannelId() > 0
&& (Objects.isNull(orderDO.getHandlerChannelAttrException())
|| !orderDO.getHandlerChannelAttrException()
|| Objects.isNull(orderItemDO.getHandlerChannelAttrException())
|| !orderItemDO.getHandlerChannelAttrException())) {
String prodAttrIds = orderItemDO.getWarehouseInProdAttrIds();
// 品名特性与渠道包含特性比较,判断是否生成不可出渠道异常
......@@ -272,7 +284,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
}
} else {
// 如果没有不可出特性,且有待处理的不可出渠道异常,则需要排查当不可出渠道异常是否为当前品名生成的
// 如果没有不可出特性,且有待处理的不可出渠道异常,
// 则需要排查当不可出渠道异常是否为当前品名生成的
if (CollectionUtil.isNotEmpty(orderExceptionDOList)) {
orderDO.setIsAutomaticHandleNoCanShipmentChannelException(true);
}
......@@ -436,12 +449,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
continue;
}
}
if (it.getSeaFreightCurrency() == 0 || it.getSeaFreightVolume() == 0L){
if (it.getSeaFreightCurrency() == 0 || it.getSeaFreightVolume() == 0L) {
throw exception(ORDER_NO_QUOTE_NOT_CUSTOM_PRICE);
}
it.setOneSeaFreight(channelPriceParam.getFreightFee());
if (it.getCharging() == 0) {
if (it.getClearanceFreightCurrency() == 0 || it.getClearanceFreightVolume() == 0L){
if (it.getClearanceFreightCurrency() == 0 || it.getClearanceFreightVolume() == 0L) {
throw exception(ORDER_CLEARANCE_NO_QUOTE_NOT_CUSTOM_PRICE);
}
it.setOneClearanceFreight(channelPriceParam.getClearanceFee());
......@@ -686,7 +699,6 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
@Override
public boolean addOrderReceivable(OrderDO orderDO, Integer type) {
boolean isPayAdvanceException = false;
......@@ -1055,7 +1067,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
int sumNum = Objects.nonNull(orderDO.getSumNum()) ? orderDO.getSumNum() : 0; // 入仓件数
int timeTotalNum = Objects.nonNull(orderDO.getLastTimeTotalNum()) ? orderDO.getLastTimeTotalNum() : 0;
int currentTotalNum = sumNum - timeTotalNum;
if (currentTotalNum < 0){
if (currentTotalNum < 0) {
currentTotalNum = 0;
}
LogisticsInfoDto logisticsStartInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(orderDO.getLineId());
......@@ -1212,7 +1224,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
int sumNum = Objects.nonNull(orderDO.getSumNum()) ? orderDO.getSumNum() : 0; // 入仓件数
int timeTotalNum = Objects.nonNull(orderDO.getLastTimeTotalNum()) ? orderDO.getLastTimeTotalNum() : 0;
int currentTotalNum = sumNum - timeTotalNum;
if (currentTotalNum < 0){
if (currentTotalNum < 0) {
// 当因为拆单、退仓导致当次更新的入仓箱数为负数时,此值默认为0,只更新总入仓箱数
currentTotalNum = 0;
}
......@@ -1873,7 +1885,6 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
public void costCalculation(String userId, OrderDO orderDO, Long consignorCustomerId, Long consigneeCustomerId,
Long consignorCustomerContactsId, Long consigneeCustomerContactsId,
List<OrderItemDO> orderItemDOList, Integer type) {
......@@ -2263,7 +2274,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
private int createClearanceFeeNoQuiteException(OrderDO orderDO, int noQuoteOrAutomaticNoQuote, OrderItemDO orderItemDO) {
// 查询是否有重量超限异常,如果有则不生成清关费异常
// TODO 查询是否有重量超限异常和渠道包装重量超限异常,如果有则不生成清关费异常
List<OrderExceptionDO> goodsOverweightExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndProdIdAndExceptionKeys(orderDO.getOrderId(), null,orderItemDO.getProdId(),
List<OrderExceptionDO> goodsOverweightExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndProdIdAndExceptionKeys(orderDO.getOrderId(), null, orderItemDO.getProdId(),
CollectionUtil.newArrayList(OrderExceptionEnum.GOODS_OVERWEIGHT_EXCEPTION.getKey(), OrderExceptionEnum.LINE_WEIGHT_EXCEPTION.getKey()));
// 渠道重量超限异常 channel_packaging_overweight_exception
// List<OrderExceptionDO> channelPackagingOverweightExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(), orderItemDO.getOrderItemId(), OrderExceptionEnum.CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION.getKey());
......@@ -2363,8 +2374,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
* 锁链-重货,收费立方={(25-1-4-6)*5000/(5000+10900)}+4=8.40m³
* 秤砣-重货,收费立方={(25-1-4-6)*10900/(5000+10900)}+6=15.6m³
* 总收费重量1+8.4+15.6=25。。。。。。
*
*
* <p>
* <p>
* 2、空运泡货订单-商品收费重量计算公式调整
* 泡货订单商品的收费重量=(订单总收费重量-商品总入仓重量)*(商品入仓体积/订单中商品为泡货的总体积)+商品入仓重量
* 下面用例子示例:
......@@ -2376,6 +2387,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
* 洞洞鞋-泡货,收费重量={(83.5-20-10-1)*0.3/(0.1+0.3)}+10=49.38KG
* 气球-泡货,收费重量={(83.5-20-10-1)*0.1/(0.1+0.3)}+1=14.12KG
* 总收费重量20+49.38+14.12=83.5
*
* @param orderDO 订单信息
* @param orderItemDOList 订单项信息
* @param zhongPaoBestVO 重泡货配置
......@@ -2624,7 +2636,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemDO.setIsPriced(Boolean.FALSE);
}
// 处理重泡货异常时,标记计价类型,如果是阶梯价格,则需要重新计价,如果是非阶梯价格,则不用重新计价
if (type == 9){
if (type == 9) {
param.setIsChangeFeeValue(true);
}
param.setSpecialCommission(Objects.nonNull(orderItemDO.getSpecialCommission()) && orderItemDO.getSpecialCommission());
......@@ -2751,7 +2763,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
prodConditionParamList.add(param);
}
boolean isWarehouseIn = false;
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) && !Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())){
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) && !Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
isWarehouseIn = true;
}
// 定单价费用
......@@ -2842,7 +2854,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} else {
orderItemDO.setIsPriced(Objects.nonNull(orderItemDO.getIsPriced()) ? orderItemDO.getIsPriced() : Boolean.FALSE);
}
}else {
} else {
// 海运
if (StringUtils.isNotBlank(orderItemDO.getWarehouseInInfo()) && orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) > 0 && !orderItemDO.getIsPriced()) {
// 已入仓的商品项,如果未定价,且价格不为0,则标记为已定价
......@@ -2923,7 +2935,6 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
private void correctionAirError(List<OrderItemDO> orderItemDOList, OrderDO orderDO, OrderItemDO it) {
if (orderDO.getOrderType() == 1) {
// 判断入仓品名的收费重量是否与订单的泡货重量一致
......@@ -3065,7 +3076,6 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
private String filterProdAttrIds(String prodAttrIds) {
List<Long> attrIdList = Arrays.stream(prodAttrIds.split(StrUtil.COMMA)).map(Long::parseLong).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(attrIdList)) {
......@@ -3081,7 +3091,6 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
private void calculateTotalOnePrice(List<OrderItemDO> orderItemDOList, OrderDO orderDO, List<ProdConditionParam> prodConditionParams) {
Long targetId = 1L;// 目标币种,默认美元
OrderObjectiveDO objectiveDO = orderObjectiveService.getByOrderId(orderDO.getOrderId());
......
......@@ -418,7 +418,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
|| Objects.equals(TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue(), createReqVO.getTransportId())) {
if (Objects.isNull(order.getChannelId()) || 0 == order.getChannelId()) {
// 当前空运或海空联运订单下单时,没有渠道id,则生成渠道异常
OrderExceptionCreateReqVO orderExceptionCreateReqVO = this.genOrderException(order.getOrderId(), order, null, null, OrderExceptionEnum.CHANNEL_EXCEPTION,
OrderExceptionCreateReqVO orderExceptionCreateReqVO =
this.genOrderException(order.getOrderId(), order, null, null, OrderExceptionEnum.CHANNEL_EXCEPTION,
"未选择线路渠道", "No route channel selected");
orderExceptionService.createOrderException(orderExceptionCreateReqVO);
}
......@@ -626,7 +627,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeService.save(orderConsigneeDO);
if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
//customerType 发货人-1 收货人 2
int customerType= this.checkOrderSalesman(order,createReqVO.getOfferId(),null,null,orderConsignorDO,orderConsigneeDO);
int customerType = this.checkOrderSalesman(order, createReqVO.getOfferId(), null, null, orderConsignorDO, orderConsigneeDO);
// if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {
// // 海外仓归属发货人
// order.setCustomerId(orderConsignorDO.getCustomerId());
......@@ -716,13 +717,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// }//end
// 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus())
&& Objects.nonNull(order.getCustomerId()) &&
order.getCustomerId() > 0) {
//addOrderCustomerService(order, customerType);
addOrderCustomerServiceAndCustomer(createReqVO,order, customerType);
addOrderCustomerServiceAndCustomer(createReqVO, order, customerType);
}
}
}
//新增订单 客户联系人处理
private void adminSaveConsignorAndConsignee(OrderCreateReqVO createReqVO, OrderDO order, String creator,
Date now, DictDataRespDTO dictDataRespDTO) {
......@@ -924,12 +928,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
// 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(order,createReqVO.getOfferId(),null,null,orderConsignorDO,orderConsigneeDO);
int customerType = this.checkOrderSalesman(order, createReqVO.getOfferId(), null, null, orderConsignorDO, orderConsigneeDO);
// 更新所属客户经理(业务员)
if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
//addOrderCustomerService(order, customerType);
addOrderCustomerServiceAndCustomer(createReqVO,order, customerType);
addOrderCustomerServiceAndCustomer(createReqVO, order, customerType);
}
}
}
......@@ -944,66 +948,66 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {
// 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0) ;
} else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null) {
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
}else{
List<TargetOfferBackVO> offerBackVOList =targetLogMapper.getTargetOfferBackByOrerId(order.getOrderId()) ;
} else {
List<TargetOfferBackVO> offerBackVOList = targetLogMapper.getTargetOfferBackByOrerId(order.getOrderId());
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && CollectionUtil.isNotEmpty(offerBackVOList)) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else{
} else {
//都不符合,归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
} else if (order.getDrawee() == 2 ) {//收货人付款 层级5 第一个
if(consigneeDO!=null){
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
if (consigneeDO != null) {
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService());
}else{
} else {
order.setSalesmanId(0L);
}
} 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(CollectionUtil.isNotEmpty(offerBackVOList) && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
if (CollectionUtil.isNotEmpty(offerBackVOList) && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else if(CollectionUtil.isNotEmpty(offerBackVOList) && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
} else if (CollectionUtil.isNotEmpty(offerBackVOList) && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else {
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
} else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
// if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
......@@ -1023,19 +1027,19 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
//业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
}
}
}
//新增判断客户归属
private void addOrderSalesmanCustomerService(OrderCreateReqVO createReqVO,OrderDO order) {
private void addOrderSalesmanCustomerService(OrderCreateReqVO createReqVO, OrderDO order) {
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
......@@ -1044,36 +1048,36 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {//层级1
// 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0) ;
} else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null) {
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
}else{
} else {
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId()!=null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else{
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
} else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
// order.setCustomerId(0L);
// order.setSalesmanId(0L);
}
} else if (order.getDrawee() == 2 ) {//收货人付款 层级5 第一个
if(consigneeDO!=null){
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
if (consigneeDO != null) {
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService());
}else{
} else {
//没有收货人
order.setCustomerId(0L);
order.setSalesmanId(0L);
......@@ -1082,33 +1086,33 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} 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 第二个 订单关联报价单 && 自定义付款 且发货人付运费
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
}else {
} else {
//去掉层级5、6 ,以上不符合的都归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
......@@ -1116,8 +1120,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
//业绩归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
}
......@@ -1126,105 +1130,102 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
public int checkOrderSalesman(OrderDO order, Long offerId,CustomerDO consignorDO,CustomerDO consigneeDO,OrderConsignorDO orderConsignorDO,OrderConsigneeDO orderConsigneeDO){
public int checkOrderSalesman(OrderDO order, Long offerId, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) {
int customerType = 1; //1-业绩归属发货人,2-业绩归属收货人
if(Objects.isNull(orderConsigneeDO)){//订单收货人
if (Objects.isNull(orderConsigneeDO)) {//订单收货人
orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
}
if(Objects.isNull(orderConsignorDO)){//订单发货人
if (Objects.isNull(orderConsignorDO)) {//订单发货人
orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, order.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
}
if(Objects.isNull(consignorDO)){//发货人客户
if (Objects.isNull(consignorDO)) {//发货人客户
consignorDO = customerService.getCustomer(orderConsignorDO.getCustomerId());
}
if(Objects.isNull(consigneeDO)){
if (Objects.isNull(consigneeDO)) {
consigneeDO = customerService.getCustomer(orderConsigneeDO.getCustomerId());//收货人客户
}
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) {//层级1
// 海外仓归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0) ;
customerType = 1 ;
} else{
if(consignorDO !=null && ! consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if(consignorDO!=null){
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
customerType = 1;
} else {
if (consignorDO != null && !consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null) {
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
customerType = 1 ;
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
customerType = 1;
}
}else{
} else {
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && offerId!=null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
if (order.getDrawee() == 1 && offerId != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
customerType = 1 ;
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
customerType = 1;
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
customerType = 1 ;
}else{
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
customerType = 2 ;
customerType = 1;
} else {
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
customerType = 2;
// order.setCustomerId(0L);
// order.setSalesmanId(0L);
}
} else if (order.getDrawee() == 2 ) {//收货人付款 层级5 第一个
if(consigneeDO!=null){
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
if (consigneeDO != null) {
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService());
customerType = 1 ;
}else{
customerType = 1;
} else {
//没有收货人
order.setCustomerId(0L);
order.setSalesmanId(0L);
customerType = 0 ;
customerType = 0;
// order.setSalesmanId(0L);
}
} 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(offerId!=null && ( order.getDrawee()==3 && freight==1 )){//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
if (offerId != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
customerType = 1 ;
}else if(offerId!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerType = 1;
} else if (offerId != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
customerType = 1 ;
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerType = 1;
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
customerType = 1 ;
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
customerType = 1;
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService());
customerType = 1 ;
customerType = 1;
}else {
} else {
//去掉层级5、6 ,以上不符合的都归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
customerType = 2 ;
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
customerType = 2;
}
......@@ -1233,26 +1234,30 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
//业绩归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
customerType = 2 ;
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
customerType = 2;
}
}
}
return customerType ;
return customerType;
}
private void addOrderCustomerServiceAndCustomer(OrderCreateReqVO createReqVO,OrderDO order, int customerType) {
if (Objects.nonNull(order.getParentOrderId()) && order.getParentOrderId() > 0 && !order.getSplitSeparateOrder()) {
private void addOrderCustomerServiceAndCustomer(
OrderCreateReqVO createReqVO, OrderDO order, int customerType) {
if (Objects.nonNull(order.getParentOrderId())
&& order.getParentOrderId() > 0 && !order.getSplitSeparateOrder()) {
// 拆单子订单,并且未标记为独立订单,则不执行客户经理分配规则,以原单为主
return;
}
// 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩
List<OrderExceptionDO> orderExceptionDOList =
orderExceptionService.getOrderExceptionByCustomerId(order.getCustomerId());
orderExceptionService.getOrderExceptionByCustomerId(
order.getCustomerId());
// 获取当前订单的异常
OrderExceptionDO currentOrderException = orderExceptionDOList.stream()
.filter(orderExceptionDO -> Objects.equals(orderExceptionDO.getOrderId(), order.getOrderId())).findFirst().orElse(null);
......@@ -1277,20 +1282,23 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setSalesmanId(oldCustomerService);
} else {
//order.setSalesmanId(customerDO.getCustomerService());
addOrderSalesmanCustomerService(createReqVO,order);
addOrderSalesmanCustomerService(createReqVO, order);
}
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(order.getSalesmanId());
if (Objects.nonNull(adminUserRespDTO)) {
order.setDeptId(adminUserRespDTO.getDeptId());
}
} else if (CollectionUtil.isEmpty(orderExceptionDOList) && Objects.nonNull(customerDO)
&& (Objects.isNull(customerDO.getCustomerService()) || (!customerDO.getIsCustomerServiceConfirmed() && Objects.isNull(oldCustomerService)))) {
&& (Objects.isNull(customerDO.getCustomerService()) ||
(!customerDO.getIsCustomerServiceConfirmed() && Objects.isNull(oldCustomerService)))) {
// 如果客户正在移交新客户经理,但是未接收,并且老客户经理不为null,则不创建客户经理未分配异常
//web下单,业绩为收货人,不产生未分配客户经理异常
//if (order.getUserId() != null && order.getUserId() > 0 && customerType == 2) {
if (order.getUserId() != null && order.getUserId() > 0 && order.getSalesmanId()>0) {
if (order.getUserId() != null && order.getUserId() > 0
&& order.getSalesmanId() != null && order.getSalesmanId() > 0) {
//order.setSalesmanId(0L);
addOrderSalesmanCustomerService(createReqVO,order);
addOrderSalesmanCustomerService(createReqVO, order);
order.setDeptId(0L);
log.info("web下单,业绩为收货人,不产生未分配客户经理异常 orderNo={}", order.getOrderNo());
} else {
......@@ -1312,7 +1320,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderExceptionService.createOrderException(orderExceptionCreateReqVO);
}
} else {
// 该订单存在该客户未分配客户经理异常,或者该客户的客户经理待接收,则不再生成未分配客户经理异常,且该订单不产生业绩归属
// 该订单存在该客户未分配客户经理异常,
// 或者该客户的客户经理待接收,则不再生成未分配客户经理异常,且该订单不产生业绩归属
order.setSalesmanId(0L);
order.setDeptId(0L);
}
......@@ -1389,52 +1398,52 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
}
private void setAddOrderCustomerServiceCustomerId(OrderCreateReqVO createReqVO,OrderDO order, CustomerDO consignorDO,CustomerDO consigneeDO,OrderConsignorDO orderConsignorDO,OrderConsigneeDO orderConsigneeDO){
private void setAddOrderCustomerServiceCustomerId(OrderCreateReqVO createReqVO, OrderDO order, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) {
// 补充业绩规则判断
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) { //如果是海外仓
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else {
if(!consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}
} else if (order.getDrawee() == 2 && createReqVO.getOfferId()==null && !consignorDO.getDefaultPay()) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId()) ;
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
} else if (order.getDrawee() == 2 && createReqVO.getOfferId() == null && !consignorDO.getDefaultPay()) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
} 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()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}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());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (!consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 2) || (order.getDrawee() == 3 && clearanceFee == 2)) {//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
......@@ -1450,58 +1459,58 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
private void setUpdateOrderCustomerServiceCustomerId(OrderUpdateReqVO createReqVO,OrderDO order, CustomerDO consignorDO,CustomerDO consigneeDO,OrderConsignorDO orderConsignorDO,OrderConsigneeDO orderConsigneeDO){
private void setUpdateOrderCustomerServiceCustomerId(OrderUpdateReqVO createReqVO, OrderDO order, CustomerDO consignorDO, CustomerDO consigneeDO, OrderConsignorDO orderConsignorDO, OrderConsigneeDO orderConsigneeDO) {
// 补充业绩规则判断
if (Objects.nonNull(order.getType()) && order.getType().contains("2")) { //如果是海外仓
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else{
if(!consignorDO.getNoConsignee() && !order.getHasConsignee()){//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
}
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(order.getDrawee() == 1 && consignorDO.getDefaultPay() ){// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else{
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
//业绩归收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
} else if ( order.getDrawee() == 2 ) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId()) ;
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
} 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()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(createReqVO.getOfferId()!=null && ( order.getDrawee()==3 && clearanceFee==1 )){//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if(consignorDO.getDefaultPay() && ( order.getDrawee()==3 && freight==1 )){ //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else if (consignorDO.getDefaultPay() && ( order.getDrawee()==3 && clearanceFee==1 )){// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId()) ;
order.setSalesmanId(consignorDO.getCustomerService()!=null?consignorDO.getCustomerService():0);
}else {
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
order.setSalesmanId(consignorDO.getCustomerService() != null ? consignorDO.getCustomerService() : 0);
} else {
//去掉层级5、6 ,如果都不符合条件,归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
// if(!consignorDO.getDefaultPay() && (order.getDrawee()==3 && freight==2 ) || (order.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// order.setCustomerId(orderConsigneeDO.getCustomerId());
......@@ -1513,8 +1522,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else {
//业绩归属收获人
order.setCustomerId(orderConsigneeDO.getCustomerId()!=null?orderConsigneeDO.getCustomerId():0);
order.setSalesmanId(consigneeDO.getCustomerService()!=null?consigneeDO.getCustomerService():0);
order.setCustomerId(orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() : 0);
order.setSalesmanId(consigneeDO.getCustomerService() != null ? consigneeDO.getCustomerService() : 0);
}
}
......@@ -3374,7 +3383,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeService.saveOrUpdate(orderConsigneeDO);
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
//customerType 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(updateObj,updateReqVO.getOfferId(),consignorCustomerDO,null,orderConsignorDO,orderConsigneeDO);
int customerType = this.checkOrderSalesman(updateObj, updateReqVO.getOfferId(), consignorCustomerDO, null, orderConsignorDO, orderConsigneeDO);
// if (Objects.nonNull(updateObj.getType()) && updateObj.getType().contains("2")) {
// // 海外仓归属发货人
// updateObj.setCustomerId(orderConsignorDO.getCustomerId());
......@@ -3674,7 +3683,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
//customerType 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(updateObj,updateReqVO.getOfferId(),consignorDO,consigneeDO,orderConsignorDO,orderConsigneeDO);
int customerType = this.checkOrderSalesman(updateObj, updateReqVO.getOfferId(), consignorDO, consigneeDO, orderConsignorDO, orderConsigneeDO);
// 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus()) && Objects.nonNull(updateObj.getCustomerId()) && updateObj.getCustomerId() > 0) {
......@@ -6421,9 +6430,10 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
yejiCreateDate) {
orderMapper.UpdateOrderVValue(orderId, calVvalue, yejiCreateDate);
}
@Transactional(rollbackFor = Exception.class)
public void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId){
orderMapper.updateOrderCustomerAndSalesmanId(customerId,salesmanId,orderId) ;
public void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId) {
orderMapper.updateOrderCustomerAndSalesmanId(customerId, salesmanId, orderId);
}
}
......@@ -170,7 +170,8 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
@Override
@Transactional(rollbackFor = Exception.class)
public Long createOrderException(OrderExceptionCreateReqVO createReqVO) {
OrderAbnormalStateEnum abnormal = OrderAbnormalStateEnum.keyOf(createReqVO.getOrderExceptionType());
OrderAbnormalStateEnum abnormal =
OrderAbnormalStateEnum.keyOf(createReqVO.getOrderExceptionType());
if (null == abnormal) {
throw exception(ORDER_EXCEPTION_NOT_EXISTS);
}
......@@ -230,7 +231,8 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
}
if (mustToInsert) {
OrderExceptionDO orderException = OrderExceptionConvert.INSTANCE.convert(createReqVO);
OrderExceptionDO orderException =
OrderExceptionConvert.INSTANCE.convert(createReqVO);
orderException.setOrderExceptionRemark(JSONObject.toJSONString(createReqVO.getOrderExceptionDescVO()));
orderExceptionMapper.insert(orderException);
resultId = orderException.getId();
......@@ -553,7 +555,8 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
@Transactional(rollbackFor = Exception.class)
public void handlerExceptionByExceptionId(OrderExceptionResultHandlerVo vo) {
OrderExceptionDO orderExceptionDO = this.getById(vo.getOrderExceptionId());
OrderExceptionDO orderExceptionDO =
this.getById(vo.getOrderExceptionId());
if (null == orderExceptionDO) {
throw exception(ORDER_EXCEPTION_RESULT_NOT_EXISTS);
}
......@@ -600,6 +603,7 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
List<ApplyInfoVO> applyInfoVOList = new ArrayList<>();
orderExceptionResultService.save(orderExceptionResult);
if ((orderExceptionDO.getOrderExceptionType() + "_result").equals(OrderExceptionResult.ORDER_COD_EXCEPTION_RESULT.KEY)) {
//代收货款
if (vo.getOrderExceptionHandlerResult().equals(OrderExceptionResult.ORDER_COD_EXCEPTION_RESULT.COD)) {
......@@ -2616,26 +2620,39 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
@Override
public void autoProcessException(Long orderId, Long orderItemId, OrderExceptionEnum orderExceptionEnum, String remark, String orderExceptionHandlerResult, boolean isSystemAutoProcess) {
List<OrderExceptionDO> pendHeavyExceptionList = this.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderId, orderItemId, orderExceptionEnum.getKey());
public void autoProcessException(Long orderId,
Long orderItemId,
OrderExceptionEnum orderExceptionEnum,
String remark,
String orderExceptionHandlerResult,
boolean isSystemAutoProcess) {
List<OrderExceptionDO> pendHeavyExceptionList =
this.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderId, orderItemId, orderExceptionEnum.getKey());
if (CollectionUtil.isNotEmpty(pendHeavyExceptionList)) {
for (OrderExceptionDO orderExceptionDO : pendHeavyExceptionList) {
// 自动处理 只处理待处理的。 处理中的不需要了
if (orderExceptionDO.getOrderExceptionStatus() == 0) {
autoProcessExceptionDo(orderExceptionDO, orderExceptionHandlerResult, remark, isSystemAutoProcess);
autoProcessExceptionDo(orderExceptionDO,
orderExceptionHandlerResult,
remark, isSystemAutoProcess);
}
}
}
}
private void autoProcessExceptionDo(OrderExceptionDO orderExceptionDO, String orderExceptionHandlerResult, String remark, boolean isSystemAutoProcess) {
private void autoProcessExceptionDo(OrderExceptionDO orderExceptionDO,
String orderExceptionHandlerResult,
String remark,
boolean isSystemAutoProcess) {
//默认admin
Long adminId = 1l;
if (!isSystemAutoProcess) {
adminId = SecurityFrameworkUtils.getLoginUserId();
}
OrderExceptionResultHandlerVo orderExceptionResultHandlerVo = new OrderExceptionResultHandlerVo();
OrderExceptionResultHandlerVo orderExceptionResultHandlerVo =
new OrderExceptionResultHandlerVo();
orderExceptionResultHandlerVo.setSource("pc");
orderExceptionResultHandlerVo.setOrderExceptionId(orderExceptionDO.getId());
orderExceptionResultHandlerVo.setSystemAutoProcess(isSystemAutoProcess);
......
......@@ -345,7 +345,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
this.validateProdAttrAccess(createReqVO.getProdId(), orderDO.getOrderNo());
validateWarehouseInItem(orderDO, brand, orderWarehouseInItemDoList, prodTitleZh, prodTitleEn);
validateWarehouseInItem(orderDO,
brand,
orderWarehouseInItemDoList,
prodTitleZh,
prodTitleEn);
// 拆单时系统会自动入仓,跳过此判断
if (!createReqVO.getIsSplitOrderAutoCreate()) {
if (CollectionUtil.isEmpty(createReqVO.getPictureUrls())) {
......@@ -357,7 +361,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SPLIT_ORDER_CAN_NOT_WAREHOUSE_IN);
}
// 订单排单校验
applicationContext.publishEvent(new BoxCheckOrderSchedulingEvent(orderId));
applicationContext.publishEvent(
new BoxCheckOrderSchedulingEvent(orderId));
}
// 若已经存在入仓纪录,则就是追加。
......@@ -408,8 +413,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
CustomerDO orderConsignorCustomer =
customerService.getCustomer(orderConsignorDO.getCustomerId());
// 发货人不是代理或同行
if (orderConsignorCustomer != null && StringUtils.isNotEmpty(orderConsignorCustomer.getType())
&& !orderConsignorCustomer.getType().contains("2") && !orderConsignorCustomer.getType().contains("3")) {
if (orderConsignorCustomer != null &&
StringUtils.isNotEmpty(orderConsignorCustomer.getType())
&& !orderConsignorCustomer.getType().contains("2") &&
!orderConsignorCustomer.getType().contains("3")) {
// 收货人信息
OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOrderConsigneeByOrderId(orderId);
......@@ -644,7 +651,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
return orderItemDO.getOrderItemId();
}
private void validateWarehouseInItem(OrderDO orderDO, Long brand, List<OrderWarehouseInItemDto> orderWarehouseInItemDoList, String prodTitleZh, String prodTitleEn) {
private void validateWarehouseInItem(OrderDO orderDO,
Long brand,
List<OrderWarehouseInItemDto> orderWarehouseInItemDoList,
String prodTitleZh,
String prodTitleEn) {
if (brand == null || brand.equals(0L)) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.PROD_BRAND_NOT_NULL);
}
......@@ -653,8 +664,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_WAREHOUSE_IN_NOT_EXISTS);
}
boolean quantityRequired = warehouseService.quantityRequired(orderDO.getLineId());
boolean isConcentrateTransport = StringUtils.isNotEmpty(orderDO.getType()) && orderDO.getType().contains("1");
boolean quantityRequired =
warehouseService.quantityRequired(orderDO.getLineId());
boolean isConcentrateTransport =
StringUtils.isNotEmpty(orderDO.getType()) &&
orderDO.getType().contains("1");
for (OrderWarehouseInItemDto orderWarehouseInItemDto : orderWarehouseInItemDoList) {
......@@ -705,7 +719,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
throw ServiceExceptionUtil.exception(ErrorCodeConstants.PROD_WAREHOUSE_IN_VOLUME_NOT_ZERO, I18nMessage.getLang() == 0 ? prodTitleZh : prodTitleEn);
}
}
if (quantityRequired && (orderWarehouseInItemDto.getQuantityAll() == null || orderWarehouseInItemDto.getQuantityAll().equals(0))) {
if (quantityRequired &&
(orderWarehouseInItemDto.getQuantityAll() == null ||
orderWarehouseInItemDto.getQuantityAll().equals(0))) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.WAREHOUSE_IN_ITEM_QUANTITY_REQUIRED);
}
......@@ -1071,9 +1088,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderQueryService.isSplitOrderChildren(orderDO);
// 没有入仓数据则提示
Long inCount = orderWarehouseInMapper.selectCount(OrderWarehouseInDO::getOrderId, orderId);
Long inCount = orderWarehouseInMapper.selectCount(OrderWarehouseInDO::getOrderId,
orderId);
if (inCount == 0) {
throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_WAREHOUSE_IN_NOT_EXISTS);
throw ServiceExceptionUtil.exception(
ErrorCodeConstants.ORDER_WAREHOUSE_IN_NOT_EXISTS);
}
List<OrderItemDO> orderItemDOList =
......@@ -1093,7 +1112,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (isNotRollbackIn && !finishReqVO.getIsSplitIn()) {
// 订单排单校验
applicationContext.publishEvent(new BoxCheckOrderSchedulingEvent(orderId));
applicationContext.publishEvent(
new BoxCheckOrderSchedulingEvent(orderId));
// 校验是否有已核销的应收单,如果有,则不能再次入仓修改
receivableService.verificationReceivableIsWriteOff(orderDO.getOrderId(), null);
......@@ -1101,24 +1121,31 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 影像
if (finishReqVO.getUpdateWarehouseInUrl()) {
orderWarehousePictureService.createWarehousePictureBatch(finishReqVO.getUrls(), 1, orderId);
orderWarehousePictureService.createWarehousePictureBatch(
finishReqVO.getUrls(), 1, orderId);
}
// 转异
String manualExceptionType = finishReqVO.getManualExceptionType();
if (StringUtils.isNotEmpty(manualExceptionType)) {
msg = "订单转异";
// 异常影像
orderWarehousePictureService.createWarehousePictureBatch(finishReqVO.getExceptionUrls(), 4, orderId);
orderWarehousePictureService.createWarehousePictureBatch(
finishReqVO.getExceptionUrls(), 4, orderId);
// 异常
String descZh = getOrderOtherExceptionDesc(manualExceptionType, 0, finishReqVO.getDescZh(), finishReqVO.getDescEn());
String descEn = getOrderOtherExceptionDesc(manualExceptionType, 1, finishReqVO.getDescZh(), finishReqVO.getDescEn());
OrderExceptionCreateReqVO orderExceptionCreateReqVO = genOrderException(orderId, null, orderDO,
OrderExceptionEnum.ORDER_OTHER_EXCEPTION, descZh, descEn, finishReqVO.getExceptionUrls());
OrderExceptionCreateReqVO orderExceptionCreateReqVO =
genOrderException(orderId,
null,
orderDO,
OrderExceptionEnum.ORDER_OTHER_EXCEPTION,
descZh,
descEn,
finishReqVO.getExceptionUrls());
orderExceptionService.createOrderException(orderExceptionCreateReqVO);
}
......@@ -1134,7 +1161,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
finishReqVO.getOrderSpecialNeedReceivableReqVoList();
if (CollectionUtil.isNotEmpty(orderSpecialNeedReceivableReqVoList)) {
List<Long> specialNeedIds = orderSpecialNeedReceivableReqVoList.stream().map(OrderSpecialNeedReceivableReqVo::getId).collect(Collectors.toList());
List<OrderSpecialNeedDO> orderSpecialNeedList = orderSpecialNeedService.getOrderSpecialNeedList(specialNeedIds);
List<OrderSpecialNeedDO> orderSpecialNeedList =
orderSpecialNeedService.getOrderSpecialNeedList(specialNeedIds);
orderSpecialNeedList.forEach(orderSpecialNeedDO -> orderSpecialNeedReceivableReqVoList.stream()
.filter(t -> t.getId().equals(orderSpecialNeedDO.getId())).findFirst().ifPresent(orderSpecialNeedReceivableReqVo -> {
......@@ -1193,7 +1221,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
} else {
orderExceptionService.autoProcessException(orderId, null, OrderExceptionEnum.CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION, "未超过路线渠道包装重量上限,系统已自动处理", OrderExceptionResult.CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION_RESULT.CONFIRMED_SEND);
orderExceptionService.autoProcessException(orderId,
null,
OrderExceptionEnum.CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION,
"未超过路线渠道包装重量上限,系统已自动处理",
OrderExceptionResult.CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION_RESULT.CONFIRMED_SEND);
}
// 入仓总数量、体积、重量
......@@ -1239,6 +1271,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
finishReqVO.getIsSumVolumeNoChange(), finishReqVO.getIsSumWeightNoChange(), finishStocked);
// 处理发货人异常
//需要到仓确认,需要自动生成发货人异常信息 lanbm 2024-06-03 add
processConsignorException(finishReqVO, orderId, orderDO);
// 重新调用计算订单价格, 订单信息和订单项信息需要重新查询,
......@@ -1256,10 +1289,13 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 更新订单状态
Integer result = orderService.updateStatus(orderId,
orderDO.getOrderNo(),
OrderStatusEnum.IN_WAREHOUSE.getValue(), null,
OrderStatusEnum.IN_WAREHOUSE.getValue(),
null,
OrderWarehouseInStatusEnum.warehouse_finished.getValue(),
null, null,
null, false);
null,
null,
null,
false);
if (!isSplitOrderChildren && isNotRollbackIn) {
// 生成预付异常
......@@ -1276,8 +1312,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (CollectionUtil.isEmpty(labelDtoList)) {
// 若没有标签号列表参数,则说明不是更新的,就查一下是否有1~sum的标签号,若有,就不需要再重新生成了。
List<OrderLabelBackVO> orderLabelBackVOS = orderLabelService.getLabelListByOrder(orderId);
if (CollectionUtil.isNotEmpty(orderLabelBackVOS) && orderLabelBackVOS.size() == 1 && orderLabelBackVOS.get(0).getEnd() == numSum2) {
List<OrderLabelBackVO> orderLabelBackVOS =
orderLabelService.getLabelListByOrder(orderId);
if (CollectionUtil.isNotEmpty(orderLabelBackVOS)
&& orderLabelBackVOS.size() == 1
&& orderLabelBackVOS.get(0).getEnd() == numSum2) {
// do nothing
labelDtoList = new ArrayList<>();
} else {
......@@ -1347,7 +1386,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
Set<Long> idSet = new HashSet<>();
idSet.add(orderDO.getCustomerId());
//订单发货人
OrderConsignorDO orderConsignorDO2 = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId())
OrderConsignorDO orderConsignorDO2 =
orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId())
.orderByDesc(OrderConsignorDO::getId).last("limit 1"));
//订单收货人
......@@ -1587,21 +1627,40 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (orderDO.getTransportId() != 3 && orderDO.getTransportId() != 4) {
// 1.12.发货人异常(客户档案设置了到仓确认,此类客户的货是通知装柜才可装)
// 发货人
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId())
OrderConsignorDO orderConsignorDO =
orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId())
.orderByDesc(OrderConsignorDO::getId)
.last("limit 1"));
if (orderConsignorDO.getCustomerId() != null) {
CustomerDO customerDO = customerMapper.selectById(orderConsignorDO.getCustomerId());
if (customerDO != null && customerDO.getArrivalConfirm() != null && customerDO.getArrivalConfirm().equals(1)) {
CustomerDO customerDO =
customerMapper.selectById(orderConsignorDO.getCustomerId());
if (customerDO != null
&& customerDO.getArrivalConfirm() != null
&& customerDO.getArrivalConfirm().equals(1)) {
OrderExceptionCreateReqVO orderExceptionCreateReqVO =
genOrderException(orderId, null, orderDO,
OrderExceptionEnum.ORDER_CONSIGNOR_EXCEPTION,
OrderExceptionEnum.ORDER_CONSIGNOR_EXCEPTION.getZhValueDesc(),
OrderExceptionEnum.ORDER_CONSIGNOR_EXCEPTION.getEnValueDesc(),
null);
OrderExceptionCreateReqVO orderExceptionCreateReqVO = genOrderException(orderId, null, orderDO, OrderExceptionEnum.ORDER_CONSIGNOR_EXCEPTION,
OrderExceptionEnum.ORDER_CONSIGNOR_EXCEPTION.getZhValueDesc(), OrderExceptionEnum.ORDER_CONSIGNOR_EXCEPTION.getEnValueDesc(), null);
List<OrderExceptionDO> listOrderException =
orderExceptionService.selectList(
new LambdaQueryWrapper<OrderExceptionDO>().
eq(OrderExceptionDO::getOrderId, orderId).
eq(OrderExceptionDO::getOrderExceptionType, "order_consignor_exception"));
//先判断到仓确认记录是否存在,不存在才创建 lanbm 2024-06-03 add
if (CollectionUtil.isEmpty(listOrderException)) {
orderExceptionService.createOrderException(orderExceptionCreateReqVO);
}
}
}
}
}
}
private void processZhongPaoException(Long orderId, OrderDO orderDO, ZhongPaoBestVO zhongPaoBest,
BigDecimal weightSum, BigDecimal volumeSum, Boolean isUpdateCallback,
......@@ -1726,7 +1785,14 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
}
private void processMoreOrLessException(Long orderId, OrderDO orderDO, Integer sumNumWarehouseIn) {
/*
处理多箱或少箱异常
lanbm 2024-06-04 添加注释
ecw_order_exception_result 异常处理记录表
*/
private void processMoreOrLessException(Long orderId,
OrderDO orderDO,
Integer sumNumWarehouseIn) {
Integer totalNum = 0;
if (StringUtils.isNotBlank(orderDO.getCost())) {
CostVO costVO = JSONObject.parseObject(orderDO.getCost(), CostVO.class);
......@@ -1739,7 +1805,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
Integer cartonsNumDiff = Math.abs(diff);
String unit = "1";
DictDataRespDTO unitData = DictFrameworkUtils.getDictDataFromCache("packaging_type", unit);
DictDataRespDTO unitData =
DictFrameworkUtils.getDictDataFromCache("packaging_type", unit);
String labelEn = unitData != null ? unitData.getLabelEn() : unit;
String label = unitData != null ? unitData.getLabel() : unit;
String autoProcessExceptionRemark = "系统自动处理 处理人admin";
......@@ -1765,16 +1832,23 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
} else if (OrderItemStatusEnum.less_than.getValue().equals(diffType)) {
OrderExceptionEnum orderSuperfluousBoxException = OrderExceptionEnum.ORDER_LACK_BOX_EXCEPTION;
OrderExceptionEnum orderSuperfluousBoxException =
OrderExceptionEnum.ORDER_LACK_BOX_EXCEPTION;
// 箱数有变化时才更新异常
boolean noSameCartonsOrderException = isNoSameCartonsOrderException(orderId, cartonsNumDiff, orderSuperfluousBoxException);
boolean noSameCartonsOrderException =
isNoSameCartonsOrderException(orderId,
cartonsNumDiff,
orderSuperfluousBoxException);
if (noSameCartonsOrderException) {
// 生成少箱异常
OrderExceptionCreateReqVO orderExceptionCreateReqVO = genOrderException(orderId, null, orderDO,
OrderExceptionEnum.ORDER_LACK_BOX_EXCEPTION, String.format("缺少%d%s", cartonsNumDiff, label),
String.format("less than %d %s", cartonsNumDiff, labelEn), null);
OrderExceptionCreateReqVO orderExceptionCreateReqVO =
genOrderException(orderId, null, orderDO,
OrderExceptionEnum.ORDER_LACK_BOX_EXCEPTION,
String.format("缺少%d%s", cartonsNumDiff, label),
String.format("less than %d %s", cartonsNumDiff, labelEn),
null);
orderExceptionService.createOrderException(orderExceptionCreateReqVO);
// 删除多箱的未处理异常
......@@ -1782,9 +1856,17 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
} else {
// 删除少箱的未处理异常
orderExceptionService.autoProcessException(orderId, null, OrderExceptionEnum.ORDER_LACK_BOX_EXCEPTION, autoProcessExceptionRemark, OrderExceptionResult.ORDER_LACK_BOX_EXCEPTION_RESULT.CONFIRM_CORRECT);
//少箱异常
orderExceptionService.autoProcessException(orderId,
null,
OrderExceptionEnum.ORDER_LACK_BOX_EXCEPTION,
autoProcessExceptionRemark,
OrderExceptionResult.ORDER_LACK_BOX_EXCEPTION_RESULT.CONFIRM_CORRECT);
// 删除多箱的未处理异常
orderExceptionService.autoProcessException(orderId, null, OrderExceptionEnum.ORDER_SUPERFLUOUS_BOX_EXCEPTION, autoProcessExceptionRemark, OrderExceptionResult.ORDER_SUPERFLUOUS_BOX_EXCEPTION_RESULT.CONFIRM_CORRECT);
orderExceptionService.autoProcessException(orderId, null,
OrderExceptionEnum.ORDER_SUPERFLUOUS_BOX_EXCEPTION,
autoProcessExceptionRemark,
OrderExceptionResult.ORDER_SUPERFLUOUS_BOX_EXCEPTION_RESULT.CONFIRM_CORRECT);
}
}
......@@ -2038,10 +2120,13 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
return noSameException;
}
private boolean isNoSameCartonsOrderException(Long orderId, int cartonsNumDiff, OrderExceptionEnum orderSuperfluousBoxException) {
private boolean isNoSameCartonsOrderException(Long orderId,
int cartonsNumDiff,
OrderExceptionEnum orderSuperfluousBoxException) {
boolean noSameProcessedException = true;
List<OrderExceptionDO> orderExceptionList = orderExceptionService.getOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderId, null, orderSuperfluousBoxException.getKey());
List<OrderExceptionDO> orderExceptionList =
orderExceptionService.getOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderId, null, orderSuperfluousBoxException.getKey());
if (CollectionUtil.isNotEmpty(orderExceptionList)) {
try {
OrderExceptionDO orderExceptionDO = orderExceptionList.get(0);
......@@ -2706,7 +2791,6 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 未完成入仓直接更新数据
if (orderDO.getStatus() < OrderStatusEnum.IN_WAREHOUSE.getValue()) {
// 除费用申请等相关审批外,其他审批都不可以操作
throwProcessingApproval(orderDO);
......@@ -2754,7 +2838,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 已完成入仓,则需要提交申请
else {
//完成入仓之后修改信息才发起审批流程 lanbm 2024-06-04 添加注释
// 需要提交审批,则不能有其他任何审批
orderQueryService.throwProcessingApproval(orderId);
......@@ -2772,12 +2856,16 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
compareOrderItemField(updateReqVO, orderItemOld, applyInfoList);
// 开始处理入仓纪录
compareOrderWarehouseInField(orderItemOld.getProdTitleZh(), orderWarehouseInListOld, orderWarehouseInUpdateItemDoList, applyInfoList);
compareOrderWarehouseInField(orderItemOld.getProdTitleZh(),
orderWarehouseInListOld,
orderWarehouseInUpdateItemDoList,
applyInfoList);
if (CollectionUtil.isNotEmpty(applyInfoList)) {
// 仅有入仓明细直接更新,不提交审批
if (applyInfoList.size() == 1 && applyInfoList.get(0).getName().endsWith("入仓明细")) {
if (applyInfoList.size() == 1 &&
applyInfoList.get(0).getName().endsWith("入仓明细")) {
updateOrderWarehouseInDetails(orderItemId, orderWarehouseInUpdateItemDoList, orderWarehouseInListOld);
......@@ -2787,7 +2875,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
// 仅有入仓影像直接更新,不提交审批
else if (applyInfoList.size() == 1 && applyInfoList.get(0).getName().endsWith("入仓影像")) {
else if (applyInfoList.size() == 1 &&
applyInfoList.get(0).getName().endsWith("入仓影像")) {
// 影像
orderWarehousePictureService.createWarehousePictureBatch(updateReqVO.getPictureUrls(), 5, orderItemId);
......@@ -2798,7 +2887,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
// 仅有入仓明细和入仓影像直接更新,不提交审批
else if (applyInfoList.size() == 2 && applyInfoList.get(0).getName().endsWith("入仓影像") && applyInfoList.get(1).getName().endsWith("入仓明细")) {
else if (applyInfoList.size() == 2 &&
applyInfoList.get(0).getName().endsWith("入仓影像") && applyInfoList.get(1).getName().endsWith("入仓明细")) {
// 影像
orderWarehousePictureService.createWarehousePictureBatch(updateReqVO.getPictureUrls(), 5, orderItemId);
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "货物入仓影像修改", applyInfoList);
......@@ -2812,17 +2902,15 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 包含其他更新 发起审核流程
else {
// 删除入仓明细的比较,因为纪录的值会很长,没意义。
applyInfoList.removeIf(t -> t.getName().endsWith("入仓明细"));
// 设置差异对象
updateReqVO.setApplyInfoVOList(applyInfoList);
String details = JSON.toJSONString(updateReqVO);
log.info("入仓修改json = {}", details);
OrderWarehouseApprovalDO orderWarehouseApprovalDO = OrderWarehouseApprovalDO.builder()
OrderWarehouseApprovalDO orderWarehouseApprovalDO =
OrderWarehouseApprovalDO.builder()
.orderIds(orderId.toString())
.orderItemId(updateReqVO.getOrderItemId())
.type(OrderWarehouseApprovalTypeEnum.WAREHOUSE_IN_UPDATE.getValue())
......@@ -2877,11 +2965,17 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
ApplyInfoVO infoVO;
// 新增入仓
List<OrderWarehouseInItemDto> addList = orderWarehouseInItemDtoList.stream().filter(t -> t.getId() == null).collect(Collectors.toList());
List<OrderWarehouseInItemDto> addList =
orderWarehouseInItemDtoList.stream().
filter(t -> t.getId() == null).
collect(Collectors.toList());
for (OrderWarehouseInItemDto inNew : addList) {
DictDataRespDTO unitData = DictFrameworkUtils.getDictDataFromCache("packaging_type", inNew.getUnit());
DictDataRespDTO specificationTypeData = DictFrameworkUtils.getDictDataFromCache("warehousing_specification_type", inNew.getSpecificationType().toString());
DictDataRespDTO unitData =
DictFrameworkUtils.getDictDataFromCache("packaging_type", inNew.getUnit());
DictDataRespDTO specificationTypeData =
DictFrameworkUtils.getDictDataFromCache("warehousing_specification_type", inNew.getSpecificationType().toString());
// 不在老的里面,说明是新增的
infoVO = new ApplyInfoVO();
......@@ -2924,7 +3018,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 更新入仓
for (OrderWarehouseInItemDto inNew : orderWarehouseInItemDtoList) {
OrderWarehouseInDO inOld = orderWarehouseInListOld.stream().filter(t -> t.getId().equals(inNew.getId())).findFirst().orElse(null);
OrderWarehouseInDO inOld =
orderWarehouseInListOld.stream().
filter(t -> t.getId().equals(inNew.getId())).
findFirst().orElse(null);
if (inOld != null) {
String prodName = String.format("商品:%s - ", prodTitleZhOld);
......@@ -3197,9 +3295,13 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 入仓影像
List<String> pictureUrls = CollectionUtil.isNotEmpty(updateReqVO.getPictureUrls()) ? updateReqVO.getPictureUrls() : new ArrayList<>();
List<String> pictureUrlsOld = orderWarehousePictureService.getWarehousePictureUrlList(5, orderItemOld.getOrderItemId());
if (pictureUrlsOld.size() != pictureUrls.size() || pictureUrlsOld.containsAll(pictureUrls)) {
List<String> pictureUrls =
CollectionUtil.isNotEmpty(updateReqVO.getPictureUrls()) ? updateReqVO.getPictureUrls() : new ArrayList<>();
List<String> pictureUrlsOld =
orderWarehousePictureService.getWarehousePictureUrlList(5,
orderItemOld.getOrderItemId());
if (pictureUrlsOld.size() != pictureUrls.size() ||
pictureUrlsOld.containsAll(pictureUrls)) {
infoVO = new ApplyInfoVO();
infoVO.setName(prodName + "入仓影像");
infoVO.setOrgValue((CollectionUtil.isEmpty(pictureUrlsOld) ? 0 : pictureUrlsOld.size()) + "个");
......
......@@ -70,6 +70,9 @@ public class OrderExceptionChannelPriceController {
return success(OrderExceptionChannelPriceConvert.INSTANCE.convert(exceptionChannelPrice));
}
/*
getOrderExceptionChannelPriceList
*/
@PostMapping("/getOrderExceptionChannelPriceList")
@ApiOperation("根据订单ID,异常ID获取价格")
public CommonResult<List<OrderExceptionChannelPriceBackVO>> getOrderExceptionChannelPriceList(@Valid @RequestBody OrderExceptionChannelPriceQueryVO queryVO) {
......@@ -77,7 +80,8 @@ public class OrderExceptionChannelPriceController {
queryWrapper.eq(OrderExceptionChannelPriceDO::getOrderId, queryVO.getOrderId());
queryWrapper.eq(OrderExceptionChannelPriceDO::getExceptionId, queryVO.getExceptionId());
queryWrapper.eq(OrderExceptionChannelPriceDO::getExceptionResultId, queryVO.getExceptionResultId());
List<OrderExceptionChannelPriceDO> exceptionChannelPrice = exceptionChannelPriceService.list(queryWrapper);
List<OrderExceptionChannelPriceDO> exceptionChannelPrice =
exceptionChannelPriceService.list(queryWrapper);
return success(OrderExceptionChannelPriceConvert.INSTANCE.convertList(exceptionChannelPrice));
}
......
......@@ -102,7 +102,9 @@ public class OrderExceptionController {
return success(orderExceptionService.statisticsOrder(query));
}
/*
根据订单ID获取订单异常处理记录 lanbm 2024-06-04 添加注释
*/
@GetMapping("/getExceptionListByOrderId")
@ApiOperation("根据订单ID获取所有的订单异常列表")
@ApiImplicitParam(name = "orderId", value = "订单ID", required = true, example = "1024", dataTypeClass = Long.class)
......
......@@ -75,6 +75,9 @@ public class OrderWarehouseInController {
/*
创建入仓,保存入仓记录 lanbm 2024-05-28 添加注释
渠道,关联可出商品属性
SELECT * from ecw_channel
SELECT * from ecw_product_attr
*/
@PostMapping("/create")
@ApiOperation("入仓/追加")
......@@ -130,7 +133,9 @@ public class OrderWarehouseInController {
@PostMapping("/finish")
@ApiOperation("入仓完成/转异")
@Idempotent(timeout = 5)
public CommonResult<Boolean> finishWarehouseIn(@Valid @RequestBody OrderWarehouseInFinishReqVO finishReqVO) {
public CommonResult<Boolean> finishWarehouseIn(
@Valid @RequestBody OrderWarehouseInFinishReqVO finishReqVO) {
//lanbm 2024-05-26 在此处添加注释
String redisKey = MessageFormat.format(ORDER_FINISH_WAREHOUSE_IN_KEY,
finishReqVO.getOrderId().toString());
......@@ -140,6 +145,7 @@ public class OrderWarehouseInController {
}
boolean hasException = false;
try {
//完成入仓
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
hasException = orderWarehouseInService.finishWarehouseIn(finishReqVO);
......
......@@ -126,7 +126,7 @@ public class MyOrderController {
@PostMapping("/create")
@DynamicRateLimiter(base = "#Headers['Authorization']", permits = 1)
@ApiOperation(value = "创建订单", notes = "发货人只取当前用户信息,收货人取当前用户的客户信息")
@Idempotent(timeout = 5)
@Idempotent(timeout = 15)
@PreAuthenticated
public CommonResult<Long> createOrder(@Valid @RequestBody OrderCreateReqVO createReqVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
......
......@@ -41,19 +41,39 @@ public class ProdLinePriceController {
*/
@PostMapping("/calculation")
@ApiOperation("计算单种运输方式的商品费用(单个商品也做数组传参)")
public CommonResult<CalculationCostResultDto> calculationProdCost(@RequestBody ConditionParam param) {
if (CollectionUtil.isEmpty(param.getProdConditionParamList())){
public CommonResult<CalculationCostResultDto> calculationProdCost(
@RequestBody ConditionParam param) {
if (CollectionUtil.isEmpty(param.getProdConditionParamList())) {
return error(ORDER_ITEM_PROD_NOT_EXISTS);
}
// 前端实时计价时需要将订单的固定价格参数进行格式化,转为未定价,否则不会去查询当前实时价格
param.setProdConditionParamList(param.getProdConditionParamList().stream().peek(it->it.setIsPriced(false)).collect(Collectors.toList()));
List<ProdConditionParam> prodConditionParams = prodCostCalculation.obtainProdLineOnePrice(param.getProdConditionParamList(), "",
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1, param.getCustomerId(),
param.getTransportId(), param.getLineId(), param.getChannelId(), false);
CalculationCostResultDto dto = prodCostCalculation.calculationProdCost(prodConditionParams, "",
param.getOrderType(), Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1, Objects.nonNull(param.getIsCargoControl()) && param.getIsCargoControl() ? 1 : 0,
param.getUserId(), param.getCustomerId(), param.getConsignorCustomerId(), param.getConsigneeCustomerId(),
param.getConsignorCustomerContactsId(), param.getConsigneeCustomerContactsId(), param.getTransportId(), param.getLineId(), param.getChannelId());
param.setProdConditionParamList(param.getProdConditionParamList().stream().peek(it -> it.setIsPriced(false)).collect(Collectors.toList()));
List<ProdConditionParam> prodConditionParams =
prodCostCalculation.obtainProdLineOnePrice(
param.getProdConditionParamList(),
"",
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1,
param.getCustomerId(),
param.getTransportId(),
param.getLineId(),
param.getChannelId(),
false);
CalculationCostResultDto dto =
prodCostCalculation.calculationProdCost(prodConditionParams,
"",
param.getOrderType(),
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1,
Objects.nonNull(param.getIsCargoControl()) && param.getIsCargoControl() ? 1 : 0,
param.getUserId(),
param.getCustomerId(),
param.getConsignorCustomerId(),
param.getConsigneeCustomerId(),
param.getConsignorCustomerContactsId(),
param.getConsigneeCustomerContactsId(),
param.getTransportId(),
param.getLineId(),
param.getChannelId());
return success(dto);
}
......
package cn.iocoder.yudao.module.shipment.dal.dataobject;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
/**
* 费用登记 DO
*
......@@ -56,6 +59,7 @@ public class BoxCostDO extends BaseDO {
/*
费用产生时间 lanbm 2024-05-17 add
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date freecsdate;
}
......@@ -46,4 +46,6 @@ public interface MakeBillOfLadingMapper extends AbstractMapper<MakeBillOfLadingD
}
MakeBillOfLadingListBackVO getLadingBillOrderInfo(Long orderId);
String getBpmStatus(String process_instance_id);
}
......@@ -15,6 +15,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public interface MakeBillOfLadingService extends IService<MakeBillOfLadingDO> {
/*
获取提单审批状态 lanbm 2024-06-04 add
*/
String getBpmStatus(String process_instance_id);
/**
* 创建制作提货单
* @param createReqVO 创建信息
......
......@@ -173,6 +173,13 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
@Resource
private CurrencyApi currencyApi;
/*
获取提单审批状态 lanbm 2024-06-04 add
*/
public String getBpmStatus(String process_instance_id) {
return makeBillOfLadingMapper.getBpmStatus(process_instance_id);
}
@SneakyThrows
@Override
@Transactional(rollbackFor = Exception.class)
......
......@@ -92,4 +92,17 @@ public class BoxCostBackVO {
private String updater;
/*
应付款,关联的付款单 lanbm 2024-06-03 add
*/
private String paymentId;
/*
费用产生时间 lanbm 2024-05-17 add
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date freecsdate;
}
......@@ -38,6 +38,11 @@ public class MakeBillOfLadingBackVO {
@ApiModelProperty(value = "流程实例ID")
private String bpmProcessId;
/*
审批状态 lanbm 2024-05-04 add
*/
private String bpmStatus;
@ApiModelProperty(value = "提货单pdfURL")
private String imgUrl;
......
......@@ -2,12 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.shipment.dal.mysql.makeBillOfLading.MakeBillOfLadingMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="getBpmStatus" resultType="java.lang.String">
SELECT status from bpm_process_instance_ext
where deleted=0 and process_instance_id=#{process_instance_id}
</select>
<select id="getLadingBillOrderInfo" parameterType="java.lang.Long" resultType="cn.iocoder.yudao.module.shipment.vo.makeBillOfLading.MakeBillOfLadingListBackVO">
SELECT distinct
......
......@@ -71,7 +71,7 @@ public class BoxCostController {
//@PreAuthorize("@ss.hasPermission('ecw:box-cost:create')")
public CommonResult<Long> createBoxCost(@Valid @RequestBody BoxCostCreateReqVO createReqVO) {
//lanbm 2024-05-17 添加费用产生日期字段
String s="";
String s = "";
return success(boxCostService.createBoxCost(createReqVO));
}
......@@ -80,7 +80,7 @@ public class BoxCostController {
// @PreAuthorize("@ss.hasPermission('ecw:box-cost:update')")
public CommonResult<Boolean> updateBoxCost(@Valid @RequestBody BoxCostUpdateReqVO updateReqVO) {
//lanbm 2024-05-17 添加费用产生日期字段
String s="";
String s = "";
boxCostService.updateBoxCost(updateReqVO);
return success(true);
}
......@@ -111,19 +111,25 @@ public class BoxCostController {
public CommonResult<Long> getPaymentId(@RequestParam("id") Long id) {
PayableDO payableDO = payableService.getPayable(id);
if (payableDO == null) {
return error(new ErrorCode(1,"费用记录不存在"));
return error(new ErrorCode(1, "费用记录不存在"));
}
if (payableDO.getPaymentId()==null||payableDO.getPaymentId() == 0) {
return error(new ErrorCode(2,"付款单信息还未生成。"));
//ecw_payable 付款单信息
if (payableDO.getPaymentId() == null || payableDO.getPaymentId() == 0) {
return error(new ErrorCode(2, "付款单信息还未生成。"));
}
return success(payableDO.getPaymentId());
}
/*
-- 先登记费用信息,生成 ecw_payable 付款单,付款单付款付款后生成
-- 应付款 ecw_payment
*/
@GetMapping("/list")
@ApiOperation("获得费用登记列表, use this")
//@PreAuthorize("@ss.hasPermission('ecw:box-cost:query')")
public CommonResult<List<BoxCostBackVO>> getBoxCostList(@Valid BoxCostQueryVO query) {
//ecw_box_cost 费用登记
List<BoxCostDO> list = boxCostService.getBoxCostList(query);
List<BoxCostBackVO> costList = BoxCostConvert.INSTANCE.convertList(list);
......@@ -149,7 +155,9 @@ public class BoxCostController {
if (CollectionUtil.isNotEmpty(payableList)) {
Map<Long, PayableDO> payableMap = payableList.stream()
.collect(Collectors.toMap(PayableDO::getShippingFeeId, t -> t));
for (BoxCostBackVO boxCostBackVO : costList) {
//获取应付款信息
PayableDO payableDO = payableMap.get(boxCostBackVO.getId());
if (payableDO != null) {
//lanbm 2024-05-16 添加实付金额币种
......@@ -161,6 +169,13 @@ public class BoxCostController {
//lanbm 2024-05-16 添加付款单单号
boxCostBackVO.setPayableNo(payableDO.getPayableNo());
boxCostBackVO.setPayableId(payableDO.getId());
//判断是否生成付款单 lanbm 2024-06-03
if (payableDO.getPaymentId() == null || payableDO.getPaymentId() == 0) {
boxCostBackVO.setPaymentId("-1");
} else {
boxCostBackVO.setPaymentId(payableDO.getPaymentId().toString());
}
}
}
}
......
package cn.iocoder.yudao.module.shipment.controller.admin;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -89,7 +90,7 @@ public class MakeBillOfLadingController {
//ecw_make_bill_of_lading 提单
String redisKey = MessageFormat.format(BOX_MAKE_LADING_KEY, createReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
if (count > 1) {
return error(BOX_MAKE_LADING_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
......@@ -181,13 +182,27 @@ public class MakeBillOfLadingController {
public CommonResult<MakeBillOfLadingBackVO> downloadByOrderId(@RequestParam("orderId") Long orderId, HttpServletResponse response) {
MakeBillOfLadingDO lading = makeBillOfLadingService.selectOne(MakeBillOfLadingDO::getOrderId, orderId);
if (lading == null) {
return error(new ErrorCode(1109010018, "该提单未制作或未审批通过!"));
return error(new ErrorCode(1109010018,
"该提单未制作或未审批通过!"));
}
OrderDO orderDOCheck = orderService.getById(orderId);
if (orderDOCheck.getStatus() < OrderStatusEnum.INSTALLED_CABINET.getValue()) {
return error(new ErrorCode(1109010019, "装柜前无法下载提货单"));
}
return success(MakeBillOfLadingConvert.INSTANCE.convert(lading));
MakeBillOfLadingBackVO vResult =
MakeBillOfLadingConvert.INSTANCE.convert(lading);
if (lading.getBpmProcessId() == null ||
lading.getBpmProcessId().length() == 0) {
vResult.setBpmStatus("-1");
} else {
String sStatus =
makeBillOfLadingService.getBpmStatus(lading.getBpmProcessId());
if (sStatus == null) sStatus = "-1";
vResult.setBpmStatus(sStatus);
}
return success(vResult);
}
@GetMapping("/download")
......
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