Bläddra i källkod

[task-6467]受控文件查阅:受限类文件查阅异常
1.只展示用户所在部门的部门查阅类型文件
2.受限类文件申请后要在客户的受限类文件夹中展示

xiexh 4 månader sedan
förälder
incheckning
4bc98ee652

+ 64 - 7
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/business/service/impl/ReformServiceImpl.java

@@ -1,5 +1,6 @@
 package com.lc.ibps.business.service.impl;
 
+import com.lc.ibps.api.org.constant.PartyType;
 import com.lc.ibps.base.core.constants.StringPool;
 import com.lc.ibps.base.core.util.AppUtil;
 import com.lc.ibps.base.core.util.BeanUtils;
@@ -185,14 +186,39 @@ public class ReformServiceImpl implements ReformService {
 
         // 部门权限文件
         // shi_fou_guo_shen_ in ('有效','使用')
-        String buMenSql = sql + " where wj.shi_fou_guo_shen_ in ('有效','使用') and  qqwweerr and FIND_IN_SET (wj.xi_lei_id_,'%s') ";
+        String buMenSql = sql + " where wj.shi_fou_guo_shen_ in ('有效','使用') and  qqwweerr ";
         IPartyPositionService partyPositionService = AppUtil.getBean(IPartyPositionService.class);
         APIResult<List<PartyPositionPo>> result1 = partyPositionService.findByUserId(userId);
         if (result1.isFailed() || Collections.isEmpty(result1.getData())) {
             throw new IllegalArgumentException("buMen not match!");
         }
-        String currBuMen = result1.getData().stream().map(PartyPositionTbl::getId).collect(Collectors.joining(","));
-        String[] split = currBuMen.split(",");
+        ArrayList<String> deptList = new ArrayList<>();
+        ArrayList<String> deptNameList = new ArrayList<>();
+        for(PartyPositionPo p1 :result1.getData()){
+            String sid = p1.getId();
+            String sidName = p1.getName();
+            APIResult<List<PartyPositionPo>> resultAll =partyPositionService.findAll();
+            if (BeanUtils.isEmpty(resultAll) || Collections.isEmpty(resultAll.getData())) {
+                throw new IllegalArgumentException("buMen not match!");
+            }
+            for(PartyPositionPo p : resultAll.getData()){
+                if(p.getPath().contains(sid)){
+                    deptList.add(p.getId());
+                    deptNameList.add(sidName);
+                }
+            }
+
+        }
+        // 使用Stream去重并转换为数组
+        String[] split = deptList.stream()
+                .distinct()
+                .toArray(String[]::new);
+        String[] splitName = deptList.stream()
+                .distinct()
+                .toArray(String[]::new);
+        log.warn("去重后的部门数组: {}" + Arrays.toString(splitName));
+        //String currBuMen = result1.getData().stream().map(PartyPositionTbl::getId).collect(Collectors.joining(","));
+        //String[] split = currBuMen.split(",");
         String buMenAtr = "";
         for (String bu: split ) {
             if(buMenAtr.length()<1){
@@ -202,16 +228,21 @@ public class ReformServiceImpl implements ReformService {
             }
         }
         buMenSql = buMenSql.replace("qqwweerr"," (" + buMenAtr + ")");
-        buMenSql = String.format(buMenSql , bmIds);
+        String str ="";
+         if(BeanUtils.isNotEmpty(buMenAtr)){
+             str = " AND FIND_IN_SET (wj.xi_lei_id_,'"+bmIds.trim()+"')";
+         }
+         buMenSql = buMenSql+str;
+        //buMenSql = String.format(buMenSql , bmIds);
         buMenSql = buMenSql + conditions + sorts;
         List<Map<String, Object>> buMenList = (List<Map<String, Object>>) commonDao.query(buMenSql);
 
 
         //  受限文件
         // 超管 和 文件管理员 查询所有 否则根据当前用户匹配查询
-        String role = "SELECT id_ from ibps_party_user_role WHERE ROLE_ID_ in(SELECT id_ from ibps_party_role where NAME_='wjgly') and USER_ID_='%s' limit 1";
+        String role = "SELECT id_ from ibps_party_user_role WHERE ROLE_ID_ in(SELECT id_ from ibps_party_role where ROLE_ALIAS_='wjgly') and USER_ID_='%s' limit 1";
         Map<String, Object> roleMap = commonDao.queryOne(role);
-        String sxsql = "select wj.id_ as id,cy.id_ as cy_id_,sc.id_ as sc_id_,wj.shu_ju_lai_yuan_ AS shu_ju_lai_yuan_,file.ext_ AS ext_,file.FILE_PATH_ AS file_path_," +
+/*        String sxsql = "select wj.id_ as id,cy.id_ as cy_id_,sc.id_ as sc_id_,wj.shu_ju_lai_yuan_ AS shu_ju_lai_yuan_,file.ext_ AS ext_,file.FILE_PATH_ AS file_path_," +
                 "  CONCAT(file.file_name_, '.', file.ext_, '(',CASE WHEN file.total_bytes_ >= 1024 * 1024 THEN CONCAT(ROUND(file.total_bytes_ / (1024.0 * 1024), 2), ' M') " +
                 "  WHEN file.total_bytes_ >= 1024 THEN CONCAT(ROUND(file.total_bytes_ / 1024.0, 2), ' K') ELSE CONCAT(file.total_bytes_, 'B') END , ')') as file_info_," +
                 "  wj.wen_jian_xi_lei_,wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_,wj.wen_jian_fu_jian_ AS fu_jian_,sq.cha_yue_jie_zhi_s, " +
@@ -236,7 +267,33 @@ public class ReformServiceImpl implements ReformService {
                 "  WHERE wjxxb.id_ = wj.id_ AND CONCAT_WS(',',IF( wjxdzb.bian_zhi_ren_ != '', wjxdzb.bian_zhi_ren_, NULL )," +
                 "  IF( wjxdzb.zhu_shen_he_ren_ != '', wjxdzb.zhu_shen_he_ren_, NULL ), " +
                 "  IF( wjxdzb.zhu_shen_pi_ren_ != '', wjxdzb.zhu_shen_pi_ren_, NULL ) " +
-                "  ) LIKE '%%%s%%' ))  and FIND_IN_SET (wj.xi_lei_id_,'%s') ";
+                "  ) LIKE '%%%s%%' ))  and FIND_IN_SET (wj.xi_lei_id_,'%s') ";*/
+
+        String sxsql = "select wj.id_ as id,cy.id_ as cy_id_,sc.id_ as sc_id_,wj.shu_ju_lai_yuan_ AS shu_ju_lai_yuan_,file.ext_ AS ext_,file.FILE_PATH_ AS file_path_," +
+                "  CONCAT(file.file_name_, '.', file.ext_, '(',CASE WHEN file.total_bytes_ >= 1024 * 1024 THEN CONCAT(ROUND(file.total_bytes_ / (1024.0 * 1024), 2), ' M') " +
+                "  WHEN file.total_bytes_ >= 1024 THEN CONCAT(ROUND(file.total_bytes_ / 1024.0, 2), ' K') ELSE CONCAT(file.total_bytes_, 'B') END , ')') as file_info_," +
+                "  wj.wen_jian_xi_lei_,wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_,wj.wen_jian_fu_jian_ AS fu_jian_,sq.cha_yue_jie_zhi_s, " +
+                "  wj.fa_bu_shi_jian_ as fa_fang_shi_jian_, " +
+                "  wj.shi_fou_guo_shen_ AS shi_fou_guo_shen_, wj.bian_zhi_bu_men_ AS bian_zhi_bu_men_, " +
+                "  wj.bian_zhi_ren_ AS bian_zhi_ren_, " +
+                "  wj.bian_zhi_shi_jian AS bian_zhi_shi_jian, " +
+                "  wj.wen_jian_lei_xing AS wen_jian_lei_xing, " +
+                "  wj.quan_xian_lei_xin AS quan_xian_lei_xin, " +
+                "  wj.poct_shi_yong_ AS shi_yong_bu_men_ " +
+                "  FROM t_wjxxb wj " +
+                "  LEFT JOIN (" +
+                "  SELECT a.* FROM t_skwjcysqsqzb a INNER JOIN ( SELECT wen_jian_id_, MAX(cha_yue_jie_zhi_s) as max_time FROM t_skwjcysqsqzb " +
+                "  WHERE parent_id_ IN ( SELECT id_ FROM t_skwjcysqsq WHERE shi_fou_guo_shen_ = '已完成' AND bian_zhi_ren_ = '%s' ) " +
+                "  GROUP BY wen_jian_id_  ) b ON a.wen_jian_id_ = b.wen_jian_id_ AND a.cha_yue_jie_zhi_s = b.max_time " +
+                "  WHERE a.parent_id_ IN (  SELECT id_ FROM t_skwjcysqsq WHERE shi_fou_guo_shen_ = '已完成' AND bian_zhi_ren_ = '%s' ) " +
+                "  ) sq ON wj.id_ = sq.wen_jian_id_ " +
+                "  left join (select id_,parent_id_ from t_wjcyjl group by parent_id_) cy on cy.parent_id_ = wj.id_ " +
+                "  left join (select id_,parent_id_ from t_wjscjl group by parent_id_) sc on sc.parent_id_ = wj.id_ " +
+                "  left join ibps_file_attachment file on file.id_ = wj.wen_jian_fu_jian_ WHERE wj.shi_fou_guo_shen_ = '有效' AND (%s OR %s " +
+                "  OR EXISTS (SELECT 1 FROM t_wjxdzb wjxdzb JOIN t_wjxzxdjlb wjxzxdjlb ON wjxdzb.id_ = wjxzxdjlb.parent_id_ JOIN t_wjxxb wjxxb ON wjxxb.shu_ju_lai_yuan_ = wjxzxdjlb.id_ " +
+                "  JOIN t_skwjcysqsqzb skwjcysqsqzb ON wjxxb.id_= skwjcysqsqzb.wen_jian_id_ "+
+                "  WHERE wjxxb.id_ = wj.id_ AND skwjcysqsqzb.create_by_ LIKE '%%%s%%' ))  and FIND_IN_SET (wj.xi_lei_id_,'%s') ";
+
         sxsql = String.format(sxsql, userId, userId, ContextUtil.isSuper() , BeanUtils.isNotEmpty(roleMap) , userId , kzIds);
         sxsql = sxsql + conditions + sorts;
         List<Map<String, Object>> limitLists = (List<Map<String, Object>>) commonDao.query(sxsql);