ソースを参照

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

phoenix 1 年間 前
コミット
017b3a4d16

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

@@ -12,6 +12,7 @@ import com.xjrsoft.module.room.entity.RoomBed;
 import com.xjrsoft.module.room.vo.AdjustBedClassPageVo;
 import com.xjrsoft.module.room.vo.AdjustBedClassStudentPageVo;
 import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
+import com.xjrsoft.module.room.vo.ClassStudentCountVo;
 import com.xjrsoft.module.room.vo.DistributeClassPageVo;
 import com.xjrsoft.module.room.vo.DistributeResultListVo;
 import com.xjrsoft.module.room.vo.DistributeRoomBedPageVo;
@@ -81,4 +82,40 @@ public interface RoomBedMapper extends MPJBaseMapper<RoomBed> {
      */
     Page<NoBedStudentPageVo> getNoBedStudent(Page<AdjustBedPageDto> page, AdjustBedPageDto dto);
 
+    /* 查询分配床位班级列表的各个人数 - 开始 */
+
+    /**
+     * 查询班上需要住宿的人数
+     */
+    List<ClassStudentCountVo> getAllStayCount();
+
+    /**
+     * 查询班上需要住宿的男生人数
+     */
+    List<ClassStudentCountVo> getAllStayMaleCount();
+
+    /**
+     * 查询班上需要住宿的女生人数
+     */
+    List<ClassStudentCountVo> getAllStayFemaleCount();
+
+    /**
+     * 已安排的总人数
+     */
+    List<ClassStudentCountVo> getAllArrangedCount();
+
+    /**
+     * 已安排的男生人数
+     */
+    List<ClassStudentCountVo> getAllArrangedMaleCount();
+
+    /**
+     * 已安排的女生人数
+     */
+    List<ClassStudentCountVo> getAllArrangedFemaleCount();
+
+
+
+    /* 查询分配床位班级列表的各个人数 - 结束 */
+
 }

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

@@ -31,6 +31,7 @@ import com.xjrsoft.module.room.service.IRoomBedService;
 import com.xjrsoft.module.room.vo.AdjustBedClassPageVo;
 import com.xjrsoft.module.room.vo.AdjustBedClassStudentPageVo;
 import com.xjrsoft.module.room.vo.AdjustBedStudentPageVo;
+import com.xjrsoft.module.room.vo.ClassStudentCountVo;
 import com.xjrsoft.module.room.vo.DistributeClassPageVo;
 import com.xjrsoft.module.room.vo.DistributeResultClassVo;
 import com.xjrsoft.module.room.vo.DistributeResultListVo;
@@ -123,7 +124,80 @@ public class RoomBedServiceImpl extends MPJBaseServiceImpl<RoomBedMapper, RoomBe
 
     @Override
     public Page<DistributeClassPageVo> getDistributeClassInfo(Page<DistributeClassPageDto> page, DistributeClassPageDto dto) {
-        return roomBedMapper.getDistributeClassInfo(page, dto);
+        Page<DistributeClassPageVo> classInfo = roomBedMapper.getDistributeClassInfo(page, dto);
+        List<DistributeClassPageVo> records = classInfo.getRecords();
+        //查询所有班级需要安排住宿的人数,并组装成map备用
+        List<ClassStudentCountVo> allStayCount = roomBedMapper.getAllStayCount();
+        Map<String, Integer> allStayCountMap = new HashMap<>();
+        for (ClassStudentCountVo classStudentCountVo : allStayCount) {
+            allStayCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
+        }
+
+        //查询所有班级需要安排住宿的男生人数,并组装成map备用
+        List<ClassStudentCountVo> allStayMaleCount = roomBedMapper.getAllStayMaleCount();
+        Map<String, Integer> allStayMaleCountMap = new HashMap<>();
+        for (ClassStudentCountVo classStudentCountVo : allStayMaleCount) {
+            allStayMaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
+        }
+
+        //查询所有班级需要安排住宿的女生人数,并组装成map备用
+        List<ClassStudentCountVo> allStayFemaleCount = roomBedMapper.getAllStayFemaleCount();
+        Map<String, Integer> allStayFemaleCountMap = new HashMap<>();
+        for (ClassStudentCountVo classStudentCountVo : allStayFemaleCount) {
+            allStayFemaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
+        }
+
+        //查询所有班级已经安排住宿的总人数,并组装成map备用
+        List<ClassStudentCountVo> allArrangedCount = roomBedMapper.getAllArrangedCount();
+        Map<String, Integer> allArrangedCountMap = new HashMap<>();
+        for (ClassStudentCountVo classStudentCountVo : allArrangedCount) {
+            allArrangedCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
+        }
+
+        //查询所有班级已经安排住宿的男生人数,并组装成map备用
+        List<ClassStudentCountVo> allArrangedMaleCount = roomBedMapper.getAllArrangedMaleCount();
+        Map<String, Integer> allArrangedMaleCountMap = new HashMap<>();
+        for (ClassStudentCountVo classStudentCountVo : allArrangedMaleCount) {
+            allArrangedMaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
+        }
+
+        //查询所有班级已经安排住宿的女生人数,并组装成map备用
+        List<ClassStudentCountVo> allArrangedFemaleCount = roomBedMapper.getAllArrangedFemaleCount();
+        Map<String, Integer> allArrangedFemaleCountMap = new HashMap<>();
+        for (ClassStudentCountVo classStudentCountVo : allArrangedFemaleCount) {
+            allArrangedFemaleCountMap.put(classStudentCountVo.getClassId(), classStudentCountVo.getStudentCount());
+        }
+
+        for (DistributeClassPageVo record : records) {
+            Integer needCout = 0;
+            Integer distributeCount = 0;
+            Integer maleCount = 0, femaleCount = 0;
+            if(allStayMaleCountMap.get(record.getId()) != null){
+                maleCount = allStayMaleCountMap.get(record.getId());
+            }
+            record.setMaleCount(maleCount);
+
+            if(allStayFemaleCountMap.get(record.getId()) != null){
+                femaleCount = allStayMaleCountMap.get(record.getId());
+            }
+            record.setFemaleCount(femaleCount);
+
+            if("SB10001".equals(dto.getGender()) && allStayMaleCountMap.get(record.getId()) != null){
+                needCout = allStayMaleCountMap.get(record.getId());
+                distributeCount = needCout - (allArrangedMaleCountMap.get(record.getId()) == null ? 0 : allArrangedMaleCountMap.get(record.getId()));
+            }else if("SB10002".equals(dto.getGender())){
+                needCout = femaleCount;
+                distributeCount = needCout - (allArrangedFemaleCountMap.get(record.getId()) == null ? 0 : allArrangedFemaleCountMap.get(record.getId()));
+            }else{
+                needCout = allStayCountMap.get(record.getId());
+                distributeCount = needCout - (allArrangedCountMap.get(record.getId()) == null ? 0 : allArrangedCountMap.get(record.getId()));
+            }
+
+            record.setNeedCount(needCout);
+            record.setDistributeCount(distributeCount);
+        }
+
+        return classInfo;
     }
 
     @Override

+ 19 - 0
src/main/java/com/xjrsoft/module/room/vo/ClassStudentCountVo.java

@@ -0,0 +1,19 @@
+package com.xjrsoft.module.room.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author dzx
+ * @date 2024/1/15
+ */
+@Data
+public class ClassStudentCountVo {
+
+    @ApiModelProperty("班级id")
+    private String classId;
+
+
+    @ApiModelProperty("学生人数")
+    private Integer studentCount;
+}

+ 4 - 4
src/main/java/com/xjrsoft/module/room/vo/DistributeClassPageVo.java

@@ -54,12 +54,12 @@ public class DistributeClassPageVo {
     private Integer distributeCount;
 
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("需要住宿的男生人数")
-    @ApiModelProperty("需要住宿的男生人数")
+    @ExcelProperty("需要安排住宿的男生人数")
+    @ApiModelProperty("需要安排住宿的男生人数")
     private Integer maleCount;
 
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("需要住宿的女生人数")
-    @ApiModelProperty("需要住宿的女生人数")
+    @ExcelProperty("需要安排住宿的女生人数")
+    @ApiModelProperty("需要安排住宿的女生人数")
     private Integer femaleCount;
 }

+ 62 - 0
src/main/resources/mapper/room/RoomBedMapper.xml

@@ -122,6 +122,68 @@
         </if>
 
     </select>
+    <!--查询分配床位班级列表的各个人数 - 开始 -->
+
+    <!-- 查询班上需要住宿的人数 -->
+    <select id="getAllStayCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
+        SELECT t1.id,COUNT(*) FROM base_class t1
+        LEFT JOIN base_student_school_roll t2 ON t1.id = t2.class_id
+        LEFT JOIN xjr_user t3 ON t2.user_id = t3.id
+        WHERE t1.delete_mark = 0
+        AND t2.delete_mark = 0 AND t3.delete_mark = 0
+        AND t2.stduy_status = 'FB3002' GROUP BY t1.id
+    </select>
+
+    <!-- 需要安排的男生总人数 -->
+    <select id="getAllStayMaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
+        SELECT t1.id,COUNT(*) FROM base_class t1
+        LEFT JOIN base_student_school_roll t2 ON t1.id = t2.class_id
+        LEFT JOIN xjr_user t3 ON t2.user_id = t3.id
+        WHERE t1.delete_mark = 0
+        AND t2.delete_mark = 0 AND t3.delete_mark = 0
+        AND t3.gender = 1
+        AND t2.stduy_status = 'FB3002' GROUP BY t1.id
+    </select>
+    <!-- 需要安排的女生总人数 -->
+    <select id="getAllStayFemaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
+        SELECT t1.id,COUNT(*) FROM base_class t1
+        LEFT JOIN base_student_school_roll t2 ON t1.id = t2.class_id
+        LEFT JOIN xjr_user t3 ON t2.user_id = t3.id
+        WHERE t1.delete_mark = 0
+        AND t2.delete_mark = 0 AND t3.delete_mark = 0
+        AND t3.gender = 2
+        AND t2.stduy_status = 'FB3002' GROUP BY t1.id
+    </select>
+    <!-- 已分配的总人数 -->
+    <select id="getAllArrangedCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
+        SELECT COUNT(*) FROM room_bed a1
+        LEFT JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id
+        LEFT JOIN xjr_user c4 ON a2.user_id = c4.id
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
+        AND a2.class_id = t1.id
+    </select>
+    <!-- 已分配的男生人数 -->
+    <select id="getAllArrangedMaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
+        SELECT a1.id,COUNT(*) FROM base_class a1
+        LEFT JOIN base_student_school_roll a2 ON a1.id = a2.class_id
+        LEFT JOIN room_bed a3 ON a2.user_id = a3.student_user_id
+        LEFT JOIN xjr_user a4 ON a3.student_user_id = a4.id AND a4.gender = 1
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
+        AND a4.delete_mark = 0
+        GROUP BY a1.idd
+    </select>
+    <!-- 已分配的女生人数 -->
+    <select id="getAllArrangedFemaleCount" resultType="com.xjrsoft.module.room.vo.ClassStudentCountVo">
+        SELECT a1.id,COUNT(*) FROM base_class a1
+        LEFT JOIN base_student_school_roll a2 ON a1.id = a2.class_id
+        LEFT JOIN room_bed a3 ON a2.user_id = a3.student_user_id
+        LEFT JOIN xjr_user a4 ON a3.student_user_id = a4.id AND a4.gender = 2
+        WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
+        AND a4.delete_mark = 0
+        GROUP BY a1.idd
+    </select>
+    <!--查询分配床位班级列表的各个人数 - 结束 -->
+
     <select id="getDistributeRoomBedInfo" parameterType="com.xjrsoft.module.room.dto.DistributeRoomBedPageDto" resultType="com.xjrsoft.module.room.vo.DistributeRoomBedPageVo">
         SELECT t1.id,t1.sort_code,t2.name AS build_name,t1.floor_number,t1.room_name,t4.name AS gender_cn, t3.name AS check_in_status_cn,
         t1.bed_count,(

+ 116 - 6
src/main/resources/sqlScript/20240112_sql.sql

@@ -8,19 +8,129 @@ CREATE TABLE evaluate_template
 (
     id BIGINT NOT NULL COMMENT '主键编号',
     `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
-    `create_date` datetime NULL DEFAULT NULL COMMENT '创建时间',
+    `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
     `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
-    `modify_date` datetime NULL DEFAULT NULL COMMENT '修改时间',
+    `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
     `delete_mark` INT NOT NULL COMMENT '删除标记',
     `enabled_mark` INT NOT NULL COMMENT '有效标志',
     `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
-    `name`  varchar(200) NULL DEFAULT NULL COMMENT '模板名称',
+    `name`  VARCHAR(200) NULL DEFAULT NULL COMMENT '模板名称',
     `evaluate_type` VARCHAR(30) NULL DEFAULT NULL COMMENT '评价类型(xjr_dictionary_item[evaluate_type])',
-    `total` float NULL DEFAULT NULL COMMENT '评价总分',
+    `total` INT NULL DEFAULT NULL COMMENT '评价总分',
     `dept_ids` json NULL DEFAULT NULL COMMENT '使用部门ids',
-    `remark` varchar(1000)NULL DEFAULT NULL  COMMENT '备注',
-    `status` int not null default 0 COMMENT '状态(0:禁用 1:启用)',
+    `remark` VARCHAR(1000)NULL DEFAULT NULL  COMMENT '备注',
+    `status` INT NOT NULL DEFAULT 0 COMMENT '状态(0:禁用 1:启用)',
     PRIMARY KEY (`id`)
 ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '评价模版';
 
+-- ----------------------------
+-- 评价项
+-- ----------------------------
+DROP TABLE IF EXISTS evaluate_item;
+CREATE TABLE evaluate_item
+(
+    id BIGINT NOT NULL COMMENT '主键编号',
+    `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
+    `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
+    `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
+    `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
+    `delete_mark` INT NOT NULL COMMENT '删除标记',
+    `enabled_mark` INT NOT NULL COMMENT '有效标志',
+    `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
+    `evaluate_template_id` BIGINT NOT NULL COMMENT '评价模版编号',
+    `topic`  VARCHAR(500) NULL DEFAULT NULL COMMENT '标题名称',
+    `problem` VARCHAR(1000) NULL DEFAULT NULL COMMENT '题目名称',
+    `score` INT NULL DEFAULT NULL COMMENT '题目分数(最小为0,只能整数)',
+    `input_not_null` INT NULL DEFAULT NULL COMMENT '输入框是否为空(1:非空,0,空)',
+    PRIMARY KEY (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '评价项';
+
+-- ----------------------------
+-- 评价结果
+-- ----------------------------
+DROP TABLE IF EXISTS evaluate_result;
+CREATE TABLE evaluate_result
+(
+    id BIGINT NOT NULL COMMENT '主键编号',
+    `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
+    `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
+    `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
+    `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
+    `delete_mark` INT NOT NULL COMMENT '删除标记',
+    `enabled_mark` INT NOT NULL COMMENT '有效标志',
+    `evaluate_item_id` BIGINT NULL DEFAULT NULL COMMENT '评价项编号',
+    `user_id`  VARCHAR(200) NULL DEFAULT NULL COMMENT '参评人编号',
+    `evaluated_object` VARCHAR(30) NULL DEFAULT NULL COMMENT '被评对象(teacher:老师,class:班级,student:学生)',
+    `evaluated_object_id` BIGINT NULL DEFAULT NULL COMMENT '被评对象编号',
+    `score` INT NULL DEFAULT NULL COMMENT '评价分数',
+    `opinion` VARCHAR(2000) NULL DEFAULT NULL COMMENT '建议/意见',
+    PRIMARY KEY (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '评价结果';
+
+-- ----------------------------
+-- 评价管理
+-- ------------------------
+DROP TABLE IF EXISTS evaluate_manage;
+CREATE TABLE evaluate_manage
+(
+    id BIGINT NOT NULL COMMENT '主键编号',
+    `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
+    `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
+    `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
+    `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
+    `delete_mark` INT NOT NULL COMMENT '删除标记',
+    `enabled_mark` INT NOT NULL COMMENT '有效标志',
+    `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
+    `evaluate_template_id` BIGINT NOT NULL COMMENT '评价模版编号',
+    `base_semester_id` BIGINT NULL DEFAULT NULL COMMENT '学期id',
+    `org_id` BIGINT NULL DEFAULT NULL COMMENT '题目分数(最小为0,只能整数)',
+    `name` VARCHAR(255) NULL DEFAULT NULL COMMENT '评价名称',
+    `start_time` DATETIME NULL DEFAULT NULL COMMENT '开始时间',
+    `end_time` DATETIME NULL DEFAULT NULL COMMENT '结束时间',
+    `status` INT NULL DEFAULT NULL COMMENT '状态(1:进行中,0,暂停)',
+    PRIMARY KEY (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '评价管理';
+
+-- ----------------------------
+-- 被评价对象
+-- ------------------------
+DROP TABLE IF EXISTS evaluate_object;
+CREATE TABLE evaluate_object
+(
+    id BIGINT NOT NULL COMMENT '主键编号',
+    `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
+    `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
+    `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
+    `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
+    `delete_mark` INT NOT NULL COMMENT '删除标记',
+    `enabled_mark` INT NOT NULL COMMENT '有效标志',
+    `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
+    `evaluate_manage_id` BIGINT NOT NULL COMMENT '评价管理编号',
+    `base_grade_id` BIGINT NULL DEFAULT NULL COMMENT '年级id',
+    `org_id` BIGINT NULL DEFAULT NULL COMMENT '题目分数(最小为0,只能整数)',
+    `object_id` BIGINT NULL DEFAULT NULL COMMENT '被评价对象id',
+    `object_type` VARCHAR(50) NULL DEFAULT NULL COMMENT '被评价对象类别(teacher:老师,class:班级,student:学生)',
+    PRIMARY KEY (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '被评价对象';
+
+-- ----------------------------
+-- 评价执行人
+-- ------------------------
+DROP TABLE IF EXISTS evaluate_executer;
+CREATE TABLE evaluate_executer
+(
+    id BIGINT NOT NULL COMMENT '主键编号',
+    `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
+    `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
+    `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
+    `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
+    `delete_mark` INT NOT NULL COMMENT '删除标记',
+    `enabled_mark` INT NOT NULL COMMENT '有效标志',
+    `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
+    `evaluate_manage_id` BIGINT NOT NULL COMMENT '评价管理编号',
+    `evaluate_object_id` BIGINT NULL DEFAULT NULL COMMENT '被评对象id',
+    `user_id` BIGINT NULL DEFAULT NULL COMMENT '参加评价的人id',
+    PRIMARY KEY (`id`)
+) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '评价执行人';
+
 -- ------------------------------------------------------------------评价--------------------------------------------------------------------