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(); } }