From 305dc0c57b588f15dd53e5c6c01c3210292a3e9d Mon Sep 17 00:00:00 2001 From: 杜洪波 <1074825718@qq.com> Date: 星期四, 22 八月 2024 18:15:25 +0800 Subject: [PATCH] 文档管理目录调整 --- src/main/java/com/product/file/controller/DocumentDirectoryConstoller.java | 658 ++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 359 insertions(+), 299 deletions(-) diff --git a/src/main/java/com/product/file/controller/DocumentDirectoryConstoller.java b/src/main/java/com/product/file/controller/DocumentDirectoryConstoller.java index 790a172..e25fc03 100644 --- a/src/main/java/com/product/file/controller/DocumentDirectoryConstoller.java +++ b/src/main/java/com/product/file/controller/DocumentDirectoryConstoller.java @@ -15,6 +15,8 @@ import com.product.module.sys.config.SystemErrorCode; import com.product.module.sys.entity.SystemUser; import com.product.module.sys.version.ApiVersion; +import com.product.util.BaseUtil; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -34,311 +36,369 @@ @RequestMapping("/api/directory") @RestController public class DocumentDirectoryConstoller extends AbstractBaseController { - @Autowired - public DocumentDirectoryService documentDirectoryService; + + @Autowired + DocumentDirectoryService documentDirectoryService; - /** - * 鏁版嵁鏉冮檺楠岃瘉 - */ - @Autowired - PermissionService permissionService; - /** - * 鏂板鏂囦欢澶规暟鎹� - * @param request - * @return - */ - @RequestMapping(value = "/addDocumentDirectory/{version}", method = RequestMethod.POST) - @ApiVersion(1) - public String addDocumentDirectory(HttpServletRequest request) { - try { - //鑾峰彇鍙傛暟 - FieldSetEntity fse = null; - Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); - if (bean != null) { - RequestParameterEntity reqp = (RequestParameterEntity) bean; - fse = reqp.getFormData(); - } - //鍒ゆ柇鍙傛暟鏄惁涓虹┖ - if (fse == null) { - SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - } - IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService); - return OK_Add(service.addDocumentDirectory(fse)); - } catch (BaseException e) { - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(e); - }catch (Exception e) { - e.printStackTrace(); - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); - } - } + /** + * 鏁版嵁鏉冮檺楠岃瘉 + */ + @Autowired + PermissionService permissionService; + + /** + * 鏂板鏂囦欢澶规暟鎹� + * + * @param request + * @return + */ + @RequestMapping(value = "/all-directory-tree/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String allDirectoryTree(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_OA_DIRECTORY); + return com.product.util.ResultInfo.success(BaseUtil.dataTableEntityToJson(documentDirectoryService.allDirectoryTree())); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); + } + } - /** - * 淇敼鏂囦欢澶� - * @param request - * @return - */ - @RequestMapping(value = "/upDocumentDirectory/{version}", method = RequestMethod.POST) - @ApiVersion(1) - public String upDocumentDirectory(HttpServletRequest request) { - try { - //鑾峰彇鍙傛暟 - FieldSetEntity fse = null; - Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); - if (bean != null) { - RequestParameterEntity reqp = (RequestParameterEntity) bean; - fse = reqp.getFormData(); - } - //鍒ゆ柇鍙傛暟鏄惁涓虹┖ - if (fse == null) { - SpringMVCContextHolder - .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - } - String uuid = fse.getString(CmnConst.UUID);//琛╱uid - //瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - int type; - if(currentUser.getUserType() == 2){ - type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; - }else { - type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; - } - //鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� - if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) { - SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - } - IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService); - if(service.upDocumentDirectory(fse)) { - return OK(); - } - return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); - } catch (BaseException e) { - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(e); - }catch (Exception e) { - e.printStackTrace(); - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); - } - } + /** + * 鏂板鏂囦欢澶规暟鎹� + * + * @param request + * @return + */ + @RequestMapping(value = "/addDocumentDirectory/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String addDocumentDirectory(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + // 鍒ゆ柇鍙傛暟鏄惁涓虹┖ + if (fse == null) { + SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + } + IDocumentDirectoryService service = (IDocumentDirectoryService) getProxyInstance(documentDirectoryService); + return OK_Add(service.addDocumentDirectory(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); + } + } - /** - * 涓汉鏂囦欢澶归噸鍛藉悕 - * @param request - * @return - */ - @RequestMapping(value = "/upDocumentDirectoryName/{version}", method = RequestMethod.POST) - @ApiVersion(1) - public String upDocumentDirectoryName(HttpServletRequest request) { - try { - //鑾峰彇鍙傛暟 - FieldSetEntity fse = null; - Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); - if (bean != null) { - RequestParameterEntity reqp = (RequestParameterEntity) bean; - fse = reqp.getFormData(); - } - //鍒ゆ柇鍙傛暟鏄惁涓虹┖ - if (fse == null) { - SpringMVCContextHolder - .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - } - String uuid = fse.getString(CmnConst.UUID);//琛╱uid - //瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - int type; - if(currentUser.getUserType() == 2){ - type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; - }else { - type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; - } - //鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� - if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) { - SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - } - IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService); - if(service.upDocumentDirectoryName(fse)) { - return OK(); - } - return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(), DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText()); - } catch (BaseException e) { - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(e); - }catch (Exception e) { - e.printStackTrace(); - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(), DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText()); - } - } + /** + * 淇敼鏂囦欢澶� + * + * @param request + * @return + */ + @RequestMapping(value = "/upDocumentDirectory/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String upDocumentDirectory(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + // 鍒ゆ柇鍙傛暟鏄惁涓虹┖ + if (fse == null) { + SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + } + String uuid = fse.getString(CmnConst.UUID);// 琛╱uid + // 瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + int type; + if (currentUser.getUserType() == 2) { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; + } else { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; + } + // 鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� + if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) { + SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + } + IDocumentDirectoryService service = (IDocumentDirectoryService) getProxyInstance(documentDirectoryService); + if (service.upDocumentDirectory(fse)) { + return OK(); + } + return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); + } + } - /** - * 鍒犻櫎鏂囦欢澶� - * @param request - * @return - */ - @RequestMapping(value = "/delDocumentDirectory/{version}", method = RequestMethod.POST) - @ApiVersion(1) - public String delDocumentDirectory(HttpServletRequest request) { - try { - //鑾峰彇鍙傛暟 - FieldSetEntity fse = null; - Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); - if (bean != null) { - RequestParameterEntity reqp = (RequestParameterEntity) bean; - fse = reqp.getFormData(); - } - //鍒ゆ柇鍙傛暟鏄惁涓虹┖ - if (fse == null) { - SpringMVCContextHolder - .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - } - String uuid = fse.getString(CmnConst.UUID);//琛╱uid - //瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - int type; - if(currentUser.getUserType() == 2){ - type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; - }else { - type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; - } - //鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� - if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) { - SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - } - IDocumentDirectoryService service = (IDocumentDirectoryService)getProxyInstance(documentDirectoryService); - if(service.delDocumentDirectory(fse)){ - return OK(); - } - return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText()); - } catch (BaseException e) { - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(e); - }catch (Exception e) { - e.printStackTrace(); - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText()); - } - } + /** + * 涓汉鏂囦欢澶归噸鍛藉悕 + * + * @param request + * @return + */ + @RequestMapping(value = "/upDocumentDirectoryName/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String upDocumentDirectoryName(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + // 鍒ゆ柇鍙傛暟鏄惁涓虹┖ + if (fse == null) { + SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + } + String uuid = fse.getString(CmnConst.UUID);// 琛╱uid + // 瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + int type; + if (currentUser.getUserType() == 2) { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; + } else { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; + } + // 鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� + if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) { + SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + } + IDocumentDirectoryService service = (IDocumentDirectoryService) getProxyInstance(documentDirectoryService); + if (service.upDocumentDirectoryName(fse)) { + return OK(); + } + return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(), + DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText()); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getValue(), + DocumentCode.DOCUMENT_DIRECTORY_NAME_FAIL.getText()); + } + } + /** + * 鍒犻櫎鏂囦欢澶� + * + * @param request + * @return + */ + @RequestMapping(value = "/delDocumentDirectory/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String delDocumentDirectory(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + // 鍒ゆ柇鍙傛暟鏄惁涓虹┖ + if (fse == null) { + SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + } + String uuid = fse.getString(CmnConst.UUID);// 琛╱uid + // 瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + int type; + if (currentUser.getUserType() == 2) { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; + } else { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; + } + // 鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� + if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) { + SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + } + IDocumentDirectoryService service = (IDocumentDirectoryService) getProxyInstance(documentDirectoryService); + if (service.delDocumentDirectory(fse)) { + return OK(); + } + return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText()); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_DELETE_FAIL.getText()); + } + } - /** - * 鏂囦欢鐩綍鍒楄〃灞曠ず - * @param request - * @return - */ - @RequestMapping(value = "/moveToList/{version}", method = RequestMethod.POST) - @ApiVersion(1) - public String moveToList(HttpServletRequest request) { - try { - //鑾峰彇鍙傛暟 - FieldSetEntity fse = null; - Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); - if (bean != null) { - RequestParameterEntity reqp = (RequestParameterEntity) bean; - fse = reqp.getFormData(); - } - //鍒ゆ柇鍙傛暟鏄惁涓虹┖ - if (fse == null) { - SpringMVCContextHolder - .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - } - return OK_List(documentDirectoryService.moveToList(fse)); - } catch (BaseException e) { - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(e); - }catch (Exception e) { - e.printStackTrace(); - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText()); - } - } + /** + * 鏂囦欢鐩綍鍒楄〃灞曠ず + * + * @param request + * @return + */ + @RequestMapping(value = "/moveToList/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String moveToList(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + // 鍒ゆ柇鍙傛暟鏄惁涓虹┖ + if (fse == null) { + SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + } + return OK_List(documentDirectoryService.moveToList(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText()); + } + } + /** + * 鑾峰彇鏂囨。鐩綍鏍戝舰鍒楄〃 + * + * @param request + * @return + */ + @RequestMapping(value = "/treeListAll/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String treeListAll(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + // 鍒ゆ柇鍙傛暟鏄惁涓虹┖ + if (fse == null) { + SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + } + return ResultInfo.success(documentDirectoryService.treeListAll(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getText()); + } + } - /** - * 鑾峰彇鏂囨。鐩綍鏍戝舰鍒楄〃 - * @param request - * @return - */ - @RequestMapping(value = "/treeListAll/{version}", method = RequestMethod.POST) - @ApiVersion(1) - public String treeListAll(HttpServletRequest request) { - try { - //鑾峰彇鍙傛暟 - FieldSetEntity fse = null; - Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); - if (bean != null) { - RequestParameterEntity reqp = (RequestParameterEntity) bean; - fse = reqp.getFormData(); - } - //鍒ゆ柇鍙傛暟鏄惁涓虹┖ - if (fse == null) { - SpringMVCContextHolder - .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - } - return ResultInfo.success(documentDirectoryService.treeListAll(fse)); - } catch (BaseException e) { - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(e); - }catch (Exception e) { - e.printStackTrace(); - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_GET_TREE_FAIL.getText()); - } - } - /** - * 鑾峰彇鏂囨。鐩綍璇︽儏 - * @param request - * @return - */ - @RequestMapping(value = "/documentDirectoryInfo/{version}", method = RequestMethod.POST) - @ApiVersion(1) - public String documentDirectoryInfo(HttpServletRequest request) { - try { - //鑾峰彇鍙傛暟 - FieldSetEntity fse = null; - Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); - if (bean != null) { - RequestParameterEntity reqp = (RequestParameterEntity) bean; - fse = reqp.getFormData(); - } - //鍒ゆ柇鍙傛暟鏄惁涓虹┖ - if (fse == null) { - SpringMVCContextHolder - .getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), DocumentCode.DOCUMENT_FORM_NODATA.getText()); - } - String uuid = fse.getString(CmnConst.UUID);//琛╱uid - //瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - int type; - if(currentUser.getUserType() == 2){ - type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; - }else { - type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; - } - //鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� - if(!permissionService.validDataPermission(CmnConst.product_oa_DIRECTORY,uuid,type)) { - SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); - } - return OK_List(documentDirectoryService.documentDirectoryInfo(fse)); - } catch (BaseException e) { - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(e); - }catch (Exception e) { - e.printStackTrace(); - SpringMVCContextHolder.getSystemLogger().error(e); - return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(), DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText()); - } - } + /** + * 鑾峰彇鏂囨。鐩綍璇︽儏 + * + * @param request + * @return + */ + @RequestMapping(value = "/documentDirectoryInfo/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String documentDirectoryInfo(HttpServletRequest request) { + try { + // 鑾峰彇鍙傛暟 + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + // 鍒ゆ柇鍙傛暟鏄惁涓虹┖ + if (fse == null) { + SpringMVCContextHolder.getSystemLogger().error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + return this.error(DocumentCode.DOCUMENT_FORM_NODATA.getValue(), + DocumentCode.DOCUMENT_FORM_NODATA.getText()); + } + String uuid = fse.getString(CmnConst.UUID);// 琛╱uid + // 瓒呯骇绠$悊鍛樹负1 鏅�氬崟浣嶇鐞嗗憳2 + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + int type; + if (currentUser.getUserType() == 2) { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_ORG; + } else { + type = CoreConst.DATA_PERMISSION_VALID_TYPE_USER; + } + // 鏁版嵁鎿嶄綔鐨勬潈闄愰獙璇� + if (!permissionService.validDataPermission(CmnConst.PRODUCT_OA_DIRECTORY, uuid, type)) { + SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), + SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText()); + } + return OK_List(documentDirectoryService.documentDirectoryInfo(fse)); + } catch (BaseException e) { + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + SpringMVCContextHolder.getSystemLogger().error(e); + return this.error(DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getValue(), + DocumentCode.DOCUMENT_CATALOG_GET_FAIL.getText()); + } + } } -- Gitblit v1.9.2