|
@@ -17,6 +17,7 @@ import org.jeecg.modules.message.websocket.WebSocket;
|
|
|
import org.jeecg.modules.projectImportList.readListener.ProjectChbImportReadListener;
|
|
|
import org.jeecg.modules.projectKmbh.entity.KzksProjectKmbh;
|
|
|
import org.jeecg.modules.wzOutboundOrderBNew.entity.WzOutboundOrderBNew;
|
|
|
+import org.jeecg.modules.wzOutboundOrderBNew.entity.WzOutboundOrderBNewExport;
|
|
|
import org.jeecg.modules.wzOutboundOrderBNew.mapper.WzOutboundOrderBNewMapper;
|
|
|
import org.jeecg.modules.wzOutboundOrderBNew.monitor.WzOutboundOrderBNewListenerS;
|
|
|
import org.jeecg.modules.wzOutboundOrderBNew.monitor.WzOutboundOrderBNewListerner;
|
|
@@ -31,7 +32,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
|
/**
|
|
@@ -81,4 +84,106 @@ public class WzOutboundOrderBNewServiceImpl extends ServiceImpl<WzOutboundOrderB
|
|
|
return Result.ok("文件导入成功!");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<WzOutboundOrderBNewExport> getClfDetailIfBoss1(String nowMonth) {
|
|
|
+ ArrayList<WzOutboundOrderBNewExport> resultList = new ArrayList<>();
|
|
|
+
|
|
|
+ ExecutorService threadPoolExecutors = Executors.newFixedThreadPool(8);
|
|
|
+
|
|
|
+ int wzSize = orderBNewMapper.getCountClfDetail(nowMonth); // 当前月份一共有多少条物资数据
|
|
|
+ log.info("开始进行分片查询,共{}条数据",wzSize);
|
|
|
+ int threadCount = 8; // 开8个线程处理
|
|
|
+
|
|
|
+ int baseBatchSize = wzSize / threadCount; // 每个线程处理的数量
|
|
|
+ int remaining = wzSize % threadCount; // 余数
|
|
|
+ int currentIndex = 0; // 起始索引
|
|
|
+
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+
|
|
|
+ for (int i = 0; i < threadCount; i++) {
|
|
|
+ int batchSize = baseBatchSize;
|
|
|
+ if (remaining > 0){
|
|
|
+ batchSize += 1;
|
|
|
+ remaining -= 1;
|
|
|
+ }
|
|
|
+ map.put(String.valueOf(i), currentIndex + "-" + batchSize);
|
|
|
+ currentIndex += batchSize;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (!map.get("0").isEmpty()){
|
|
|
+ String[] split = map.get("0").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!map.get("1").isEmpty()){
|
|
|
+ String[] split = map.get("1").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!map.get("2").isEmpty()){
|
|
|
+ String[] split = map.get("2").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!map.get("3").isEmpty()){
|
|
|
+ String[] split = map.get("3").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!map.get("4").isEmpty()){
|
|
|
+ String[] split = map.get("4").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!map.get("5").isEmpty()){
|
|
|
+ String[] split = map.get("5").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!map.get("6").isEmpty()){
|
|
|
+ String[] split = map.get("6").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!map.get("7").isEmpty()){
|
|
|
+ String[] split = map.get("7").split("-");
|
|
|
+ threadPoolExecutors.submit(() -> {
|
|
|
+ List<WzOutboundOrderBNewExport> list = orderBNewMapper.getClfDetailIfBoss1ByOffset(nowMonth,Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
|
|
+ resultList.addAll(list);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ threadPoolExecutors.shutdown();
|
|
|
+ boolean b = threadPoolExecutors.awaitTermination(5, TimeUnit.HOURS);
|
|
|
+ log.info("查询结束");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ } finally {
|
|
|
+ threadPoolExecutors.shutdown();
|
|
|
+ }
|
|
|
+
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
}
|