管理员允许查看各功能使用数据表

This commit is contained in:
2025-09-09 18:48:42 +08:00
parent 4c5d8d3c61
commit aff51a2793

View File

@@ -415,12 +415,25 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
Long accountId = UserContext.getUserHolder().getId(); Long accountId = UserContext.getUserHolder().getId();
Account account = accountService.getById(accountId); Account account = accountService.getById(accountId);
// 允许查看数据的用户id // 允许查看数据的用户id
if (!ADMIN_IDS.contains(account.getId()) if (Objects.isNull(account.getSystemUser())
&& !ADMIN_IDS_READ_ONLY.contains(account.getId()) || (account.getSystemUser() != 5
) { && account.getSystemUser() != 7
&& !ADMIN_IDS.contains(account.getId())
&& !ADMIN_IDS_READ_ONLY.contains(account.getId()))) {
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode()); throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
} }
if ((ids == null || ids.isEmpty()) && (account.getSystemUser() == 5 || account.getSystemUser() == 7)){
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getParentId, accountId).eq(Account::getOrganizationName, account.getOrganizationName());
List<Account> accounts = accountMapper.selectList(queryWrapper);
ids = (accounts != null) ?
accounts.stream()
.map(Account::getId)
.collect(Collectors.toList()) :
new ArrayList<>();
}
log.info("getActiveUserFunc ==> startTime:{}, endTime:{}, accountList:{}", startTime, endTime, ids); log.info("getActiveUserFunc ==> startTime:{}, endTime:{}, accountList:{}", startTime, endTime, ids);
// 必须指定时间区间 // 必须指定时间区间
if (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) { if (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {