Commit 96e27c3b authored by lanbaoming's avatar lanbaoming

2024-06-04

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