Pārlūkot izejas kodu

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

# Conflicts:
#	src/main/resources/sqlScript/20250120_sql.sql
大数据与最优化研究所 9 mēneši atpakaļ
vecāks
revīzija
3c982869fb
22 mainītis faili ar 466 papildinājumiem un 157 dzēšanām
  1. 3 0
      src/main/java/com/xjrsoft/module/base/service/IBaseSemesterService.java
  2. 15 0
      src/main/java/com/xjrsoft/module/base/service/impl/BaseSemesterServiceImpl.java
  3. 68 0
      src/main/java/com/xjrsoft/module/job/StudentReportPlanTask.java
  4. 4 2
      src/main/java/com/xjrsoft/module/schedule/util/DataUtil.java
  5. 14 1
      src/main/java/com/xjrsoft/module/student/controller/StudentReportPlanController.java
  6. 100 32
      src/main/java/com/xjrsoft/module/student/controller/StudentReportRecordController.java
  7. 3 0
      src/main/java/com/xjrsoft/module/student/dto/StudentReportRecordStatisticsDto.java
  8. 1 1
      src/main/java/com/xjrsoft/module/student/mapper/StudentReportPlanMapper.java
  9. 3 0
      src/main/java/com/xjrsoft/module/student/mapper/StudentReportRecordMapper.java
  10. 1 1
      src/main/java/com/xjrsoft/module/student/service/IStudentReportPlanService.java
  11. 10 2
      src/main/java/com/xjrsoft/module/student/service/impl/StudentReportPlanServiceImpl.java
  12. 35 16
      src/main/java/com/xjrsoft/module/student/service/impl/StudentReportRecordServiceImpl.java
  13. 68 0
      src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordExcelVo.java
  14. 30 0
      src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordItemVo.java
  15. 3 0
      src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordPlanPageVo.java
  16. 3 0
      src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordStatisticsListVo.java
  17. 6 3
      src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordStatisticsVo.java
  18. 1 0
      src/main/resources/mapper/student/BaseStudentMapper.xml
  19. 1 1
      src/main/resources/mapper/student/StudentReportPlanMapper.xml
  20. 42 8
      src/main/resources/mapper/student/StudentReportRecordMapper.xml
  21. 51 44
      src/main/resources/sqlScript/20250120_sql.sql
  22. 4 46
      src/test/java/com/xjrsoft/module/job/JianyuekbBaseDataTaskTest.java

+ 3 - 0
src/main/java/com/xjrsoft/module/base/service/IBaseSemesterService.java

@@ -14,4 +14,7 @@ import com.xjrsoft.module.base.entity.BaseSemester;
 public interface IBaseSemesterService extends IService<BaseSemester> {
 
     BaseSemester getCurrentSemester();
+
+
+    Long getLastSemester();
 }

+ 15 - 0
src/main/java/com/xjrsoft/module/base/service/impl/BaseSemesterServiceImpl.java

@@ -39,4 +39,19 @@ public class BaseSemesterServiceImpl extends ServiceImpl<BaseSemesterMapper, Bas
         BaseSemester baseSemester = semesterList.get(0);
         return baseSemester;
     }
+
+
+    @Override
+    public Long getLastSemester() {
+        List<BaseSemester> semesterList = this.list(
+                new QueryWrapper<BaseSemester>().lambda()
+                        .eq(BaseSemester::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .orderByDesc(BaseSemester::getStartDate)
+        );
+        if(semesterList.isEmpty()){
+            return null;
+        }
+        BaseSemester baseSemester = semesterList.get(0);
+        return baseSemester.getId();
+    }
 }

+ 68 - 0
src/main/java/com/xjrsoft/module/job/StudentReportPlanTask.java

@@ -0,0 +1,68 @@
+package com.xjrsoft.module.job;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.module.student.entity.StudentReportPlan;
+import com.xjrsoft.module.student.service.IBaseStudentService;
+import com.xjrsoft.module.student.service.IStudentReportPlanService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 学生报到相关计划调整
+ * @author dzx
+ * @date 2025年2月10日
+ */
+@Component
+@Slf4j
+public class StudentReportPlanTask {
+
+    @Autowired
+    private IStudentReportPlanService planService;
+
+
+    @Scheduled(cron = "0 */15 * * * ?")
+    public void execute() {
+        doExecute();
+    }
+
+    public void doExecute(){
+        //查询已发布未开始的,自动开始
+        LocalDateTime now = LocalDateTime.now();
+        List<StudentReportPlan> list = planService.list(
+                new QueryWrapper<StudentReportPlan>().lambda()
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(StudentReportPlan::getStatus, 1)
+                        .eq(StudentReportPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .le(StudentReportPlan::getStartTime, now)
+                        .ge(StudentReportPlan::getEndTime, now)
+        );
+
+        for (StudentReportPlan studentReportPlan : list) {
+            planService.release(studentReportPlan);
+        }
+
+        //查询已发布已结束的,自动结束
+        List<StudentReportPlan> endList = planService.list(
+                new QueryWrapper<StudentReportPlan>().lambda()
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(StudentReportPlan::getStatus, 1)
+                        .eq(StudentReportPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .le(StudentReportPlan::getEndTime, now)
+        );
+        for (StudentReportPlan studentReportPlan : endList) {
+            studentReportPlan.setStatus(2);
+            planService.updateById(studentReportPlan);
+        }
+    }
+
+}
+

+ 4 - 2
src/main/java/com/xjrsoft/module/schedule/util/DataUtil.java

@@ -322,7 +322,7 @@ public class DataUtil {
      * 新增学期
      */
     public Map<String, String> insertSemester(String tableName, Map<String, String> ids) throws Exception {
-        String sql = "select * from " + tableName + " where delete_mark = 0";
+        String sql = "select * from " + tableName + " where delete_mark = 0 order by start_date desc limit 3";
         List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql, BaseSemester.class);
 
         Map<String, String> idMap = new HashMap<>();
@@ -369,7 +369,9 @@ public class DataUtil {
             String result = ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
 
             JsonObject resultJson = jsonParser.parse(result).getAsJsonObject();
-            idMap.put(semester.getId().toString(), resultJson.get("data").getAsString());
+            if(StrUtil.isNotEmpty(resultJson.get("data").getAsString())){
+                idMap.put(semester.getId().toString(), resultJson.get("data").getAsString());
+            }
         }
         //插入记录表
         insertRecord(tableName, idMap);

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

@@ -6,6 +6,7 @@ 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.enums.EnabledMark;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
@@ -131,6 +132,17 @@ public class StudentReportPlanController {
         }
         //如果发布,需要先验证计划中的班级是否在其他生效的计划内
         if(dto.getStatus() != null && dto.getStatus() == 1){
+            List<StudentReportPlan> list = studentReportPlanService.list(
+                    new QueryWrapper<StudentReportPlan>().lambda()
+                            .ne(StudentReportPlan::getId, reportPlan.getId())
+                            .eq(StudentReportPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                            .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                            .eq(StudentReportPlan::getStatus, 1)
+                            .ne(StudentReportPlan::getSemesterId, reportPlan.getSemesterId())
+            );
+            if(!list.isEmpty()){
+                throw new MyException("已存在正在进行的计划,无法发布");
+            }
             if(reportPlan.getStudentReportPlanClassRelationList() == null || reportPlan.getStudentReportPlanClassRelationList().isEmpty()){
                 return RT.error("未选择班级,无法进行发布");
             }
@@ -146,7 +158,7 @@ public class StudentReportPlanController {
                 return RT.error("已发布,无法再次发布");
             }
 
-            studentReportPlanService.release(reportPlan);
+//            studentReportPlanService.release(reportPlan);
             reportPlan.setStatus(dto.getStatus());
             reportPlan.setModifyDate(new Date());
             reportPlan.setModifyUserId(StpUtil.getLoginIdAsLong());
@@ -199,6 +211,7 @@ public class StudentReportPlanController {
                         setId(e.getId());
                         setName(e.getName());
                         setParentId(e.getSemesterId());
+                        setStatus(e.getStatus());
                     }}
             );
         }));

+ 100 - 32
src/main/java/com/xjrsoft/module/student/controller/StudentReportRecordController.java

@@ -10,8 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xjrsoft.common.enums.DeleteMark;
-import com.xjrsoft.common.enums.EnabledMark;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.EnrollTypeEnum;
 import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.RoleCodeEnum;
@@ -20,11 +19,13 @@ import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.entity.BaseSemester;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseGradeService;
 import com.xjrsoft.module.base.service.IBaseSemesterService;
+import com.xjrsoft.module.base.vo.BaseClassPageVo;
 import com.xjrsoft.module.databoard.vo.ItemCountVo;
 import com.xjrsoft.module.student.dto.AddStudentReportRecordDto;
 import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
@@ -32,10 +33,12 @@ import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
 import com.xjrsoft.module.student.dto.StudentReportSignDto;
 import com.xjrsoft.module.student.dto.UpdateStudentReportRecordDto;
 import com.xjrsoft.module.student.entity.StudentReportPlan;
+import com.xjrsoft.module.student.entity.StudentReportPlanClassRelation;
 import com.xjrsoft.module.student.entity.StudentReportRecord;
 import com.xjrsoft.module.student.service.IStudentReportPlanService;
 import com.xjrsoft.module.student.service.IStudentReportRecordService;
-import com.xjrsoft.module.student.vo.BaseMajorCategorPageVo;
+import com.xjrsoft.module.student.vo.StudentReportRecordExcelVo;
+import com.xjrsoft.module.student.vo.StudentReportRecordItemVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordPageVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
 import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo;
@@ -58,6 +61,7 @@ import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Date;
@@ -198,7 +202,7 @@ public class StudentReportRecordController {
     @SaCheckPermission("studentreportrecord:detail")
     public RT<StudentReportRecordStatisticsVo> classStatistics(@Valid StudentReportRecordStatisticsDto dto){
 
-        if(dto.getTeacherId() == null){
+        if(dto.getTeacherId() == null && dto.getClassId() == null){
             dto.setTeacherId(StpUtil.getLoginIdAsLong());
         }
         if(dto.getBaseSemesterId() == null){
@@ -211,7 +215,7 @@ public class StudentReportRecordController {
                 dto.setBaseSemesterId(semesterList.get(0).getId());
             }
         }
-        if(dto.getGradeId() == null){
+        if(dto.getGradeId() == null && dto.getClassId() == null){
             LambdaQueryWrapper<BaseGrade> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper
                     .orderByDesc(BaseGrade::getTitle)
@@ -222,7 +226,7 @@ public class StudentReportRecordController {
             }
         }
 
-        Long planId = planService.getEffectivePlanId(dto.getTeacherId());
+        Long planId = planService.getEffectivePlanId(dto.getTeacherId(), dto.getClassId());
         dto.setStudentReportPlanId(planId);
 
         StudentReportRecordStatisticsVo statisticsVo = studentReportRecordService.getClassStatistics(dto);
@@ -244,7 +248,7 @@ public class StudentReportRecordController {
     @ApiOperation(value="领导统计")
     @SaCheckPermission("studentreportrecord:detail")
     public RT<StudentReportRecordStatisticsVo> statistics(@Valid StudentReportRecordStatisticsDto dto){
-        if(dto.getGradeId() == null){
+        if(dto.getGradeId() == null && (dto.getCategory() == null || dto.getCategory() == 1)){
             LambdaQueryWrapper<BaseGrade> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper
                     .orderByDesc(BaseGrade::getTitle)
@@ -257,6 +261,9 @@ public class StudentReportRecordController {
         if(dto.getEnrollType() == null || dto.getEnrollType().isEmpty()){
             dto.setEnrollType(EnrollTypeEnum.AUTUMN_ENROLLMENT.getCode());
         }
+        if(dto.getCategory() != null && dto.getCategory() == 2 && dto.getBaseSemesterId() == null){
+            dto.setBaseSemesterId(semesterService.getLastSemester());
+        }
         List<StudentReportRecordStatisticsListVo> dataList = studentReportRecordService.getStatisticsDataList(dto);
         StudentReportRecordStatisticsVo statisticsVo = new StudentReportRecordStatisticsVo();
         statisticsVo.setAllCount(dataList.stream().count());
@@ -286,54 +293,81 @@ public class StudentReportRecordController {
                         && StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatus())
                         && x.getReportTime() != null
         ).count());
-        Map<String, List<StudentReportRecordStatisticsListVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getGraduatedUniversity));
-        List<ItemCountVo> graduatedUniversityList = new ArrayList<>();
-        for (String graduatedUniversity : graduatedUniversityMap.keySet()) {
-            graduatedUniversityList.add(
-                    new ItemCountVo(){{
-                        setItem(graduatedUniversity);
-                        setCount(graduatedUniversityMap.get(graduatedUniversity).size());
-                    }}
-            );
+
+        if(dto.getCategory() != null && dto.getCategory() == 1){
+            Map<String, List<StudentReportRecordStatisticsListVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getGraduatedUniversity));
+            List<ItemCountVo> graduatedUniversityList = new ArrayList<>();
+            for (String graduatedUniversity : graduatedUniversityMap.keySet()) {
+                graduatedUniversityList.add(
+                        new ItemCountVo(){{
+                            setItem(graduatedUniversity);
+                            setCount(graduatedUniversityMap.get(graduatedUniversity).size());
+                        }}
+                );
+            }
+            statisticsVo.setGraduatedUniversityList(graduatedUniversityList);
         }
-        statisticsVo.setGraduatedUniversityList(graduatedUniversityList);
 
         Map<String, List<StudentReportRecordStatisticsListVo>> classMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassName));
-        List<ItemCountVo> classList = new ArrayList<>();
+        Map<String, List<StudentReportRecordStatisticsListVo>> classNotMap = dataList.stream().filter(x -> x.getReportTime() == null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassName));
+        List<StudentReportRecordItemVo> classList = new ArrayList<>();
         for (String className : classMap.keySet()) {
             classList.add(
-                    new ItemCountVo(){{
+                    new StudentReportRecordItemVo(){{
                         setItem(className);
                         setCount(classMap.get(className).size());
+                        if(classNotMap.get(className) != null && !(classNotMap.get(className).isEmpty())){
+                            setCount2(classNotMap.get(className).size());
+                        }
                     }}
             );
         }
         statisticsVo.setClassList(classList);
 
         Map<String, List<StudentReportRecordStatisticsListVo>> classTypeMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassType));
-        List<ItemCountVo> classTypeList = new ArrayList<>();
+        Map<String, List<StudentReportRecordStatisticsListVo>> classTypeNotMap = dataList.stream().filter(x -> x.getReportTime() == null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassType));
+        List<StudentReportRecordItemVo> classTypeList = new ArrayList<>();
         for (String classType : classTypeMap.keySet()) {
             classTypeList.add(
-                    new ItemCountVo(){{
+                    new StudentReportRecordItemVo(){{
                         setItem(classType);
                         setCount(classTypeMap.get(classType).size());
+                        if(classTypeNotMap.get(classType) != null && !(classTypeNotMap.get(classType).isEmpty())){
+                            setCount2(classTypeNotMap.get(classType).size());
+                        }
                     }}
             );
         }
         statisticsVo.setClassTypeList(classTypeList);
 
         Map<String, List<StudentReportRecordStatisticsListVo>> majorMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getMajorName));
-        List<ItemCountVo> majorList = new ArrayList<>();
+        Map<String, List<StudentReportRecordStatisticsListVo>> majorNotMap = dataList.stream().filter(x -> x.getReportTime() == null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getMajorName));
+        List<StudentReportRecordItemVo> majorList = new ArrayList<>();
         for (String majorName : majorMap.keySet()) {
             majorList.add(
-                    new ItemCountVo(){{
+                    new StudentReportRecordItemVo(){{
                         setItem(majorName);
                         setCount(majorMap.get(majorName).size());
+                        if(majorNotMap.get(majorName) != null && !(majorNotMap.get(majorName).isEmpty())){
+                            setCount2(majorNotMap.get(majorName).size());
+                        }
                     }}
             );
         }
         statisticsVo.setMajorList(majorList);
 
+        Map<String, List<StudentReportRecordStatisticsListVo>> deptMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getDeptName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getDeptName));
+        List<ItemCountVo> deptList = new ArrayList<>();
+        for (String deptName : deptMap.keySet()) {
+            deptList.add(
+                    new ItemCountVo(){{
+                        setItem(deptName);
+                        setCount(deptMap.get(deptName).size());
+                    }}
+            );
+        }
+        statisticsVo.setDeptList(deptList);
+
         BigDecimal divide = BigDecimal.ZERO;
         if( statisticsVo.getAllCount() != 0){
             divide = BigDecimal.valueOf(statisticsVo.getArrivedCount()).divide(BigDecimal.valueOf(statisticsVo.getAllCount()), 4, RoundingMode.HALF_UP);
@@ -350,11 +384,13 @@ public class StudentReportRecordController {
         List<String> roleList = StpUtil.getRoleList();
         if(roleList.size() == 2 && roleList.contains(RoleCodeEnum.TEACHER.getCode()) && roleList.contains(RoleCodeEnum.CLASSTE.getCode())){
             Long classId = classService.getIdByTeacherId(StpUtil.getLoginIdAsLong());
-            if(ObjectUtil.isNull(classId)){
+            if(ObjectUtil.isNull(classId) && dto.getClassId() == null){
                 return RT.ok(new PageOutput<>());
             }
-            dto.setClassId(classId);
-            Long planId = planService.getEffectivePlanId(dto.getTeacherId());
+            if(dto.getClassId() == null){
+                dto.setClassId(classId);
+            }
+            Long planId = planService.getEffectivePlanId(dto.getTeacherId(), dto.getClassId());
             dto.setStudentReportPlanId(planId);
         }
         Page<StudentReportRecordPlanPageVo> planPage = studentReportRecordService.getPlanPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
@@ -362,6 +398,25 @@ public class StudentReportRecordController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/class-list")
+    @ApiOperation(value="班主任负责班级")
+    @SaCheckPermission("studentreportrecord:detail")
+    public RT<List<BaseClassPageVo>> classList(@Valid StudentReportRecordPageDto dto){
+
+        long teacherId = StpUtil.getLoginIdAsLong();
+        Long planId = planService.getEffectivePlanId(teacherId, null);
+        List<BaseClassPageVo> list = classService.selectJoinList(BaseClassPageVo.class,
+                new MPJLambdaWrapper<BaseClass>()
+                        .select(BaseClass::getId)
+                        .selectAs(BaseClass::getName, BaseClassPageVo::getName)
+                        .innerJoin(StudentReportPlanClassRelation.class, StudentReportPlanClassRelation::getClassId, BaseClass::getId)
+                        .innerJoin(StudentReportPlan.class, StudentReportPlan::getId, StudentReportPlanClassRelation::getStudentReportPlanId)
+                        .eq(StudentReportPlan::getId, planId)
+                        .eq(BaseClass::getTeacherId, teacherId)
+        );
+        return RT.ok(list);
+    }
+
     @PostMapping(value = "/sign")
     @ApiOperation(value="学生报到")
     @SaCheckPermission("studentreportrecord:detail")
@@ -369,12 +424,14 @@ public class StudentReportRecordController {
         StudentReportRecord record = studentReportRecordService.getById(dto.getId());
         StudentReportPlan reportPlan = studentReportPlanService.getById(record.getStudentReportPlanId());
         LocalDateTime now = LocalDateTime.now();
-        if(reportPlan.getStatus() != 1 || (now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
+        if(reportPlan.getStatus() != 1 || !(now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
             return RT.error("不在报到时间内,无法报到");
         }
         return RT.ok(studentReportRecordService.sgin(dto));
     }
 
+
+
     @PostMapping(value = "/all-sign")
     @ApiOperation(value="变更已报到")
     @SaCheckPermission("studentreportrecord:detail")
@@ -382,7 +439,7 @@ public class StudentReportRecordController {
         StudentReportRecord record = studentReportRecordService.getById(dtoList.get(0).getId());
         StudentReportPlan reportPlan = studentReportPlanService.getById(record.getStudentReportPlanId());
         LocalDateTime now = LocalDateTime.now();
-        if(reportPlan.getStatus() != 1 || (now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
+        if(reportPlan.getStatus() != 1 || !(now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
             return RT.error("不在报到时间内,无法报到");
         }
         return RT.ok(studentReportRecordService.allSgin(dtoList));
@@ -392,17 +449,28 @@ public class StudentReportRecordController {
     @PostMapping(value = "/update-stduyStatus")
     @ApiOperation(value="切换就读方式")
     @SaCheckPermission("studentreportrecord:detail")
-    public RT<Boolean> updateStduyStatus(@Valid StudentReportSignDto dto){
+    public RT<Boolean> updateStduyStatus(@Valid @RequestBody StudentReportSignDto dto){
         return RT.ok(studentReportRecordService.updateStduyStatus(dto));
     }
 
-    @PostMapping(value = "/export-querty")
+    @PostMapping(value = "/export-query")
     @ApiOperation(value="导出")
     @SaCheckPermission("studentreportrecord:detail")
-    public ResponseEntity<byte[]> exportQuerty(@Valid StudentReportRecordPageDto dto){
+    public ResponseEntity<byte[]> exportQuerty(@Valid @RequestBody StudentReportRecordPageDto dto){
         List<StudentReportRecordPlanPageVo> planPageList = studentReportRecordService.getPlanPageList(dto);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        List<StudentReportRecordExcelVo> dataList = new ArrayList<>();
+        for (StudentReportRecordPlanPageVo pageVo : planPageList) {
+            StudentReportRecordExcelVo excelVo = BeanUtil.toBean(pageVo, StudentReportRecordExcelVo.class);
+            if(pageVo.getReportTime() != null){
+                excelVo.setReportTime(sdf.format(pageVo.getReportTime()));
+            }
+
+            dataList.add(excelVo);
+        }
         ByteArrayOutputStream bot = new ByteArrayOutputStream();
-        EasyExcel.write(bot, StudentReportRecordPlanPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(planPageList);
+        EasyExcel.write(bot, StudentReportRecordExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
         String fileName = "exportQuerty" + ExcelTypeEnum.XLSX.getValue();
         return RT.fileStream(bot.toByteArray(), fileName);
     }

+ 3 - 0
src/main/java/com/xjrsoft/module/student/dto/StudentReportRecordStatisticsDto.java

@@ -34,4 +34,7 @@ public class StudentReportRecordStatisticsDto extends PageInput {
     @JsonIgnore
     @ApiModelProperty("报到计划id")
     private Long studentReportPlanId;
+
+    @ApiModelProperty("统计类别(1:新生报到 2:开学报告 3:试读报到)")
+    private Integer category;
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/student/mapper/StudentReportPlanMapper.java

@@ -23,5 +23,5 @@ public interface StudentReportPlanMapper extends MPJBaseMapper<StudentReportPlan
     Page<StudentReportPlanPageVo> getPage(Page<StudentReportPlanPageVo> page, @Param("dto") StudentReportPlanPageDto dto);
 
 
-    List<BaseClass> validateClass(@Param("id") Long id, @Param("classIds") List<Long> classIds);
+    List<BaseClass> validateClass(@Param("id") Long id, @Param("semesterId") Long semesterId, @Param("classIds") List<Long> classIds);
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/student/mapper/StudentReportRecordMapper.java

@@ -33,4 +33,7 @@ public interface StudentReportRecordMapper extends MPJBaseMapper<StudentReportRe
 
     List<StudentReportRecordPlanPageVo> getPlanPageList(@Param("dto") StudentReportRecordPageDto dto);
 
+
+    List<StudentReportRecordStatisticsListVo> getStatisticsPlanDataList(@Param("dto") StudentReportRecordStatisticsDto dto);
+
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/student/service/IStudentReportPlanService.java

@@ -47,5 +47,5 @@ public interface IStudentReportPlanService extends MPJBaseService<StudentReportP
 
     Boolean release(StudentReportPlan studentReportPlan);
 
-    Long getEffectivePlanId(Long teacherId);
+    Long getEffectivePlanId(Long teacherId, Long classId);
 }

+ 10 - 2
src/main/java/com/xjrsoft/module/student/service/impl/StudentReportPlanServiceImpl.java

@@ -8,6 +8,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
@@ -123,7 +124,8 @@ public class StudentReportPlanServiceImpl extends MPJBaseServiceImpl<StudentRepo
 
     @Override
     public List<BaseClass> validateClass(Long id, List<Long> classIds) {
-        return this.baseMapper.validateClass(id, classIds);
+        StudentReportPlan plan = this.getById(id);
+        return this.baseMapper.validateClass(id, plan.getSemesterId(), classIds);
     }
 
     /**
@@ -140,6 +142,9 @@ public class StudentReportPlanServiceImpl extends MPJBaseServiceImpl<StudentRepo
         List<BaseStudentUserPageVo> studentList = studentService.getStudentList(new BaseStudentUserPageDto() {{
             setClassIds(classIds);
         }});
+        if(studentList.isEmpty()){
+            throw new MyException("未能查询到学生,请联系管理员");
+        }
 
         Date createDate = new Date();
         List<StudentReportRecord> insertList = new ArrayList<>();
@@ -193,14 +198,17 @@ public class StudentReportPlanServiceImpl extends MPJBaseServiceImpl<StudentRepo
      * @return 计划id
      */
     @Override
-    public Long getEffectivePlanId(Long teacherId) {
+    public Long getEffectivePlanId(Long teacherId, Long classId) {
         LocalDateTime now = LocalDateTime.now();
         List<StudentReportPlan> list = this.selectJoinList(StudentReportPlan.class,
                 new MPJLambdaWrapper<StudentReportPlan>()
                         .leftJoin(StudentReportPlanClassRelation.class, StudentReportPlanClassRelation::getStudentReportPlanId, StudentReportPlan::getId)
                         .leftJoin(BaseClass.class, BaseClass::getId, StudentReportPlanClassRelation::getClassId)
                         .eq(teacherId != null, BaseClass::getTeacherId, teacherId)
+                        .eq(classId != null, BaseClass::getId, classId)
                         .eq(StudentReportPlan::getEnabledMark, EnabledMark.ENABLED.getCode())
+                        .eq(StudentReportPlan::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(StudentReportPlan::getStatus, 1)
                         .le(StudentReportPlan::getStartTime, now)
                         .ge(StudentReportPlan::getEndTime, now)
                         .orderByDesc(StudentReportPlan::getId)

+ 35 - 16
src/main/java/com/xjrsoft/module/student/service/impl/StudentReportRecordServiceImpl.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.student.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.xjrsoft.common.enums.DeleteMark;
@@ -53,7 +54,17 @@ public class StudentReportRecordServiceImpl extends MPJBaseServiceImpl<StudentRe
 
     @Override
     public List<StudentReportRecordStatisticsListVo> getStatisticsDataList(StudentReportRecordStatisticsDto dto) {
-        return this.baseMapper.getStatisticsDataList(dto);
+        List<StudentReportRecordStatisticsListVo> resultList;
+        if(dto.getCategory() != null && dto.getCategory() == 1){
+            resultList = this.baseMapper.getStatisticsDataList(dto);
+        }else if(dto.getCategory() != null && dto.getCategory() == 2){
+            resultList = this.baseMapper.getStatisticsPlanDataList(dto);
+        }else if(dto.getCategory() != null && dto.getCategory() == 3){
+            resultList = this.baseMapper.getStatisticsDataList(dto);
+        }else{
+            resultList = this.baseMapper.getStatisticsDataList(dto);
+        }
+        return resultList;
     }
 
     @Override
@@ -79,21 +90,29 @@ public class StudentReportRecordServiceImpl extends MPJBaseServiceImpl<StudentRe
     public Boolean sgin(StudentReportSignDto dto) {
         StudentReportRecord record = this.getById(dto.getId());
         record.setModifyDate(new Date());
-        record.setUserId(StpUtil.getLoginIdAsLong());
-        record.setReportTime(new Date());
-        this.updateById(record);
-
-        BaseStudent student = studentService.getOne(
-                new QueryWrapper<BaseStudent>().lambda()
-                        .eq(BaseStudent::getUserId, record.getUserId())
-                        .eq(BaseStudent::getDeleteMark, DeleteMark.NODELETE.getCode())
-        );
-        student.setIsNormal(1);
-        studentService.updateById(student);
+        record.setModifyUserId(StpUtil.getLoginIdAsLong());
+        if(record.getReportTime() != null){
+            UpdateWrapper<StudentReportRecord> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.eq("id", dto.getId());
+            updateWrapper.setSql("report_time = null");
+            this.update(record, updateWrapper);
+        }else{
+            record.setReportTime(new Date());
+            this.updateById(record);
+
+            BaseStudent student = studentService.getOne(
+                    new QueryWrapper<BaseStudent>().lambda()
+                            .eq(BaseStudent::getUserId, record.getUserId())
+                            .eq(BaseStudent::getDeleteMark, DeleteMark.NODELETE.getCode())
+            );
+            student.setIsNormal(1);
+            studentService.updateById(student);
+
+            User user = userService.getById(record.getUserId());
+            user.setEnabledMark(EnabledMark.ENABLED.getCode());
+            userService.updateById(user);
+        }
 
-        User user = userService.getById(record.getUserId());
-        user.setEnabledMark(EnabledMark.ENABLED.getCode());
-        userService.updateById(user);
         return true;
     }
 
@@ -113,7 +132,7 @@ public class StudentReportRecordServiceImpl extends MPJBaseServiceImpl<StudentRe
         for (StudentReportSignDto dto : dtoList) {
             StudentReportRecord record = this.getById(dto.getId());
             record.setModifyDate(new Date());
-            record.setUserId(StpUtil.getLoginIdAsLong());
+            record.setModifyUserId(StpUtil.getLoginIdAsLong());
             record.setReportTime(new Date());
             this.updateById(record);
 

+ 68 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordExcelVo.java

@@ -0,0 +1,68 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 学生报到记录表导出出参
+* @Author dzx
+* @Date: 2024-08-28
+* @Version 1.0
+*/
+@Data
+public class StudentReportRecordExcelVo {
+
+
+    @ExcelProperty("年级")
+    @ApiModelProperty("年级")
+    private String gradeName;
+
+
+    @ExcelProperty("班级")
+    @ApiModelProperty("班级")
+    private String className;
+
+    @ExcelProperty("班主任")
+    @ApiModelProperty("班主任")
+    private String teacherName;
+
+    @ExcelProperty("学生姓名")
+    @ApiModelProperty("学生姓名")
+    private String name;
+
+    @ExcelProperty("性别")
+    @ApiModelProperty("性别")
+    private String gender;
+
+    @ExcelProperty("身份证号")
+    @ApiModelProperty("身份证号")
+    private String credentialNumber;
+
+    @ExcelProperty("手机号")
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    @ExcelProperty("学生来源")
+    @ApiModelProperty("学生来源")
+    private String studentTypeCn;
+
+    @ExcelProperty("就读方式")
+    @ApiModelProperty("就读方式")
+    private String stduyStatusCn;
+
+    @ExcelProperty("学籍状态")
+    @ApiModelProperty("学籍状态")
+    private String archivesStatusCn;
+
+    @ExcelProperty("报到时间")
+    @ApiModelProperty("报到时间")
+    private String reportTime;
+
+    @ApiModelProperty("家长电话")
+    private String parentMobile;
+
+}

+ 30 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentReportRecordItemVo.java

@@ -0,0 +1,30 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @title: 学生报到记录表表单出参
+* @Author dzx
+* @Date: 2024-08-28
+* @Version 1.0
+*/
+@Data
+public class StudentReportRecordItemVo {
+
+    @ApiModelProperty("统计项")
+    private String item;
+    /**
+     * 完成总数
+     */
+    @ApiModelProperty("数量")
+    private Integer count;
+
+    @ApiModelProperty("数量")
+    private Integer count2;
+
+
+
+}

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

@@ -74,4 +74,7 @@ public class StudentReportRecordPlanPageVo {
     @ApiModelProperty("报到时间")
     private Date reportTime;
 
+    @ApiModelProperty("家长电话")
+    private String parentMobile;
+
 }

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

@@ -43,4 +43,7 @@ public class StudentReportRecordStatisticsListVo {
     @ApiModelProperty("专业方向")
     private String majorName;
 
+    @ApiModelProperty("专业部名称")
+    private String deptName;
+
 }

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

@@ -65,12 +65,15 @@ public class StudentReportRecordStatisticsVo {
     private Long notStayFemaleCount;
 
     @ApiModelProperty("班级报到情况")
-    private List<ItemCountVo> classList;
+    private List<StudentReportRecordItemVo> classList;
 
     @ApiModelProperty("班级类型报到情况")
-    private List<ItemCountVo> classTypeList;
+    private List<StudentReportRecordItemVo> classTypeList;
 
     @ApiModelProperty("专业报到情况")
-    private List<ItemCountVo> majorList;
+    private List<StudentReportRecordItemVo> majorList;
+
+    @ApiModelProperty("专业部报到情况")
+    private List<ItemCountVo> deptList;
 
 }

+ 1 - 0
src/main/resources/mapper/student/BaseStudentMapper.xml

@@ -64,6 +64,7 @@
         LEFT JOIN xjr_dictionary_detail t10 ON t3.learn_status = t10.code AND t10.item_id = 1762024751192084482
         WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
         and t3.archives_status = 'FB2901'
+        and t2.is_normal = 1
         <if test="dto.name != null and dto.name != ''">
             and t1.name like concat('%', #{dto.name},'%')
         </if>

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

@@ -26,7 +26,7 @@
         INNER JOIN student_report_plan_class_relation t2 ON t1.id = t2.class_id
         INNER JOIN student_report_plan t3 ON t2.student_report_plan_id = t3.id
         WHERE t3.delete_mark = 0 AND NOW() BETWEEN t3.start_time AND t3.end_time
-        AND t3.id != #{id}
+        AND t3.id != #{id} and t3.status = 1
         and t1.id in
         <foreach item="classId" index="index" collection="classIds" open="(" close=")" separator=",">
             #{classId}

+ 42 - 8
src/main/resources/mapper/student/StudentReportRecordMapper.xml

@@ -36,8 +36,18 @@
         ) AS arrived_count
         FROM base_class t1
         INNER JOIN xjr_user t2 ON t1.teacher_id = t2.id
-        WHERE t1.delete_mark = 0 and t1.grade_id = #{dto.gradeId}
-        AND t1.teacher_id = #{dto.teacherId}
+        WHERE t1.delete_mark = 0
+        <if test="dto.teacherId != null">
+            AND t1.teacher_id = #{dto.teacherId}
+        </if>
+        <if test="dto.gradeId != null">
+            and t1.grade_id = #{dto.gradeId}
+        </if>
+        <if test="dto.classId != null">
+            AND t1.id = #{dto.classId}
+        </if>
+
+
     </select>
     <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto"
             resultType="com.xjrsoft.module.student.vo.StudentReportRecordPageVo">
@@ -61,7 +71,9 @@
         SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
         t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
         t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
-        t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report FROM student_report_record t1
+        t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report,
+        (SELECT telephone FROM base_student_family WHERE delete_mark = 0 AND user_id = t1.user_id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile
+        FROM student_report_record t1
         INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
         INNER JOIN xjr_user t3 ON t3.id = t1.user_id
         LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
@@ -72,7 +84,9 @@
         LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
         LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
         WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
-        and t1.student_report_plan_id = #{dto.studentReportPlanId}
+        <if test="dto.studentReportPlanId != null">
+            and t1.student_report_plan_id = #{dto.studentReportPlanId}
+        </if>
         <if test="dto.keyword != null and dto.keyword != ''">
             and t1.name like concat('%', #{dto.keyword},'%')
         </if>
@@ -114,13 +128,15 @@
         <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
             and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
         </if>
-        ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC
+        ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name
     </select>
     <select id="getPlanPageList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
         SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
         t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
         t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
-        t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report FROM student_report_record t1
+        t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report,
+        (SELECT mobile FROM base_student_family_member WHERE delete_mark = 0 AND user_id = t1.user_id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile
+        FROM student_report_record t1
         INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
         INNER JOIN xjr_user t3 ON t3.id = t1.user_id
         LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
@@ -173,12 +189,12 @@
         <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
             and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
         </if>
-        ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC
+        ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name
     </select>
     <select id="getStatisticsDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
             resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
         SELECT t1.name,t1.credential_number,t2.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
-        t6.name AS class_name,t8.name as class_type,t7.name AS major_name FROM base_new_student t1
+        t6.name AS class_name,t8.name as class_type,t7.name AS major_name,t9.name as dept_name FROM base_new_student t1
         INNER JOIN xjr_user t2 ON t1.credential_number = t2.credential_number
         INNER JOIN enrollment_plan t3 ON t3.id = t1.enrollment_plan_id
         INNER JOIN base_student_school_roll t4 ON t4.user_id = t2.id
@@ -186,9 +202,27 @@
         INNER JOIN base_class t6 ON t6.id = t4.class_id
         INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
         left join xjr_dictionary_detail t8 on t6.class_type = t8.code and t8.item_id = 2023000000000000039
+        INNER JOIN xjr_department t9 ON t9.id = t6.org_id
         WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
         AND t3.grade_id = #{dto.gradeId} AND t3.enroll_type = #{dto.enrollType}
         AND (t1.delete_reason IS NULL OR t1.delete_reason = '')
         AND t2.delete_mark = 0
     </select>
+    <select id="getStatisticsPlanDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
+            resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
+        SELECT t1.name,t1.credential_number,t1.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
+        t6.name AS class_name,t8.name AS class_type,t7.name AS major_name,t9.name AS dept_name FROM xjr_user t1
+        INNER JOIN base_student_school_roll t4 ON t4.user_id = t1.id
+        INNER JOIN student_report_record t5 ON t1.id = t5.user_id AND t5.delete_mark = 0
+        INNER JOIN base_class t6 ON t6.id = t4.class_id
+        INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
+        LEFT JOIN xjr_dictionary_detail t8 ON t6.class_type = t8.code AND t8.item_id = 2023000000000000039
+        INNER JOIN xjr_department t9 ON t9.id = t6.org_id
+        inner join student_report_plan t10 on t5.student_report_plan_id = t10.id
+        WHERE t1.delete_mark = 0 and t10.delete_mark = 0
+        <if test="dto.gradeId != null">
+            and t4.grade_id = #{dto.gradeId}
+        </if>
+        AND t10.semester_id = #{dto.baseSemesterId}
+    </select>
 </mapper>

+ 51 - 44
src/main/resources/sqlScript/20250120_sql.sql

@@ -2,55 +2,55 @@
 -- 2025-01-20 10:36
 -- 需要进行课程管理的班级
 -- ----------------------------
-drop table if exists base_class_admin_course;
-create table `base_class_admin_course`
+DROP TABLE IF EXISTS base_class_admin_course;
+CREATE TABLE `base_class_admin_course`
 (
-    id                  bigint        not null comment '主键编号'
-        primary key,
-    create_user_id      bigint        null comment '创建人',
-    create_date         datetime      null comment '创建时间',
-    modify_user_id      bigint        null comment '修改人',
-    modify_date         datetime      null comment '修改时间',
-    delete_mark         int           not null comment '删除标记',
-    enabled_mark        int           not null comment '有效标志',
-    sort_code           int           null comment '序号',
-    remark              varchar(1000) null comment '备注',
-
-    class_id         bigint      null comment '班级id(base_class)',
-    base_semester_id bigint      null comment '学期id'
-) engine = innodb
-  default charset = utf8mb4
-  collate = utf8mb4_0900_ai_ci comment ='需要进行课程管理的班级';
-
-alter table base_class_course
-    modify class_id bigint null comment '需要进行课程管理的班级id(base_class_admin_course)(原有班级主键id字段)';
-
-alter table textbook_subscription_item
-    add use_class_num int default 0 null comment '在本次征订中本征订项的教材使用的班级数量';
+    id                  BIGINT        NOT NULL COMMENT '主键编号'
+        PRIMARY KEY,
+    create_user_id      BIGINT        NULL COMMENT '创建人',
+    create_date         DATETIME      NULL COMMENT '创建时间',
+    modify_user_id      BIGINT        NULL COMMENT '修改人',
+    modify_date         DATETIME      NULL COMMENT '修改时间',
+    delete_mark         INT           NOT NULL COMMENT '删除标记',
+    enabled_mark        INT           NOT NULL COMMENT '有效标志',
+    sort_code           INT           NULL COMMENT '序号',
+    remark              VARCHAR(1000) NULL COMMENT '备注',
+
+    class_id         BIGINT      NULL COMMENT '班级id(base_class)',
+    base_semester_id BIGINT      NULL COMMENT '学期id'
+) ENGINE = INNODB
+  DEFAULT CHARSET = utf8mb4
+  COLLATE = utf8mb4_0900_ai_ci COMMENT ='需要进行课程管理的班级';
+
+ALTER TABLE base_class_course
+    MODIFY class_id BIGINT NULL COMMENT '需要进行课程管理的班级id(base_class_admin_course)(原有班级主键id字段)';
+
+ALTER TABLE textbook_subscription_item
+    ADD use_class_num INT DEFAULT 0 NULL COMMENT '在本次征订中本征订项的教材使用的班级数量';
 
 -- ----------------------------
 -- 2025-01-22 14:36
 -- 教材征订记录详情与班级关联表
 -- ----------------------------
-drop table if exists textbook_subscription_item_class;
-create table `textbook_subscription_item_class`
+DROP TABLE IF EXISTS textbook_subscription_item_class;
+CREATE TABLE `textbook_subscription_item_class`
 (
-    id                       bigint        not null comment '主键编号'
-        primary key,
-    create_user_id           bigint        null comment '创建人',
-    create_date              datetime      null comment '创建时间',
-    modify_user_id           bigint        null comment '修改人',
-    modify_date              datetime      null comment '修改时间',
-    delete_mark              int           not null comment '删除标记',
-    enabled_mark             int           not null comment '有效标志',
-    sort_code                int           null comment '序号',
-    remark                   varchar(1000) null comment '备注',
-
-    textbook_subscription_item_id bigint        not null comment '教材征订记录详情表id(textbook_subscription)',
-    base_class_id            bigint        not null comment '按班级征订中征订的班级主键(base_class)'
-) engine = innodb
-  default charset = utf8mb4
-  collate = utf8mb4_0900_ai_ci comment ='教材征订记录详情与班级关联表';
+    id                       BIGINT        NOT NULL COMMENT '主键编号'
+        PRIMARY KEY,
+    create_user_id           BIGINT        NULL COMMENT '创建人',
+    create_date              DATETIME      NULL COMMENT '创建时间',
+    modify_user_id           BIGINT        NULL COMMENT '修改人',
+    modify_date              DATETIME      NULL COMMENT '修改时间',
+    delete_mark              INT           NOT NULL COMMENT '删除标记',
+    enabled_mark             INT           NOT NULL COMMENT '有效标志',
+    sort_code                INT           NULL COMMENT '序号',
+    remark                   VARCHAR(1000) NULL COMMENT '备注',
+
+    textbook_subscription_item_id BIGINT        NOT NULL COMMENT '教材征订记录详情表id(textbook_subscription)',
+    base_class_id            BIGINT        NOT NULL COMMENT '按班级征订中征订的班级主键(base_class)'
+) ENGINE = INNODB
+  DEFAULT CHARSET = utf8mb4
+  COLLATE = utf8mb4_0900_ai_ci COMMENT ='教材征订记录详情与班级关联表';
 
 DROP TABLE IF EXISTS student_change_record;
 CREATE TABLE `student_change_record`  (
@@ -107,8 +107,11 @@ CREATE TABLE `student_report_plan_class_relation`  (
 ALTER TABLE `student_report_record`
   ADD COLUMN `student_report_plan_id` BIGINT NULL   COMMENT '报到计划id' AFTER `base_semester_id`;
 
-alter table textbook_subscription_item
-    add class_ids varchar(1024) null comment '按班级征订当前征订项的的教材使用的班级的主键';
+ALTER TABLE textbook_subscription_item
+    ADD base_class_ids VARCHAR(1024) NULL COMMENT '按班级征订当前征订项的的教材使用的班级的主键';
+
+ALTER TABLE `base_class`
+  ADD INDEX (`major_set_id`);
 
 alter table textbook_subscription
     add order_number varchar(256) not null comment '征订单号(标识+当前时间(YYYYMMDDHHmmss)+三位序号)';
@@ -131,6 +134,10 @@ alter table textbook_warehouse_record
 alter table textbook_warehouse_record
     add issued_number int default 0 null comment '已出库数量';
 
+ALTER TABLE `student_report_record`
+  ADD INDEX (`base_semester_id`),
+  ADD INDEX (`student_report_plan_id`);
+
 alter table textbook_warehouse_record
     add recede_number int default 0 null comment '领取后退书数量';
 

+ 4 - 46
src/test/java/com/xjrsoft/module/job/JianyuekbBaseDataTaskTest.java

@@ -111,60 +111,18 @@ class JianyuekbBaseDataTaskTest {
             sql = "SELECT * FROM base_class WHERE delete_mark = 0" +
                 " and id not in (SELECT source_id FROM jianyue_data WHERE table_name = 'base_class' AND source_id IS NOT NULL)";
 
-            List<Map<String, Object>> dataList = SqlRunnerAdapter.db().selectList(sql, BaseClass.class);
-            String semesterSerialNo = dataUtil.getCurrenSemeter();
-            Map<String, String> idMap = new HashMap<>();
-            JsonParser jsonParser = new JsonParser();
-            for (Map<String, Object> baseClassMap : dataList) {
-                BaseClass baseClass = SqlRunnerAdapterUtil.convertMapToEntity(baseClassMap, BaseClass.class);
-                String url  = ScheduleUtil.apiUrl + "class/create";
-                JsonObject paramJson = new JsonObject();
-                if(baseClass.getTeacherId() != null && teacherMap.get(baseClass.getTeacherId().toString()) != null){
-                    paramJson.addProperty("teacherSerialNo", teacherMap.get(baseClass.getTeacherId().toString()));
-                }
-                paramJson.addProperty("name", baseClass.getName());
-
-                paramJson.addProperty("semesterSerialNo", semesterSerialNo);
-                paramJson.addProperty("eduYearSerialNo", gradeMap.get(baseClass.getOrgId() + "_" + baseClass.getGradeId().toString()));
-                paramJson.addProperty("extendId", baseClass.getId());
-                if(baseClass.getClassroomId() != null && classroomMap.get(baseClass.getClassroomId().toString()) != null){
-                    paramJson.addProperty("classRoomSerialNo", classroomMap.get(baseClass.getClassroomId().toString()));
-                }
-//                if(ids != null && ids.get(baseClass.getId().toString()) != null){
-//                    url  = ScheduleUtil.apiUrl + "class/update";
-//                    paramJson.addProperty("serialNo", ids.get(baseClass.getId().toString()));
-//                    long timestamp = System.currentTimeMillis();
-//                    //生成签名
-//                    String sign = ScheduleUtil.createSign(timestamp);
-//                    ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
-//                    continue;
-//                }
-
-                //获取时间戳
-                long timestamp = System.currentTimeMillis();
-                //生成签名
-                String sign = ScheduleUtil.createSign(timestamp);
-                String result = ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
-                if(result == null){
-                    continue;
-                }
-                JsonObject resultJson = jsonParser.parse(result).getAsJsonObject();
-                idMap.put(baseClass.getId().toString(), resultJson.get("data").getAsString());
-            }
-            dataUtil.insertRecord("base_class", idMap);
+            tableName = "base_semester";
+            dataUtil.insertSemester(tableName, dataMap.get(tableName));
         } catch (Exception e) {
         }
     }
 
     @Test
     void test3() throws Exception {
-        long timestamp = System.currentTimeMillis();
-        //生成签名
-        String sign = ScheduleUtil.createSign(timestamp);
+        DataUtil dataUtil = new DataUtil();
+        String currenSemeter = dataUtil.getCurrenSemeter();
 
-        System.out.println(timestamp);
 
-        System.out.println(sign);
     }
 
     @Test