package com.stylefeng.guns.modular.account.service.impl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
import com.stylefeng.guns.modular.account.dao.UserWithdrawalMapper;
|
import com.stylefeng.guns.modular.account.service.UserWithdrawalService;
|
import com.stylefeng.guns.modular.system.model.UserWithdrawal;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Service;
|
|
@Slf4j
|
@Service
|
public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalMapper, UserWithdrawal> implements UserWithdrawalService {
|
|
@Override
|
public Boolean withdrawDeposit(Integer amount, String bankAcctNo, String withdrawPassword) {
|
// 查询当前操作电子用户
|
/*UserWithdrawal userWithdrawal = this.selectOne(new EntityWrapper<UserWithdrawal>()
|
.eq("userId", Objects.requireNonNull(ShiroKit.getUser()).getId())
|
.eq("userType", 2)
|
.last("LIMIT 1"));
|
|
// 先从平台进行分账到用户电子账簿
|
// 查询平台账户
|
Company company = companyService.selectOne(new EntityWrapper<Company>()
|
.eq("type", 1));
|
// 查询平台开户信息
|
ElectronicLedger electronicLedger = electronicLedgerService.selectOne(new EntityWrapper<ElectronicLedger>()
|
.eq("userId", company.getId())
|
.eq("userType", 3)
|
.last("LIMIT 1"));
|
try {
|
// 进行平台分账到司机电子账簿
|
log.info("平台分账到司机电子账簿=========");
|
AllocationReq allocationReq = this.createAllocationReq(userWithdrawal.getBalanceAcctId(), electronicLedger.getBalanceAcctId(), amount,withdrawPassword);
|
AllocationResp allocationResp = AllocationExample.create(allocationReq);
|
log.info("平台分账到司机电子账簿完成=========:{}",allocationResp);
|
|
// 用户电子账簿进行提现操作
|
WithdrawalResp withdrawalResp = WithdrawalExample.create(this.createWithdrawalReq(userWithdrawal.getBalanceAcctId(), amount, withdrawPassword, bankAcctNo));
|
log.info("司机电子账簿提现完成=========:{}",withdrawalResp);
|
return true;
|
}catch (Exception e){
|
log.info("司机提现失败=========:{}",e.getMessage());
|
e.printStackTrace();
|
return false;
|
}*/
|
return null;
|
}
|
}
|