Преглед на файлове

Merge remote-tracking branch 'origin/dev' into dev

chenyi преди 2 години
родител
ревизия
40302c7ee8
променени са 19 файла, в които са добавени 166 реда и са изтрити 54 реда
  1. 5 2
      RMS/src/main/java/cn/cslg/report/common/config/InnerInterceptor/LizzMybatisIntercepts.java
  2. 84 0
      RMS/src/main/java/cn/cslg/report/common/core/annotation/LoggerAspect.java
  3. 5 1
      RMS/src/main/java/cn/cslg/report/common/model/vo/PersonnelVO.java
  4. 3 2
      RMS/src/main/java/cn/cslg/report/common/utils/SecurityUtils/SecurityUtils.java
  5. 14 2
      RMS/src/main/java/cn/cslg/report/common/utils/auth/TreeUtils.java
  6. 0 1
      RMS/src/main/java/cn/cslg/report/service/OutInterfaceService.java
  7. 3 3
      RMS/src/main/java/cn/cslg/report/service/business/AssoTaskPatentSplitService.java
  8. 44 32
      RMS/src/main/java/cn/cslg/report/service/business/ReportDocumentService.java
  9. 8 11
      RMS/src/main/java/cn/cslg/report/service/business/ReportService.java
  10. BIN
      RMS/target/classes/cn/cslg/report/common/config/InnerInterceptor/LizzMybatisIntercepts.class
  11. BIN
      RMS/target/classes/cn/cslg/report/common/model/vo/PersonnelVO$DP.class
  12. BIN
      RMS/target/classes/cn/cslg/report/common/model/vo/PersonnelVO$PerRole.class
  13. BIN
      RMS/target/classes/cn/cslg/report/common/model/vo/PersonnelVO.class
  14. BIN
      RMS/target/classes/cn/cslg/report/common/utils/SecurityUtils/SecurityUtils.class
  15. BIN
      RMS/target/classes/cn/cslg/report/common/utils/auth/TreeUtils.class
  16. BIN
      RMS/target/classes/cn/cslg/report/service/OutInterfaceService.class
  17. BIN
      RMS/target/classes/cn/cslg/report/service/business/AssoTaskPatentSplitService.class
  18. BIN
      RMS/target/classes/cn/cslg/report/service/business/ReportDocumentService.class
  19. BIN
      RMS/target/classes/cn/cslg/report/service/business/ReportService.class

+ 5 - 2
RMS/src/main/java/cn/cslg/report/common/config/InnerInterceptor/LizzMybatisIntercepts.java

@@ -107,8 +107,11 @@ public class LizzMybatisIntercepts implements InnerInterceptor {
                             }
                         }
                         // 根据sql语句结构,将拼接sql放入合适的位置
-                        if (Localsql.contains("order by")) {
-                            Localsql = Localsql.replace("order by", "And (" + sqls + ") order by");
+                        if (Localsql.contains("ORDER BY")) {
+                            Localsql = Localsql.replace("ORDER BY", "And (" + sqls + ") ORDER BY");
+                        }
+                        else if (Localsql.contains("LIMIT")) {
+                            Localsql = Localsql.replace("LIMIT", "And (" + sqls + ") LIMIT");
                         } else {
                             Localsql += " And (" + sqls + ")";
                         }

+ 84 - 0
RMS/src/main/java/cn/cslg/report/common/core/annotation/LoggerAspect.java

@@ -0,0 +1,84 @@
+package cn.cslg.report.common.core.annotation;
+
+import cn.cslg.report.common.model.DataSource;
+import cn.cslg.report.common.model.vo.PersonnelVO;
+import cn.cslg.report.common.utils.CacheUtils;
+import cn.cslg.report.common.utils.JsonUtils;
+import cn.cslg.report.common.utils.Response;
+import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.report.common.utils.auth.TreeUtils;
+import cn.cslg.report.common.utils.auth.checkAuth;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.extern.slf4j.Slf4j;
+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.*;
+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;
+
+@Order(3)
+@Aspect
+@Component
+@Slf4j
+public class LoggerAspect {
+
+
+    /**
+     * 定义切点
+     */
+    @Pointcut("execution( * cn.cslg.report.controller..*.*(..))")
+    public void annotationPointcut() {
+
+    }
+
+    /**
+     * @param joinPoint 当前执行的方法
+     */
+    @Around("annotationPointcut()")
+    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
+
+        //判断通过
+        return joinPoint.proceed();
+    }
+
+    @AfterThrowing(pointcut = "annotationPointcut()",throwing = "e")
+    public void doAfterThrowing(JoinPoint joinPoint, Throwable e){
+
+        //获取用户请求方法的参数并序列化为JSON格式字符串
+        String params = "";
+        if (joinPoint.getArgs()!=null&&joinPoint.getArgs().length>0){
+            for (int i = 0; i < joinPoint.getArgs().length; i++) {
+                params+= JsonUtils.objectToJson(joinPoint.getArgs()[i])+";";
+            }
+        }
+        try{
+            String str1 ="异常代码:" + e.getClass().getName();
+            String str2 ="异常信息:" + e.getMessage();
+            String str3="异常方法:" + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()");
+            String str4="请求参数:" + params;
+   log.error(str1+"\r"+str2+"\r"+str3+"\r"+str4);
+        }catch (Exception ex){
+            //记录本地异常日志
+            log.error("==异常通知异常==");
+            log.error("异常信息:{}", ex.getMessage());
+        }
+    }
+
+}
+

+ 5 - 1
RMS/src/main/java/cn/cslg/report/common/model/vo/PersonnelVO.java

@@ -79,7 +79,11 @@ public class PersonnelVO extends BaseVO {
      * Back:人员QQ号
      */
     private String qqNumber;
-
+    /**
+     * Front:
+     * Back:负责部门List
+     */
+    private List<Integer> dutyDeparts;
     /**
      * Front:微信号
      * Back:人员微信号

+ 3 - 2
RMS/src/main/java/cn/cslg/report/common/utils/SecurityUtils/SecurityUtils.java

@@ -1,5 +1,6 @@
 package cn.cslg.report.common.utils.SecurityUtils;
 
+import cn.dev33.satoken.stp.StpUtil;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -15,10 +16,10 @@ public class SecurityUtils {
     /**
      * 设置权限标识
      */
-    public void startDataScope(String Function) {
+    public static void startDataScope(String Function) {
         Map<String, Object> m = new HashMap<>();
         m.put("token", LoginUtils.getToken());
-        m.put("loginId", loginUtils.getId());
+        m.put("loginId", StpUtil.getLoginIdAsInt());
         m.put("functionId", Function);
         threadLocal.set(m);
     }

+ 14 - 2
RMS/src/main/java/cn/cslg/report/common/utils/auth/TreeUtils.java

@@ -2,10 +2,12 @@ package cn.cslg.report.common.utils.auth;
 
 import cn.cslg.report.common.model.DataSource;
 import cn.cslg.report.common.model.vo.PersonnelVO;
+import cn.cslg.report.common.utils.StringUtils;
 import com.alibaba.fastjson.JSONObject;
 import org.springframework.stereotype.Component;
 
 import java.lang.reflect.Field;
+import java.util.ArrayList;
 import java.util.List;
 
 @Component
@@ -184,7 +186,6 @@ public class TreeUtils {
                             Field dataField = DPClass.getDeclaredField(Fields);
                             dataField.setAccessible(true);
                             tem = dataField.get(dp).toString() + ",";
-
                         }
                         reField = sourceField.replace("local." + sourceField, "(" + tem.substring(0, tem.length() - 1) + ")");
                     }
@@ -240,7 +241,18 @@ public class TreeUtils {
                         Class<?> personClass = personnelVO.getClass();
                         Field dataField = personClass.getDeclaredField(field);
                         dataField.setAccessible(true);
-                        reField = dataField.get(personnelVO).toString();
+                        if(dataField.getType().getName().equals("java.util.List"))
+                        {
+                      List<Integer> ids = (List<Integer>)dataField.get(personnelVO);
+                      if(ids==null||ids.size()==0){
+                          ids =new ArrayList<>();
+                          ids.add(0);
+                      }
+                        reField   =   "("+StringUtils.join(ids,",")+")";
+                            break;
+                        }else {
+                            reField = dataField.get(personnelVO).toString();
+                        }
                         break;
                     }
                 }

+ 0 - 1
RMS/src/main/java/cn/cslg/report/service/OutInterfaceService.java

@@ -187,7 +187,6 @@ public class OutInterfaceService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
-
     /**
      * @title 分页查询人员
      * @description 接口来源:PCS

+ 3 - 3
RMS/src/main/java/cn/cslg/report/service/business/AssoTaskPatentSplitService.java

@@ -52,13 +52,13 @@ public class AssoTaskPatentSplitService extends ServiceImpl<AssoTaskPatentSplitM
         }else {
             Map<String, Object> map = new HashMap<>();
             LambdaQueryWrapper<Report> queryWrapper=new LambdaQueryWrapper<>();
-            queryWrapper.eq(Report::getId,reportId).eq(Report::getSignPatentNo,patentNo);
+            queryWrapper.eq(Report::getId,reportId);
             Report report = reportService.list(queryWrapper).get(0);
             if (report != null) {
                 map.put("splitBy", report.getSplitBy());
                 map.put("splitType", report.getSplitType());
-
-            } else {
+            }
+            else {
                 map.put("splitBy", null);
                 map.put("splitType", null);
             }

+ 44 - 32
RMS/src/main/java/cn/cslg/report/service/business/ReportDocumentService.java

@@ -168,6 +168,8 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
         }
         //获得对比记录-特征关联ID
         List<Integer> recordfeatureRecordIds = scenariosRecords.stream().map(AssoScenarIOS::getFeatureRecordID).collect(Collectors.toList());
+        //从关联表里获得是公识的特征Id
+        List<Integer> knowedIds= scenariosRecords.stream().map(AssoScenarIOS::getFeaturesID).collect(Collectors.toList());
         //根据对比记录-特征关联ID查出对比记录-特征关联信息
         List<AssoRecordsFeature> assoRecordsFeatures = new ArrayList<>();
         if (recordfeatureRecordIds != null && recordfeatureRecordIds.size() != 0) {
@@ -180,6 +182,7 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
         List<Integer> recordIds = assoRecordsFeatures.stream().map(AssoRecordsFeature::getRecordsId).collect(Collectors.toList());
         //从对比记录-特征关联信息里剔出特征Id
         List<Integer> sFeatureIds = assoRecordsFeatures.stream().map(AssoRecordsFeature::getFeatureId).collect(Collectors.toList());
+        sFeatureIds.addAll(knowedIds);
         //根据特征ID查询出报告所有方案的特征
         List<Features> sFeatures = new ArrayList<>();
         LambdaQueryWrapper<Features> sFeaturesWrapper = new LambdaQueryWrapper<>();
@@ -263,7 +266,7 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
             List<AssoRecordsFeature> assoRecordsFeatures1 = assoRecordsFeatures.stream().filter(item -> featureRecordsIds.contains(item.getId())).collect(Collectors.toList());
             List<Integer> partRecordIds = assoRecordsFeatures1.stream().map(AssoRecordsFeature::getRecordsId).collect(Collectors.toList());
             List<Integer> partFetIds = assoRecordsFeatures1.stream().map(AssoRecordsFeature::getFeatureId).collect(Collectors.toList());
-            //获得识特征的ID
+            //获得识特征的ID
             List<Integer> comFetIds = partScenariosRecords.stream().map(AssoScenarIOS::getFeaturesID).collect(Collectors.toList());
             partFetIds.addAll(comFetIds);
             //获得单个对比方案的权要的所有特征
@@ -289,35 +292,46 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
             //存放对比方案每一个特征记录
             List<Map<String, Object>> maps = new ArrayList<>();
             partFeatures.forEach(tem -> {
-                Map<String, Object> map = new HashMap<>();
-                map.put("featureContent", tem.getContent());
-                AssoRecordsFeature assoRecordsFeature = finalAsso.stream().filter(item -> item.getFeatureId().equals(tem.getId())).findFirst().orElse(new AssoRecordsFeature());
-                map.put("compareResult", assoRecordsFeature.getComResult() != null ? assoRecordsFeature.getComResult() : "公识");
-                CompareRecords record = records.stream().filter(item -> item.getId().equals(assoRecordsFeature.getRecordsId())).findFirst().orElse(new CompareRecords());
-                String compareContent = "";
-                //获取对比内容
-                String content = record.getContent() != null ? record.getContent() : "";
-                //获得对比专利号
-                String patentNo = record.getPatentNo() != null ? record.getPatentNo() : "";
-                if (OtherName.containsKey(patentNo)) {
-                    patentNo = OtherName.get(patentNo).toString()+":";
-                }
-                else if(!patentNo.equals("")){
-                    patentNo+=":";
-                }
 
-                //获得解析过程
-                String paresingProcess = record.getParesingProcess() != null ? "(" + record.getParesingProcess() + ")" : "";
-                compareContent = patentNo + content + paresingProcess;
-                //获取对比专利号
-                map.put("compareContent", compareContent);
-                map.put("figure", fileUtils.getSystemPath() + record.getFilePath());
-                if (record.getFields() == null && record.getPosition() == null) {
-                    map.put("position", "");
-                } else {
-                    map.put("position", "\r" + "(" + record.getFields() + "[" + record.getPosition() + "]" + ")");
-                }
-                maps.add(map);
+               List<AssoRecordsFeature>  assoRecordsFeatures2 = assoRecordsFeatures1.stream().filter(item -> item.getFeatureId().equals(tem.getId())).collect(Collectors.toList());
+               if(comFetIds.contains(tem.getId())){
+                   Map<String, Object> map = new LinkedHashMap<>();
+                   map.put("featureContent", tem.getContent());
+                   map.put("compareResult","公识");
+                   map.put("compareContent", "");
+                   maps.add(map);
+               }
+               for(AssoRecordsFeature assoRecordsFeature :assoRecordsFeatures2){
+                   Map<String, Object> map = new LinkedHashMap<>();
+                   map.put("featureContent", tem.getContent());
+                   map.put("compareResult", assoRecordsFeature.getComResult() != null ? assoRecordsFeature.getComResult() : "不公开");
+                   CompareRecords record = records.stream().filter(item -> item.getId().equals(assoRecordsFeature.getRecordsId())).findFirst().orElse(new CompareRecords());
+                   String compareContent = "";
+                   //获取对比内容
+                   String content = record.getContent() != null ? record.getContent() : "";
+                   //获得对比专利号
+                   String patentNo = record.getPatentNo() != null ? record.getPatentNo() : "";
+                   if (OtherName.containsKey(patentNo)) {
+                       patentNo = OtherName.get(patentNo).toString()+":";
+                   }
+                   else if(!patentNo.equals("")){
+                       patentNo+=":";
+                   }
+
+                   //获得解析过程
+                   String paresingProcess = record.getParesingProcess() != null ? "(" + record.getParesingProcess() + ")" : "";
+                   compareContent = patentNo + content + paresingProcess;
+                   //获取对比专利号
+                   map.put("compareContent", compareContent);
+                   map.put("figure", fileUtils.getSystemPath() + record.getFilePath());
+                   if (record.getFields() == null && record.getPosition() == null) {
+                       map.put("position", "");
+                   } else {
+                       map.put("position", "\r" + "(" + record.getFields() + "[" + record.getPosition() + "]" + ")");
+                   }
+                   maps.add(map);
+               }
+
             });
             //方案内容
             temMap.put("fileDetails", maps);
@@ -369,7 +383,6 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
             //创造性
             temMap.put("creative", creative);
             scenariosMaps.add(temMap);
-
         }
         List<Map<String, Object>> allRightScenarios = new ArrayList<>();
         List<Map<String, Object>> resultMaps = new ArrayList<>();
@@ -427,7 +440,6 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
         return template;
     }
 
-
     /**
      * @param reportId
      * @param filePath
@@ -550,7 +562,7 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
         LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
         HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
         // 将bz设置为行循环绑定的数据源的key,即key是bz的value会在模板中的{{bz}}处进行解析
-        Configure configure = Configure.builder().bind("compareMessage", policy).bind("compareMessageVOS", policy).build();
+        Configure configure = Configure.builder().bind("compareMessage", policy).bind("targetDescription", htmlRenderPolicy).build();
         XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
         return template;
     }

+ 8 - 11
RMS/src/main/java/cn/cslg/report/service/business/ReportService.java

@@ -6,6 +6,7 @@ import cn.cslg.report.common.model.vo.ReportVO;
 import cn.cslg.report.common.model.vo.SystemDictVO;
 import cn.cslg.report.common.utils.*;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.report.common.utils.SecurityUtils.SecurityUtils;
 import cn.cslg.report.common.utils.auth.checkAuth;
 import cn.cslg.report.entity.Personnel;
 import cn.cslg.report.entity.Report;
@@ -116,7 +117,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         Integer id =loginUtils.getId();
          List<Integer> departIds =outInterfaceService.getDutyDepartsFromPCS(id);
         LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
-        if (reportVO.getName() != null && reportVO.getName() != "") {
+        queryWrapper.ne(Report::getId,0);
+        if (reportVO.getName() != null) {
             queryWrapper.like(Report::getName, reportVO.getName());
         }
         if (reportVO.getReportId() != null) {
@@ -125,22 +127,17 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         if (reportVO.getSignPatentNo() != null && reportVO.getSignPatentNo() != "") {
             queryWrapper.like(Report::getSignPatentNo, reportVO.getSignPatentNo());
         }
-
+        queryWrapper.orderByDesc(Report::getCreateTime);
         //分页
         if (reportVO.getSize() != null && reportVO.getCurrent() != null) {
-            queryWrapper.and(QueryWrapper -> {
-                QueryWrapper.eq(Report::getCreatePersonId, id)
-                        .or().eq(Report::getPersonId, id);
-                if(departIds.size()!=0){
-                    QueryWrapper.or().in(Report::getDepartmentId,departIds);
-                }
-            });
-            queryWrapper.orderByDesc(Report::getId);
+            SecurityUtils.startDataScope("/pcs/report/query");
             List<Report> reports = this.page(new Page<>(reportVO.getCurrent(), reportVO.getSize()), queryWrapper).getRecords();
             reports = this.reportData(reports);
+            SecurityUtils.startDataScope("/pcs/report/query");
             long count = this.count(queryWrapper);
             return Response.success(reports, DataUtils.setPageColumn(reportVO.getSize(), reportVO.getCurrent(), Math.toIntExact(count)));
-        } else {
+        }
+        else {
             queryWrapper.orderByDesc(Report::getId);
             List<Report> reports = this.list(queryWrapper);
             reports = this.reportData(reports);

BIN
RMS/target/classes/cn/cslg/report/common/config/InnerInterceptor/LizzMybatisIntercepts.class


BIN
RMS/target/classes/cn/cslg/report/common/model/vo/PersonnelVO$DP.class


BIN
RMS/target/classes/cn/cslg/report/common/model/vo/PersonnelVO$PerRole.class


BIN
RMS/target/classes/cn/cslg/report/common/model/vo/PersonnelVO.class


BIN
RMS/target/classes/cn/cslg/report/common/utils/SecurityUtils/SecurityUtils.class


BIN
RMS/target/classes/cn/cslg/report/common/utils/auth/TreeUtils.class


BIN
RMS/target/classes/cn/cslg/report/service/OutInterfaceService.class


BIN
RMS/target/classes/cn/cslg/report/service/business/AssoTaskPatentSplitService.class


BIN
RMS/target/classes/cn/cslg/report/service/business/ReportDocumentService.class


BIN
RMS/target/classes/cn/cslg/report/service/business/ReportService.class