|
@@ -6,20 +6,24 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.usky.common.core.exception.BusinessException;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
-import com.usky.system.domain.SysTenantConfig;
|
|
|
-import com.usky.system.domain.SysTenantPlatform;
|
|
|
+import com.usky.system.domain.*;
|
|
|
import com.usky.system.mapper.SysTenantPlatformMapper;
|
|
|
+import com.usky.system.service.ISysMenuService;
|
|
|
+import com.usky.system.service.SysPlatformMenuService;
|
|
|
import com.usky.system.service.SysPlatformService;
|
|
|
import com.usky.system.service.SysTenantPlatformService;
|
|
|
import com.usky.system.service.vo.SysPlatformVo;
|
|
|
import com.usky.system.service.vo.TenantPlatformListVo;
|
|
|
+import com.usky.system.service.vo.TenantPlatformMenuVo;
|
|
|
import com.usky.system.service.vo.TenantPlatformVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -35,6 +39,12 @@ public class SysTenantPlatformServiceImpl extends AbstractCrudService<SysTenantP
|
|
|
@Autowired
|
|
|
private SysPlatformService sysPlatformService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysPlatformMenuService sysPlatformMenuService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysMenuService menuService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void updateTenantPlatform(TenantPlatformVo tenantPlatformVo) {
|
|
@@ -55,7 +65,7 @@ public class SysTenantPlatformServiceImpl extends AbstractCrudService<SysTenantP
|
|
|
.eq(SysTenantPlatform::getIsDefault,1);
|
|
|
List<SysTenantPlatform> list = this.list(queryWrapper1);
|
|
|
if (list.size()<=0){
|
|
|
- throw new BusinessException("不允许操作超级管理员用户");
|
|
|
+ throw new BusinessException("没有相关关联数据,请联系管理员");
|
|
|
}
|
|
|
for (int i = 0; i < arr.length; i++){
|
|
|
if (!arr[i].equals(list.get(0).getPlatformId())){
|
|
@@ -97,4 +107,39 @@ public class SysTenantPlatformServiceImpl extends AbstractCrudService<SysTenantP
|
|
|
}
|
|
|
return list2;
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String, Object> selectTenantPlatform(Integer tenantId){
|
|
|
+ LambdaQueryWrapper<SysTenantPlatform> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(SysTenantPlatform::getTenantId,tenantId);
|
|
|
+ List<SysTenantPlatform> list = this.list(queryWrapper);
|
|
|
+ List<TenantPlatformMenuVo> list1 = new ArrayList<>();
|
|
|
+ Long[] arr = sysPlatformMenuService.selectPlatformMenu(tenantId);
|
|
|
+ Map<String, Object> ajax = new HashMap<>();
|
|
|
+ ajax.put("checkedKeys",arr);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ List<Integer> platformIds = new ArrayList<>();
|
|
|
+ for(int j=0;j<list.size();j++){
|
|
|
+ platformIds.add(list.get(j).getPlatformId());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<SysPlatform> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper1.in(SysPlatform::getId,platformIds);
|
|
|
+ List<SysPlatform> platformList = sysPlatformService.list(queryWrapper1);
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
+ TenantPlatformMenuVo tenantPlatformMenuVo = new TenantPlatformMenuVo();
|
|
|
+ tenantPlatformMenuVo.setId(list.get(i).getPlatformId());
|
|
|
+ if (CollectionUtils.isNotEmpty(platformList)){
|
|
|
+ for(int k=0;k<platformList.size();k++){
|
|
|
+ if (list.get(i).getPlatformId().equals(platformList.get(k).getId())){
|
|
|
+ tenantPlatformMenuVo.setLabel(platformList.get(k).getPlatformName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<SysMenu> menus = sysPlatformMenuService.getPlatformMenuList(list.get(i).getPlatformId());
|
|
|
+ tenantPlatformMenuVo.setChildren(menuService.buildMenuTreeSelect(menus));
|
|
|
+ list1.add(tenantPlatformMenuVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ajax.put("menus",list1);
|
|
|
+ return ajax;
|
|
|
+ }
|
|
|
}
|