2369059705@qq.com
2023-05-26 60f5341a0b30529975f9297b8c735f92c2afc970
文档权限问题
已修改2个文件
95 ■■■■■ 文件已修改
src/main/java/com/product/file/config/CmnConst.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/file/service/DocumentService.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/file/config/CmnConst.java
@@ -25,6 +25,7 @@
    public static final String product_oa_DOCUMENT = "product_oa_document";        //文档表
    public static final String product_oa_DOCUMENT_LOG = "product_oa_document_log";        // 文档操作日志表
    public static final String PRODUCT_SYS_PRINT_TEMPLATE_RECORD = "product_sys_print_template_reocrd";// 打印模板记录表
    public static final String PRODUCT_SYS_STAFFS = "product_sys_staffs";
    public static final String ATTACHMENT_CAPACITY = "attachment_capacity";
    public static final String RESULT = "result";
src/main/java/com/product/file/service/DocumentService.java
@@ -17,6 +17,7 @@
import com.product.file.config.CmnConst;
import com.product.file.service.ide.IDocumentService;
import com.product.module.sys.entity.SystemUser;
import com.product.org.admin.service.OrganizationServiceV2;
import com.product.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -47,6 +48,8 @@
  @Autowired
  DocumentDirectoryService documentDirectoryService;
    @Autowired
    OrganizationServiceV2 organizationServiceV2;
  @Override
  @Transactional
@@ -103,6 +106,7 @@
  /**
   * 需要批量删除
     *
   * @param fieldSetEntity
   * @return
   * @throws BaseException
@@ -221,6 +225,35 @@
    baseDao.add(dataTableEntity);
  }
    public boolean verifyOrgExist(String org, Integer user_id) {
        String this_user = String.valueOf(user_id);
        String[][] orgArr = organizationServiceV2.decomposesMultipleTypeValues(org);
        String[] user = orgArr[3];
        if (null != user) {
            for (int i = 0; i < user.length; i++) {
                if (this_user.equals(user[i])) {
                    return true;
                }
            }
        }
        String[] level = orgArr[0];
        String[] dept = orgArr[1];
        String[] post = orgArr[2];
        if (null != level) {
            DataTableEntity org_level_uuid = baseDao.listTable(CmnConst.PRODUCT_SYS_STAFFS, BaseUtil.buildQuestionMarkFilter("org_level_uuid", level, true) + " and user_id=?", new String[]{this_user});
            if (org_level_uuid.getRows() > 0) return true;
        }
        if (null != dept) {
            DataTableEntity dept_uuid = baseDao.listTable(CmnConst.PRODUCT_SYS_STAFFS, BaseUtil.buildQuestionMarkFilter("dept_uuid", dept, true) + " and user_id=?", new String[]{this_user});
            if (dept_uuid.getRows() > 0) return true;
        }
        if (null != post) {
            DataTableEntity post_uuid = baseDao.listTable(CmnConst.PRODUCT_SYS_STAFFS, BaseUtil.buildQuestionMarkFilter("job_post_uuid", post, true) + " and user_id=?", new String[]{this_user});
            if (post_uuid.getRows() > 0) return true;
        }
        return false;
    }
  @Override
  public FieldSetEntity getButtonPermissions(FieldSetEntity fieldSetEntity) throws BaseException {
    String butt = "";
@@ -233,63 +266,15 @@
      String key = "%," + user_id + ",%";
      String directory_uuid = fieldSetEntity.getString(CmnConst.DIRECTORY_UUID);
      //String key = "%,140,%";
            DataTableEntity dataTableEntity = new DataTableEntity();
            FieldSetEntity org = baseDao.getFieldSetByFilter(CmnConst.product_oa_DIRECTORY_RIGHTS, "directory_uuid=?", new String[]{directory_uuid}, false);
            if (verifyOrgExist(org.getString("storage_uuid"), user_id)) {
      StringBuffer sql = new StringBuffer();
      sql.append(" SELECT  substring_index(substring_index(a.rigths,',',b.help_topic_id+1),',',-1) fun FROM  product_oa_directory_rights a ")
              .append(" INNER join   mysql.help_topic b on b.help_topic_id < (length(a.rigths) - length(replace(a.rigths,',',''))+1) ")
              .append(" WHERE a.directory_uuid = ? AND CONCAT(',',a.storage_uuid,',') LIKE ? ");
      //暂时不用
//      sql.append(" SELECT ")
//              .append(" fun ")
//              .append(" FROM ")
//              .append(" ( SELECT ")
//              .append(" SUBSTRING_INDEX( SUBSTRING_INDEX( d.rigths, ',', 1 ), ',', - 1 ) fun, ")
//              .append(" d.staff_ids, ")
//              .append(" d.directory_uuid ")
//              .append(" FROM ")
//              .append(" (SELECT a.rigths, concat( ',', b.staff_ids, ',' ) staff_ids, a.directory_uuid FROM product_oa_directory_rights a LEFT JOIN product_sys_organizational_structure_storage b ON a.storage_uuid = b.uuid) d UNION ALL ")
//              .append(" SELECT ")
//              .append(" SUBSTRING_INDEX( SUBSTRING_INDEX( d.rigths, ',', 2 ), ',', - 1 ) fun, ")
//              .append(" d.staff_ids, ")
//              .append(" d.directory_uuid ")
//              .append(" FROM ")
//              .append(" (SELECT a.rigths, concat( ',', b.staff_ids, ',' ) staff_ids, a.directory_uuid FROM product_oa_directory_rights a LEFT JOIN product_sys_organizational_structure_storage b ON a.storage_uuid = b.uuid) d UNION ALL ")
//              .append(" SELECT ")
//              .append(" SUBSTRING_INDEX( SUBSTRING_INDEX( d.rigths, ',', 3 ), ',',- 1 ) fun, ")
//              .append(" d.staff_ids, ")
//              .append(" d.directory_uuid ")
//              .append(" FROM ")
//              .append(" (SELECT a.rigths, concat( ',', b.staff_ids, ',' ) staff_ids, a.directory_uuid FROM product_oa_directory_rights a LEFT JOIN product_sys_organizational_structure_storage b ON a.storage_uuid = b.uuid) d UNION ALL ")
//              .append(" SELECT ")
//              .append(" SUBSTRING_INDEX( SUBSTRING_INDEX( d.rigths, ',', 4 ), ',',- 1 ) fun, ")
//              .append(" d.staff_ids, ")
//              .append(" d.directory_uuid ")
//              .append(" FROM ")
//              .append(" (SELECT a.rigths, concat( ',', b.staff_ids, ',' ) staff_ids, a.directory_uuid FROM product_oa_directory_rights a LEFT JOIN product_sys_organizational_structure_storage b ON a.storage_uuid = b.uuid) d UNION ALL ")
//              .append(" SELECT ")
//              .append(" SUBSTRING_INDEX( SUBSTRING_INDEX( d.rigths, ',', 5 ), ',',- 1 ) fun, ")
//              .append(" d.staff_ids, ")
//              .append(" d.directory_uuid ")
//              .append(" FROM ")
//              .append(" (SELECT a.rigths, concat( ',', b.staff_ids, ',' ) staff_ids, a.directory_uuid FROM product_oa_directory_rights a LEFT JOIN product_sys_organizational_structure_storage b ON a.storage_uuid = b.uuid) d UNION ALL ")
//              .append(" SELECT ")
//              .append(" SUBSTRING_INDEX( SUBSTRING_INDEX( d.rigths, ',', 6 ), ',',- 1 ) fun, ")
//              .append(" d.staff_ids, ")
//              .append(" d.directory_uuid ")
//              .append(" FROM ")
//              .append(" (SELECT a.rigths, concat( ',', b.staff_ids, ',' ) staff_ids, a.directory_uuid FROM product_oa_directory_rights a LEFT JOIN product_sys_organizational_structure_storage b ON a.storage_uuid = b.uuid) d UNION ALL ")
//              .append(" SELECT ")
//              .append(" SUBSTRING_INDEX( SUBSTRING_INDEX( d.rigths, ',', 7 ), ',',- 1 ) fun, ")
//              .append(" d.staff_ids, ")
//              .append(" d.directory_uuid ")
//              .append(" FROM ")
//              .append(" (SELECT a.rigths, concat( ',', b.staff_ids, ',' ) staff_ids, a.directory_uuid FROM product_oa_directory_rights a LEFT JOIN product_sys_organizational_structure_storage b ON a.storage_uuid = b.uuid) d ")
//              .append(" ) e ")
//              .append(" WHERE ")
//              .append(" CONCAT(',',e.staff_ids,',') LIKE ? ")
//              .append(" AND e.directory_uuid = ? ")
//              .append(" GROUP BY ")
//              .append(" e.fun ");
      DataTableEntity dataTableEntity = baseDao.listTable(sql.toString(), new String[]{directory_uuid,key});
                        .append(" WHERE a.directory_uuid = ? ");
                dataTableEntity = baseDao.listTable(sql.toString(), new String[]{directory_uuid});
            }
      StringBuffer button = new StringBuffer();
      if (!BaseUtil.dataTableIsEmpty(dataTableEntity)) {
        for (int i = 0, length = dataTableEntity.getRows(); i < length; i++) {
@@ -409,6 +394,7 @@
  /**
   * 移动(文件批量移动)6
     *
   * @param
   * @return
   * @throws BaseException