‘linchangsheng’ 2 周之前
父節點
當前提交
f3b6dbb046
共有 1 個文件被更改,包括 23 次插入0 次删除
  1. 23 0
      mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/order/PayOrderLogic.java

+ 23 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/order/PayOrderLogic.java

@@ -1061,13 +1061,36 @@ public class PayOrderLogic {
 
     }
 
+    @Transactional(rollbackFor = Exception.class)
     public void cancel(String orderId) {
         if (workerOrderService.lambdaQuery().eq(WorkerOrder::getOrderId,orderId)
                 .eq(WorkerOrder::getPayStatus,"WAIT").count() < 1){
             throw new RemoteServiceException("订单不属于未支付不可取消");
         }
+        WorkerOrder workerOrder = workerOrderService.getById(orderId);
+
         workerOrderService.lambdaUpdate().eq(WorkerOrder::getOrderId,orderId)
                 .set(WorkerOrder::getPayStatus,"CANCEL").update();
+
+        if (!StringUtil.isEmpty(workerOrder.getWorkerOrderId())) {
+            Integer count = workerOrderService.lambdaQuery()
+                    .eq(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
+                    .isNotNull(WorkerOrder::getGreeOrderId)
+                    .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
+                    .count();
+            if (count > 0){
+                Integer countWait = workerOrderService.lambdaQuery()
+                        .eq(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
+                        .eq(WorkerOrder::getPayStatus, PayStatusEnum.WAIT.getKey())
+                        .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
+                        .count();
+
+                if (countWait < 1)
+                    throw new RemoteServiceException("存在4.0辅材支付单,请必须支付");
+            }
+        }
+
+
     }
 
     public List<SysDictCompany> sysDict(String dictType, String status) {