‘linchangsheng’ 2 hafta önce
ebeveyn
işleme
d74c4e9b4e

+ 15 - 18
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/order/PayOrderLogic.java

@@ -399,22 +399,20 @@ public class PayOrderLogic {
 
         workerOrderDetail.setIfCancel(true);
         if (!StringUtil.isEmpty(workerOrder.getWorkerOrderId())) {
-            Integer count = workerOrderService.lambdaQuery()
-                    .eq(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
+            WorkerOrder workerOrderOne = workerOrderService.lambdaQuery()
                     .isNotNull(WorkerOrder::getGreeOrderId)
-                    .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
-                    .count();
-            if (count > 0){
+                    .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
+                    .last("limit 1").one();
+            if (workerOrderOne != null){
                 Integer countWait = workerOrderService.lambdaQuery()
-                        .eq(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
+                        .ge(WorkerOrder::getTotalAmount, workerOrderOne.getTotalAmount())
                         .eq(WorkerOrder::getPayStatus, PayStatusEnum.WAIT.getKey())
-                        .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
+                        .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
                         .count();
 
                 if (countWait < 2){
                     workerOrderDetail.setIfCancel(false);
                 }
-
             }
         }
 
@@ -936,14 +934,13 @@ public class PayOrderLogic {
 
             workerOrderDetail.setIfCancel(true);
             if (!StringUtil.isEmpty(workerOrderDetail.getWorkerOrderId())) {
-                Integer count = workerOrderService.lambdaQuery()
-                        .eq(WorkerOrder::getTotalAmount, workerOrderDetail.getTotalAmount())
+                WorkerOrder workerOrder = workerOrderService.lambdaQuery()
                         .isNotNull(WorkerOrder::getGreeOrderId)
                         .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
-                        .count();
-                if (count > 0){
+                        .last("limit 1").one();
+                if (workerOrder != null){
                     Integer countWait = workerOrderService.lambdaQuery()
-                            .eq(WorkerOrder::getTotalAmount, workerOrderDetail.getTotalAmount())
+                            .ge(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
                             .eq(WorkerOrder::getPayStatus, PayStatusEnum.WAIT.getKey())
                             .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
                             .count();
@@ -1137,14 +1134,14 @@ public class PayOrderLogic {
                 .set(WorkerOrder::getPayStatus,"CANCEL").update();
 
         if (!StringUtil.isEmpty(workerOrder.getWorkerOrderId())) {
-            Integer count = workerOrderService.lambdaQuery()
-                    .eq(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
+            WorkerOrder workerOrderOne = workerOrderService.lambdaQuery()
                     .isNotNull(WorkerOrder::getGreeOrderId)
                     .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
-                    .count();
-            if (count > 0){
+                    .last("limit 1").one();
+            if (workerOrderOne != null){
+
                 Integer countWait = workerOrderService.lambdaQuery()
-                        .eq(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
+                        .ge(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
                         .eq(WorkerOrder::getPayStatus, PayStatusEnum.WAIT.getKey())
                         .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
                         .count();