|
@@ -1,10 +1,16 @@
|
|
|
package org.brynhild.graduation.timetable.controller;
|
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.brynhild.graduation.common.constant.AccountConstant;
|
|
|
import org.brynhild.graduation.common.transfer.dto.Result;
|
|
|
+import org.brynhild.graduation.common.utils.RequestBodyVerifier;
|
|
|
+import org.brynhild.graduation.timetable.service.ITimeTableService;
|
|
|
import org.brynhild.graduation.transfer.timetable.bo.TimeTableConfig;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.brynhild.graduation.transfer.timetable.vo.AdminQueryClassStatistic;
|
|
|
+import org.brynhild.graduation.transfer.timetable.vo.AdminQueryStudentStatistic;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
@@ -13,7 +19,10 @@ import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/public")
|
|
|
+@RequiredArgsConstructor
|
|
|
public class CommonController {
|
|
|
+ private final RequestBodyVerifier verifier;
|
|
|
+ private final ITimeTableService tableService;
|
|
|
|
|
|
@GetMapping("/config")
|
|
|
public Result getCurrentConfig() {
|
|
@@ -26,4 +35,55 @@ public class CommonController {
|
|
|
config.setTimes(strings);
|
|
|
return new Result(true, "查询成功", config);
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/statistic/class")
|
|
|
+ public Result queryClassStatistic(@RequestBody @Validated AdminQueryClassStatistic info, BindingResult result,
|
|
|
+ @RequestHeader(AccountConstant.ACCOUNT_HEADER)String token){
|
|
|
+ if (result.hasErrors()) {
|
|
|
+ return verifier.convertToErrors(result);
|
|
|
+ }
|
|
|
+ return tableService.queryClassStatistic(info,token);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/statistic/student")
|
|
|
+ public Result queryStudentStatistic(@RequestBody @Validated AdminQueryStudentStatistic info, BindingResult result,
|
|
|
+ @RequestHeader(AccountConstant.ACCOUNT_HEADER)String token){
|
|
|
+ if (result.hasErrors()) {
|
|
|
+ return verifier.convertToErrors(result);
|
|
|
+ }
|
|
|
+ return tableService.queryStudentStatistic(info,token);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/statistic/class")
|
|
|
+ public Result queryClassStatisticPublic(){
|
|
|
+ AdminQueryClassStatistic info=new AdminQueryClassStatistic();
|
|
|
+ info.setId(2L);
|
|
|
+ return tableService.queryClassStatistic(info,"");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/statistic/student")
|
|
|
+ public Result queryStudentStatisticPublic(){
|
|
|
+ AdminQueryStudentStatistic info=new AdminQueryStudentStatistic();
|
|
|
+ info.setId(3L);
|
|
|
+ return tableService.queryStudentStatistic(info,"");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/statistic/class/generate")
|
|
|
+ public Result generateClassStatistic(@RequestBody @Validated AdminQueryClassStatistic info,BindingResult result,
|
|
|
+ @RequestHeader(AccountConstant.ACCOUNT_HEADER)String token){
|
|
|
+ if (result.hasErrors()) {
|
|
|
+ return verifier.convertToErrors(result);
|
|
|
+ }
|
|
|
+ return tableService.generateClassStatistic(info,token);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/statistic/student/generate")
|
|
|
+ public Result generateStudentStatistic(@RequestBody @Validated AdminQueryStudentStatistic info,BindingResult result,
|
|
|
+ @RequestHeader(AccountConstant.ACCOUNT_HEADER)String token){
|
|
|
+ if (result.hasErrors()) {
|
|
|
+ return verifier.convertToErrors(result);
|
|
|
+ }
|
|
|
+ return tableService.generateStudentStatistic(info,token);
|
|
|
+ }
|
|
|
}
|