死锁问题
This commit is contained in:
parent
cbdf804c9c
commit
e00d6f413e
@ -53,6 +53,8 @@ import java.util.*;
|
||||
@Service
|
||||
public class AccountRechargeServiceImpl extends DefaultBaseService implements IAccountRechargeService {
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
@Autowired
|
||||
private IAccountRechargeDao accountRechargeDao;
|
||||
|
||||
@ -277,6 +279,8 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
||||
|
||||
@Override
|
||||
public AccountRechargePayDTO saveAccount(String thirdParty, AccountRechargeVO accountRechargeVO) {
|
||||
AccountRechargePayDTO payDTO = new AccountRechargePayDTO();
|
||||
synchronized (lock) {
|
||||
String userId = StringUtils.isEmpty(accountRechargeVO.getUserId()) ? userUtil.getUserId(null) : accountRechargeVO.getUserId();
|
||||
// 查看该用户今日的记录, 超过50条不能再创建
|
||||
Integer count = accountRechargeDao.getTodayByAccountId(userId);
|
||||
@ -291,7 +295,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
||||
/* if (totalMoney < 10 || totalMoney > 200000) { // 最大2000块,最小1毛
|
||||
throw new SaveException("金额输入错误");
|
||||
}*/
|
||||
AccountRechargePayDTO payDTO = new AccountRechargePayDTO();
|
||||
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(accountRechargeVO);
|
||||
if ("微信".equals(thirdParty)) {
|
||||
|
||||
@ -335,6 +339,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
||||
params.put("gmtModified", currentDate);
|
||||
params.put("isDelete", 0);
|
||||
accountRechargeDao.save(params);
|
||||
}
|
||||
return payDTO;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user