Commit e0f80c905e3408bc5d0c6723e5cd16df58352ab5
1 parent
62156ef2
去除多余的import
Showing
2 changed files
with
44 additions
and
78 deletions
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java
| 1 | 1 | package org.jeecg.modules.system.controller; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | -import com.google.common.collect.Sets; | |
| 5 | 4 | import io.swagger.annotations.Api; |
| 6 | 5 | import io.swagger.annotations.ApiOperation; |
| 7 | 6 | import lombok.extern.slf4j.Slf4j; |
| 8 | -import org.apache.logging.log4j.util.Strings; | |
| 9 | 7 | import org.apache.shiro.SecurityUtils; |
| 10 | 8 | import org.jeecg.common.api.vo.Result; |
| 11 | 9 | import org.jeecg.common.aspect.annotation.AutoLog; |
| 12 | 10 | import org.jeecg.common.system.base.controller.JeecgController; |
| 13 | -import org.jeecg.common.system.vo.DictModel; | |
| 14 | 11 | import org.jeecg.common.system.vo.LoginUser; |
| 15 | 12 | import org.jeecg.common.util.oConvertUtils; |
| 16 | 13 | import org.jeecg.modules.system.entity.*; |
| 17 | 14 | import org.jeecg.modules.system.service.*; |
| 18 | -import org.jeecg.modules.system.util.DoTaskThread; | |
| 19 | 15 | import org.jeecg.modules.system.util.IDNumberUtil; |
| 20 | -import org.jeecg.modules.system.util.MultiThreadUtil; | |
| 21 | -import org.jeecg.modules.system.util.TaskThreadQuery; | |
| 22 | -import org.jeecg.modules.system.vo.FamilyVo; | |
| 23 | 16 | import org.jeecg.modules.system.vo.GaPunishVo; |
| 24 | 17 | import org.jeecg.modules.system.vo.SpecialStudentVo; |
| 25 | 18 | import org.springframework.web.bind.annotation.*; |
| 26 | 19 | |
| 27 | 20 | import javax.annotation.Resource; |
| 28 | -import java.text.SimpleDateFormat; | |
| 29 | 21 | import java.util.*; |
| 30 | 22 | import java.util.concurrent.*; |
| 31 | -import java.util.stream.Collectors; | |
| 32 | -import java.util.stream.Stream; | |
| 23 | + | |
| 33 | 24 | |
| 34 | 25 | |
| 35 | 26 | /** |
| ... | ... | @@ -189,49 +180,49 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 189 | 180 | } |
| 190 | 181 | } |
| 191 | 182 | |
| 192 | - public Map<String,Family> queryByThread() { | |
| 193 | - Map<String,Family> familyMap = new HashMap<>(); | |
| 194 | - try { | |
| 195 | - long startTime = System.currentTimeMillis(); | |
| 196 | - // 数据集合大小,由调用者自己指定 | |
| 197 | - int listSize = gaDemographicService.count(); | |
| 198 | - // 开启的线程数 | |
| 199 | - int runSize = 25; | |
| 200 | - // 一个线程处理数据条数,如果库中有100条数据,开启20个线程,那么每一个线程执行的条数就是5条 | |
| 201 | - int count = listSize / runSize;//5 | |
| 202 | - // 创建一个线程池,数量和开启线程的数量一样 | |
| 203 | - ExecutorService executor = MultiThreadUtil.createThread(runSize); | |
| 204 | - // 计算sql语句中每个分页查询的起始和结束数据下标 | |
| 205 | - // 循环创建线程 | |
| 206 | - //此处调用具体的查询方法 | |
| 207 | - List<Callable<Map<String,Family>>> taskList = new ArrayList<Callable<Map<String,Family>>>();//创建任务 | |
| 208 | - System.out.println("开始查询线程总数" + runSize); | |
| 209 | - for (int i = 0; i < runSize; i++) { | |
| 210 | - int index = i * count; | |
| 211 | - int num = count; | |
| 212 | - Callable<Map<String,Family>> task= new DoTaskThread(gaDemographicService,index, num);//条件查询,name没有就给null | |
| 213 | - taskList.add(task); | |
| 214 | - } | |
| 215 | - List<Future<Map<String,Family>>> futureList = executor.invokeAll(taskList); | |
| 216 | - System.out.println(futureList.size()); | |
| 217 | - if (futureList != null && futureList.size() > 0){ | |
| 218 | - for (Future<Map<String,Family>> future:futureList) { | |
| 219 | - if(future.get() != null) { | |
| 220 | - familyMap.putAll(future.get()); | |
| 221 | - } | |
| 222 | - } | |
| 223 | - } | |
| 224 | - executor.shutdown();//关闭线程 | |
| 225 | - long endTime = System.currentTimeMillis(); | |
| 226 | - long s = ((endTime - startTime) / 1000); | |
| 227 | - System.out.println(runSize + "个线程查询花了" + s + "秒" ); | |
| 228 | - System.out.println("总条数"+familyMap.size() ); | |
| 229 | - } catch (Exception e) { | |
| 230 | - e.printStackTrace(); | |
| 231 | - log.info(String.valueOf(e)); | |
| 232 | - } | |
| 233 | - return familyMap; | |
| 234 | - } | |
| 183 | +// public Map<String,Family> queryByThread() { | |
| 184 | +// Map<String,Family> familyMap = new HashMap<>(); | |
| 185 | +// try { | |
| 186 | +// long startTime = System.currentTimeMillis(); | |
| 187 | +// // 数据集合大小,由调用者自己指定 | |
| 188 | +// int listSize = gaDemographicService.count(); | |
| 189 | +// // 开启的线程数 | |
| 190 | +// int runSize = 25; | |
| 191 | +// // 一个线程处理数据条数,如果库中有100条数据,开启20个线程,那么每一个线程执行的条数就是5条 | |
| 192 | +// int count = listSize / runSize;//5 | |
| 193 | +// // 创建一个线程池,数量和开启线程的数量一样 | |
| 194 | +// ExecutorService executor = MultiThreadUtil.createThread(runSize); | |
| 195 | +// // 计算sql语句中每个分页查询的起始和结束数据下标 | |
| 196 | +// // 循环创建线程 | |
| 197 | +// //此处调用具体的查询方法 | |
| 198 | +// List<Callable<Map<String,Family>>> taskList = new ArrayList<Callable<Map<String,Family>>>();//创建任务 | |
| 199 | +// System.out.println("开始查询线程总数" + runSize); | |
| 200 | +// for (int i = 0; i < runSize; i++) { | |
| 201 | +// int index = i * count; | |
| 202 | +// int num = count; | |
| 203 | +// Callable<Map<String,Family>> task= new DoTaskThread(gaDemographicService,index, num);//条件查询,name没有就给null | |
| 204 | +// taskList.add(task); | |
| 205 | +// } | |
| 206 | +// List<Future<Map<String,Family>>> futureList = executor.invokeAll(taskList); | |
| 207 | +// System.out.println(futureList.size()); | |
| 208 | +// if (futureList != null && futureList.size() > 0){ | |
| 209 | +// for (Future<Map<String,Family>> future:futureList) { | |
| 210 | +// if(future.get() != null) { | |
| 211 | +// familyMap.putAll(future.get()); | |
| 212 | +// } | |
| 213 | +// } | |
| 214 | +// } | |
| 215 | +// executor.shutdown();//关闭线程 | |
| 216 | +// long endTime = System.currentTimeMillis(); | |
| 217 | +// long s = ((endTime - startTime) / 1000); | |
| 218 | +// System.out.println(runSize + "个线程查询花了" + s + "秒" ); | |
| 219 | +// System.out.println("总条数"+familyMap.size() ); | |
| 220 | +// } catch (Exception e) { | |
| 221 | +// e.printStackTrace(); | |
| 222 | +// log.info(String.valueOf(e)); | |
| 223 | +// } | |
| 224 | +// return familyMap; | |
| 225 | +// } | |
| 235 | 226 | |
| 236 | 227 | /** |
| 237 | 228 | * 来源数据 | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/TenantContext.java deleted
| 1 | -//package org.jeecg.modules.system.util; | |
| 2 | -// | |
| 3 | -//import lombok.extern.slf4j.Slf4j; | |
| 4 | -// | |
| 5 | -///** | |
| 6 | -// * 多租户 tenant_id存储器 | |
| 7 | -// */ | |
| 8 | -//@Slf4j | |
| 9 | -//public class TenantContext { | |
| 10 | -// | |
| 11 | -// private static ThreadLocal<String> currentTenant = new ThreadLocal<>(); | |
| 12 | -// | |
| 13 | -// public static void setTenant(String tenant) { | |
| 14 | -// log.debug(" setting tenant to " + tenant); | |
| 15 | -// currentTenant.set(tenant); | |
| 16 | -// } | |
| 17 | -// | |
| 18 | -// public static String getTenant() { | |
| 19 | -// return currentTenant.get(); | |
| 20 | -// } | |
| 21 | -// | |
| 22 | -// public static void clear(){ | |
| 23 | -// currentTenant.remove(); | |
| 24 | -// } | |
| 25 | -//} |