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