Browse Source

no message

FengChaoYu 8 months ago
parent
commit
030b76ac22

+ 22 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/settle/repair/DailyImportSummaryController.java

@@ -173,8 +173,17 @@ public class DailyImportSummaryController {
     @ApiOperation(value = "增减费用管理-执行")
     public ResponseHelper reduceCountDo(
             @ApiParam(required = true, value = "导入批次号") @RequestParam String importBatchNo
-    ) {
-        dailyImportSummaryLogic.reduceCountDo(importBatchNo);
+    ) throws Exception {
+        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_DAILY_SUMMARY);
+        if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
+            throw new RemoteServiceException("正在汇总中,请稍后再试");
+        }
+        try {
+            dailyImportSummaryLogic.reduceCountDo(importBatchNo);
+        } finally {
+            obtain.unlock();
+        }
+
         return ResponseHelper.success();
     }
 
@@ -182,8 +191,17 @@ public class DailyImportSummaryController {
     @ApiOperation(value = "增减费用明细-批量执行")
     public ResponseHelper reduceBatchDo(
             @ApiParam(required = true, value = "id") @RequestParam List<String> ids
-    ) {
-        dailyImportSummaryLogic.reduceBatchDo(ids);
+    ) throws Exception {
+        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_DAILY_SUMMARY);
+        if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
+            throw new RemoteServiceException("正在汇总中,请稍后再试");
+        }
+        try {
+            dailyImportSummaryLogic.reduceBatchDo(ids);
+        } finally {
+            obtain.unlock();
+        }
+
         return ResponseHelper.success();
     }