@@ -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