| | |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); |
| | | // 平台 |
| | | TCompany company1 = baseMapper.selectList(new EntityWrapper<TCompany>().eq("type", 1)).get(0); |
| | | TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalMapper.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", company1.getId())).get(0); |
| | | // TCompany company1 = baseMapper.selectList(new EntityWrapper<TCompany>().eq("type", 1)).get(0); |
| | | // TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalMapper.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", company1.getId())).get(0); |
| | | // 转出 电子账簿id |
| | | String balanceAcctId = enterpriseWithdrawal.getBalanceAcctId(); |
| | | String code = enterpriseWithdrawal.getTransactionAuthorizationCode(); |
| | | code = Base64Util.decode(code); |
| | | // String balanceAcctId = enterpriseWithdrawal.getBalanceAcctId(); |
| | | // String code = enterpriseWithdrawal.getTransactionAuthorizationCode(); |
| | | // code = Base64Util.decode(code); |
| | | |
| | | |
| | | // 获取分公司分账时间 |
| | |
| | | // 开始分账 |
| | | System.out.println("-----------分公司开始分账----------"); |
| | | // 获取当前收入电子账簿id |
| | | List<TEnterpriseWithdrawal> enterpriseWithdrawal1 = enterpriseWithdrawalMapper.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", company.getId())); |
| | | List<TEnterpriseWithdrawal> enterpriseWithdrawal1 = enterpriseWithdrawalMapper.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("type",1).eq("companyId", company.getId())); |
| | | if (enterpriseWithdrawal1.size() > 0) { |
| | | // 获取当前公司未分账的金额 |
| | | Double sum = state.stream().filter(e -> e.getUserType() == 1 && company.getId().equals(e.getObjectId())).mapToDouble(Income::getMoney).sum(); |
| | |
| | | } |
| | | // Double v = sum * 100; |
| | | // int money = v.intValue(); |
| | | // TEnterpriseWithdrawal enterpriseWithdrawal2 = enterpriseWithdrawal1.get(0); |
| | | TEnterpriseWithdrawal enterpriseWithdrawal2 = enterpriseWithdrawal1.get(0); |
| | | // String balanceAcctId1 = enterpriseWithdrawal2.getBalanceAcctId(); |
| | | // AllocationReq allocationReq = new AllocationReq(); |
| | | // allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | |
| | | String seq_date = simpleDateFormat.format(new Date()); |
| | | try { |
| | | // AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | Map<String, Object> fenzhang = FenZhangUtil.fenzhang(req_seq_id, seq_date, String.valueOf(sum), "1"); |
| | | Map<String, Object> fenzhang = FenZhangUtil.fenzhang(req_seq_id, seq_date, String.valueOf(sum), enterpriseWithdrawal2.getHuifuId()); |
| | | String resp_code = fenzhang.get("resp_code").toString(); |
| | | if(!"00000000".equals(resp_code)){ |
| | | continue; |
| | |
| | | } |
| | | |
| | | // 司机分账 |
| | | List<Integer> collect2 = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("applicationStatus", "succeeded")).stream().map(e -> e.getUserId()).collect(Collectors.toList()); |
| | | List<Integer> collect2 = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("type", 1)).stream().map(e -> e.getUserId()).collect(Collectors.toList()); |
| | | if (collect2.size() == 0) { |
| | | collect2.add(0); |
| | | } |
| | |
| | | List<TDriver> collect = tDrivers.stream().filter(e -> e.getCompanyId() == tDriverPayDay.getCompanyId()).collect(Collectors.toList()); |
| | | for (TDriver tDriver : collect) { |
| | | // 获取司机的电子账簿 |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("userType", 2).eq("userId", tDriver.getId()).eq("applicationStatus", "succeeded")); |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("type", 1).eq("phone", tDriver.getPhone())); |
| | | if (userWithdrawals.size() > 0) { |
| | | // 当前司机分账金额 |
| | | Double sum = state.stream().filter(e -> (e.getUserType() == 2 && tDriver.getId().equals(e.getObjectId()))).mapToDouble(Income::getMoney).sum(); |
| | |
| | | String req_seq_id = ToolUtil.getRandomString(32); |
| | | String seq_date = simpleDateFormat.format(new Date()); |
| | | |
| | | // UserWithdrawal userWithdrawal = userWithdrawals.get(0); |
| | | UserWithdrawal userWithdrawal = userWithdrawals.get(0); |
| | | // String balanceAcctId1 = userWithdrawal.getBalanceAcctId(); |
| | | // AllocationReq allocationReq = new AllocationReq(); |
| | | // allocationReq.setOutOrderNo(); |
| | |
| | | // allocationReq.setOrderAmount(1l); |
| | | // allocationReq.setPassword(code); |
| | | try { |
| | | Map<String, Object> fenzhang = FenZhangUtil.fenzhang(req_seq_id, seq_date, String.valueOf(sum), "1"); |
| | | Map<String, Object> fenzhang = FenZhangUtil.fenzhang(req_seq_id, seq_date, String.valueOf(sum), userWithdrawal.getHuiFuId()); |
| | | // AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | System.out.println(tDriver.getId() + "::" + tDriver.getName() + "-----分账状态" + fenzhang.toString() + "--------------"); |
| | | String resp_code = fenzhang.get("resp_code").toString(); |