|
|
@@ -150,7 +150,7 @@ public class GlobalExceptionHandler {
|
|
|
String errorMessage = null;
|
|
|
FieldError fieldError = ex.getBindingResult().getFieldError();
|
|
|
if (fieldError == null) {
|
|
|
- // 组合校验,参考自 https://t.zsxq.com/3HVTx
|
|
|
+
|
|
|
List<ObjectError> allErrors = ex.getBindingResult().getAllErrors();
|
|
|
if (CollUtil.isNotEmpty(allErrors)) {
|
|
|
errorMessage = allErrors.get(0).getDefaultMessage();
|
|
|
@@ -279,11 +279,7 @@ public class GlobalExceptionHandler {
|
|
|
return CommonResult.error(FORBIDDEN);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 处理 Guava UncheckedExecutionException
|
|
|
- *
|
|
|
- * 例如说,缓存加载报错,可见 <a href="https://t.zsxq.com/UszdH">https://t.zsxq.com/UszdH</a>
|
|
|
- */
|
|
|
+
|
|
|
@ExceptionHandler(value = UncheckedExecutionException.class)
|
|
|
public CommonResult<?> uncheckedExecutionExceptionHandler(HttpServletRequest req, UncheckedExecutionException ex) {
|
|
|
return allExceptionHandler(req, ex.getCause());
|
|
|
@@ -387,65 +383,7 @@ public class GlobalExceptionHandler {
|
|
|
* @param ex 异常
|
|
|
* @return 如果是 Table 不存在的异常,则返回对应的 CommonResult
|
|
|
*/
|
|
|
- private CommonResult<?> handleTableNotExists(Throwable ex) {
|
|
|
- String message = ExceptionUtil.getRootCauseMessage(ex);
|
|
|
- if (!message.contains("doesn't exist")) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- // 1. 数据报表
|
|
|
- if (message.contains("report_")) {
|
|
|
- log.error("[报表模块 xdz-module-report - 表结构未导入][参考 https://cloud.xdz.cn/report/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[报表模块 xdz-module-report - 表结构未导入][参考 https://cloud.xdz.cn/report/ 开启]");
|
|
|
- }
|
|
|
- // 2. 工作流
|
|
|
- if (message.contains("bpm_")) {
|
|
|
- log.error("[工作流模块 xdz-module-bpm - 表结构未导入][参考 https://cloud.xdz.cn/bpm/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[工作流模块 xdz-module-bpm - 表结构未导入][参考 https://cloud.xdz.cn/bpm/ 开启]");
|
|
|
- }
|
|
|
- // 3. 微信公众号
|
|
|
- if (message.contains("mp_")) {
|
|
|
- log.error("[微信公众号 xdz-module-mp - 表结构未导入][参考 https://cloud.xdz.cn/mp/build/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[微信公众号 xdz-module-mp - 表结构未导入][参考 https://cloud.xdz.cn/mp/build/ 开启]");
|
|
|
- }
|
|
|
- // 4. 商城系统
|
|
|
- if (StrUtil.containsAny(message, "product_", "promotion_", "trade_")) {
|
|
|
- log.error("[商城系统 xdz-module-mall - 已禁用][参考 https://cloud.xdz.cn/mall/build/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[商城系统 xdz-module-mall - 已禁用][参考 https://cloud.xdz.cn/mall/build/ 开启]");
|
|
|
- }
|
|
|
- // 5. ERP 系统
|
|
|
- if (message.contains("erp_")) {
|
|
|
- log.error("[ERP 系统 xdz-module-erp - 表结构未导入][参考 https://cloud.xdz.cn/erp/build/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[ERP 系统 xdz-module-erp - 表结构未导入][参考 https://cloud.xdz.cn/erp/build/ 开启]");
|
|
|
- }
|
|
|
- // 6. CRM 系统
|
|
|
- if (message.contains("crm_")) {
|
|
|
- log.error("[CRM 系统 xdz-module-crm - 表结构未导入][参考 https://cloud.xdz.cn/crm/build/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[CRM 系统 xdz-module-crm - 表结构未导入][参考 https://cloud.xdz.cn/crm/build/ 开启]");
|
|
|
- }
|
|
|
- // 7. 支付平台
|
|
|
- if (message.contains("pay_")) {
|
|
|
- log.error("[支付模块 xdz-module-pay - 表结构未导入][参考 https://cloud.xdz.cn/pay/build/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[支付模块 xdz-module-pay - 表结构未导入][参考 https://cloud.xdz.cn/pay/build/ 开启]");
|
|
|
- }
|
|
|
- // 8. AI 大模型
|
|
|
- if (message.contains("ai_")) {
|
|
|
- log.error("[AI 大模型 xdz-module-ai - 表结构未导入][参考 https://cloud.xdz.cn/ai/build/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[AI 大模型 xdz-module-ai - 表结构未导入][参考 https://cloud.xdz.cn/ai/build/ 开启]");
|
|
|
- }
|
|
|
- // 9. IoT 物联网
|
|
|
- if (message.contains("iot_")) {
|
|
|
- log.error("[IoT 物联网 xdz-module-iot - 表结构未导入][参考 https://doc.xdz.cn/iot/build/ 开启]");
|
|
|
- return CommonResult.error(NOT_IMPLEMENTED.getCode(),
|
|
|
- "[IoT 物联网 xdz-module-iot - 表结构未导入][参考 https://doc.xdz.cn/iot/build/ 开启]");
|
|
|
- }
|
|
|
+ private CommonResult<?> handleTableNotExists(Throwable ex) {
|
|
|
return null;
|
|
|
}
|
|
|
|