puzhibing
2023-07-25 c91d30ae503c1a37c60a2fc83f610e032d56a26c
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/WithdrawalServiceImpl.java
@@ -8,6 +8,10 @@
import com.stylefeng.guns.modular.system.service.IUserInfoService;
import com.stylefeng.guns.modular.system.service.IWithdrawalService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.util.Tingg.TinggPayoutUtil;
import com.stylefeng.guns.modular.system.util.Tingg.model.AuthStatus;
import com.stylefeng.guns.modular.system.util.Tingg.model.PayoutResponse;
import com.stylefeng.guns.modular.system.util.Tingg.model.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
@@ -29,8 +33,8 @@
    @Autowired
    private IUserInfoService userInfoService;
  /*  @Autowired
    private ICBCPayUtil icbcPayUtil;*/
    @Autowired
    private TinggPayoutUtil tinggPayoutUtil;
    private Map<String, Timer> timerMap = new HashMap<>();
@@ -40,13 +44,11 @@
    /**
     * 提现操作
     * @param money
     * @param code
     * @param name
     * @param uid
     * @throws Exception
     */
    @Override
    public ResultUtil withdrawal(Double money, String code, String name, Integer uid, Integer language) throws Exception {
    public ResultUtil withdrawal(Double money, Integer uid, String remark, Integer language) throws Exception {
        language = userInfoService.queryLanguage(uid, language);
        if(money.compareTo(0D) <= 0){
            return ResultUtil.error(language == 1 ? "提现金额必须大于0" : language == 2 ? "Withdrawal amount must be greater than 0" : "Le montant du retrait doit être supérieur à 0");
@@ -61,17 +63,16 @@
        Withdrawal withdrawal = new Withdrawal();
        withdrawal.setBalance(userInfo.getBalance());
        withdrawal.setCode(code);
        withdrawal.setCode(userInfo.getPhone());// TODO: 2023/7/5 第三方支支持手机号提现
        withdrawal.setBankName(userInfo.getPhoneOperator());
        withdrawal.setFlag(1);
        withdrawal.setInsertTime(new Date());
        withdrawal.setRemark(remark);
        withdrawal.setMoney(money);
        withdrawal.setName(name);
        withdrawal.setName(userInfo.getFirstName() + " " + userInfo.getLastName());
        withdrawal.setState(1);
        withdrawal.setUserId(uid);
        withdrawal.setUserType(1);
        /*ResultUtil<String> transfer = icbcPayUtil.transfer(Double.valueOf(withdrawal.getMoney() * 100).longValue(), withdrawal.getCode(), withdrawal.getName());
        withdrawal.setSerialNo(transfer.getData());*/
        this.insert(withdrawal);
        double v = new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
@@ -92,10 +93,10 @@
    @Override
    public List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception {
        pageNum = (pageNum - 1) * size;
        String name = language == 1 ? "银行卡提现" : language == 2 ? "Bank card withdrawal" : "Retrait par carte bancaire";
        String name = language == 1 ? "手机号:" : language == 2 ? "Phone number:" : "Numéro de portable:";
        List<Map<String, Object>> list = withdrawalMapper.queryWithdrawal(uid, 1, pageNum, size);
        for (Map<String, Object> map : list) {
            map.put("name", name);
            map.put("name", name + map.get("code"));
        }
        return list;
    }