Browse Source

分销团长订单列表 异步

zhaoxian 11 months ago
parent
commit
674d31020e

+ 25 - 7
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -2010,8 +2010,7 @@ public class SupplyChainController extends BaseController {
         os.flush();
         os.close();
     }
-
-
+    static ExecutorService addListCService = Executors.newFixedThreadPool(5);
     /**
      * 接口链接:
      * https://open.kwaixiaodian.com/zone/new/docs/api?name=open.distribution.investment.activity.open.close&version=1
@@ -2019,11 +2018,30 @@ public class SupplyChainController extends BaseController {
     @GetMapping("/addList")
     @ApiOperation(value = "分销团长订单列表(游标方式)")
     public void addList(String beginDate, String endDate) {
-        try {
-            supplyChainService.addList(beginDate, endDate, "");
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
+        List<String> allDatesOfTwoTimes = DateUtils.getAllDatesOfTwoTimes(beginDate, endDate);
+        allDatesOfTwoTimes.forEach(date -> addListCService.submit(() -> {
+            try {
+                supplyChainService.addList(date, date, "");
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }));
+    }
+
+    @GetMapping("/addListC")
+    @ApiOperation(value = "多日期本地调试---分销团长订单列表")
+    public void addListC(String beginDate, String endDate) {
+        List<String> allDatesOfTwoTimes = DateUtils.getAllDatesOfTwoTimes(beginDate, endDate);
+        allDatesOfTwoTimes.forEach(date -> addListCService.submit(() -> {
+            try {
+                long currentTimeMillis = System.currentTimeMillis();
+                System.out.println(date + "开始执行ing...");
+                supplyChainService.addList(date, date, "");
+                System.out.println(date + "用时:" + (System.currentTimeMillis() - currentTimeMillis) / 60000 + "分");
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }));
     }
 
     static ExecutorService fxNowService = Executors.newFixedThreadPool(3);