july 4 лет назад
Родитель
Сommit
e8fd6e16d2

+ 23 - 0
ldt-core/src/main/java/org/springblade/common/constant/CallbackServeUrl.java

@@ -0,0 +1,23 @@
+package org.springblade.common.constant;
+
+import lombok.AllArgsConstructor;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author July
+ * @version 1.0.0
+ * @ClassName CallbackServeUrl.java
+ * @Description TODO
+ * @createTime 2021年11月15日 10:50:00
+ */
+@Component
+@AllArgsConstructor
+public class CallbackServeUrl {
+
+	private static Environment environment;
+
+	public static String callbackServeUrl() {
+		return environment.getProperty("callback.domain");
+	}
+}

+ 3 - 5
ldt-core/src/main/java/org/springblade/payment/plugin/WithdrawPlugin.java

@@ -12,6 +12,7 @@ import lombok.AllArgsConstructor;
 import lombok.NoArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springblade.common.cache.PaymentCache;
+import org.springblade.common.constant.CallbackServeUrl;
 import org.springblade.common.enums.OrderType;
 import org.springblade.common.enums.PaymentType;
 import org.springblade.common.enums.TransferStatus;
@@ -67,18 +68,15 @@ public class WithdrawPlugin implements Withdraw {
 	ApplicationEventPublisher eventPublisher;
 	ITransferRecService transferRecService;
 	BladeLogger bladeLogger;
-	Environment env;
 
 	@Override
 	public String callbackUrl(String paymentType) {
-		String callbackDomain = env.getProperty("callback.domain");
-		return callbackDomain + CALLBACK_PREFIX + paymentType;
+		return CallbackServeUrl.callbackServeUrl() + CALLBACK_PREFIX + paymentType;
 	}
 
 	@Override
 	public String csUrl(String paymentType) {
-		String callbackDomain = env.getProperty("callback.domain");
-		return callbackDomain + CSURL_PREFIX + paymentType;
+		return CallbackServeUrl.callbackServeUrl() + CSURL_PREFIX + paymentType;
 	}
 
 	@Override

+ 3 - 9
ldt-core/src/main/java/org/springblade/payment/plugin/YeePayPlugin.java

@@ -8,11 +8,11 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.yeepay.yop.sdk.service.common.response.YopResponse;
 import lombok.AllArgsConstructor;
-import lombok.NoArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springblade.common.cache.PaymentCache;
+import org.springblade.common.constant.CallbackServeUrl;
 import org.springblade.common.enums.AppConstant;
 import org.springblade.common.enums.OrderType;
 import org.springblade.common.enums.PaymentType;
@@ -40,13 +40,10 @@ import org.springblade.yeePay.entity.MerchantInfo;
 import org.springblade.yeePay.entity.saas.PayLinkOrderDto;
 import org.springblade.yeePay.service.YeePayService;
 import org.springblade.yeePay.service.YeepaySaasService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
 
-import javax.annotation.PostConstruct;
 import javax.servlet.http.HttpServletRequest;
 
 
@@ -72,18 +69,15 @@ public class YeePayPlugin implements Payment {
 	ITransferRecService transferRecService;
 	IAgentLeagueRecordService agentLeagueRecordService;
 	BladeLogger bladeLogger;
-	Environment env;
 
 	@Override
 	public String callbackUrl(String paymentType) {
-		String callbackDomain = env.getProperty("callback.domain");
-		return callbackDomain + CALLBACK_PREFIX + paymentType;
+		return CallbackServeUrl.callbackServeUrl() + CALLBACK_PREFIX + paymentType;
 	}
 
 	@Override
 	public String csUrl(String paymentType) {
-		String callbackDomain = env.getProperty("callback.domain");
-		return callbackDomain + CSURL_PREFIX + paymentType;
+		return CallbackServeUrl.callbackServeUrl() + CSURL_PREFIX + paymentType;
 	}
 
 

+ 4 - 4
ldt-core/src/main/resources/application-dev.yml

@@ -38,11 +38,11 @@ spring:
     #  commandTimeout: 5000
   datasource:
     # MySql
-    url: jdbc:mysql://192.168.1.168:3306/ldt?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
-#    url: jdbc:mysql://192.168.1.218:3306/gx-ldt-0823?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+#    url: jdbc:mysql://192.168.1.168:3306/ldt?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+    url: jdbc:mysql://192.168.1.218:3306/gx-ldt-0823?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
     username: root
-#    password: root@123456
-    password: root
+    password: root@123456
+#    password: root
     # PostgreSQL
     #url: jdbc:postgresql://127.0.0.1:5432/bladex_boot
     #username: postgres