From 1a9b7154ccdbb30cd3f575749d02cbe32204c139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Mon, 17 Jun 2024 15:50:33 +0800 Subject: [PATCH] =?UTF-8?q?optimize:=20=E4=BC=98=E5=8C=96=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/core/exception/BaseGlobalExceptionHandle.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nflg_project_dev/nflg-boot-base/nflg-boot-core/src/main/java/com/nflg/product/base/core/exception/BaseGlobalExceptionHandle.java b/nflg_project_dev/nflg-boot-base/nflg-boot-core/src/main/java/com/nflg/product/base/core/exception/BaseGlobalExceptionHandle.java index 6e43b547..838f590e 100644 --- a/nflg_project_dev/nflg-boot-base/nflg-boot-core/src/main/java/com/nflg/product/base/core/exception/BaseGlobalExceptionHandle.java +++ b/nflg_project_dev/nflg-boot-base/nflg-boot-core/src/main/java/com/nflg/product/base/core/exception/BaseGlobalExceptionHandle.java @@ -1,5 +1,6 @@ package com.nflg.product.base.core.exception; +import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; @@ -51,7 +52,7 @@ public class BaseGlobalExceptionHandle { public ResultVO handleDuplicateKeyException(DuplicateKeyException e) { log.error(e.getMessage(), e); //return ResultVO.error("已存在该记录,请勿重复操作"); - return ResultVO.error("已存在该记录,请勿重复操作"); + return ResultVO.error("数据库存在重复数据"); } @@ -59,8 +60,11 @@ public class BaseGlobalExceptionHandle { @ResponseBody public ResultVO handleException(Exception e) { log.error(e.getMessage(), e); - //return ResultVO.error("操作失败,请联系系统管理员"); - return ResultVO.error("操作失败,请联系系统管理员"); + if (StrUtil.isNotBlank(e.getMessage()) && e.getMessage().contains("Deadlock")) { + return ResultVO.error("操作失败,请重试"); + } else { + return ResultVO.error("操作失败,请联系系统管理员"); + } } /**