修改上传接口
build / build-push (push) Successful in 52s

This commit is contained in:
chenxing
2026-08-24 18:48:21 +08:00
parent a7539a4cf0
commit 5a7adb9ce3
15 changed files with 112 additions and 40 deletions
@@ -30,16 +30,22 @@ public class MenuBarController {
@GetMapping("getMenuBarSchList")
public List<MenuBar> getMenuBarSchList(BoaUser authUserWithDept) {
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new com.yunhai.platform.apistd.BizException(com.yunhai.platform.utils.exception.ErrorCode.INTERNAL_SERVER_ERROR));
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!userCurrentRoleOpt.isPresent()) {
return new ArrayList<>();
}
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
return menuBarService.getMenuBarList(userCurrentRole.getSchId());
}
@GetMapping("getMenuBarList")
public List<Map> getMenuBarList(BoaUser authUserWithDept) {
List<Map> result = new ArrayList<>();
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new com.yunhai.platform.apistd.BizException(com.yunhai.platform.utils.exception.ErrorCode.INTERNAL_SERVER_ERROR));
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!userCurrentRoleOpt.isPresent()) {
return result;
}
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
Integer roleId = userCurrentRole.getRoleId();
if (roleId == 7 || roleId == 2) roleId = 2;
Boolean isSuperAdmin = authUserWithDept.getType() == 1;
@@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
@@ -24,10 +26,12 @@ public class SocketController {
private String websocketUrl;
@GetMapping("getMsgAddress")
public String getMsgAddress(BoaUser authUserWithDept) {
public Map<String, String> getMsgAddress(BoaUser authUserWithDept) {
Integer uid = authUserWithDept.getId();
UUID uuid = UUID.randomUUID();
MapCacheUtil.getInstance().add(uuid.toString(), uid.toString(), 20 * 1000L);
return this.websocketUrl + "/" + uuid.toString();
Map<String, String> result = new HashMap<>();
result.put("url", this.websocketUrl + "/" + uuid.toString());
return result;
}
}
@@ -30,16 +30,22 @@ public class StatsBarController {
@GetMapping("getStatsBarSchList")
public List<StatsBar> getStatsBarSchList(BoaUser authUserWithDept) {
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new com.yunhai.platform.apistd.BizException(com.yunhai.platform.utils.exception.ErrorCode.INTERNAL_SERVER_ERROR));
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!userCurrentRoleOpt.isPresent()) {
return new ArrayList<>();
}
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
return statsBarService.getStatsBarList(userCurrentRole.getSchId());
}
@GetMapping("getStatsBarList")
public List<Map> getStatsBarList(BoaUser authUserWithDept) {
List<Map> result = new ArrayList<>();
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new com.yunhai.platform.apistd.BizException(com.yunhai.platform.utils.exception.ErrorCode.INTERNAL_SERVER_ERROR));
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!userCurrentRoleOpt.isPresent()) {
return result;
}
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
Integer roleId = userCurrentRole.getRoleId();
if (roleId == 7 || roleId == 2) roleId = 2;
Boolean isSuperAdmin = authUserWithDept.getType() == 1;
@@ -30,16 +30,22 @@ public class TeacherCopilotController {
@GetMapping("TeacherCopilot/getSchList")
public List<TeacherCopilot> getList(BoaUser authUserWithDept) {
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new com.yunhai.platform.apistd.BizException(com.yunhai.platform.utils.exception.ErrorCode.INTERNAL_SERVER_ERROR));
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!userCurrentRoleOpt.isPresent()) {
return new ArrayList<>();
}
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
return teacherCopilotService.getList(userCurrentRole.getSchId());
}
@GetMapping("TeacherCopilot/getUserList")
public List<TeacherCopilot.Dto> getUserList(BoaUser authUserWithDept) {
List<TeacherCopilot.Dto> result = new ArrayList<>();
UserCurrentRole userCurrentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new com.yunhai.platform.apistd.BizException(com.yunhai.platform.utils.exception.ErrorCode.INTERNAL_SERVER_ERROR));
Optional<UserCurrentRole> userCurrentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!userCurrentRoleOpt.isPresent()) {
return result;
}
UserCurrentRole userCurrentRole = userCurrentRoleOpt.get();
Integer roleId = userCurrentRole.getRoleId();
if (roleId == 7 || roleId == 2) roleId = 2;
Boolean isSuperAdmin = authUserWithDept.getType() == 1;
@@ -81,8 +81,10 @@ public class UserSettingsController {
}
@PostMapping(value = "iconUpload", produces = "application/json")
public String iconUpload(BoaUser authUserWithDept, @RequestParam("file") MultipartFile file) {
return this.upload(file, "icon");
public Map<String, String> iconUpload(BoaUser authUserWithDept, @RequestParam("file") MultipartFile file) {
Map<String, String> result = new HashMap<>();
result.put("url", this.upload(file, "icon"));
return result;
}
@PostMapping(value = "deleteWallById", produces = "application/json")
@@ -127,16 +129,15 @@ public class UserSettingsController {
@GetMapping(value = "getUserSettings")
public UserSettings getUserSettings(BoaUser authUserWithDept) {
UserCurrentRole currentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
Integer schId = currentRole.getSchId();
Optional<UserCurrentRole> currentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
Integer schId = currentRoleOpt.isPresent() ? currentRoleOpt.get().getSchId() : null;
UserSettings model = new UserSettings();
Optional<UserSettings> optional = userSettingsService.findUserSettings(authUserWithDept.getId());
// TODO 待确认:bschBaseOpenApi.getPcGrzxPage —— 新框架 YschBaseOpenApi 是否有此方法待确认
// List<BoaApp> appPageList = bschBaseOpenApi.getPcGrzxPage(authUserWithDept.getId(), schId);
List<BoaApp> appPageList = Collections.emptyList();
if (optional.isPresent()) model = optional.get();
if (model.getWallpaperUrl() == null || model.getWallpaperUrl().isEmpty()) {
if ((model.getWallpaperUrl() == null || model.getWallpaperUrl().isEmpty()) && schId != null) {
List<String> schList = getSchSettingsWallpaper(schId);
if (schList.size() > 0) model.setWallpaperUrl(schList.get(0));
}
@@ -155,8 +156,11 @@ public class UserSettingsController {
@GetMapping(value = "getUserDesktopAppList")
public List<Map> getUserDesktopAppList(BoaUser authUserWithDept) {
UserCurrentRole currentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
Optional<UserCurrentRole> currentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!currentRoleOpt.isPresent()) {
return new ArrayList<>();
}
UserCurrentRole currentRole = currentRoleOpt.get();
Optional<UserSettings> optional = userSettingsService.findUserSettings(authUserWithDept.getId());
Integer schId = currentRole.getSchId(), userId = currentRole.getUserId();
UserSettings model = new UserSettings();
@@ -246,16 +250,21 @@ public class UserSettingsController {
@GetMapping(value = "getLightAppList", produces = "application/json")
public List<LightApp> getLightAppList(BoaUser authUserWithDept) {
UserCurrentRole currentRole = userCurrentRoleService.findById(authUserWithDept.getId())
.orElseThrow(() -> new BizException(ErrorCode.INTERNAL_SERVER_ERROR));
Integer schId, userId = null;
if (authUserWithDept.getType() == 1) {
schId = 0;
} else if (currentRole.getRoleId() == 7 || currentRole.getRoleId() == 2) {
schId = currentRole.getSchId();
} else {
schId = currentRole.getSchId();
userId = currentRole.getUserId();
Optional<UserCurrentRole> currentRoleOpt = userCurrentRoleService.findById(authUserWithDept.getId());
if (!currentRoleOpt.isPresent()) {
return new ArrayList<>();
}
UserCurrentRole currentRole = currentRoleOpt.get();
if (currentRole.getRoleId() == 7 || currentRole.getRoleId() == 2) {
schId = currentRole.getSchId();
} else {
schId = currentRole.getSchId();
userId = currentRole.getUserId();
}
}
return userSettingsService.findLightAppList(schId, userId);
}
@@ -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());
}
+2 -2
View File
@@ -41,7 +41,7 @@ yh:
enabled: true
sso:
# CAS 单点登录(浏览器 SSO 重定向 / ticket 校验)
server-url-prefix: https://sso.yunhaixingtong.com/cas/
server-url-prefix: http://sso.yunhaixingtong.com/cas/
# 本地 context-path=/、端口 8070;prod 由 Nacos 的 yh.sso.client-host-url 覆盖
client-host-url: http://localhost:8070
allow-headers: all
@@ -58,7 +58,7 @@ yh:
# yh-openapi 开放接口客户端(前缀必须是 yh.open,OpenApiProperties 绑定;base-host + base-path 拼出
# 完整跨仓基址,openapi 客户端再拼 /oapi/** 端点;app-key/app-secret 同时驱动应用间签名)
enabled: true
base-host: http://localhost:8060
base-host: http://base.yunhaixingtong.com
base-path: /userbase
app-key: 100001
app-secret: ec4e860206374c80938719fff8e14a86