diff --git a/zlt-business/device-center/src/main/resources/bootstrap.yml b/zlt-business/device-center/src/main/resources/bootstrap.yml index 3b3b43e4..1a0e7044 100644 --- a/zlt-business/device-center/src/main/resources/bootstrap.yml +++ b/zlt-business/device-center/src/main/resources/bootstrap.yml @@ -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: diff --git a/zlt-business/order-center/pom.xml b/zlt-business/order-center/pom.xml index 042ee6a8..118ee8a2 100644 --- a/zlt-business/order-center/pom.xml +++ b/zlt-business/order-center/pom.xml @@ -90,14 +90,14 @@ hibernate-validator - + - + javax.servlet javax.servlet-api diff --git a/zlt-business/order-center/src/main/java/com/central/order/controller/WxPayController.java b/zlt-business/order-center/src/main/java/com/central/order/controller/WxPayController.java index a5440ab8..8fe3c816 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/controller/WxPayController.java +++ b/zlt-business/order-center/src/main/java/com/central/order/controller/WxPayController.java @@ -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 result = parser.parse(requestParam, Map.class); diff --git a/zlt-business/order-center/src/main/resources/bootstrap.yml b/zlt-business/order-center/src/main/resources/bootstrap.yml index e780c4e4..1566517e 100644 --- a/zlt-business/order-center/src/main/resources/bootstrap.yml +++ b/zlt-business/order-center/src/main/resources/bootstrap.yml @@ -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: diff --git a/zlt-business/user-center/src/main/resources/bootstrap.yml b/zlt-business/user-center/src/main/resources/bootstrap.yml index c2b67a64..a23d0891 100644 --- a/zlt-business/user-center/src/main/resources/bootstrap.yml +++ b/zlt-business/user-center/src/main/resources/bootstrap.yml @@ -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: diff --git a/zlt-commons/zlt-wechat-spring-boot-starter/src/main/java/com/central/wechat/config/WechatAutoConfiguration.java b/zlt-commons/zlt-wechat-spring-boot-starter/src/main/java/com/central/wechat/config/WechatAutoConfiguration.java index cd904d50..2d2d61c5 100644 --- a/zlt-commons/zlt-wechat-spring-boot-starter/src/main/java/com/central/wechat/config/WechatAutoConfiguration.java +++ b/zlt-commons/zlt-wechat-spring-boot-starter/src/main/java/com/central/wechat/config/WechatAutoConfiguration.java @@ -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() { diff --git a/zlt-config/src/main/resources/bootstrap.properties b/zlt-config/src/main/resources/bootstrap.properties index 2168d2fe..19e3c72f 100644 --- a/zlt-config/src/main/resources/bootstrap.properties +++ b/zlt-config/src/main/resources/bootstrap.properties @@ -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 diff --git a/zlt-uaa/src/main/resources/bootstrap.yml b/zlt-uaa/src/main/resources/bootstrap.yml index f24da648..aff9b849 100644 --- a/zlt-uaa/src/main/resources/bootstrap.yml +++ b/zlt-uaa/src/main/resources/bootstrap.yml @@ -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: