|
@@ -41,22 +41,28 @@ public class TTxRecordServiceImpl extends ServiceImpl<TTxRecordMapper, TTxRecord
|
|
|
|
|
|
@Resource
|
|
|
private TJsService jsService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public TTxRecord applicationCash(TTxRecord record) {
|
|
|
- if(StringUtils.isBlank(record.getcOpenId())){
|
|
|
+ if (StringUtils.isBlank(record.getcOpenId())) {
|
|
|
throw new ServiceException("OpenID不能为空");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(record.getOpeningBank())){
|
|
|
+ if (StringUtils.isBlank(record.getOpeningBank())) {
|
|
|
throw new ServiceException("开户行不能为空");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(record.getBankAccount())){
|
|
|
+ if (StringUtils.isBlank(record.getBankAccount())) {
|
|
|
throw new ServiceException("银行账号不能为空");
|
|
|
}
|
|
|
- if(null == record.getdPrice() || record.getdPrice().compareTo(BigDecimal.ZERO) <= 0){
|
|
|
- throw new ServiceException("体现金额不能为空");
|
|
|
+
|
|
|
+ TWxUser user = wxUserService.getByOpenId(record.getcOpenId());
|
|
|
+ if (null == record.getdPrice() || record.getdPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+ throw new ServiceException("提现金额不能为空");
|
|
|
}
|
|
|
|
|
|
+ if (record.getdPrice().compareTo(user.getdBalance()) > 0) {
|
|
|
+ throw new ServiceException("提现金额不能大于钱包余额");
|
|
|
+ }
|
|
|
LambdaQueryWrapper<TJs> mhCompanyLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
mhCompanyLambdaQueryWrapper.eq(TJs::getcOpenId, record.getcOpenId());
|
|
|
TJs js = jsService.getOne(mhCompanyLambdaQueryWrapper);
|