From f2095a1e0e2634292f057f38ef027f45b57e7ee8 Mon Sep 17 00:00:00 2001 From: wxy <1229384355@qq.com> Date: Mon, 25 Jul 2022 11:19:05 +0800 Subject: [PATCH] 优化数据查询,数据新增 --- juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java | 68 ++++++++++++++++++++++++++++++++++---------------------------------- juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java | 2 +- juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java | 2 +- juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java | 2 +- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java index 62a2043..5f3e9f9 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java +++ b/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> f1 = CompletableFuture.supplyAsync(() -> gaPunishService.queryAll(), executor); -// CompletableFuture> f2 = CompletableFuture.supplyAsync(() -> specialStudentService.queryList(), executor); -// CompletableFuture> f3 = CompletableFuture.supplyAsync(() -> mzOrphanService.getIdentityS(), executor); -// CompletableFuture> f4 = CompletableFuture.supplyAsync(() -> mzUnsupportedService.getIdentityS(), executor); -// CompletableFuture> f5 = CompletableFuture.supplyAsync(() -> mzLeftBehindChildrenService.getIdentityS(), executor); -// CompletableFuture> f6 = CompletableFuture.supplyAsync(() -> mzAdoptionService.getIdentityS(), executor); -// CompletableFuture> f7 = CompletableFuture.supplyAsync(() -> highSchoolService.getList(), executor); -// CompletableFuture> f8 = CompletableFuture.supplyAsync(() -> primarySchoolService.getList(), executor); + ExecutorService pool = Executors.newFixedThreadPool(50); + CompletableFuture> f1 = CompletableFuture.supplyAsync(() -> gaPunishService.queryAll(), executor); + CompletableFuture> f2 = CompletableFuture.supplyAsync(() -> specialStudentService.queryList(), executor); + CompletableFuture> f3 = CompletableFuture.supplyAsync(() -> mzOrphanService.getIdentityS(), executor); + CompletableFuture> f4 = CompletableFuture.supplyAsync(() -> mzUnsupportedService.getIdentityS(), executor); + CompletableFuture> f5 = CompletableFuture.supplyAsync(() -> mzLeftBehindChildrenService.getIdentityS(), executor); + CompletableFuture> f6 = CompletableFuture.supplyAsync(() -> mzAdoptionService.getIdentityS(), executor); + CompletableFuture> f7 = CompletableFuture.supplyAsync(() -> highSchoolService.getList(), executor); + CompletableFuture> f8 = CompletableFuture.supplyAsync(() -> primarySchoolService.getList(), executor); //行政处罚数据 - Map gaPunishVos = gaPunishService.queryAll(); -// Map gaPunishVos = new HashMap<>(); -// gaPunishVos.putAll(f1.get()); - List specialStudentVos = specialStudentService.queryList(); -// List specialStudentVos = new ArrayList<>(); -// specialStudentVos.addAll(f2.get()); +// Map gaPunishVos = gaPunishService.queryAll(); + Map gaPunishVos = new HashMap<>(); + gaPunishVos.putAll(f1.get()); +// List specialStudentVos = specialStudentService.queryList(); + List specialStudentVos = new ArrayList<>(); + specialStudentVos.addAll(f2.get()); //孤儿数据 - List mzOrphans = mzOrphanService.getIdentityS(); -// List mzOrphans = new ArrayList<>(); -// mzOrphans.addAll(f3.get()); +// List mzOrphans = mzOrphanService.getIdentityS(); + List mzOrphans = new ArrayList<>(); + mzOrphans.addAll(f3.get()); //无人抚养 - List mzUnsupporteds = mzUnsupportedService.getIdentityS(); -// List mzUnsupporteds = new ArrayList<>(); -// mzUnsupporteds.addAll(f4.get()); +// List mzUnsupporteds = mzUnsupportedService.getIdentityS(); + List mzUnsupporteds = new ArrayList<>(); + mzUnsupporteds.addAll(f4.get()); //留守儿童 - List mzLeftBehinds =mzLeftBehindChildrenService.getIdentityS(); -// List mzLeftBehinds = new ArrayList<>(); -// mzLeftBehinds.addAll(f5.get()); +// List mzLeftBehinds =mzLeftBehindChildrenService.getIdentityS(); + List mzLeftBehinds = new ArrayList<>(); + mzLeftBehinds.addAll(f5.get()); //领养 - List mzAdoptions =mzAdoptionService.getIdentityS(); -// List mzAdoptions = new ArrayList<>(); -// mzAdoptions.addAll(f6.get()); +// List mzAdoptions =mzAdoptionService.getIdentityS(); + List mzAdoptions = new ArrayList<>(); + mzAdoptions.addAll(f6.get()); //获取初高中学生信息 - List highSchools = highSchoolService.getList(); -// List highSchools = new ArrayList<>(); -// highSchools.addAll(f7.get()); +// List highSchools = highSchoolService.getList(); + List highSchools = new ArrayList<>(); + highSchools.addAll(f7.get()); //获取幼小学生信息 - List primarySchools = primarySchoolService.getList(); -// List primarySchools = new ArrayList<>(); -// primarySchools.addAll(f8.get()); +// List primarySchools = primarySchoolService.getList(); + List primarySchools = new ArrayList<>(); + primarySchools.addAll(f8.get()); //人口基本信息小于18岁 // Map gaDemographics =gaDemographicService.getIdentityS(); // Map gaDemographics =new HashMap<>(); // gaDemographics.putAll(f9.get()); //关闭线程池 -// pool.shutdown(); + pool.shutdown(); Map gaDemographics = gaDemographicService.getIdentityS(); System.out.println("线程池查询用时" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); long startTime1 = System.currentTimeMillis(); diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java index 4fe8517..093a12f 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java +++ b/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 impleme public void updateStudentWithThreads(List list) { // 线程数量 - final Integer threadCount = 10; + final Integer threadCount = 8; //每个线程处理的数据量 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java index 05194c8..4fb8b3d 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java +++ b/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 implements public void updateStudentWithThreads(List list) { // 线程数量 - final Integer threadCount = 10; + final Integer threadCount = 8; //每个线程处理的数据量 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java index 18f81e5..6a90261 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java +++ b/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 i public void updateStudentWithThreads(List list) { // 线程数量 - final Integer threadCount = 10; + final Integer threadCount = 8; //每个线程处理的数据量 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; -- libgit2 0.21.4