|
@@ -82,6 +82,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
@Override
|
|
|
public Object queryMessage(QueryRequest queryRequest) throws Exception {
|
|
|
List<String> sqls = formatQueryService.reSqls(queryRequest, "importTask");
|
|
|
+ this.loadSearchSql(sqls,queryRequest.getProjectId());
|
|
|
//根据sql查询事件信息
|
|
|
List<ImportTaskVO> importTaskVOS = importTaskMapper.getImportTask(sqls.get(0), sqls.get(1), sqls.get(2));
|
|
|
//查询总数
|
|
@@ -136,7 +137,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
if (importTaskDTO.getType() == null) {
|
|
|
importTaskDTO.setType(4);
|
|
|
}
|
|
|
- List<String> addPatentNos =importTaskDTO.getPatentNos();
|
|
|
+ List<String> addPatentNos = importTaskDTO.getPatentNos();
|
|
|
ImportTaskCondition importTaskCondition = new ImportTaskCondition();
|
|
|
if (importTaskDTO.getImportToId() != null) {
|
|
|
if (importTaskDTO.getImportToType().equals(0)) {
|
|
@@ -206,26 +207,26 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
throw new XiaoShiException("文件错误");
|
|
|
}
|
|
|
} else if (importTaskCondition.getType().equals(4)) {
|
|
|
- try {if(addPatentNos==null||addPatentNos.size()==0) {
|
|
|
- PatentStarListDTO patentStarListDto = new PatentStarListDTO()
|
|
|
- .setCurrentQuery(importTaskCondition.getSearchCondition())
|
|
|
- .setOrderBy(importTaskCondition.getOrderBy())
|
|
|
- .setOrderByType(importTaskCondition.getOrderByType())
|
|
|
- .setPageNum(1)
|
|
|
- .setRowCount(50)
|
|
|
- .setDBType(importTaskCondition.getDbType());
|
|
|
-
|
|
|
- //调用一般接口返回一批专利著录相关数据
|
|
|
- Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
- if (resultMap == null || (Integer) resultMap.get("total") == 0) {
|
|
|
- ThrowException.throwXiaoShiException("未检索到相关专利");
|
|
|
+ try {
|
|
|
+ if (addPatentNos == null || addPatentNos.size() == 0) {
|
|
|
+ PatentStarListDTO patentStarListDto = new PatentStarListDTO()
|
|
|
+ .setCurrentQuery(importTaskCondition.getSearchCondition())
|
|
|
+ .setOrderBy(importTaskCondition.getOrderBy())
|
|
|
+ .setOrderByType(importTaskCondition.getOrderByType())
|
|
|
+ .setPageNum(1)
|
|
|
+ .setRowCount(50)
|
|
|
+ .setDBType(importTaskCondition.getDbType());
|
|
|
+
|
|
|
+ //调用一般接口返回一批专利著录相关数据
|
|
|
+ Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
+ if (resultMap == null || (Integer) resultMap.get("total") == 0) {
|
|
|
+ ThrowException.throwXiaoShiException("未检索到相关专利");
|
|
|
+ } else {
|
|
|
+ importTask.setAllNum((Integer) resultMap.get("total"));
|
|
|
+ }
|
|
|
} else {
|
|
|
- importTask.setAllNum((Integer) resultMap.get("total"));
|
|
|
+ importTask.setAllNum(addPatentNos.size());
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- importTask.setAllNum(addPatentNos.size());
|
|
|
- }
|
|
|
} catch (Exception e) {
|
|
|
throw new XiaoShiException("文件错误");
|
|
|
}
|
|
@@ -382,7 +383,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
ImportTask importTask = this.getById(taskId);
|
|
|
importTask.setState(state);
|
|
|
importTask.updateById();
|
|
|
- if (state.equals(4)||state.equals(5)) {
|
|
|
+ if (state.equals(4) || state.equals(5)) {
|
|
|
schedulingTaskService.pauseTask(taskId, state);
|
|
|
}
|
|
|
if (state.equals(0)) {
|
|
@@ -391,7 +392,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
|
|
|
}
|
|
|
|
|
|
- public Integer addExportTask(ExportTaskDTO exportTaskDTO){
|
|
|
+ public Integer addExportTask(ExportTaskDTO exportTaskDTO) {
|
|
|
if (exportTaskDTO == null) {
|
|
|
throw new XiaoShiException("入参不能为空");
|
|
|
}
|
|
@@ -417,7 +418,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
String name = "";
|
|
|
if (exportTaskDTO.getType().equals(6)) {
|
|
|
name = "【专利】";
|
|
|
- } else if (exportTaskDTO.getType().equals(7)){
|
|
|
+ } else if (exportTaskDTO.getType().equals(7)) {
|
|
|
name = "【PDF首页】";
|
|
|
}
|
|
|
String importTaskName = "导出" + name + "-" + exportTaskDTO.getCreateName();
|
|
@@ -430,7 +431,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
}
|
|
|
|
|
|
|
|
|
- public Integer updateExportTask(ExportTaskDTO exportTaskDTO){
|
|
|
+ public Integer updateExportTask(ExportTaskDTO exportTaskDTO) {
|
|
|
if (exportTaskDTO == null) {
|
|
|
throw new XiaoShiException("入参不能为空");
|
|
|
}
|
|
@@ -451,4 +452,36 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
|
|
|
}
|
|
|
return importTask.getId();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //装载查询语句
|
|
|
+ private List<String> loadSearchSql(List<String> sqls,Integer projectId) {
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
+ String id = personnelVO.getId();
|
|
|
+ String rootSql = "";
|
|
|
+
|
|
|
+ if (sqls.get(0) == null || projectId==null) {
|
|
|
+ rootSql = "it.create_id=" + id;
|
|
|
+ } else {
|
|
|
+ Project project =projectService.getById(projectId);
|
|
|
+ if(project==null){
|
|
|
+ throw new XiaoShiException("未查询到专题库");
|
|
|
+ }
|
|
|
+ String createId =project.getCreateId();
|
|
|
+ String headId =project.getHeadId();
|
|
|
+ if(createId!=id&&headId!=id){
|
|
|
+ rootSql = "it.create_id=" + id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (sqls.get(0) != null && !sqls.get(0).equals("") && !rootSql.equals("")) {
|
|
|
+ sqls.set(0, rootSql + " and " + "(" + sqls.get(0) + ")");
|
|
|
+ } else if ((sqls.get(0) == null || sqls.get(0).equals("")) && !rootSql.equals("")) {
|
|
|
+ sqls.set(0, rootSql);
|
|
|
+ }
|
|
|
+
|
|
|
+ return sqls;
|
|
|
+
|
|
|
+ }
|
|
|
}
|