文件名从 src/main/java/com/product/file/controller/DocumentConstoller.java 修改 |
| | |
| | | */ |
| | | @RequestMapping("/api/document") |
| | | @RestController |
| | | public class DocumentConstoller extends AbstractBaseController { |
| | | public class DocumentController extends AbstractBaseController { |
| | | @Autowired |
| | | public DocumentService documentService; |
| | | |
| | |
| | | public String addDocument(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); |
| | | IDocumentService service = (IDocumentService) getProxyInstance(documentService); |
| | | String uuids = service.addDocument(fse); |
| | | return OK_Add(uuids); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 鏂囨。鏀惰棌 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/collection/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String documentCollection(HttpServletRequest request) { |
| | | try { |
| | | //鑾峰彇鍙傛暟 |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_OA_DOCUMENT_COLLECTION); |
| | | return OK_Add(documentService.documentCollection(fse)); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | return this.error(e); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return this.error(DocumentCode.DOCUMENT_COLLECTION_FAIL.getValue(), DocumentCode.DOCUMENT_COLLECTION_FAIL.getText() + e.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | | * 鏂囨。鍙栨秷鏀惰棌 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/cancel-collection/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String documentCancelCollection(HttpServletRequest request) { |
| | | try { |
| | | //鑾峰彇鍙傛暟 |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_OA_DOCUMENT_COLLECTION); |
| | | if (documentService.documentCancelCollection(fse.getString("document_uuid"))) { |
| | | return OK(); |
| | | } |
| | | return error(DocumentCode.DOCUMENT_CANCEL_COLLECTION_FAIL.getValue(), DocumentCode.DOCUMENT_CANCEL_COLLECTION_FAIL.getText()); |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | return this.error(e); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return this.error(DocumentCode.DOCUMENT_OPERATE_FAIL.getValue(), DocumentCode.DOCUMENT_OPERATE_FAIL.getText() + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getApplyDocument/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |