浏览代码

templeDesice 2022/8/30

lwhhszx 3 年之前
父节点
当前提交
6c6c2848da

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/utils/CacheUtils.java

@@ -54,7 +54,7 @@ public class CacheUtils {
         if (StringUtils.isEmpty(json)) {
             throw new NotLoginException("无数据", "user", "");
         } else {
-            return JsonUtils.jsonToPojo(json, PersonnelVO.class);
+            return com.alibaba.fastjson2.JSONObject.parseObject(json, PersonnelVO.class);
         }
     }
 

+ 33 - 3
PAS/src/main/java/cn/cslg/pas/common/utils/auth/TreeUtils.java

@@ -5,6 +5,7 @@ import cn.cslg.pas.common.model.PersonnelVO;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.RedisUtil;
 import com.alibaba.fastjson.JSONObject;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -46,7 +47,7 @@ public class TreeUtils {
         else{
             String field =jsonLeft.get("field").toString();
             String value=distinguishFields(jsonLeft.get("value").toString(),dataSource,personnelVO);
-            str1 = field+jsonLeft.get("opr").toString()+value;
+            str1 = field+" "+jsonLeft.get("opr").toString()+" "+value;
         }
         if(jsonRight.containsKey("right")){
             str2= recursionTree( jsonRight,dataSource,personnelVO);
@@ -54,7 +55,7 @@ public class TreeUtils {
         else{
             String field =jsonRight.get("field").toString();
             String value=distinguishFields(jsonRight.get("value").toString(),dataSource,personnelVO);
-            str2 =field+jsonRight.get("opr").toString()+value;
+            str2 =field+" "+jsonRight.get("opr").toString()+" "+value;
         }
         String sql ="("+ str1+") "+ jsonObject.get("logicOpr")+" ("+str2+")";
         return sql;
@@ -91,15 +92,44 @@ public class TreeUtils {
 
     //对field部分进行计算 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;
         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;
+                    break;
+                }
+
+
             }}
 
         return reField;

+ 2 - 1
PAS/src/main/resources/application-dev.yml

@@ -1,8 +1,9 @@
 spring:
   redis:
-    host: 192.168.0.57
+    host: 47.101.137.223
     port: 6379
     database: 8
+    password: Xx0GWxdWQJxx6Swe
     timeout: 1000
   datasource:
     url: jdbc:mysql://47.101.137.223:3306/pas?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8

+ 6 - 6
PAS/src/main/resources/mapper/ProjectMapper.xml

@@ -25,12 +25,12 @@
             <if test="params.clientName != '' and params.clientName != null">
                 and b.name like concat('%', #{params.clientName}, '%')
             </if>
-            <if test="params.myself == true">
-                and ((a.id in
-                <foreach item="item" index="index" collection="params.proIds" open="(" separator="," close=")">
-                    #{item}
-                </foreach>) or a.creat_id = #{params.createBy})
-            </if>
+<!--            <if test="params.myself == true">-->
+<!--                and ((a.id in-->
+<!--                <foreach item="item" index="index" collection="params.proIds" open="(" separator="," close=")">-->
+<!--                    #{item}-->
+<!--                </foreach>) or a.creat_id = #{params.createBy})-->
+<!--            </if>-->
             <if test="params.type != null and params.type.size() != 0">
                 <foreach item="item" index="index" collection="params.type" open=" and (" separator="or" close=")">
                     FIND_IN_SET(#{item}, a.typeid)