|
@@ -205,7 +205,10 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
throw new XiaoShiException("文件错误");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
importTask.setProgress(0.0);
|
|
|
+ String taskName = this.setImportTaskName(importTaskCondition,personnelVO.getName());
|
|
|
+ importTask.setName(taskName);
|
|
|
importTask.insert();
|
|
|
|
|
|
schedulingTaskService.startTask();
|
|
@@ -221,18 +224,10 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
|
|
|
private void loadImportTask(List<ImportTaskVO> importTaskVOS) throws IOException {
|
|
|
List<String> createIds = new ArrayList<>();
|
|
|
- List<Integer> projectIds = new ArrayList<>();
|
|
|
- List<Integer> productIds = new ArrayList<>();
|
|
|
importTaskVOS.forEach(item -> {
|
|
|
if (item.getCreateId() != null) {
|
|
|
createIds.add(item.getCreateId());
|
|
|
}
|
|
|
- if (item.getProductId() != null) {
|
|
|
- productIds.add(item.getProductId());
|
|
|
- }
|
|
|
- if (item.getProjectId() != null) {
|
|
|
- projectIds.add(item.getProjectId());
|
|
|
- }
|
|
|
});
|
|
|
List<Personnel> personnels = new ArrayList<>();
|
|
|
List<Product> products = new ArrayList<>();
|
|
@@ -244,20 +239,6 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
personnels = JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
|
|
|
}
|
|
|
|
|
|
- //查询专题库或报告
|
|
|
- if (projects.size() != 0) {
|
|
|
- LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(Project::getId, projectIds);
|
|
|
- projects = projectService.list(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- //查询专题库或报告
|
|
|
- if (products.size() != 0) {
|
|
|
- LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(Product::getId, productIds);
|
|
|
- products = productService.list(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
LambdaQueryWrapper<SystemDict> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.eq(SystemDict::getGroupType, "IMPORT_TASK");
|
|
@@ -270,47 +251,6 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
importTaskVO.setCreateName(personnel.getPersonnelName());
|
|
|
}
|
|
|
|
|
|
- //装载名称
|
|
|
- String type = "";
|
|
|
- String toName = "";
|
|
|
- String to = "";
|
|
|
- String taskName = "";
|
|
|
- if (importTaskVO.getType().equals(2)) {
|
|
|
-// TaskCondition taskCondition = taskConditionService.getById(task.getTaskConditionId());
|
|
|
-// String conditions = taskCondition.getConditions();
|
|
|
-// String taskNameSuffix = conditions.substring(conditions.indexOf("AN=(") + 4, conditions.indexOf(")")).replace(" OR ", "|");
|
|
|
-// type = "专利号" + taskNameSuffix;
|
|
|
- type = "【专利号】";
|
|
|
- } else if (importTaskVO.getType().equals(3) || importTaskVO.getType().equals(4)) {
|
|
|
- type = "【检索式】";
|
|
|
- } else if (importTaskVO.getType().equals(1)) {
|
|
|
- type = "【Excel】";
|
|
|
- }
|
|
|
- if (importTaskVO.getProjectId() != null && importTaskVO.getProjectType().equals(0)) {
|
|
|
- to = "专题库";
|
|
|
- Project project = projects.stream().filter(item -> item.getId().equals(importTaskVO.getProjectId())).findFirst().orElse(null);
|
|
|
- if (project != null) {
|
|
|
- toName = project.getName();
|
|
|
- }
|
|
|
- } else if (importTaskVO.getProjectId() != null && importTaskVO.getProjectType().equals(1)) {
|
|
|
- to = "报告";
|
|
|
- Project project = projects.stream().filter(item -> item.getId().equals(importTaskVO.getProjectId())).findFirst().orElse(null);
|
|
|
- if (project != null) {
|
|
|
- toName = project.getName();
|
|
|
- }
|
|
|
- } else if (importTaskVO.getProductId() != null) {
|
|
|
- to = "产品";
|
|
|
- Product product = products.stream().filter(item -> item.getId().equals(importTaskVO.getProductId())).findFirst().orElse(null);
|
|
|
- if (product != null) {
|
|
|
- toName = product.getName();
|
|
|
- }
|
|
|
- }
|
|
|
- //导入任务
|
|
|
- taskName = type + "导入到" + to + "【" + toName + "】 - " + personnel.getPersonnelName();
|
|
|
-
|
|
|
- importTaskVO.setTaskName(taskName);
|
|
|
-
|
|
|
-
|
|
|
//装载状态
|
|
|
SystemDict systemDict1 = systemDictList.stream()
|
|
|
.filter(item -> item.getType().equals("IMPORT_TASK_TYPE") && item.getType()
|
|
@@ -329,4 +269,53 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private String setImportTaskName(ImportTaskCondition importTaskCondition,String name){
|
|
|
+
|
|
|
+
|
|
|
+ //装载名称
|
|
|
+ String type = "";
|
|
|
+ String toName = "";
|
|
|
+ String to = "";
|
|
|
+ String taskName = "";
|
|
|
+ if (importTaskCondition.getType().equals(2)) {
|
|
|
+
|
|
|
+ type = "【专利号】";
|
|
|
+ } else if (importTaskCondition.getType().equals(3) || importTaskCondition.getType().equals(4)) {
|
|
|
+ type = "【检索式】";
|
|
|
+ } else if (importTaskCondition.getType().equals(1)) {
|
|
|
+ type = "【Excel】";
|
|
|
+ }
|
|
|
+ if (importTaskCondition.getProjectId() != null && importTaskCondition.getProjectType().equals(0)) {
|
|
|
+ to = "专题库";
|
|
|
+ LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(Project::getId, importTaskCondition.getProjectId());
|
|
|
+ List<Project> projects = projectService.list(queryWrapper);
|
|
|
+ if (projects.size()!=0) {
|
|
|
+ toName = projects.get(0).getName();
|
|
|
+ }
|
|
|
+ } else if (importTaskCondition.getProjectId() != null && importTaskCondition.getProjectType().equals(1)) {
|
|
|
+ to = "报告";
|
|
|
+ LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(Project::getId, importTaskCondition.getProjectId());
|
|
|
+ List<Project> projects = projectService.list(queryWrapper);
|
|
|
+ if (projects.size()!=0) {
|
|
|
+ toName = projects.get(0).getName();
|
|
|
+ }
|
|
|
+ } else if (importTaskCondition.getProductId() != null) {
|
|
|
+ to = "产品";
|
|
|
+ LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(Product::getId, importTaskCondition.getProductId());
|
|
|
+ List<Product> products = productService.list(queryWrapper);
|
|
|
+ if (products.size()!=0) {
|
|
|
+ toName = products.get(0).getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //导入任务
|
|
|
+ taskName = type + "导入到" + to + "【" + toName + "】 - " + name;
|
|
|
+
|
|
|
+
|
|
|
+return taskName;
|
|
|
+ }
|
|
|
}
|