mitao
2025-11-24 473a109a404797bc154834b0dfe87331a27aa7a8
ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TDriverController.java
@@ -14,6 +14,7 @@
import com.stylefeng.guns.core.util.WoUtil;
import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample;
import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq;
import com.stylefeng.guns.modular.huifu.biz.FenZhangUtil;
import com.stylefeng.guns.modular.system.controller.util.Base64Util;
import com.stylefeng.guns.modular.system.dao.DriverPunishMapper;
import com.stylefeng.guns.modular.system.dao.DriverTrainMapper;
@@ -2073,7 +2074,7 @@
    @Autowired
    private IUserWithdrawalService userWithdrawalService;
    public String createAllocationReq(Integer companyId,Integer userId,int type,double money){
    public String createAllocationReq(Integer companyId,Integer userId,int type,double money) throws Exception {
        List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId));
        TDriver tUser = tDriverService.selectById(userId);
        List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone()));
@@ -2081,33 +2082,41 @@
            return "error";
        }
        AllocationReq allocationReq= new AllocationReq();
        allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
        //AllocationReq allocationReq= new AllocationReq();
        //allocationReq.setOutOrderNo(ToolUtil.getRandomString(32));
        Map<String, Object> result;
        if(type==1){
            allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
            allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
            allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode()));
            //allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
            //allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
            //
            //allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode()));
            result = FenZhangUtil.fenzhang(RequestSeqUtil.generate("TK"), DateUtil.formatDate(new Date(), "yyyyMMdd"), String.valueOf(money), userWithdrawals.get(0).getHuiFuId());
        }else {
            allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
            allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
            allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode()));
            //allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId());
            //allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId());
            //allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode()));
            result = FenZhangUtil.payFromUser(RequestSeqUtil.generate("TK"), DateUtil.formatDate(new Date(), "yyyyMMdd"), String.valueOf(money), userWithdrawals.get(0).getHuiFuId());
        }
        money=money*100;
        allocationReq.setAmount((int)money);
        allocationReq.setProductName("分账");
        allocationReq.setProductCount(1);
        allocationReq.setOrderNo(ToolUtil.getRandomString(32));
        allocationReq.setOrderAmount(1l);
        try {
            AllocationResp allocationResp = AllocationExample.create(allocationReq);
            System.out.println(allocationResp);
        if ("00000000".equals(result.get("respCode").toString())) {
            return "ok";
        } catch (UpyztException e) {
            e.printStackTrace();
            return e.getMessage();
        } else {
            return result.get("respDesc").toString();
        }
        //money=money*100;
        //allocationReq.setAmount((int)money);
        //allocationReq.setProductName("分账");
        //allocationReq.setProductCount(1);
        //allocationReq.setOrderNo(ToolUtil.getRandomString(32));
        //allocationReq.setOrderAmount(1l);
        //try {
        //    AllocationResp allocationResp = AllocationExample.create(allocationReq);
        //    System.out.println(allocationResp);
        //    return "ok";
        //} catch (UpyztException e) {
        //    e.printStackTrace();
        //    return e.getMessage();
        //}
    }
}