From 5aa087c457b531700c2dced0cd76738a6aa23b05 Mon Sep 17 00:00:00 2001 From: gaowdong Date: Tue, 3 Jun 2025 16:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/AccWalletInfoBusiness.java | 2 +- .../service/impl/AccTradeServiceImpl.java | 24 ++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java index a86f1e6..3028b0a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java @@ -171,7 +171,7 @@ public class AccWalletInfoBusiness { this.accTradeService.updateAccTrade(accountTrade); } log.error("修改钱包失败", ex); - throw new ServiceException("修改钱包失败"); + throw new ServiceException(ex.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java index 3c61d2f..e1db273 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java @@ -14,6 +14,8 @@ import com.bonus.canteen.core.account.service.IAccTradeService; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.houqin.utils.SM4EncryptUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,6 +32,8 @@ import java.util.List; */ @Service public class AccTradeServiceImpl implements IAccTradeService { + private static final Logger log = LoggerFactory.getLogger(AccTradeServiceImpl.class); + @Autowired private AccTradeMapper accTradeMapper; @@ -69,9 +73,14 @@ public class AccTradeServiceImpl implements IAccTradeService { @Override @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) public int insertAccTrade(AccountTrade accountTrade) { - accountTrade.setCreateTime(DateUtils.getNowDate()); - accountTrade.setUpdateTime(DateUtils.getNowDate()); - return accTradeMapper.insertAccTrade(accountTrade); + try { + accountTrade.setCreateTime(DateUtils.getNowDate()); + accountTrade.setUpdateTime(DateUtils.getNowDate()); + return accTradeMapper.insertAccTrade(accountTrade); + } catch (Exception e) { + log.error("insertAccTrade 异常:", e); + throw new ServiceException("系统异常"); + } } @Override @@ -82,7 +91,8 @@ public class AccTradeServiceImpl implements IAccTradeService { BeanUtils.copyProperties(accTradeVo, accountTrade); return accTradeMapper.insertAccTrade(accountTrade); } catch (Exception e) { - throw new ServiceException("错误信息描述" + e.getMessage()); + log.error("insertAccTradeVo 异常:", e); + throw new ServiceException("系统异常"); } } @@ -99,7 +109,8 @@ public class AccTradeServiceImpl implements IAccTradeService { try { return accTradeMapper.updateAccTrade(accountTrade); } catch (Exception e) { - throw new ServiceException("错误信息描述" + e.getMessage()); + log.error("updateAccTrade 异常:", e); + throw new ServiceException("系统异常"); } } @@ -109,7 +120,8 @@ public class AccTradeServiceImpl implements IAccTradeService { try { return accTradeMapper.updateAccTradeVoByOrderNo(accTradeVo); } catch (Exception e) { - throw new ServiceException("错误信息描述" + e.getMessage()); + log.error("updateAccTradeVoByOrderNo 异常:", e); + throw new ServiceException("系统异常"); } }