Parcourir la source

试读报道调整

dzx il y a 8 mois
Parent
commit
6b7a13d55f

+ 6 - 1
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassServiceImpl.java

@@ -52,6 +52,8 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -491,7 +493,6 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
             }
         }
 
-
         dto.setClassId(classId);
         List<StudentReportRecordPlanPageVo> tryReadingList = reportRecordMapper.getTryReadingList(dto);
 
@@ -517,6 +518,10 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
                 .filter(x -> x.getIsReport() == 0)
                 .collect(Collectors.toList());
         result.setNotArrivedCount(notArrivedList.size());
+
+        BigDecimal divide = BigDecimal.valueOf(result.getArrivedCount()).divide(BigDecimal.valueOf(result.getAllCount()), 4, RoundingMode.HALF_UP);
+        result.setReportRate(divide.doubleValue() + "");
+
         return result;
     }
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/banding/vo/BandingTaskClassReportStatisticsVo.java

@@ -62,4 +62,7 @@ public class BandingTaskClassReportStatisticsVo {
 
     @ApiModelProperty("已到女生人数")
     private Integer arrivedFemaleCount;
+
+    @ApiModelProperty("报到率")
+    private String reportRate;
 }

+ 46 - 0
src/main/java/com/xjrsoft/module/student/controller/StudentTryReadingReportController.java

@@ -34,6 +34,7 @@ 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.StudentReportChangeClassBatchDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
 import com.xjrsoft.module.student.dto.StudentReportSignDto;
@@ -180,6 +181,15 @@ public class StudentTryReadingReportController {
         return RT.ok(isSuccess);
     }
 
+    @PostMapping("/change-class-batch")
+    @ApiOperation(value = "批量调整班级")
+    @SaCheckPermission("tryreadingreport:change-class")
+    @XjrLog(value = "调整班级")
+    public RT<Boolean> changeClassBatch(@Valid @RequestBody StudentReportChangeClassBatchDto dto){
+        boolean isSuccess = recordService.changeClassBatch(dto);
+        return RT.ok(isSuccess);
+    }
+
     @PostMapping(value = "/update-stduyStatus")
     @ApiOperation(value="切换就读方式")
     @SaCheckPermission("tryreadingreport:update-stduyStatus")
@@ -418,6 +428,42 @@ public class StudentTryReadingReportController {
             divide = BigDecimal.valueOf(statisticsVo.getArrivedCount()).divide(BigDecimal.valueOf(statisticsVo.getAllCount()), 4, RoundingMode.HALF_UP);
         }
         statisticsVo.setReportRate(divide.doubleValue());
+
+        //查询年级趋势
+        List<BaseGrade> gradeList = gradeService.list(
+                new QueryWrapper<BaseGrade>().lambda()
+                        .eq(BaseGrade::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(BaseGrade::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .eq(BaseGrade::getStatus, 1)
+                        .orderByDesc(BaseGrade::getTitle)
+        );
+        List<ItemCountVo> gradeDataList = new ArrayList<>();
+        for (int i = 0; i < gradeList.size(); i ++){
+            BaseGrade baseGrade = gradeList.get(i);
+
+            List<EnrollmentPlan> enrollmentPlans = enrollmentPlanService.list(
+                    new QueryWrapper<EnrollmentPlan>().lambda()
+                            .eq(EnrollmentPlan::getEnrollType, dto.getEnrollType())
+                            .eq(EnrollmentPlan::getGradeId, baseGrade.getId())
+                            .eq(EnrollmentPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                            .eq(EnrollmentPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                            .orderByDesc(EnrollmentPlan::getId)
+            );
+            int gradeCount = 0;
+            for (EnrollmentPlan enrollmentPlan : enrollmentPlans) {
+                StudentTryReadingReportPageDto gradeRecordPageDto = new StudentTryReadingReportPageDto();
+                gradeRecordPageDto.setEnrollmentPlanId(enrollmentPlan.getId());
+                gradeRecordPageDto.setIsReport(1);
+                gradeCount += recordService.getTryReadingList(recordPageDto).size();
+            }
+            ItemCountVo itemCountVo = new ItemCountVo();
+            itemCountVo.setItem(baseGrade.getName());
+            itemCountVo.setCount(gradeCount);
+            gradeDataList.add(itemCountVo);
+        }
+
+        statisticsVo.setGradeList(gradeDataList);
+
         return RT.ok(statisticsVo);
     }
 

+ 24 - 0
src/main/java/com/xjrsoft/module/student/dto/StudentReportChangeClassBatchDto.java

@@ -0,0 +1,24 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+* @title: 学生报到计划分页查询入参
+* @Author dzx
+* @Date: 2025-01-21
+* @Version 1.0
+*/
+@Data
+public class StudentReportChangeClassBatchDto {
+
+    @ApiModelProperty("主键ids")
+    private List<Long> ids;
+
+
+    @ApiModelProperty("班级id")
+    private Long classId;
+}

+ 9 - 0
src/main/java/com/xjrsoft/module/student/service/IStudentReportRecordService.java

@@ -3,6 +3,7 @@ package com.xjrsoft.module.student.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.banding.dto.ChangeClassDto;
+import com.xjrsoft.module.student.dto.StudentReportChangeClassBatchDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
 import com.xjrsoft.module.student.dto.StudentReportSignDto;
@@ -56,5 +57,13 @@ public interface IStudentReportRecordService extends MPJBaseService<StudentRepor
 
     Boolean tryReadingSign(StudentReportSignDto dto);
 
+    /**
+     * 试读报到或者新生报到调整班级
+     */
     Boolean changeClass(StudentReportSignDto dto);
+
+    /**
+     * 试读报到或者新生报到批量调整班级
+     */
+    Boolean changeClassBatch(StudentReportChangeClassBatchDto dto);
 }

+ 27 - 1
src/main/java/com/xjrsoft/module/student/service/impl/StudentReportRecordServiceImpl.java

@@ -32,6 +32,7 @@ import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.service.IUserRoleRelationService;
 import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.student.dto.StudentReportChangeClassBatchDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
 import com.xjrsoft.module.student.dto.StudentReportSignDto;
@@ -65,6 +66,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
 
 /**
 * @title: 学生报到记录表
@@ -440,7 +442,7 @@ public class StudentReportRecordServiceImpl extends MPJBaseServiceImpl<StudentRe
      * @return
      */
     @Override
-    @Transactional(rollbackFor = Exception.class)
+        @Transactional(rollbackFor = Exception.class)
     public Boolean changeClass(StudentReportSignDto dto) {
         StudentReportRecord record = this.getById(dto.getId());
         record.setReportTime(new Date());
@@ -488,6 +490,30 @@ public class StudentReportRecordServiceImpl extends MPJBaseServiceImpl<StudentRe
         return true;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean changeClassBatch(StudentReportChangeClassBatchDto dto) {
+        List<StudentReportRecord> records = this.listByIds(dto.getIds());
+        List<Long> newStudentIds = records.stream().map(StudentReportRecord::getUserId).collect(Collectors.toList());
+        List<BandingTaskClassStudent> classStudents = taskClassStudentService.list(
+                new QueryWrapper<BandingTaskClassStudent>().lambda()
+                        .eq(BandingTaskClassStudent::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(BandingTaskClassStudent::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .in(BandingTaskClassStudent::getNewStudentId, newStudentIds)
+        );
+        if(!classStudents.isEmpty()){
+            throw new MyException("选择了已分班的学生,无法调整班级");
+        }
+        for (Long id : dto.getIds()) {
+            this.changeClass(new StudentReportSignDto(){{
+                setId(id);
+                setClassId(dto.getClassId());
+            }});
+        }
+
+        return true;
+    }
+
     LocalDate getBirthDate(String idCardNumber){
         // 获取出生日期前6位,即yyyyMM
         String birthdayString = idCardNumber.substring(6, 14);

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

@@ -76,4 +76,7 @@ public class StudentReportRecordStatisticsVo {
     @ApiModelProperty("专业部报到情况")
     private List<ItemCountVo> deptList;
 
+    @ApiModelProperty("年级报到情况")
+    private List<ItemCountVo> gradeList;
+
 }