1课表模板管理;

2、课表生成;
3、课表的网格视图;
4、导出与打印
This commit is contained in:
2026-09-18 09:02:41 +08:00
parent 971ea46da5
commit 911dfe911b
16 changed files with 1864 additions and 0 deletions
@@ -1,17 +1,24 @@
package com.roomroot.web.controller.jwgl;
import com.roomroot.jwgl.dto.kcb.TimetableGridQuery;
import com.roomroot.jwgl.dto.kcb.TimetableQuery;
import com.roomroot.jwgl.entity.KCB;
import com.roomroot.jwgl.service.KCBService;
import com.roomroot.jwgl.service.TimetableGridService;
import com.roomroot.jwgl.unit.PageQuery;
import com.roomroot.jwgl.unit.PageResult;
import com.roomroot.jwgl.unit.Result;
import com.roomroot.jwgl.vo.kcb.ClassTimetableVO;
import com.roomroot.jwgl.vo.kcb.DailyWeeklyTimetableRangeVO;
import com.roomroot.jwgl.vo.kcb.TimetableGridVO;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.util.List;
/**
@@ -24,6 +31,9 @@ public class KCBController {
@Resource
private KCBService kcbService;
@Resource
private TimetableGridService timetableGridService;
/**
* 新增
*/
@@ -133,4 +143,27 @@ public class KCBController {
public void exportClassCourses(TimetableQuery cond, HttpServletResponse response) {
kcbService.exportClassCourses(cond, response);
}
/**
* 周次横版课表网格(手册一第12章)。
* <p>dim=semester|team|teacher|roomid 为对应编号;可传 mbbh 套用课表模板。</p>
*/
@GetMapping("/grid")
public Result<TimetableGridVO> grid(TimetableGridQuery query) {
return Result.success(timetableGridService.grid(query));
}
/**
* 网格课表矩阵 Excel 导出(每周一个 sheet,节次 × 星期)。
*/
@GetMapping("/grid/export")
public ResponseEntity<byte[]> exportGrid(TimetableGridQuery query) {
byte[] bytes = timetableGridService.exportGrid(query);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
String name = "课表_" + query.getDim() + ".xlsx";
headers.setContentDispositionFormData("attachment",
new String(name.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
return ResponseEntity.ok().headers(headers).body(bytes);
}
}
@@ -0,0 +1,63 @@
package com.roomroot.web.controller.jwgl;
import com.roomroot.jwgl.entity.KCBMBB;
import com.roomroot.jwgl.service.KCBMBService;
import com.roomroot.jwgl.unit.PageQuery;
import com.roomroot.jwgl.unit.PageResult;
import com.roomroot.jwgl.unit.Result;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.List;
/**
* 课表模版管理(手册一第12章;CRUD + 启停 + 下拉选项)
*/
@RestController
@RequestMapping("/kcbmb")
public class KCBMBController {
@Resource
private KCBMBService kcbmbService;
@GetMapping("/list")
public Result<PageResult<KCBMBB>> list(PageQuery query, @RequestParam(required = false) String mbmc) {
return Result.success(kcbmbService.page(query, mbmc));
}
@GetMapping("/get")
public Result<KCBMBB> get(@RequestParam("bh") String bh) {
return Result.success(kcbmbService.get(bh));
}
/** 可用模板下拉(课表生成页套用选择) */
@GetMapping("/options")
public Result<List<KCBMBB>> options() {
return Result.success(kcbmbService.options());
}
@PostMapping("/add")
public Result<Void> add(@RequestBody KCBMBB tpl) {
kcbmbService.add(tpl);
return Result.success();
}
@PostMapping("/update")
public Result<Void> update(@RequestBody KCBMBB tpl) {
kcbmbService.update(tpl);
return Result.success();
}
@PostMapping("/delete")
public Result<Void> delete(@RequestParam("bh") String bh) {
kcbmbService.delete(bh);
return Result.success();
}
/** 启用/停用模版 */
@PostMapping("/toggle")
public Result<Void> toggle(@RequestParam("bh") String bh, @RequestParam("enabled") boolean enabled) {
kcbmbService.toggle(bh, enabled);
return Result.success();
}
}