From 0b662023206a47f70f1aa3dc1abbd8c58dbb2f96 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 28 Jul 2020 09:33:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E9=97=A8=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/BackDoorController.java | 29 +++++++++++++++++++ .../epmet/redis/CustomerAppWxServiceUtil.java | 11 +++++-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 epmet-auth/src/main/java/com/epmet/controller/BackDoorController.java diff --git a/epmet-auth/src/main/java/com/epmet/controller/BackDoorController.java b/epmet-auth/src/main/java/com/epmet/controller/BackDoorController.java new file mode 100644 index 0000000000..b87e071a50 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/controller/BackDoorController.java @@ -0,0 +1,29 @@ +package com.epmet.controller; + +import com.epmet.redis.CustomerAppWxServiceUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Set; + +/** + * @author jianjun liu + * @date 2020-06-04 20:39 + **/ +@RestController +@RequestMapping("opback") +public class BackDoorController { + @Autowired + private CustomerAppWxServiceUtil customerAppWxServiceUtil; + + /** + * 数据库添加新客户app后 + * + * @return + */ + @RequestMapping("reloadcustomerapp") + public Set initWxMaService() { + return customerAppWxServiceUtil.initWxMaService(); + } +} diff --git a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java index a7f36c75f0..e641d17ed6 100644 --- a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java +++ b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java @@ -65,6 +65,10 @@ public class CustomerAppWxServiceUtil implements ApplicationRunner { @Override public void run(ApplicationArguments args) { + initWxMaService(); + } + + public Set initWxMaService() { Map maServicesNew = Maps.newConcurrentMap(); SetOperations appSet = null; List result = null; @@ -91,7 +95,7 @@ public class CustomerAppWxServiceUtil implements ApplicationRunner { logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp result:{}", JSON.toJSONString(configAllAppResult)); if (configAllAppResult == null || !configAllAppResult.success()) { logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp fail"); - return; + return maServicesNew.keySet(); } result = configAllAppResult.getData(); result.forEach(app -> { @@ -110,8 +114,11 @@ public class CustomerAppWxServiceUtil implements ApplicationRunner { if (maServicesNew.size() > 0) { maServices = maServicesNew; if (appSet != null && result != null) { - appSet.add(appKey, result); + for (CustomerAppDTO app : result) { + appSet.add(appKey, app); + } } } + return maServicesNew.keySet(); } }