|
@@ -268,10 +268,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
throw new ServiceException("订单正在生产中,无法直接删除,需要走审批流程");
|
|
throw new ServiceException("订单正在生产中,无法直接删除,需要走审批流程");
|
|
}
|
|
}
|
|
|
|
|
|
- this.removeById(id);
|
|
|
|
- orderSkuService.remove(q -> q.eq(OrderSku::getOrderId, id));
|
|
|
|
- orderSkuBomService.remove(q -> q.eq(OrderSkuBom::getOrderId, id));
|
|
|
|
- orderPackageBomService.remove(q -> q.eq(OrderPackageBom::getOrderId, id));
|
|
|
|
|
|
+ // 删除订单以及订单关联数据
|
|
|
|
+ delete(id);
|
|
|
|
|
|
if (saveLog) {
|
|
if (saveLog) {
|
|
OrderOperatingLog orderOperatingLog = new OrderOperatingLog();
|
|
OrderOperatingLog orderOperatingLog = new OrderOperatingLog();
|
|
@@ -422,4 +420,33 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ @Override
|
|
|
|
+ public synchronized void deleteAndStore(Long id) {
|
|
|
|
+
|
|
|
|
+ OrderInfo orderInfo = getById(id);
|
|
|
|
+
|
|
|
|
+ if (orderInfo == null) {
|
|
|
|
+ throw new ServiceException("未找到订单");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ delete(id);
|
|
|
|
+
|
|
|
|
+ if (orderInfo.getStatus() <= OrderStatusEnum.STOCK_PREPARATION.getKey()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除订单以及订单关联数据
|
|
|
|
+ */
|
|
|
|
+ private void delete(Long id) {
|
|
|
|
+ this.removeById(id);
|
|
|
|
+ orderSkuService.remove(q -> q.eq(OrderSku::getOrderId, id));
|
|
|
|
+ orderSkuBomService.remove(q -> q.eq(OrderSkuBom::getOrderId, id));
|
|
|
|
+ orderPackageBomService.remove(q -> q.eq(OrderPackageBom::getOrderId, id));
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|