Quellcode durchsuchen

试读报道报错调整

dzx vor 8 Monaten
Ursprung
Commit
1fe4625ac4

+ 42 - 2
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassServiceImpl.java

@@ -36,7 +36,13 @@ import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
 import com.xjrsoft.module.student.dto.StudentTryReadingReportPageDto;
+import com.xjrsoft.module.student.entity.EnrollmentPlan;
+import com.xjrsoft.module.student.entity.StudentReportPlan;
+import com.xjrsoft.module.student.mapper.EnrollmentPlanMapper;
+import com.xjrsoft.module.student.mapper.StudentReportPlanMapper;
 import com.xjrsoft.module.student.mapper.StudentReportRecordMapper;
+import com.xjrsoft.module.student.service.IEnrollmentPlanService;
+import com.xjrsoft.module.student.service.IStudentReportPlanService;
 import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.system.entity.DictionaryItem;
@@ -71,6 +77,10 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
     private final DictionarydetailMapper detailMapper;
     private final BaseClassMapper classMapper;
     private final StudentReportRecordMapper reportRecordMapper;
+    private final EnrollmentPlanMapper enrollmentPlanMapper;
+    private final IStudentReportPlanService reportPlanService;
+
+
     @Override
     public Boolean add(BandingTaskClass bandingTaskClass) {
         bandingTaskClass.setCreateDate(new Date());
@@ -450,8 +460,38 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
     @Override
     public BandingTaskClassReportStatisticsVo getTryReadingReportClassStatistics(Long classId) {
         BandingTaskClassReportStatisticsVo result = new BandingTaskClassReportStatisticsVo();
-
         StudentTryReadingReportPageDto dto = new StudentTryReadingReportPageDto();
+        if(classId == 0L){
+            StudentReportPlan plan = reportPlanService.getLastTryReadingPlan();
+            BandingTask bandingTask = bandingTaskMapper.selectById(plan.getBandingTaskId());
+            List<EnrollmentPlan> enrollmentPlans = enrollmentPlanMapper.selectList(
+                    new QueryWrapper<EnrollmentPlan>().lambda()
+                            .eq(EnrollmentPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                            .eq(EnrollmentPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                            .eq(EnrollmentPlan::getEnrollType, bandingTask.getEnrollType())
+                            .eq(EnrollmentPlan::getGradeId, bandingTask.getGradeId())
+                            .orderByDesc(EnrollmentPlan::getId)
+            );
+            if(!enrollmentPlans.isEmpty()){
+                dto.setEnrollmentPlanId(enrollmentPlans.get(0).getId());
+            }
+        }else{
+            BandingTaskClass taskClass = this.getById(classId);
+            BandingTask task = bandingTaskMapper.selectById(taskClass.getBandingTaskId());
+            List<EnrollmentPlan> enrollmentPlanList = enrollmentPlanMapper.selectList(
+                    new QueryWrapper<EnrollmentPlan>().lambda()
+                            .eq(EnrollmentPlan::getEnrollType, task.getEnrollType())
+                            .eq(EnrollmentPlan::getGradeId, task.getGradeId())
+                            .eq(EnrollmentPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                            .eq(EnrollmentPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                            .orderByDesc(EnrollmentPlan::getId)
+            );
+            if(!enrollmentPlanList.isEmpty()){
+                dto.setEnrollmentPlanId(enrollmentPlanList.get(0).getId());
+            }
+        }
+
+
         dto.setClassId(classId);
         List<StudentReportRecordPlanPageVo> tryReadingList = reportRecordMapper.getTryReadingList(dto);
 
@@ -474,7 +514,7 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
         result.setArrivedCount(arrivedList.size());
         //未到人数
         List<StudentReportRecordPlanPageVo> notArrivedList = tryReadingList.stream()
-                .filter(x -> x.getIsReport() == 1)
+                .filter(x -> x.getIsReport() == 0)
                 .collect(Collectors.toList());
         result.setNotArrivedCount(notArrivedList.size());
         return result;

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

@@ -255,7 +255,7 @@ public class StudentReportPlanController {
                         .eq(BandingTask::getGradeId, enrollmentPlan.getGradeId())
         );
         if (plan == null) {
-            return RT.ok(new StudentReportPlanVo());
+            return RT.error("未能查询到有报到学生,无法设置");
         }
         return RT.ok(BeanUtil.toBean(plan, StudentReportPlanVo.class));
     }

+ 24 - 3
src/main/java/com/xjrsoft/module/student/controller/StudentTryReadingReportController.java

@@ -30,14 +30,20 @@ import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.service.IBaseGradeService;
 import com.xjrsoft.module.base.service.IBaseSemesterService;
 import com.xjrsoft.module.databoard.vo.ItemCountVo;
+import com.xjrsoft.module.organization.dto.GetUserByParamDto;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.student.dto.ChangeBandingStatusDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
 import com.xjrsoft.module.student.dto.StudentReportSignDto;
 import com.xjrsoft.module.student.dto.StudentTryReadingReportPageDto;
+import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.entity.EnrollmentPlan;
 import com.xjrsoft.module.student.entity.StudentReportPlan;
 import com.xjrsoft.module.student.entity.StudentReportRecord;
+import com.xjrsoft.module.student.service.IBaseNewStudentService;
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
 import com.xjrsoft.module.student.service.IEnrollmentPlanService;
 import com.xjrsoft.module.student.service.IStudentReportPlanService;
 import com.xjrsoft.module.student.service.IStudentReportRecordService;
@@ -53,6 +59,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
@@ -85,6 +92,9 @@ public class StudentTryReadingReportController {
     private final IBaseGradeService gradeService;
     private final IEnrollmentPlanService enrollmentPlanService;
     private final IBandingTaskService bandingTaskService;
+    private final IUserService userService;
+    private final IBaseStudentSchoolRollService rollService;
+    private final IBaseNewStudentService newStudentService;
 
 
     @GetMapping(value = "/page")
@@ -126,6 +136,17 @@ public class StudentTryReadingReportController {
         List<Long> list = new ArrayList<>();
         list.add(record.getUserId());
         classStudentService.removeStudent(list, reportPlan.getBandingTaskId());
+        BaseNewStudent newStudent = newStudentService.getById(record.getUserId());
+        if(newStudent != null){
+            User user = userService.getUserByParam(new GetUserByParamDto() {{
+                setCredentialNumber(newStudent.getCredentialNumber());
+            }});
+            if(user != null){
+                rollService.disableStudent(user.getId());
+            }
+        }
+
+
         return RT.ok(true);
     }
 
@@ -206,7 +227,7 @@ public class StudentTryReadingReportController {
     @GetMapping(value = "/class-list")
     @ApiOperation(value="查询班级信息")
     @SaCheckPermission("studentreportrecord:detail")
-    @XjrLog(value = "导出")
+    @XjrLog(value = "查询班级信息")
     public RT<List<BandingTaskClassPageVo>> classList(@Valid StudentReportRecordPageDto dto){
         BandingTaskClassPageDto classDto = new BandingTaskClassPageDto();
         if(dto.getEnrollmentPlanId() == null){
@@ -244,8 +265,8 @@ public class StudentTryReadingReportController {
     @GetMapping(value = "/class-statistics")
     @ApiOperation(value="班级数据统计")
     @SaCheckPermission("studentreportrecord:detail")
-    @XjrLog(value = "导出")
-    public RT<BandingTaskClassReportStatisticsVo> classStatistics(@Valid Long classId){
+    @XjrLog(value = "班级数据统计")
+    public RT<BandingTaskClassReportStatisticsVo> classStatistics(@RequestParam Long classId){
         return RT.ok(bandingTaskClassService.getTryReadingReportClassStatistics(classId));
     }