From f694f6ac8336866061a0caf8ff6b149a3d1f4a4b Mon Sep 17 00:00:00 2001
From: 杜洪波 <1074825718@qq.com>
Date: 星期二, 27 八月 2024 17:19:23 +0800
Subject: [PATCH] 代码提交

---
 src/main/java/com/product/file/controller/DocumentDirectoryController.java |   82 ++++-------------------------------------
 1 files changed, 8 insertions(+), 74 deletions(-)

diff --git a/src/main/java/com/product/file/controller/DocumentDirectoryController.java b/src/main/java/com/product/file/controller/DocumentDirectoryController.java
index 32ed83a..0537848 100644
--- a/src/main/java/com/product/file/controller/DocumentDirectoryController.java
+++ b/src/main/java/com/product/file/controller/DocumentDirectoryController.java
@@ -69,89 +69,23 @@
 					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) {
-			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)) {
+			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);
@@ -159,7 +93,7 @@
 		} 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());
 		}
 	}

--
Gitblit v1.9.2