From eb6b6dbb35a9f029e0b7d269773685c19fd40976 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 11 七月 2024 10:47:51 +0800
Subject: [PATCH] 玩湃微信商户认证代码

---
 cloud-server-account/src/main/java/com/dsh/account/controller/PaymentCallbackController.java |   62 ++++++++++++++++--------------
 1 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/PaymentCallbackController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/PaymentCallbackController.java
index f38af27..24963ef 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/controller/PaymentCallbackController.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/controller/PaymentCallbackController.java
@@ -15,6 +15,8 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.Map;
 
 /**
@@ -23,7 +25,7 @@
 
 
 @RestController
-@RequestMapping("/payment/callback")
+@RequestMapping("")
 public class PaymentCallbackController {
 
 
@@ -42,21 +44,21 @@
      * 课包续课支付宝支付回调接口
      */
     @PostMapping("/base/coursePackage/alipayPaymentCallback")
-    public void alipayCallback(HttpServletRequest request, HttpServletResponse response){
+    public void alipayCallback(HttpServletRequest request, HttpServletResponse response) {
         try {
             Map<String, String> map = payMoneyUtil.alipayCallback(request);
-            if(null != map){
+            if (null != map) {
                 String out_trade_no = map.get("out_trade_no");
                 String transaction_id = map.get("transaction_id");
                 ResultUtil resultUtil = tstuService.insertVipPaymentCallback(out_trade_no, transaction_id);
-                if(resultUtil.getCode() == 200){
+                if (resultUtil.getCode() == 200) {
                     PrintWriter out = response.getWriter();
                     out.write("success");
                     out.flush();
                     out.close();
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -66,22 +68,22 @@
      * 课包续课微信支付回调接口
      */
     @PostMapping("/base/coursePackage/wechatPaymentCallback")
-    public void weChatCallback(HttpServletRequest request, HttpServletResponse response){
+    public void weChatCallback(HttpServletRequest request, HttpServletResponse response) {
         try {
             Map<String, String> map = payMoneyUtil.weixinpayCallback(request);
-            if(null != map){
+            if (null != map) {
                 String out_trade_no = map.get("out_trade_no");
                 String transaction_id = map.get("transaction_id");
                 String result = map.get("result");
                 ResultUtil resultUtil = tstuService.insertVipPaymentCallback(out_trade_no, transaction_id);
-                if(resultUtil.getCode() == 200){
+                if (resultUtil.getCode() == 200) {
                     PrintWriter out = response.getWriter();
                     out.write(result);
                     out.flush();
                     out.close();
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -90,21 +92,21 @@
      * 充值玩湃币支付宝支付回调接口
      */
     @PostMapping("/base/recharge/alipayRechargeCallback")
-    public void alipayRechargeCallback(HttpServletRequest request, HttpServletResponse response){
+    public void alipayRechargeCallback(HttpServletRequest request, HttpServletResponse response) {
         try {
             Map<String, String> map = payMoneyUtil.alipayCallback(request);
-            if(null != map){
+            if (null != map) {
                 String out_trade_no = map.get("out_trade_no");
                 String transaction_id = map.get("transaction_id");
                 ResultUtil resultUtil = recordsService.addRechargeCallbackPay(out_trade_no, transaction_id);
-                if(resultUtil.getCode() == 200){
+                if (resultUtil.getCode() == 200) {
                     PrintWriter out = response.getWriter();
                     out.write("success");
                     out.flush();
                     out.close();
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -114,22 +116,22 @@
      * 课包续课微信支付回调接口
      */
     @PostMapping("/base/recharge/wechatRechargeCallback")
-    public void wechatRechargeCallback(HttpServletRequest request, HttpServletResponse response){
+    public void wechatRechargeCallback(HttpServletRequest request, HttpServletResponse response) {
         try {
             Map<String, String> map = payMoneyUtil.weixinpayCallback(request);
-            if(null != map){
+            if (null != map) {
                 String out_trade_no = map.get("out_trade_no");
                 String transaction_id = map.get("transaction_id");
                 String result = map.get("result");
                 ResultUtil resultUtil = recordsService.addRechargeCallbackPay(out_trade_no, transaction_id);
-                if(resultUtil.getCode() == 200){
+                if (resultUtil.getCode() == 200) {
                     PrintWriter out = response.getWriter();
                     out.write(result);
                     out.flush();
                     out.close();
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -137,27 +139,28 @@
 
     /**
      * 兑换商品支付的微信回调
+     *
      * @param request
      * @param response
      */
     @ResponseBody
-    @PostMapping("/base/appUser/addVipPaymentWeChatCallback")
-    public void addVipPaymentWeChatCallback(HttpServletRequest request, HttpServletResponse response){
+    @PostMapping("/base/pointMer/exchangeGoodPaymentWeChatCallback")
+    public void exchangeGoodPaymentWeChatCallback(HttpServletRequest request, HttpServletResponse response) {
         try {
             Map<String, String> map = payMoneyUtil.weixinpayCallback(request);
-            if(null != map){
+            if (null != map) {
                 String out_trade_no = map.get("out_trade_no");
                 String transaction_id = map.get("transaction_id");
                 String result = map.get("result");
-                ResultUtil resultUtil = tappService.exchangeAddPaymentCallback(out_trade_no, transaction_id,1);
-                if(resultUtil.getCode() == 200){
+                ResultUtil resultUtil = tappService.exchangeAddPaymentCallback(out_trade_no, transaction_id, 1);
+                if (resultUtil.getCode() == 200) {
                     PrintWriter out = response.getWriter();
                     out.write(result);
                     out.flush();
                     out.close();
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -165,26 +168,27 @@
 
     /**
      * 兑换商品支付的支付宝回调
+     *
      * @param request
      * @param response
      */
     @ResponseBody
-    @PostMapping("/base/appUser/addVipPaymentAliCallback")
-    public void addVipPaymentAliCallback(HttpServletRequest request, HttpServletResponse response){
+    @PostMapping("/base/pointMer/exchangeGoodPaymentAliCallback")
+    public void exchangeGoodPaymentAliCallback(HttpServletRequest request, HttpServletResponse response) {
         try {
             Map<String, String> map = payMoneyUtil.alipayCallback(request);
-            if(null != map){
+            if (null != map) {
                 String out_trade_no = map.get("out_trade_no");
                 String trade_no = map.get("trade_no");
-                ResultUtil resultUtil = tappService.exchangeAddPaymentCallback(out_trade_no, trade_no,2);
-                if(resultUtil.getCode() == 200){
+                ResultUtil resultUtil = tappService.exchangeAddPaymentCallback(out_trade_no, trade_no, 2);
+                if (resultUtil.getCode() == 200) {
                     PrintWriter out = response.getWriter();
                     out.write("success");
                     out.flush();
                     out.close();
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }

--
Gitblit v1.7.1