| | |
| | | StringBuffer sql = new StringBuffer(); |
| | | |
| | | sql.append("SELECT \n"); |
| | | sql.append(" A.*,B.show_name name, \n"); |
| | | sql.append(" E.route_name,A.*,B.show_name name, \n"); |
| | | sql.append(" CONCAT(CONVERT(a.file_size / 1024, decimal(10,2)), 'KB') file_size_kb, \n"); |
| | | sql.append(" CASE WHEN D.document_uuid IS NOT NULL THEN '1' ELSE '0' END AS is_collection, \n"); |
| | | sql.append(" (SELECT case when COUNT(*)=0 then 1 else COUNT(*) end FROM product_oa_document_history where product_oa_document_history.document_uuid=A.uuid) -1 history_count "); |
| | | sql.append("FROM( \n"); |
| | | sql.append(" ,if(A.turn_button is null,'否','是') turn"); |
| | | sql.append(" FROM( \n"); |
| | | if ("!borrow".equals(directory_uuid)) { |
| | | //借阅文件夹查询文件特殊处理 |
| | | sql.append("SELECT\n"); |
| | |
| | | sql.append("LEFT JOIN product_sys_staffs B ON B.user_id = A.created_by \n"); |
| | | sql.append("LEFT JOIN product_sys_attachments C ON C.uuid = B.staff_avatar \n"); |
| | | sql.append("LEFT JOIN product_oa_document_collection D ON D.document_uuid = A.uuid AND D.created_by = ?"); |
| | | sql.append("LEFT JOIN product_sys_function_buttons E ON E.uuid = A.turn_button "); |
| | | |
| | | DataTableEntity documentData = baseDao.listTable(sql.toString(), new String[]{directory_uuid, SpringMVCContextHolder.getCurrentUserId()}, |
| | | fieldSetEntity.getInteger(CmnConst.PAGESIZE), fieldSetEntity.getInteger(CmnConst.CPAGE)); |
| | | baseDao.listInternationDataTable(documentData, null); |
| | |
| | | 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); |
| | | |
| | | FieldSetEntity org = recursionRole(directory_uuid); |
| | | 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) ") |
| | | .append(" WHERE a.directory_uuid = ? "); |
| | | dataTableEntity = baseDao.listTable(sql.toString(), new String[]{directory_uuid}); |
| | | dataTableEntity = baseDao.listTable(sql.toString(), new String[]{org.getString("directory_uuid")}); |
| | | } |
| | | StringBuffer button = new StringBuffer(); |
| | | if (!BaseUtil.dataTableIsEmpty(dataTableEntity)) { |
| | |
| | | fse.setSubData(dataMap); |
| | | |
| | | return fse; |
| | | } |
| | | |
| | | /** |
| | | * 递归获取权限如果当前文档未配置权限就去递归查询父级权限 |
| | | * @param directory_uuid |
| | | * @return |
| | | */ |
| | | private FieldSetEntity recursionRole(String directory_uuid){ |
| | | FieldSetEntity org = baseDao.getFieldSetByFilter(CmnConst.PRODUCT_OA_DIRECTORY_RIGHTS, "directory_uuid=?", new String[]{directory_uuid}, false); |
| | | if (FieldSetEntity.isEmpty(org)&&!StringUtils.isEmpty(directory_uuid)){ |
| | | FieldSetEntity directoryFs = baseDao.getFieldSet(CmnConst.PRODUCT_OA_DIRECTORY, directory_uuid,false); |
| | | FieldSetEntity parentFs = baseDao.getFieldSetByFilter(CmnConst.PRODUCT_OA_DIRECTORY, "tricode=?",new String[]{directoryFs.getString("tricode_parent")},false); |
| | | org=recursionRole(parentFs.getUUID()); |
| | | } |
| | | return org; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public DataTableEntity getApplyDocument(FieldSetEntity fse) throws BaseException { |
| | | |
| | | String sub_uuid = fse.getString("sub_uuid"); |
| | | String filter=" uuid in ("+sub_uuid+")"; |
| | | DataTableEntity product_sys_attachments = baseDao.listTable("product_sys_attachments", filter, new Object[]{}); |
| | | String sub_uuid = fse.getString("sub_uuid"); |
| | | String sub_uuid_replace = sub_uuid.replace("\"", ""); |
| | | String[] sub_uuid_split = sub_uuid_replace.split(","); |
| | | String sub_uuids=""; |
| | | for (int i = 0; i < sub_uuid_split.length; i++) { |
| | | |
| | | if(i==sub_uuid_split.length-1){ |
| | | sub_uuids=sub_uuids+"\""+sub_uuid_split[i]+"\""; |
| | | }else { |
| | | sub_uuids=sub_uuids+"\""+sub_uuid_split[i]+"\","; |
| | | } |
| | | } |
| | | List<String> param = new ArrayList<>(); |
| | | StringBuilder sb=new StringBuilder(); |
| | | sb.append(" SELECT a.*,f.show_name"); |
| | | sb.append(" FROM product_sys_attachments a "); |
| | | sb.append(" LEFT JOIN product_sys_staffs f "); |
| | | sb.append(" on a.created_by =f.user_id "); |
| | | sb.append(" where a.uuid in ("+sub_uuids+")"); |
| | | DataTableEntity product_sys_attachments = baseDao.listTable(sb.toString(),param.toArray()); |
| | | return product_sys_attachments; |
| | | } |
| | | |
| | |
| | | StringBuilder sb = new StringBuilder(); |
| | | List<String> param = new ArrayList<>(); |
| | | sb.append(" SELECT b.* FROM ("); |
| | | sb.append(" SELECT t.uuid,t.file_name,t.file_size,s.show_name,t.created_utc_datetime,count(t.uuid) as applyCount"); |
| | | sb.append(" SELECT t.uuid,t.file_name,t.attachment_size as file_size,s.show_name,t.created_utc_datetime,count(t.uuid) as applyCount"); |
| | | sb.append(" FROM product_oa_document_borrow_sub b"); |
| | | sb.append(" JOIN product_oa_document t"); |
| | | sb.append(" JOIN product_sys_attachments t"); |
| | | sb.append(" on b.sub_uuid=t.uuid"); |
| | | sb.append(" JOIN product_sys_staffs s "); |
| | | sb.append(" on t.created_by=s.user_id"); |
| | | sb.append(" group by t.file_name,t.uuid,s.show_name,t.created_utc_datetime,t.file_size"); |
| | | sb.append(" group by t.file_name,t.uuid,s.show_name,t.created_utc_datetime,t.attachment_size"); |
| | | sb.append(" )b order by b.applyCount asc"); |
| | | DataTableEntity dataTableEntity = baseDao.listTable(sb.toString(), param.toArray()); |
| | | return dataTableEntity; |
| | |
| | | sb.append(" FROM product_oa_document_borrow w "); |
| | | sb.append(" left JOIN product_oa_document_borrow_sub b"); |
| | | sb.append(" on b.borrow_uuid=w.uuid"); |
| | | sb.append(" left JOIN product_oa_document t"); |
| | | sb.append(" left JOIN product_sys_attachments t"); |
| | | sb.append(" on b.sub_uuid=t.uuid"); |
| | | sb.append(" left JOIN product_sys_staffs s"); |
| | | sb.append(" on w.borrower=s.user_id"); |