Browse Source

学生报到计划

dzx 1 month ago
parent
commit
04cc6febd1

+ 57 - 0
src/main/java/com/xjrsoft/module/student/controller/StudentReportPlanController.java

@@ -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);
+    }
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/student/controller/StudentReportRecordController.java

@@ -319,4 +319,6 @@ public class StudentReportRecordController {
         return RT.ok(statisticsVo);
     }
 
+
+
 }

+ 6 - 2
src/main/java/com/xjrsoft/module/student/dto/AddStudentReportPlanDto.java

@@ -2,8 +2,10 @@ package com.xjrsoft.module.student.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.util.Date;
 import java.util.List;
 
@@ -43,13 +45,15 @@ public class AddStudentReportPlanDto implements Serializable {
     /**
     * 数据修改开始时间
     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @ApiModelProperty("数据修改开始时间")
-    private Date updateStartTime;
+    private LocalDate updateStartTime;
     /**
     * 数据修改结束时间
     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @ApiModelProperty("数据修改结束时间")
-    private Date updateEndTime;
+    private LocalDate updateEndTime;
     /**
     * 状态(0:草稿 1:进行中 2:已结束)
     */

+ 32 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentReportPlanTreeVo.java

@@ -0,0 +1,32 @@
+package com.xjrsoft.module.student.vo;
+
+import com.xjrsoft.common.model.tree.ITreeNode;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author dzx
+ * @date 2024年6月27日
+ */
+@Data
+public class StudentReportPlanTreeVo implements ITreeNode<StudentReportPlanTreeVo, Long>, Serializable {
+
+    @ApiModelProperty("id")
+    private Long id;
+
+    @ApiModelProperty("name")
+    private String name;
+
+    @ApiModelProperty("disabled")
+    private Long parentId;
+
+    @ApiModelProperty("children")
+    private List<StudentReportPlanTreeVo> children;
+
+    @ApiModelProperty("状态(1:进行中,2:已结束)")
+    private Integer status;
+
+}