浏览代码

Merge remote-tracking branch 'origin/master'

xiexiang 1 年之前
父节点
当前提交
6e9d6b9255

+ 41 - 4
src/main/java/cn/cslg/pas/service/MailSendService.java

@@ -9,10 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -109,4 +106,44 @@ public class MailSendService {
         }
         rabbitMQUtils.sendEmailMessage(map);
     }
+
+    //任务开始邮件
+    public void sendAddTaskEmail(String taskName, String addPerson, String endTime, String handlePerson, String email) {
+        Map<String, Object> map = new LinkedHashMap<>();
+        map.put("title", "任务通知");
+        map.put("template", "mail/eTask.html");
+        map.put("value1", handlePerson);
+        map.put("img", "\\src\\main\\resources\\mail\\logo.png");
+        map.put("email", email);
+        map.put("value2", addPerson);
+        map.put("value3", taskName);
+        map.put("value4", endTime);
+        map.put("value5", url);
+        rabbitMQUtils.sendEmailMessage(map);
+    }
+
+    public void sendImportTaskDoneEmail(String taskTypeName, String taskName, String personId) {
+        String res = "";
+        try {
+            res = permissionService.getPersonnelByIdsFromPCS(Arrays.asList(personId));
+        } catch (Exception e) {
+        }
+        if (!res.equals("")) {
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            List<Personnel> personnels = JSON.parseArray(jsonObject.getString("data"), Personnel.class);
+           Personnel personnel =personnels.get(0);
+            Map<String, Object> map = new LinkedHashMap<>();
+            map.put("title","任务通知");
+            map.put("template","mail/eTaskDone.html");
+            map.put("value1",personnel.getPersonnelName());
+            map.put("img","\\src\\main\\resources\\mail\\logo.png");
+            map.put("email",personnel.getPersonnelEmail());
+            map.put("value2",taskTypeName);
+            map.put("value3",taskName);
+            rabbitMQUtils.sendEmailMessage(map);
+        }
+
+
+
+}
 }

+ 23 - 17
src/main/java/cn/cslg/pas/service/business/FeatureService.java

@@ -59,6 +59,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
 
     @Autowired
     private PatentStarApiService patentStarApiService;
+
     @Transactional(rollbackFor = Exception.class)
     public List<PatentRightVo> splitPatentFeature(SplitVO splitVO) throws IOException {
         String patentNo = splitVO.getPatentNo();
@@ -81,7 +82,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
 
         //查询拆分下的权要
         List<RePatentClaim> patentRights = this.getRightListByNo(patentNo);
-        if(patentRights.size()==0){
+        if (patentRights.size() == 0) {
             return new ArrayList<>();
         }
         LambdaQueryWrapper<PatentSplitMessage> splitWrapper = new LambdaQueryWrapper<>();
@@ -198,21 +199,21 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public List<RePatentClaim> getRightListByNo(String patentNo,String appNo) throws IOException {
+    public List<RePatentClaim> getRightListByNo(String patentNo, String appNo) throws IOException {
         //从pas获得拆分后的权要
         SelectClaimDTO selectClaimDTO = null;
-        String patentRight ="";
-        try {if(appNo!=null) {
-            selectClaimDTO = patentStarApiService.getOrginCalim(appNo);
-            if(selectClaimDTO!=null&&selectClaimDTO.getClaimContent()!=null&&selectClaimDTO.getClaimContent().size()!=0){
-              patentRight=selectClaimDTO.getClaimContent().get(0).getTextContent();
+        String patentRight = "";
+        try {
+            if (appNo != null) {
+                selectClaimDTO = patentStarApiService.getOrginCalim(appNo);
+                if (selectClaimDTO != null && selectClaimDTO.getClaimContent() != null && selectClaimDTO.getClaimContent().size() != 0) {
+                    patentRight = selectClaimDTO.getClaimContent().get(0).getTextContent();
 
+                }
+            } else if (patentNo != null) {
+                selectClaimDTO = esService.selectClaim(patentNo);
+                patentRight = selectClaimDTO.getClaim();
             }
-        }
-        else if(patentNo!=null){
-            selectClaimDTO = esService.selectClaim(patentNo);
-            patentRight =selectClaimDTO.getClaim();
-        }
 
         } catch (Exception e) {
             throw new XiaoShiException("未查询到权要");
@@ -265,9 +266,9 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
         }
     }
 
-    public List<PatentRightTree> getPatentRightTree(String patentNo,String appNo) {
+    public List<PatentRightTree> getPatentRightTree(String patentNo, String appNo) {
         try {
-            List<RePatentClaim> patentRights = this.getRightListByNo(patentNo,appNo);
+            List<RePatentClaim> patentRights = this.getRightListByNo(patentNo, appNo);
 
             List<PatentRightTree> treeNodeList = new ArrayList<>();
             //装载权要原文
@@ -490,17 +491,21 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
         splitWrapper.eq(PatentSplitMessage::getProjectId, projectId);
 
         PatentSplitMessage patentSplitMessage = patentSplitMessageService.getOne(splitWrapper, false);
-
+        List<Feature> allFeatures = new ArrayList<>();
+        if (patentSplitMessage == null) {
+            return allFeatures;
+        }
         LambdaQueryWrapper<Feature> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(Feature::getProjectId, projectId)
                 .eq(Feature::getPatentNo, patentNo)
                 .eq(Feature::getSplitMessageId, patentSplitMessage.getId());
-        List<Feature> allFeatures = this.list(wrapper);
+        allFeatures = this.list(wrapper);
         return allFeatures;
     }
 
     /**
      * 保存特征
+     *
      * @param updateFeatureDTO
      * @return
      */
@@ -529,13 +534,14 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
         if (patentSplitMessage == null) {
             throw new XiaoShiException("未进行拆分过");
         }
-        List<Integer> ids =   this.saveFeatures(features, patentSplitMessage.getId(), projectId);
+        List<Integer> ids = this.saveFeatures(features, patentSplitMessage.getId(), projectId);
         return ids;
     }
 
 
     /**
      * 批量添加特征
+     *
      * @param features
      * @param splitMessageId
      * @param projectId

+ 1 - 0
src/main/java/cn/cslg/pas/service/business/PatentDigProjectService.java

@@ -147,6 +147,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
         StringRequest stringRequest = new StringRequest();
         BeanUtils.copyProperties(groupRequest, stringRequest);
         List<String> sqls = formatQueryService.reSqls(stringRequest, tableName);
+        sqls = this.loadSearchSql(sqls);
         //格式化 分组
         GroupConfig groupConfig = null;
         if (groupRequest.getGroupBy() != null) {

+ 11 - 7
src/main/java/cn/cslg/pas/service/importPatent/TaskThread.java

@@ -11,6 +11,7 @@ import cn.cslg.pas.domain.business.ImportTask;
 import cn.cslg.pas.domain.es.Patent;
 import cn.cslg.pas.factorys.PatentImportFactory.PatentImportFactory;
 import cn.cslg.pas.factorys.PatentImportFactory.PatentImportImp;
+import cn.cslg.pas.service.MailSendService;
 import cn.cslg.pas.service.business.CommonService;
 import cn.cslg.pas.service.business.ImportTaskService;
 import cn.cslg.pas.service.common.MessageService;
@@ -113,8 +114,8 @@ public class TaskThread extends Thread {
         ImportTaskConfig config = configs.stream().filter(item -> item.getTaskType().equals(importTaskAMVO.getType()) && item.getImportTo().equals(Constants.IMPORT_PATENT_TO)).findFirst().orElse(null);
         PatentImportImp patentImportImp = patentImportFactory.getClass(config.getImportClass());
         patentImportImp.setTaskThread(this);
-      Boolean flag=  patentImportImp.startPatentThread();
-        if(flag) {
+        Boolean flag = patentImportImp.startPatentThread();
+        if (flag) {
             taskThreadLock.lock();
             try {
                 taskThreadCondition.await();
@@ -127,6 +128,9 @@ public class TaskThread extends Thread {
         if (importTaskAMVO.getState().equals(1)) {
             task.setState(2);
             importTaskAMVO.setState(2);
+            MailSendService mailSendService = applicationContext.getBean(MailSendService.class);
+
+            mailSendService.sendImportTaskDoneEmail("导入任务",task.getName(),task.getCreateId());
 
         } else {
             task.setState(importTaskAMVO.getState());
@@ -136,9 +140,9 @@ public class TaskThread extends Thread {
         task.updateById();
         MessageService messageService = applicationContext.getBean(MessageService.class);
         messageService.sendAllDoneMessage(importTaskAMVO);
-        SchedulingTaskService schedulingTaskService =applicationContext.getBean(SchedulingTaskService.class);
-   schedulingTaskService.removeTaskAMVO(importTaskAMVO.getId());
-   schedulingTaskService.startTask();
+        SchedulingTaskService schedulingTaskService = applicationContext.getBean(SchedulingTaskService.class);
+        schedulingTaskService.removeTaskAMVO(importTaskAMVO.getId());
+        schedulingTaskService.startTask();
     }
 
 
@@ -148,7 +152,7 @@ public class TaskThread extends Thread {
     public void awakeTaskThread() {
         synchronized ("导入任务是否完成") {
             importTaskAMVO.setThreadDoneCounter(importTaskAMVO.getThreadDoneCounter() + 1);
-            System.out.println("任务已经完成第"+importTaskAMVO.getThreadDoneCounter());
+            System.out.println("任务已经完成第" + importTaskAMVO.getThreadDoneCounter());
             if (importTaskAMVO.getThreadCounter().equals(importTaskAMVO.getThreadDoneCounter())) {
 
                 System.out.println("任务已经完成");
@@ -163,7 +167,7 @@ public class TaskThread extends Thread {
         }
     }
 
-    public  void doneTask(){
+    public void doneTask() {
         if (taskThreadLock.tryLock()) {
             //taskLock.lock();
             taskThreadCondition.signalAll();

+ 2 - 2
src/main/resources/mapper/Event.xml

@@ -67,10 +67,10 @@
         select count(*) from (select ${selectField} from ${tableName}
         <if test="sqls.get(0)!=''">
             where ${sqls.get(0)}
-            and p.entrust_type is not null
+
         </if>
         <if test="sqls.get(0)==''">
-            where p.entrust_type is not null
+
         </if>
         group by ${groupField}
         ) as c

+ 13 - 0
src/test/java/cn/cslg/pas/service/PDFBoxTests.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.service;
+
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class PDFBoxTests {
+    public  void test(){
+
+
+
+
+    }
+}