|
@@ -1,5 +1,6 @@
|
|
package com.ym.mec.biz.service.impl;
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
import com.ym.mec.biz.dal.dao.SysTenantConfigDao;
|
|
import com.ym.mec.biz.dal.dao.SysTenantConfigDao;
|
|
import com.ym.mec.biz.dal.entity.SysConfig;
|
|
import com.ym.mec.biz.dal.entity.SysConfig;
|
|
import com.ym.mec.biz.dal.entity.SysTenantConfig;
|
|
import com.ym.mec.biz.dal.entity.SysTenantConfig;
|
|
@@ -23,11 +24,13 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
-public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTenantConfig> implements SysTenantConfigService, ApplicationEventPublisherAware {
|
|
|
|
|
|
+public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTenantConfig> implements SysTenantConfigService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SysTenantConfigDao sysTenantConfigDao;
|
|
private SysTenantConfigDao sysTenantConfigDao;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private SysConfigDao sysConfigDao;
|
|
|
|
+ @Autowired
|
|
private RedissonClient redissonClient;
|
|
private RedissonClient redissonClient;
|
|
private static final String tenantKey = "sysTenantConfig";
|
|
private static final String tenantKey = "sysTenantConfig";
|
|
|
|
|
|
@@ -36,13 +39,13 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
|
|
return sysTenantConfigDao;
|
|
return sysTenantConfigDao;
|
|
}
|
|
}
|
|
|
|
|
|
- private ApplicationEventPublisher applicationEventPublisher;
|
|
|
|
|
|
+// private ApplicationEventPublisher applicationEventPublisher;
|
|
|
|
|
|
- @Override
|
|
|
|
- public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
|
|
|
|
- this.applicationEventPublisher = applicationEventPublisher;
|
|
|
|
- applicationEventPublisher.publishEvent(new TenantConfigChangeEvent(this));
|
|
|
|
- }
|
|
|
|
|
|
+// @Override
|
|
|
|
+// public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
|
|
|
|
+// this.applicationEventPublisher = applicationEventPublisher;
|
|
|
|
+// applicationEventPublisher.publishEvent(new TenantConfigChangeEvent(this));
|
|
|
|
+// }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void setTenantConfig(ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> tenantConfig) {
|
|
public void setTenantConfig(ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> tenantConfig) {
|
|
@@ -79,10 +82,17 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
|
|
if(sysConfigs == null || sysConfigs.size() == 0){
|
|
if(sysConfigs == null || sysConfigs.size() == 0){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ //如果是平台账户只改默认值
|
|
|
|
+ if(tenantId < 0){
|
|
|
|
+ sysConfigDao.batchUpdate(sysConfigs);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
List<Long> configIdList = sysConfigs.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
List<Long> configIdList = sysConfigs.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
- sysTenantConfigDao.delByConfigId(configIdList,tenantId);
|
|
|
|
- sysTenantConfigDao.batchInsert(sysConfigs,tenantId);
|
|
|
|
- applicationEventPublisher.publishEvent(new TenantConfigChangeEvent(this,tenantId));
|
|
|
|
|
|
+ if(tenantId > 0){
|
|
|
|
+ sysTenantConfigDao.delByConfigId(configIdList,tenantId);
|
|
|
|
+ sysTenantConfigDao.batchInsert(sysConfigs,tenantId);
|
|
|
|
+ }
|
|
|
|
+// applicationEventPublisher.publishEvent(new TenantConfigChangeEvent(this,tenantId));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|