|
@@ -33,7 +33,6 @@ import javax.annotation.Resource;
|
33
|
33
|
import javax.servlet.http.HttpServletRequest;
|
34
|
34
|
import javax.servlet.http.HttpServletResponse;
|
35
|
35
|
import java.util.ArrayList;
|
36
|
|
-import java.util.Comparator;
|
37
|
36
|
import java.util.List;
|
38
|
37
|
import java.util.concurrent.CompletableFuture;
|
39
|
38
|
|
|
@@ -61,8 +60,8 @@ public class AdTheatreController extends BaseController{
|
61
|
60
|
private AdMediaService adMediaService;
|
62
|
61
|
@Resource
|
63
|
62
|
private AdTheatreTvStatService adTheatreTvStatService;
|
64
|
|
- @Resource
|
65
|
|
- private TaskExecutor batchExecutor;
|
|
63
|
+ @Resource
|
|
64
|
+ private TaskExecutor taskExecutor;
|
66
|
65
|
|
67
|
66
|
/**
|
68
|
67
|
* to 列表页面
|
|
@@ -262,15 +261,10 @@ public class AdTheatreController extends BaseController{
|
262
|
261
|
}
|
263
|
262
|
// 入库
|
264
|
263
|
List<AdTheatre> adTheatres = adTheatreService.batchAdd(list, tvList);
|
265
|
|
-
|
266
|
|
-
|
267
|
|
- //同步统计数据
|
268
|
|
- for (AdTheatre adTheatre:adTheatres) {
|
269
|
|
- adTheatreTvStatService.saveStatByTheatreTv(adTheatre);
|
270
|
|
- }
|
271
|
|
-
|
272
|
264
|
// 判断执行结果
|
273
|
265
|
if (adTheatres != null) {
|
|
266
|
+ //异步统计数据
|
|
267
|
+ asyncBatchSaveStatByTheatreTv(adTheatres);
|
274
|
268
|
request.setAttribute("repeat", 0);
|
275
|
269
|
request.setAttribute("code", Constants.CODE_SUCCESS);
|
276
|
270
|
request.setAttribute("msg", msg);
|
|
@@ -288,4 +282,12 @@ public class AdTheatreController extends BaseController{
|
288
|
282
|
return returnHtml;
|
289
|
283
|
}
|
290
|
284
|
|
|
285
|
+ // 异步统计数据
|
|
286
|
+ private void asyncBatchSaveStatByTheatreTv(List<AdTheatre> adTheatres) {
|
|
287
|
+ CompletableFuture.runAsync(() -> {
|
|
288
|
+ for (AdTheatre adTheatre:adTheatres) {
|
|
289
|
+ adTheatreTvStatService.saveStatByTheatreTv(adTheatre);
|
|
290
|
+ }
|
|
291
|
+ }, taskExecutor);
|
|
292
|
+ }
|
291
|
293
|
}
|