Browse Source

Merge remote-tracking branch 'origin/dev' into dev

大数据与最优化研究所 1 month ago
parent
commit
dbeed96091

+ 18 - 5
src/main/java/com/xjrsoft/module/student/controller/StudentReportPlanController.java

@@ -13,6 +13,7 @@ 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.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseSemesterService;
 import com.xjrsoft.module.student.dto.AddStudentReportPlanDto;
 import com.xjrsoft.module.student.dto.StudentReportPlanPageDto;
@@ -21,7 +22,7 @@ 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.StudentReportPlanClassRelationVo;
 import com.xjrsoft.module.student.vo.StudentReportPlanPageVo;
 import com.xjrsoft.module.student.vo.StudentReportPlanTreeVo;
 import com.xjrsoft.module.student.vo.StudentReportPlanVo;
@@ -41,6 +42,7 @@ import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -59,6 +61,7 @@ public class StudentReportPlanController {
 
     private final IStudentReportPlanService studentReportPlanService;
     private final IBaseSemesterService semesterService;
+    private final IBaseClassService classService;
 
     @GetMapping(value = "/page")
     @ApiOperation(value="学生报到计划列表(分页)")
@@ -77,7 +80,17 @@ public class StudentReportPlanController {
         if (studentReportPlan == null) {
            return RT.error("找不到此数据!");
         }
-        return RT.ok(BeanUtil.toBean(studentReportPlan, StudentReportPlanVo.class));
+        StudentReportPlanVo planVo = BeanUtil.toBean(studentReportPlan, StudentReportPlanVo.class);
+        List<Long> classIds = studentReportPlan.getStudentReportPlanClassRelationList().stream().map(StudentReportPlanClassRelation::getClassId).collect(Collectors.toList());
+
+        List<BaseClass> classList = classService.listByIds(classIds);
+        Map<Long, String> classMaps = classList.stream().collect(Collectors.toMap(BaseClass::getId, BaseClass::getName));
+        List<StudentReportPlanClassRelationVo> classRelationList = planVo.getStudentReportPlanClassRelationList();
+        for (StudentReportPlanClassRelationVo baseClass : classRelationList) {
+            baseClass.setClassName(classMaps.get(baseClass.getClassId()));
+        }
+
+        return RT.ok(planVo);
     }
 
 
@@ -118,13 +131,13 @@ public class StudentReportPlanController {
         }
         //如果发布,需要先验证计划中的班级是否在其他生效的计划内
         if(dto.getStatus() != null && dto.getStatus() == 1){
-            if(reportPlan.getStudentReportPlanClassRelationList() == null || !reportPlan.getStudentReportPlanClassRelationList().isEmpty()){
+            if(reportPlan.getStudentReportPlanClassRelationList() == null || reportPlan.getStudentReportPlanClassRelationList().isEmpty()){
                 return RT.error("未选择班级,无法进行发布");
             }
             List<Long> classIds = reportPlan.getStudentReportPlanClassRelationList()
                     .stream().map(StudentReportPlanClassRelation::getClassId).collect(Collectors.toList());
             List<BaseClass> classList = studentReportPlanService.validateClass(dto.getId(), classIds);
-            if(classList.isEmpty()){
+            if(!classList.isEmpty()){
                 Set<String> classNames = classList.stream().map(BaseClass::getName).collect(Collectors.toSet());
                 return RT.error(classNames.toString().replace("[", "").replace("]", "") + "已在其他计划中,无法发布");
             }
@@ -151,7 +164,7 @@ public class StudentReportPlanController {
     @GetMapping(value = "/tree")
     @ApiOperation(value="学期计划树")
     @SaCheckPermission("studentreportplan:detail")
-    public RT<List<StudentReportPlanTreeVo>> tree(@RequestParam Long id){
+    public RT<List<StudentReportPlanTreeVo>> tree(){
         List<Integer> statusList = new ArrayList<>();
         statusList.add(1);statusList.add(2);
         List<StudentReportPlan> list = studentReportPlanService.list(

+ 2 - 2
src/main/java/com/xjrsoft/module/student/entity/StudentReportPlan.java

@@ -64,13 +64,13 @@ public class StudentReportPlan implements Serializable {
     @ApiModelProperty("删除标记(0:未删除 1:已删除)")
     @TableField(fill = FieldFill.INSERT)
     @TableLogic
-    private Object deleteMark;
+    private Integer deleteMark;
     /**
     * 有效标记(0:未启用 1:已启用)
     */
     @ApiModelProperty("有效标记(0:未启用 1:已启用)")
     @TableField(fill = FieldFill.INSERT)
-    private Object enabledMark;
+    private Integer enabledMark;
     /**
     * 学期id(base_semester)
     */

+ 3 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentReportPlanClassRelationVo.java

@@ -28,6 +28,9 @@ public class StudentReportPlanClassRelationVo {
     @ApiModelProperty("班级id")
     private Long classId;
 
+    @ApiModelProperty("班级名称")
+    private String className;
+
 
 
 }

+ 5 - 1
src/main/java/com/xjrsoft/module/student/vo/StudentReportPlanPageVo.java

@@ -29,7 +29,7 @@ public class StudentReportPlanPageVo {
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("创建人")
     @ApiModelProperty("创建人")
-    private Long createUserId;
+    private String createUserName;
     /**
     * 创建时间
     */
@@ -72,6 +72,10 @@ public class StudentReportPlanPageVo {
     @ExcelProperty("学期id(base_semester)")
     @ApiModelProperty("学期id(base_semester)")
     private Long semesterId;
+
+    @ApiModelProperty("所属学期")
+    private String semesterName;
+
     /**
     * 计划名称
     */

+ 1 - 1
src/main/resources/mapper/student/StudentReportPlanMapper.xml

@@ -5,7 +5,7 @@
 <mapper namespace="com.xjrsoft.module.student.mapper.StudentReportPlanMapper">
     <select id="getPage" parameterType="com.xjrsoft.module.student.dto.StudentReportPlanPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportPlanPageVo">
         SELECT t1.id,t1.name,t3.name AS semester_name,t1.start_time,t1.end_time,
-        t1.update_end_time,t1.update_start_time,t1.status,t1.create_date,
+        t1.update_end_time,t1.update_start_time,t1.status,t1.create_date,t1.semester_id,
         t2.name AS create_user_name FROM student_report_plan t1
         LEFT JOIN xjr_user t2 ON t1.create_user_id = t2.id
         INNER JOIN base_semester t3 ON t1.semester_id = t3.id