use of com.heepy.model.UserAccount in project finacialpotal by f117-sercet.
the class UserAccountServiceImpl method lockAccount.
@Transactional(rollbackFor = Exception.class)
@Override
public boolean lockAccount(String userCode, String lockAmt) {
UserAccount userAccount = this.getByUserCode(userCode);
String amount = userAccount.getAmount();
if (Double.parseDouble(amount) < Double.parseDouble(lockAmt)) {
return false;
}
amount = BigDemicalUtil.subtract(amount, lockAmt);
String freezeAmount = BigDemicalUtil.add(userAccount.getFreezeAmount(), lockAmt);
userAccount.setAmount(amount);
userAccount.setFreezeAmount(freezeAmount);
this.updateById(userAccount);
return true;
}
use of com.heepy.model.UserAccount in project finacialpotal by f117-sercet.
the class UserAccountServiceImpl method transferAccounts.
@Override
@Transactional(rollbackFor = Exception.class)
public boolean transferAccounts(String userCode, String unLockAmt) {
UserAccount userAccount = this.getByUserCode(userCode);
String amount = userAccount.getAmount();
amount = BigDemicalUtil.add(amount, unLockAmt);
userAccount.setAmount(amount);
this.updateById(userAccount);
return false;
}
use of com.heepy.model.UserAccount in project finacialpotal by f117-sercet.
the class UserAccountServiceImpl method withdraw.
@Transactional(rollbackFor = Exception.class)
@Override
public void withdraw(Map<String, Object> paramMap) {
String bindCode = (String) paramMap.get("bindCode");
String fetchAmt = (String) paramMap.get("fetchAmt");
UserAccount userAccount = userAccountMapper.selectOne(new QueryWrapper<UserAccount>().eq("user_code", bindCode));
String amount = BigDemicalUtil.subtract(userAccount.getAmount(), fetchAmt);
userAccount.setAmount(amount);
userAccountMapper.updateById(userAccount);
}
use of com.heepy.model.UserAccount in project finacialpotal by f117-sercet.
the class UserAccountServiceImpl method recharge.
@Transactional(rollbackFor = Exception.class)
@Override
public void recharge(Map<String, Object> paramMap) {
String bindCode = (String) paramMap.get("bindCode");
String chargeAmt = (String) paramMap.get("chargeAmt");
UserAccount userAccount = userAccountMapper.selectOne(new QueryWrapper<UserAccount>().eq("user_code", bindCode));
if (null == userAccount) {
userAccount = new UserAccount();
userAccount.setUserCode(bindCode);
userAccount.setFreezeAmount("0");
userAccountMapper.insert(userAccount);
} else {
String amount = BigDemicalUtil.add(userAccount.getAmount(), chargeAmt);
userAccount.setAmount(amount);
userAccountMapper.updateById(userAccount);
}
}
use of com.heepy.model.UserAccount in project finacialpotal by f117-sercet.
the class UserAccountServiceImpl method unLockAccount.
@Transactional(rollbackFor = Exception.class)
@Override
public boolean unLockAccount(String userCode, String unLockAmt) {
UserAccount userAccount = this.getByUserCode(userCode);
String freezeAmount = userAccount.getFreezeAmount();
if (Double.parseDouble(freezeAmount) < Double.parseDouble(unLockAmt)) {
return false;
}
freezeAmount = BigDemicalUtil.subtract(userAccount.getFreezeAmount(), unLockAmt);
userAccount.setFreezeAmount(freezeAmount);
this.updateById(userAccount);
return true;
}
Aggregations