From 4e124926ee6ee682084466067ae37550fca475fa Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 05 八月 2025 11:39:48 +0800 Subject: [PATCH] 代码提交 世界杯修改支付宝资金结算功能 --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java index dc89dab..635b821 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java @@ -849,10 +849,13 @@ * @param id */ @Override - public void cancelWorldCupRefund(Integer id) { + public void cancelWorldCupRefund(Integer id) throws Exception { //免费除外 List<WorldCupPayment> list2 = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id) .ne("payType", 0).eq("payStatus", 2).eq("state", 1)); + List<WorldCupStore> list = worldCupStoreService.lambdaQuery().eq(WorldCupStore::getWorldCupId, id).list(); + Integer storeId = list.get(0).getStoreId(); + Store store = storeClient.queryStoreById(storeId); for (WorldCupPayment worldCupPayment : list2) { List<WorldCupPaymentParticipant> list1 = worldCupPaymentParticipantService.list(new QueryWrapper<WorldCupPaymentParticipant>() .eq("worldCupId", id).eq("worldCupPaymentId", worldCupPayment.getId()).eq("alreadyEntered", 0)); @@ -860,14 +863,25 @@ BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size())); //微信支付 if(worldCupPayment.getPayType() == 1){ - Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(), - worldCupPayment.getAmount().toString(), multiply.toString(), "/base/worldCup/wxRefundWorldCupCallback"); - if(!"SUCCESS".equals(map.get("return_code"))){ - System.err.println("-------------微信退款失败---------"); - System.err.println(map.get("return_msg")); - }else{ - worldCupPayment.setRefundAmount(multiply); - worldCupPaymentService.updateById(worldCupPayment); + if (store.getOperatorId()!=null && store.getOperatorId()!=0){ + String smidVx= storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); + if (!StringUtils.hasLength(smidVx)){ + System.err.println("运营商未配置微信商户号,获取支付失败!"); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String codeRefund = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5);// 退款单号 + // 运营商退款 + payMoneyUtil.weixinRefundV3(smidVx, codeRefund, worldCupPayment.getPayOrderNo(), worldCupPayment.getAmount().toString(), "/base/worldCup/wxRefundWorldCupCallback1"); + }else { + Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(), + worldCupPayment.getAmount().toString(), multiply.toString(), "/base/worldCup/wxRefundWorldCupCallback"); + if (!"SUCCESS".equals(map.get("return_code"))) { + System.err.println("-------------微信退款失败---------"); + System.err.println(map.get("return_msg")); + } else { + worldCupPayment.setRefundAmount(multiply); + worldCupPaymentService.updateById(worldCupPayment); + } } } //支付宝支付 -- Gitblit v1.7.1