|
@@ -67,9 +67,6 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
private final TextdictInfoServiceImpl textDictInfoService;
|
|
|
private final InformationQueryClient informationQueryClient;
|
|
|
|
|
|
- //创建线程池任务
|
|
|
- private final ExecutorService executor = Executors.newFixedThreadPool(4);
|
|
|
-
|
|
|
@Override
|
|
|
public List<WbsTreePrivateVO> tree(String wbsId, String projectId) {
|
|
|
WbsInfo wbsInfo = wbsInfoMapper.selectOne(Wrappers.<WbsInfo>query().lambda().eq(WbsInfo::getId, wbsId));
|
|
@@ -810,32 +807,12 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
this.wbsParamServiceImpl.updateBatchById(updateList, 1000);
|
|
|
}
|
|
|
if (insertList.size() > 0) {
|
|
|
- try {
|
|
|
- List<List<WbsParam>> partition1 = Lists.partition(insertList, 1000);
|
|
|
- CompletionService<Void> completionService = new ExecutorCompletionService<>(executor);
|
|
|
- for (List<WbsParam> addList : partition1) {
|
|
|
- completionService.submit(() -> {
|
|
|
- wbsParamServiceImpl.insertBatch(addList, 1000);
|
|
|
- return null;
|
|
|
- });
|
|
|
- }
|
|
|
- for (int i = 0; i < partition1.size(); i++) {
|
|
|
- try {
|
|
|
- completionService.take().get();
|
|
|
- } catch (ExecutionException e) {
|
|
|
- // 异常处理
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- //释放线程
|
|
|
- executor.shutdown();
|
|
|
+ List<List<WbsParam>> partition1 = Lists.partition(insertList, 1000);
|
|
|
+ for (List<WbsParam> addList : partition1) {
|
|
|
+ wbsParamServiceImpl.insertBatch(addList, 1000);
|
|
|
}
|
|
|
-
|
|
|
+ return true;
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -1148,36 +1125,15 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
jdbcTemplate.execute(delSql);
|
|
|
}
|
|
|
|
|
|
- try {
|
|
|
- List<List<TextdictInfo>> partition1 = Lists.partition(insertData, 1000);
|
|
|
- CompletionService<Void> completionService = new ExecutorCompletionService<>(executor);
|
|
|
- for (List<TextdictInfo> addList : partition1) {
|
|
|
- completionService.submit(() -> {
|
|
|
- textDictInfoService.insertBatch(addList, 1000);
|
|
|
- return null;
|
|
|
- });
|
|
|
- }
|
|
|
- for (int i = 0; i < partition1.size(); i++) {
|
|
|
- try {
|
|
|
- completionService.take().get();
|
|
|
- } catch (ExecutionException e) {
|
|
|
- // 异常处理
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- //释放线程
|
|
|
- executor.shutdown();
|
|
|
+ List<List<TextdictInfo>> partition1 = Lists.partition(insertData, 1000);
|
|
|
+ for (List<TextdictInfo> addList : partition1) {
|
|
|
+ textDictInfoService.insertBatch(addList, 1000);
|
|
|
}
|
|
|
-
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- throw new ServiceException("当前项目关联的wbs树不是私有关联");
|
|
|
}
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("当前项目关联的wbs树不是私有关联");
|
|
|
}
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
@Override
|