排课功能优化
This commit is contained in:
+95
@@ -1,7 +1,10 @@
|
||||
package com.roomroot.web.controller.jwgl;
|
||||
|
||||
import com.roomroot.common.exception.ServiceException;
|
||||
import com.roomroot.jwgl.dto.scheduling.SchedulingArrangeRequest;
|
||||
import com.roomroot.jwgl.dto.scheduling.SchedulingCellOpRequest;
|
||||
import com.roomroot.jwgl.dto.scheduling.SchedulingCourseEditRequest;
|
||||
import com.roomroot.jwgl.service.RunningCoursePublishService;
|
||||
import com.roomroot.jwgl.service.SchedulingWindowService;
|
||||
import com.roomroot.jwgl.unit.Result;
|
||||
import com.roomroot.jwgl.vo.scheduling.SchedulingViewVO;
|
||||
@@ -14,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -30,6 +35,9 @@ public class SchedulingWindowController {
|
||||
@Autowired
|
||||
private SchedulingWindowService schedulingWindowService;
|
||||
|
||||
@Autowired
|
||||
private RunningCoursePublishService runningCoursePublishService;
|
||||
|
||||
/**
|
||||
* 排课窗组合视图:班次头 + 课程列表(排满标绿)+ 周次×星期×节次格子。
|
||||
*/
|
||||
@@ -84,4 +92,91 @@ public class SchedulingWindowController {
|
||||
@RequestParam(value = "czlx", required = false) String czlx) {
|
||||
return Result.success(schedulingWindowService.logs(sskcbh, czlx));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑课程教学任务信息(手册 12.3.1):学时/周课时/课程简称/责任教员/默认场地。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('teach:schedulingWindow:edit')")
|
||||
@PostMapping("/course/update")
|
||||
public Result<Map<String, Object>> updateCourse(@RequestBody SchedulingCourseEditRequest request) {
|
||||
return Result.success(schedulingWindowService.updateCourse(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 教学班次(合班)当前列表 + 候选班次(手册 12.3.2.2)。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('teach:schedulingWindow:list')")
|
||||
@GetMapping("/course/teams")
|
||||
public Result<Map<String, Object>> courseTeams(@RequestParam("sskcbh") String sskcbh) {
|
||||
return Result.success(schedulingWindowService.courseTeams(sskcbh));
|
||||
}
|
||||
|
||||
/**
|
||||
* 教学保障选项:保障类别 + 保障资源(含总量与计量单位,手册 12.3.2.5)。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('teach:schedulingWindow:list')")
|
||||
@GetMapping("/support/options")
|
||||
public Result<Map<String, Object>> supportOptions() {
|
||||
return Result.success(schedulingWindowService.supportOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量发布【运行课表】(手册 12.1):把班次学期的课程任务发布为运行课程。
|
||||
*
|
||||
* <p>发布前要求教学任务已发布未结束、责任教员与默认场地齐备;逐个班次独立事务,
|
||||
* 单个失败不影响其它班次,失败原因逐条返回。</p>
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('teach:schedulingWindow:edit')")
|
||||
@PostMapping("/publish")
|
||||
public Result<List<Map<String, Object>>> publish(@RequestBody PublishRequest request) {
|
||||
return Result.success(batchPublish(request, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【运行课表】(手册 12.2):撤回该班次学期的运行课程,已排课次一并删除。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('teach:schedulingWindow:edit')")
|
||||
@PostMapping("/withdraw")
|
||||
public Result<List<Map<String, Object>>> withdraw(@RequestBody PublishRequest request) {
|
||||
return Result.success(batchPublish(request, false));
|
||||
}
|
||||
|
||||
/** 批量发布/撤回公共实现 */
|
||||
private List<Map<String, Object>> batchPublish(PublishRequest request, boolean publish) {
|
||||
if (request == null || request.getXydxqbhs() == null || request.getXydxqbhs().isEmpty()) {
|
||||
throw new ServiceException("请选择要操作的班次学期", 400);
|
||||
}
|
||||
List<Map<String, Object>> results = new ArrayList<>();
|
||||
for (String xydxqbh : request.getXydxqbhs()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("xydxqbh", xydxqbh);
|
||||
try {
|
||||
int count = publish
|
||||
? runningCoursePublishService.publish(xydxqbh)
|
||||
: runningCoursePublishService.withdraw(xydxqbh);
|
||||
item.put("success", true);
|
||||
item.put("count", count);
|
||||
item.put("message", publish ? ("已发布 " + count + " 条运行课程") : ("已删除 " + count + " 条运行课程"));
|
||||
} catch (Exception e) {
|
||||
item.put("success", false);
|
||||
item.put("count", 0);
|
||||
item.put("message", e.getMessage() == null ? "操作失败" : e.getMessage());
|
||||
}
|
||||
results.add(item);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/** 批量发布/删除请求体 */
|
||||
public static class PublishRequest {
|
||||
private List<String> xydxqbhs;
|
||||
|
||||
public List<String> getXydxqbhs() {
|
||||
return xydxqbhs;
|
||||
}
|
||||
|
||||
public void setXydxqbhs(List<String> xydxqbhs) {
|
||||
this.xydxqbhs = xydxqbhs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -70,4 +70,16 @@ public class TeacherCalendarController {
|
||||
public Result<List<JYL>> listByRq(@RequestParam("rq") String rq) {
|
||||
return Result.success(jylService.listByRq(rq));
|
||||
}
|
||||
|
||||
/** 批量保存教员历(教员历编辑器整片提交,按 教员+日期+节次 幂等覆盖) */
|
||||
@PostMapping("/batchSave")
|
||||
public Result<Integer> batchSave(@RequestBody List<JYL> list) {
|
||||
return Result.success(jylService.batchSave(list));
|
||||
}
|
||||
|
||||
/** 批量删除教员历(本表无 del_flag,物理删除) */
|
||||
@PostMapping("/batchDelete")
|
||||
public Result<Integer> batchDelete(@RequestBody List<String> bhs) {
|
||||
return Result.success(jylService.batchDelete(bhs));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user