package com.yunhai.userhome.controller.api; import com.yunhai.platform.utils.model.BoaUser; import com.yunhai.userhome.config.Config; import com.yunhai.userhome.entity.SchSettings; import com.yunhai.userhome.service.ISchSettingsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.Optional; /** * 学校设置接口(CAS 登录态,路径 {@code /{platform}/}),对齐旧 UserHome SchSettingsController。 *
getSchSettings 实际跨仓调用 schConfig(见 SchSettingsServiceImpl); * saveSchTheme/saveSchLogo(P1)本期写入本地 sch_settings 表(跨仓回写可后续对接)。
*/ @RestController @RequestMapping(value = Config.API_PATH) public class SchSettingsController { @Autowired private ISchSettingsService schSettingsService; private Integer resolveSchId(BoaUser user) { if (user.getSchool() != null) { return user.getSchool().getId(); } if (user.getBureau() != null) { return user.getBureau().getId(); } return 0; } @PostMapping("saveSchTheme") public void saveSchTheme(BoaUser authUserWithDept, String themeName, @RequestParam(name = "schId", defaultValue = "0") Integer schId) { if (schId == null || schId == 0) { schId = resolveSchId(authUserWithDept); } SchSettings schSettings = new SchSettings(); Optional