Преглед изворни кода

产品导入专利与查询产品的导入任务

chendayu пре 2 година
родитељ
комит
2896e167c1

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/QueryTaskVO.java

@@ -158,6 +158,10 @@ public class QueryTaskVO implements Serializable {
      * 报告名称
      */
     private String reportName;
+    /**
+     * 产品名称
+     */
+    private String productName;
 
     //以下属性是两张表都没有的(值为:任务表使用的oldName、任务条件表由手动装载生成)
     /**

+ 22 - 27
PAS/src/main/java/cn/cslg/pas/service/TaskService.java

@@ -10,14 +10,14 @@ import cn.cslg.pas.common.model.vo.*;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 
-import cn.cslg.pas.domain.Personnel;
-import cn.cslg.pas.domain.Project;
-import cn.cslg.pas.domain.Report;
-import cn.cslg.pas.domain.Task;
+import cn.cslg.pas.domain.*;
+import cn.cslg.pas.domain.asso.AssoProductPatent;
 import cn.cslg.pas.domain.asso.TaskCondition;
 import cn.cslg.pas.mapper.TaskMapper;
 import cn.cslg.pas.common.model.dto.UploadFileDTO;
+import cn.cslg.pas.service.asso.AssoProductPatentService;
 import cn.cslg.pas.service.asso.TaskConditionService;
+import cn.cslg.pas.service.impl.ProductServiceImpl;
 import cn.cslg.pas.service.upLoadPatent.*;
 
 import cn.hutool.core.io.FileUtil;
@@ -65,6 +65,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
     private final TaskConditionService taskConditionService;
     private final ProjectService projectService;
     private final ReportService reportService;
+    private final ProductServiceImpl productService;
     private final JobService jobService;
     private final TaskMapper taskMapper;
 
@@ -136,6 +137,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
         } else if (projectImportPatentVO.getProjectId() == null && projectImportPatentVO.getReportId() != null) {
             //若是和报告关联
             task.setReportId(projectImportPatentVO.getReportId());
+        } else if (projectImportPatentVO.getProductId() != null) {
+            //若是和产品关联
+            task.setProductId(projectImportPatentVO.getProductId());
         }
         //文件名称
         task.setFileName(fileDTO.getFileName());
@@ -322,7 +326,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                 }
             }
 
-            //装载任务名称(专利号/检索式 导入到 某某 专题库/报告中)
+            //装载任务名称(专利号/检索式 导入到 某某 专题库/报告中/产品
             if (queryTaskDTO.getProjectId() != null) {  //若当前查询是查询所有导入专题库的任务,则装载专题库名称
                 List<Integer> projectIds = tasks.stream().map(QueryTaskVO::getProjectId).collect(Collectors.toList());
                 List<Project> projects = projectService.list(new LambdaQueryWrapper<Project>().in(Project::getId, projectIds));
@@ -345,6 +349,16 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                         }
                     });
                 });
+            } else if (queryTaskDTO.getProductId() != null) {  //若当前查询是查询所有导入产品的任务,则装载报告名称
+                List<Integer> productIds = tasks.stream().map(QueryTaskVO::getProductId).collect(Collectors.toList());
+                List<Product> products = productService.list(new LambdaQueryWrapper<Product>().in(Product::getId, productIds));
+                tasks.forEach(task -> {
+                    products.forEach(product -> {
+                        if (task.getProductId().equals(product.getId())) {
+                            task.setProductName(product.getProductName());
+                        }
+                    });
+                });
             }
 
             for (QueryTaskVO task : tasks) {
@@ -365,6 +379,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                 } else if (task.getReportName() != null) {
                     to = "报告";
                     toName = task.getReportName();
+                } else if (task.getProductName() != null) {
+                    to = "产品";
+                    toName = task.getProductName();
                 }
                 if (task.getType().equals(2)) {  //导出任务
                     taskName = to + "【" + toName + "】导出 - " + task.getCreateName();
@@ -372,28 +389,6 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                     taskName = type + "导入到" + to + "【" + toName + "】 - " + task.getCreateName();
                 }
                 task.setTaskName(taskName);
-//                if (task.getType().equals(5)) {  //若是专利号导入任务
-//                    if (task.getProjectName() != null) {  //专题库
-//                        taskName = "专利号导入到专题库【" + task.getProjectName() + "】中 - " + task.getCreateName();
-//                    } else if (task.getReportName() != null) {  //报告
-//                        taskName = "专利号导入到报告【" + task.getReportName() + "】中 - " + task.getCreateName();
-//                    }
-//                    task.setTaskName(taskName);
-//                } else if (task.getType().equals(3) || task.getType().equals(4)) {  //若是检索式导入(欧专局或专利之星)
-//                    if (task.getProjectName() != null) {
-//                        taskName = "检索式导入到专题库【" + task.getProjectName() + "】中 - " + task.getCreateName();
-//                    } else if (task.getReportName() != null) {
-//                        taskName = "检索式导入到报告【" + task.getReportName() + "】中 - " + task.getCreateName();
-//                    }
-//                    task.setTaskName(taskName);
-//                } else if (task.getType().equals(2)) {  //若是导出
-//                    if (task.getProjectName() != null) {
-//                        taskName = "专题库【" + task.getProjectName() + "】导出 - " + task.getCreateName();
-//                    } else if (task.getReportName() != null) {
-//                        taskName = "报告【" + task.getReportName() + "】导出 - " + task.getCreateName();
-//                    }
-//                    task.setTaskName(taskName);
-//                }
 
             }
         }

+ 12 - 5
PAS/src/main/resources/mapper/TaskMapper.xml

@@ -37,7 +37,8 @@
     <!--List<QueryTaskVO> queryTasks(QueryTaskDTO queryTaskDTO);-->
     <select id="queryTasks" resultMap="queryTasksMap">
         select tas.id tas_id, tas.type tas_type, tas.uid tas_uid, tas.ctime tas_ctime, tas.tid tas_tid,
-        tas.report_id tas_report_id, tas.product_id tas_product_id, tas.mfields tas_mfields, tas.mun tas_mun, tas.onmun tas_onmun, tas.endtime
+        tas.report_id tas_report_id, tas.product_id tas_product_id, tas.mfields tas_mfields, tas.mun tas_mun, tas.onmun
+        tas_onmun, tas.endtime
         tas_endtime,
         tas.status tas_status, tas.filename tas_filename, tas.filesize tas_filesize, tas.loadtime tas_loadtime, tas.main
         tas_main,
@@ -60,15 +61,21 @@
             <if test="reportId != null and reportId != 0">
                 and tas.report_id = #{reportId}
             </if>
-            <if test="projectId == null and reportId == null">
-                and tas.uid = #{createId}
+            <if test="productId != null and productId != 0">
+                and tas.product_id = #{productId}
             </if>
-            <if test="projectId == 0 and reportId == null">
+            <if test="projectId == 0 and reportId == null and productId == null">
                 and tas.tid != 0
             </if>
-            <if test="reportId == 0 and projectId == null">
+            <if test="reportId == 0 and projectId == null and productId == null">
                 and tas.report_id is not null
             </if>
+            <if test="productId == 0 and projectId == null and reportId == null">
+                and tas.product_id is not null
+            </if>
+            <if test="projectId == null and reportId == null">
+                and tas.uid = #{createId}
+            </if>
             <if test="personIds != null and personIds.size > 0">
                 and tas.uid in
                 <foreach collection="personIds" item="n" separator="," open="(" close=")">