From 2c13a6f34253ee595eedac139ab2c4b05a26bbc2 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 11 一月 2022 12:18:02 +0800
Subject: [PATCH] 优化代码
---
service-api/src/main/java/com/java110/api/controller/app/AppController.java | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/service-api/src/main/java/com/java110/api/controller/app/AppController.java b/service-api/src/main/java/com/java110/api/controller/app/AppController.java
index bca4b7b..62b40f8 100644
--- a/service-api/src/main/java/com/java110/api/controller/app/AppController.java
+++ b/service-api/src/main/java/com/java110/api/controller/app/AppController.java
@@ -22,6 +22,7 @@
import com.java110.core.base.controller.BaseController;
import com.java110.core.context.IPageData;
import com.java110.utils.constant.CommonConstant;
+import com.java110.vo.ResultVo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@@ -92,7 +93,7 @@
responseEntity = apiSMOImpl.doApi(postInfo, headers,request);
} catch (Throwable e) {
logger.error("璇锋眰post 鏂规硶[" + service + "]澶辫触锛�" + postInfo, e);
- responseEntity = new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ responseEntity = ResultVo.error("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
}
logger.debug("api锛歿} 杩斿洖淇℃伅涓猴細{}", service, responseEntity);
@@ -125,7 +126,7 @@
} catch (Throwable e) {
logger.error("璇锋眰get 鏂规硶[" + service + "]澶辫触锛�", e);
- responseEntity = new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ responseEntity = ResultVo.error("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
}
logger.debug("api锛歿} 杩斿洖淇℃伅涓猴細{}", service, responseEntity);
@@ -161,7 +162,7 @@
//responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers);
} catch (Throwable e) {
logger.error("璇锋眰get 鏂规硶[" + action + "]澶辫触锛�", e);
- responseEntity = new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ responseEntity = ResultVo.error("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
}
logger.debug("api锛歿} 杩斿洖淇℃伅涓猴細{}", action, responseEntity);
@@ -199,7 +200,7 @@
//responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers);
} catch (Throwable e) {
logger.error("璇锋眰post 鏂规硶[" + action + "]澶辫触锛�" + postInfo, e);
- responseEntity = new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ responseEntity = ResultVo.error("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
}
logger.debug("api锛歿} 杩斿洖淇℃伅涓猴細{}", action, responseEntity);
@@ -234,7 +235,7 @@
//responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers);
} catch (Throwable e) {
logger.error("璇锋眰put 鏂规硶[" + service + "]澶辫触锛�", e);
- responseEntity = new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ responseEntity = ResultVo.error("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
}
logger.debug("api锛歿} 杩斿洖淇℃伅涓猴細{}", service, responseEntity);
return responseEntity;
@@ -266,7 +267,7 @@
//responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers);
} catch (Throwable e) {
logger.error("璇锋眰delete 鏂规硶[" + service + "]澶辫触锛�", e);
- responseEntity = new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ responseEntity = ResultVo.error("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
}
logger.debug("api锛歿} 杩斿洖淇℃伅涓猴細{}", service, responseEntity);
--
Gitblit v1.8.0