package com.gxwebsoft.common.system.controller; import cn.hutool.core.util.StrUtil; import com.gxwebsoft.common.core.config.ConfigProperties; import com.gxwebsoft.common.core.utils.RedisUtil; import com.gxwebsoft.common.core.utils.RequestUtil; import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.system.entity.Payment; import com.wechat.pay.java.core.notification.NotificationConfig; import com.wechat.pay.java.core.notification.NotificationParser; import com.wechat.pay.java.core.notification.RSANotificationConfig; import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Map; /** * 会员特权购买记录表控制器 * * @author 科技小王子 * @since 2023-06-20 18:07:50 */ @Api(tags = "余额支付结果通知(未完成)") @RestController @RequestMapping("/api/system/balance-pay") public class NotifyByBalancePayController extends BaseController { @Value("${spring.profiles.active}") String active; @Resource private RedisUtil redisUtil; @Resource private RequestUtil requestUtil; @Resource private ConfigProperties conf; @ApiModelProperty("异步通知") @PostMapping("/notify/{tenantId}") public String wxNotify(@RequestHeader Map header, @RequestBody String body, @PathVariable("tenantId") Integer tenantId) { System.out.println("异步通知*************** = "); // 以支付通知回调为例,验签、解密并转换成 Transaction try { // 推送微信官方支付结果(携带租户ID的POST请求) // requestUtil.pushBalancePayNotify(); return "SUCCESS"; } catch (Exception $e) { System.out.println($e.getMessage()); } return "fail"; } }