| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | DocumentDirectoryService documentDirectoryService; |
| | | @Autowired |
| | | OrganizationServiceV2 organizationServiceV2; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | |
| | | /** |
| | | * 需要批量删除 |
| | | * |
| | | * @param fieldSetEntity |
| | | * @return |
| | | * @throws BaseException |
| | |
| | | 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 = ""; |
| | |
| | | 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++) { |
| | |
| | | |
| | | /** |
| | | * 移动(文件批量移动)6 |
| | | * |
| | | * @param |
| | | * @return |
| | | * @throws BaseException |