fix:升级服务调整逻辑,完善通知配置初始化逻辑,回调待优化
This commit is contained in:
@@ -4,10 +4,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: device-center
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 119.45.169.13
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 119.45.169.13
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
|
||||
@@ -90,14 +90,14 @@
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||
<artifactId>wechatpay-java</artifactId>
|
||||
<version>0.2.15</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
<!-- 微信公众号 SDK -->
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-mp</artifactId>
|
||||
<version>4.5.0</version>
|
||||
@@ -118,7 +118,7 @@
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-common</artifactId>
|
||||
<version>4.6.0</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
|
||||
+8
-8
@@ -1,6 +1,5 @@
|
||||
package com.central.order.controller;
|
||||
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.central.order.constants.ProfitSharingConstants;
|
||||
import com.central.order.enums.OrderStatus;
|
||||
import com.central.order.enums.RefundState;
|
||||
@@ -76,10 +75,11 @@ public class WxPayController {
|
||||
.build();
|
||||
log.info("------收到微信支付成功回调通知------");
|
||||
log.info(requestParam.toString());
|
||||
// @TODO 后面需要将订单号和租户ID缓存进行处理,或者其他方式,目前先使用默认的tenantID,退款也是同样的问题
|
||||
WechatConfig config = wechatConfigService.getConfigBySerialNumber(serial);
|
||||
String tenantId = config.getTenantId();
|
||||
if (StringUtil.isBlank(tenantId)) {
|
||||
tenantId = defaultTenantId;
|
||||
String tenantId = defaultTenantId;
|
||||
if (config != null) {
|
||||
tenantId = config.getTenantId();
|
||||
}
|
||||
|
||||
NotificationParser notificationParser = wxPayConfigFactory.createNotificationParser(tenantId);
|
||||
@@ -201,9 +201,9 @@ public class WxPayController {
|
||||
.build();
|
||||
|
||||
WechatConfig config = wechatConfigService.getConfigBySerialNumber(serial);
|
||||
String tenantId = config.getTenantId();
|
||||
if (StringUtil.isBlank(tenantId)) {
|
||||
tenantId = defaultTenantId;
|
||||
String tenantId = defaultTenantId;
|
||||
if (config != null) {
|
||||
tenantId = config.getTenantId();
|
||||
}
|
||||
|
||||
NotificationParser notificationParser = wxPayConfigFactory.createNotificationParser(tenantId);
|
||||
@@ -240,7 +240,7 @@ public class WxPayController {
|
||||
*/
|
||||
private ProfitSharingNotification parseNotification(RequestParam requestParam) {
|
||||
try {
|
||||
NotificationParser parser = wxPayConfigFactory.createNotificationParser("");
|
||||
NotificationParser parser = wxPayConfigFactory.createNotificationParser(defaultTenantId);
|
||||
// 解析为Map后转换为ProfitSharingNotification对象
|
||||
Map<String, Object> result = parser.parse(requestParam, Map.class);
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: order-center
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 81.70.164.178
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 81.70.164.178
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
|
||||
@@ -4,10 +4,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: user-center
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 124.222.128.40
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 124.222.128.40
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
|
||||
+17
-22
@@ -28,36 +28,31 @@ public class WechatAutoConfiguration {
|
||||
@ConditionalOnBean(WechatConfigService.class)
|
||||
public WxMpService wxMpService(WechatConfigService configService) {
|
||||
log.info("WxMpService(公众号相关)被加载,tenantId:{}", getCurrentTenantId());
|
||||
return new WxMpServiceImpl() {
|
||||
@Override
|
||||
public WxMpDefaultConfigImpl getWxMpConfigStorage() {
|
||||
WechatConfig config = configService.getConfig("MP", getCurrentTenantId());
|
||||
WxMpDefaultConfigImpl wxConfig = new WxMpDefaultConfigImpl();
|
||||
wxConfig.setAppId(config.getAppId());
|
||||
wxConfig.setSecret(config.getAppSecret());
|
||||
wxConfig.setToken(config.getToken());
|
||||
wxConfig.setAesKey(config.getAesKey());
|
||||
return wxConfig;
|
||||
}
|
||||
};
|
||||
WechatConfig wechatConfig = configService.getConfig("MP", getCurrentTenantId());
|
||||
WxMpService service = new WxMpServiceImpl();
|
||||
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
|
||||
|
||||
config.setAppId(wechatConfig.getAppId());
|
||||
config.setSecret(wechatConfig.getAppSecret());
|
||||
|
||||
service.setWxMpConfigStorage(config);
|
||||
return service;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(WechatConfigService.class)
|
||||
public WxMaService wxMaService(WechatConfigService configService) {
|
||||
log.info("WxMaService(小程序通知)被加载,tenantId:{}", getCurrentTenantId());
|
||||
return new WxMaServiceImpl() {
|
||||
@Override
|
||||
public WxMaDefaultConfigImpl getWxMaConfig() {
|
||||
WechatConfig config = configService.getConfig("PAY", getCurrentTenantId());
|
||||
WxMaDefaultConfigImpl wxConfig = new WxMaDefaultConfigImpl();
|
||||
wxConfig.setAppid(config.getAppId());
|
||||
wxConfig.setSecret(config.getAppSecret());
|
||||
return wxConfig;
|
||||
}
|
||||
};
|
||||
WechatConfig wechatConfig = configService.getConfig("PAY", getCurrentTenantId());
|
||||
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||
config.setAppid(wechatConfig.getAppId());
|
||||
config.setSecret(wechatConfig.getAppSecret());
|
||||
WxMaService service = new WxMaServiceImpl();
|
||||
service.setWxMaConfig(config);
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean({WechatConfigService.class})
|
||||
public WxPayConfigFactory wxPayConfigFactory() {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
########################## bootstrap级别通用配置 ##########################
|
||||
# 默认开发环境
|
||||
spring.profiles.active=dev
|
||||
spring.profiles.active=prod
|
||||
|
||||
##### nacos(注册中心和配置中心)地址
|
||||
#spring.cloud.nacos.server-addr=81.70.164.178:8848
|
||||
spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.server-addr=81.70.164.178:8848
|
||||
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.username=nacos
|
||||
spring.cloud.nacos.password=nacos
|
||||
#spring.cloud.nacos.password=nacosGFLY
|
||||
#spring.cloud.nacos.password=nacos
|
||||
spring.cloud.nacos.password=nacosGFLY
|
||||
spring.cloud.nacos.config.file-extension=yml
|
||||
spring.cloud.nacos.config.shared-configs[0].data-id=common.yml
|
||||
spring.cloud.nacos.config.shared-configs[0].refresh=true
|
||||
|
||||
@@ -8,10 +8,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: uaa-server
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 124.222.128.40
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 124.222.128.40
|
||||
|
||||
encrypt:
|
||||
key-store:
|
||||
|
||||
Reference in New Issue
Block a user