From f49d12e6071858dbd6b4bd0c1adc1a101757f6c8 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期五, 19 四月 2024 14:20:32 +0800
Subject: [PATCH] 华晟版本
---
server/openapi/src/main/java/com/doumee/api/web/BizResourceController.java | 144 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 125 insertions(+), 19 deletions(-)
diff --git a/server/openapi/src/main/java/com/doumee/api/web/BizResourceController.java b/server/openapi/src/main/java/com/doumee/api/web/BizResourceController.java
index 217dc55..c077a10 100644
--- a/server/openapi/src/main/java/com/doumee/api/web/BizResourceController.java
+++ b/server/openapi/src/main/java/com/doumee/api/web/BizResourceController.java
@@ -1,5 +1,6 @@
package com.doumee.api.web;
+import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.config.annotation.ErpLoginRequired;
import com.doumee.core.constants.ResponseStatus;
@@ -13,6 +14,7 @@
import com.doumee.dao.web.reqeust.ErpVisitDTO;
import com.doumee.service.business.VisitsService;
import com.doumee.service.business.ext.ERPSyncService;
+import com.google.gson.JsonObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -56,7 +58,19 @@
@ApiImplicitParam(paramType = "query", dataType = "String", name = "accessSecret", value = "璁块棶绉橀挜锛岀敱璁垮绔彁渚�", required = true)
})
public ApiResponse<AccessTokenResponse> accesstoken(@RequestParam String accessKey, @RequestParam String accessSecret) {
- return ApiResponse.success(erpSyncService.createERPToken(accessKey,accessSecret));
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ response.setData(erpSyncService.createERPToken(accessKey,accessSecret));
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ Map<String,String> param = new HashMap<>();
+ param.put("accessKey",accessKey);
+ param.put("accessSecret",accessSecret);
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/accesstoken", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
@ErpLoginRequired
@@ -67,9 +81,19 @@
})
public ApiResponse<List<RoleListResponse>> roleList(@RequestBody RoleListRequest param) {
param.setToken(this.getToken());
- return ApiResponse.success(erpSyncService.erpQueryDeviceList(param));
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ response.setData(erpSyncService.erpQueryDeviceList(param));
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/resource/role/lis", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "鍋滆溅鍦哄叏閲忎俊鎭帴鍙�", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝ERP绔悓姝ュ叏閮ㄥ仠杞﹀満鏁版嵁")
@PostMapping("/resource/park/list")
@ApiImplicitParams({
@@ -77,9 +101,19 @@
})
public ApiResponse<List<ParkListResponse>> parkList(@RequestBody ParkListRequest param) {
param.setToken(this.getToken());
- return ApiResponse.success(erpSyncService.parkList(param));
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ response.setData(erpSyncService.parkList(param));
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/resource/role/list", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "璁垮鍑哄叆浜嬩欢鍚屾鎺ュ彛", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝ERP绔幏鍙栬瀹㈠嚭鍏ヨ褰曚俊鎭�")
@PostMapping("/resource/visit/list")
@ApiImplicitParams({
@@ -87,9 +121,19 @@
})
public ApiResponse<PageData<VisitEventListResponse>> visitList (@RequestBody PageWrap<VisitListRequest> pageWrap) {
pageWrap.getModel().setToken(this.getToken());
- return ApiResponse.success(erpSyncService.visitListPage(pageWrap));
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ response.setData(erpSyncService.visitListPage(pageWrap));
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(pageWrap,"/visitbiz/resource/visit/list", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "闂ㄧ鍑哄叆浜嬩欢鍚屾鎺ュ彛", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝ERP绔幏鍙栭棬绂佸嚭鍏ヨ褰曚俊鎭�")
@PostMapping("/resource/doorEvent/list")
@ApiImplicitParams({
@@ -97,9 +141,19 @@
})
public ApiResponse<PageData<DoorEventListResponse>> doorEventList (@RequestBody PageWrap<DoorEventListRequest> pageWrap) {
pageWrap.getModel().setToken(this.getToken());
- return ApiResponse.success(erpSyncService.doorEventListPage(pageWrap));
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ response.setData(erpSyncService.doorEventListPage(pageWrap));
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(pageWrap,"/visitbiz/resource/doorEvent/list", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "杞﹁締鍑哄叆浜嬩欢鍚屾鎺ュ彛", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝ERP绔幏鍙栬溅杈嗗嚭鍏ヨ褰曚俊鎭�")
@PostMapping("/resource/carvisit/list")
@ApiImplicitParams({
@@ -107,9 +161,19 @@
})
public ApiResponse<PageData<CarEventListResponse>> carEventList (@RequestBody PageWrap<CarEventListRequest> pageWrap) {
pageWrap.getModel().setToken(this.getToken());
- return ApiResponse.success(erpSyncService.carEventList(pageWrap));
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ response.setData(erpSyncService.carEventList(pageWrap));
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(pageWrap,"/visitbiz/resource/carvisit/list", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "缁勭粐鍙樺寲鎺ュ彛", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝瀹屾垚璁垮绔粍缁囦俊鎭悓姝ワ紝璇ユ帴鍙f敮鎸佸崟涓粍缁囨柊澧炪�佹洿鏂般�佸垹闄ら渶姹�")
@PostMapping("/event/org/update")
@ApiImplicitParams({
@@ -117,10 +181,19 @@
})
public ApiResponse orgUpdate(@RequestBody OrgUpdateRequest param) {
param.setToken(this.getToken());
- erpSyncService.orgUpdate(param);
- return ApiResponse.success(null);
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ erpSyncService.orgUpdate(param);
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/event/org/update", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "浜哄憳鍙樺寲鎺ュ彛", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝瀹屾垚璁垮绔汉鍛樹俊鎭悓姝ワ紝璇ユ帴鍙f敮鎸佸崟涓汉鍛樻柊澧炪�佹洿鏂般�佸垹闄ら渶姹�")
@PostMapping("/event/user/update")
@ApiImplicitParams({
@@ -128,20 +201,38 @@
})
public ApiResponse userUpdate(@RequestBody UserUpdateRequest param) {
param.setToken(this.getToken());
- erpSyncService.userUpdate(param);
- return ApiResponse.success(null);
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ erpSyncService.userUpdate(param);
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/event/user/update", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "浜哄憳闂ㄧ缁勬巿鏉冩帴鍙�", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝璁垮绔汉鍛樺悓姝ラ棬绂佺粍鎺堟潈淇℃伅锛岃鎺ュ彛鏀寔浜哄憳闂ㄧ缁勬巿鏉冩柊澧炪�佹洿鏂般�佹竻绌洪渶姹傘��")
@PostMapping("/event/role/userAuthor")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鎺堟潈token鍊�", required = true)
})
public ApiResponse roleUserAuthor(@RequestBody UserAuthorRequest param) {
- erpSyncService.roleUserAuthor(param);
- return ApiResponse.success(null);
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ erpSyncService.roleUserAuthor(param);
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/event/role/userAuthor", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "杞﹁締鎺堟潈鍋滆溅鍦烘帴鍙�", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝璁垮绔悓姝ヨ溅杈嗗鍋滆溅鍦虹殑浣跨敤鏉冮檺锛岃鎺ュ彛鏀寔杞﹁締缁戝畾銆佽В缁戝綊灞炰汉锛屾敮鎸佹柊澧炪�佹洿鏂般�佹竻绌鸿溅杈嗘巿鏉冧俊鎭�")
@PostMapping("/event/park/carAuthor")
@ApiImplicitParams({
@@ -156,12 +247,11 @@
}catch (Exception e){
response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
}
- //-----TODO-------璁版棩蹇�-------start-----
-
- //-----TODO-------璁版棩蹇�-------end-----
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/event/park/carAuthor", JSONObject.toJSONString(response),Constants.ZERO);
return response;
}
+ @ErpLoginRequired
@ApiOperation(value = "璁垮鐢宠瀹℃壒缁撴灉閫氱煡鎺ュ彛", notes = "璁垮绔彁渚涳紝渚涜瀹㈢璋冪敤锛屾彁浜よ瀹㈢敵璇峰鎵圭殑缁撴灉")
@PostMapping("/event/approve/notice")
@ApiImplicitParams({
@@ -169,8 +259,16 @@
})
public ApiResponse approveApply(@RequestBody ApproveNoticeRequest param) {
param.setToken(this.getToken());
- erpSyncService.approveApply(param);
- return ApiResponse.success(null);
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ erpSyncService.approveApply(param);
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/event/approve/notice", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
@ErpLoginRequired
@@ -181,8 +279,16 @@
})
public ApiResponse createVisit(@Valid @RequestBody ErpVisitDTO param) {
param.setToken(this.getToken());
- visitsService.createFKForErp(param);
- return ApiResponse.success("鎿嶄綔鎴愬姛");
+ ApiResponse response = ApiResponse.success(null);
+ try {
+ visitsService.createFKForErp(param);
+ }catch (BusinessException e){
+ response = ApiResponse.failed(e.getCode(), e.getMessage());
+ }catch (Exception e){
+ response = ApiResponse.failed(ResponseStatus.SERVER_ERROR.getCode(),ResponseStatus.SERVER_ERROR.getMessage());
+ }
+ erpSyncService.saveInterfaceLog(param,"/visitbiz/resource/createVisit", JSONObject.toJSONString(response),Constants.ZERO);
+ return response;
}
--
Gitblit v1.9.3