Преглед на файлове

学生寝室分配按照缴费状态排序分配

dzx преди 1 година
родител
ревизия
af3bfd822a

+ 8 - 0
src/main/java/com/xjrsoft/module/room/mapper/RoomBedMapper.java

@@ -21,6 +21,7 @@ import com.xjrsoft.module.room.vo.RoomBedExcelVo;
 import com.xjrsoft.module.room.vo.RoomBedInfoVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import com.xjrsoft.module.room.vo.RoomBedVo;
+import com.xjrsoft.module.room.vo.StudentPayStatusVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -129,4 +130,11 @@ public interface RoomBedMapper extends MPJBaseMapper<RoomBed> {
      */
     RoomBedInfoVo getBedInfoByUserId(Long id);
 
+    /**
+     * 查询学生的住宿费缴费状态
+     * @param dto
+     * @return
+     */
+    List<StudentPayStatusVo> getStudentPayStatus(@Param("dto") DistributeRoomBedDto dto);
+
 }

+ 25 - 1
src/main/java/com/xjrsoft/module/room/service/impl/RoomBedServiceImpl.java

@@ -41,6 +41,7 @@ import com.xjrsoft.module.room.vo.NoBedStudentPageVo;
 import com.xjrsoft.module.room.vo.RoomBedExcelVo;
 import com.xjrsoft.module.room.vo.RoomBedPageVo;
 import com.xjrsoft.module.room.vo.RoomClassCountVo;
+import com.xjrsoft.module.room.vo.StudentPayStatusVo;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.mapper.BaseStudentMapper;
@@ -260,6 +261,11 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
         return roomBedMapper.getDistributeRoomBedInfo(page, dto);
     }
 
+    /**
+     * 分配床位
+     * @param dto
+     * @return
+     */
     @Override
     public Boolean distributeRoomBed(DistributeRoomBedDto dto) {
         List<Room> roomList = roomMapper.selectList(new QueryWrapper<Room>().lambda().in(Room::getId, dto.getRoomIds()));
@@ -274,6 +280,12 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
         int i = 0;
         Map<Long, Integer> classDistributeBedNumber = new HashMap<>();
         Map<Long, Integer> classStudent = new HashMap<>();
+        //查询学生住宿费缴费状态
+        List<StudentPayStatusVo> studentPayStatus = roomBedMapper.getStudentPayStatus(dto);
+        Map<Long, Integer> payStatusMap = new HashMap<>();
+        for (StudentPayStatusVo payStatus : studentPayStatus) {
+            payStatusMap.put(payStatus.getId(), payStatus.getPayStatus());
+        }
         for (String genderNumber : genderSet) {
             //根据性别查询出所有空床位信息
             List<RoomBed> bedInfoList = roomBedMapper.selectList(
@@ -302,7 +314,19 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
                 );
                 //已分配床位数
                 int distributeBedNumber = 0;
-                for (BaseStudent studentInfoVo : studentList) {
+                //先分配已缴费的,再分配未交费的,把已缴费的学生排序到一起
+                List<BaseStudent> studentOrderList = new ArrayList<>();
+                for (BaseStudent baseStudent : studentList) {
+                    if(payStatusMap.get(baseStudent.getUserId()) == 1){
+                        studentOrderList.add(baseStudent);
+                    }
+                }
+                for (BaseStudent baseStudent : studentList) {
+                    if(payStatusMap.get(baseStudent.getUserId()) == null || payStatusMap.get(baseStudent.getUserId()) == 0){
+                        studentOrderList.add(baseStudent);
+                    }
+                }
+                for (BaseStudent studentInfoVo : studentOrderList) {
                     if(i >= bedInfoList.size()){
                         continue;
                     }

+ 26 - 0
src/main/java/com/xjrsoft/module/room/vo/StudentPayStatusVo.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.room.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 寝室床位表单出参
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+public class StudentPayStatusVo {
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private Long id;
+    /**
+    * 序号
+    */
+    @ApiModelProperty("序号")
+    private Integer payStatus;
+
+}

+ 13 - 1
src/main/resources/mapper/room/RoomBedMapper.xml

@@ -373,5 +373,17 @@
         WHERE t3.build_type = 'FB3604'
         AND t1.student_user_id = #{id}
     </select>
-
+    <select id="getStudentPayStatus" parameterType="com.xjrsoft.module.room.dto.DistributeRoomBedDto" resultType="com.xjrsoft.module.room.vo.StudentPayStatusVo">
+        SELECT DISTINCT t1.id,(t3.factrecarmny >= t3.factar) AS pay_status FROM xjr_user t1
+        INNER JOIN base_student t2 ON t1.id = t2.user_id
+        INNER JOIN pb_v_xsxxsfytb t3 ON t1.credential_number = t3.Studentcode
+        INNER JOIN base_student_school_roll t4 ON t1.id = t4.user_id
+        WHERE t1.delete_mark = 0 and t4.stduy_status = 'FB3002' AND t3.feeitemcode = 103042766003001
+        <if test="dto.classIds != null">
+            and t4.class_id in
+            <foreach item="classId" index="index" collection="dto.classIds" open="(" close=")" separator=",">
+                #{classId}
+            </foreach>
+        </if>
+    </select>
 </mapper>

+ 1 - 1
src/main/resources/sqlScript/20240219_sql.sql

@@ -146,7 +146,7 @@ CREATE TABLE `wf_teacher_self_evaluation_item` (
   `number` INT DEFAULT NULL COMMENT '获奖次数',
   `total_score` INT DEFAULT NULL COMMENT '合计分数',
   PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师自评子表'
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师自评子表';
 
 -- ------------------------------------------------
 -- 教师自评类别