@@ -43,8 +43,11 @@ public class MenuBarServiceImpl implements IMenuBarService {
|
||||
|
||||
@Override
|
||||
public List<MenuBar> findMenuBarById(Integer userId) {
|
||||
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(userId)
|
||||
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
|
||||
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(userId);
|
||||
if (!userCurrentRoleOpt.isPresent()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
|
||||
List<MenuBar> list = getMenuBarList(userCurrentRole.getSchId());
|
||||
List<MenuBar> result = list.stream().filter(MenuBar::getIsShow).collect(Collectors.toList());
|
||||
result = result.stream().sorted(Comparator.comparing(MenuBar::getOrderNum, Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList());
|
||||
|
||||
@@ -42,8 +42,11 @@ public class StatsBarServiceImpl implements IStatsBarService {
|
||||
|
||||
@Override
|
||||
public List<StatsBar> findStatsBarById(Integer userId) {
|
||||
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(userId)
|
||||
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
|
||||
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(userId);
|
||||
if (!userCurrentRoleOpt.isPresent()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
|
||||
List<StatsBar> list = getStatsBarList(userCurrentRole.getSchId());
|
||||
List<StatsBar> result = list.stream().filter(StatsBar::getIsShow).collect(Collectors.toList());
|
||||
result = result.stream().sorted(Comparator.comparing(StatsBar::getOrderNum, Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList());
|
||||
|
||||
@@ -42,8 +42,11 @@ public class TeacherCopilotServiceImpl implements ITeacherCopilotService {
|
||||
|
||||
@Override
|
||||
public List<TeacherCopilot> findById(Integer userId) {
|
||||
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(userId)
|
||||
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
|
||||
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(userId);
|
||||
if (!userCurrentRoleOpt.isPresent()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
|
||||
List<TeacherCopilot> list = getList(userCurrentRole.getSchId());
|
||||
List<TeacherCopilot> result = list.stream().filter(TeacherCopilot::getIsShow).collect(Collectors.toList());
|
||||
result = result.stream().sorted(Comparator.comparing(TeacherCopilot::getOrderNum, Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList());
|
||||
|
||||
@@ -44,8 +44,11 @@ public class UserSettingsServiceImpl implements IUserSettingsService {
|
||||
|
||||
@Override
|
||||
public List<Wallpaper> findWallList(Integer userId) {
|
||||
UserCurrentRole currentRole = userCurrentRoleService.findById(userId)
|
||||
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
|
||||
Optional<UserCurrentRole> currentRoleOpt = userCurrentRoleService.findById(userId);
|
||||
if (!currentRoleOpt.isPresent()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
UserCurrentRole currentRole = currentRoleOpt.get();
|
||||
List<Wallpaper> resultList = new ArrayList<>();
|
||||
List<Wallpaper> baseList = wallpaperRepository.findBySchIdAndType(0, 0);
|
||||
List<Wallpaper> schList = wallpaperRepository.findBySchIdAndType(currentRole.getSchId(), 1);
|
||||
@@ -80,8 +83,11 @@ public class UserSettingsServiceImpl implements IUserSettingsService {
|
||||
|
||||
@Override
|
||||
public Optional<UserSettings> findUserSettings(Integer userId) {
|
||||
UserCurrentRole currentRole = userCurrentRoleService.findById(userId)
|
||||
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
|
||||
Optional<UserCurrentRole> currentRoleOpt = userCurrentRoleService.findById(userId);
|
||||
if (!currentRoleOpt.isPresent()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
UserCurrentRole currentRole = currentRoleOpt.get();
|
||||
return userSettingsRepository.findByUserIdAndSchIdAndRoleId(currentRole.getUserId(), currentRole.getSchId(), currentRole.getRoleId());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user