Ver Fonte

12.20 陈宇

lwhhszx há 2 anos atrás
pai
commit
fa3b5fa1f4

+ 3 - 0
RMS/src/main/java/cn/cslg/report/common/config/InnerInterceptor/LizzMybatisIntercepts.java

@@ -109,6 +109,9 @@ public class LizzMybatisIntercepts implements InnerInterceptor {
                         // 根据sql语句结构,将拼接sql放入合适的位置
                         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 + ")";
                         }

+ 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

+ 6 - 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,15 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         if (reportVO.getSignPatentNo() != null && reportVO.getSignPatentNo() != "") {
             queryWrapper.like(Report::getSignPatentNo, reportVO.getSignPatentNo());
         }
-
         //分页
         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);
             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/business/CompareMessageService.class


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


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


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