From 06a17c236d4cb9b8da75fce43af938cb7ea510bf Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期一, 15 十二月 2025 09:50:12 +0800
Subject: [PATCH] feat: 优化企业微信判断,优化gps分断处理
---
dryad-payment/src/main/java/com/ruoyi/payment/interfaces/controller/PaymentController.java | 96 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 1 deletions(-)
diff --git a/dryad-payment/src/main/java/com/ruoyi/payment/interfaces/controller/PaymentController.java b/dryad-payment/src/main/java/com/ruoyi/payment/interfaces/controller/PaymentController.java
index 311f0bd..e84292f 100644
--- a/dryad-payment/src/main/java/com/ruoyi/payment/interfaces/controller/PaymentController.java
+++ b/dryad-payment/src/main/java/com/ruoyi/payment/interfaces/controller/PaymentController.java
@@ -33,6 +33,7 @@
/**
* 鍙戣捣寰俊Native鏀粯
*/
+ @Anonymous()
@PostMapping("/wechat/native")
public AjaxResult createWechatNativePayment(@Validated @RequestBody PaymentRequest request) {
try {
@@ -47,6 +48,7 @@
/**
* 鍙戣捣鏀粯瀹濆綋闈粯
*/
+ @Anonymous()
@PostMapping("/alipay/precreate")
public AjaxResult createAlipayPrecreate(@Validated @RequestBody PaymentRequest request) {
try {
@@ -61,6 +63,7 @@
/**
* 鍙戣捣鏀粯瀹濆綋闈粯锛堢涓夋柟鎺ュ彛锛�
*/
+ @Anonymous()
@PostMapping("/alipay/thirdparty/precreate")
public AjaxResult createAlipayThirdPartyPrecreate(@Validated @RequestBody PaymentRequest request) {
try {
@@ -75,6 +78,7 @@
/**
* 鏌ヨ璁㈠崟
*/
+ @Anonymous()
@GetMapping("/orders/{orderId}")
public AjaxResult getOrder(@PathVariable Long orderId) {
try {
@@ -92,6 +96,7 @@
/**
* 鏌ヨ鏈�鏂颁氦鏄�
*/
+ @Anonymous()
@GetMapping("/orders/{orderId}/transactions/latest")
public AjaxResult getLatestTransaction(@PathVariable Long orderId) {
try {
@@ -109,6 +114,7 @@
/**
* 鏌ヨ鏀粯瀹濈涓夋柟浜ゆ槗鐘舵��
*/
+ @Anonymous()
@GetMapping("/alipay/thirdparty/query/{orderId}")
public AjaxResult queryAlipayThirdPartyTradeStatus(@PathVariable Long orderId) {
try {
@@ -119,4 +125,92 @@
return AjaxResult.error("鏌ヨ澶辫触: " + e.getMessage());
}
}
-}
+
+ /**
+ * 杞鏌ヨ鏀粯鐘舵�侊紙鐢ㄤ簬鍥炶皟澶辫触鐨勮ˉ鍋挎満鍒讹級
+ * <p>
+ * 杩欎釜鎺ュ彛鐢ㄤ簬鍦ㄦ敮浠樺洖璋冩湭鎴愬姛鏃讹紝涓诲姩杞鏌ヨ鏀粯鐘舵�併��
+ * 鏀寔寰俊鍜屾敮浠樺疂锛堝寘鎷涓夋柟鏀粯瀹濓級銆�
+ * <p>
+ * 杩斿洖缁撴灉鍖呭惈锛�
+ * - orderStatus: 璁㈠崟鐘舵��
+ * - transactionStatus: 浜ゆ槗鐘舵��
+ * - tradeStatus: 绗笁鏂逛氦鏄撶姸鎬�
+ * - needPoll: 鏄惁闇�瑕佺户缁疆璇�
+ * - message: 鎻愮ず淇℃伅
+ * <p>
+ * 寤鸿杞绛栫暐锛�
+ * 1. 棣栨杞锛氱珛鍗宠疆璇�
+ * 2. 鍚庣画杞锛氶棿闅�3-5绉�
+ * 3. 鏈�澶氳疆璇�20娆★紝绾�100绉掑悗鍋滄
+ * 4. 濡傛灉 needPoll=false锛岃〃绀烘敮浠樺凡瀹屾垚鎴栫‘璁ゅけ璐ワ紝鏃犻渶缁х画杞
+ */
+ @Anonymous()
+ @GetMapping("/poll/{orderId}")
+ public AjaxResult pollPaymentStatus(@PathVariable Long orderId) {
+ try {
+ java.util.Map<String, Object> result = paymentService.pollPaymentStatus(orderId);
+ return AjaxResult.success(result);
+ } catch (Exception e) {
+ log.error("杞鏌ヨ鏀粯鐘舵�佸け璐�", e);
+ return AjaxResult.error("鏌ヨ澶辫触: " + e.getMessage());
+ }
+ }
+
+ /**
+ * 鏍规嵁浜ゆ槗鍗曞彿鏌ヨ寰俊鏀粯鐘舵��
+ * <p>
+ * 璇ユ帴鍙g敤浜庨�氳繃鍟嗘埛璁㈠崟鍙凤紙浜ゆ槗鍗曞彿锛夌洿鎺ユ煡璇㈠井淇℃敮浠樼姸鎬併��
+ * <p>
+ * 杩斿洖缁撴灉鍖呭惈锛�
+ * - success: 鏌ヨ鏄惁鎴愬姛
+ * - isPaid: 鏄惁宸叉敮浠�
+ * - tradeState: 浜ゆ槗鐘舵�侊紙SUCCESS-鏀粯鎴愬姛锛孨OTPAY-鏈敮浠橈紝CLOSED-宸插叧闂瓑锛�
+ * - transactionId: 寰俊鏀粯璁㈠崟鍙�
+ * - totalFee: 璁㈠崟閲戦锛堝垎锛�
+ * - timeEnd: 鏀粯瀹屾垚鏃堕棿
+ * - message: 鎻愮ず淇℃伅
+ *
+ * @param outTradeNo 鍟嗘埛璁㈠崟鍙凤紙浜ゆ槗鍗曞彿锛�
+ */
+ @Anonymous()
+ @GetMapping("/wechat/query/{outTradeNo}")
+ public AjaxResult queryWechatTrade(@PathVariable String outTradeNo) {
+ try {
+ java.util.Map<String, Object> result = paymentService.queryWechatTradeByOutTradeNo(outTradeNo);
+ return AjaxResult.success(result);
+ } catch (Exception e) {
+ log.error("鏌ヨ寰俊浜ゆ槗鐘舵�佸け璐ワ紝浜ゆ槗鍗曞彿: {}", outTradeNo, e);
+ return AjaxResult.error("鏌ヨ澶辫触: " + e.getMessage());
+ }
+ }
+
+ /**
+ * 鏍规嵁浜ゆ槗鍗曞彿鏌ヨ鏀粯瀹濇敮浠樼姸鎬�
+ * <p>
+ * 璇ユ帴鍙g敤浜庨�氳繃鍟嗘埛璁㈠崟鍙凤紙浜ゆ槗鍗曞彿锛夌洿鎺ユ煡璇㈡敮浠樺疂鏀粯鐘舵�併��
+ * <p>
+ * 杩斿洖缁撴灉鍖呭惈锛�
+ * - success: 鏌ヨ鏄惁鎴愬姛
+ * - isPaid: 鏄惁宸叉敮浠�
+ * - tradeStatus: 浜ゆ槗鐘舵�侊紙TRADE_SUCCESS-鏀粯鎴愬姛锛學AIT_BUYER_PAY-绛夊緟浠樻锛孴RADE_CLOSED-宸插叧闂瓑锛�
+ * - tradeNo: 鏀粯瀹濅氦鏄撳彿
+ * - totalAmount: 璁㈠崟閲戦锛堝厓锛�
+ * - sendPayDate: 浜ゆ槗鏀粯鏃堕棿
+ * - buyerLogonId: 涔板鏀粯瀹濊处鍙�
+ * - message: 鎻愮ず淇℃伅
+ *
+ * @param outTradeNo 鍟嗘埛璁㈠崟鍙凤紙浜ゆ槗鍗曞彿锛�
+ */
+ @Anonymous()
+ @GetMapping("/alipay/query/{outTradeNo}")
+ public AjaxResult queryAlipayTrade(@PathVariable String outTradeNo) {
+ try {
+ java.util.Map<String, Object> result = paymentService.queryAlipayTradeByOutTradeNo(outTradeNo);
+ return AjaxResult.success(result);
+ } catch (Exception e) {
+ log.error("鏌ヨ鏀粯瀹濅氦鏄撶姸鎬佸け璐ワ紝浜ゆ槗鍗曞彿: {}", outTradeNo, e);
+ return AjaxResult.error("鏌ヨ澶辫触: " + e.getMessage());
+ }
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1