订单优化
parent
bb22a3babb
commit
09fc2e9e02
|
|
@ -809,15 +809,17 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
|
||||||
throw new ServiceException(CharSequenceUtil.format("订单[{}]当前状态无法发货",
|
throw new ServiceException(CharSequenceUtil.format("订单[{}]当前状态无法发货",
|
||||||
order.getOrderNo()));
|
order.getOrderNo()));
|
||||||
}
|
}
|
||||||
checkNoCompleteRefundDetail(storeOrderDetailIds, "售后完成状态的商品无法发货");
|
List<Long> existsRefundDetailIds = checkNoCompleteRefundDetail(storeOrderDetailIds,
|
||||||
|
"售后完成状态的商品无法发货");
|
||||||
List<StoreOrderDetail> containDetails = storeOrderDetailMapper.selectList(
|
List<StoreOrderDetail> containDetails = storeOrderDetailMapper.selectList(
|
||||||
Wrappers.lambdaQuery(StoreOrderDetail.class)
|
Wrappers.lambdaQuery(StoreOrderDetail.class)
|
||||||
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
|
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
|
||||||
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
||||||
for (StoreOrderDetail containDetail : containDetails) {
|
for (StoreOrderDetail containDetail : containDetails) {
|
||||||
if (EDeliveryType.SHIP_COMPLETE.getValue().equals(order.getDeliveryType())) {
|
if (EDeliveryType.SHIP_COMPLETE.getValue().equals(order.getDeliveryType())) {
|
||||||
//如果是货齐再发,此次发货需要包含所有明细
|
//如果是货齐再发,此次发货需要包含所有明细(排除已存在售后的明细)
|
||||||
if (!storeOrderDetailIds.contains(containDetail.getId())) {
|
if (!storeOrderDetailIds.contains(containDetail.getId())
|
||||||
|
&& !existsRefundDetailIds.contains(containDetail.getId())) {
|
||||||
throw new ServiceException(CharSequenceUtil.format("订单[{}]不可拆单发货",
|
throw new ServiceException(CharSequenceUtil.format("订单[{}]不可拆单发货",
|
||||||
order.getOrderNo()));
|
order.getOrderNo()));
|
||||||
}
|
}
|
||||||
|
|
@ -904,15 +906,17 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
|
||||||
throw new ServiceException(CharSequenceUtil.format("订单[{}]当前状态无法发货",
|
throw new ServiceException(CharSequenceUtil.format("订单[{}]当前状态无法发货",
|
||||||
order.getOrderNo()));
|
order.getOrderNo()));
|
||||||
}
|
}
|
||||||
checkNoCompleteRefundDetail(storeOrderDetailIds, "售后完成状态的商品无法发货");
|
List<Long> existsRefundDetailIds = checkNoCompleteRefundDetail(storeOrderDetailIds,
|
||||||
|
"售后完成状态的商品无法发货");
|
||||||
List<StoreOrderDetail> containDetails = storeOrderDetailMapper.selectList(
|
List<StoreOrderDetail> containDetails = storeOrderDetailMapper.selectList(
|
||||||
Wrappers.lambdaQuery(StoreOrderDetail.class)
|
Wrappers.lambdaQuery(StoreOrderDetail.class)
|
||||||
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
|
.eq(StoreOrderDetail::getStoreOrderId, order.getId())
|
||||||
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
||||||
for (StoreOrderDetail containDetail : containDetails) {
|
for (StoreOrderDetail containDetail : containDetails) {
|
||||||
if (EDeliveryType.SHIP_COMPLETE.getValue().equals(order.getDeliveryType())) {
|
if (EDeliveryType.SHIP_COMPLETE.getValue().equals(order.getDeliveryType())) {
|
||||||
//如果是货齐再发,此次发货需要包含所有明细
|
//如果是货齐再发,此次发货需要包含所有明细(排除已存在售后的明细)
|
||||||
if (!storeOrderDetailIds.contains(containDetail.getId())) {
|
if (!storeOrderDetailIds.contains(containDetail.getId())
|
||||||
|
&& !existsRefundDetailIds.contains(containDetail.getId())) {
|
||||||
throw new ServiceException(CharSequenceUtil.format("订单[{}]不可拆单发货",
|
throw new ServiceException(CharSequenceUtil.format("订单[{}]不可拆单发货",
|
||||||
order.getOrderNo()));
|
order.getOrderNo()));
|
||||||
}
|
}
|
||||||
|
|
@ -982,7 +986,8 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
|
||||||
public ExpressShippingLabelDTO printOrder(Long storeOrderId, List<Long> storeOrderDetailIds, Long expressId,
|
public ExpressShippingLabelDTO printOrder(Long storeOrderId, List<Long> storeOrderDetailIds, Long expressId,
|
||||||
Boolean needShip, Long operatorId) {
|
Boolean needShip, Long operatorId) {
|
||||||
Assert.notEmpty(storeOrderDetailIds);
|
Assert.notEmpty(storeOrderDetailIds);
|
||||||
checkNoCompleteRefundDetail(storeOrderDetailIds, "售后完成状态的商品无法打印快递单");
|
List<Long> existsRefundDetailIds = checkNoCompleteRefundDetail(storeOrderDetailIds,
|
||||||
|
"售后完成状态的商品无法打印快递单");
|
||||||
ExpressManager expressManager = expressService.getExpressManager(expressId);
|
ExpressManager expressManager = expressService.getExpressManager(expressId);
|
||||||
Express express = expressService.getById(expressId);
|
Express express = expressService.getById(expressId);
|
||||||
if (!BeanValidators.exists(express) || !express.getSystemDeliverAccess()) {
|
if (!BeanValidators.exists(express) || !express.getSystemDeliverAccess()) {
|
||||||
|
|
@ -999,8 +1004,9 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
|
||||||
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
||||||
for (StoreOrderDetail containDetail : containDetails) {
|
for (StoreOrderDetail containDetail : containDetails) {
|
||||||
if (EDeliveryType.SHIP_COMPLETE.getValue().equals(order.getDeliveryType())) {
|
if (EDeliveryType.SHIP_COMPLETE.getValue().equals(order.getDeliveryType())) {
|
||||||
//如果是货齐再发,此次发货需要包含所有明细
|
//如果是货齐再发,此次发货需要包含所有明细(排除已存在售后的明细)
|
||||||
if (!storeOrderDetailIds.contains(containDetail.getId())) {
|
if (!storeOrderDetailIds.contains(containDetail.getId())
|
||||||
|
&& !existsRefundDetailIds.contains(containDetail.getId())) {
|
||||||
throw new ServiceException(CharSequenceUtil.format("订单[{}]不可拆单发货",
|
throw new ServiceException(CharSequenceUtil.format("订单[{}]不可拆单发货",
|
||||||
order.getOrderNo()));
|
order.getOrderNo()));
|
||||||
}
|
}
|
||||||
|
|
@ -1828,20 +1834,26 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
|
||||||
*
|
*
|
||||||
* @param orderDetailIds
|
* @param orderDetailIds
|
||||||
* @param errorMsg
|
* @param errorMsg
|
||||||
|
* @return 已存在售后的订单明细ID
|
||||||
*/
|
*/
|
||||||
private void checkNoCompleteRefundDetail(Collection<Long> orderDetailIds, String errorMsg) {
|
private List<Long> checkNoCompleteRefundDetail(Collection<Long> orderDetailIds, String errorMsg) {
|
||||||
if (CollUtil.isEmpty(orderDetailIds)) {
|
if (CollUtil.isEmpty(orderDetailIds)) {
|
||||||
return;
|
return ListUtil.empty();
|
||||||
}
|
}
|
||||||
List<StoreOrderDetail> refundDetails = storeOrderDetailMapper.selectList(Wrappers
|
List<StoreOrderDetail> refundDetails = storeOrderDetailMapper.selectList(Wrappers
|
||||||
.lambdaQuery(StoreOrderDetail.class)
|
.lambdaQuery(StoreOrderDetail.class)
|
||||||
.in(StoreOrderDetail::getOriginOrderDetailId, orderDetailIds)
|
.in(StoreOrderDetail::getOriginOrderDetailId, orderDetailIds)
|
||||||
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
.eq(SimpleEntity::getDelFlag, Constants.UNDELETED));
|
||||||
|
List<Long> existsRefundDetailIds = new ArrayList<>();
|
||||||
for (StoreOrderDetail refundDetail : refundDetails) {
|
for (StoreOrderDetail refundDetail : refundDetails) {
|
||||||
|
if (orderDetailIds.contains(refundDetail.getOriginOrderDetailId())) {
|
||||||
|
existsRefundDetailIds.add(refundDetail.getOriginOrderDetailId());
|
||||||
|
}
|
||||||
if (EOrderStatus.AFTER_SALE_COMPLETED.getValue().equals(refundDetail.getDetailStatus())) {
|
if (EOrderStatus.AFTER_SALE_COMPLETED.getValue().equals(refundDetail.getDetailStatus())) {
|
||||||
throw new ServiceException(errorMsg);
|
throw new ServiceException(errorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return existsRefundDetailIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue