企业账号也可以调用【查询配置的模块和菜单列表】接口

This commit is contained in:
guoshengxiong 2024-07-26 17:17:19 +08:00
parent 7274a8bf00
commit 51b7745ad3
4 changed files with 22 additions and 8 deletions

View File

@ -216,11 +216,11 @@ public class BaseModuleController {
}
}
@ApiOperation(value = "查询项目配置的模块和菜单列表", notes = "查询项目配置的模块和菜单列表", httpMethod = "POST")
@ApiOperation(value = "查询配置的模块和菜单列表", notes = "查询配置的模块和菜单列表", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "moduleType", value = "模块类型1企业模块2项目后台模块3企业后台4项目看板", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/getModuleAndMenuList")
public Result<Map<String, Object>> getModuleAndMenuList(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {

View File

@ -9,6 +9,9 @@
<if test="projectSelectType == '1'.toString()">
and a.module_type in (2,4)
</if>
<if test="moduleType != null and moduleType != ''">
and a.module_type = #{moduleType}
</if>
ORDER BY a.module_type,a.label_sort_num,a.label_name,a.module_id
</select>
<select id="getProjectModuleList" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseModule">

View File

@ -1,12 +1,10 @@
package com.zhgd.xmgl.modules.basicdata.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
import com.zhgd.xmgl.modules.basicdata.entity.CompanyConfig;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
@ -20,6 +18,7 @@ import com.zhgd.xmgl.modules.basicdata.service.IBaseAuthorityService;
import com.zhgd.xmgl.modules.basicdata.service.IBaseModuleService;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -27,7 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Description: 模块
@ -48,6 +46,9 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
private SystemUserServiceImpl systemUserService;
@Autowired
private CompanyConfigMapper companyConfigMapper;
@Lazy
@Autowired
private CompanyConfigServiceImpl companyConfigService;
@Autowired
private IBaseAuthorityService baseAuthorityService;
@ -105,10 +106,13 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
if (systemUser == null) {
throw new OpenAlertException("账号不存在");
}
if (StrUtil.isBlank(projectSn)) {
throw new OpenAlertException("projectSn不能为空");
CompanyConfig companyConfig;
if (StrUtil.isNotBlank(projectSn)) {
companyConfig = companyConfigMapper.getCompanyConfigByProject(projectSn);
} else {
//企业类型
companyConfig = companyConfigMapper.getCompanyConfigBySn(systemUser.getSn());
}
CompanyConfig companyConfig = companyConfigMapper.getCompanyConfigByProject(projectSn);
if (companyConfig == null) {
throw new OpenAlertException("企业配置不存在");
}
@ -116,6 +120,11 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
return systemUserService.getUserAuthority(null, SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue(), projectSn, companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), moduleType);
} else if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue()) || Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
return systemUserService.getUserAuthority(Long.valueOf(userId), systemUser.getAccountType(), projectSn, companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), moduleType);
} else if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())
|| Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue())
|| Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_CITY_ACCOUNT.getValue())
|| Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_SUB_ACCOUNT.getValue())) {
return systemUserService.getUserAuthority(Long.valueOf(userId), systemUser.getAccountType(), systemUser.getSn(), companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), moduleType);
}
return null;
}

View File

@ -1049,12 +1049,14 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
param.put("styleType", styleType);
if (Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())) {
param.put("headquartersSn", headquartersSn);
param.put("moduleType", moduleType);
moduleList = baseModuleMapper.getCompanyModuleList(param);
menuList = baseMenuService.selectHeadquartersMenuList(param);
actionList = baseActionMapper.getHeadquartersActionList(param);
data.put("roleName", "公司管理员");
} else if (Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue()) || Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_CITY_ACCOUNT.getValue()) || Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_SUB_ACCOUNT.getValue())) {
param.put("userId", userId);
param.put("moduleType", moduleType);
moduleList = baseModuleMapper.getUserModuleList(param);
menuList = baseMenuService.selectComapnyUserMenuList(param);
actionList = baseActionMapper.getComapnyUserActionList(param);