Commit 2c49c07b by guojx

Merge branch 'feature-2023-01-目标配置' into 'developer'

Feature 2023 01 目标配置

See merge request !878
parents 3f5cf00a a0c3f3e8
package com.gic.haoban.manage.web.exception; package com.gic.haoban.manage.web.exception;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.ShowFrontMessageException; import com.gic.haoban.base.api.common.ShowFrontMessageException;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.controller.WebBaseController; import com.gic.haoban.manage.web.controller.WebBaseController;
...@@ -52,6 +53,25 @@ public class GlobalExceptionHandler extends WebBaseController { ...@@ -52,6 +53,25 @@ public class GlobalExceptionHandler extends WebBaseController {
return res; return res;
} }
@ResponseBody
@ExceptionHandler(RuntimeException.class)
public RestResponse controllerRunExceptionForRest(HttpServletResponse response, RuntimeException ex) {
logger.error("controllerRunException:{}", ex.getMessage(), ex);
RestResponse res = new RestResponse();
res.setCode(String.valueOf(HaoBanErrCode.ERR_3.getCode()));
String message = ex.getMessage();
if (message != null && message.indexOf(ShowFrontMessageException.class.getName()) > -1) {
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
message = (matcher.group(2));
}
} else {
message = HaoBanErrCode.ERR_3.getMsg();
}
res.setMessage(message);
return res;
}
/** /**
* 全局异常 * 全局异常
*/ */
......
...@@ -119,7 +119,7 @@ public class DataTargetHttpUtils { ...@@ -119,7 +119,7 @@ public class DataTargetHttpUtils {
Config config = ConfigService.getConfig("COMMON.data-api-config"); Config config = ConfigService.getConfig("COMMON.data-api-config");
String value = config.getProperty(apolloKey, ""); String value = config.getProperty(apolloKey, "");
if (StringUtils.isBlank(value)) { if (StringUtils.isBlank(value)) {
throw new RuntimeException("配置有误!"); throw new RuntimeException("数据接口配置有误!");
} }
LOGGER.info("{}:Apollo查询的配置信息:{}", apolloKey, value); LOGGER.info("{}:Apollo查询的配置信息:{}", apolloKey, value);
String[] split = value.split("\\+\\+\\+\\+"); String[] split = value.split("\\+\\+\\+\\+");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment