july 4 роки тому
батько
коміт
9775ede72f

+ 11 - 8
ldt-core/src/main/java/org/springblade/common/constant/CallbackServeUrl.java

@@ -1,6 +1,7 @@
 package org.springblade.common.constant;
 
-import lombok.AllArgsConstructor;
+import cn.hutool.extra.spring.SpringUtil;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
 
@@ -8,16 +9,18 @@ import org.springframework.stereotype.Component;
  * @author July
  * @version 1.0.0
  * @ClassName CallbackServeUrl.java
- * @Description TODO
+ * @Description 回调服务地址
  * @createTime 2021年11月15日 10:50:00
  */
-@Component
-@AllArgsConstructor
+//@Component
 public class CallbackServeUrl {
 
-	private static Environment environment;
+	public static final String CALL_BACK_SERVE_URL = SpringUtil.getBean(Environment.class).getProperty("callback.domain");
 
-	public static String callbackServeUrl() {
-		return environment.getProperty("callback.domain");
-	}
+	/*public static String CALL_BACK_SERVE_URL;
+
+	@Value("${callback.domain}")
+	public void setDomain(String domain) {
+		CallbackServeUrl.CALL_BACK_SERVE_URL = domain;
+	}*/
 }

+ 2 - 1
ldt-core/src/main/java/org/springblade/flow/mall/task/MallInvitationTask.java

@@ -7,6 +7,7 @@ import com.yeepay.yop.sdk.service.common.response.YopResponse;
 import org.flowable.engine.delegate.DelegateExecution;
 import org.flowable.engine.delegate.JavaDelegate;
 import org.springblade.common.cache.FlowCache;
+import org.springblade.common.constant.CallbackServeUrl;
 import org.springblade.common.enums.AppConstant;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.utils.BeanUtil;
@@ -56,7 +57,7 @@ public class MallInvitationTask  {
 
 		//封装进件信息
 		InvitationDto invitationDto = InvitationBuilder.build(audit);
-		invitationDto.setNotifyUrl(yeePayConst.getServiceUrl()+"/payment/invitation/callback/"+ AppConstant.InvitationType.MALL_INVITATION);
+		invitationDto.setNotifyUrl(CallbackServeUrl.CALL_BACK_SERVE_URL+"/payment/invitation/callback/"+ AppConstant.InvitationType.MALL_INVITATION);
 		invitationDto.setParentMerchantNo(yeePayConst.getPlatformServiceNo());
 		invitationDto.setBusinessRole(YeepayApiConstant.businessRole.SETTLED_MERCHANT.name());
 		invitationDto.getMerchantCorporationInfo().setLegalName(audit.getLegalPerson());

+ 3 - 2
ldt-core/src/main/java/org/springblade/flow/shop/task/InvitationTask.java

@@ -10,6 +10,7 @@ import org.flowable.engine.delegate.JavaDelegate;
 import org.springblade.common.cache.FlowCache;
 import org.springblade.common.cache.PlatformCache;
 import org.springblade.common.config.entity.PlatformConfig;
+import org.springblade.common.constant.CallbackServeUrl;
 import org.springblade.common.enums.AppConstant;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.utils.SpringUtil;
@@ -88,7 +89,7 @@ public class InvitationTask implements JavaDelegate {
 	private YopResponse merchantInvitation(Audit audit, Shop shop, Map<String, Object> variables){
 		//封装进件信息
 		InvitationDto invitationDto = InvitationBuilder.build(audit);
-		invitationDto.setNotifyUrl(yeePayConst.getServiceUrl() + "/payment/invitation/callback/" + AppConstant.InvitationType.SHOP_INVITATION);
+		invitationDto.setNotifyUrl(CallbackServeUrl.CALL_BACK_SERVE_URL + "/payment/invitation/callback/" + AppConstant.InvitationType.SHOP_INVITATION);
 		invitationDto.setBusinessRole(YeepayApiConstant.businessRole.SETTLED_MERCHANT.name());
 		audit.setRequestNo(invitationDto.getRequestNo());
 
@@ -115,7 +116,7 @@ public class InvitationTask implements JavaDelegate {
 
 			//封装进件信息
 			MicroInvitationDto microInvitationDto = MicroInvitationBuilder.build(audit);
-			microInvitationDto.setNotifyUrl(yeePayConst.getServiceUrl() + "/payment/invitation/callback/" + AppConstant.InvitationType.SHOP_INVITATION);
+			microInvitationDto.setNotifyUrl(CallbackServeUrl.CALL_BACK_SERVE_URL + "/payment/invitation/callback/" + AppConstant.InvitationType.SHOP_INVITATION);
 			microInvitationDto.setBusinessRole(YeepayApiConstant.businessRole.SETTLED_MERCHANT.name());
 			audit.setRequestNo(microInvitationDto.getRequestNo());
 

+ 2 - 1
ldt-core/src/main/java/org/springblade/gateway/mall_gateway/controller/MallYeePayProductController.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springblade.common.cache.PlatformCache;
 import org.springblade.common.config.yeepay.OpenProduct;
+import org.springblade.common.constant.CallbackServeUrl;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tenant.annotation.TenantIgnore;
 import org.springblade.core.tool.api.R;
@@ -83,7 +84,7 @@ public class MallYeePayProductController {
 			.parentMerchantNo(yeePayConst.getPlatformServiceNo())
 			.merchantNo(mall.getMerchantNo())
 			.productInfo(JSON.parseArray(modifyProductInfo,ProductFeeModifyDto.ModifyProductInfo.class))
-			.notifyUrl(new StringBuilder(yeePayConst.getServiceUrl())
+			.notifyUrl(new StringBuilder(CallbackServeUrl.CALL_BACK_SERVE_URL)
 				.append("/mall/yeepay/product/fee/modifyProductFeeNotify").toString())
 			.requestNo(UUID.randomUUID().toString())
 			.build());

+ 2 - 1
ldt-core/src/main/java/org/springblade/gateway/shop_gateway/controller/ShopYeePayProduceController.java

@@ -12,6 +12,7 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springblade.common.cache.PlatformCache;
 import org.springblade.common.config.yeepay.OpenProduct;
+import org.springblade.common.constant.CallbackServeUrl;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tenant.annotation.TenantIgnore;
 import org.springblade.core.tool.api.R;
@@ -81,7 +82,7 @@ public class ShopYeePayProduceController {
 			.parentMerchantNo(yeePayConst.getPlatformServiceNo())
 			.merchantNo(shop.getMerchantNo())
 			.productInfo(JSON.parseArray(modifyProductInfo,ProductFeeModifyDto.ModifyProductInfo.class))
-			.notifyUrl(new StringBuilder(yeePayConst.getServiceUrl())
+			.notifyUrl(new StringBuilder(CallbackServeUrl.CALL_BACK_SERVE_URL)
 				.append("/shop/yeepay/product/fee/modifyProductFeeNotify").toString())
 			.requestNo(UUID.randomUUID().toString())
 			.build());

+ 3 - 0
ldt-core/src/main/java/org/springblade/gateway/web_gateway/controller/PressureTestController.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.common.cache.PaymentCache;
+import org.springblade.common.constant.CallbackServeUrl;
 import org.springblade.common.enums.*;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.api.R;
@@ -26,6 +27,7 @@ import org.springblade.payment.event.UserPayEvent;
 import org.springblade.payment.event.UserWithdrawEvent;
 import org.springblade.payment.handle.Trade;
 import org.springblade.payment.handle.entity.Order;
+import org.springblade.payment.plugin.PaymentBuilder;
 import org.springblade.wx.config.ConfigForShop;
 import org.springblade.wx.constant.MessageTemplate;
 import org.springblade.wx.constant.MiniProgramType;
@@ -100,6 +102,7 @@ public class PressureTestController {
 		String settleRequestNo = IdUtil.simpleUUID();
 		withdrawRec.setRequestNo(settleRequestNo);
 		withdrawRecService.updateById(withdrawRec);
+		String callbackServeUrl = CallbackServeUrl.CALL_BACK_SERVE_URL;
 
 		//支付参数
 		SuccessParams successParams = SuccessParams.builder()

+ 2 - 1
ldt-core/src/main/java/org/springblade/ldt/bills/service/impl/PointBillsServiceImpl.java

@@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.yeepay.yop.sdk.service.common.response.YopResponse;
 import lombok.AllArgsConstructor;
 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.PaymentScene;
@@ -177,7 +178,7 @@ public class PointBillsServiceImpl extends BaseServiceImpl<PointBillsMapper, Poi
 			.requestNo(requestNo)
 			.usage("积分交易核销!")
 			.feeChargeSide(YeepayApiConstant.feeChargeSide.INSIDE)
-			.notifyUrl(yeePayConst.getServiceUrl() + "/payment/callback/YEE_PAY")
+			.notifyUrl(CallbackServeUrl.CALL_BACK_SERVE_URL + "/payment/callback/YEE_PAY")
 			.build();
 
 		YopResponse yopResponse = yeepaySaasService.transferOrder(transferOrderDto);

+ 2 - 1
ldt-core/src/main/java/org/springblade/ldt/mall/service/impl/MallServiceImpl.java

@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.yeepay.yop.sdk.service.common.response.YopResponse;
 import lombok.AllArgsConstructor;
 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.PaymentScene;
@@ -114,7 +115,7 @@ public class MallServiceImpl extends BaseServiceImpl<MallMapper, Mall> implement
 			.requestNo(requestNo)
 			.payType(YeepayApiConstant.payType.B2B)
 			.remark(bills.getBillDesc())
-			.notifyUrl(yeePayConst.getServiceUrl() + "/withdraw/callback/YEE_PAY_WITHDRAW")
+			.notifyUrl(CallbackServeUrl.CALL_BACK_SERVE_URL + "/withdraw/callback/YEE_PAY_WITHDRAW")
 			.returnUrl(yeePayConst.getRechargeReturnUrl())
 			.amount(bills.getPrice())
 			.bankCode(bankCode)

+ 2 - 1
ldt-core/src/main/java/org/springblade/payment/callback/trade/UserPointTransferWithdrawCallback.java

@@ -9,6 +9,7 @@ import com.yeepay.yop.sdk.service.common.response.YopResponse;
 import lombok.AllArgsConstructor;
 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.WithdrawStatus;
 import org.springblade.core.log.exception.ServiceException;
@@ -63,7 +64,7 @@ public class UserPointTransferWithdrawCallback {
 			.bankAccountNo(withdrawRec.getReceiverAccountNo())
 			.receiveType(YeepayApiConstant.receiveType.valueOf(withdrawRec.getReceiveType()))
 			.orderAmount(successParams.getTotalPrice().toPlainString())
-			.notifyUrl(yeePayConst.getServiceUrl() + "/withdraw/callback/YEE_PAY_WITHDRAW")
+			.notifyUrl(CallbackServeUrl.CALL_BACK_SERVE_URL + "/withdraw/callback/YEE_PAY_WITHDRAW")
 			.build();
 		withdrawRec.setRequestNo(requestNo);
 		withdrawRecService.saveOrUpdate(withdrawRec);

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

@@ -71,12 +71,12 @@ public class WithdrawPlugin implements Withdraw {
 
 	@Override
 	public String callbackUrl(String paymentType) {
-		return CallbackServeUrl.callbackServeUrl() + CALLBACK_PREFIX + paymentType;
+		return CallbackServeUrl.CALL_BACK_SERVE_URL + CALLBACK_PREFIX + paymentType;
 	}
 
 	@Override
 	public String csUrl(String paymentType) {
-		return CallbackServeUrl.callbackServeUrl() + CSURL_PREFIX + paymentType;
+		return CallbackServeUrl.CALL_BACK_SERVE_URL + CSURL_PREFIX + paymentType;
 	}
 
 	@Override

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

@@ -72,12 +72,12 @@ public class YeePayPlugin implements Payment {
 
 	@Override
 	public String callbackUrl(String paymentType) {
-		return CallbackServeUrl.callbackServeUrl() + CALLBACK_PREFIX + paymentType;
+		return CallbackServeUrl.CALL_BACK_SERVE_URL + CALLBACK_PREFIX + paymentType;
 	}
 
 	@Override
 	public String csUrl(String paymentType) {
-		return CallbackServeUrl.callbackServeUrl() + CSURL_PREFIX + paymentType;
+		return CallbackServeUrl.CALL_BACK_SERVE_URL + CSURL_PREFIX + paymentType;
 	}