| | |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.VipPayment; |
| | | import com.dsh.account.enums.RechargeRecordEnum; |
| | | import com.dsh.account.feignclient.communityWorldCup.WorldCupPaymentClinet; |
| | | import com.dsh.account.feignclient.communityWorldCup.model.GetWorldCupPayment; |
| | | import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; |
| | | import com.dsh.account.feignclient.competition.model.PaymentCompetition; |
| | | import com.dsh.account.feignclient.course.CoursePaymentClient; |
| | |
| | | import com.dsh.account.mapper.RechargeRecordsMapper; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.model.IncomeQuery; |
| | | import com.dsh.account.model.WorldCupPayment; |
| | | import com.dsh.account.model.query.RechargeRecordsQuery; |
| | | import com.dsh.account.model.vo.RechargeRecordsVO; |
| | | import com.dsh.account.model.vo.userBenefitDetail.RechargeDetailsVo; |
| | |
| | | |
| | | @Resource |
| | | private RechargeConfigClient reconMapper; |
| | | @Autowired |
| | | @Resource |
| | | private RechargeRecordsMapper rechargeRecordsMapper; |
| | | |
| | | @Resource |
| | | private WorldCupPaymentClinet worldCupPaymentClinet; |
| | | |
| | | |
| | | @Override |
| | |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | |
| | | //世界杯 |
| | | GetWorldCupPayment getWorldCupPayment = new GetWorldCupPayment(); |
| | | getWorldCupPayment.setAppUserId(appUserId); |
| | | getWorldCupPayment.setPayType("3"); |
| | | getWorldCupPayment.setStartTime(monthStart); |
| | | getWorldCupPayment.setEndTime(monthEnd); |
| | | List<WorldCupPayment> worldCupPayment = worldCupPaymentClinet.getWorldCupPayment(getWorldCupPayment); |
| | | for (WorldCupPayment cupPayment : worldCupPayment) { |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | if(cupPayment.getPayStatus() != 3){ |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getPayTime())); |
| | | consumeDetail.setConsumeAmount("-" + cupPayment.getAmount()); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | }else{ |
| | | consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getPayTime())); |
| | | consumeDetail.setConsumeAmount("-" + cupPayment.getAmount()); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | |
| | | consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_WORLD_CIP_PAYMENT.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getRefundTime())); |
| | | consumeDetail.setConsumeAmount("+" + cupPayment.getRefundAmount()); |
| | | consumeDetail.setRecordId(1); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (ToolUtil.isNotEmpty(recordId)) { |
| | | details = details.stream() |
| | | .filter(record -> record.getRecordId().equals(recordId)) |
| | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | private String smid = "2088330203191220";//平台支付宝商户号 |
| | | private ResultUtil AlipayPayment(String code, BigDecimal amount) { |
| | | ResultUtil alipay = payMoneyUtil.alipay("玩湃币充值", "玩湃币充值", "", code, amount.toString(), |
| | | ResultUtil alipay = payMoneyUtil.alipay(smid,"玩湃币充值", "玩湃币充值", "", code, amount.toString(), |
| | | "/base/recharge/alipayRechargeCallback"); |
| | | if (alipay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Thread.sleep(wait); |
| | | |
| | | RechargeRecords records = rereMapper.selectOne(new QueryWrapper<RechargeRecords>() |
| | | .eq("code", code)); |
| | | if (records.getPayStatus() == 2) { |
| | | break; |
| | | } |
| | | AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code); |
| | | |
| | | if (resultUtil.getCode().equals("10000") && records.getPayStatus() == 1) { |
| | | /** |
| | | * WAIT_BUYER_PAY(交易创建,等待买家付款)、 |
| | | * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、 |
| | | * TRADE_SUCCESS(交易支付成功)、 |
| | | * TRADE_FINISHED(交易结束,不可退款) |
| | | */ |
| | | // Map<String, String> data1 = resultUtil.getData(); |
| | | // String s = data1.get("tradeStatus"); |
| | | // String tradeNo = data1.get("tradeNo"); |
| | | |
| | | String tradeNo = resultUtil.getTradeNo(); |
| | | String tradeStatus = resultUtil.getTradeStatus(); |
| | | System.out.println("ssssss" + tradeStatus); |
| | | if ("TRADE_CLOSED".equals(tradeStatus) || "TRADE_FINISHED".equals(tradeStatus) || num == 10) { |
| | | records.setState(3); |
| | | rereMapper.deleteById(records.getId()); |
| | | break; |
| | | } |
| | | if ("TRADE_SUCCESS".equals(tradeStatus)) { |
| | | records.setAppUserId(null); |
| | | records.setPayStatus(2); |
| | | records.setPayTime(new Date()); |
| | | records.setOrderNumber(tradeNo); |
| | | rereMapper.updateById(records); |
| | | |
| | | RechargeRecords rechargeRecords = rereMapper.selectOne(new QueryWrapper<RechargeRecords>() |
| | | .eq("code", code)); |
| | | if (rechargeRecords.getPayStatus() == 2) { |
| | | TAppUser tAppUser = tappMapper.selectById(rechargeRecords.getAppUserId()); |
| | | tAppUser.setPlayPaiCoins(null == tAppUser.getPlayPaiCoins() ? rechargeRecords.getPlayPaiCoins() : tAppUser.getPlayPaiCoins() + rechargeRecords.getPlayPaiCoins()); |
| | | tappMapper.updateById(tAppUser); |
| | | break; |
| | | } |
| | | |
| | | |
| | | break; |
| | | } |
| | | if ("WAIT_BUYER_PAY".equals(tradeStatus)) { |
| | | num++; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return alipay; |
| | | } |
| | | |
| | | private ResultUtil WeChatPayment(String code, BigDecimal amount) throws Exception { |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("玩湃币充值", "", code, amount.toString(), |
| | | "/base/recharge/wechatRechargeCallback", "APP", ""); |
| | | if (weixinpay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Thread.sleep(wait); |
| | | RechargeRecords records = rereMapper.selectOne(new QueryWrapper<RechargeRecords>() |
| | | .eq("code", code)); |
| | | if (records.getPayStatus() == 2) { |
| | | break; |
| | | } |
| | | ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(code, ""); |
| | | if (resultUtil.getCode() == 200 && records.getPayStatus() == 1) { |
| | | /** |
| | | * SUCCESS—支付成功, |
| | | * REFUND—转入退款, |
| | | * NOTPAY—未支付, |
| | | * CLOSED—已关闭, |
| | | * REVOKED—已撤销(刷卡支付), |
| | | * USERPAYING--用户支付中, |
| | | * PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | */ |
| | | Map<String, String> data1 = resultUtil.getData(); |
| | | String s = data1.get("trade_state"); |
| | | String transaction_id = data1.get("transaction_id"); |
| | | if ("REFUND".equals(s) || "NOTPAY".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) { |
| | | records.setState(3); |
| | | rereMapper.deleteById(records.getId()); |
| | | break; |
| | | } |
| | | if ("SUCCESS".equals(s)) { |
| | | records.setPayStatus(2); |
| | | records.setOrderNumber(transaction_id); |
| | | rereMapper.updateById(records); |
| | | break; |
| | | } |
| | | if ("USERPAYING".equals(s)) { |
| | | num++; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return weixinpay; |
| | | |
| | | } |
| | |
| | | public ResultUtil addRechargeCallbackPay(String code, String orderNumber) { |
| | | RechargeRecords rechargeRecords = this.baseMapper.selectOne(new QueryWrapper<RechargeRecords>() |
| | | .eq("code", code)); |
| | | if (rechargeRecords.getPayStatus() == 2) { |
| | | if (null == rechargeRecords || rechargeRecords.getPayStatus() == 2) { |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | TAppUser tAppUser = tappMapper.selectById(rechargeRecords.getAppUserId()); |
| | | tAppUser.setPlayPaiCoins(null == tAppUser.getPlayPaiCoins() ? rechargeRecords.getPlayPaiCoins() : tAppUser.getPlayPaiCoins() + rechargeRecords.getPlayPaiCoins()); |
| | | tappMapper.updateById(tAppUser); |
| | | |
| | | rechargeRecords.setAppUserId(null); |
| | | rechargeRecords.setPayStatus(2); |
| | | rechargeRecords.setPayTime(new Date()); |
| | | rechargeRecords.setOrderNumber(orderNumber); |
| | | this.baseMapper.updateById(rechargeRecords); |
| | | |
| | | TAppUser tAppUser = tappMapper.selectById(rechargeRecords.getAppUserId()); |
| | | tAppUser.setPlayPaiCoins(null == tAppUser.getPlayPaiCoins() ? rechargeRecords.getPlayPaiCoins() : tAppUser.getPlayPaiCoins() + rechargeRecords.getPlayPaiCoins()); |
| | | tappMapper.updateById(tAppUser); |
| | | return null; |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |