| | |
| | | @RequestMapping("/api/directory") |
| | | @RestController |
| | | public class DocumentDirectoryController extends AbstractBaseController { |
| | | |
| | | |
| | | @Autowired |
| | | DocumentDirectoryService documentDirectoryService; |
| | | |
| | |
| | | */ |
| | | @Autowired |
| | | PermissionService permissionService; |
| | | |
| | | |
| | | /** |
| | | * 新增文件夹数据 |
| | | * |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增文件夹数据 |
| | | * |
| | | * 文档目录保存 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/addDocumentDirectory/{version}", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/save-directory/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String addDocumentDirectory(HttpServletRequest request) { |
| | | public String saveDocumentDireactory(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()); |
| | | } |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | IDocumentDirectoryService service = (IDocumentDirectoryService) getProxyInstance(documentDirectoryService); |
| | | return OK_Add(service.addDocumentDirectory(fse)); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | 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);// 表uuid |
| | | // 超级管理员为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)) { |
| | | if(service.saveDocumentDireactory(fse)) { |
| | | return OK(); |
| | | } |
| | | return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), |
| | | return error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), |
| | | DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); |
| | | } catch (BaseException e) { |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), |
| | | return error(DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getValue(), |
| | | DocumentCode.DOCUMENT_CATALOG_SAVE_FAIL.getText()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 个人文件夹重命名 |
| | | * |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 删除文件夹 |
| | | * |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 文件目录列表展示 |
| | | * |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取文档目录树形列表 |
| | | * |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取文档目录详情 |
| | | * |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |