|
@@ -1,43 +1,35 @@
|
|
|
package com.ym.mec.biz.event.listener;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.ym.mec.biz.dal.entity.TenantInfo;
|
|
|
import com.ym.mec.biz.event.TenantConfigChangeEvent;
|
|
|
-import com.ym.mec.biz.service.SysTenantConfigService;
|
|
|
-import com.ym.mec.biz.service.TenantInfoService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.ApplicationListener;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.concurrent.ConcurrentHashMap;
|
|
|
-
|
|
|
@Component
|
|
|
public class TenantConfigListener implements ApplicationListener<TenantConfigChangeEvent> {
|
|
|
|
|
|
- @Autowired
|
|
|
- private SysTenantConfigService sysTenantConfigService;
|
|
|
- @Autowired
|
|
|
- private TenantInfoService tenantInfoService;
|
|
|
+// @Autowired
|
|
|
+// private SysTenantConfigService sysTenantConfigService;
|
|
|
+// @Autowired
|
|
|
+// private TenantInfoService tenantInfoService;
|
|
|
|
|
|
@Override
|
|
|
public void onApplicationEvent(TenantConfigChangeEvent event) {
|
|
|
- if(event.getTenantId() != null){
|
|
|
- TenantInfo tenantInfo = tenantInfoService.getById(event.getTenantId());
|
|
|
- if(tenantInfo != null){
|
|
|
- ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> allTenantConfig = sysTenantConfigService.getAllTenantConfig();
|
|
|
- allTenantConfig.put(tenantInfo.getId(),sysTenantConfigService.queryAllMap(tenantInfo.getId()));
|
|
|
- sysTenantConfigService.setTenantConfig(allTenantConfig);
|
|
|
- }
|
|
|
- }else {
|
|
|
- List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
|
|
|
- if(tenantInfos != null && tenantInfos.size() > 0){
|
|
|
- ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> tenantConfig = new ConcurrentHashMap<>(tenantInfos.size());
|
|
|
- for (TenantInfo tenantInfo : tenantInfos) {
|
|
|
- tenantConfig.put(tenantInfo.getId(),sysTenantConfigService.queryAllMap(tenantInfo.getId()));
|
|
|
- }
|
|
|
- sysTenantConfigService.setTenantConfig(tenantConfig);
|
|
|
- }
|
|
|
- }
|
|
|
+// if(event.getTenantId() != null){
|
|
|
+// TenantInfo tenantInfo = tenantInfoService.getById(event.getTenantId());
|
|
|
+// if(tenantInfo != null){
|
|
|
+// ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> allTenantConfig = sysTenantConfigService.getAllTenantConfig();
|
|
|
+// allTenantConfig.put(tenantInfo.getId(),sysTenantConfigService.queryAllMap(tenantInfo.getId()));
|
|
|
+// sysTenantConfigService.setTenantConfig(allTenantConfig);
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
|
|
|
+// if(tenantInfos != null && tenantInfos.size() > 0){
|
|
|
+// ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> tenantConfig = new ConcurrentHashMap<>(tenantInfos.size());
|
|
|
+// for (TenantInfo tenantInfo : tenantInfos) {
|
|
|
+// tenantConfig.put(tenantInfo.getId(),sysTenantConfigService.queryAllMap(tenantInfo.getId()));
|
|
|
+// }
|
|
|
+// sysTenantConfigService.setTenantConfig(tenantConfig);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
}
|