| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | |
| | | @Service |
| | | public class TWithdrawalServiceImpl extends ServiceImpl<TWithdrawalMapper, TWithdrawal> implements ITWithdrawalService { |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Override |
| | | public void addWithdrawal(String receivePaymentName, String receivePaymentAccount, Integer withdrawalType, String openBank, BigDecimal withdrawalMoney, Integer uid) { |
| | | public ResultUtil addWithdrawal(String receivePaymentName, String receivePaymentAccount, Integer withdrawalType, String openBank, BigDecimal withdrawalMoney, Integer uid) { |
| | | |
| | | // 查询司机余额是否足够 |
| | | Driver driver = driverService.selectById(uid); |
| | | |
| | | if(withdrawalMoney.compareTo(BigDecimal.valueOf(driver.getBalance())) > 0){ |
| | | return ResultUtil.error("提现金额大于余额"); |
| | | } |
| | | |
| | | driver.setBalance(BigDecimal.valueOf(driver.getBalance()).subtract(withdrawalMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | |
| | | TWithdrawal tWithdrawal = new TWithdrawal(); |
| | | tWithdrawal.setDriverId(uid); |
| | | tWithdrawal.setReceivePaymentName(receivePaymentName); |
| | |
| | | tWithdrawal.setStatus(1); |
| | | tWithdrawal.setOpenBank(openBank); |
| | | this.insert(tWithdrawal); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public List<TWithdrawal> queryList(Page<TWithdrawal> page, Integer uid) { |
| | | return this.baseMapper.queryList(page,uid); |
| | | } |
| | | } |