From 89610234a2bdc56f60e0998045892ef2672edccc Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期五, 19 四月 2024 14:18:31 +0800
Subject: [PATCH] 最新版本

---
 server/openapi/src/main/java/com/doumee/api/web/BizResourceController.java |  177 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 158 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 172f38c..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,14 +1,20 @@
 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;
+import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.erp.model.openapi.request.*;
 import com.doumee.core.erp.model.openapi.response.*;
 import com.doumee.core.utils.Constants;
-import com.doumee.service.business.ERPSyncService;
+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;
@@ -17,6 +23,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -40,6 +47,9 @@
     @Autowired
     private SystemDictDataBiz systemDictDataBiz;
 
+    @Autowired
+    private VisitsService visitsService;
+
 
     @ApiOperation(value = "璋冪敤鍑嵁鑾峰彇鎺ュ彛", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝鍚慐RP鎻愪緵缁熸帴鍙h皟鐢ㄥ嚟璇�")
     @GetMapping("/accesstoken")
@@ -48,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
@@ -59,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({
@@ -69,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({
@@ -79,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({
@@ -89,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({
@@ -99,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({
@@ -109,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({
@@ -120,30 +201,57 @@
     })
     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({
             @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鎺堟潈token鍊�", required = true)
     })
     public ApiResponse parkCarAuthor(@RequestBody CarAuthorRequest param) {
-        erpSyncService.parkCarAuthor(param);
-        return  ApiResponse.success(null);
+        ApiResponse response = ApiResponse.success(null);
+        try {
+            erpSyncService.parkCarAuthor(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/park/carAuthor", JSONObject.toJSONString(response),Constants.ZERO);
+        return  response;
     }
 
+    @ErpLoginRequired
     @ApiOperation(value = "璁垮鐢宠瀹℃壒缁撴灉閫氱煡鎺ュ彛", notes = "璁垮绔彁渚涳紝渚涜瀹㈢璋冪敤锛屾彁浜よ瀹㈢敵璇峰鎵圭殑缁撴灉")
     @PostMapping("/event/approve/notice")
     @ApiImplicitParams({
@@ -151,13 +259,42 @@
     })
     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
+    @ApiOperation(value = "鍙戣捣璁垮鐢宠", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝ERP绔彂璧疯瀹㈢敵璇�")
+    @PostMapping("/resource/createVisit")
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "鎺堟潈token鍊�", required = true)
+    })
+    public ApiResponse  createVisit(@Valid @RequestBody ErpVisitDTO param) {
+        param.setToken(this.getToken());
+        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;
     }
 
 
-
-    @ApiOperation(value = "FTP璐︽埛淇℃伅", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝FTP璐︽埛淇℃伅")
+    @ApiOperation(value = "FTP璐︽埛淇℃伅", notes = "璁垮绔彁渚涳紝渚汦RP绔皟鐢紝FTP璐︽埛淇℃伅,鍏朵腑銆怓TP璧勬簮璁块棶鏄犲皠鍦板潃銆戠敤浜庡浘鐗囧洖鏄句娇鐢紝" +
+            "姣斿浜鸿劯鍥剧墖鍥炴樉鎷兼帴锛氥�怓TP璧勬簮璁块棶鏄犲皠鍦板潃銆�+銆怓TP鐢ㄦ埛鍥剧墖瀛樺偍鐩綍銆�+銆愬疄闄呬汉鑴稿浘鐗囧瓨鍌ㄥ瓧娈靛唴瀹广��" +
+            "濡傦細http://175.27.187.84/file4/member/20231211/skjd-skdjf4enc-flgk.png")
     @GetMapping("/resource/ftpAccount")
     public ApiResponse<Map<String,Object>> ftpAccount() {
         Map<String,Object> map = new HashMap<>();
@@ -177,6 +314,8 @@
         systemDictDataBiz.queryByCode(Constants.FTP,Constants.DEVICE_EVENT_IMG).getCode());
         map.put("FTP鐢ㄦ埛鍥剧墖瀛樺偍鐩綍",
         systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode());
+        map.put("FTP璧勬簮璁块棶鏄犲皠鍦板潃",
+        systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode());
         return  ApiResponse.success(map);
     }
 

--
Gitblit v1.9.3