From df4733091b30b0434a04dacd0e844663114d4cfe Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期三, 09 七月 2025 17:51:56 +0800 Subject: [PATCH] 修改支付宝支付和bug修改 --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 100 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 88 insertions(+), 12 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 e753e6e..dc89dab 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 @@ -25,8 +25,10 @@ import com.dsh.communityWorldCup.model.*; import com.dsh.communityWorldCup.service.*; import com.dsh.communityWorldCup.util.*; +import com.dsh.communityWorldCup.util.wx.WxV3PayConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.math.BigDecimal; @@ -181,19 +183,22 @@ worldCup.setMatchNumber(worldCup.getMatchNumber() + 1); this.updateById(worldCup); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("gameType", 1); + jsonObject.put("ids", ids); //2、调起开启游戏的接口。 HashMap<String, String> map = new HashMap<>(); map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); map.put("space_id", tGame.getSiteId() + ""); map.put("red_sutu_id", tGame.getRed()); map.put("blue_sutu_id", tGame.getBlue()); - map.put("api_url", "http://221.182.45.100:56666/communityWorldCup/base/worldCup/endWorldCupCallback"); - map.put("custom", JSON.toJSONString(ids)); + map.put("api_url", "https://online.daowepark.com:443/communityWorldCup/base/worldCup/endWorldCupCallback"); + map.put("custom", jsonObject.toJSONString()); - String s = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/quickStart", map); - JSONObject jsonObject = JSONObject.parseObject(s); - Integer code1 = jsonObject.getInteger("code"); - String message = jsonObject.getString("message"); + String s = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/quickStart", map); + JSONObject jsonObject1 = JSONObject.parseObject(s); + Integer code1 = jsonObject1.getInteger("code"); + String message = jsonObject1.getString("message"); if (200 == code1) { return ResultUtil.success(); } else { @@ -508,6 +513,8 @@ return payment; } + private String smid = "2088330203191220";//平台支付宝商户号 + /** * 支付逻辑 @@ -536,17 +543,57 @@ worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); - return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), - worldCup.getCash().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); + List<WorldCupStore> list = worldCupStoreService.lambdaQuery().eq(WorldCupStore::getWorldCupId, worldCup.getId()).list(); + if (list.isEmpty()){ + return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), + worldCupPayment.getAmount().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); + }else{ + Integer storeId = list.get(0).getStoreId(); + Store store = storeClient.queryStoreById(storeId); + if (store.getOperatorId()==null||store.getOperatorId()==0){ + // 平台 + return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), + worldCupPayment.getAmount().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); + }else{ + String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); + System.err.println("微信商户号"+s2); + if(!StringUtils.hasLength(s2)){ + return ResultUtil.error("运营商未配置微信商户号,获取支付失败!"); + } + return payMoneyUtil.weixinpayV3(s2,"社区世界杯报名",worldCupPayment.getCode() + ,"/base/worldCup/wxPayWorldCupCallback1",worldCupPayment.getAmount().toString()); + } + } + + + } //支付宝 if(payType == 2){ + String smidRes = smid;// 结算资金到商户号 + worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); - return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), - worldCup.getCash().toString(), "/base/worldCup/aliPayWorldCupCallback"); - } + List<WorldCupStore> list = worldCupStoreService.lambdaQuery().eq(WorldCupStore::getWorldCupId, worldCup.getId()).list(); + + if (list.isEmpty()){ + }else{ + Integer storeId = list.get(0).getStoreId(); + Store store = storeClient.queryStoreById(storeId); + if (store.getOperatorId()==null||store.getOperatorId()==0){ + }else{ + String s2 = storeClient.getmerchantNumberAliByOperatorId(store.getOperatorId()); + System.err.println("支付宝商户号"+s2); + if(!StringUtils.hasLength(s2)){ + return ResultUtil.error("运营商未配置支付宝商户号,获取支付失败!"); + } + smidRes=s2; + } + } + return payMoneyUtil.alipay(smidRes, "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), + worldCupPayment.getAmount().toString(), "/base/worldCup/aliPayWorldCupCallback"); + } //玩湃币 if(payType == 3){ AppUser appUser = appUserClient.getAppUser(paymentWorldCup.getUid()); @@ -709,7 +756,7 @@ * @return */ @Override - public ResultUtil paymentWorldCupCallback(String code, String outTradeNo) { + public ResultUtil paymentWorldCupCallback(String code, String outTradeNo) throws AlipayApiException { WorldCupPayment worldCupPayment = worldCupPaymentService.getOne(new QueryWrapper<WorldCupPayment>().eq("code", code)); Integer worldCupId = worldCupPayment.getWorldCupId(); worldCupPayment.setPayStatus(2); @@ -737,6 +784,35 @@ worldCupPaymentParticipant.setCreateTime(new Date()); worldCupPaymentParticipantService.save(worldCupPaymentParticipant); } + if (worldCupPayment.getPayType()==2){ + List<WorldCupStore> list = worldCupStoreService.lambdaQuery().eq(WorldCupStore::getWorldCupId, worldCupPayment.getWorldCupId()).list(); + String resSmid = smid; + if (!list.isEmpty()){ + Integer storeId = list.get(0).getStoreId(); + Store store = storeClient.queryStoreById(storeId); + if (store.getOperatorId()==null||store.getOperatorId()==0){ + }else{ + String s2 = storeClient.getmerchantNumberAliByOperatorId(store.getOperatorId()); + System.err.println("支付宝商户号"+s2); + if(!StringUtils.hasLength(s2)){ + return ResultUtil.error("运营商未配置支付宝商户号,获取支付失败!"); + } + resSmid=s2; + } + } + String finalResSmid = resSmid; + new Thread(new Runnable() { + @Override + public void run() { + try { + Thread.sleep(30000); + payMoneyUtil.confirm(finalResSmid, code, outTradeNo, worldCupPayment.getAmount().toString()); + }catch (Exception e){ + } + } + }).start(); + } + return ResultUtil.success(); } -- Gitblit v1.7.1