Browse Source

新生报到功能

dzx 6 months ago
parent
commit
fbb4d41833

+ 19 - 0
src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

@@ -25,6 +25,7 @@ import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.student.dto.ActiveAccountDto;
 import com.xjrsoft.module.student.dto.ActiveAccountDto;
 import com.xjrsoft.module.student.dto.AddBaseNewStudentDto;
 import com.xjrsoft.module.student.dto.AddBaseNewStudentDto;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
+import com.xjrsoft.module.student.dto.DeleteNewStudentDto;
 import com.xjrsoft.module.student.dto.UpdateBaseNewStudentDto;
 import com.xjrsoft.module.student.dto.UpdateBaseNewStudentDto;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.entity.BaseStudentFamilyMember;
 import com.xjrsoft.module.student.entity.BaseStudentFamilyMember;
@@ -89,6 +90,16 @@ public class BaseNewStudentController {
         return RT.ok(pageOutput);
         return RT.ok(pageOutput);
     }
     }
 
 
+    @GetMapping(value = "/report-page")
+    @ApiOperation(value="新生报到(分页)")
+    @SaCheckPermission("basenewstudent:detail")
+    public RT<PageOutput<BaseNewStudentPageVo>> reportPage(@Valid BaseNewStudentPageDto dto){
+
+        Page<BaseNewStudentPageVo> page = baseNewStudentService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<BaseNewStudentPageVo> pageOutput = ConventPage.getPageOutput(page, BaseNewStudentPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/tree")
     @GetMapping(value = "/tree")
     @ApiOperation(value="新生维护信息树")
     @ApiOperation(value="新生维护信息树")
     @SaCheckPermission("basenewstudent:detail")
     @SaCheckPermission("basenewstudent:detail")
@@ -161,8 +172,16 @@ public class BaseNewStudentController {
     @SaCheckPermission("basenewstudent:delete")
     @SaCheckPermission("basenewstudent:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
         return RT.ok(baseNewStudentService.removeBatchByIds(ids));
         return RT.ok(baseNewStudentService.removeBatchByIds(ids));
+    }
 
 
+    @DeleteMapping("deleteByUserIds")
+    @ApiOperation(value = "删除新生(保留新生信息,删除基础信息)")
+    @SaCheckPermission("basenewstudent:delete")
+    public RT<Boolean> deleteByUserIds(@Valid @RequestBody DeleteNewStudentDto dto){
+        return RT.ok(baseNewStudentService.deleteByUserIds(dto));
     }
     }
+
+
     @PostMapping("/import")
     @PostMapping("/import")
     @ApiOperation(value = "导入")
     @ApiOperation(value = "导入")
     public RT<List<Map<String, String>>> importData(@RequestParam Long treeId, @RequestParam MultipartFile file) throws IOException {
     public RT<List<Map<String, String>>> importData(@RequestParam Long treeId, @RequestParam MultipartFile file) throws IOException {

+ 29 - 0
src/main/java/com/xjrsoft/module/student/dto/DeleteNewStudentDto.java

@@ -0,0 +1,29 @@
+package com.xjrsoft.module.student.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+* @title: 删除新生
+* @Author fanxp
+* @Date: 2023-11-14
+* @Version 1.0
+*/
+@Data
+public class DeleteNewStudentDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("新生信息id")
+    private List<Long> ids;
+
+    @ApiModelProperty("学生userIds")
+    private List<Long> userIds;
+
+    @ApiModelProperty("删除原因")
+    private String deleteReason;
+}

+ 3 - 0
src/main/java/com/xjrsoft/module/student/entity/BaseNewStudent.java

@@ -166,4 +166,7 @@ public class BaseNewStudent implements Serializable {
      */
      */
     @ApiModelProperty("第二志愿")
     @ApiModelProperty("第二志愿")
     private Long secondAmbitionId;
     private Long secondAmbitionId;
+
+    @ApiModelProperty("删除原因(用于新生删除功能)")
+    private String deleteReason;
 }
 }

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

@@ -25,6 +25,7 @@ public interface BaseNewStudentMapper extends MPJBaseMapper<BaseNewStudent> {
 
 
     Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
     Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
 
 
+    Page<BaseNewStudentPageVo> getReportPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
     List<EnrollmentPlanTreeVo> getEnrollmentPlanList();
     List<EnrollmentPlanTreeVo> getEnrollmentPlanList();
 
 
     List<EnrollmentPlanGradeVo> getGradeList();
     List<EnrollmentPlanGradeVo> getGradeList();

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

@@ -5,6 +5,7 @@ import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.banding.vo.IdManyCountVo;
 import com.xjrsoft.module.banding.vo.IdManyCountVo;
 import com.xjrsoft.module.outint.vo.IdCountVo;
 import com.xjrsoft.module.outint.vo.IdCountVo;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
+import com.xjrsoft.module.student.dto.DeleteNewStudentDto;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
@@ -27,7 +28,7 @@ public interface IBaseNewStudentService extends MPJBaseService<BaseNewStudent> {
 
 
     Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
     Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
 
 
-
+    Page<BaseNewStudentPageVo> getReportPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
     List<EnrollmentPlanTreeVo> getEnrollmentPlanList();
     List<EnrollmentPlanTreeVo> getEnrollmentPlanList();
 
 
     List<EnrollmentPlanGradeVo> getGradeList();
     List<EnrollmentPlanGradeVo> getGradeList();
@@ -39,4 +40,6 @@ public interface IBaseNewStudentService extends MPJBaseService<BaseNewStudent> {
     List<IdCountVo> getMajorStudent(Long gradeId, String enrollType, Integer index);
     List<IdCountVo> getMajorStudent(Long gradeId, String enrollType, Integer index);
 
 
     List<IdManyCountVo> getMajorStudentCount(Long bandingTaskId);
     List<IdManyCountVo> getMajorStudentCount(Long bandingTaskId);
+
+    Boolean deleteByUserIds(DeleteNewStudentDto dto);
 }
 }

+ 49 - 1
src/main/java/com/xjrsoft/module/student/service/impl/BaseNewStudentServiceImpl.java

@@ -12,11 +12,21 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.banding.vo.IdManyCountVo;
 import com.xjrsoft.module.banding.vo.IdManyCountVo;
 import com.xjrsoft.module.base.entity.BaseMajorSet;
 import com.xjrsoft.module.base.entity.BaseMajorSet;
 import com.xjrsoft.module.base.service.IBaseMajorSetService;
 import com.xjrsoft.module.base.service.IBaseMajorSetService;
+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.outint.vo.IdCountVo;
 import com.xjrsoft.module.outint.vo.IdCountVo;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
+import com.xjrsoft.module.student.dto.DeleteNewStudentDto;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.entity.BaseNewStudent;
+import com.xjrsoft.module.student.entity.BaseStudent;
+import com.xjrsoft.module.student.entity.BaseStudentFamily;
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.mapper.BaseNewStudentMapper;
 import com.xjrsoft.module.student.mapper.BaseNewStudentMapper;
 import com.xjrsoft.module.student.service.IBaseNewStudentService;
 import com.xjrsoft.module.student.service.IBaseNewStudentService;
+import com.xjrsoft.module.student.service.IBaseStudentFamilyService;
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
+import com.xjrsoft.module.student.service.IBaseStudentService;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
 import com.xjrsoft.module.student.vo.EnrollmentPlanGradeVo;
 import com.xjrsoft.module.student.vo.EnrollmentPlanGradeVo;
@@ -49,11 +59,19 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
 
 
     private final DictionarydetailMapper dictionarydetailMapper;
     private final DictionarydetailMapper dictionarydetailMapper;
     private final IBaseMajorSetService majorSetService;
     private final IBaseMajorSetService majorSetService;
+    private final IUserService userService;
+    private final IBaseStudentService studentService;
+    private final IBaseStudentSchoolRollService rollService;
+    private final IBaseStudentFamilyService familyService;
+    private final IUserRoleRelationService roleRelationService;
     @Override
     @Override
     public Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto) {
     public Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto) {
         return this.baseMapper.getPage(page, dto);
         return this.baseMapper.getPage(page, dto);
     }
     }
-
+    @Override
+    public Page<BaseNewStudentPageVo> getReportPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto) {
+        return this.baseMapper.getReportPage(page, dto);
+    }
     @Override
     @Override
     public List<EnrollmentPlanTreeVo> getEnrollmentPlanList() {
     public List<EnrollmentPlanTreeVo> getEnrollmentPlanList() {
         return this.baseMapper.getEnrollmentPlanList();
         return this.baseMapper.getEnrollmentPlanList();
@@ -258,6 +276,36 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
         return this.baseMapper.getMajorStudentCount(bandingTaskId);
         return this.baseMapper.getMajorStudentCount(bandingTaskId);
     }
     }
 
 
+    @Override
+    public Boolean deleteByUserIds(DeleteNewStudentDto dto) {
+        List<BaseNewStudent> studentList = this.baseMapper.selectBatchIds(dto.getIds());
+        for (BaseNewStudent student : studentList) {
+            student.setDeleteReason(dto.getDeleteReason());
+            student.setModifyDate(new Date());
+        }
+        this.updateBatchById(studentList);
+
+        userService.deleteBatch(dto.getUserIds());
+        studentService.remove(
+                new QueryWrapper<BaseStudent>().lambda()
+                        .in(BaseStudent::getUserId, dto.getUserIds())
+        );
+        rollService.remove(
+                new QueryWrapper<BaseStudentSchoolRoll>().lambda()
+                .in(BaseStudentSchoolRoll::getUserId, dto.getUserIds())
+        );
+        familyService.remove(
+                new QueryWrapper<BaseStudentFamily>().lambda()
+                        .in(BaseStudentFamily::getUserId, dto.getUserIds())
+        );
+
+        roleRelationService.remove(
+                new QueryWrapper<UserRoleRelation>().lambda()
+                        .in(UserRoleRelation::getUserId, dto.getUserIds())
+        );
+        return true;
+    }
+
     /**
     /**
      * 检查必填字段是否为空
      * 检查必填字段是否为空
      */
      */

+ 7 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentPageVo.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -163,4 +164,10 @@ public class BaseNewStudentPageVo {
     @ExcelProperty("班主任")
     @ExcelProperty("班主任")
     @ApiModelProperty("班主任")
     @ApiModelProperty("班主任")
     private String teacherName;
     private String teacherName;
+
+    @ApiModelProperty("学生userId")
+    private Long userId;
+
+    @ApiModelProperty("报到时间")
+    private LocalDate reportTime;
 }
 }

+ 73 - 1
src/main/resources/mapper/student/BaseNewStudentMapper.xml

@@ -6,7 +6,7 @@
     <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseNewStudentPageDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
     <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseNewStudentPageDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
         SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
         SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
         t1.score,t1.graduate_class,t1.source,t5.name as source_cn,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
         t1.score,t1.graduate_class,t1.source,t5.name as source_cn,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
-        t8.name as second_ambition,t1.is_adjust,t1.status,t11.name AS class_name,t12.name AS teacher_name FROM base_new_student t1
+        t8.name as second_ambition,t1.is_adjust,t1.status,ifnull(t11.name,t1.delete_reason) AS class_name,t12.name AS teacher_name FROM base_new_student t1
         LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
         LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
         LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
         LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
         LEFT JOIN xjr_dictionary_detail t5 ON t1.source = t5.code AND t5.item_id = 2023000000000000028
         LEFT JOIN xjr_dictionary_detail t5 ON t1.source = t5.code AND t5.item_id = 2023000000000000028
@@ -74,6 +74,78 @@
             </if>
             </if>
         </if>
         </if>
     </select>
     </select>
+    <select id="getReportPage" parameterType="com.xjrsoft.module.student.dto.BaseNewStudentPageDto" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
+        SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
+        t1.score,t1.graduate_class,t1.source,t5.name as source_cn,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t7.name as first_ambition,
+        t8.name as second_ambition,t1.is_adjust,t1.status,ifnull(t11.name,t1.delete_reason) AS class_name,t12.name AS teacher_name ,t13.report_time,t9.id as user_id FROM base_new_student t1
+        LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
+        LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
+        LEFT JOIN xjr_dictionary_detail t5 ON t1.source = t5.code AND t5.item_id = 2023000000000000028
+        LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
+        LEFT JOIN base_major_set t7 ON t1.first_ambition = t7.id
+        LEFT JOIN base_major_set t8 ON t1.second_ambition = t8.id
+        LEFT JOIN xjr_user t9 ON t1.credential_number = t9.credential_number AND t9.delete_mark = 0
+        LEFT JOIN base_student_school_roll t10 ON t9.id = t10.user_id AND t10.delete_mark = 0
+        LEFT JOIN base_class t11 ON t10.class_id = t11.id
+        LEFT JOIN xjr_user t12 ON t11.teacher_id = t12.id
+        LEFT JOIN student_report_record t13 ON t9.id = t13.user_id
+        WHERE t1.delete_mark = 0
+        <if test="dto.name != null and dto.name != ''">
+            and t1.name like concat('%', #{dto.name}, '%')
+        </if>
+        <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
+            and t1.credential_number like concat('%', #{dto.credentialNumber}, '%')
+        </if>
+        <if test="dto.graduateSchool != null and dto.graduateSchool != ''">
+            and t1.graduate_school like concat('%', #{dto.graduateSchool}, '%')
+        </if>
+        <if test="dto.isImportScore != null">
+            <if test="dto.isImportScore == 1">
+                and t1.score is not null
+            </if>
+            <if test="dto.isImportScore == 0">
+                and t1.score is null
+            </if>
+        </if>
+        <if test="dto.firstAmbition != null and dto.firstAmbition != ''">
+            and t1.first_ambition = #{dto.firstAmbition}
+        </if>
+        <if test="dto.secondAmbition != null and dto.secondAmbition != ''">
+            and t1.second_ambition = #{dto.secondAmbition}
+        </if>
+
+        <if test="dto.startDate != null and dto.endDate != null">
+            AND t1.create_date between #{dto.startDate} and #{dto.endDate}
+        </if>
+        <if test="dto.gender != null and dto.gender != ''">
+            AND t1.gender = #{dto.gender}
+        </if>
+        <if test="dto.status != null">
+            AND t1.status = #{dto.status}
+        </if>
+        <if test="dto.isAdjust != null">
+            AND t1.is_adjust = #{dto.isAdjust}
+        </if>
+        <if test="dto.enrollmentPlanId != null">
+            AND t1.enrollment_plan_id = #{dto.enrollmentPlanId}
+        </if>
+        <if test="dto.treeId != null and dto.treeType != null">
+            <if test="dto.treeType == 1">
+                AND t4.grade_id = #{dto.treeId}
+            </if>
+            <if test="dto.treeType == 2">
+                AND t4.enroll_type = #{dto.treeId}
+            </if>
+        </if>
+        <if test="dto.field != null and dto.field != '' and dto.field == 'score'">
+            <if test="dto.order == 'descend'">
+                order by t1.score desc
+            </if>
+            <if test="dto.order == 'ascend'">
+                order by t1.score asc
+            </if>
+        </if>
+    </select>
     <select id="getEnrollmentPlanList" resultType="com.xjrsoft.module.student.vo.EnrollmentPlanTreeVo">
     <select id="getEnrollmentPlanList" resultType="com.xjrsoft.module.student.vo.EnrollmentPlanTreeVo">
         SELECT t1.enroll_type, t2.name AS enroll_type_cn,t3.name AS grade_name, t3.id as grade_id,t1.id FROM enrollment_plan t1
         SELECT t1.enroll_type, t2.name AS enroll_type_cn,t3.name AS grade_name, t3.id as grade_id,t1.id FROM enrollment_plan t1
         LEFT JOIN xjr_dictionary_detail t2 ON t1.enroll_type = t2.code AND t2.item_id = 2023000000000000027
         LEFT JOIN xjr_dictionary_detail t2 ON t1.enroll_type = t2.code AND t2.item_id = 2023000000000000027