钱包管理-抛异常 回滚交易

This commit is contained in:
gaowdong 2025-04-10 18:38:29 +08:00
parent 67c7bbc121
commit 77d34b8f04
1 changed files with 57 additions and 50 deletions

View File

@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
import com.bonus.canteen.core.account.mapper.AccWalletInfoMapper;
import com.bonus.canteen.core.account.domain.AccWalletInfo;
import com.bonus.canteen.core.account.service.IAccWalletInfoService;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -194,7 +195,9 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
// SecurityUtils.getUserId().toString(), DateUtils.toLocalDateTime(new Date()));
// }
@Transactional(rollbackFor = Exception.class)
public void acWalletBalanceOperation(WalletBalanceOperation operation) {
try{
switch (WalletBalanceOperationEnum.getEnum(operation.getOperationType())) {
case ADD_BAL:
addAccWalletInfo(operation);
@ -246,5 +249,9 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
accTradeWalletDetail.setTradeTime(DateUtils.getNowDate());
accTradeWalletDetail.setCreateBy(SecurityUtils.getUsername());
this.accTradeWalletDetailService.insertAccTradeWalletDetail(accTradeWalletDetail);
}catch (Exception ex) {
log.error("修改钱包失败", ex);
throw new ServiceException("修改钱包失败");
}
}
}