Browse Source

去除import

chenjz 3 years ago
parent
commit
db439a80ed

+ 12 - 10
src/main/java/com/ylcm/sys/controller/AdTheatreController.java

@@ -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
 }

+ 0 - 1
src/main/java/com/ylcm/sys/service/AdTheatreTvStatService.java

@@ -3,7 +3,6 @@ package com.ylcm.sys.service;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5 5
 import com.ylcm.sys.domain.AdTheatre;
6
-import com.ylcm.sys.domain.AdTheatreTv;
7 6
 import com.ylcm.sys.domain.AdTheatreTvStat;
8 7
 import com.ylcm.sys.form.AdTheatreAnalysisDetailQueryForm;
9 8
 import com.ylcm.sys.form.AdTheatreAnalysisQueryForm;

+ 28 - 0
yangguang.iml

@@ -1,5 +1,33 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
+  <component name="FacetManager">
4
+    <facet type="jpa" name="JPA">
5
+      <configuration>
6
+        <setting name="validation-enabled" value="true" />
7
+        <datasource-mapping>
8
+          <factory-entry name="yangguang" />
9
+        </datasource-mapping>
10
+        <naming-strategy-map />
11
+      </configuration>
12
+    </facet>
13
+    <facet type="web" name="Web">
14
+      <configuration>
15
+        <descriptors>
16
+          <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" />
17
+        </descriptors>
18
+        <webroots>
19
+          <root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
20
+        </webroots>
21
+        <sourceRoots>
22
+          <root url="file://$MODULE_DIR$/src/main/java" />
23
+          <root url="file://$MODULE_DIR$/src/main/resource" />
24
+        </sourceRoots>
25
+      </configuration>
26
+    </facet>
27
+    <facet type="Spring" name="Spring">
28
+      <configuration />
29
+    </facet>
30
+  </component>
3 31
   <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4 32
     <output url="file://$MODULE_DIR$/target/classes" />
5 33
     <output-test url="file://$MODULE_DIR$/target/test-classes" />