增减钱包余额保护
This commit is contained in:
parent
96b57d76ae
commit
5d1ca83851
|
|
@ -52,6 +52,8 @@ public class AccWalletInfoBusiness {
|
||||||
IAccTradeService accTradeService;
|
IAccTradeService accTradeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
IAccTradeWalletDetailService accTradeWalletDetailService;
|
IAccTradeWalletDetailService accTradeWalletDetailService;
|
||||||
|
|
||||||
|
//此方法不可以直接调用,须通过service中的方法调用
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void addAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
public void addAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
||||||
log.info("新增钱包入参: {}", JacksonUtil.writeValueAsString(walletUpdateDTO));
|
log.info("新增钱包入参: {}", JacksonUtil.writeValueAsString(walletUpdateDTO));
|
||||||
|
|
@ -70,6 +72,7 @@ public class AccWalletInfoBusiness {
|
||||||
log.info("新增钱包结束");
|
log.info("新增钱包结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//此方法不可以直接调用,须通过service中的方法调用
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void clearAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
public void clearAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
||||||
log.info("扣减钱包入参: {}", JacksonUtil.writeValueAsString(walletUpdateDTO));
|
log.info("扣减钱包入参: {}", JacksonUtil.writeValueAsString(walletUpdateDTO));
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,9 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
@Override
|
@Override
|
||||||
public void addAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
public void addAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
||||||
if(!walletUpdateDTO.isBatch()) {
|
if(!walletUpdateDTO.isBatch()) {
|
||||||
|
if(Objects.isNull(walletUpdateDTO.getUserId())) {
|
||||||
|
throw new ServiceException("用户编号不能为空");
|
||||||
|
}
|
||||||
AccRedisUtils.lockUpdateAccWalletBalance(walletUpdateDTO.getUserId());
|
AccRedisUtils.lockUpdateAccWalletBalance(walletUpdateDTO.getUserId());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
@ -197,6 +200,9 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
@Override
|
@Override
|
||||||
public void clearAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
public void clearAccWalletBalance(WalletUpdateDTO walletUpdateDTO) {
|
||||||
if(!walletUpdateDTO.isBatch()) {
|
if(!walletUpdateDTO.isBatch()) {
|
||||||
|
if(Objects.isNull(walletUpdateDTO.getUserId())) {
|
||||||
|
throw new ServiceException("用户编号不能为空");
|
||||||
|
}
|
||||||
AccRedisUtils.lockUpdateAccWalletBalance(walletUpdateDTO.getUserId());
|
AccRedisUtils.lockUpdateAccWalletBalance(walletUpdateDTO.getUserId());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue