Commit f2095a1e0e2634292f057f38ef027f45b57e7ee8

Authored by wxy
1 parent caff71a3

优化数据查询,数据新增

juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java
@@ -115,52 +115,52 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra @@ -115,52 +115,52 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra
115 try { 115 try {
116 System.out.println("开始数据分析"); 116 System.out.println("开始数据分析");
117 long startTime = System.currentTimeMillis(); 117 long startTime = System.currentTimeMillis();
118 -// ExecutorService pool = Executors.newFixedThreadPool(8);  
119 -// CompletableFuture<Map<String, GaPunishVo>> f1 = CompletableFuture.supplyAsync(() -> gaPunishService.queryAll(), executor);  
120 -// CompletableFuture<List<SpecialStudentVo>> f2 = CompletableFuture.supplyAsync(() -> specialStudentService.queryList(), executor);  
121 -// CompletableFuture<List<String>> f3 = CompletableFuture.supplyAsync(() -> mzOrphanService.getIdentityS(), executor);  
122 -// CompletableFuture<List<String>> f4 = CompletableFuture.supplyAsync(() -> mzUnsupportedService.getIdentityS(), executor);  
123 -// CompletableFuture<List<String>> f5 = CompletableFuture.supplyAsync(() -> mzLeftBehindChildrenService.getIdentityS(), executor);  
124 -// CompletableFuture<List<String>> f6 = CompletableFuture.supplyAsync(() -> mzAdoptionService.getIdentityS(), executor);  
125 -// CompletableFuture<List<MrSchool>> f7 = CompletableFuture.supplyAsync(() -> highSchoolService.getList(), executor);  
126 -// CompletableFuture<List<MrSchool>> f8 = CompletableFuture.supplyAsync(() -> primarySchoolService.getList(), executor); 118 + ExecutorService pool = Executors.newFixedThreadPool(50);
  119 + CompletableFuture<Map<String, GaPunishVo>> f1 = CompletableFuture.supplyAsync(() -> gaPunishService.queryAll(), executor);
  120 + CompletableFuture<List<SpecialStudentVo>> f2 = CompletableFuture.supplyAsync(() -> specialStudentService.queryList(), executor);
  121 + CompletableFuture<List<String>> f3 = CompletableFuture.supplyAsync(() -> mzOrphanService.getIdentityS(), executor);
  122 + CompletableFuture<List<String>> f4 = CompletableFuture.supplyAsync(() -> mzUnsupportedService.getIdentityS(), executor);
  123 + CompletableFuture<List<String>> f5 = CompletableFuture.supplyAsync(() -> mzLeftBehindChildrenService.getIdentityS(), executor);
  124 + CompletableFuture<List<String>> f6 = CompletableFuture.supplyAsync(() -> mzAdoptionService.getIdentityS(), executor);
  125 + CompletableFuture<List<MrSchool>> f7 = CompletableFuture.supplyAsync(() -> highSchoolService.getList(), executor);
  126 + CompletableFuture<List<MrSchool>> f8 = CompletableFuture.supplyAsync(() -> primarySchoolService.getList(), executor);
127 //行政处罚数据 127 //行政处罚数据
128 - Map<String,GaPunishVo> gaPunishVos = gaPunishService.queryAll();  
129 -// Map<String, GaPunishVo> gaPunishVos = new HashMap<>();  
130 -// gaPunishVos.putAll(f1.get());  
131 - List<SpecialStudentVo> specialStudentVos = specialStudentService.queryList();  
132 -// List<SpecialStudentVo> specialStudentVos = new ArrayList<>();  
133 -// specialStudentVos.addAll(f2.get()); 128 +// Map<String,GaPunishVo> gaPunishVos = gaPunishService.queryAll();
  129 + Map<String, GaPunishVo> gaPunishVos = new HashMap<>();
  130 + gaPunishVos.putAll(f1.get());
  131 +// List<SpecialStudentVo> specialStudentVos = specialStudentService.queryList();
  132 + List<SpecialStudentVo> specialStudentVos = new ArrayList<>();
  133 + specialStudentVos.addAll(f2.get());
134 //孤儿数据 134 //孤儿数据
135 - List<String> mzOrphans = mzOrphanService.getIdentityS();  
136 -// List<String> mzOrphans = new ArrayList<>();  
137 -// mzOrphans.addAll(f3.get()); 135 +// List<String> mzOrphans = mzOrphanService.getIdentityS();
  136 + List<String> mzOrphans = new ArrayList<>();
  137 + mzOrphans.addAll(f3.get());
138 //无人抚养 138 //无人抚养
139 - List<String> mzUnsupporteds = mzUnsupportedService.getIdentityS();  
140 -// List<String> mzUnsupporteds = new ArrayList<>();  
141 -// mzUnsupporteds.addAll(f4.get()); 139 +// List<String> mzUnsupporteds = mzUnsupportedService.getIdentityS();
  140 + List<String> mzUnsupporteds = new ArrayList<>();
  141 + mzUnsupporteds.addAll(f4.get());
142 //留守儿童 142 //留守儿童
143 - List<String> mzLeftBehinds =mzLeftBehindChildrenService.getIdentityS();  
144 -// List<String> mzLeftBehinds = new ArrayList<>();  
145 -// mzLeftBehinds.addAll(f5.get()); 143 +// List<String> mzLeftBehinds =mzLeftBehindChildrenService.getIdentityS();
  144 + List<String> mzLeftBehinds = new ArrayList<>();
  145 + mzLeftBehinds.addAll(f5.get());
146 //领养 146 //领养
147 - List<String> mzAdoptions =mzAdoptionService.getIdentityS();  
148 -// List<String> mzAdoptions = new ArrayList<>();  
149 -// mzAdoptions.addAll(f6.get()); 147 +// List<String> mzAdoptions =mzAdoptionService.getIdentityS();
  148 + List<String> mzAdoptions = new ArrayList<>();
  149 + mzAdoptions.addAll(f6.get());
150 //获取初高中学生信息 150 //获取初高中学生信息
151 - List<MrSchool> highSchools = highSchoolService.getList();  
152 -// List<MrSchool> highSchools = new ArrayList<>();  
153 -// highSchools.addAll(f7.get()); 151 +// List<MrSchool> highSchools = highSchoolService.getList();
  152 + List<MrSchool> highSchools = new ArrayList<>();
  153 + highSchools.addAll(f7.get());
154 //获取幼小学生信息 154 //获取幼小学生信息
155 - List<MrSchool> primarySchools = primarySchoolService.getList();  
156 -// List<MrSchool> primarySchools = new ArrayList<>();  
157 -// primarySchools.addAll(f8.get()); 155 +// List<MrSchool> primarySchools = primarySchoolService.getList();
  156 + List<MrSchool> primarySchools = new ArrayList<>();
  157 + primarySchools.addAll(f8.get());
158 //人口基本信息小于18岁 158 //人口基本信息小于18岁
159 // Map<String,String> gaDemographics =gaDemographicService.getIdentityS(); 159 // Map<String,String> gaDemographics =gaDemographicService.getIdentityS();
160 // Map<String,String> gaDemographics =new HashMap<>(); 160 // Map<String,String> gaDemographics =new HashMap<>();
161 // gaDemographics.putAll(f9.get()); 161 // gaDemographics.putAll(f9.get());
162 //关闭线程池 162 //关闭线程池
163 -// pool.shutdown(); 163 + pool.shutdown();
164 Map<String, String> gaDemographics = gaDemographicService.getIdentityS(); 164 Map<String, String> gaDemographics = gaDemographicService.getIdentityS();
165 System.out.println("线程池查询用时" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); 165 System.out.println("线程池查询用时" + (System.currentTimeMillis() - startTime) / 1000 + "秒");
166 long startTime1 = System.currentTimeMillis(); 166 long startTime1 = System.currentTimeMillis();
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java
@@ -88,7 +88,7 @@ public class FamilyServiceImpl extends ServiceImpl&lt;FamilyMapper, Family&gt; impleme @@ -88,7 +88,7 @@ public class FamilyServiceImpl extends ServiceImpl&lt;FamilyMapper, Family&gt; impleme
88 88
89 public void updateStudentWithThreads(List<Family> list) { 89 public void updateStudentWithThreads(List<Family> list) {
90 // 线程数量 90 // 线程数量
91 - final Integer threadCount = 10; 91 + final Integer threadCount = 8;
92 92
93 //每个线程处理的数据量 93 //每个线程处理的数据量
94 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; 94 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount;
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java
@@ -153,7 +153,7 @@ public class MinorServiceImpl extends ServiceImpl&lt;MinorMapper, Minor&gt; implements @@ -153,7 +153,7 @@ public class MinorServiceImpl extends ServiceImpl&lt;MinorMapper, Minor&gt; implements
153 153
154 public void updateStudentWithThreads(List<Minor> list) { 154 public void updateStudentWithThreads(List<Minor> list) {
155 // 线程数量 155 // 线程数量
156 - final Integer threadCount = 10; 156 + final Integer threadCount = 8;
157 157
158 //每个线程处理的数据量 158 //每个线程处理的数据量
159 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; 159 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount;
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java
@@ -82,7 +82,7 @@ public class MrSchoolServiceImpl extends ServiceImpl&lt;MrSchoolMapper, MrSchool&gt; i @@ -82,7 +82,7 @@ public class MrSchoolServiceImpl extends ServiceImpl&lt;MrSchoolMapper, MrSchool&gt; i
82 82
83 public void updateStudentWithThreads(List<MrSchool> list) { 83 public void updateStudentWithThreads(List<MrSchool> list) {
84 // 线程数量 84 // 线程数量
85 - final Integer threadCount = 10; 85 + final Integer threadCount = 8;
86 86
87 //每个线程处理的数据量 87 //每个线程处理的数据量
88 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; 88 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount;