| | |
| | | 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; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | DocumentDirectoryService documentDirectoryService; |
| | | @Autowired |
| | | OrganizationServiceV2 organizationServiceV2; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | baseDao.add(dataTableEntity); |
| | | } |
| | | |
| | | public boolean verifyOrgExist(String org, Integer user_id) { |
| | | public boolean verifyOrgExist(String org) { |
| | | Integer user_id = SpringMVCContextHolder.getCurrentUser().getUser_id(); |
| | | String code = SpringMVCContextHolder.getCurrentUser().getCurrentStaff().getString("tricode"); |
| | | //获取所有上级编码 |
| | | String[] superior_code = new String[code.split("-").length - 1]; |
| | | for (int i = 0; i < code.split("-").length - 1; i++) { |
| | | superior_code[i] = code.substring(0, code.length() - ((i + 1) * 4)); |
| | | } |
| | | String this_user = String.valueOf(user_id); |
| | | String[][] orgArr = organizationServiceV2.decomposesMultipleTypeValues(org); |
| | | SpringMVCContextHolder.getCurrentUser().getLanguageCode(); |
| | | String[][] orgArr = BaseUtil.decomposesMultipleTypeValues(org); |
| | | String[] user = orgArr[3]; |
| | | if (null != user) { |
| | | for (int i = 0; i < user.length; i++) { |
| | |
| | | } |
| | | String[] level = orgArr[0]; |
| | | String[] dept = orgArr[1]; |
| | | String[] post = orgArr[2]; |
| | | // List<String> list = Arrays.asList(a); --OK |
| | | // List<String> list = Arrays.asList("A","B","C"); --OK |
| | | // list.add("F"); --UnsupportedOperationException |
| | | // list.remove("A"); --UnsupportedOperationException |
| | | // list.set(1,"javaee");--OK (因为是把数组转为集合,其本质还是数组,数组长度固定不变,但内容可以改变) |
| | | // 结论:虽然可以把数组转为集合,但是集合长度不能改变 |
| | | List list = new ArrayList(); |
| | | ; |
| | | 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; |
| | | list.addAll(Arrays.asList(level)); |
| | | } |
| | | 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; |
| | | list.addAll(Arrays.asList(dept)); |
| | | } |
| | | String[] level_dept = new String[list.size()]; |
| | | list.toArray(level_dept); |
| | | |
| | | |
| | | String[] post = orgArr[2]; |
| | | if (level_dept.length != 0) { |
| | | DataTableEntity org_level_uuid = baseDao.listTable(CmnConst.TABLE_PRODUCT_SYS_ORG_LEVELS, BaseUtil.buildQuestionMarkFilter("uuid", level_dept, true) + " and " + BaseUtil.buildQuestionMarkFilter("org_level_code", superior_code, true), new String[]{}); |
| | | if (org_level_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}); |
| | |
| | | //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)) { |
| | | if (verifyOrgExist(org.getString("storage_uuid"))) { |
| | | 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) ") |