From 5dc40fcd64b0513150f1d8335ab849e6d8cdc28e Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 04 七月 2025 19:42:49 +0800 Subject: [PATCH] 支付版本更新 根据资金流向使用V2或V3服务商版本支付 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/WeiXinV3Controller.java | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-) diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/WeiXinV3Controller.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/WeiXinV3Controller.java index 772b83a..979fe4f 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/WeiXinV3Controller.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/WeiXinV3Controller.java @@ -14,19 +14,17 @@ import com.dsh.activity.service.*; import com.dsh.activity.util.*; //import com.dsh.activity.util.wx.WechatPaymentService; -import com.dsh.activity.util.wx.WxAppPayService; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; +import java.security.PrivateKey; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; @@ -42,10 +40,12 @@ @RequestMapping("/base") public class WeiXinV3Controller { -// @Resource + // @Resource // private WechatPaymentService wechatPaymentService; +// @Autowired +// private WxAppPayService wxAppPayService; @Autowired - private WxAppPayService wxAppPayService; + private PayMoneyUtil payMoneyUtil; @ResponseBody @PostMapping("/testWeiXinV3") @ApiOperation(value = "获取添加人员、选择人员说明文案") @@ -56,12 +56,9 @@ // Map<String, Object> stringObjectMap = wechatPaymentService.weChatDoUnifiedOrder(); // ... 在你的下单方法中调用 ... try { - String description = "商品描述"; - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); - String outTradeNo =sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); - BigDecimal amount = new BigDecimal("0.01"); // 支付金额,例如1分钱 - Map<String, String> payParams = wxAppPayService.createOrder(description, outTradeNo, amount); - return ResultUtil.success(payParams); + ResultUtil resultUtil = payMoneyUtil.weixinpayV3("1720719391","购买玩湃惠民卡","15645654askjak13", + "/base/huimin/callBack/weixinPayHuiminCallback1","99"); + return resultUtil; // 将 payParams 返回给你的APP前端,前端使用这些参数调起微信支付SDK // return ResponseEntity.ok(payParams); // 示例 @@ -72,5 +69,13 @@ } return ResultUtil.success(); } - -} +// @PostMapping("/test-private-key") +// public String testPrivateKey() { +// try { +// PrivateKey privateKey = WXPaySignatureCertificateUtil.getPrivateKey(); +// return "私钥加载成功: " + privateKey.getAlgorithm(); +// } catch (Exception e) { +// return "私钥加载失败: " + e.getMessage(); +// } +// } +} \ No newline at end of file -- Gitblit v1.7.1