Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master' into prod_test

lwhhszx 1 anno fa
parent
commit
cb4aa433f1
84 ha cambiato i file con 3018 aggiunte e 436 eliminazioni
  1. 46 0
      src/main/java/cn/cslg/pas/common/DataSource.java
  2. 175 0
      src/main/java/cn/cslg/pas/common/auth/AuthAop.java
  3. 362 0
      src/main/java/cn/cslg/pas/common/auth/TreeUtils.java
  4. 17 0
      src/main/java/cn/cslg/pas/common/auth/checkAuth.java
  5. 4 4
      src/main/java/cn/cslg/pas/common/config/WebSocketConfig.java
  6. 52 0
      src/main/java/cn/cslg/pas/common/dto/ExportTaskDTO.java
  7. 14 0
      src/main/java/cn/cslg/pas/common/dto/ExternalLegalInfoDTO.java
  8. 48 0
      src/main/java/cn/cslg/pas/common/dto/ExternalLegalStatusDTO.java
  9. 6 0
      src/main/java/cn/cslg/pas/common/dto/GetAllPersonDTO.java
  10. 1 1
      src/main/java/cn/cslg/pas/common/dto/ImportTaskDTO.java
  11. 7 1
      src/main/java/cn/cslg/pas/common/dto/PatentExport/PatentExportVO.java
  12. 19 0
      src/main/java/cn/cslg/pas/common/dto/QueryScratchWordsDTO.java
  13. 12 0
      src/main/java/cn/cslg/pas/common/dto/SwQueryDTO.java
  14. 75 0
      src/main/java/cn/cslg/pas/common/dto/business/ScratchWordsDTO.java
  15. 70 0
      src/main/java/cn/cslg/pas/common/dto/business/UpdateScratchWordsDTO.java
  16. 8 0
      src/main/java/cn/cslg/pas/common/dto/customAnalyse/SelectCustomAnalyseDTO.java
  17. 16 0
      src/main/java/cn/cslg/pas/common/dto/customAnalyse/SelectCustomAnalyseListDTO.java
  18. 17 17
      src/main/java/cn/cslg/pas/common/utils/GenerateObjectUtil.java
  19. 51 0
      src/main/java/cn/cslg/pas/common/utils/ParseByteToFileUtils.java
  20. 3 1
      src/main/java/cn/cslg/pas/common/utils/ResponseEnum.java
  21. 15 0
      src/main/java/cn/cslg/pas/common/vo/ConfigVOS/PatentConfigVO.java
  22. 5 6
      src/main/java/cn/cslg/pas/common/vo/ImportTaskAMVO.java
  23. 1 1
      src/main/java/cn/cslg/pas/common/vo/business/MergePersonAgainVO.java
  24. 11 0
      src/main/java/cn/cslg/pas/common/vo/customAnalyse/CustomAnalyseIdVO.java
  25. 26 0
      src/main/java/cn/cslg/pas/common/vo/customAnalyse/CustomAnalyseVO.java
  26. 17 0
      src/main/java/cn/cslg/pas/common/vo/customAnalyse/SelectAnalyseVO.java
  27. 11 0
      src/main/java/cn/cslg/pas/common/vo/customAnalyse/SelectCustomAnalyseVO.java
  28. 6 0
      src/main/java/cn/cslg/pas/common/vo/es/EsCustomFieldBatchVO.java
  29. 16 0
      src/main/java/cn/cslg/pas/controller/AssoGroupFeatureController.java
  30. 61 0
      src/main/java/cn/cslg/pas/controller/CustomAnalyseController.java
  31. 6 0
      src/main/java/cn/cslg/pas/controller/ImportTaskController.java
  32. 17 4
      src/main/java/cn/cslg/pas/controller/InvalidStatutesController.java
  33. 21 8
      src/main/java/cn/cslg/pas/controller/PatentClaimHistoryContorller.java
  34. 30 22
      src/main/java/cn/cslg/pas/controller/PatentController.java
  35. 1 4
      src/main/java/cn/cslg/pas/controller/ReportExportController.java
  36. 71 0
      src/main/java/cn/cslg/pas/controller/ScratchWordsController.java
  37. 2 9
      src/main/java/cn/cslg/pas/controller/TempleController.java
  38. 16 3
      src/main/java/cn/cslg/pas/controller/outApi/PatentStarController.java
  39. 55 0
      src/main/java/cn/cslg/pas/domain/business/CustomAnalysisItem.java
  40. 53 0
      src/main/java/cn/cslg/pas/domain/business/CustomAnalysisItemSchema.java
  41. 2 2
      src/main/java/cn/cslg/pas/domain/business/ImportTaskCondition.java
  42. 2 0
      src/main/java/cn/cslg/pas/domain/business/ReportTemple.java
  43. 80 0
      src/main/java/cn/cslg/pas/domain/business/ScratchWords.java
  44. 14 12
      src/main/java/cn/cslg/pas/domain/es/Marking.java
  45. 1 1
      src/main/java/cn/cslg/pas/domain/es/Patent.java
  46. 3 2
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildCountAnalysisBuilder.java
  47. 16 0
      src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetCommonValue.java
  48. 25 0
      src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetDateValue.java
  49. 21 0
      src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetNameValue.java
  50. 8 0
      src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetValueImp.java
  51. 25 0
      src/main/java/cn/cslg/pas/factorys/PatentExportFactory/PatentExportFactory.java
  52. 23 0
      src/main/java/cn/cslg/pas/mapper/CustomAnalysisItemMapper.java
  53. 14 0
      src/main/java/cn/cslg/pas/mapper/CustomAnalysisItemSchemaMapper.java
  54. 13 0
      src/main/java/cn/cslg/pas/mapper/ScratchWordsMapper.java
  55. 1 10
      src/main/java/cn/cslg/pas/service/ReportExportService.java
  56. 119 0
      src/main/java/cn/cslg/pas/service/business/CustomAnalyseService.java
  57. 56 4
      src/main/java/cn/cslg/pas/service/business/ImportTaskService.java
  58. 31 4
      src/main/java/cn/cslg/pas/service/business/InvalidStatutesService.java
  59. 68 36
      src/main/java/cn/cslg/pas/service/business/MergePersonService.java
  60. 136 94
      src/main/java/cn/cslg/pas/service/business/PDFExportFirstPageService.java
  61. 85 55
      src/main/java/cn/cslg/pas/service/business/PatentExportService.java
  62. 1 1
      src/main/java/cn/cslg/pas/service/business/TempleService.java
  63. 110 0
      src/main/java/cn/cslg/pas/service/business/ScratchWordsService.java
  64. 44 7
      src/main/java/cn/cslg/pas/service/business/es/EsCustomFieldService.java
  65. 11 3
      src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java
  66. 239 0
      src/main/java/cn/cslg/pas/service/business/es/EsScratchWordsService.java
  67. 4 1
      src/main/java/cn/cslg/pas/service/business/es/EsService.java
  68. 23 1
      src/main/java/cn/cslg/pas/service/business/invalidReport/AssoGroupFeatureService.java
  69. 1 0
      src/main/java/cn/cslg/pas/service/business/invalidReport/EvidenceReasonService.java
  70. 24 0
      src/main/java/cn/cslg/pas/service/business/invalidReport/PatentClaimHistoryService.java
  71. 27 10
      src/main/java/cn/cslg/pas/service/common/FileManagerService.java
  72. 19 0
      src/main/java/cn/cslg/pas/service/common/MessageService.java
  73. 58 9
      src/main/java/cn/cslg/pas/service/common/PatentStarApiService.java
  74. 22 21
      src/main/java/cn/cslg/pas/service/importPatent/GetCataloguingFromWebThread.java
  75. 1 1
      src/main/java/cn/cslg/pas/service/importPatent/GetPatentFromExcelThread.java
  76. 6 2
      src/main/java/cn/cslg/pas/service/importPatent/ImportFromExcelToEsService.java
  77. 59 36
      src/main/java/cn/cslg/pas/service/importPatent/ImportFromWebToEsService.java
  78. 2 1
      src/main/java/cn/cslg/pas/service/importPatent/SchedulingTaskService.java
  79. 17 18
      src/main/java/cn/cslg/pas/service/importPatent/TaskThread.java
  80. 18 10
      src/main/resources/jsons/patent.json
  81. 33 0
      src/main/resources/mapper/CustomAnalyseMapper.xml
  82. 69 0
      src/test/java/cn/cslg/pas/service/EsScratchWordsServiceTest.java
  83. 16 2
      src/test/java/cn/cslg/pas/service/EsServiceTests.java
  84. 27 12
      src/test/java/cn/cslg/pas/service/EventServiceTests.java

+ 46 - 0
src/main/java/cn/cslg/pas/common/DataSource.java

@@ -0,0 +1,46 @@
+package cn.cslg.pas.common;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @author 沈永艺
+ * @date 2022-8-12
+ * @description 数据权限类 数据库对应实体
+ */
+
+@Data
+@Accessors(chain = true)
+
+public class DataSource  {
+    /**
+     * 数据字典名字
+     */
+    private String dataSourceName;
+
+    /**
+     * 数据字典描述
+     */
+    private String dataSourceDescription;
+
+    /**
+     * 数据字典数据库
+     */
+    private String dataSourceDataBase;
+
+    /**
+     * 数据字典表格
+     */
+    private String dataSourceTable;
+
+    /**
+     * 数据字典字段
+     */
+    private String dataSourceField;
+
+    private  Integer id;
+    private Integer isDelete;
+
+
+}

+ 175 - 0
src/main/java/cn/cslg/pas/common/auth/AuthAop.java

@@ -0,0 +1,175 @@
+package cn.cslg.pas.common.auth;
+
+
+import cn.cslg.pas.common.DataSource;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.common.utils.Response;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.v3.oas.annotations.Operation;
+import okhttp3.FormBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Objects;
+
+import static cn.cslg.pas.common.utils.JsonUtils.log;
+
+@Order(2)
+@Aspect
+@Component
+public class AuthAop {
+    @Value("${authorUrl}")
+    private String url;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+    @Autowired
+    private LoginUtils loginUtils;
+
+    /**
+     * 定义切点
+     */
+    @Pointcut("@annotation(cn.cslg.pas.common.auth.checkAuth)")
+    public void annotationPointcut() {
+
+    }
+
+    /**
+     * @param joinPoint 当前执行的方法
+     */
+    @Around("annotationPointcut()")
+    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
+        try {
+            //获得登录人信息
+            PersonnelVO personnelVO = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
+            if (personnelVO.getState() == 0) {
+                return Response.error("登录账号已被禁用,请联系管理员启用");
+            }
+
+
+            // 是否通过切面过滤标记
+            Boolean isPass = true;
+            MethodSignature ms = (MethodSignature) joinPoint.getSignature();
+            //获得执行方法对象
+            Method method = ms.getMethod();
+            //获得执行方法对象上的@checkAuth,@Operation注解对象
+            checkAuth myAnnotation = method.getAnnotation(checkAuth.class);
+            Operation operAnnotation = method.getAnnotation(Operation.class);
+            //获得@checkAuth注解上FunId参数的值
+            String functionId = myAnnotation.FunId();
+            //获得执行方法的参数对象
+            Object[] args = joinPoint.getArgs();
+            //根据登录人的id以及功能id获得规则信息
+            //将登录人的id以及功能id放入requestBody中
+            RequestBody requestBody = new FormBody.Builder()
+                    .add("loginId", loginUtils.getId().toString())
+                    .add("functionId", functionId)
+                    .build();
+            //建立远程连接
+            OkHttpClient okHttpClient = new OkHttpClient();
+            //发送请求
+            Request request = new Request.Builder()
+                    .url(url + "/permission/api/data/queryDataRule")
+                    .addHeader("Cookie", LoginUtils.getToken())
+                    .post(requestBody)
+                    .build();
+            //获得请求结果
+            String resBody = Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+            JSONArray jsonArray = JSONArray.parseArray(resBody);
+            //如果获得规则的返回值为[-1]则代表登录人没有使用该功能的权限
+            if (jsonArray.get(0).toString().equals("-1")) {
+                return Response.noPermissions("没有" + operAnnotation.summary() + "的功能");
+            }
+            //如果获得规则的返回值为[0],则直接通过判断
+            else if (jsonArray.size() == 1 && jsonArray.get(0).equals("0")) {
+                return joinPoint.proceed();
+            }
+            // 如果查询结果的size大于0证明有限制逻辑
+            if (jsonArray.size() > 0) {
+                RequestBody reBodySource = new FormBody.Builder()
+                        .add("tableName", "local")
+                        .build();
+                //处理jsonObject,变为(x==y)&&(z==t)的形式 ,并用js引擎进行boolean判断
+                //建立连接去获得字典信息
+                OkHttpClient okHttpClientSou = new OkHttpClient();
+                //发送请求
+                Request requestSou = new Request.Builder()
+                        .url(url + "/permission/api/data/getDataSource")
+                        .post(reBodySource)
+                        .addHeader("Cookie", LoginUtils.getToken())
+                        .build();
+                //获得请求返回
+                String resSource = Objects.requireNonNull(okHttpClientSou.newCall(requestSou).execute().body()).string();
+
+                JSONArray jsonArray1 = JSON.parseArray(resSource);
+                // 获得字典
+                List<DataSource> dataSources = jsonArray1.toJavaList(DataSource.class);
+                //循环遍历将多个规则拼接起来
+                StringBuilder sqlStr = new StringBuilder();
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    //将数据库里存的规则转换为可识别的判断逻辑
+                    String sql = TreeUtils.reCompute(JSONObject.parseObject(jsonArray.get(i).toString()), args, dataSources, personnelVO);
+                    sqlStr.append(jsonArray.size() != i + 1 ? sql + " || " : sql);
+                }
+                //js引擎进行判断
+                ScriptEngineManager manager = new ScriptEngineManager();
+                //根据名字获得引擎
+                ScriptEngine engine = manager.getEngineByName("javascript");
+                //进行判断,生成判断结果并将判断结果赋给isPass
+                Object result = engine.eval(sqlStr.toString());//进行判断
+                isPass = (Boolean) result;
+            }
+
+            //判断不通过
+            if (!isPass) {
+                return Response.noPermissions("没有权限进行" + operAnnotation.summary() + "的操作");
+            }
+            //判断通过
+            return joinPoint.proceed();
+        }
+        catch (Exception var10) {
+            log.error("operlog exception:{}", var10);
+            return joinPoint.proceed();
+        }
+
+    }
+
+
+    @Before(value = "annotationPointcut()")
+    public void doAfterReturning(JoinPoint joinPoint) {
+        this.handleAfterLog(joinPoint);
+
+    }
+
+    protected void handleAfterLog(JoinPoint joinPoint) {
+        try {
+            log.info("after ----> title:{}, desc:{}",1,2);
+            return;
+        } catch (Exception var10) {
+            log.error("operlog exception:{}", var10);
+            return;
+        }
+    }
+
+}
+

+ 362 - 0
src/main/java/cn/cslg/pas/common/auth/TreeUtils.java

@@ -0,0 +1,362 @@
+package cn.cslg.pas.common.auth;
+
+
+import cn.cslg.pas.common.DataSource;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+@Component
+public class TreeUtils {
+    /**
+     * 将二叉树json对象转为sql where后的条件语句
+     * liRJ
+     *
+     * @param jsonObject  要处理的jsonObject对象
+     * @param dataSource  要使用的数据字典
+     * @param personnelVO 登录人的信息
+     * @return 拼接的sql
+     */
+    // 处理sql语句,返回拼接sql
+    public static String reSql(JSONObject jsonObject, List<DataSource> dataSource, PersonnelVO personnelVO) throws NoSuchFieldException, IllegalAccessException {
+        String sql;
+        //判断是否为规则,是的话则返回为“”,不对其他sql条件产生影响
+        if (jsonObject.get("nodeType").equals("logic")) {
+            sql = "";
+        }
+        //符合二叉树形式
+        else if (jsonObject.containsKey("left") && jsonObject.containsKey("right")) {
+            //将二叉树转换为sql条件
+            sql = recursionTree(jsonObject, dataSource, personnelVO);
+        }
+        // 不符合二叉树形式(单条数据)
+        else {
+            //获得规则的field字段,作为sql条件的栏位
+            String field = jsonObject.get("field").toString();
+            //获得规则的栏位值,并且要对值进行识别操作
+            String value = distinguishFields(jsonObject.get("value").toString(), dataSource, personnelVO);
+            if (jsonObject.get("opr").toString().equals("FIND_IN_SET")) {
+                sql = "FIND_IN_SET(" + value + "," + field + ")";
+            } else {
+                sql = field + " " + jsonObject.get("opr").toString() + " " + value;
+            }
+        }
+
+        return sql;
+    }
+
+    /**
+     * 将二叉树json对象转为sql where后的条件语句
+     * liRJ
+     *
+     * @param jsonObject  要处理的jsonObject对象
+     * @param dataSource  要使用的数据字典
+     * @param personnelVO 登录人的信息
+     * @return 拼接的sql
+     */
+    // 处理规则
+    public static String reCompute(JSONObject jsonObject, Object[] object, List<DataSource> dataSource, PersonnelVO personnelVO) throws NoSuchFieldException, IllegalAccessException {
+        String sql;
+        //判断是否为sql类型规则,是的话规则转换为1==1,不对其他规则产生影响
+        if (jsonObject.get("nodeType").equals("sql")) {
+            sql = "1==1";
+        }
+        //符合二叉树形式
+        else if (jsonObject.containsKey("left") && jsonObject.containsKey("right")) {
+            //将二叉树转换为规则判断
+            sql = cRecursionTree(jsonObject, object, dataSource, personnelVO);
+        }
+        // 不符合二叉树形式(单条数据)
+        else {
+            //获得规则的 field字段,并进行识别操作
+            String field = distinguishFields(jsonObject.get("field").toString(), object, dataSource, personnelVO);
+            //获得规则的 value字段,并进行识别操作
+            String value = distinguishValues(jsonObject.get("value").toString(), object);
+            //获得规则的 运算符字段,并进行识别操作
+            String opr = distinguishLogic(jsonObject.getString("nodeType"), jsonObject.getString("opr"));
+            //field 和value若为以,隔开的数组时,将被拆开,并合成为新的规则
+            sql = arrayEqlToString(field, value, opr);
+        }
+
+        return sql;
+    }
+
+    /**
+     * 递归将二叉树转换为字符串
+     * liRJ
+     *
+     * @param jsonObject jsonObject
+     */
+    //将二叉树转换为sql条件
+    public static String recursionTree(JSONObject jsonObject, List<DataSource> dataSource, PersonnelVO personnelVO) throws NoSuchFieldException, IllegalAccessException {
+        String str1;
+        String str2;
+        // 获得规则左边
+        JSONObject jsonLeft = jsonObject.getJSONObject("left");
+        // 获得规则右边
+        JSONObject jsonRight = jsonObject.getJSONObject("right");
+        //判断是否含有left分支,有的话进行递归
+        if (jsonLeft.containsKey("left")) {
+            str1 = recursionTree(jsonLeft, dataSource, personnelVO);//递归
+        }
+        //没有的话解析字符串拼接成子sql
+        else {
+            String field = jsonLeft.get("field").toString();
+            //获得规则的 value字段,并进行识别操作
+            String value = distinguishFields(jsonLeft.get("value").toString(), dataSource, personnelVO); //没有的话解析字符串拼接成子sql
+            if (jsonLeft.get("opr").toString().equals("FIND_IN_SET")) {
+                str1 = "FIND_IN_SET(" + value + "," + field + ")";
+            } else {
+                str1 = field + " " + jsonLeft.get("opr").toString() + " " + value;
+            }
+        }
+        //同上部分处理left分支
+        if (jsonRight.containsKey("right")) {
+            str2 = recursionTree(jsonRight, dataSource, personnelVO);
+        } else {
+            String field = jsonRight.get("field").toString();
+            String value = distinguishFields(jsonRight.get("value").toString(), dataSource, personnelVO);
+            if (jsonRight.get("opr").toString().equals("FIND_IN_SET")) {
+                str2 = "FIND_IN_SET(" + value + "," + field + ")";
+            } else {
+                str2 = field + " " + jsonRight.get("opr").toString() + " " + value;
+            }
+        }
+        return "(" + str1 + ") " + jsonObject.get("logicOpr") + " (" + str2 + ")";
+    }
+
+    //将二叉树转换为规则判断
+    public static String cRecursionTree(JSONObject jsonObject, Object[] object, List<DataSource> dataSource, PersonnelVO personnelVO) throws NoSuchFieldException, IllegalAccessException {
+        String str1;
+        String str2;
+        // 获得规则左边
+        JSONObject jsonLeft = jsonObject.getJSONObject("left");
+        // 获得规则右边
+        JSONObject jsonRight = jsonObject.getJSONObject("right");
+        //判断是否含有left分支,有的话进行递归
+        if (jsonLeft.containsKey("left")) {
+            str1 = cRecursionTree(jsonLeft, object, dataSource, personnelVO);
+        } else {
+            //获得规则的 field字段,并进行识别操作
+            String field = distinguishFields(jsonLeft.get("field").toString(), object, dataSource, personnelVO);
+            //获得规则的 value字段,并进行识别操作
+            String value = distinguishValues(jsonLeft.get("value").toString(), object);
+            //获得规则的 opr字段,并进行识别操作
+            String opr = distinguishLogic(jsonLeft.getString("nodeType"), jsonLeft.getString("opr"));
+            str1 = arrayEqlToString(field, value, opr);
+        }
+        //同上部分处理right分支
+        if (jsonRight.containsKey("right")) {
+            str2 = cRecursionTree(jsonRight, object, dataSource, personnelVO);
+        } else {
+            String field = distinguishFields(jsonRight.get("field").toString(), object, dataSource, personnelVO);
+            String value = distinguishValues(jsonRight.get("value").toString(), object);
+            String opr = distinguishLogic(jsonRight.getString("nodeType"), jsonRight.getString("opr"));
+            str2 = arrayEqlToString(field, value, opr);
+        }
+
+        return "(" + str1 + ") " + distinguishLogic(jsonObject.getString("nodeType"), jsonObject.getString("logicOpr")) + " (" + str2 + ")";
+    }
+
+    //对field和value部分进行计算 sql查询
+    public static String distinguishFields(String field, List<DataSource> dataSources, PersonnelVO personnelVO) throws NoSuchFieldException, IllegalAccessException {
+        //获得登录用户部门列表信息
+        List<PersonnelVO.DP> dps = personnelVO.getDpList();
+        //获得登录用户角色列表信息
+        List<PersonnelVO.PerRole> perRoles = personnelVO.getRList();
+        String tem = "";
+        String reField = field;
+        //如果参数是sql语句
+        if (field.contains("select")) {
+            for (DataSource dataSource : dataSources) {
+                String sourceField = dataSource.getDataSourceField();
+                if (field.contains("local." + sourceField)) {
+                    // 判断是否是部门信息
+                    if (sourceField.contains("DP.")) {
+                        // 分割字符串获得部门字段
+                        String Fields = sourceField.split("\\.")[1];
+                        // 遍历部门信息,用反射将对应字段转换成(*,*,...)格式
+                        for (PersonnelVO.DP dp : dps) {
+                            Class<?> DPClass = dp.getClass();
+                            Field dataField = DPClass.getDeclaredField(Fields);
+                            dataField.setAccessible(true);
+                            tem = dataField.get(dp).toString() + ",";
+
+                        }
+                        reField = sourceField.replace("local." + sourceField, "(" + tem.substring(0, tem.length() - 1) + ")");
+                    }
+                    //判断是否是角色信息(处理过程同部门信息处理过程)
+                    else if (sourceField.contains("PerRole.")) {
+                        String Fields = sourceField.split("\\.")[1];
+                        for (PersonnelVO.PerRole perRole : perRoles) {
+                            Class<?> DPClass = perRole.getClass();
+                            Field dataField = DPClass.getDeclaredField(Fields);
+                            dataField.setAccessible(true);
+                            tem = dataField.get(perRole).toString() + ",";
+                        }
+                        reField = sourceField.replace("local." + sourceField, "(" + tem.substring(0, tem.length() - 1) + ")");
+                    } else {
+                        Class<?> personClass = personnelVO.getClass();
+                        Field dataField = personClass.getDeclaredField(sourceField);
+                        dataField.setAccessible(true);
+                        reField = reField.replace("local." + sourceField, dataField.get(personnelVO).toString());
+                    }
+                }
+            }
+        }
+        //遍历字典数据
+        else {
+            for (DataSource dataSource : dataSources) {
+                // 如果匹配上字典字段则进行处理
+                if (field.equals(dataSource.getDataSourceField())) {
+                    // 判断是否是部门信息
+                    if (field.contains("DP.")) {
+                        // 分割字符串获得部门字段
+                        String Fields = field.split("\\.")[1];
+                        // 遍历部门信息,用反射将对应字段转换成(*,*,...)格式
+                        for (PersonnelVO.DP dp : dps) {
+                            Class<?> DPClass = dp.getClass();
+                            Field dataField = DPClass.getDeclaredField(Fields);
+                            dataField.setAccessible(true);
+                            tem = dataField.get(dp).toString() + ",";
+
+                        }
+                        reField = "(" + tem.substring(0, tem.length() - 1) + ")";
+                    }
+                    //判断是否是角色信息(处理过程同部门信息处理过程)
+                    else if (field.contains("PerRole.")) {
+                        String Fields = field.split("\\.")[1];
+                        for (PersonnelVO.PerRole perRole : perRoles) {
+                            Class<?> DPClass = perRole.getClass();
+                            Field dataField = DPClass.getDeclaredField(Fields);
+                            dataField.setAccessible(true);
+                            tem = dataField.get(perRole).toString() + ",";
+                        }
+                        reField = "(" + tem.substring(0, tem.length() - 1) + ")";
+                    } else {
+                        Class<?> personClass = personnelVO.getClass();
+                        Field dataField = personClass.getDeclaredField(field);
+                        dataField.setAccessible(true);
+                        reField = dataField.get(personnelVO).toString();
+                        break;
+                    }
+                }
+            }
+        }
+        return reField;
+    }
+
+    //对field部分进行计算
+    public static String distinguishFields(String field, Object[] object, List<DataSource> dataSources, PersonnelVO personnelVO) throws NoSuchFieldException, IllegalAccessException {
+        String reField = "'" + field + "'";
+        //反射获方法的参数值
+        Class<?> jsonClass = object[0].getClass();
+        for (Field field1 : jsonClass.getDeclaredFields()) {
+            if (field1.getName().equals(field)) {     //判断field的值是否和参数名一样,一样的话变为参数值
+                Field dataField = jsonClass.getDeclaredField(field);
+                dataField.setAccessible(true);//设置data属性为可访问的
+                String fie = dataField.get(object[0]).toString();
+                reField = "'" + fie + "'";
+                break;
+            }
+        }
+        //获得登录用户部门列表信息
+        List<PersonnelVO.DP> dps = personnelVO.getDpList();
+        //获得登录用户角色列表信息
+        List<PersonnelVO.PerRole> perRoles = personnelVO.getRList();
+        String tem = "";
+        //遍历字典数据
+        for (DataSource dataSource : dataSources) {
+            // 如果匹配上字典字段则进行处理
+            if (field.equals(dataSource.getDataSourceField())) {
+                // 判断是否是部门信息
+                if (field.contains("DP.")) {
+                    // 分割字符串获得部门字段
+                    String Fields = field.split("\\.")[1];
+                    // 遍历部门信息,用反射将对应字段转换成(*,*,...)格式
+                    for (PersonnelVO.DP dp : dps) {
+                        Class<?> DPClass = dp.getClass();
+                        Field dataField = DPClass.getDeclaredField(Fields);
+                        dataField.setAccessible(true);
+                        tem = dataField.get(dp).toString() + ",";
+
+                    }
+                    reField = tem.substring(0, tem.length() - 1);
+                }
+                //判断是否是角色信息(处理过程同部门信息处理过程)
+                else if (field.contains("PerRole.")) {
+                    String Fields = field.split("\\.")[1];
+                    for (PersonnelVO.PerRole perRole : perRoles) {
+                        Class<?> DPClass = perRole.getClass();
+                        Field dataField = DPClass.getDeclaredField(Fields);
+                        dataField.setAccessible(true);
+                        tem = dataField.get(perRole).toString() + ",";
+                    }
+                    reField = tem.substring(0, tem.length() - 1);
+                } else {
+                    Class<?> personClass = personnelVO.getClass();
+                    Field dataField = personClass.getDeclaredField(field);
+                    dataField.setAccessible(true);
+                    reField = "'" + dataField.get(personnelVO).toString() + "'";
+                    break;
+                }
+            }
+        }
+
+        return reField;
+    }
+
+    //对value部分进行计算
+    public static String distinguishValues(String value, Object[] object) throws NoSuchFieldException, IllegalAccessException {
+        String reValue = "'" + value + "'";
+        //反射获得参数值
+        Class<?> jsonClass = object[0].getClass();
+        for (Field field1 : jsonClass.getDeclaredFields()) {
+            if (field1.getName().equals(value)) {     //判断value的值是否和参数名一样,一样的话变为参数值
+                Field dataField = jsonClass.getDeclaredField(value);
+                dataField.setAccessible(true);//设置data属性为可访问的
+                String fie = dataField.get(object[0]).toString();
+                reValue = "'" + fie + "'";
+                break;
+            }
+        }
+
+        return reValue;
+    }
+
+    //对应改变运算逻辑
+    public static String distinguishLogic(String nodeType, String opr) {
+        if (nodeType.equals("logic")) {
+            switch (opr) {
+                case "=":
+                    opr = "==";
+                    break;
+                case "and":
+                    opr = "&&";
+                    break;
+                case "or":
+                    opr = "||";
+                    break;
+            }
+        }
+
+        return opr;
+    }
+
+    // 将x,y=z,w 形式改为 x=z||x=w||y=z||y=w形式
+    public static String arrayEqlToString(String field, String value, String opr) {
+        StringBuilder reStr = new StringBuilder();
+        String[] fields = field.split(",");
+        String[] values = value.split(",");
+        for (int i = 0; i < fields.length; i++) {
+            for (int t = 0; t < values.length; t++) {
+                reStr.append(i == fields.length - 1 && t == values.length - 1 ? fields[i] + opr + values[t] : fields[i] + opr + values[t] + "||");
+            }
+        }
+
+        return reStr.toString();
+    }
+}

+ 17 - 0
src/main/java/cn/cslg/pas/common/auth/checkAuth.java

@@ -0,0 +1,17 @@
+package cn.cslg.pas.common.auth;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author LRJ
+ * @date 2022-8-23
+ * @description 数据权限(增删改)条件判断注解
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface checkAuth {
+    String FunId() default "0";
+}
+

+ 4 - 4
src/main/java/cn/cslg/pas/common/config/WebSocketConfig.java

@@ -6,8 +6,8 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
 @Configuration
 public class WebSocketConfig {
-    @Bean
-    public ServerEndpointExporter serverEndpointExporter() {
-        return new ServerEndpointExporter();
-    }
+//    @Bean
+//    public ServerEndpointExporter serverEndpointExporter() {
+//        return new ServerEndpointExporter();
+//    }
 }

+ 52 - 0
src/main/java/cn/cslg/pas/common/dto/ExportTaskDTO.java

@@ -0,0 +1,52 @@
+package cn.cslg.pas.common.dto;
+
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 导出任务DTO类
+ *
+ * @author xx
+ */
+
+@Accessors(chain = true)
+@Data
+public class ExportTaskDTO {
+    private Integer projectId;
+
+    /**
+     * 1 Excel导入
+     * 2 专利号导入
+     * 3 专利号文件导入
+     * 4 检索导入
+     * 5 pdf文档导入
+     * 6 Excel导出
+     */
+    private Integer type;
+
+    /**
+     * 文件guid
+     */
+    private String fileGuid;
+
+    /**
+     * 导出总条数
+     */
+    private Integer allNum;
+
+    /**
+     /**
+     * 失败条数
+     */
+    private Integer defaultNum;
+
+    /**
+     * 完成时间
+     */
+    private Date finishTime;
+}

+ 14 - 0
src/main/java/cn/cslg/pas/common/dto/ExternalLegalInfoDTO.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.common.dto;
+
+import cn.cslg.pas.domain.es.LegalEvent;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ExternalLegalInfoDTO {
+
+    private List<String> legalStatus;
+
+    private List<LegalEvent> legalEvents;
+}

+ 48 - 0
src/main/java/cn/cslg/pas/common/dto/ExternalLegalStatusDTO.java

@@ -0,0 +1,48 @@
+package cn.cslg.pas.common.dto;
+
+import lombok.Data;
+
+@Data
+public class ExternalLegalStatusDTO {
+    private Long ID;
+    private String JUANQI;
+    private String PatentType;
+    private String LegalDate;
+    private String LegalStatus;
+    private String LegalStatusInfo;
+    private String LegalCode;
+    private String VOL;
+    private String NUM;
+    private String PAG;
+    private String IPC;
+    private String SHENQINGH;
+    private String SHENQINGR;
+    private String SHENQINGGBR;
+    private String SHOUQUANGGR;
+    private String WUXIAOXGJDH;
+    private String WUXIAOXGJDR;
+    private String ZHONGZHIR;
+    private String FANGQISXR;
+    private String YUANMINGC;
+    private String YUANGONGGR;
+    private String BIANGENGSXCODE;
+    private String BIANGENGSX;
+    private String BIANGENGQ;
+    private String BIANGENGH;
+    private String DENGJISXR;
+    private String HETONGBAH;
+    private String RANGYUR;
+    private String SHOURANGR;
+    private String ZHUANLIMC;
+    private String XUKEZL;
+    private String BEIANRQ;
+    private String BIANGENGR;
+    private String JIECHUR;
+    private String DENGJIH;
+    private String CHUZHIR;
+    private String ZHIQUANR;
+    private String SHOUJIANR;
+    private String WENJIANMC;
+    private String DETAIL;
+
+}

+ 6 - 0
src/main/java/cn/cslg/pas/common/dto/GetAllPersonDTO.java

@@ -1,18 +1,24 @@
 package cn.cslg.pas.common.dto;
 
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.List;
 
 @Data
+@EqualsAndHashCode
 public class GetAllPersonDTO {
 
     private String name;
 
+    private String abbreviation;
+
     private String address;
 
     private String country;
 
+    private String province;
+
     private String remark;
 
     //类型  0 申请人  1 权利人  2 发明人

+ 1 - 1
src/main/java/cn/cslg/pas/common/dto/ImportTaskDTO.java

@@ -84,5 +84,5 @@ public class ImportTaskDTO {
     private String orderByType;
 
     private List<EsCustomFieldDTO> fieldDTOS;
-
+    private List<String> patentNos;
 }

+ 7 - 1
src/main/java/cn/cslg/pas/common/dto/PatentExport/PatentExportVO.java

@@ -11,7 +11,7 @@ public class PatentExportVO {
     /**
      * 字段名
      */
-    private String key;
+    private String value;
 
     /**
      * 字段中文
@@ -32,4 +32,10 @@ public class PatentExportVO {
      * 类型
      */
     private String type;
+
+    private Boolean ifShow;
+
+    private Boolean ifHidden;
+
+    private Integer createType;
 }

+ 19 - 0
src/main/java/cn/cslg/pas/common/dto/QueryScratchWordsDTO.java

@@ -0,0 +1,19 @@
+package cn.cslg.pas.common.dto;
+
+import cn.cslg.pas.common.vo.PersonSelfFieldVO;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 实体类表以及栏位信息
+ */
+@Data
+public class QueryScratchWordsDTO {
+    private String createName;
+    private String patentNo;
+    private Date markTime;
+    private String markSelectText;
+
+}

+ 12 - 0
src/main/java/cn/cslg/pas/common/dto/SwQueryDTO.java

@@ -0,0 +1,12 @@
+package cn.cslg.pas.common.dto;
+import lombok.Data;
+
+
+/**
+ * 划词检索dto类
+ */
+@Data
+public class SwQueryDTO {
+    private String patentNo;
+    private Integer projectId;
+}

+ 75 - 0
src/main/java/cn/cslg/pas/common/dto/business/ScratchWordsDTO.java

@@ -0,0 +1,75 @@
+package cn.cslg.pas.common.dto.business;
+
+import lombok.Data;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/10
+ */
+@Data
+public class ScratchWordsDTO {
+    /**
+     * 创建人
+     */
+    private String createId;
+
+    /**
+     * 租户id
+     */
+    private Integer tenantId;
+
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+    /**
+     * 位置
+     */
+    private Integer position;
+
+    /**
+     * 内容
+     */
+    private String text;
+
+    /**
+     * 划词栏位
+     */
+    private String scratchField;
+
+    /**
+     * 划词类型(0下划线,1高亮,2波浪线)
+     */
+    private Integer scratchType;
+
+    /**
+     * 划词颜色
+     */
+    private String color;
+
+    /**
+     * 标引备注
+     */
+    private String remark;
+
+    /**
+     * 创建来源
+     */
+    private Integer createFrom;
+
+    /**
+     * 存放id(专题库id/报告id)
+     */
+    private Integer projectId;
+
+    /**
+     * 公开类型(0私有1公有)
+     */
+    private Integer permissionType;
+
+    /**
+     * 公开范围(true只在来源处可见/false所有地方可见)
+     */
+    private String rangeType;
+}

+ 70 - 0
src/main/java/cn/cslg/pas/common/dto/business/UpdateScratchWordsDTO.java

@@ -0,0 +1,70 @@
+package cn.cslg.pas.common.dto.business;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/10
+ */
+@Data
+public class UpdateScratchWordsDTO {
+    private String id;
+    /**
+     * 是否公开
+     */
+    private   Boolean isPublic;
+
+    /**
+     * 标注颜色
+     */
+    private  String markColor;
+
+    /**
+     * 标注备注
+     */
+    private String markOteText;
+
+    /**
+     * 标注类型
+     */
+    private  Integer markType;
+
+    /**
+     * 标注栏位
+     */
+    private String markSelectField;
+
+    /**
+     * 标注选择文本
+     */
+    private  String markSelectText;
+
+    private Integer markSite;
+
+    /**
+     * 标注时间
+     */
+    private DateTime markTime;
+
+    /**
+     * 标注人
+     */
+    private String markUserId;
+
+    /**
+     * 标注范围
+     */
+    private Integer publicScope;
+
+    /**
+     * 标注专利数据库id/报告id
+     */
+    private Integer projectId;
+
+    /**
+     * 标注租户id
+     */
+    private Integer publicTenantId;
+}

+ 8 - 0
src/main/java/cn/cslg/pas/common/dto/customAnalyse/SelectCustomAnalyseDTO.java

@@ -0,0 +1,8 @@
+package cn.cslg.pas.common.dto.customAnalyse;
+
+import lombok.Data;
+
+@Data
+public class SelectCustomAnalyseDTO {
+
+}

+ 16 - 0
src/main/java/cn/cslg/pas/common/dto/customAnalyse/SelectCustomAnalyseListDTO.java

@@ -0,0 +1,16 @@
+package cn.cslg.pas.common.dto.customAnalyse;
+
+
+import lombok.Data;
+
+@Data
+public class SelectCustomAnalyseListDTO {
+
+    private String name;
+
+    private Integer permissions;
+
+    private Integer sort;
+
+    private Integer type;
+}

+ 17 - 17
src/main/java/cn/cslg/pas/common/utils/GenerateObjectUtil.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import org.springframework.cglib.beans.BeanGenerator;
 import org.springframework.stereotype.Component;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.List;
 import java.util.Map;
@@ -13,23 +14,6 @@ import java.util.Map;
 @Component
 public class GenerateObjectUtil {
 
-    /*public static Object generateObjectByField(List<DomainFieldDTO> domainFieldDTOS) throws Exception {
-        BeanGenerator generator = new BeanGenerator();
-        for (DomainFieldDTO domainFieldDTO : domainFieldDTOS) {
-            generator.addProperty(domainFieldDTO.getField(), java.lang.String.class);
-        }
-        // 构建对象
-        Object obj = generator.create();
-        // 赋值
-        for (DomainFieldDTO domainFieldDTO : domainFieldDTOS) {
-            BeanUtils.setProperty(obj, domainFieldDTO.getField(), domainFieldDTO.getValue());
-        }
-
-        // json转换去掉前缀
-        String gsonString = JSONObject.toJSONString(obj).replace("$cglib_prop_", "");
-        return JSON.parseObject(gsonString, Object.class);
-
-    }*/
 
     public static void setObjectProperty(Object obj, String propertyName, Object value) throws Exception {
         String setMethodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
@@ -37,4 +21,20 @@ public class GenerateObjectUtil {
         method.invoke(obj, value);
     }
 
+    /**
+     *
+     * @param obj
+     * @param propertyName
+     * @return
+     */
+    public static Object getPropertyValue(Object obj, String propertyName){
+        try {
+            String getMethodName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
+            Method method = obj.getClass().getMethod(getMethodName);
+            return method.invoke(obj);
+        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
 }

+ 51 - 0
src/main/java/cn/cslg/pas/common/utils/ParseByteToFileUtils.java

@@ -0,0 +1,51 @@
+package cn.cslg.pas.common.utils;
+
+import cn.cslg.pas.service.common.FileManagerService;
+import cn.hutool.core.util.IdUtil;
+import org.apache.commons.io.input.XmlStreamReaderException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class ParseByteToFileUtils {
+    @Autowired
+    private FileManagerService fileManagerService;
+
+    public static MultipartFile convertBytesToMultipartFile(byte[] fileData, String fileName) throws IOException {
+        InputStream inputStream = new ByteArrayInputStream(fileData);
+        MultipartFile multipartFile = new MockMultipartFile("file", fileName, "application/octet-stream", inputStream);
+        return multipartFile;
+    }
+
+    public String uploadFile(byte[] fileData) throws IOException {
+        List<MultipartFile> multipartFiles = new ArrayList<>();
+        //保存生成地址
+        String fileName = IdUtil.simpleUUID() + ".xls";
+        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
+        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
+        MultipartFile multipartFile = this.convertBytesToMultipartFile(fileData, encodedFileName);
+        multipartFiles.add(multipartFile);
+        List<String> fileGuids = fileManagerService.uploadFileGetGuid(multipartFiles);
+        String fileGuid = null;
+        if (!fileGuids.isEmpty()) {
+            fileGuid = fileGuids.get(0);
+        }
+        return fileGuid;
+    }
+}

+ 3 - 1
src/main/java/cn/cslg/pas/common/utils/ResponseEnum.java

@@ -14,7 +14,9 @@ public enum ResponseEnum {
     PATENT_IMPORT_TASK_SUCCESS(903, "导入任务完成"),
     PATENT_IMPORT_PATENT_PART_SUCCESS(900, "专利信息部分上传成功"),
     COMPARE_LITERATURE_BATCH(600,"批量上传对比文献"),
-    COMPARE_LITERATURE_BATCH_DONE(601,"批量上传对比文献完成");
+    COMPARE_LITERATURE_BATCH_DONE(601,"批量上传对比文献完成"),
+    PATENT_EXPORT_TASK(602,"导出专利信息"),
+    PATENT_EXPORT_TASK_DONE(603,"导出专利信息完成") ;
 
     private Integer code;
     private String message;

+ 15 - 0
src/main/java/cn/cslg/pas/common/vo/ConfigVOS/PatentConfigVO.java

@@ -0,0 +1,15 @@
+package cn.cslg.pas.common.vo.ConfigVOS;
+
+import lombok.Data;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Data
+public class PatentConfigVO {
+    private String type;
+    private String value;
+    private String exportClass;
+}
+

+ 5 - 6
src/main/java/cn/cslg/pas/common/vo/ImportTaskAMVO.java

@@ -84,14 +84,13 @@ public class ImportTaskAMVO {
     private char ifAddPDF;
     private char  ifAddCatalogue;
 
-    private Integer shouldSaveCounter;
+    private Integer threadCounter;
 
-    private Integer haveSaveCounter;
+    private Integer threadDoneCounter;
 
+    private Integer messageThreadDoneCounter;
 
-    private Integer shouldSaveMessageCounter;
-    private Integer haveSaveMessageCounter;
 
-
-    private Integer patentMessageShouldSaveCounter;
+    private Integer messageThreadCounter;
+    private String patentNoStr;
 }

+ 1 - 1
src/main/java/cn/cslg/pas/common/vo/business/MergePersonAgainVO.java

@@ -9,7 +9,7 @@ public class MergePersonAgainVO {
 
     private List<String> needMergedName;
 
-    private List<String> mergeName;
+    private List<String> mergedName;
 
     private Integer projectId;
 

+ 11 - 0
src/main/java/cn/cslg/pas/common/vo/customAnalyse/CustomAnalyseIdVO.java

@@ -0,0 +1,11 @@
+package cn.cslg.pas.common.vo.customAnalyse;
+
+import lombok.Data;
+
+@Data
+public class CustomAnalyseIdVO {
+
+    private Integer id;
+
+    private Integer type;
+}

+ 26 - 0
src/main/java/cn/cslg/pas/common/vo/customAnalyse/CustomAnalyseVO.java

@@ -0,0 +1,26 @@
+package cn.cslg.pas.common.vo.customAnalyse;
+
+
+import lombok.Data;
+
+@Data
+public class CustomAnalyseVO {
+
+    private Integer id;
+
+    private String name;
+
+    private Integer parentId;
+
+    //1系统公有   2系统私有  3数据库公有  4数据库私有
+    private Integer permissions;
+
+    private Integer projectId;
+
+    private Integer sort;
+
+    //类型 1组别  2分析项
+    private Integer type;
+
+    private Integer status;
+}

+ 17 - 0
src/main/java/cn/cslg/pas/common/vo/customAnalyse/SelectAnalyseVO.java

@@ -0,0 +1,17 @@
+package cn.cslg.pas.common.vo.customAnalyse;
+
+import lombok.Data;
+
+@Data
+public class SelectAnalyseVO {
+
+    private Integer projectId;
+
+    private Integer type;
+
+    private Integer tenantId;
+
+    private String creatorId;
+
+
+}

+ 11 - 0
src/main/java/cn/cslg/pas/common/vo/customAnalyse/SelectCustomAnalyseVO.java

@@ -0,0 +1,11 @@
+package cn.cslg.pas.common.vo.customAnalyse;
+
+import lombok.Data;
+
+@Data
+public class SelectCustomAnalyseVO {
+
+    private Integer projectId;
+
+    private Integer type;
+}

+ 6 - 0
src/main/java/cn/cslg/pas/common/vo/es/EsCustomFieldBatchVO.java

@@ -1,7 +1,9 @@
 package cn.cslg.pas.common.vo.es;
 
+import cn.cslg.pas.common.dto.PatentExport.PatentExportVO;
 import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.dto.es.EsCustomFieldValueDTO;
+import cn.cslg.pas.common.model.request.OrderDTO;
 import lombok.Data;
 
 import java.util.List;
@@ -23,8 +25,12 @@ public class EsCustomFieldBatchVO {
 
     private String searchQuery;
 
+    private List<OrderDTO> orderDTOList;
+
     private List<EsCustomFieldValueDTO> customFields;
 
     private List<EsCustomFieldDTO> esCustomFieldDTOS;
 
+    private List<PatentExportVO> selected;
+
 }

+ 16 - 0
src/main/java/cn/cslg/pas/controller/AssoGroupFeatureController.java

@@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 
 /**
  * 特征Controller层
@@ -104,4 +106,18 @@ public class AssoGroupFeatureController {
         }
         return Response.success("添加成功");
     }
+
+    @Operation(summary = "取消删除特征")
+    @GetMapping("/cancelRemoveFeature")
+    public Response cancelRemoveFeature( Integer featureId ) {
+        Records records =new Records();
+        try {
+           List<Integer> ids = assoGroupFeatureService.cancelRemoveFeature(featureId);
+           records.setData(ids);
+        }
+        catch (Exception e){
+            return  Response.error(e.getMessage());
+        }
+        return Response.success(records);
+    }
 }

+ 61 - 0
src/main/java/cn/cslg/pas/controller/CustomAnalyseController.java

@@ -0,0 +1,61 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseDTO;
+import cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseListDTO;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.vo.customAnalyse.CustomAnalyseIdVO;
+import cn.cslg.pas.common.vo.customAnalyse.CustomAnalyseVO;
+import cn.cslg.pas.common.vo.customAnalyse.SelectCustomAnalyseVO;
+import cn.cslg.pas.service.business.CustomAnalyseService;
+import io.swagger.v3.oas.annotations.Operation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RequestMapping(Constants.API_XiaoSHI + "/customAnalyse")
+@RestController
+public class CustomAnalyseController {
+
+    @Autowired
+    private CustomAnalyseService customAnalyseService;
+
+    @Operation(summary = "查询组别")
+    @PostMapping("/queryAnalyseGroup")
+    public Response queryAnalyseGroup(@RequestBody SelectCustomAnalyseVO vo) {
+        List<SelectCustomAnalyseListDTO> list = customAnalyseService.queryAnalyseGroup(vo);
+        return Response.success(list);
+    }
+
+    @Operation(summary = "查询组别详情")
+    @PostMapping("/queryAnalyseGroupDetail")
+    public Response queryAnalyseGroupDetail(@RequestBody CustomAnalyseIdVO vo) {
+        SelectCustomAnalyseDTO dto = customAnalyseService.queryAnalyseGroupDetail(vo);
+        return Response.success(dto);
+    }
+
+    @Operation(summary = "添加组别")
+    @PostMapping("/addAnalyseGroup")
+    public Response addAnalyseGroup(@RequestBody CustomAnalyseVO vo) {
+        Integer groupId = customAnalyseService.addAnalyseGroup(vo);
+        return Response.success(groupId);
+    }
+
+    @Operation(summary = "编辑组别")
+    @PostMapping("/editAnalyseGroup")
+    public Response editAnalyseGroup(@RequestBody CustomAnalyseVO vo) {
+        Integer groupId = customAnalyseService.editAnalyseGroup(vo);
+        return Response.success(groupId);
+    }
+
+    @Operation(summary = "删除组别")
+    @PostMapping("/delAnalyseGroup")
+    public Response delAnalyseGroup(@RequestBody CustomAnalyseIdVO vo) {
+        Integer groupId = customAnalyseService.delAnalyseGroup(vo);
+        return Response.success(groupId);
+    }
+}

+ 6 - 0
src/main/java/cn/cslg/pas/controller/ImportTaskController.java

@@ -19,19 +19,25 @@ import org.springframework.web.bind.annotation.*;
 @RequestMapping(Constants.API_XiaoSHI + "/importTask")
 @RestController
 public class ImportTaskController {
+
     @Autowired
     private SystemDictService systemDictService;
+
     @Autowired
     private CommonService commonService;
+
     @Autowired
     private ScenarioService scenarioService;
+
     @Autowired
     private AssoScenarioMatterService assoScenarioMatterService;
 
     @Autowired
     private PersonFieldService personFieldService;
+
     @Autowired
     private BusinessFactory businessFactory;
+
     @Operation(summary = "查询导入任务")
     @PostMapping("/queryImportTask")
     public Response queryImportTask(@RequestBody StringRequest stringRequest) throws Exception {

+ 17 - 4
src/main/java/cn/cslg/pas/controller/InvalidStatutesController.java

@@ -11,10 +11,8 @@ import cn.cslg.pas.service.business.InvalidStatutesService;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -28,6 +26,7 @@ import java.util.List;
 @RestController
 public class InvalidStatutesController {
     @Autowired
+
     private InvalidStatutesService invalidStatutesService;
 
     @Operation(summary = "添加无效法条")
@@ -61,4 +60,18 @@ public class InvalidStatutesController {
         }
         return Response.success("更新成功");
     }
+
+    @Operation(summary = "删除无效法条")
+    @GetMapping("/removeInvalidStatutes")
+    public Response removeInvalidStatutes(Integer id) {
+        Records records =new Records();
+        try {
+          Integer reId=  invalidStatutesService.removeInvalidStatutes(id);
+          records.setData(reId);
+        }
+        catch (Exception e){
+            return  Response.error(e.getMessage());
+        }
+        return Response.success(records);
+    }
 }

+ 21 - 8
src/main/java/cn/cslg/pas/controller/PatentClaimHistoryContorller.java

@@ -12,13 +12,13 @@ import cn.cslg.pas.service.business.invalidReport.PatentClaimHistoryService;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 权利要求历史
+ *
  * @Author xiexiang
  * @Date 2023/12/26
  */
@@ -31,7 +31,7 @@ public class PatentClaimHistoryContorller {
 
     @Operation(summary = "修改权利要求")
     @PostMapping("/alterPatentClaim")
-    public Response alterPatentClaim(@RequestBody AlterPatentClaimDTO alterPatentClaimDTO){
+    public Response alterPatentClaim(@RequestBody AlterPatentClaimDTO alterPatentClaimDTO) {
         Integer id = patentClaimHistoryService.alterPatentClaim(alterPatentClaimDTO);
         Records records = new Records();
         records.setData(id);
@@ -40,7 +40,7 @@ public class PatentClaimHistoryContorller {
 
     @Operation(summary = "编辑权利要求历史")
     @PostMapping("/editPatentClaimHistory")
-    public Response editPatentClaimHistory(@RequestBody EditPatentClaimHistoryDTO editPatentClaimHistoryDTO){
+    public Response editPatentClaimHistory(@RequestBody EditPatentClaimHistoryDTO editPatentClaimHistoryDTO) {
         Integer id = patentClaimHistoryService.editPatentClaimHistory(editPatentClaimHistoryDTO);
         Records records = new Records();
         records.setData(id);
@@ -50,18 +50,31 @@ public class PatentClaimHistoryContorller {
 
     @Operation(summary = "删除权利要求")
     @PostMapping("/deletePatentClaim")
-    public Response deletePatentClaim(@RequestBody PatentClaimDTO patentClaimDTO){
+    public Response deletePatentClaim(@RequestBody PatentClaimDTO patentClaimDTO) {
         patentClaimHistoryService.deletePatentClaim(patentClaimDTO);
         return Response.success("");
     }
 
     @Operation(summary = "查看权利要求修改历史")
     @PostMapping("/queryPatentClaimHistory")
-    public Response queryPatentClaimHistory(@RequestBody PatentClaimDTO patentClaimDTO){
+    public Response queryPatentClaimHistory(@RequestBody PatentClaimDTO patentClaimDTO) {
         PatentClaimHistoryVO patentClaimHistoryVO = patentClaimHistoryService.queryPatentClaimHistory(patentClaimDTO);
         Records records = new Records();
         records.setData(patentClaimHistoryVO);
         return Response.success(records);
     }
 
+
+    @Operation(summary = "取消删除权要")
+    @GetMapping("/cancelRemoveClaims")
+    public Response cancelRemoveClaims(Integer claimId) {
+        Records records = new Records();
+        try {
+            List<Integer> ids = patentClaimHistoryService.cancelRemoveClaims(claimId);
+            records.setData(ids);
+        } catch (Exception e) {
+            return  Response.error(e.getMessage());
+        }
+        return Response.success(records);
+    }
 }

+ 30 - 22
src/main/java/cn/cslg/pas/controller/PatentController.java

@@ -19,6 +19,7 @@ import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.factorys.businessFactory.BusinessFactory;
+import cn.cslg.pas.service.business.CustomAnalyseService;
 import cn.cslg.pas.service.business.PDFExportFirstPageService;
 import cn.cslg.pas.service.business.PatentExportService;
 import cn.cslg.pas.service.business.MergePersonService;
@@ -34,6 +35,7 @@ import org.springframework.core.io.InputStreamResource;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.ByteArrayInputStream;
@@ -215,11 +217,18 @@ public class PatentController {
         return Response.success(allCountry);
     }
 
+    @Operation(summary = "获取国内省份列表查询")
+    @GetMapping("/getAllProvince")
+    public Response getAllProvince() {
+        List<GetAllCountryDTO> allCountry = mergePersonService.getAllProvince();
+        return Response.success(allCountry);
+    }
+
     //--------------------导出-----------------------
     @PostMapping("/exportPDFFirstPage")
     @Operation(summary = "导出专利PDF")
     public ResponseEntity<InputStreamResource> exportPDFFirstPage(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
-        byte[] fileData = pdfExportFirstPageService.mergePDFFirstPage(EsVO);
+        byte[] fileData = pdfExportFirstPageService.mergePdfFirstPage(EsVO);
         //保存生成excel的地址
         String fileName = IdUtil.simpleUUID() + ".pdf";
         //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
@@ -230,27 +239,26 @@ public class PatentController {
                 .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
     }
 
-    @PostMapping("/export")
-    @Operation(summary = "导出专利")
-    public ResponseEntity<InputStreamResource> export(@RequestBody PatentExportParams params) throws IOException {
-        Integer taskId = 1;
-        TaskParams taskParams = new TaskParams();
-        taskParams.setTaskId(taskId);
-        taskParams.setTaskType(2);
-        taskParams.setProjectId(params.getProjectId());
-        taskParams.setSelected(JsonUtils.objectToJson(params.getSelected()));
-        taskParams.setCreateId("328");
-        byte[] fileData = patentExportService.exportPatent(taskParams);
-        //保存生成excel的地址
-        String fileName = "导出专利报表.xlsx";
+//    @PostMapping("/exportPatentExcel")
+//    @Operation(summary = "导出专利")
+//    public ResponseEntity<InputStreamResource> export(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
+//        byte[] fileData = patentExportService.exportPatent(EsVO);
+//        //保存生成excel的地址
 //        String fileName = IdUtil.simpleUUID() + ".xls";
-//        String directoryName = fileUtils.createDirectory();
-//        String savePath = fileUtils.getSavePath(directoryName);
-        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
-        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
-        return ResponseEntity.ok().contentLength(fileData.length)
-                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
-                .contentType(MediaType.parseMediaType("application/octet-stream"))
-                .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
+//        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
+//        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
+//        return ResponseEntity.ok().contentLength(fileData.length)
+//                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
+//                .contentType(MediaType.parseMediaType("application/octet-stream"))
+//                .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
+//    }
+
+    @PostMapping("/exportPatentExcel")
+    @Operation(summary = "导出专利")
+    public Response export(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
+        patentExportService.exportPatent(EsVO);
+        Records records = new Records();
+        records.setData("导出成功");
+        return Response.success(records);
     }
 }

+ 1 - 4
src/main/java/cn/cslg/pas/controller/ReportExportController.java

@@ -24,10 +24,7 @@ public class ReportExportController {
     @Operation(summary = "导出报告")
     @PostMapping("/export")
     public Response queryPatentProject(@RequestBody StringRequest stringRequest) throws Exception {
-//        reportExportService.exportReport(1,1);
-      String a
-         =commonService.readJsonFile("event.json");
-      System.out.println(a);
+   reportExportService.exportReport(1,1);
         return Response.success("records");
     }
 

+ 71 - 0
src/main/java/cn/cslg/pas/controller/ScratchWordsController.java

@@ -0,0 +1,71 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.business.ScratchWordsDTO;
+import cn.cslg.pas.common.dto.business.UpdateScratchWordsDTO;
+import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.domain.business.ScratchWords;
+import cn.cslg.pas.service.business.ScratchWordsService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/10
+ */
+@Tag(name = "划词高亮")
+@CrossOrigin
+@RestController
+@RequestMapping(Constants.API_XiaoSHI + "/scratchWords")
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class ScratchWordsController {
+    private final ScratchWordsService scratchWordsService;
+
+    @Operation(summary = "新增划词高亮")
+    @PostMapping("/add")
+    public Response add(@RequestBody ScratchWords scratchWords) {
+        if (scratchWords != null) {
+            String id = scratchWordsService.add(scratchWords);
+            Records records = new Records();
+            records.setData(id);
+            return Response.success(records);
+        } else {
+            return Response.error("请求参数为null");
+        }
+    }
+
+    @Operation(summary = "更新划词高亮")
+    @PostMapping("/update")
+    public Response update(@RequestBody UpdateScratchWordsDTO updateScratchWordsDTO) {
+        if (updateScratchWordsDTO != null) {
+            String id = scratchWordsService.update(updateScratchWordsDTO);
+            Records records = new Records();
+            records.setData(id);
+            return Response.success(records);
+        } else {
+            return Response.error("更新失败");
+        }
+    }
+
+    @Operation(summary = "删除标注")
+    @PostMapping("/removeScratchWrods")
+    public Response removeScratchWrods(@RequestBody List<String> ids) {
+        if (ids != null && !ids.isEmpty()) {
+            List<String> deleteIds = scratchWordsService.removeById(ids);
+            Records records = new Records();
+            records.setData(deleteIds);
+            return Response.success(records);
+        } else {
+            return Response.error("删除失败");
+        }
+    }
+
+
+}

+ 2 - 9
src/main/java/cn/cslg/pas/controller/TempleController.java

@@ -2,23 +2,16 @@ package cn.cslg.pas.controller;
 
 
 import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.common.dto.business.EsCountDTO;
 import cn.cslg.pas.common.dto.business.ReportTempleDTO;
 import cn.cslg.pas.common.utils.Response;
-import cn.cslg.pas.common.vo.business.EsCountVO;
 import cn.cslg.pas.common.vo.business.TempleByReportTypeVO;
-import cn.cslg.pas.service.business.TempleService;
+import cn.cslg.pas.service.business.ReportTempleService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
 
-import java.io.IOException;
-import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.Map;
 
 @Tag(name = "报告模板")
 @RestController
@@ -26,7 +19,7 @@ import java.util.Map;
 public class TempleController {
 
     @Autowired
-    private TempleService templeService;
+    private ReportTempleService templeService;
 
     @Operation(summary = "根据报告类型查询报告模板表")
     @PostMapping("/queryTempleByType")

+ 16 - 3
src/main/java/cn/cslg/pas/controller/outApi/PatentStarController.java

@@ -1,9 +1,7 @@
 package cn.cslg.pas.controller.outApi;
 
 import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.common.dto.InnerPatentPdfDTO;
-import cn.cslg.pas.common.dto.PatentColumnDTO;
-import cn.cslg.pas.common.dto.PatentStarListDTO;
+import cn.cslg.pas.common.dto.*;
 import cn.cslg.pas.common.dto.business.SelectClaimDTO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.utils.Response;
@@ -21,6 +19,7 @@ import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
+import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
 
@@ -141,4 +140,18 @@ public class PatentStarController {
         List<String> figures = patentStarApiService.getExternalFigure(appNo);
         return Response.success(figures);
     }
+
+    @GetMapping("/getPictureGuid")
+    @Operation(summary = "外部获取摘要附图")
+    public Response getPictureGuid(String appNo) throws IOException {
+        String pictureGuid = patentStarApiService.getPictureGuid(appNo);
+        return Response.success(pictureGuid);
+    }
+
+    @GetMapping("/getLegalStatus")
+    @Operation(summary = "外部获取法律状态")
+    public Response getLegalStatus(String appNo) throws ParseException {
+        ExternalLegalInfoDTO infoDTO = patentStarApiService.getLegalStatus(appNo);
+        return Response.success(infoDTO);
+    }
 }

+ 55 - 0
src/main/java/cn/cslg/pas/domain/business/CustomAnalysisItem.java

@@ -0,0 +1,55 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 自定义分析项目
+ *
+ * @Author zero
+ * @Date 2024/01/12
+ */
+@Data
+@TableName("os_custom_analysis_item")
+public class CustomAnalysisItem extends BaseEntity<CustomAnalysisItem> {
+
+    @TableField(value = "name")
+    private String name;
+
+    @TableField(value = "parent_id")
+    private Integer parentId;
+
+    @TableField(value = "permissions")
+    private Integer permissions;
+
+    @TableField(value = "project_id")
+    private Integer projectId;
+
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
+
+    @TableField(value = "sort")
+    private Integer sort;
+
+    @TableField(value = "type")
+    private Integer type;
+
+    @TableField(value = "status")
+    private Integer status;
+
+    @TableField(value = "creator_id")
+    private String creatorId;
+
+    @TableField(value = "creator")
+    private String creator;
+
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    @TableField(value = "update_time")
+    private Date updateTime;
+}

+ 53 - 0
src/main/java/cn/cslg/pas/domain/business/CustomAnalysisItemSchema.java

@@ -0,0 +1,53 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 自定义分析项目维度数据
+ *
+ * @Author zero
+ * @Date 2024/01/12
+ */
+@Data
+@TableName("os_custom_analysis_item_schema")
+public class CustomAnalysisItemSchema extends BaseEntity<CustomAnalysisItemSchema> {
+
+    @TableField(value = "dimension")
+    private String dimension;
+
+    @TableField(value = "field")
+    private Integer field;
+
+    @TableField(value = "expand")
+    private Integer expand;
+
+    @TableField(value = "type")
+    private Integer type;
+
+    @TableField(value = "ptype")
+    private Integer ptype;
+
+    @TableField(value = "num")
+    private Integer num;
+
+    @TableField(value = "status")
+    private Integer status;
+
+    @TableField(value = "creator_id")
+    private Integer creatorId;
+
+    @TableField(value = "creator")
+    private String creator;
+
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+}

+ 2 - 2
src/main/java/cn/cslg/pas/domain/business/ImportTaskCondition.java

@@ -19,8 +19,8 @@ public class ImportTaskCondition extends BaseEntity<ImportTaskCondition> {
      * 项目id
      */
     private Integer projectId;
-@TableField(exist = false)
-    private List<String> patentNos;
+    @TableField(value = "patent_nos")
+    private String patentNos;
     /**
      * 项目类型
      * 0专题库 1报告

+ 2 - 0
src/main/java/cn/cslg/pas/domain/business/ReportTemple.java

@@ -2,6 +2,7 @@ package cn.cslg.pas.domain.business;
 
 import cn.cslg.pas.domain.BaseEntity;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import nonapi.io.github.classgraph.json.Id;
 
@@ -16,6 +17,7 @@ import java.util.Date;
  * @since 2023-12-09
  */
 @Data
+@TableName("report_temple")
 public class ReportTemple extends BaseEntity<ReportTemple> {
     /**
      * 模板名称

+ 80 - 0
src/main/java/cn/cslg/pas/domain/business/ScratchWords.java

@@ -0,0 +1,80 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.util.Date;
+
+/**
+ * 标注
+ * @Author xiexiang
+ * @Date 2024/1/10
+ */
+@Data
+/*数据库中的表对应的类
+ */
+public class ScratchWords {
+    private String patentNo;
+    /**
+     * 是否公开
+     */
+    private Boolean isPublic;
+
+    /**
+     * 标注颜色
+     */
+    private  String markColor;
+
+    /**
+     * 标注备注
+     */
+    private String markOteText;
+
+    /**
+     * 标注类型
+     */
+    private Integer markType;
+
+    /**
+     * 标注栏位
+     */
+    private String markSelectField;
+
+    /**
+     * 标注选择文本
+     */
+    private String markSelectText;
+
+    private Integer markSite;
+
+    /**
+     * 标注时间
+     */
+    private Date markTime;
+
+    /**
+     * 标注人
+     */
+    private  String markUserId;
+
+    /**
+     * 标注范围 1仅在范围可见 0所有地方可见
+     */
+    private Integer publicScope;
+
+    /**
+     * 标注专利数据库id/报告id
+     */
+    private Integer projectId;
+
+    /**
+     * 标注租户id
+     */
+    private Integer publicTenantId;
+
+
+}

+ 14 - 12
src/main/java/cn/cslg/pas/domain/es/Marking.java

@@ -7,6 +7,8 @@ import lombok.NoArgsConstructor;
 import org.joda.time.DateTime;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
+
 /**
  * 标注
  */
@@ -19,69 +21,69 @@ public class Marking {
      * 是否公开
      */
     @JsonProperty("is_public")
-    String isPublic;
+  private   Boolean isPublic;
 
     /**
      * 标注颜色
      */
     @JsonProperty("mark_Color")
-    String markColor;
+    private  String markColor;
 
     /**
      * 标注备注
      */
     @JsonProperty("mark_noteText")
-    String mark_oteText;
+    private String markOteText;
 
     /**
      * 标注类型
      */
     @JsonProperty("mark_type")
-    Integer markType;
+    private  Integer markType;
 
     /**
      * 标注栏位
      */
     @JsonProperty("mark_selectField")
-    String mark_selectField;
+    private String markSelectField;
 
     /**
      * 标注选择文本
      */
     @JsonProperty("mark_selectText")
-    String markSelectText;
+    private  String markSelectText;
 
     @JsonProperty("mark_site")
-    String markSite;
+    private Integer markSite;
 
     /**
      * 标注时间
      */
     @JsonProperty("mark_time")
-    DateTime markTime;
+    private Date markTime;
 
     /**
      * 标注人
      */
     @JsonProperty("mark_user_id")
-    Integer markUserId;
+    private String markUserId;
 
     /**
      * 标注范围
      */
     @JsonProperty("public_scope")
-    Integer publicScope;
+    private Integer publicScope;
 
     /**
      * 标注专利数据库id/报告id
      */
     @JsonProperty("public_project_id")
-    Integer projectId;
+    private Integer projectId;
 
     /**
      * 标注租户id
      */
     @JsonProperty("public_tenant_id")
-    Integer publicTenantId;
+    private Integer publicTenantId;
 
 }

+ 1 - 1
src/main/java/cn/cslg/pas/domain/es/Patent.java

@@ -418,7 +418,7 @@ public class Patent {
      * 标注
      */
     @JsonProperty("markings")
-    List<Marking> markings;
+    Marking markings;
     @JsonProperty("patent_join")
     PatentJoin patentJoin;
 

+ 3 - 2
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildCountAnalysisBuilder.java

@@ -36,7 +36,8 @@ public class ChildCountAnalysisBuilder implements IEsCountAnalysisBuilder {
         if (ifHaveChild) {
 
             if (!CollectionUtils.isEmpty(values)) {
-                termAgg = AggregationBuilders.terms(i -> i.field(field).include(j -> j.terms(values)).size(topN));
+                termAgg = AggregationBuilders.terms(i -> i.field("custom_field.stats_value.raw").include(j -> j.terms(values)).size(topN));
+//                termAgg = AggregationBuilders.terms(i -> i.field(field).include(j -> j.terms(values)).size(topN));
             } else {
                 if (StringUtils.isNotEmpty(valueOne) && StringUtils.isEmpty(valueTwo)) {
                     String str = "*";
@@ -58,7 +59,7 @@ public class ChildCountAnalysisBuilder implements IEsCountAnalysisBuilder {
             }
         } else {
             if (!CollectionUtils.isEmpty(values)) {
-                termAgg = AggregationBuilders.terms(i -> i.field(field).include(j -> j.terms(values)).size(topN));
+                termAgg = AggregationBuilders.terms(i -> i.field("custom_field.field_value.raw").include(j -> j.terms(values)).size(topN));
             } else {
                 if (StringUtils.isNotEmpty(valueOne) && StringUtils.isEmpty(valueTwo)) {
                     String str = "*";

+ 16 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetCommonValue.java

@@ -0,0 +1,16 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class GetCommonValue implements GetValueImp{
+    @Override
+    public String getValue(Object value) {
+        String reValue = value.toString();
+        return reValue;
+    }
+}

+ 25 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetDateValue.java

@@ -0,0 +1,25 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class GetDateValue implements GetValueImp{
+    @Override
+    public String getValue(Object value) {
+        Date inputDate = (Date)value;
+        String reValue;
+        // 创建SimpleDateFormat对象,指定输出日期的格式
+        SimpleDateFormat outputDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        // 将Date对象格式化为字符串
+        reValue = outputDateFormat.format(inputDate);
+        return reValue;
+    }
+}

+ 21 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetNameValue.java

@@ -0,0 +1,21 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class GetNameValue implements GetValueImp{
+    @Override
+    public String getValue(Object value) {
+        if (value != null) {
+            String reValue = value.toString();
+            String result = reValue.substring(1, reValue.length() - 1);
+            return result;
+        } else {
+            return null;
+        }
+    }
+}

+ 8 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetValueImp.java

@@ -0,0 +1,8 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+
+import cn.cslg.pas.common.model.cronModel.SqlObject;
+
+public interface GetValueImp {
+    public String getValue(Object value);
+}

+ 25 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/PatentExportFactory.java

@@ -0,0 +1,25 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import cn.cslg.pas.factorys.getSqlFactorys.GetSqlObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class PatentExportFactory {
+    @Autowired
+    private Map<String, GetValueImp> getValueImpMap;
+
+
+    public GetValueImp getClass(String sqlType) {
+        GetValueImp bean1 = getValueImpMap.get(sqlType);
+        return bean1;
+    }
+}

+ 23 - 0
src/main/java/cn/cslg/pas/mapper/CustomAnalysisItemMapper.java

@@ -0,0 +1,23 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseListDTO;
+import cn.cslg.pas.common.vo.customAnalyse.SelectAnalyseVO;
+import cn.cslg.pas.common.vo.customAnalyse.SelectCustomAnalyseVO;
+import cn.cslg.pas.domain.business.CustomAnalysisItem;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 自定义分析项目mapper
+ * @Author zero
+ * @Date 2024/01/12
+ */
+@Repository
+public interface CustomAnalysisItemMapper extends BaseMapper<CustomAnalysisItem> {
+
+    public List<SelectCustomAnalyseListDTO> queryAnalyseGroup(@Param("vo") SelectAnalyseVO vo);
+
+}

+ 14 - 0
src/main/java/cn/cslg/pas/mapper/CustomAnalysisItemSchemaMapper.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.CustomAnalysisItemSchema;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 自定义分析项目维度数据mapper
+ * @Author zero
+ * @Date 2024/01/12
+ */
+@Repository
+public interface CustomAnalysisItemSchemaMapper extends BaseMapper<CustomAnalysisItemSchema> {
+}

+ 13 - 0
src/main/java/cn/cslg/pas/mapper/ScratchWordsMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.ScratchWords;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/10
+ */
+@Repository
+public interface ScratchWordsMapper extends BaseMapper<ScratchWords> {
+}

+ 1 - 10
src/main/java/cn/cslg/pas/service/ReportExportService.java

@@ -2,16 +2,12 @@ package cn.cslg.pas.service;
 
 import cn.cslg.pas.common.dto.PatentColumnDTO;
 import cn.cslg.pas.common.dto.PatentDTO;
-import cn.cslg.pas.common.dto.PatentDetailDTO;
-import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.dto.es.EsCustomFieldValueDTO;
 import cn.cslg.pas.common.model.SystemMO;
 import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.request.StringRequest;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.vo.*;
-import cn.cslg.pas.common.vo.business.AllCustomFieldVO;
-import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.domain.ReportDocument;
 import cn.cslg.pas.domain.business.*;
 import cn.cslg.pas.domain.es.Text;
@@ -21,8 +17,6 @@ import cn.cslg.pas.service.business.*;
 import cn.cslg.pas.service.business.es.*;
 import cn.cslg.pas.service.common.FileManagerService;
 import cn.hutool.core.util.IdUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.deepoove.poi.XWPFTemplate;
 import com.deepoove.poi.config.Configure;
@@ -32,9 +26,7 @@ import com.deepoove.poi.data.Pictures;
 import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.usermodel.PictureData;
 import org.ddr.poi.html.HtmlRenderPolicy;
-import org.joda.time.format.FormatUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -42,13 +34,12 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @Slf4j
 @Service
 public class ReportExportService {
     @Autowired
-    private TempleService templeService;
+    private ReportTempleService templeService;
     @Autowired
     private FileUtils fileUtils;
     @Autowired

+ 119 - 0
src/main/java/cn/cslg/pas/service/business/CustomAnalyseService.java

@@ -0,0 +1,119 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseDTO;
+import cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseListDTO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.common.vo.customAnalyse.CustomAnalyseIdVO;
+import cn.cslg.pas.common.vo.customAnalyse.CustomAnalyseVO;
+import cn.cslg.pas.common.vo.customAnalyse.SelectAnalyseVO;
+import cn.cslg.pas.common.vo.customAnalyse.SelectCustomAnalyseVO;
+import cn.cslg.pas.domain.business.CustomAnalysisItem;
+import cn.cslg.pas.exception.UnLoginException;
+import cn.cslg.pas.mapper.CustomAnalysisItemMapper;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 自定义分析项目Service层
+ *
+ * @Author zero
+ * @Date 2024/01/12
+ */
+@Service
+public class CustomAnalyseService extends ServiceImpl<CustomAnalysisItemMapper, CustomAnalysisItem> {
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private LoginUtils loginUtils;
+
+    @Autowired
+    private CustomAnalysisItemMapper customAnalysisItemMapper;
+
+    public List<SelectCustomAnalyseListDTO> queryAnalyseGroup(SelectCustomAnalyseVO vo) {
+        List<SelectCustomAnalyseListDTO> list = new ArrayList<>();
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new UnLoginException("未登录");
+        }
+
+        SelectAnalyseVO analyseVO = new SelectAnalyseVO();
+        analyseVO.setProjectId(vo.getProjectId());
+        analyseVO.setType(vo.getType());
+        analyseVO.setTenantId(personnelVO.getTenantId());
+        analyseVO.setCreatorId(personnelVO.getId());
+        customAnalysisItemMapper.queryAnalyseGroup(analyseVO);
+        return list;
+    }
+
+
+    public SelectCustomAnalyseDTO queryAnalyseGroupDetail(CustomAnalyseIdVO vo) {
+        SelectCustomAnalyseDTO dto = new SelectCustomAnalyseDTO();
+        CustomAnalysisItem item = customAnalysisItemMapper.selectById(vo.getId());
+        if (ObjectUtil.isNotEmpty(item)) {
+            BeanUtils.copyProperties(item, dto);
+        }
+        return dto;
+    }
+
+    public Integer addAnalyseGroup(CustomAnalyseVO vo) {
+
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new UnLoginException("未登录");
+        }
+
+        CustomAnalysisItem item = new CustomAnalysisItem();
+        BeanUtils.copyProperties(vo, item);
+        item.setTenantId(personnelVO.getTenantId());
+        item.setCreatorId(personnelVO.getId());
+        item.setCreator(personnelVO.getName());
+        item.setCreateTime(new Date());
+        item.setUpdateTime(new Date());
+        item.insert();
+        return item.getId();
+    }
+
+    public Integer editAnalyseGroup(CustomAnalyseVO vo) {
+
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new UnLoginException("未登录");
+        }
+
+        CustomAnalysisItem item = customAnalysisItemMapper.selectById(vo.getId());
+        BeanUtils.copyProperties(vo, item);
+        item.setTenantId(personnelVO.getTenantId());
+        item.setCreatorId(personnelVO.getId());
+        item.setCreator(personnelVO.getName());
+        item.setUpdateTime(new Date());
+        item.insert();
+        return item.getId();
+    }
+
+    public Integer delAnalyseGroup(CustomAnalyseIdVO vo) {
+        CustomAnalysisItem item = customAnalysisItemMapper.selectById(vo.getId());
+        customAnalysisItemMapper.deleteById(vo.getId());
+        return item.getId();
+    }
+
+}

+ 56 - 4
src/main/java/cn/cslg/pas/service/business/ImportTaskService.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.service.business;
 
+import cn.cslg.pas.common.dto.ExportTaskDTO;
 import cn.cslg.pas.common.dto.ImportTaskDTO;
 import cn.cslg.pas.common.dto.PatentStarListDTO;
 import cn.cslg.pas.common.model.cronModel.Personnel;
@@ -81,7 +82,6 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
         List<String> sqls = formatQueryService.reSqls(queryRequest, "importTask");
         //根据sql查询事件信息
         List<ImportTaskVO> importTaskVOS = importTaskMapper.getImportTask(sqls.get(0), sqls.get(1), sqls.get(2));
-
         //查询总数
         Long total = importTaskMapper.getImportTaskCount(sqls.get(0));
 
@@ -134,7 +134,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
         if (importTaskDTO.getType() == null) {
             importTaskDTO.setType(4);
         }
-
+ List<String> addPatentNos =importTaskDTO.getPatentNos();
         ImportTaskCondition importTaskCondition = new ImportTaskCondition();
         if (importTaskDTO.getImportToId() != null) {
             if (importTaskDTO.getImportToType().equals(0)) {
@@ -161,7 +161,10 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
         importTaskCondition.setOrderBy(importTaskDTO.getOrderBy());
         importTaskCondition.setOrderByType(importTaskDTO.getOrderByType());
         importTaskCondition.setCreateId(personnelVO.getId());
-
+        if (importTaskDTO.getPatentNos() != null && importTaskDTO.getPatentNos().size() > 0) {
+            String jsons = JSONObject.toJSON(importTaskDTO.getPatentNos()).toString();
+            importTaskCondition.setPatentNos(jsons);
+        }
         String fieldJson = JsonUtils.objectToJson(importTaskCondition);
         importTaskCondition.setCustomFields(fieldJson);
         importTaskCondition.insert();
@@ -196,7 +199,7 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
                 throw new XiaoShiException("文件错误");
             }
         } else if (importTaskCondition.getType().equals(4)) {
-            try {
+            try {if(addPatentNos==null||addPatentNos.size()==0) {
                 PatentStarListDTO patentStarListDto = new PatentStarListDTO()
                         .setCurrentQuery(importTaskCondition.getSearchCondition())
                         .setOrderBy(importTaskCondition.getOrderBy())
@@ -212,6 +215,10 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
                 } else {
                     importTask.setAllNum((Integer) resultMap.get("total"));
                 }
+            }
+            else {
+                importTask.setAllNum(addPatentNos.size());
+            }
             } catch (Exception e) {
                 throw new XiaoShiException("文件错误");
             }
@@ -378,4 +385,49 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
         }
 
     }
+
+    public Integer addExportExcel(ExportTaskDTO exportTaskDTO){
+        if (exportTaskDTO == null) {
+            throw new XiaoShiException("入参不能为空");
+        }
+//        PersonnelVO personnelVO = new PersonnelVO();
+//        try {
+//            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+//        } catch (Exception e) {
+//            throw new UnLoginException("未登录");
+//        }
+        ImportTaskCondition importTaskCondition = new ImportTaskCondition();
+        importTaskCondition.setFileGuid(exportTaskDTO.getFileGuid());
+        if (exportTaskDTO.getProjectId() != null) {
+            importTaskCondition.setProjectId(exportTaskDTO.getProjectId());
+        }
+        importTaskCondition.setIfUpdate(false);
+        importTaskCondition.setType(exportTaskDTO.getType());
+//        importTaskCondition.setCreateId(personnelVO.getId());
+        importTaskCondition.setCreateId("328");
+        importTaskCondition.insert();
+        Integer importTaskConditionId = importTaskCondition.getId();
+        if (importTaskConditionId != null) {
+            ImportTask importTask = new ImportTask();
+            importTask.setImportTaskConditionId(importTaskConditionId);
+            importTask.setType(exportTaskDTO.getType());
+            importTask.setAllNum(exportTaskDTO.getAllNum());
+            importTask.setDefaultNum(exportTaskDTO.getDefaultNum());
+            importTask.setFinishTime(exportTaskDTO.getFinishTime());
+            importTask.setCreateId("328");
+            String name = "";
+            if (exportTaskDTO.getType().equals(6)) {
+                name = "【专利】";
+            } else if (exportTaskDTO.getType().equals(7)){
+                name = "【PDF首页】";
+            }
+//            String importTaskName = "导出" + name + "-" + personnelVO.getName();
+            String importTaskName = "导出" + name + "-" + "朱豪";
+            importTask.setName(importTaskName);
+            importTask.insert();
+            return importTask.getId();
+        } else {
+            throw new XiaoShiException("导出任务记录失败");
+        }
+    }
 }

+ 31 - 4
src/main/java/cn/cslg/pas/service/business/InvalidStatutesService.java

@@ -5,10 +5,7 @@ import cn.cslg.pas.common.dto.business.InvalidStatutesDTO;
 import cn.cslg.pas.common.dto.invalidDTO.UpdateMessageDTO;
 import cn.cslg.pas.common.utils.GenerateObjectUtil;
 import cn.cslg.pas.common.vo.invalidVO.InvalidStatutesVO;
-import cn.cslg.pas.domain.business.AssoGroupFeature;
-import cn.cslg.pas.domain.business.InvalidStatutes;
-import cn.cslg.pas.domain.business.PatentClaim;
-import cn.cslg.pas.domain.business.SystemDict;
+import cn.cslg.pas.domain.business.*;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.InvalidStatutesMapper;
 import cn.cslg.pas.service.business.invalidReport.PatentClaimService;
@@ -17,7 +14,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.ArrayList;
@@ -38,6 +37,9 @@ public class InvalidStatutesService extends ServiceImpl<InvalidStatutesMapper, I
 
     @Autowired
     private PatentClaimService patentClaimService;
+    @Autowired
+    @Lazy
+    private ProofGroupService proofGroupService;
 
     /**
      * 添加无效法条
@@ -210,4 +212,29 @@ public class InvalidStatutesService extends ServiceImpl<InvalidStatutesMapper, I
         }
         return true;
     }
+
+    /**
+     *
+     * @param id
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public Integer removeInvalidStatutes(Integer id){
+        if(id==null){
+            throw new XiaoShiException("请输入无效法条");
+        }
+        InvalidStatutes invalidStatutes =this.getById(id);
+        if(invalidStatutes==null){
+            throw new XiaoShiException("无效法条不存在");
+        }
+    //根据无效法条id 查询是否有证据组合
+        LambdaQueryWrapper<ProofGroup> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(ProofGroup::getInvalidStatutesId,id);
+        List<ProofGroup> proofGroups =proofGroupService.list(queryWrapper);
+          if(proofGroups.size()>0){
+              throw new XiaoShiException("请先删除该法条的证据组合");
+          }
+          this.removeById(id);
+          return id;
+    }
 }

+ 68 - 36
src/main/java/cn/cslg/pas/service/business/MergePersonService.java

@@ -184,7 +184,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
     public Integer mergePersonAgain(MergePersonAgainVO vo) throws Exception {
         List<String> mergedNames = vo.getNeedMergedName();
-        List<String> mergeName = vo.getMergeName();
+        List<String> mergeName = vo.getMergedName();
         List<String> nameList = new ArrayList<>();
         if (!CollectionUtils.isEmpty(mergedNames)) {
             for (String mergedName : mergedNames) {
@@ -427,7 +427,6 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
         List<GetEsAllPersonDTO> personDTOS = new ArrayList<>();
         for (Hit<Patent> hit : hits) {
             Patent esMess = hit.source();
-            PersonAddress applicantAddr = null;
             GetEsAllPersonDTO personDTO = new GetEsAllPersonDTO();
             personDTO.setApplicantAddr(esMess.getApplicantAddr());
             personDTO.setRightHolderAddr(esMess.getRightHolderAddr());
@@ -480,7 +479,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
                     for (String s : rightHolder) {
                         GetAllPersonDTO dto = new GetAllPersonDTO();
                         dto.setName(s);
-                        dto.setType(0);
+                        dto.setType(1);
                         if (StringUtils.isNotEmpty(rightHolderAddr.getCountry())) {
                             dto.setCountry(rightHolderAddr.getCountry());
                         }
@@ -494,7 +493,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
                     for (String s : rightHolder) {
                         GetAllPersonDTO dto = new GetAllPersonDTO();
                         dto.setName(s);
-                        dto.setType(0);
+                        dto.setType(1);
                         rightDTOS.add(dto);
                     }
                 }
@@ -504,13 +503,19 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
         //申请人和权利人相同的去除
         if (!CollectionUtils.isEmpty(applicantDTOS) && !CollectionUtils.isEmpty(rightDTOS)) {
             for (GetAllPersonDTO applicantDTO : applicantDTOS) {
-                rightDTOS.removeIf(rightDTO -> applicantDTO.getName().equals(rightDTO.getName()));
+                rightDTOS.removeIf(rightDTO -> rightDTO.getName().equals(applicantDTO.getName()));
             }
         }
         //装载在同一个集合
         personDTOList.addAll(applicantDTOS);
         personDTOList.addAll(rightDTOS);
 
+        if (!CollectionUtils.isEmpty(personDTOList)) {
+            Set<GetAllPersonDTO> set = new TreeSet<>(Comparator.comparing(GetAllPersonDTO::getName));
+            set.addAll(personDTOList);
+            personDTOList = new ArrayList<>(set);
+        }
+
         //发明人
         List<GetAllPersonDTO> inventorDTOS = new ArrayList<>();
         if (!CollectionUtils.isEmpty(personDTOS)) {
@@ -529,6 +534,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
 //        IPage<MergePerson> page = new Page<>(vo.getPageNum(), vo.getPageSize());
         LambdaQueryWrapper<MergePerson> wrapper = new LambdaQueryWrapper<MergePerson>()
                 .eq(MergePerson::getProjectId, vo.getProjectId())
+                .eq(MergePerson::getType, type)
                 .eq(StringUtils.isNotEmpty(vo.getName()), MergePerson::getName, vo.getName())
                 .orderByDesc(MergePerson::getCreateTime);
 //        IPage<MergePerson> record = mergePersonMapper.selectPage(page, wrapper);
@@ -550,6 +556,8 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
                 merge.setRemark(person.getRemark());
                 merge.setType(personType);
                 merge.setMergeId(person.getId());
+                merge.setAbbreviation(person.getAbbreviation());
+                merge.setProvince(person.getProvince());
                 mergeList.add(merge);
 
                 if (personType == 0) {
@@ -621,7 +629,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
         String name = vo.getName();
         Integer projectId = vo.getProjectId();
         MergePerson mergePerson = mergePersonMapper.selectOne(new LambdaQueryWrapper<MergePerson>()
-                .eq(MergePerson::getMergedName, name)
+                .eq(MergePerson::getName, name)
                 .eq(MergePerson::getProjectId, projectId));
         if (ObjectUtil.isNotEmpty(mergePerson)) {
             Integer personId = mergePerson.getId();
@@ -682,42 +690,46 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
     public Integer delMergePerson(MergePersonIdVO vo) throws IOException {
         Integer type = vo.getType();
         MergePerson mergePerson = mergePersonMapper.selectById(vo.getId());
-        String name = mergePerson.getName();
         if (ObjectUtil.isNotEmpty(mergePerson)) {
             LambdaQueryWrapper<MergePerson> wrapper = new LambdaQueryWrapper<MergePerson>()
                     .eq(BaseEntity::getId, vo.getId());
             this.remove(wrapper);
 
-            SearchRequest.Builder builder = new SearchRequest.Builder();
-            //设置查询索引
-            builder.index("patent");
-            List<Query> queries = new ArrayList<>();
-            if (type == 0) {
-                Query q1 = QueryBuilders.term(i -> i.field("merge_applicant.name.raw").value(name));
-                Query query1 = QueryBuilders.nested(i -> i.path("merge_applicant").query(q1));
-                Query q2 = QueryBuilders.term(i -> i.field("merge_right_holder.name.raw").value(name));
-                Query query2 = QueryBuilders.nested(i -> i.path("merge_right_holder").query(q2));
-                queries.add(query1);
-                queries.add(query2);
-            } else {
-                Query q = QueryBuilders.term(i -> i.field("merge_inventor.name.raw").value(name));
-                Query query3 = QueryBuilders.nested(i -> i.path("merge_inventor").query(q));
-                queries.add(query3);
-            }
-            Query query = QueryBuilders.bool(i -> i.must(queries));
-            builder.query(query);
-            SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
-            List<Hit<Patent>> hits = response.hits().hits();
-            Map<String, Patent> map = new HashMap<>();
-            for (Hit<Patent> hit : hits) {
-                String id = hit.id();
-                map.put(id, hit.source());
-            }
+            String name = mergePerson.getName();
+            String mergedName = mergePerson.getMergedName();
+            List<String> list = JSONArray.parseArray(mergedName, String.class);
+            if (!CollectionUtils.isEmpty(list)) {
+                SearchRequest.Builder builder = new SearchRequest.Builder();
+                //设置查询索引
+                builder.index("patent");
+                List<Query> queries = new ArrayList<>();
+                if (type == 0) {
+                    Query q1 = QueryBuilders.term(i -> i.field("merge_applicant.name.raw").value(name));
+                    Query query1 = QueryBuilders.nested(i -> i.path("merge_applicant").query(q1));
+                    Query q2 = QueryBuilders.term(i -> i.field("merge_right_holder.name.raw").value(name));
+                    Query query2 = QueryBuilders.nested(i -> i.path("merge_right_holder").query(q2));
+                    queries.add(query1);
+                    queries.add(query2);
+                } else {
+                    Query q = QueryBuilders.term(i -> i.field("merge_inventor.name.raw").value(name));
+                    Query query3 = QueryBuilders.nested(i -> i.path("merge_inventor").query(q));
+                    queries.add(query3);
+                }
+                Query query = QueryBuilders.bool(i -> i.must(queries));
+                builder.query(query);
+                SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+                List<Hit<Patent>> hits = response.hits().hits();
+                Map<String, Patent> map = new HashMap<>();
+                for (Hit<Patent> hit : hits) {
+                    String id = hit.id();
+                    map.put(id, hit.source());
+                }
 
-            if (!CollectionUtils.isEmpty(map)) {
-                for (String id : map.keySet()) {
-                    Patent patent = map.get(id);
-                    esService.delMergePerson(patent, id, type, mergePerson.getName());
+                if (!CollectionUtils.isEmpty(map)) {
+                    for (String id : map.keySet()) {
+                        Patent patent = map.get(id);
+                        esService.delMergePerson(patent, id, type, mergePerson.getName());
+                    }
                 }
             }
         }
@@ -743,4 +755,24 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
         }
         return list;
     }
+
+    /**
+     * 获取国内省份列表查询
+     * @return
+     */
+    public List<GetAllCountryDTO> getAllProvince() {
+        List<GetAllCountryDTO> list = new ArrayList<>();
+        List<SystemDict> countries = systemDictMapper.selectList(new LambdaQueryWrapper<SystemDict>()
+                .eq(SystemDict::getType, "PROVINCE"));
+        if (!CollectionUtils.isEmpty(countries)) {
+            countries.forEach(county -> {
+                GetAllCountryDTO dto = new GetAllCountryDTO();
+                dto.setLabel(county.getLabel());
+                dto.setValue(county.getValue());
+                dto.setType(county.getType());
+                list.add(dto);
+            });
+        }
+        return list;
+    }
 }

+ 136 - 94
src/main/java/cn/cslg/pas/service/business/PDFExportFirstPageService.java

@@ -13,6 +13,7 @@ import cn.cslg.pas.service.business.es.EsPatentService;
 import cn.cslg.pas.service.business.es.EsService;
 import cn.cslg.pas.service.common.FileManagerService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.input.XmlStreamReaderException;
 import org.apache.pdfbox.multipdf.PDFMergerUtility;
 import org.apache.pdfbox.io.MemoryUsageSetting;
 import org.apache.pdfbox.pdmodel.PDDocument;
@@ -46,37 +47,78 @@ public class PDFExportFirstPageService {
     private EsPatentService patentService;
 
 
+    public byte[] mergePdfFirstPage(EsCustomFieldBatchVO EsVO){
+        try {
+            List<String> patentNos = this.getPatentNo(EsVO);
+            byte[] result = this.mergePerPatentPDF(patentNos);
+            return result;
+        } catch (Exception e) {
+            throw new XiaoShiException("合并错误");
+        }
+    }
 
-    public byte[] mergePDFFirstPage(EsCustomFieldBatchVO EsVO) throws IOException {
+    /**
+     * 获取专利号
+     * @param EsVO
+     * @return
+     * @throws IOException
+     */
+    public List<String> getPatentNo(EsCustomFieldBatchVO EsVO) throws IOException {
         //初始化
         Integer startNum = EsVO.getStartNumber();
         Integer endNum = EsVO.getEndNumber();
         List<String> isAdd = EsVO.getIsAdd();
         List<String> isDel = EsVO.getIsDelete();
-        // 创建一个PDFMergerUtility实例
         try {
             if (!CollectionUtils.isEmpty(isAdd) && startNum <= 1 && endNum < 1) {
                 isAdd.removeAll(isDel);
                 //创建一个输出流
-                byte[] result = this.mergePerPatentPDF(isAdd);
-                return result;
+                return isAdd;
             } else if (startNum > 1 && endNum > 0){
                 List<String> patentNos = new ArrayList<>();
                 try {
                     patentNos = esCustomFieldService.getPatentNos(EsVO);
-                    byte[] result = this.mergePerPatentPDF(patentNos);
-                    return result;
+                    return patentNos;
                 } catch (Exception e) {
                     throw new XiaoShiException("");
                 }
             } else {
-                return new byte[0];
+                throw new XiaoShiException("入参错误");
             }
-        } catch (FileNotFoundException e) {
-            throw new FileNotFoundException();
+        } catch (Exception e) {
+            throw new XiaoShiException("获取专利号错误");
         }
     }
 
+//    public byte[] mergePDFFirstPage(EsCustomFieldBatchVO EsVO) throws IOException {
+//        //初始化
+//        Integer startNum = EsVO.getStartNumber();
+//        Integer endNum = EsVO.getEndNumber();
+//        List<String> isAdd = EsVO.getIsAdd();
+//        List<String> isDel = EsVO.getIsDelete();
+//        try {
+//            if (!CollectionUtils.isEmpty(isAdd) && startNum <= 1 && endNum < 1) {
+//                isAdd.removeAll(isDel);
+//                //创建一个输出流
+//                byte[] result = this.mergePerPatentPDF(isAdd);
+//                return result;
+//            } else if (startNum > 1 && endNum > 0){
+//                List<String> patentNos = new ArrayList<>();
+//                try {
+//                    patentNos = esCustomFieldService.getPatentNos(EsVO);
+//                    byte[] result = this.mergePerPatentPDF(patentNos);
+//                    return result;
+//                } catch (Exception e) {
+//                    throw new XiaoShiException("");
+//                }
+//            } else {
+//                throw new XiaoShiException("入参错误");
+//            }
+//        } catch (FileNotFoundException e) {
+//            throw new FileNotFoundException();
+//        }
+//    }
+
 
 
 //    /**
@@ -105,93 +147,93 @@ public class PDFExportFirstPageService {
 //        return pdfData;
 //    }
 
-    /**
-     * 判断文件数组是否为空
-     * @param pdfDocuments
-     * @return
-     */
-    private boolean isByteEmpty(byte[][] pdfDocuments) {
-        return pdfDocuments == null || pdfDocuments.length == 0 || Arrays.stream(pdfDocuments).allMatch(array -> array == null || array.length == 0);
-    }
-
-    /**
-     * 3
-     * @param pdfDatas
-     * @return
-     * @throws IOException
-     */
-    public byte[] mergeFirstPage(byte[][] pdfDatas) throws IOException{
-        //创建一个输出流
-        try {
-            // 创建一个PDFMergerUtility实例
-            PDFMergerUtility merger = new PDFMergerUtility();
-            PDDocument resultDocument = new PDDocument();
-            //逐个处理每个pdf文件
-            for (byte[] pdfData : pdfDatas) {
-                // 加载每个输入的PDF文档
-                PDDocument document = PDDocument.load(pdfData);
-                // 获取第一页
-                PDPage firstPage = document.getPage(0);
-                // 创建一个新的文档用于保存第一页
-                PDDocument firstPageDocument = new PDDocument();
-                firstPageDocument.addPage(firstPage);
-                // 将第一页添加到合并器中
-                merger.appendDocument(resultDocument, firstPageDocument);
-                // 关闭当前处理的文档
-                document.close();
-                firstPageDocument.close();
-            }
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            resultDocument.save(out);
-            resultDocument.close();
-            return out.toByteArray();
-        } catch (FileNotFoundException e) {
-            throw new FileNotFoundException();
-        }
-    }
+//    /**
+//     * 判断文件数组是否为空
+//     * @param pdfDocuments
+//     * @return
+//     */
+//    private boolean isByteEmpty(byte[][] pdfDocuments) {
+//        return pdfDocuments == null || pdfDocuments.length == 0 || Arrays.stream(pdfDocuments).allMatch(array -> array == null || array.length == 0);
+//    }
 
-    /**
-     * 2
-     * 根据查询到的专利信息获取它公告或公开专利的pdf文档数据流
-     * @param patents
-     * @return
-     */
-    public byte[][] getPDFByteByAppNo(List<PatentColumnDTO> patents){
-        List<byte[]> pdfDatas = new ArrayList<>();
-        //遍历传入专利集合
-        for (PatentColumnDTO item : patents) {
-            //判断申请号是否为空
-            if (item.getAppNo() != null) {
-                String appNo = item.getAppNo();
-                Integer type = 1;
-                //获取公告专利pdf文档guid
-                String pdfGuid = FormatUtil.getPDFFormat(appNo, type);
+//    /**
+//     * 3
+//     * @param pdfDatas
+//     * @return
+//     * @throws IOException
+//     */
+//    public byte[] mergeFirstPage(byte[][] pdfDatas) throws IOException{
+//        //创建一个输出流
+//        try {
+//            // 创建一个PDFMergerUtility实例
+//            PDFMergerUtility merger = new PDFMergerUtility();
+//            PDDocument resultDocument = new PDDocument();
+//            //逐个处理每个pdf文件
+//            for (byte[] pdfData : pdfDatas) {
+//                // 加载每个输入的PDF文档
+//                PDDocument document = PDDocument.load(pdfData);
+//                // 获取第一页
+//                PDPage firstPage = document.getPage(0);
+//                // 创建一个新的文档用于保存第一页
+//                PDDocument firstPageDocument = new PDDocument();
+//                firstPageDocument.addPage(firstPage);
+//                // 将第一页添加到合并器中
+//                merger.appendDocument(resultDocument, firstPageDocument);
+//                // 关闭当前处理的文档
+//                document.close();
+//                firstPageDocument.close();
+//            }
+//            ByteArrayOutputStream out = new ByteArrayOutputStream();
+//            resultDocument.save(out);
+//            resultDocument.close();
+//            return out.toByteArray();
+//        } catch (FileNotFoundException e) {
+//            throw new FileNotFoundException();
+//        }
+//    }
 
-                byte[] pdfData = new byte[0];
-                try {
-                    pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid);
-                    if (pdfData == null  || pdfData.length == 0) {
-                        //获取公开专利pdf文档guid
-                        Integer type2 = 0;
-                        String pdfGuid2 = FormatUtil.getPDFFormat(appNo, type2);
-                        pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid2);
-                        if (pdfData == null  || pdfData.length == 0) {
-                            continue;
-                        } else {
-                            pdfDatas.add(pdfData);
-                        }
-                    } else {
-                        pdfDatas.add(pdfData);
-                    }
-                } catch (IOException e) {
-                    e.printStackTrace();
-                    continue;//继续处理下一件专利
-                }
-            }
-        }
-        byte[][] pdfDataArray = new byte[pdfDatas.size()][];
-        return pdfDatas.toArray(pdfDataArray);
-    }
+//    /**
+//     * 2
+//     * 根据查询到的专利信息获取它公告或公开专利的pdf文档数据流
+//     * @param patents
+//     * @return
+//     */
+//    public byte[][] getPDFByteByAppNo(List<PatentColumnDTO> patents){
+//        List<byte[]> pdfDatas = new ArrayList<>();
+//        //遍历传入专利集合
+//        for (PatentColumnDTO item : patents) {
+//            //判断申请号是否为空
+//            if (item.getAppNo() != null) {
+//                String appNo = item.getAppNo();
+//                Integer type = 1;
+//                //获取公告专利pdf文档guid
+//                String pdfGuid = FormatUtil.getPDFFormat(appNo, type);
+//
+//                byte[] pdfData = new byte[0];
+//                try {
+//                    pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid);
+//                    if (pdfData == null  || pdfData.length == 0) {
+//                        //获取公开专利pdf文档guid
+//                        Integer type2 = 0;
+//                        String pdfGuid2 = FormatUtil.getPDFFormat(appNo, type2);
+//                        pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid2);
+//                        if (pdfData == null  || pdfData.length == 0) {
+//                            continue;
+//                        } else {
+//                            pdfDatas.add(pdfData);
+//                        }
+//                    } else {
+//                        pdfDatas.add(pdfData);
+//                    }
+//                } catch (IOException e) {
+//                    e.printStackTrace();
+//                    continue;//继续处理下一件专利
+//                }
+//            }
+//        }
+//        byte[][] pdfDataArray = new byte[pdfDatas.size()][];
+//        return pdfDatas.toArray(pdfDataArray);
+//    }
 
     public byte[] mergePerPatentPDF(List<String> patentNos) throws IOException {
         PDFMergerUtility merger = new PDFMergerUtility();

+ 85 - 55
src/main/java/cn/cslg/pas/service/business/PatentExportService.java

@@ -1,20 +1,20 @@
 package cn.cslg.pas.service.business;
 
-import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.ExportTaskDTO;
 import cn.cslg.pas.common.dto.PatentColumnDTO;
-import cn.cslg.pas.common.dto.PatentDTO;
 import cn.cslg.pas.common.dto.PatentExport.PatentExportVO;
-import cn.cslg.pas.common.dto.PatentExport.TaskParams;
-import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.utils.*;
-import cn.cslg.pas.common.vo.TaskWebSocketDTO;
+import cn.cslg.pas.common.vo.ConfigVOS.PatentConfigVO;
+import cn.cslg.pas.common.vo.WebSocketMessageVO;
+import cn.cslg.pas.common.vo.business.PatentNoVO;
+import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.exception.XiaoShiException;
-import cn.cslg.pas.service.business.es.EsService;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.IdUtil;
-import cn.hutool.core.util.StrUtil;
+import cn.cslg.pas.factorys.PatentExportFactory.GetValueImp;
+import cn.cslg.pas.factorys.PatentExportFactory.PatentExportFactory;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import cn.cslg.pas.service.common.MessageService;
+import com.alibaba.fastjson.JSON;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.io.input.XmlStreamReaderException;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.ss.usermodel.FillPatternType;
@@ -26,12 +26,12 @@ import org.springframework.stereotype.Service;
 
 import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
 /**
+ * Excel导出专利
  * @Author xiexiang
  * @Date 2024/1/3
  */
@@ -40,29 +40,44 @@ import java.util.stream.Collectors;
 public class PatentExportService {
 
     @Autowired
-    private FileUtils fileUtils;
+    private PDFExportFirstPageService pdfExportFirstPageService;
 
     @Autowired
-    private EsService esService;
+    private EsPatentService patentService;
+
+    @Autowired
+    private MessageService messageService;
+
+    @Autowired
+    private PatentExportFactory patentExportFactory;
+
+    @Autowired
+    private ParseByteToFileUtils parseByteToFileUtils;
+
+    @Autowired
+    private ImportTaskService importTaskService;
 
     /**
      * 导出专利
-     * @param taskParams
+     *
+     * @param EsVO
      * @return
      * @throws IOException
      */
-    public byte[] exportPatent(TaskParams taskParams) throws IOException {
+    @Async
+    public void exportPatent(EsCustomFieldBatchVO EsVO) throws IOException {
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
+            String esSelected = JsonUtils.objectToJson(EsVO.getSelected());
             //selected字符串转PatentExportVO集合
-            List<PatentExportVO> selected = Optional.ofNullable(JsonUtils.jsonToList(taskParams.getSelected(), PatentExportVO.class))
+            List<PatentExportVO> selected = Optional.ofNullable(JsonUtils.jsonToList(esSelected, PatentExportVO.class))
                     .orElse(new ArrayList<>());
             //导出文件名
             if (selected.isEmpty()) {
-                throw new IllegalArgumentException("没有选择要导出的数据");
+                throw new IllegalArgumentException("没有选择要导出的字段数据");
             }
 
             //key的集合(标头:例如patentNo)
-            List<String> columns = selected.stream().filter(PatentExportVO::getSelected).map(PatentExportVO::getKey).distinct().collect(Collectors.toList());
+            List<String> columns = selected.stream().filter(PatentExportVO::getSelected).map(PatentExportVO::getValue).distinct().collect(Collectors.toList());
             //name的集合
             List<String> headers = selected.stream().filter(PatentExportVO::getSelected).map(PatentExportVO::getName).distinct().collect(Collectors.toList());
             if (columns.size() != headers.size()) {
@@ -70,7 +85,7 @@ public class PatentExportService {
             }
             //新建工作簿
             HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
-            //新sheet页
+            //新sheet页
             HSSFSheet sheet = hssfWorkbook.createSheet();
             sheet.setDefaultColumnWidth(30);
             //新建标头行
@@ -93,49 +108,35 @@ public class PatentExportService {
                 cell.setCellValue(headers.get(i));
             }
             //根据projectId查询专利信息
-            QueryRequest queryRequest = new QueryRequest();
-            queryRequest.setProjectId(taskParams.getProjectId());
-            PatentDTO patentDTO;
-            try {
-                patentDTO = esService.esSearch(queryRequest);
-            } catch (Exception e) {
-                throw new XiaoShiException("错误");
+            List<String> patentNos = pdfExportFirstPageService.getPatentNo(EsVO);
+            if (patentNos.isEmpty()) {
+                throw new XiaoShiException("未获取到专利信息");
             }
-
-            List<PatentColumnDTO> patents = patentDTO.getPatents();
-            for (int i = 0; i < patents.size(); i++) {
+            Integer total = patentNos.size();
+            Integer defaultNum = 0;
+            for (int i = 0; i < patentNos.size(); i++) {
                 Map<String, Object> map = new LinkedHashMap<>();
-                PatentColumnDTO patent = patents.get(i);
+                PatentNoVO patentNoVO = new PatentNoVO();
+                patentNoVO.setPatentNo(patentNos.get(i));
+                PatentColumnDTO patent = patentService.selectPatentDetail(patentNoVO);
                 if (patent == null) {
+                    defaultNum++;
                     continue;
                 }
-
                 for (int j = 0; j < columns.size(); j++) {
                     String column = columns.get(j);
-                    PatentExportVO patentExportVO = selected.stream().filter(item -> item.getKey().equals(column)).findFirst().orElse(new PatentExportVO());
-                    Object value = null;
-                    switch (column) {
-                        case "patentno":
-                            value = patent.getPatentNo();
-                            break;
-                        case "abstract":
-                            value = patent.getAbstractStr();
-                            break;
-                        case "abstract_path":
-                            break;
-                        case "publicno":
-                            value = patent.getPublicNo();
-                            break;
-                        case "publicdate":
-                            value = patent.getPublicDate();
-                            break;
-                        case "pstatus":
-                            value = patent.getSimpleStatus();
-                            break;
-                        default:
-                            value = null;
+                    PatentExportVO patentExportVO = selected.stream().filter(item -> item.getValue().equals(column)).findFirst().orElse(new PatentExportVO());
+                    // 使用反射获取属性值
+                    Object value = GenerateObjectUtil.getPropertyValue(patent, patentExportVO.getValue());
+                    if (value != null) {
+                        String json = CommonService.readJsonFile("patent.json");
+                        List<PatentConfigVO> patentConfigVOS = JSON.parseArray(json, PatentConfigVO.class);
+                        PatentConfigVO patentConfigVO = patentConfigVOS.stream().filter(item -> item.getValue().equals(column)).findFirst().orElse(null);
+                        String exportClass = patentConfigVO.getExportClass();
+                        GetValueImp getValueImp = patentExportFactory.getClass(exportClass);
+                        String reValue = getValueImp.getValue(value);
+                        map.put(patentExportVO.getName(), reValue);
                     }
-                    map.put(patentExportVO.getName(), value);
                 }
                 //新建一普通行
                 HSSFRow row = sheet.createRow(i + 1);
@@ -153,12 +154,41 @@ public class PatentExportService {
                         }
                     }
                 }
+                WebSocketMessageVO webSocketMessageVO =new WebSocketMessageVO();
+                webSocketMessageVO.setProjectId(EsVO.getProjectId());
+                webSocketMessageVO.setCreateId("328");
+                webSocketMessageVO.setCode(602);
+                webSocketMessageVO.setAllNum(total);
+                webSocketMessageVO.setCurrentNum(i+1);
+                webSocketMessageVO.setState(1);
+                messageService.sendPatentExportMessage(webSocketMessageVO);
             }
             hssfWorkbook.write(out);
-            return out.toByteArray();
+            WebSocketMessageVO webSocketMessageVO =new WebSocketMessageVO();
+            webSocketMessageVO.setProjectId(EsVO.getProjectId());
+            webSocketMessageVO.setCreateId("328");
+            webSocketMessageVO.setAllNum(total);
+            webSocketMessageVO.setCurrentNum(total);
+            webSocketMessageVO.setState(2);
+            messageService.sendPatentExportMessage(webSocketMessageVO);
+            String fileGuid = "";
+            if (out.toByteArray() != null && out.toByteArray().length != 0) {
+                fileGuid = parseByteToFileUtils.uploadFile(out.toByteArray());
+            }
+            ExportTaskDTO exportTaskDTO = new ExportTaskDTO();
+            exportTaskDTO.setProjectId(EsVO.getProjectId());
+            exportTaskDTO.setType(6);
+            exportTaskDTO.setFileGuid(fileGuid);
+            exportTaskDTO.setAllNum(total);
+            exportTaskDTO.setDefaultNum(defaultNum);
+            Integer taskId = importTaskService.addExportExcel(exportTaskDTO);
+            if (taskId == null) {
+                throw new XiaoShiException("导出记录失败");
+            }
         } catch (FileNotFoundException e) {
             throw new FileNotFoundException();
         }
     }
 
+
 }

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

@@ -16,7 +16,7 @@ import java.util.List;
 
 @Service
 @Slf4j
-public class TempleService extends ServiceImpl<ReportTempleMapper, ReportTemple> {
+public class ReportTempleService extends ServiceImpl<ReportTempleMapper, ReportTemple> {
 
     /**
      * 根据报告类型查询报告模板表

+ 110 - 0
src/main/java/cn/cslg/pas/service/business/ScratchWordsService.java

@@ -0,0 +1,110 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.SwQueryDTO;
+import cn.cslg.pas.common.dto.business.UpdateScratchWordsDTO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.domain.business.ScratchWords;
+import cn.cslg.pas.domain.es.Marking;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.ScratchWordsMapper;
+import cn.cslg.pas.service.business.es.EsScratchWordsService;
+import cn.cslg.pas.service.business.es.EsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/10
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, ScratchWords> {
+    private final CacheUtils cacheUtils;
+    private final LoginUtils loginUtils;
+    private final EsScratchWordsService esScratchWordsService;
+    private final EsService esService;
+
+    /**
+     * 新增划词高亮
+     *
+     * @param scratchWords
+     */
+    public String add(ScratchWords scratchWords) {
+
+        scratchWords = new ScratchWords();
+        //获取当前登陆人信息
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        if (personnelVO != null) {
+            //设置创建人id
+            scratchWords.setMarkUserId(personnelVO.getId());
+            //设置租户id
+            scratchWords.setPublicTenantId(personnelVO.getTenantId());
+        } else {
+            throw new XiaoShiException("未查询到创建人信息");
+        }
+        //数据入表
+        String id = esScratchWordsService.addScratchWords(scratchWords);
+        return id;
+    }
+
+    /**
+     * 更新划词高亮
+     *
+     * @param updateScratchWordsDTO
+     */
+    public String update(UpdateScratchWordsDTO updateScratchWordsDTO) {
+        String id = updateScratchWordsDTO.getId();
+        Marking marking = new Marking();
+        BeanUtils.copyProperties(updateScratchWordsDTO, marking);
+        id = esScratchWordsService.updateScratchWords(id, marking);
+        return id;
+
+    }
+
+    /**
+     * 查询划词高亮
+     *
+     * @param swQueryDTO
+     * @return
+     */
+    public List<String> queryAll(SwQueryDTO swQueryDTO) {
+        if (swQueryDTO.getPatentNo() != null) {
+            //获取当前登陆人信息
+            PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            Integer tenantId = personnelVO.getTenantId();
+            String createId = personnelVO.getId();
+
+        } else {
+            throw new XiaoShiException("传入参数不可为空");
+        }
+        return null;
+    }
+
+
+    /**
+     * 删除划词高亮
+     *
+     * @param ids
+     **/
+    public List<String> removeById(List<String> ids) {
+        ids.forEach(item -> {
+            try {
+                esScratchWordsService.removeById(item);
+            }catch (Exception e){
+                throw new XiaoShiException("删除错误");
+            }
+
+        });
+        return ids;
+    }
+}

+ 44 - 7
src/main/java/cn/cslg/pas/service/business/es/EsCustomFieldService.java

@@ -1,13 +1,16 @@
 package cn.cslg.pas.service.business.es;
 
+import cn.cslg.pas.common.core.base.IfConstant;
 import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.dto.es.EsCustomFieldValueDTO;
 import cn.cslg.pas.common.dto.es.FieldHistoryDTO;
 import cn.cslg.pas.common.dto.es.QueryEsCustomFieldDTO;
+import cn.cslg.pas.common.model.request.OrderDTO;
 import cn.cslg.pas.common.utils.FormatUtil;
 import cn.cslg.pas.common.utils.parseQueryToTree.expressManager;
 import cn.cslg.pas.common.utils.parseQueryToTree.operateNode;
 import cn.cslg.pas.common.utils.parseQueryToTree.treeNode;
+import cn.cslg.pas.common.vo.EsConfigVO;
 import cn.cslg.pas.common.vo.PatentWithIdVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.common.vo.es.FieldHistoryVO;
@@ -16,6 +19,7 @@ import cn.cslg.pas.domain.business.CustomField;
 import cn.cslg.pas.domain.business.TreeNode;
 import cn.cslg.pas.domain.es.*;
 import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.service.business.CommonService;
 import cn.cslg.pas.service.business.TreeNodeService;
 import cn.cslg.pas.service.query.FormatQueryService;
 import co.elastic.clients.elasticsearch.ElasticsearchClient;
@@ -30,6 +34,7 @@ import co.elastic.clients.elasticsearch.core.SearchRequest;
 import co.elastic.clients.elasticsearch.core.SearchResponse;
 import co.elastic.clients.elasticsearch.core.search.Hit;
 import co.elastic.clients.json.JsonData;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.Value;
@@ -290,7 +295,7 @@ public class EsCustomFieldService {
                 }
 
             }
-        } else if (startNum > 1 && endNum > 0){
+        } else if (startNum >= 1 && endNum > 0){
             List<String> patentNos = this.getPatentNos(vo);
             for (String patentNo : patentNos) {
                 for (EsCustomFieldDTO fieldDTO : fieldDTOS) {
@@ -314,8 +319,14 @@ public class EsCustomFieldService {
         Integer projectId = vo.getProjectId();
         Integer startNum = vo.getStartNumber();
         Integer endNum = vo.getEndNumber();
-        List<String> isAdd = vo.getIsAdd();
-        List<String> isDel = vo.getIsDelete();
+        List<String> isAdd = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(vo.getIsAdd())) {
+            isAdd = vo.getIsAdd();
+        }
+        List<String> isDel = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(vo.getIsDelete())) {
+            isDel = vo.getIsDelete();
+        }
         String searchCondition = "";
         if (StringUtils.isNotEmpty(vo.getSearchQuery())) {
             searchCondition = vo.getSearchQuery();
@@ -348,9 +359,36 @@ public class EsCustomFieldService {
         //3. 从es中检索数据
         Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent");
         builder.query(q);
-        if (startNum > 0 && endNum > 0) {
-            builder.from(startNum-1).size(endNum);
+
+        List<OrderDTO> dtoList = vo.getOrderDTOList();
+        if (!CollectionUtils.isEmpty(dtoList)) {
+            String json = CommonService.readJsonFile("patent.json");
+            List<EsConfigVO> esConfigVOS = JSON.parseArray(json, EsConfigVO.class);
+            for (OrderDTO orderDTO : dtoList) {
+                EsConfigVO configVO = esConfigVOS.stream().filter(item -> item.getField().equals(orderDTO.getOrderBy())).findFirst().orElse(null);
+                if (configVO != null) {
+                    if (orderDTO.getOrderType().equals(IfConstant.NO)) {
+                        builder.sort(sortOptionsBuilder -> sortOptionsBuilder
+                                .field(fieldSortBuilder -> fieldSortBuilder
+                                        .field(configVO.getEsField()).order(SortOrder.Asc)));
+                    } else {
+                        builder.sort(sortOptionsBuilder -> sortOptionsBuilder
+                                .field(fieldSortBuilder -> fieldSortBuilder
+                                        .field(configVO.getEsField()).order(SortOrder.Desc)));
+                    }
+                }
+            }
+        } else {
+            builder.sort(sortOptionsBuilder -> sortOptionsBuilder
+                    .field(fieldSortBuilder -> fieldSortBuilder
+                            .field("patent_no.keyword").order(SortOrder.Desc)));
         }
+
+        int number = endNum - startNum;
+        if (startNum > 0 && endNum > startNum) {
+            builder.from(startNum-1).size(number);
+        }
+
         SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
         List<Hit<Patent>> hits = response.hits().hits();
         List<String> patentNos = new ArrayList<>();
@@ -360,7 +398,7 @@ public class EsCustomFieldService {
         }
         patentNos.addAll(isAdd);
         patentNos.removeAll(isDel);
-        return patentNos.stream().distinct().collect(Collectors.toList());
+        return patentNos.stream().collect(Collectors.toList());
     }
 
 
@@ -578,7 +616,6 @@ public class EsCustomFieldService {
         long total = response.hits().total().value();
         if (total > 0) {
             esCustomFieldHistoryHit = response.hits().hits().get(0);
-
         }
         return esCustomFieldHistoryHit;
 

+ 11 - 3
src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java

@@ -21,6 +21,7 @@ import cn.cslg.pas.common.vo.business.PatentKinVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.domain.es.*;
 import cn.cslg.pas.service.business.CommonService;
+import cn.cslg.pas.service.common.FileManagerService;
 import cn.cslg.pas.service.query.FormatQueryService;
 import co.elastic.clients.elasticsearch.ElasticsearchClient;
 import co.elastic.clients.elasticsearch._types.SortOrder;
@@ -34,6 +35,7 @@ import co.elastic.clients.elasticsearch.core.search.SourceConfigBuilders;
 import co.elastic.clients.elasticsearch.transform.Source;
 import com.alibaba.druid.sql.visitor.functions.If;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
@@ -56,6 +58,9 @@ public class EsPatentService {
     private final ElasticsearchClient client;
     private final FormatQueryService formatQueryService;
 
+    @Autowired
+    private FileManagerService fileManagerService;
+
     /**
      * 根据专利号查询专利详情
      *
@@ -176,10 +181,13 @@ public class EsPatentService {
      * @param appNo
      * @return
      */
-    public List<String> getFigure(String appNo) {
+    public List<String> getFigure(String appNo) throws IOException {
         List<String> list = new ArrayList<>();
-        String pictureFormat = FormatUtil.getPictureFormat(appNo);
-        list.add(pictureFormat);
+        String guids = fileManagerService.getPatentPictureGuids(appNo);
+        if (StringUtils.isNotEmpty(guids)) {
+            JSONObject jsonObject = JSONObject.parseObject(guids);
+            list = JSONArray.parseArray(jsonObject.get("data").toString(), String.class);
+        }
         return list;
     }
 

+ 239 - 0
src/main/java/cn/cslg/pas/service/business/es/EsScratchWordsService.java

@@ -0,0 +1,239 @@
+package cn.cslg.pas.service.business.es;
+
+import cn.cslg.pas.common.dto.QueryScratchWordsDTO;
+import cn.cslg.pas.common.vo.PatentWithIdVO;
+import cn.cslg.pas.domain.business.ScratchWords;
+import cn.cslg.pas.domain.es.Marking;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentJoin;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.service.permissions.PermissionService;
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch._types.query_dsl.Query;
+import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
+import co.elastic.clients.elasticsearch.core.DeleteResponse;
+import co.elastic.clients.elasticsearch.core.SearchRequest;
+import co.elastic.clients.elasticsearch.core.SearchResponse;
+import co.elastic.clients.elasticsearch.core.search.Hit;
+import co.elastic.clients.json.JsonData;
+import com.alibaba.fastjson.JSON;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class EsScratchWordsService {
+    @Autowired
+    private EsService esService;
+    @Autowired
+    private ElasticsearchClient client;
+    @Autowired
+    private PermissionService permissionService;
+
+    //添加划词标注
+    public String addScratchWords(ScratchWords scratchWords) {
+        String patentNo = scratchWords.getPatentNo();
+        if (patentNo == null) {
+            throw new XiaoShiException("请输入专利号");
+        }
+        //根据专利号查询专利
+        String patentId = null;
+        try {
+            PatentWithIdVO patentWithIdVO = esService.getIdByPatentNo(patentNo);
+            if (patentWithIdVO != null) {
+                patentId = patentWithIdVO.getId();
+            }
+        } catch (Exception e) {
+            throw new XiaoShiException("未获取到专利");
+        }
+        if (patentId == null) {
+            throw new XiaoShiException("未获取到专利");
+        }
+        Marking marking = new Marking();
+        BeanUtils.copyProperties(scratchWords, marking);
+        Patent patent = new Patent();
+        patent.setMarkings(marking);
+        PatentJoin patentJoin = new PatentJoin();
+        patentJoin.setParent(patentId);
+        patentJoin.setName("marking");
+        patent.setPatentJoin(patentJoin);
+        String id = null;
+        try {
+            id = esService.addChildPatent(patent, patentId);
+        } catch (Exception e) {
+            throw new XiaoShiException("保存失败");
+        }
+        return id;
+    }
+
+    public String updateScratchWords(String id, Marking marking) {
+        //根据id查询
+        Patent patent = null;
+        try {
+            patent = this.getById(id);
+        } catch (Exception e) {
+            throw new XiaoShiException("错误");
+        }
+        if (patent == null) {
+            throw new XiaoShiException("划词信息不存在");
+        }
+        Marking marking1 = patent.getMarkings();
+        BeanUtils.copyProperties(marking, marking1);
+        patent.setMarkings(marking1);
+        esService.updatePatent(patent, id);
+        return id;
+    }
+
+    public void queryScratchWord(QueryScratchWordsDTO queryScratchWordsDTO) {
+        String createId = "1";
+        Integer tenantId = 1;
+        String createName = queryScratchWordsDTO.getCreateName();
+        String patentNo = queryScratchWordsDTO.getPatentNo();
+        String content = queryScratchWordsDTO.getMarkSelectText();
+        Date marketTime = queryScratchWordsDTO.getMarkTime();
+        Integer projectId = 1;
+        //公开
+        Query q1 = QueryBuilders.term(t -> t.field("markings.is_public").value(true));
+        //不公开
+        Query q2 = QueryBuilders.term(t -> t.field("markings.is_public").value(false));
+        //创建人id
+        Query q3 = QueryBuilders.term(t -> t.field("markings.mark_user_id").value(createId));
+        //租户id
+        Query q4 = QueryBuilders.term(t -> t.field("markings.public_tenant_id").value(tenantId));
+        //公开范围为全部
+        Query q5 = QueryBuilders.term(t -> t.field("markings.public_scope").value(0));
+        //公开范围为所在地
+        Query q6 = QueryBuilders.term(t -> t.field("markings.public_scope").value(1));
+        //数据库id
+        Query q7 = QueryBuilders.term(t -> t.field("public_project_id").value(projectId));
+        Query parentQ1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(patentNo));
+
+        //公开号
+        Query parentQ2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(patentNo));
+
+        //授权号
+        Query parentQ3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(patentNo));
+        Query parentQ = QueryBuilders.bool(i -> i.should(parentQ1, parentQ2, parentQ3));
+        Query qPatent = QueryBuilders.hasParent(t -> t.parentType("patent").query(parentQ));
+        //公开并且全部范围
+        Query bool1 = QueryBuilders.bool(i -> i.must(q1, q6, q4));
+        // 公开并且所在地
+        Query bool2 = QueryBuilders.bool(i -> i.must(q1, q6, q7));
+        //不公开
+        Query bool3 = QueryBuilders.bool(i -> i.must(q2, q3, q7));
+        List<Query> queries = new ArrayList<>();
+        queries.add(bool1);
+        queries.add(bool2);
+        queries.add(bool3);
+        if (patentNo != null) {
+            Query query = this.getPatentNoQuery(patentNo);
+            queries.add(query);
+        }
+        if (createName != null && createName.trim() != "") {
+            Query query = this.getCreateQuery(createName);
+            queries.add(query);
+        }
+        if (content != null && content.trim() != "") {
+            Query query = this.getContentQuery(content);
+            queries.add(query);
+        }
+        if(marketTime!=null){
+            Query query =this.getMarkTimeQuery(marketTime);
+            queries.add(query);
+        }
+        Query searchBool = QueryBuilders.bool(i -> i.must(queries));
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+
+        builder.index("patent");
+        builder.query(searchBool);
+        try {
+            SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+            List<Hit<Patent>> hits = response.hits().hits();
+            List<Patent> patentList = new ArrayList<>();
+            for (Hit<Patent> hit : hits) {
+                Patent patent = hit.source();
+                patentList.add(patent);
+            }
+        } catch (Exception e) {
+            System.out.println("aa");
+        }
+
+    }
+
+
+    //查询栏位历史
+    public Patent getById(String wordsId) throws Exception {
+        Patent patent = null;
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        builder.index("patent");
+        Query q = QueryBuilders.ids(i -> i.values(Arrays.asList(wordsId)));
+        builder.query(q);
+        SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+        long total = response.hits().total().value();
+        if (total > 0) {
+            patent = response.hits().hits().get(0).source();
+        }
+        return patent;
+    }
+
+
+    public void removeById(String id) throws IOException {
+        DeleteResponse deleteResponse = client.delete(deleteRequest ->
+                deleteRequest.index("patent").id(id)
+        );
+
+    }
+
+
+    //获得专利号检索式
+    public Query getPatentNoQuery(String patentNo) {
+        Query parentQ1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(patentNo));
+
+        //公开号
+        Query parentQ2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(patentNo));
+
+        //授权号
+        Query parentQ3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(patentNo));
+        Query parentQ = QueryBuilders.bool(i -> i.should(parentQ1, parentQ2, parentQ3));
+        Query qPatent = QueryBuilders.hasParent(t -> t.parentType("patent").query(parentQ));
+        return qPatent;
+    }
+
+    //获得创建时间检索式
+    public Query getMarkTimeQuery(Date markTime) {
+        SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd");
+        String time = format2.format(markTime);
+        Query query = QueryBuilders.term(t -> t.field("mark_time").value(time));
+        return query;
+    }
+
+    //获得创建人检索式
+    public Query getCreateQuery(String createName) {
+        List<String> ids = new ArrayList<>();
+        try {
+            String json = permissionService.getPersonIdByNamePCS(createName, false);
+            ids = JSON.parseArray(json, String.class);
+        } catch (Exception e) {
+        }
+        if (ids == null || ids.size() == 0) {
+            ids = new ArrayList<>();
+            ids.add("0");
+        }
+        String strs = JsonData.of(ids).toString();
+        Query query = QueryBuilders.term(t -> t.field("mark_time").value(strs));
+        return query;
+    }
+
+    //获得内容检索式
+    public Query getContentQuery(String content) {
+        Query query = QueryBuilders.match(t -> t.field("mark_selectText").query(content));
+        return query;
+    }
+}

+ 4 - 1
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -89,9 +89,10 @@ public class EsService {
                 .document(patent)
         );
         return indexResponse.id();
-
     }
 
+
+
     /**
      * 根据专利号获取专利id
      *
@@ -125,6 +126,8 @@ public class EsService {
     }
 
 
+
+
     /**
      * Es检索
      *

+ 23 - 1
src/main/java/cn/cslg/pas/service/business/invalidReport/AssoGroupFeatureService.java

@@ -428,7 +428,7 @@ public class AssoGroupFeatureService extends ServiceImpl<AssoGroupFeatureMapper,
         //根据权要id 查询 无效法条
         LambdaQueryWrapper<InvalidStatutes> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(InvalidStatutes::getClaimId, claimId)
-                .and(wrapper->wrapper.eq(InvalidStatutes::getStatutesId, 2).or().eq(InvalidStatutes::getStatutesId,3));
+                .and(wrapper -> wrapper.eq(InvalidStatutes::getStatutesId, 2).or().eq(InvalidStatutes::getStatutesId, 3));
         List<InvalidStatutes> invalidStatutes = invalidStatutesService.list(queryWrapper);
         if (invalidStatutes != null && invalidStatutes.size() != 0) {
             List<Integer> statutesIds = invalidStatutes.stream().map(InvalidStatutes::getId).collect(Collectors.toList());
@@ -463,4 +463,26 @@ public class AssoGroupFeatureService extends ServiceImpl<AssoGroupFeatureMapper,
         }
         return true;
     }
+
+    /**
+     * 取消删除特征
+     * @param featureId
+     * @return
+     */
+    public List<Integer> cancelRemoveFeature(Integer featureId) {
+        List<Integer> ids =new ArrayList<>();
+        if(featureId==null){
+            throw  new XiaoShiException("请输入");
+        }
+        //根据特征id查询特征和证据组合关联
+        LambdaQueryWrapper<AssoGroupFeature> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoGroupFeature::getFeatureId,featureId)
+                     .eq(AssoGroupFeature::getOperateMode,1);
+         List<AssoGroupFeature> assoGroupFeatures =this.list(queryWrapper);
+         if(assoGroupFeatures.size()>0) {
+           ids = assoGroupFeatures.stream().map(AssoGroupFeature::getId).collect(Collectors.toList());
+           this.removeByIds(ids);
+         }
+        return ids;
+    }
 }

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

@@ -266,6 +266,7 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
                         if (evidenceReason != null) {
                             queryEvidenceReasonVO.setEvidenceText(evidenceReason.getEvidenceText());
                             queryEvidenceReasonVO.setEvidenceDescription(evidenceReason.getDescription());
+                           queryEvidenceReasonVO.setErRbSummary(evidenceReason.getRbSummary());
                             queryEvidenceReasonVO.setErPresentOpinions1(evidenceReason.getPresentOpinions1());
                             queryEvidenceReasonVO.setErRbDecisionKey(evidenceReason.getRbDecisionKey());
                             queryEvidenceReasonVO.setErIfPresentOpinions1(evidenceReason.getIfPresentOpinions1());

+ 24 - 0
src/main/java/cn/cslg/pas/service/business/invalidReport/PatentClaimHistoryService.java

@@ -8,6 +8,7 @@ import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.vo.invalidVO.PatentClaimHistoryVO;
 import cn.cslg.pas.common.vo.invalidVO.QueryPatentClaimHistoryVO;
+import cn.cslg.pas.domain.business.AssoGroupFeature;
 import cn.cslg.pas.domain.business.PatentClaim;
 import cn.cslg.pas.domain.business.PatentClaimHistory;
 import cn.cslg.pas.exception.UnLoginException;
@@ -391,4 +392,27 @@ public class PatentClaimHistoryService extends ServiceImpl<PatentClaimHistoryMap
         List<PatentClaim> patentClaims = patentClaimService.list(queryWrapper1);
         return patentClaims;
     }
+
+    /**
+     * 取消删除权要
+     * lrj
+     * @return
+     */
+    public List<Integer> cancelRemoveClaims(Integer claimId){
+        List<Integer> ids =new ArrayList<>();
+        if(claimId==null){
+            throw  new XiaoShiException("请输入权要");
+        }
+        //根据特征id查询特征和证据组合关联
+        LambdaQueryWrapper<PatentClaimHistory> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(PatentClaimHistory::getClaimId,claimId)
+                .eq(PatentClaimHistory::getOperateType,1);
+        List<PatentClaimHistory> patentClaimHistories =this.list(queryWrapper);
+        if(patentClaimHistories.size()>0) {
+            ids = patentClaimHistories.stream().map(PatentClaimHistory::getId).collect(Collectors.toList());
+            this.removeByIds(ids);
+        }
+        return ids;
+
+    }
 }

+ 27 - 10
src/main/java/cn/cslg/pas/service/common/FileManagerService.java

@@ -78,7 +78,7 @@ public class FileManagerService {
     }
 
     public List<String> uploadFileGetGuid(List<MultipartFile> multipartFiles) throws IOException {
-   String res= this.uploadFile(multipartFiles);
+        String res = this.uploadFile(multipartFiles);
         JSONObject jsonObject = JSONObject.parseObject(res);
         List<String> guids = JSONArray.parseArray(jsonObject.get("data").toString(), String.class);
         return guids;
@@ -145,15 +145,15 @@ public class FileManagerService {
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
-    public String uploadFileWithGuid(File file ,String guid)  throws IOException {
+    public String uploadFileWithGuid(File file, String guid) throws IOException {
         MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder()
                 .setType(MultipartBody.FORM);
-            //根据文件名获取文件的MIME类型
-            String mimeType = getMimeType(file.getPath());
-            multipartBodyBuilder.addFormDataPart("file", file.getName(), RequestBody.create(MediaType.parse(mimeType), file));
+        //根据文件名获取文件的MIME类型
+        String mimeType = getMimeType(file.getPath());
+        multipartBodyBuilder.addFormDataPart("file", file.getName(), RequestBody.create(MediaType.parse(mimeType), file));
         RequestBody requestBody = multipartBodyBuilder
                 .addFormDataPart("sourceId", String.valueOf(FileSource))
-                .addFormDataPart("fileGuid",guid)
+                .addFormDataPart("fileGuid", guid)
                 .build();
         OkHttpClient okHttpClient = new OkHttpClient.Builder()
                 .connectTimeout(60, TimeUnit.SECONDS)
@@ -167,15 +167,13 @@ public class FileManagerService {
         Response response = null;
         response = okHttpClient.newCall(request).execute();
         // 最后记得删除临时文件
-            FileUtils.deleteQuietly(file);
+        FileUtils.deleteQuietly(file);
 
         return Objects.requireNonNull(response.body()).string();
     }
 
     /**
      * 调用文件系统上传文件接口
-     *
-
      */
     public String uploadFile2(List<File> files) throws IOException {
 
@@ -206,10 +204,29 @@ public class FileManagerService {
         }
         return Objects.requireNonNull(response.body()).string();
     }
+
     public List<String> uploadFileGetGuid2(List<File> files) throws IOException {
-        String res= this.uploadFile2(files);
+        String res = this.uploadFile2(files);
         JSONObject jsonObject = JSONObject.parseObject(res);
         List<String> guids = JSONArray.parseArray(jsonObject.get("data").toString(), String.class);
         return guids;
     }
+
+    /**
+     * 调用文件系统获得专利图片的guid
+     *
+     * @param appNo 申请号
+     */
+    public String getPatentPictureGuids(String appNo) throws IOException {
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .build();
+        Request request = new Request.Builder()
+                .url(FMSUrl + "/fileManager/getPatentPictureGuids?appNo=" + appNo)
+                .get()
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
 }

+ 19 - 0
src/main/java/cn/cslg/pas/service/common/MessageService.java

@@ -89,4 +89,23 @@ public class MessageService {
             WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.COMPARE_LITERATURE_BATCH), webSocketMessageVO.getCreateId());
 
     }
+      //发送导出专利任务消息
+    public void sendPatentExportMessage(WebSocketMessageVO webSocketMessageVO) {
+        //通过WebSocket 在每一次循环结束后 向前端发送完成进度
+        //当任务状态为完成时,flag为true
+        long percentage = (long) Math.floor((webSocketMessageVO.getCurrentNum() + 0D) / webSocketMessageVO.getAllNum() * 100D);
+        boolean flag = webSocketMessageVO.getState().equals(2);
+
+        TaskWebSocketDTO taskWebSocketDTO = new TaskWebSocketDTO();
+        taskWebSocketDTO.setComplete(flag);
+        taskWebSocketDTO.setIndex(webSocketMessageVO.getCurrentNum());
+        taskWebSocketDTO.setPercentage(percentage);
+        if(flag) {
+            WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_EXPORT_TASK_DONE), webSocketMessageVO.getCreateId());
+        return;
+        }
+        WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_EXPORT_TASK), webSocketMessageVO.getCreateId());
+
+    }
+
 }

+ 58 - 9
src/main/java/cn/cslg/pas/service/common/PatentStarApiService.java

@@ -15,10 +15,7 @@ import cn.cslg.pas.common.vo.StarPatentVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.domain.WebLoginConfig;
 import cn.cslg.pas.domain.business.RetrieveRecord;
-import cn.cslg.pas.domain.es.PatentClassify;
-import cn.cslg.pas.domain.es.PatentPerson;
-import cn.cslg.pas.domain.es.PersonAddress;
-import cn.cslg.pas.domain.es.Text;
+import cn.cslg.pas.domain.es.*;
 import cn.cslg.pas.service.WebLoginConfigService;
 
 import cn.cslg.pas.service.importPatent.ImportFromWebToEsService;
@@ -50,10 +47,13 @@ import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * 调用外部接口的Service类 PCS:权限系统
@@ -871,13 +871,13 @@ public class PatentStarApiService {
             }
             patentColumnDTO.setIpc(classifies);
             //获取摘要附图
-            String pictureApi = this.getPictureApi(item.getRowApplicationNo());
-            patentColumnDTO.setPictureGuid(pictureApi);
+//            String pictureApi = this.getPictureApi(item.getRowApplicationNo());
+//            patentColumnDTO.setPictureGuid(pictureApi);
             //获取外部专利原始申请号
             patentColumnDTO.setRowApplicationNo(item.getRowApplicationNo());
             //获取法律状态
-            String cnLegalApi = this.getCnLegalApi(item.getRowApplicationNo());
-            patentColumnDTO.setLegalStatus(Arrays.asList(cnLegalApi));
+//            String cnLegalApi = this.getCnLegalApi(item.getRowApplicationNo());
+//            patentColumnDTO.setLegalStatus(Arrays.asList(cnLegalApi));
             //获取被引用次数
             //装载公开日
             if (item.getPublicDate() != null && !item.getPublicDate().trim().equals("")) {
@@ -985,9 +985,14 @@ public class PatentStarApiService {
     public Records queryExternalFamily(QueryExternalFamilyVO vo) throws IOException {
         Records records = new Records();
         String family = this.getFamilyByPubNoApi(vo.getPatentNo());
+
         QueryExternalFamilyDTO familyDTO = JSONObject.parseObject(family, QueryExternalFamilyDTO.class);
         String familyInfos = familyDTO.getFamilyinfo();
-        List<String> publicNos = Arrays.asList(familyInfos.split(";"));
+        List<String> publicNos = new ArrayList<>();
+        if (StringUtils.isNotEmpty(familyInfos) && familyInfos.equals("{}")) {
+            publicNos = Arrays.asList(familyInfos.split(";"));
+        }
+
         String pubNo = "";
         if (!CollectionUtils.isEmpty(publicNos)) {
             int count = publicNos.size() - 1;
@@ -1137,4 +1142,48 @@ public class PatentStarApiService {
         return list;
     }
 
+    /**
+     * 获取摘要附图
+     * @param appNo
+     * @return
+     */
+    public String getPictureGuid(String appNo) {
+        return this.getPictureApi(appNo);
+    }
+
+    /**
+     * @param appNo
+     * @return
+     */
+    public ExternalLegalInfoDTO getLegalStatus(String appNo) throws ParseException {
+        ExternalLegalInfoDTO infoDTO = new ExternalLegalInfoDTO();
+        List<String> list = new ArrayList<>();
+        List<LegalEvent> legalEvents = new ArrayList<>();
+        String cnLegalApi = this.getCnLegalApi(appNo);
+        if (StringUtils.isNotEmpty(cnLegalApi)) {
+            List<ExternalLegalStatusDTO> statusDTOS = JSONArray.parseArray(cnLegalApi, ExternalLegalStatusDTO.class);
+            if (!CollectionUtils.isEmpty(statusDTOS)) {
+                List<ExternalLegalStatusDTO> statusList = statusDTOS.stream().sorted(Comparator.comparing(ExternalLegalStatusDTO::getLegalDate).reversed()).collect(Collectors.toList());
+                if (!CollectionUtils.isEmpty(statusList)) {
+                    ExternalLegalStatusDTO statusDTO = statusList.get(0);
+                    list.add(statusDTO.getLegalStatus());
+                }
+                for (ExternalLegalStatusDTO dto : statusDTOS) {
+                    LegalEvent event = new LegalEvent();
+                    event.setCode(dto.getLegalCode());
+                    event.setName(dto.getLegalStatusInfo());
+                    event.setDescription(dto.getJUANQI());
+                    if (StringUtils.isNotEmpty(dto.getLegalDate())) {
+                        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+                        Date date = format.parse(dto.getLegalDate());
+                        event.setEventDate(date);
+                    }
+                    legalEvents.add(event);
+                }
+            }
+        }
+        infoDTO.setLegalStatus(list);
+        infoDTO.setLegalEvents(legalEvents);
+        return infoDTO;
+    }
 }

+ 22 - 21
src/main/java/cn/cslg/pas/service/importPatent/GetCataloguingFromWebThread.java

@@ -75,7 +75,7 @@ public class GetCataloguingFromWebThread extends Thread {
                     if (starPatentVO.getApplicationNo().startsWith("CN")) {
                         this.loadCNPatent(patentZhuLuStr, uploadPatentWebDTO.getPatent(), starPatentVO);
 
-                         //装载专利号
+                        //装载专利号
                         if (uploadPatentWebDTO.getPatent().getAppNo() != null) {
                             uploadPatentWebDTO.getPatent().setPatentNo(uploadPatentWebDTO.getPatent().getAppNo());
                         } else if (uploadPatentWebDTO.getPatent().getGrantNo() != null) {
@@ -100,28 +100,30 @@ public class GetCataloguingFromWebThread extends Thread {
 
 //                添加同族专利
                 String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(uploadPatentWebDTO.getPatent().getPublicNo());
+                List<String> familyPatentNos = new ArrayList<>();
                 if (!familyPatentNoStr.equals("no data")) {
                     FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
-                    List<String> familyPatentNos = new ArrayList<>();
                     if (familyPatentNo != null && familyPatentNo.getFamilyinfo() != null) {
                         familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
                     }
-                    if (familyPatentNos.size() != 0) {
-                        EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(familyPatentNos, "inpadoc");
-                        uploadPatentWebDTO.getPatent().setInpadocFamilyNum(esPatentFamilyDTO.getFamilyNum());
-                        uploadPatentWebDTO.getPatent().setInpadocFamilyId(esPatentFamilyDTO.getPatentFamilyId());
-                    }
                 }
-//
-//                //添加法律事务
-//                esService.addEsLegalEvent(uploadPatentWebDTO.getStarPatentVO().getPublicNo());
-
-//                //添加引用专利
-//                String nos = starPatentVO.getQuoteNos();
-//                if (nos != null) {
-//                    List<String> quotedNos = this.reQuotedNos(nos);
-//                    esService.addEsQuotePatent(uploadPatentWebDTO.getPatent().getPublicNo(), quotedNos);
-//                }
+                familyPatentNos.add(uploadPatentWebDTO.getPatent().getAppNo());
+
+                if (familyPatentNos.size() != 0) {
+                    EsPatentFamilyDTO esPatentFamilyDTO = esService.addEsPatentFamily(familyPatentNos, "inpadoc");
+                    uploadPatentWebDTO.getPatent().setInpadocFamilyNum(esPatentFamilyDTO.getFamilyNum());
+                    uploadPatentWebDTO.getPatent().setInpadocFamilyId(esPatentFamilyDTO.getPatentFamilyId());
+                }
+
+                //添加法律事务
+                esService.addEsLegalEvent(uploadPatentWebDTO.getStarPatentVO().getPublicNo());
+
+                //添加引用专利
+                String nos = starPatentVO.getQuoteNos();
+                if (nos != null) {
+                    List<String> quotedNos = this.reQuotedNos(nos);
+                    esService.addEsQuotePatent(uploadPatentWebDTO.getPatent().getPublicNo(), quotedNos);
+                }
                 //加入es保存队列
                 importFromWebToEsService.loadPatentMessageDone(uploadPatentWebDTO);
             } catch (Exception e) {
@@ -300,8 +302,7 @@ public class GetCataloguingFromWebThread extends Thread {
                 patentPeople.add(patentPerson);
             }
             patent.setRightHolder(patentPeople);
-        }
-        else if(patent.getApplicant()!=null){
+        } else if (patent.getApplicant() != null) {
             patent.setRightHolder(patent.getApplicant());
         }
 
@@ -335,7 +336,7 @@ public class GetCataloguingFromWebThread extends Thread {
 
         //装载受理局
         if (starPatentVO.getBureau() != null && !starPatentVO.getBureau().equals("")) {
-            patent.setAppCountry(starPatentVO.getBureau());
+            patent.setAppCountry(starPatentVO.getBureau().substring(0, starPatentVO.getBureau().indexOf("(")));
         }
     }
 
@@ -457,7 +458,7 @@ public class GetCataloguingFromWebThread extends Thread {
                 patentPeople.add(patentPerson);
             }
             patent.setApplicant(patentPeople);
-            if(patent.getRightHolder()==null||patent.getRightHolder().size()==0){
+            if (patent.getRightHolder() == null || patent.getRightHolder().size() == 0) {
                 patent.setRightHolder(patent.getApplicant());
             }
         }

+ 1 - 1
src/main/java/cn/cslg/pas/service/importPatent/GetPatentFromExcelThread.java

@@ -75,7 +75,7 @@ public class GetPatentFromExcelThread extends Thread {
 
                 UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
                 uploadPatentWebDTO.setHaveSaveCounter(0);
-                uploadPatentWebDTO.setTotalCounter(importTaskAMVO.getShouldSaveCounter());
+                uploadPatentWebDTO.setTotalCounter(importTaskAMVO.getThreadCounter());
                 uploadPatentWebDTO.setPictureData(uploadParamsVO.getPictureData());
                 uploadPatentWebDTO.setPatent(uploadParamsVO.getPatent());
                 //专利丢入消费者队列,并唤醒消费者线程

+ 6 - 2
src/main/java/cn/cslg/pas/service/importPatent/ImportFromExcelToEsService.java

@@ -9,14 +9,18 @@ import org.springframework.stereotype.Service;
 @Service
 public class ImportFromExcelToEsService implements PatentImportImp {
 private TaskThread taskThread;
+
     @Override
     public void startPatentThread() {
-        taskThread.getImportTaskAMVO().setShouldSaveCounter(2);
-        taskThread.getImportTaskAMVO().setHaveSaveCounter(0);
+
+        taskThread.getImportTaskAMVO().setThreadCounter(2);
+        taskThread.getImportTaskAMVO().setThreadDoneCounter(0);
 
         GetPatentPictureFromExcelThread getPatentPictureFromExcelThread =new GetPatentPictureFromExcelThread(taskThread);
         SavePatentToEsThread savePatentToEsThread = new SavePatentToEsThread(taskThread,taskThread.getApplicationContext());
+
         GetPatentFromExcelThread getPatentFromExcelThread = new GetPatentFromExcelThread(taskThread, savePatentToEsThread,getPatentPictureFromExcelThread);
+
         savePatentToEsThread.start();
         getPatentFromExcelThread.start();
         getPatentPictureFromExcelThread.start();

+ 59 - 36
src/main/java/cn/cslg/pas/service/importPatent/ImportFromWebToEsService.java

@@ -91,7 +91,12 @@ public class ImportFromWebToEsService implements PatentImportImp {
             String orderBy = importTaskAMVO.getOrderBy();  //排序字段
             String orderByType = importTaskAMVO.getOrderByType();  //排序类型
             String dbType = importTaskAMVO.getDbType();  //检索数据库类型
-            Integer doneNum = importTaskAMVO.getDoneNum();
+            Integer taskStartNum = importTaskAMVO.getDoneNum();
+            List<String> addPatentNos = new ArrayList<>();
+            String patentNoStr =importTaskAMVO.getPatentNoStr();
+            if(patentNoStr!=null){
+                addPatentNos = JSONArray.parseArray(patentNoStr);
+            }
             int patentNum = 10000;
 
             //检索式
@@ -101,14 +106,24 @@ public class ImportFromWebToEsService implements PatentImportImp {
 
             //获得返回的的多个检索式 patentStarListDtos
             if (importTaskAMVO.getType().equals(4)) {
-                patentStarListDtos = patentStarApiService.getSplitedConditions(new PatentStarListDTO()
-                        .setCurrentQuery(conditions)
-                        .setOrderBy(orderBy)
-                        .setOrderByType(orderByType)
-                        .setDBType(dbType), patentNum);
+                if (addPatentNos != null && addPatentNos.size() != 0) {
+                    PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
+                    patentStarListDTO.setCurrentQuery(conditions)
+                            .setOrderBy(orderBy)
+                            .setOrderByType(orderByType)
+                            .setDBType(dbType);
+                    patentStarListDtos = patentStarApiService.splitPatentNoByType(addPatentNos, patentStarListDTO);
+                } else {
+                    patentStarListDtos = patentStarApiService.getSplitedConditions(new PatentStarListDTO()
+                            .setCurrentQuery(conditions)
+                            .setOrderBy(orderBy)
+                            .setOrderByType(orderByType)
+                            .setDBType(dbType), patentNum);
+                }
             }
+
             //当专利为专利号导入时
-            if (importTaskAMVO.getType().equals(2)) {
+            else if (importTaskAMVO.getType().equals(2)) {
                 PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
                 patentStarListDTO.setCurrentQuery(conditions)
                         .setOrderBy(orderBy)
@@ -119,7 +134,7 @@ public class ImportFromWebToEsService implements PatentImportImp {
             }
 
             //当专利为专利号文件导入时
-            if (importTaskAMVO.getType().equals(3)) {
+            else if (importTaskAMVO.getType().equals(3)) {
                 FileManagerService fileManagerService = applicationContext.getBean(FileManagerService.class);
 
                 String res = fileManagerService.getSystemFileFromFMS(Arrays.asList(importTaskAMVO.getFileGuid()));
@@ -150,19 +165,28 @@ public class ImportFromWebToEsService implements PatentImportImp {
             char ifAddPicture = importTaskAMVO.getIfAddPicture();
             char ifAddFullText = importTaskAMVO.getIfAddFullText();
             char ifPdf = importTaskAMVO.getIfAddPDF();
+
             //下载字段
-             int index=doneNum;
+            int index = taskStartNum;
+
             //已经跳过的数量
             Integer overNum = 0;
+
+            Integer lastOverNum = overNum;
+
+            //检索式检索
             while (patentStarListDtos.size() > 0) {
                 PatentStarListDTO patentStarListDto = patentStarListDtos.remove(0);
                 Integer total = patentStarListDto.getTotal();
-                Integer lastTotalNum = overNum;
+                lastOverNum = overNum;
                 overNum += total;
-                if (overNum < doneNum) {
+
+                if (overNum < taskStartNum) {
                     continue;
                 }
-                Integer startNum = doneNum - lastTotalNum;
+
+                Integer trueStartNum = taskStartNum > lastOverNum ? taskStartNum : lastOverNum;
+                Integer startNum = trueStartNum - lastOverNum;
                 Calculate calculate = DateUtils.calculateFromStartAndEndNumber(startNum, total, 50);
                 Integer startPage = calculate.getStartPage();
                 Integer endPage = calculate.getEndPage();
@@ -173,19 +197,23 @@ public class ImportFromWebToEsService implements PatentImportImp {
                     patentStarListDTOTemp.setPageNum(i + 1);
                     patentStarListDTOTemp.setRowCount(50);
                     //调用一般接口返回一批专利著录相关数据
+
                     Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDTOTemp);
+
                     if (resultMap == null || (Integer) resultMap.get("total") == 0) {
                         continue;
                     }
                     List<StarPatentVO> starPatents = (List<StarPatentVO>) resultMap.get("records");
+
+                    if ((i * 50 + starPatents.size()) < startNum) {
+                        continue;
+                    }
+                    Integer pageStartNum = (i * 50) >= startNum ? 0 : startNum - (i * 50);
+                    Integer pageEndNum = starPatents.size();
                     //遍历这一页的专利
-                    for (int j = 0; j < starPatents.size(); j++) {
-                        if ((i * 50 + j) < startNum) {
-                            continue;
-                        }
+                    for (int j = pageStartNum; j < pageEndNum; j++) {
                         UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
                         Patent patent = new Patent();
-
                         //装载start
                         uploadPatentWebDTO.setStarPatentVO(starPatents.get(j));
                         uploadPatentWebDTO.setPatent(patent);
@@ -193,24 +221,30 @@ public class ImportFromWebToEsService implements PatentImportImp {
                         uploadPatentWebDTO.setIndex(index);
                         uploadPatentWebDTO.setTotalCounter(addPatentCounter);
                         uploadPatentWebDTO.setHaveSaveCounter(0);
+
                         if (ifCataloguing == '1') {
                             getCataloguingFromWebThread.awakeTask(uploadPatentWebDTO);
                         }
+
                         if (ifAddPicture == '1') {
                             getPatentPictureFromWebThread.awakeTask(uploadPatentWebDTO);
                         }
+
                         if (ifAddFullText == '1') {
                             getRightAndFullTextFromWebThread.awakeTask(uploadPatentWebDTO);
                         }
+
                         if (ifPdf == '1') {
                             getPatentPDFFromWebThread.awakeTask(uploadPatentWebDTO);
                         }
-                        index+=1;
+                        index += 1;
                     }
 
                 }
-                doneNum = overNum;
+
+                taskStartNum = overNum;
             }
+
             if (ifCataloguing == '1') {
                 getCataloguingFromWebThread.setIfProductAll(true);
             }
@@ -226,9 +260,7 @@ public class ImportFromWebToEsService implements PatentImportImp {
         } catch (Exception e) {
             e.printStackTrace();
             //生产消费到一半时,发生错误异常,将任务状态置为完成
-//            task = taskService.getById(task.getId());
-//            task.setStatus(2);
-//            taskService.updateById(task);
+
         }
     }
 
@@ -240,17 +272,10 @@ public class ImportFromWebToEsService implements PatentImportImp {
         this.importTaskAMVO = taskThread.getImportTaskAMVO();
     }
 
-    //加入es保存队列
-//    public void savePatentToEs(UploadPatentWebDTO uploadPatentWebDTO) {
-//        uploadPatentWebDTO.setCounter(uploadPatentWebDTO.getCounter() + 1);
-//        if (uploadPatentWebDTO.getTotalCounter().equals(uploadPatentWebDTO.getCounter())) {
-//            savePatentToEsThread.awakeTask(uploadPatentWebDTO);
-//        }
-//    }
 
     public void loadPatentMessageDone(UploadPatentWebDTO uploadPatentWebDTO) {
         synchronized ("装载专利信息") {
-            if (importTaskAMVO.getPatentMessageShouldSaveCounter() > 1) {
+            if (importTaskAMVO.getMessageThreadCounter() > 1) {
                 // 根据index查询是否有相同的
                 List<UploadPatentWebDTO> dtos = uploadPatentWebDTOS.stream()
                         .filter(item -> item.getIndex().equals(uploadPatentWebDTO.getIndex())).collect(Collectors.toList());
@@ -260,10 +285,9 @@ public class ImportFromWebToEsService implements PatentImportImp {
                     BeanUtils.copyProperties(patent, orgPatent, FormatUtil.getNullPropertyNames(patent));
                     Patent patent1 = new Patent();
                     BeanUtils.copyProperties(orgPatent, patent1);
-                    uploadPatentWebDTOS.removeIf(i->i.getIndex().equals(uploadPatentWebDTO.getIndex()));
+                    uploadPatentWebDTOS.removeIf(i -> i.getIndex().equals(uploadPatentWebDTO.getIndex()));
                     savePatentToEsThread.awakeTask(patent1);
-                }
-                else {
+                } else {
                     uploadPatentWebDTOS.add(uploadPatentWebDTO);
                 }
             } else {
@@ -277,11 +301,10 @@ public class ImportFromWebToEsService implements PatentImportImp {
 
 
     public void setPatentToEsProductAll() {
-        importTaskAMVO.setHaveSaveMessageCounter(importTaskAMVO.getHaveSaveMessageCounter() + 1);
-        if (importTaskAMVO.getPatentMessageShouldSaveCounter().equals(importTaskAMVO.getHaveSaveMessageCounter())) {
+        importTaskAMVO.setMessageThreadDoneCounter(importTaskAMVO.getThreadDoneCounter() + 1);
+        if (importTaskAMVO.getMessageThreadCounter().equals(importTaskAMVO.getMessageThreadDoneCounter())) {
             savePatentToEsThread.setIfProductAll(true);
         }
-
     }
 
     private void loadPatent(StarPatentVO starPatentVO, Patent patent) {

+ 2 - 1
src/main/java/cn/cslg/pas/service/importPatent/SchedulingTaskService.java

@@ -60,7 +60,7 @@ public class SchedulingTaskService {
                     importTaskList.get(i).setState(1);
                     importTaskList.get(i).updateById();
                     importTaskAMVOS.get(i).setState(1);
-                    importTaskAMVOS.get(i).setHaveSaveCounter(0);
+                    importTaskAMVOS.get(i).setThreadCounter(0);
                     TaskThread taskThread = new TaskThread(importTaskAMVOS.get(i), applicationContext);
                     executor.execute(taskThread);
                 }
@@ -99,6 +99,7 @@ public class SchedulingTaskService {
                 importTaskAMVO.setOrderBy(importTaskCondition.getOrderBy());
                 importTaskAMVO.setOrderByType(importTaskCondition.getOrderByType());
                 importTaskAMVO.setProjectType(importTaskCondition.getProjectType());
+                importTaskAMVO.setPatentNoStr(importTaskCondition.getPatentNos());
 
                 LambdaQueryWrapper<ReportProject> rQueryWrapper = new LambdaQueryWrapper<>();
                 rQueryWrapper.eq(ReportProject::getProjectId, importTaskCondition.getProjectId());

+ 17 - 18
src/main/java/cn/cslg/pas/service/importPatent/TaskThread.java

@@ -38,7 +38,6 @@ public class TaskThread extends Thread {
     private ApplicationContext applicationContext;
     private final Lock taskThreadLock = new ReentrantLock();
     private final Condition taskThreadCondition = taskThreadLock.newCondition();
-    private final List<Integer> importTaskQueue = new ArrayList<>();
     private ImportTaskAMVO importTaskAMVO;
     private PatentProcess patentProcess = new PatentProcess();
     private List<UploadPatentWebDTO> uploadPatentWebDTOS = new ArrayList<>();
@@ -51,9 +50,9 @@ public class TaskThread extends Thread {
         //十进制转二进制
         String imContents = "0000";
         //当任务为
-        if(importTaskAMVO.getType().equals(1))
-        {   imContents = "1100";}
-      else  if (!importTaskAMVO.getImportContent().equals(0)) {
+        if (importTaskAMVO.getType().equals(1)) {
+            imContents = "1100";
+        } else if (!importTaskAMVO.getImportContent().equals(0)) {
             imContents = MathUtils.fun(2, importTaskAMVO.getImportContent());
         }
         //下载字段
@@ -66,34 +65,34 @@ public class TaskThread extends Thread {
         importTaskAMVO.setIfAddPicture(ifAddPicture);
         importTaskAMVO.setIfAddFullText(ifFullText);
         importTaskAMVO.setIfAddPDF(ifPdf);
-        importTaskAMVO.setHaveSaveCounter(0);
-        importTaskAMVO.setHaveSaveMessageCounter(0);
-        Integer shouldSaveCount = 0;
-        Integer messageShouldSaveCount = 0;
+        importTaskAMVO.setThreadDoneCounter(0);
+        importTaskAMVO.setMessageThreadDoneCounter(0);
+        Integer threadCount = 0;
+        Integer messageThreadCount = 0;
 
         if (ifAddPicture == '1') {
-            shouldSaveCount += 1;
-            this.patentProcess.setPictureDoneNum(0);
+            threadCount += 1;
+            this.patentProcess.setPictureDoneNum(importTaskAMVO.getDoneNum());
             this.patentProcess.setPictureDefaultNum(0);
         }
         if (ifCataloguing == '1' || ifFullText == '1') {
-            shouldSaveCount += 1;
+            threadCount += 1;
             this.patentProcess.setPatentMessageDefaultNum(0);
             this.patentProcess.setPatentMessageDoneNum(0);
             if (ifCataloguing == '1') {
-                messageShouldSaveCount += 1;
+                messageThreadCount += 1;
             }
             if (ifFullText == '1') {
-                messageShouldSaveCount += 1;
+                messageThreadCount += 1;
             }
         }
         if (ifPdf == '1') {
             this.patentProcess.setPdfDefaultNum(0);
             this.patentProcess.setPdfDoneNum(0);
-            shouldSaveCount += 1;
+            threadCount += 1;
         }
-        importTaskAMVO.setPatentMessageShouldSaveCounter(messageShouldSaveCount);
-        importTaskAMVO.setShouldSaveCounter(shouldSaveCount);
+        importTaskAMVO.setMessageThreadCounter(messageThreadCount);
+        importTaskAMVO.setThreadCounter(threadCount);
         this.applicationContext = applicationContext;
         this.patentProcess.setPatentDoneNum(importTaskAMVO.getDoneNum());
         this.patentProcess.setPatentDefaultNum(0);
@@ -141,8 +140,8 @@ public class TaskThread extends Thread {
      */
     public void awakeTaskThread() {
         synchronized ("导入任务是否完成") {
-            importTaskAMVO.setHaveSaveCounter(importTaskAMVO.getHaveSaveCounter() + 1);
-            if (importTaskAMVO.getShouldSaveCounter().equals(importTaskAMVO.getHaveSaveCounter())) {
+            importTaskAMVO.setThreadDoneCounter(importTaskAMVO.getThreadDoneCounter() + 1);
+            if (importTaskAMVO.getThreadCounter().equals(importTaskAMVO.getThreadDoneCounter())) {
                 if (taskThreadLock.tryLock()) {
                     //taskLock.lock();
                     taskThreadCondition.signalAll();

+ 18 - 10
src/main/resources/jsons/patent.json

@@ -11,7 +11,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   {
     "name": "申请号",
@@ -25,7 +26,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   {
     "name": "公开号",
@@ -39,7 +41,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   {
     "name": "授权号",
@@ -53,7 +56,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   {
     "name": "公开日",
@@ -67,7 +71,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "exportClass": "getDateValue"
   },
   {
     "name": "申请日",
@@ -81,7 +86,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "exportClass": "getDateValue"
   },
   {
     "name": "授权日",
@@ -95,7 +101,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "exportClass": "getDateValue"
   },
   {
     "name": "项目id",
@@ -164,7 +171,8 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "defaultShowStats": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "exportClass": "getNameValue"
   },
   {
     "name": "标准申请人",
@@ -846,7 +854,7 @@
   },
   {
     "name": "法律状态",
-    "type": "String",
+    "type": "Array",
     "value": "legalStatus",
     "field": "LG",
     "esField": "legal_status.raw",
@@ -1071,5 +1079,5 @@
     "ifGroup": "false",
     "ifShow": "false",
     "ifAsCondition": "true"
-  }
+  },
 ]

+ 33 - 0
src/main/resources/mapper/CustomAnalyseMapper.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.cslg.pas.mapper.CustomAnalysisItemMapper">
+
+    <select id="queryAnalyseGroup" resultType="cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseListDTO">
+        select id,name,parent_id,permissions,project_id,tenant_id,sort,type,status,creator
+        from os_custom_analysis_item
+        <where>
+            <if test="vo.type != null">
+                AND type = #{vo.type}
+            </if>
+            and (
+            <if test="vo.tenantId != null">
+                /*系统公开情况*/
+                (permissions = 1 AND tenant_id = #{vo.tenantId})
+            </if>
+            <if test="vo.creatorId != null">
+                /*系统私有公开*/
+                or (permissions = 2 AND creator_id = #{vo.creatorId})
+            </if>
+            <if test="vo.tenantId != null and vo.projectId != null">
+                /*数据库公开*/
+                or (permissions = 3 AND tenant_id = #{vo.tenantId} AND project_id = #{vo.projectId})
+            </if>
+            <if test="vo.projectId != null and vo.creatorId != null">
+                /*数据库私有*/
+                or (permissions = 4 AND creator_id = #{vo.creatorId} AND project_id = #{vo.projectId})
+            </if>
+            )
+        </where>
+        order by sort asc
+    </select>
+</mapper>

+ 69 - 0
src/test/java/cn/cslg/pas/service/EsScratchWordsServiceTest.java

@@ -0,0 +1,69 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.dto.business.UpdateScratchWordsDTO;
+import cn.cslg.pas.domain.business.ScratchWords;
+import cn.cslg.pas.domain.es.Marking;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.service.business.es.EsScratchWordsService;
+import cn.cslg.pas.service.business.es.EsService;
+import org.apache.ibatis.annotations.Update;
+import org.joda.time.DateTime;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.Date;
+
+/**
+ * @author chenyu
+ * @date 2023/9/6
+ */
+@SpringBootTest
+@RunWith(SpringRunner.class)
+public class EsScratchWordsServiceTest {
+
+    @Autowired
+    private EsScratchWordsService esScratchWordsService;
+
+@Autowired
+private EsService esService;
+    @Test
+    public void addPatent() throws Exception {
+        ScratchWords scratchWords = new ScratchWords();
+        scratchWords.setPatentNo("CN201721042063.9");
+        scratchWords.setPublicTenantId(1);
+        scratchWords.setMarkUserId("1");
+        scratchWords.setIsPublic(true);
+        scratchWords.setMarkColor("#qeqrqr");
+        scratchWords.setMarkOteText("测试标引");
+        scratchWords.setMarkSite(10);
+        scratchWords.setMarkTime(new Date());
+        scratchWords.setPublicScope(1);
+        esScratchWordsService.addScratchWords(scratchWords);
+    }
+
+    @Test
+    public void getPatent() throws Exception {
+
+        esScratchWordsService.query11();
+
+    }
+
+    @Test
+    public void test() throws Exception {
+        UpdateScratchWordsDTO updateScratchWordsDTO =new UpdateScratchWordsDTO();
+        updateScratchWordsDTO.setIsPublic(true);
+        Marking marking =new Marking();
+        BeanUtils.copyProperties(updateScratchWordsDTO,marking);
+        System.out.println(marking);
+    }
+
+    @Test
+    public  void remove() throws  Exception{
+        esScratchWordsService.removeById("noU2_YwBmzIo81_4JOrU");
+
+    }
+}

+ 16 - 2
src/test/java/cn/cslg/pas/service/EsServiceTests.java

@@ -12,6 +12,8 @@ import cn.cslg.pas.service.business.es.EsService;
 
 import cn.cslg.pas.service.importPatent.SchedulingTaskService;
 import cn.hutool.core.util.XmlUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.BeanUtils;
@@ -59,7 +61,7 @@ public class EsServiceTests {
     }
 
     @Test
-  public  void search() throws Exception {
+    public void search() throws Exception {
         StringRequest stringRequest = new StringRequest();
         stringRequest.setSearchQuery("patentNo=CN201199922Y and (simpleFamilyNum>1 or simpleFamilyNum=0)");
         stringRequest.setCurrent(0L);
@@ -96,9 +98,10 @@ public class EsServiceTests {
         List<String> nos = new ArrayList<>();
         nos.add("CN201920033236.3");
         nos.add("CN202010306989.4");
-        esService.addEsPatentFamily( nos,"inpadoc");
+        esService.addEsPatentFamily(nos, "inpadoc");
         System.out.println("aa");
     }
+
     @Test
     public void addAffairPatent() throws Exception {
         String no = "CN202221363803.X";
@@ -109,4 +112,15 @@ public class EsServiceTests {
         System.out.println("aa");
     }
 
+    @Test
+    public void addNet() throws Exception {
+        List<String> patents = new ArrayList<>();
+        patents.add("aa");
+        patents.add("vbb");
+        String aa = JSONObject.toJSON(patents).toString();
+        List<String> abv =JSONArray.parseArray(aa);
+        System.out.println(abv);
+
+    }
+
 }

+ 27 - 12
src/test/java/cn/cslg/pas/service/EventServiceTests.java

@@ -1,7 +1,6 @@
 package cn.cslg.pas.service;
 
 import cn.cslg.pas.common.dto.*;
-import cn.cslg.pas.common.dto.business.EsCountDTO;
 import cn.cslg.pas.common.dto.business.EsPatentFamilyDTO;
 import cn.cslg.pas.common.dto.business.ReportTempleDTO;
 import cn.cslg.pas.common.dto.business.SelectClaimDTO;
@@ -10,8 +9,6 @@ import cn.cslg.pas.common.dto.es.EsCustomFieldValueDTO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.model.request.*;
 import cn.cslg.pas.common.utils.Response;
-import cn.cslg.pas.common.utils.parseQueryToTree.expressManager;
-import cn.cslg.pas.common.utils.parseQueryToTree.treeNode;
 import cn.cslg.pas.common.vo.business.EsCountVO;
 import cn.cslg.pas.common.vo.business.PatentKinVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
@@ -22,7 +19,7 @@ import cn.cslg.pas.domain.es.FamilyPatent;
 import cn.cslg.pas.domain.es.Patent;
 import cn.cslg.pas.domain.es.PatentFamilyMessage;
 import cn.cslg.pas.service.business.ProductMarketDataService;
-import cn.cslg.pas.service.business.TempleService;
+import cn.cslg.pas.service.business.ReportTempleService;
 import cn.cslg.pas.service.business.es.EsCountService;
 import cn.cslg.pas.service.business.es.EsCustomFieldService;
 import cn.cslg.pas.service.business.es.EsService;
@@ -33,6 +30,7 @@ import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -40,8 +38,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.*;
-import java.util.function.Function;
-import java.util.stream.Collectors;
 
 
 /**
@@ -59,7 +55,7 @@ public class EventServiceTests {
     @Autowired
     private EsCountService esCountService;
     @Autowired
-    private TempleService templeService;
+    private ReportTempleService templeService;
     @Autowired
     private EsPatentService patentService;
     @Autowired
@@ -468,16 +464,35 @@ public class EventServiceTests {
 
     @Test
     public void test101() {
-
+        List<Integer> list = new ArrayList<>();
+        list.add(1);
+        list.add(2);
+        list.add(3);
+        list.add(4);
+        this.tran(list);
     }
 
-    @Transactional
-    public void tran() {
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
+    public void tran(List<Integer> list) {
+        int i = 0;
+        for (Integer key : list) {
+            if (i == 3) {
+                this.tran1(i);
+            } else {
+                i += key;
+            }
+        }
+        System.out.println(i);
 
     }
 
-    @Transactional
-    public void tran1() {
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
+    public Integer tran1(int m) {
+        System.out.println(m);
+        m = m+1;
+        if (m > 0) {
 
+        }
+        return m;
     }
 }