|
@@ -45,10 +45,13 @@ public class UserAccountProfitServiceImpl extends ServiceImpl<UserAccountProfitM
|
|
QueryWrapper<UserAccountProfit> profitQUery = new QueryWrapper<>();
|
|
QueryWrapper<UserAccountProfit> profitQUery = new QueryWrapper<>();
|
|
profitQUery.eq("unionid", unionId);
|
|
profitQUery.eq("unionid", unionId);
|
|
List<UserAccountProfit> profitList = userAccountProfitMapper.selectList(profitQUery);
|
|
List<UserAccountProfit> profitList = userAccountProfitMapper.selectList(profitQUery);
|
|
- if (profitList == null || profitList.size() == 0)
|
|
|
|
- return prepareCashOutRes;
|
|
|
|
- prepareCashOutRes.setCurrentAmount(profitList.get(0).getCurrentAmount());
|
|
|
|
- prepareCashOutRes.setAccountProfitId(profitList.get(0).getId());
|
|
|
|
|
|
+ if (profitList == null || profitList.size() == 0){
|
|
|
|
+ prepareCashOutRes.setCurrentAmount(0);
|
|
|
|
+ prepareCashOutRes.setAccountProfitId(0);
|
|
|
|
+ }else {
|
|
|
|
+ prepareCashOutRes.setCurrentAmount(profitList.get(0).getCurrentAmount());
|
|
|
|
+ prepareCashOutRes.setAccountProfitId(profitList.get(0).getId());
|
|
|
|
+ }
|
|
List<UserAccountBank> bankList = userAccountBankMapper.getListByUser(unionId);
|
|
List<UserAccountBank> bankList = userAccountBankMapper.getListByUser(unionId);
|
|
prepareCashOutRes.setBankList(bankList);
|
|
prepareCashOutRes.setBankList(bankList);
|
|
if (bankList != null && bankList.size() > 0)
|
|
if (bankList != null && bankList.size() > 0)
|
|
@@ -63,12 +66,12 @@ public class UserAccountProfitServiceImpl extends ServiceImpl<UserAccountProfitM
|
|
UserAccountProfit accountProfit = userAccountProfitMapper.selectById(cashOutReq.getAccountProfitId());
|
|
UserAccountProfit accountProfit = userAccountProfitMapper.selectById(cashOutReq.getAccountProfitId());
|
|
if (accountProfit == null)
|
|
if (accountProfit == null)
|
|
return ResultData.getFailResult("未找到用户账户");
|
|
return ResultData.getFailResult("未找到用户账户");
|
|
- if (!cashOutReq.getUnionid().equals(accountProfit.getUnifiedId()))
|
|
|
|
|
|
+ if (!cashOutReq.getUnionid().equals(accountProfit.getUnionid()))
|
|
return ResultData.getFailResult("用户账户与提交信息不匹配");
|
|
return ResultData.getFailResult("用户账户与提交信息不匹配");
|
|
if (!cashOutReq.getCashOutAmount().equals(accountProfit.getCurrentAmount()))
|
|
if (!cashOutReq.getCashOutAmount().equals(accountProfit.getCurrentAmount()))
|
|
return ResultData.getFailResult("提现金额与账户剩余金额不匹配");
|
|
return ResultData.getFailResult("提现金额与账户剩余金额不匹配");
|
|
QueryWrapper<UserAccountBank> bankQuery = new QueryWrapper<>();
|
|
QueryWrapper<UserAccountBank> bankQuery = new QueryWrapper<>();
|
|
- bankQuery.eq("delete",false);
|
|
|
|
|
|
+ bankQuery.eq("is_delete",false);
|
|
bankQuery.eq("id",cashOutReq.getDefaultBank().getId());
|
|
bankQuery.eq("id",cashOutReq.getDefaultBank().getId());
|
|
List<UserAccountBank> bankList=userAccountBankMapper.selectList(bankQuery);
|
|
List<UserAccountBank> bankList=userAccountBankMapper.selectList(bankQuery);
|
|
if(bankList==null||bankList.size()==0)
|
|
if(bankList==null||bankList.size()==0)
|
|
@@ -80,6 +83,7 @@ public class UserAccountProfitServiceImpl extends ServiceImpl<UserAccountProfitM
|
|
throw new RuntimeException("账户扣款失败");
|
|
throw new RuntimeException("账户扣款失败");
|
|
CashOutRecord cashOutRecord=new CashOutRecord(accountProfit.getUserId(),cashOutReq.getCashOutAmount(),(short)1,bank.getAccountId(),bank.getSubbranchName()
|
|
CashOutRecord cashOutRecord=new CashOutRecord(accountProfit.getUserId(),cashOutReq.getCashOutAmount(),(short)1,bank.getAccountId(),bank.getSubbranchName()
|
|
,bank.getAccountArea(),bank.getAccountName(),bank.getBankName(),accountProfit.getUnionid(),accountProfit.getUserPhone(),accountProfit.getUnifiedId(),accountProfit.getPraiseId());
|
|
,bank.getAccountArea(),bank.getAccountName(),bank.getBankName(),accountProfit.getUnionid(),accountProfit.getUserPhone(),accountProfit.getUnifiedId(),accountProfit.getPraiseId());
|
|
|
|
+ cashOutRecord.setCreateTime(actionTime);
|
|
count=cashOutRecordMapper.addItem(cashOutRecord);
|
|
count=cashOutRecordMapper.addItem(cashOutRecord);
|
|
if(count<1 || cashOutRecord.getId()==null || cashOutRecord.getId()==0)
|
|
if(count<1 || cashOutRecord.getId()==null || cashOutRecord.getId()==0)
|
|
throw new RuntimeException("生成提现记录失败");
|
|
throw new RuntimeException("生成提现记录失败");
|