| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.RequestSeqUtil; |
| | | import com.stylefeng.guns.modular.account.service.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.huifu.biz.DouGongWithdrawBiz; |
| | | import com.stylefeng.guns.modular.huifu.biz.FenZhangUtil; |
| | | import com.stylefeng.guns.modular.system.dao.UserInfoMapper; |
| | | import com.stylefeng.guns.modular.system.dao.WithdrawalMapper; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.model.Withdrawal; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.ISysWithdrawalPoundageService; |
| | |
| | | |
| | | @Autowired |
| | | private ISysWithdrawalPoundageService sysWithdrawalPoundageService; |
| | | @Autowired |
| | | private DouGongWithdrawBiz douGongWithdrawBiz; |
| | | @Autowired |
| | | private UserWithdrawalService userWithdrawalService; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public void taskDayFenzhang() throws Exception { |
| | | List<Withdrawal> withdrawals = selectList(new EntityWrapper<Withdrawal>().eq("userType", 2).eq("state", 1).isNotNull("reqSeqId")); |
| | | if (CollUtil.isNotEmpty(withdrawals)) { |
| | | for (Withdrawal withdrawal : withdrawals) { |
| | | Map<String, Object> map = null; |
| | | try { |
| | | map = FenZhangUtil.queryFenzhang(withdrawal.getReqSeqId(), DateUtil.format(withdrawal.getInsertTime(), "yyyyMMdd")); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | Driver driver = driverService.selectById(withdrawal.getUserId()); |
| | | if (Objects.nonNull(driver)) { |
| | | UserWithdrawal userWithdrawal = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", driver.getPhone()).eq("type", 1).last("limit 1")); |
| | | System.out.println("分账定时查询:" + map.toString()); |
| | | if ("00000000".equals(map.get("resp_code")) && "S".equals(map.get("trans_stat").toString())) { |
| | | String txReqSeqId = RequestSeqUtil.generate("TX"); |
| | | withdrawal.setReqSeqId(txReqSeqId); |
| | | Map<String, Object> tx = douGongWithdrawBiz.encashment(txReqSeqId, BigDecimal.valueOf(withdrawal.getMoney()), |
| | | userWithdrawal.getHuifuId(), userWithdrawal.getTokenNo(), 2); |
| | | withdrawal.setHfSeqId(tx.get("huifu_id").toString()); |
| | | if ("00000000".equals(tx.get("resp_code")) && "S".equals(tx.get("trans_stat"))) { |
| | | withdrawal.setState(2); |
| | | this.updateById(withdrawal); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |