This commit is contained in:
2026-08-14 09:04:58 +08:00
parent 863c4f5c13
commit ea13c4ea7c
16 changed files with 74 additions and 69 deletions
@@ -13,6 +13,7 @@ import com.yunhai.bschclassmanage.service.ISchBinSchsystemService;
import com.yunhai.bschclassmanage.utils.LogContextHolder;
import com.yunhai.bschclassmanage.utils.OtherUtil;
import com.yunhai.bschclassmanage.utils.UserContext;
import com.yunhai.platform.utils.exception.DException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -42,7 +43,7 @@ public class SchsystemController {
boolean isAreaAdmin = UserRole.AREAADMIN.getValue().equals(roleId);
if (!isSuperAdmin && !isAreaAdmin) {
throw new NullPointerException("无权操作,仅超级管理员或学校管理员可设置学制");
throw new DException("无权操作,仅超级管理员或学校管理员可设置学制");
}
// 3. 确定最终操作的学校ID,并校验
@@ -51,11 +52,11 @@ public class SchsystemController {
// 区域管理员:强制使用自己所属的学校,忽略前端传入的schId
targetSchId = UserContext.getSchId();
if (targetSchId == null || targetSchId <= 0) {
throw new NullPointerException("当前学校管理员未关联有效的学校");
throw new DException("当前学校管理员未关联有效的学校");
}
} else { // 超管
if (schId == null || schId <= 0) {
throw new NullPointerException("学校ID不能为空且必须为正整数");
throw new DException("学校ID不能为空且必须为正整数");
}
targetSchId = schId;
}
@@ -85,7 +86,7 @@ public class SchsystemController {
boolean isAreaAdmin = UserRole.AREAADMIN.getValue().equals(roleId);
if (!isSuperAdmin && !isAreaAdmin) {
throw new NullPointerException("无权操作,仅超级管理员或学校管理员可设置学制");
throw new DException("无权操作,仅超级管理员或学校管理员可设置学制");
}
// 3. 确定最终操作的学校ID,并校验
@@ -94,11 +95,11 @@ public class SchsystemController {
// 区域管理员:强制使用自己所属的学校,忽略前端传入的schId
targetSchId = UserContext.getSchId();
if (targetSchId == null || targetSchId <= 0) {
throw new NullPointerException("当前学校管理员未关联有效的学校");
throw new DException("当前学校管理员未关联有效的学校");
}
} else { // 超管
if (schId == null || schId <= 0) {
throw new NullPointerException("学校ID不能为空且必须为正整数");
throw new DException("学校ID不能为空且必须为正整数");
}
targetSchId = schId;
}
@@ -112,7 +113,7 @@ public class SchsystemController {
LogContextHolder.setDescription(String.format("为学校 %d 绑定学制:%s", schName,String.join(",",schsystemNames) ));
if (schsystemIds == null || schsystemIds.length == 0) {
throw new NullPointerException("学制ID列表无效");
throw new DException("学制ID列表无效");
}
SchBinSchsystem entity=new SchBinSchsystem();
OtherUtil.setBaseEntityValue(user, entity);