Kaynağa Gözat

1、机构账户修改conf应该改默认值
2、subject/queryPageTree 接口没有数据隔离

zouxuan 3 yıl önce
ebeveyn
işleme
c1be6d1fea

+ 21 - 29
mec-biz/src/main/java/com/ym/mec/biz/event/listener/TenantConfigListener.java

@@ -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);
+//            }
+//        }
     }
 }

+ 0 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java

@@ -44,8 +44,6 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
     private SubjectGoodsMapperDao subjectGoodsMapperDao;
     @Autowired
     private ChargeTypeOrganizationFeeDao chargeTypeOrganizationFeeDao;
-    @Autowired
-    private MusicGroupDao musicGroupDao;
 
     @Override
     public BaseDAO<Integer, Subject> getDAO() {

+ 13 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysTenantConfigServiceImpl.java

@@ -1,5 +1,6 @@
 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.entity.SysConfig;
 import com.ym.mec.biz.dal.entity.SysTenantConfig;
@@ -28,6 +29,8 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 	@Autowired
 	private SysTenantConfigDao sysTenantConfigDao;
 	@Autowired
+	private SysConfigDao sysConfigDao;
+	@Autowired
 	private RedissonClient redissonClient;
 	private static final String tenantKey = "sysTenantConfig";
 
@@ -79,10 +82,17 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 		if(sysConfigs == null || sysConfigs.size() == 0){
 			return;
 		}
+		//如果是平台账户只改默认值
+		if(tenantId < 0){
+			sysConfigDao.batchUpdate(sysConfigs);
+			return;
+		}
 		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

+ 1 - 0
mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -174,6 +174,7 @@
 
     <sql id="querySubPageSql">
         <where>
+            tenant_id_ = #{tenantId}
             <if test="parentId != null">
                 AND parent_subject_id_ = #{parentId}
             </if>