|
@@ -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(
|