|
@@ -3,12 +3,17 @@ package com.xjrsoft.module.student.controller;
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
+import com.xjrsoft.common.utils.TreeUtil;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
+import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
+import com.xjrsoft.module.base.service.IBaseSemesterService;
|
|
|
import com.xjrsoft.module.student.dto.AddStudentReportPlanDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportPlanPageDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportPlanStatusDto;
|
|
@@ -16,7 +21,9 @@ import com.xjrsoft.module.student.dto.UpdateStudentReportPlanDto;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportPlan;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportPlanClassRelation;
|
|
|
import com.xjrsoft.module.student.service.IStudentReportPlanService;
|
|
|
+import com.xjrsoft.module.student.vo.BaseStudentTreeVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportPlanPageVo;
|
|
|
+import com.xjrsoft.module.student.vo.StudentReportPlanTreeVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportPlanVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -31,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
@@ -50,6 +58,7 @@ public class StudentReportPlanController {
|
|
|
|
|
|
|
|
|
private final IStudentReportPlanService studentReportPlanService;
|
|
|
+ private final IBaseSemesterService semesterService;
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
|
@ApiOperation(value="学生报到计划列表(分页)")
|
|
@@ -137,4 +146,52 @@ public class StudentReportPlanController {
|
|
|
}
|
|
|
return RT.ok(true);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "/tree")
|
|
|
+ @ApiOperation(value="学期计划树")
|
|
|
+ @SaCheckPermission("studentreportplan:detail")
|
|
|
+ public RT<List<StudentReportPlanTreeVo>> tree(@RequestParam Long id){
|
|
|
+ List<Integer> statusList = new ArrayList<>();
|
|
|
+ statusList.add(1);statusList.add(2);
|
|
|
+ List<StudentReportPlan> list = studentReportPlanService.list(
|
|
|
+ new QueryWrapper<StudentReportPlan>().lambda()
|
|
|
+ .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .in(StudentReportPlan::getStatus, statusList)
|
|
|
+ );
|
|
|
+ Set<Long> semesterIds = list.stream().map(StudentReportPlan::getSemesterId).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ List<BaseSemester> semesterList = semesterService.list(
|
|
|
+ new QueryWrapper<BaseSemester>().lambda()
|
|
|
+ .eq(BaseSemester::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .orderByDesc(BaseSemester::getName)
|
|
|
+ );
|
|
|
+
|
|
|
+ List<StudentReportPlanTreeVo> resultList = new ArrayList<>();
|
|
|
+ for (BaseSemester baseSemester : semesterList) {
|
|
|
+ if(!semesterIds.contains(baseSemester.getId())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ resultList.add(
|
|
|
+ new StudentReportPlanTreeVo(){{
|
|
|
+ setId(baseSemester.getId());
|
|
|
+ setName(baseSemester.getName());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ list.forEach((e->{
|
|
|
+ resultList.add(
|
|
|
+ new StudentReportPlanTreeVo(){{
|
|
|
+ setId(e.getId());
|
|
|
+ setName(e.getName());
|
|
|
+ setParentId(e.getSemesterId());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }));
|
|
|
+
|
|
|
+
|
|
|
+ List<StudentReportPlanTreeVo> treeVoList = TreeUtil.build(resultList);
|
|
|
+ return RT.ok(treeVoList);
|
|
|
+ }
|
|
|
}
|