bug修复

This commit is contained in:
liumengyu
2026-08-28 17:34:56 +08:00
parent a43561af8d
commit 770d32a625
23 changed files with 464 additions and 42 deletions
@@ -1,5 +1,6 @@
package com.roomroot.web.controller.jwgl; package com.roomroot.web.controller.jwgl;
import com.roomroot.common.utils.StringUtils;
import com.roomroot.jwgl.dto.faculty.AddTeacherDTO; import com.roomroot.jwgl.dto.faculty.AddTeacherDTO;
import com.roomroot.jwgl.dto.jys.ElectiveCourseBatchDTO; import com.roomroot.jwgl.dto.jys.ElectiveCourseBatchDTO;
import com.roomroot.jwgl.dto.jys.ElectiveCourseQuery; import com.roomroot.jwgl.dto.jys.ElectiveCourseQuery;
@@ -119,7 +120,8 @@ public class JYSController {
@RequestParam(defaultValue = "20") Integer pageSize, @RequestParam(defaultValue = "20") Integer pageSize,
@RequestParam(required = false) String jysdh, @RequestParam(required = false) String jysdh,
@RequestParam(required = false) String jysmc, @RequestParam(required = false) String jysmc,
@RequestParam(required = false) String bx) { @RequestParam(required = false) String bx,
@RequestParam(required = false) String ty) {
PageQuery query = new PageQuery(); PageQuery query = new PageQuery();
query.setPageNum(pageNum); query.setPageNum(pageNum);
query.setPageSize(pageSize); query.setPageSize(pageSize);
@@ -127,6 +129,7 @@ public class JYSController {
cond.setJysdh(jysdh); cond.setJysdh(jysdh);
cond.setJysmc(jysmc); cond.setJysmc(jysmc);
cond.setBx(bx); cond.setBx(bx);
cond.setTy(StringUtils.hasText(ty) ? Integer.valueOf(ty) : null);
PageResult<JYSB> pageResult = facultyService.pageJYSB(query, cond); PageResult<JYSB> pageResult = facultyService.pageJYSB(query, cond);
return Result.success(pageResult); return Result.success(pageResult);
} }
@@ -42,6 +42,11 @@ public class SemesterCalendarController {
*/ */
@PostMapping("/update") @PostMapping("/update")
public Result<Void> update(@RequestBody XQXLB xqxlb) { public Result<Void> update(@RequestBody XQXLB xqxlb) {
if(xqxlb.getBh() == null || xqxlb.getBh().trim().isEmpty()){
return Result.error(200,"编号不得为空");
}
semesterCalendarService.update(xqxlb); semesterCalendarService.update(xqxlb);
return Result.success(); return Result.success();
} }
@@ -3,6 +3,7 @@ package com.roomroot.web.controller.jwgl;
import com.roomroot.jwgl.entity.XYXX; import com.roomroot.jwgl.entity.XYXX;
import com.roomroot.jwgl.entity.XYDNDXQJBXXB; import com.roomroot.jwgl.entity.XYDNDXQJBXXB;
import com.roomroot.jwgl.entity.XYDB; import com.roomroot.jwgl.entity.XYDB;
import com.roomroot.jwgl.entity.PXRW;
import com.roomroot.jwgl.entity.XYXJYDSQB; import com.roomroot.jwgl.entity.XYXJYDSQB;
import com.roomroot.jwgl.entity.XYXJYJJGB; import com.roomroot.jwgl.entity.XYXJYJJGB;
import com.roomroot.jwgl.entity.XYXJYJTJB; import com.roomroot.jwgl.entity.XYXJYJTJB;
@@ -44,8 +45,22 @@ public class StudentRecordsController {
@Resource @Resource
private ClassSemesterService classSemesterService; private ClassSemesterService classSemesterService;
/**
* 校验培训:按主体培训任务 0/1 查询培训任务。
*
* @param ztpxrw 主体培训任务,0-否,1-是
*/
@GetMapping("/training-tasks")
public Result<List<PXRW>> listTrainingTasks(@RequestParam("ztpxrw") Integer ztpxrw) {
return Result.success(studentRecordsService.listTrainingTasks(ztpxrw));
}
// ======================== 学员信息维护 ======================== // ======================== 学员信息维护 ========================
/**
* 新增学员。
* <p>编号由后台生成 UUID;学号按当前班次编号查学员队期表的学号前缀、学号位数顺序生成,保证不重复。</p>
*/
@PostMapping("/add") @PostMapping("/add")
public Result<Void> add(@RequestBody XYXX xyxx) { public Result<Void> add(@RequestBody XYXX xyxx) {
studentRecordsService.add(xyxx); studentRecordsService.add(xyxx);
@@ -69,6 +84,11 @@ public class StudentRecordsController {
return Result.success(studentRecordsService.getById(bh)); return Result.success(studentRecordsService.getById(bh));
} }
/**
* 分页查询学员信息。
* <p>回显年级、专业、班次、考试情况、不及格门数、管理机构。
* 当前班次编号关联学员队表、专业表、学员课程成绩。</p>
*/
@GetMapping("/list") @GetMapping("/list")
public Result<PageResult<XYXX>> list(PageQuery query, XYXX xyxx) { public Result<PageResult<XYXX>> list(PageQuery query, XYXX xyxx) {
return Result.success(studentRecordsService.pageList(query, xyxx)); return Result.success(studentRecordsService.pageList(query, xyxx));
@@ -385,21 +405,27 @@ public class StudentRecordsController {
/** /**
* 分页查询学员的课程成绩列表。 * 分页查询学员的课程成绩列表。
* <p>默认不传参数则全部分页展示;可按学员编号、年度筛选;年度不传时默认展示最新年度(最大年度)的数据。</p> * <p>
* 按课程编号、学员队编号、学号、年度筛选。学号通过学员编号关联学员信息表匹配。
* </p>
* *
* @param pageNum 页码(默认1) * @param pageNum 页码(默认1)
* @param pageSize 每页条数(默认20) * @param pageSize 每页条数(默认20)
* @param xybh 学员编号(可选) * @param kcbh 课程编号(对应成绩表科目编号,可选)
* @param xydbh 学员队编号(可选)
* @param xh 学号(可选,关联学员信息表)
* @param nd 年度(可选) * @param nd 年度(可选)
*/ */
@GetMapping("/grades") @GetMapping("/grades")
public Result<PageResult<XYKCCJ>> getGrades( public Result<PageResult<XYKCCJ>> getGrades(
@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "20") Integer pageSize, @RequestParam(defaultValue = "20") Integer pageSize,
@RequestParam(required = false) String xybh, @RequestParam(required = false) String kcbh,
@RequestParam(required = false) String xydbh,
@RequestParam(required = false) String xh,
@RequestParam(required = false) Integer nd) { @RequestParam(required = false) Integer nd) {
return Result.success(studentRecordsService.pageCourseGrades( return Result.success(studentRecordsService.pageCourseGrades(
new PageQuery(pageNum, pageSize), xybh, nd)); new PageQuery(pageNum, pageSize), kcbh, xydbh, xh, nd));
} }
/** /**
@@ -87,6 +87,7 @@ public class TrainingProgramController {
* <li>zydm — 专业代码(模糊匹配)</li> * <li>zydm — 专业代码(模糊匹配)</li>
* <li>pxlx — 培训类型(精确匹配,用于版本筛选)</li> * <li>pxlx — 培训类型(精确匹配,用于版本筛选)</li>
* <li>pxcc — 培训层次(精确匹配)</li> * <li>pxcc — 培训层次(精确匹配)</li>
* <li>ty — 停用(精确匹配)</li>
* </ul> * </ul>
* </p> * </p>
* *
@@ -2,6 +2,8 @@ package com.roomroot.web.controller.jwgl;
import com.roomroot.jwgl.entity.ZYJXJHB; import com.roomroot.jwgl.entity.ZYJXJHB;
import com.roomroot.jwgl.service.ZYJXJHBService; import com.roomroot.jwgl.service.ZYJXJHBService;
import com.roomroot.jwgl.unit.PageQuery;
import com.roomroot.jwgl.unit.PageResult;
import com.roomroot.jwgl.unit.Result; import com.roomroot.jwgl.unit.Result;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -79,9 +81,13 @@ public class ZYJXJHBController {
* @param ty 停用标识(0-正常,1-停用) * @param ty 停用标识(0-正常,1-停用)
*/ */
@GetMapping("/listByZydhAndTy") @GetMapping("/listByZydhAndTy")
public Result<List<ZYJXJHB>> listByZydhAndTy(@RequestParam("zydh") String zydh, public Result<PageResult<ZYJXJHB>> listByZydhAndTy(
@RequestParam("ty") Integer ty) { @RequestParam(defaultValue = "1") Integer pageNum,
return Result.success(zyjxjhbService.listByZydhAndTy(zydh, ty)); @RequestParam(defaultValue = "20") Integer pageSize,
@RequestParam(required = false) String zydh,
@RequestParam(required = false) Integer ty) {
return Result.success(zyjxjhbService.pageByZydhAndTy(
new PageQuery(pageNum, pageSize), zydh, ty));
} }
/** /**
@@ -18,9 +18,9 @@ import java.time.LocalDateTime;
public class JCXX extends BaseEntity { public class JCXX extends BaseEntity {
/** /**
* 教研室代号 * 主键ID
*/ */
@TableId(value = "ID", type = IdType.INPUT) @TableId(value = "ID")
private String id; private String id;
/** /**
@@ -3,6 +3,7 @@ package com.roomroot.jwgl.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.roomroot.jwgl.unit.BaseEntity; import com.roomroot.jwgl.unit.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -99,8 +100,9 @@ public class PXRW extends BaseEntity {
private String ssdw; private String ssdw;
/** /**
* 主体培训任务 * 主体培训任务:0-否,1-是
*/ */
@TableField("主体培训任务")
private Integer ztpxrw; private Integer ztpxrw;
} }
@@ -216,4 +216,28 @@ public class XYXX {
/** 异动历史JSON数组,每条记录含 from/to/time/reason */ /** 异动历史JSON数组,每条记录含 from/to/time/reason */
@TableField("异动历史") @TableField("异动历史")
private String transferHistory; private String transferHistory;
/** 年级(当前班次关联学员队表,仅列表回显) */
@TableField(exist = false)
private String nj;
/** 专业(当前班次关联专业表,仅列表回显) */
@TableField(exist = false)
private String zy;
/** 班次(当前班次对应学员队名称,仅列表回显) */
@TableField(exist = false)
private String bc;
/** 考试情况(当前班次关联学员课程成绩汇总,仅列表回显) */
@TableField(exist = false)
private String ksqk;
/** 不及格门数(当前班次关联学员课程成绩统计,仅列表回显) */
@TableField(exist = false)
private Integer bjgms;
/** 管理机构(专业表教学管理机构,仅列表回显) */
@TableField(exist = false)
private String gljg;
} }
@@ -34,7 +34,9 @@
<if test="jysb.bx != null and jysb.bx != ''"> <if test="jysb.bx != null and jysb.bx != ''">
AND 部系 LIKE CONCAT('%', #{jysb.bx}, '%') AND 部系 LIKE CONCAT('%', #{jysb.bx}, '%')
</if> </if>
ORDER BY 序号 <if test="jysb.ty != null and jysb.ty != ''">
AND 停用 = #{jysb.ty}
</if>
</select> </select>
</mapper> </mapper>
@@ -0,0 +1,22 @@
package com.roomroot.jwgl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.roomroot.jwgl.entity.PXRW;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 培训任务 Mapper。
*/
@Mapper
public interface PXRWMapper extends BaseMapper<PXRW> {
/**
* 按主体培训任务标志查询培训任务。
*
* @param ztpxrw 主体培训任务:0-否,1-是
*/
List<PXRW> selectByZtpxrw(@Param("ztpxrw") Integer ztpxrw);
}
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.roomroot.jwgl.mapper.PXRWMapper">
<resultMap id="BaseResultMap" type="com.roomroot.jwgl.entity.PXRW">
<id column="标识号" property="bsh"/>
<result column="序号" property="xh"/>
<result column="任务来源" property="rwly"/>
<result column="年级" property="nj"/>
<result column="在校状态" property="zxzt"/>
<result column="任务类别" property="rwlb"/>
<result column="入学日期" property="rxrq"/>
<result column="毕业日期" property="byrq"/>
<result column="备注" property="bz"/>
<result column="学科专业信息标识号" property="xkzyxxbsh"/>
<result column="名称" property="mc"/>
<result column="计划人数" property="jhrs"/>
<result column="任务说明" property="rwsm"/>
<result column="计划班次数" property="jhbcs"/>
<result column="JSONZD" property="jsonzd"/>
<result column="所属单位" property="ssdw"/>
<result column="主体培训任务" property="ztpxrw"/>
</resultMap>
<sql id="Base_Column_List">
"标识号", "序号", "任务来源", "年级", "在校状态", "任务类别",
"入学日期", "毕业日期", "备注", "学科专业信息标识号", "名称",
"计划人数", "任务说明", "计划班次数", "JSONZD", "所属单位", "主体培训任务"
</sql>
<select id="selectByZtpxrw" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM "培训任务"
WHERE "主体培训任务" = #{ztpxrw}
ORDER BY "序号", "标识号"
</select>
</mapper>
@@ -16,11 +16,14 @@ public interface XYKCCJMapper extends BaseMapper<XYKCCJ> {
/** /**
* 分页条件查询课程成绩。 * 分页条件查询课程成绩。
* <p>学员编号、年度可选;年度未传时默认取最大年度(最新年度)的数据。</p> * <p>按课程编号(科目编号)、学员队编号、学号、年度筛选。学号经学员编号关联学员信息表匹配。</p>
*/ */
Page<XYKCCJ> selectPageByCondition(Page<XYKCCJ> page, Page<XYKCCJ> selectPageByCondition(Page<XYKCCJ> page,
@Param("xybh") String xybh, @Param("kcbh") String kcbh,
@Param("nd") Integer nd); @Param("xydbh") String xydbh,
@Param("xh") String xh,
@Param("nd") Integer nd,
@Param("xybh") String xybh);
/** 按学员队查询成绩(含学员姓名学号) */ /** 按学员队查询成绩(含学员姓名学号) */
List<StudentGradeVO> selectGradeByXydbh(@Param("xydbh") String xydbh, @Param("kmbh") String kmbh); List<StudentGradeVO> selectGradeByXydbh(@Param("xydbh") String xydbh, @Param("kmbh") String kmbh);
@@ -36,21 +36,31 @@
ORDER BY 年度 DESC, 科目编号 ORDER BY 年度 DESC, 科目编号
</select> </select>
<!-- 分页条件查询课程成绩:学员编号、年度可选;年度未传时默认取最大年度(最新年度) --> <!-- 分页条件查询课程成绩:课程编号、学员队编号、学号、年度可选;学号经学员编号关联学员信息表 -->
<select id="selectPageByCondition" resultMap="BaseResultMap"> <select id="selectPageByCondition" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> SELECT
FROM "学员课程成绩" c."编号", c."课程成绩编号", c."学员编号", c."考试成绩", c."平时成绩", c."最终成绩", c."备注",
c."补考成绩", c."补考次数", c."考试情况", c."原始考试成绩", c."原始平时成绩", c."期望学分",
c."年度", c."课类型", c."科目编号", c."学员队编号", c."已通过"
FROM "学员课程成绩" c
LEFT JOIN "学员信息表" s ON s."编号" = c."学员编号"
WHERE 1=1 WHERE 1=1
<if test="xybh != null and xybh != ''"> <if test="kcbh != null and kcbh != ''">
AND 学员编号 = #{xybh} AND c."科目编号" = #{kcbh}
</if>
<if test="xydbh != null and xydbh != ''">
AND c."学员队编号" = #{xydbh}
</if>
<if test="xh != null and xh != ''">
AND s."学号" = #{xh}
</if> </if>
<if test="nd != null"> <if test="nd != null">
AND 年度 = #{nd} AND c."年度" = #{nd}
</if> </if>
<if test="nd == null"> <if test="xybh != null and xybh != ''">
AND 年度 = (SELECT MAX(年度) FROM "学员课程成绩") AND c."学员编号" = #{xybh}
</if> </if>
ORDER BY 年度 DESC, 科目编号 ORDER BY c."年度" DESC, c."科目编号"
</select> </select>
<resultMap id="GradeResultMap" type="com.roomroot.jwgl.vo.elective.StudentGradeVO"> <resultMap id="GradeResultMap" type="com.roomroot.jwgl.vo.elective.StudentGradeVO">
@@ -3,9 +3,12 @@ package com.roomroot.jwgl.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.roomroot.jwgl.entity.XYXX; import com.roomroot.jwgl.entity.XYXX;
import com.roomroot.jwgl.vo.StudentListEchoVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 学员信息表 Mapper * 学员信息表 Mapper
*/ */
@@ -16,4 +19,10 @@ public interface XYXXMapper extends BaseMapper<XYXX> {
* 分页查询学员信息(支持条件筛选) * 分页查询学员信息(支持条件筛选)
*/ */
Page<XYXX> selectPageList(Page<XYXX> page, @Param("xyxx") XYXX xyxx); Page<XYXX> selectPageList(Page<XYXX> page, @Param("xyxx") XYXX xyxx);
/**
* 按学员编号批量回显年级、专业、班次、考试情况、不及格门数、管理机构。
* 当前班次编号关联学员队表、专业表、学员课程成绩。
*/
List<StudentListEchoVO> selectEchoByStudentIds(@Param("ids") List<String> ids);
} }
@@ -89,4 +89,38 @@
ORDER BY 学号 ORDER BY 学号
</select> </select>
<!-- 当前班次编号 → 学员队表 / 专业表 / 学员课程成绩 -->
<select id="selectEchoByStudentIds" resultType="com.roomroot.jwgl.vo.StudentListEchoVO">
SELECT
a."编号" AS bh,
t."年级" AS nj,
p."专业名称" AS zy,
t."学员队名称" AS bc,
g."考试情况" AS ksqk,
COALESCE(g."不及格门数", 0) AS bjgms,
COALESCE(j."名称", t."所属单位") AS gljg
FROM "学员信息表" a
LEFT JOIN "学员队表" t ON t."学员队编号" = a."当前班次编号"
LEFT JOIN "专业表" p ON p."专业代号" = t."专业代号"
LEFT JOIN "教学管理机构" j ON j."编号" = p."教学管理机构编号"
LEFT JOIN (
SELECT
c."学员编号",
WM_CONCAT(DISTINCT NULLIF(TRIM(c."考试情况"), '')) AS "考试情况",
SUM(CASE WHEN c."已通过" = 0 THEN 1 ELSE 0 END) AS "不及格门数"
FROM "学员课程成绩" c
INNER JOIN "学员信息表" a2 ON a2."编号" = c."学员编号"
WHERE c."学员编号" IN
<foreach collection="ids" item="gid" open="(" separator="," close=")">
#{gid}
</foreach>
AND (a2."当前班次编号" IS NULL OR c."学员队编号" = a2."当前班次编号")
GROUP BY c."学员编号"
) g ON g."学员编号" = a."编号"
WHERE a."编号" IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper> </mapper>
@@ -49,7 +49,10 @@
SELECT SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
FROM "专业表" FROM "专业表"
WHERE 停用 = 0 WHERE 1=1
<if test="zyb.ty != null and zyb.ty != ''">
AND 停用 = #{zyb.ty},
</if>
<if test="zyb.zymc != null and zyb.zymc != ''"> <if test="zyb.zymc != null and zyb.zymc != ''">
AND 专业名称 LIKE CONCAT('%', #{zyb.zymc}, '%') AND 专业名称 LIKE CONCAT('%', #{zyb.zymc}, '%')
</if> </if>
@@ -2,6 +2,7 @@ package com.roomroot.jwgl.service;
import com.roomroot.jwgl.entity.XYXX; import com.roomroot.jwgl.entity.XYXX;
import com.roomroot.jwgl.entity.XYDB; import com.roomroot.jwgl.entity.XYDB;
import com.roomroot.jwgl.entity.PXRW;
import com.roomroot.jwgl.entity.XYXJYDSQB; import com.roomroot.jwgl.entity.XYXJYDSQB;
import com.roomroot.jwgl.entity.XYXJYJJGB; import com.roomroot.jwgl.entity.XYXJYJJGB;
import com.roomroot.jwgl.entity.XYXJYJTJB; import com.roomroot.jwgl.entity.XYXJYJTJB;
@@ -23,7 +24,7 @@ import java.util.List;
*/ */
public interface StudentRecordsService { public interface StudentRecordsService {
/** 新增学员 */ /** 新增学员。编号后台生成 UUID;学号按当前班次在学员队期表的学号前缀、学号位数顺序生成。 */
void add(XYXX xyxx); void add(XYXX xyxx);
/** 删除学员(退学处理) */ /** 删除学员(退学处理) */
@@ -47,8 +48,8 @@ public interface StudentRecordsService {
// ========== 学员课程成绩查询 ========== // ========== 学员课程成绩查询 ==========
/** 分页查询学员的课程成绩列表(按学员编号、年度筛选,年度为空默认最新年度) */ /** 分页查询学员的课程成绩列表(按课程编号、学员队编号、学号、年度筛选) */
PageResult<XYKCCJ> pageCourseGrades(PageQuery query, String xybh, Integer nd); PageResult<XYKCCJ> pageCourseGrades(PageQuery query, String kcbh, String xydbh, String xh, Integer nd);
/** 分页查询学员的课程过程成绩列表(按学员编号、年度筛选,年度为空默认最新年度) */ /** 分页查询学员的课程过程成绩列表(按学员编号、年度筛选,年度为空默认最新年度) */
PageResult<XYKCGCCJ> pageCourseProcessGrades(PageQuery query, String xybh, Integer nd); PageResult<XYKCGCCJ> pageCourseProcessGrades(PageQuery query, String xybh, Integer nd);
@@ -127,4 +128,11 @@ public interface StudentRecordsService {
/** 从 Excel(.xls/.xlsx) 批量导入学员信息 */ /** 从 Excel(.xls/.xlsx) 批量导入学员信息 */
int importStudents(MultipartFile file) throws Exception; int importStudents(MultipartFile file) throws Exception;
/**
* 按主体培训任务标志查询培训任务。
*
* @param ztpxrw 主体培训任务:0-否,1-是
*/
List<PXRW> listTrainingTasks(Integer ztpxrw);
} }
@@ -1,6 +1,8 @@
package com.roomroot.jwgl.service; package com.roomroot.jwgl.service;
import com.roomroot.jwgl.entity.ZYJXJHB; import com.roomroot.jwgl.entity.ZYJXJHB;
import com.roomroot.jwgl.unit.PageQuery;
import com.roomroot.jwgl.unit.PageResult;
import java.util.List; import java.util.List;
@@ -53,13 +55,15 @@ public interface ZYJXJHBService {
List<ZYJXJHB> list(); List<ZYJXJHB> list();
/** /**
* 根据专业代号和停用标识查询 * 分页查询专业教学计划。
* <p>专业代号、停用标识可选,传了才作为等值条件过滤;不传则查询全部。</p>
* *
* @param zydh 专业代号 * @param query 分页参数
* @param ty 停用标识(0-正常,1-停用) * @param zydh 专业代号(可选)
* @return 列表 * @param ty 停用标识(可选,0-正常,1-停用)
* @return 分页结果
*/ */
List<ZYJXJHB> listByZydhAndTy(String zydh, Integer ty); PageResult<ZYJXJHB> pageByZydhAndTy(PageQuery query, String zydh, Integer ty);
/** 从 Excel(.xls/.xlsx) 导入专业教学计划 */ /** 从 Excel(.xls/.xlsx) 导入专业教学计划 */
int importZYJXJHBFromExcel(org.springframework.web.multipart.MultipartFile file) throws Exception; int importZYJXJHBFromExcel(org.springframework.web.multipart.MultipartFile file) throws Exception;
@@ -44,6 +44,7 @@ public class DisciplineServiceImpl implements DisciplineService {
@Transactional @Transactional
public void add(XKZYXX entity) { public void add(XKZYXX entity) {
entity.setTy(0); entity.setTy(0);
entity.setBsh(UuidUtil.getUUID());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
entity.setTysj(sdf.format(new Date())); entity.setTysj(sdf.format(new Date()));
xkzyxxMapper.insert(entity); xkzyxxMapper.insert(entity);
@@ -39,7 +39,6 @@ public class SemesterCalendarServiceImpl implements SemesterCalendarService {
XQXLB query = new XQXLB(); XQXLB query = new XQXLB();
//将日期分为年度和月日 //将日期分为年度和月日
LocalDate date = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd")); LocalDate date = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
int nd = date.getYear(); int nd = date.getYear();
String md = String.format("%02d%02d", date.getMonthValue(), date.getDayOfMonth()); String md = String.format("%02d%02d", date.getMonthValue(), date.getDayOfMonth());
query.setJqsj(md); query.setJqsj(md);
@@ -81,6 +80,7 @@ public class SemesterCalendarServiceImpl implements SemesterCalendarService {
@Override @Override
public void update(XQXLB xqxlb) { public void update(XQXLB xqxlb) {
xqxlbMapper.updateById(xqxlb); xqxlbMapper.updateById(xqxlb);
} }
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.roomroot.common.exception.ServiceException; import com.roomroot.common.exception.ServiceException;
import com.roomroot.jwgl.entity.XYXX; import com.roomroot.jwgl.entity.XYXX;
import com.roomroot.jwgl.entity.XYDB; import com.roomroot.jwgl.entity.XYDB;
import com.roomroot.jwgl.entity.XYDQB;
import com.roomroot.jwgl.entity.PXRW;
import com.roomroot.jwgl.entity.XYXJYDSQB; import com.roomroot.jwgl.entity.XYXJYDSQB;
import com.roomroot.jwgl.entity.XYXJYJJGB; import com.roomroot.jwgl.entity.XYXJYJJGB;
import com.roomroot.jwgl.entity.XYXJYJTJB; import com.roomroot.jwgl.entity.XYXJYJTJB;
@@ -14,6 +16,8 @@ import com.roomroot.jwgl.entity.XYKCCJ;
import com.roomroot.jwgl.entity.XYKCGCCJ; import com.roomroot.jwgl.entity.XYKCGCCJ;
import com.roomroot.jwgl.mapper.XYXXMapper; import com.roomroot.jwgl.mapper.XYXXMapper;
import com.roomroot.jwgl.mapper.XYDBMapper; import com.roomroot.jwgl.mapper.XYDBMapper;
import com.roomroot.jwgl.mapper.XYDQBMapper;
import com.roomroot.jwgl.mapper.PXRWMapper;
import com.roomroot.jwgl.mapper.XYXJYDSQBMapper; import com.roomroot.jwgl.mapper.XYXJYDSQBMapper;
import com.roomroot.jwgl.mapper.XYXJYJJGBMapper; import com.roomroot.jwgl.mapper.XYXJYJJGBMapper;
import com.roomroot.jwgl.mapper.XYXJYJTJBMapper; import com.roomroot.jwgl.mapper.XYXJYJTJBMapper;
@@ -24,6 +28,8 @@ import com.roomroot.jwgl.unit.PageQuery;
import com.roomroot.jwgl.unit.PageResult; import com.roomroot.jwgl.unit.PageResult;
import com.roomroot.jwgl.utils.ExcelParseUtil; import com.roomroot.jwgl.utils.ExcelParseUtil;
import com.roomroot.jwgl.utils.JwglRoleHelper; import com.roomroot.jwgl.utils.JwglRoleHelper;
import com.roomroot.jwgl.utils.UuidUtil;
import com.roomroot.jwgl.vo.StudentListEchoVO;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
@@ -39,7 +45,10 @@ import java.lang.reflect.Field;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import static com.roomroot.jwgl.utils.BasicManagementConstants.FORBIDDEN; import static com.roomroot.jwgl.utils.BasicManagementConstants.FORBIDDEN;
@@ -56,6 +65,12 @@ public class StudentRecordsServiceImpl implements StudentRecordsService {
@Resource @Resource
private XYDBMapper xydbMapper; private XYDBMapper xydbMapper;
@Resource
private XYDQBMapper xydqbMapper;
@Resource
private PXRWMapper pxrwMapper;
@Resource @Resource
private XYXJYDSQBMapper xyxjydsqbMapper; private XYXJYDSQBMapper xyxjydsqbMapper;
@@ -78,12 +93,112 @@ public class StudentRecordsServiceImpl implements StudentRecordsService {
@Transactional @Transactional
public void add(XYXX xyxx) { public void add(XYXX xyxx) {
denyStudentWrite(); denyStudentWrite();
if (xyxx == null) {
throw new ServiceException("学员信息不能为空");
}
String classId = trimToNull(xyxx.getDqbzbh());
if (classId == null) {
throw new ServiceException("当前班次编号不能为空");
}
xyxx.setDqbzbh(classId);
xyxx.setBh(UuidUtil.getOriginalUUID());
XYDQB period = findPeriodByClassId(classId);
if (period == null) {
throw new ServiceException("未找到当前班次对应的学员队期,无法生成学号");
}
xyxx.setXh(generateStudentNumber(period, classId));
if (trimToNull(xyxx.getXydqbh()) == null) {
xyxx.setXydqbh(period.getBh());
}
xyxx.setTxzt(0); xyxx.setTxzt(0);
xyxx.setLjzt(0); xyxx.setLjzt(0);
xyxx.setFbzt(0); xyxx.setFbzt(0);
xyxxMapper.insert(xyxx); xyxxMapper.insert(xyxx);
} }
/**
* 按当前班次在学员队期表中的学号前缀、学号位数,顺序生成不重复学号。
*/
private String generateStudentNumber(XYDQB period, String classId) {
String prefix = period.getXhqz() == null ? "" : period.getXhqz().trim();
int digits = (period.getXhws() == null || period.getXhws() <= 0) ? 3 : period.getXhws();
int seq = maxSequence(prefix, digits, classId) + 1;
int max = (int) Math.pow(10, digits) - 1;
while (seq <= max) {
String studentNo = prefix + padNumber(seq, digits);
Long exists = xyxxMapper.selectCount(new LambdaQueryWrapper<XYXX>().eq(XYXX::getXh, studentNo));
if (exists == null || exists == 0) {
return studentNo;
}
seq++;
}
throw new ServiceException("该班次学号已用尽,请调整学员队期的学号位数");
}
private XYDQB findPeriodByClassId(String classId) {
return xydqbMapper.selectOne(new LambdaQueryWrapper<XYDQB>()
.eq(XYDQB::getXydbh, classId)
.orderByDesc(XYDQB::getRxrq)
.last("LIMIT 1"));
}
private int maxSequence(String prefix, int digits, String classId) {
LambdaQueryWrapper<XYXX> wrapper = new LambdaQueryWrapper<>();
if (!prefix.isEmpty()) {
wrapper.likeRight(XYXX::getXh, prefix);
} else {
wrapper.eq(XYXX::getDqbzbh, classId);
}
wrapper.select(XYXX::getXh);
List<XYXX> list = xyxxMapper.selectList(wrapper);
int max = 0;
int prefixLen = prefix.length();
int expectedLen = prefixLen + digits;
for (XYXX row : list) {
if (row == null || row.getXh() == null) {
continue;
}
String xh = row.getXh().trim();
if (!xh.startsWith(prefix) || xh.length() != expectedLen) {
continue;
}
String suffix = xh.substring(prefixLen);
if (!isDigits(suffix)) {
continue;
}
int value = Integer.parseInt(suffix);
if (value > max) {
max = value;
}
}
return max;
}
private String padNumber(int value, int digits) {
String text = String.valueOf(value);
if (text.length() >= digits) {
return text;
}
StringBuilder builder = new StringBuilder(digits);
for (int i = text.length(); i < digits; i++) {
builder.append('0');
}
builder.append(text);
return builder.toString();
}
private boolean isDigits(String text) {
if (text == null || text.isEmpty()) {
return false;
}
for (int i = 0; i < text.length(); i++) {
if (!Character.isDigit(text.charAt(i))) {
return false;
}
}
return true;
}
@Override @Override
@Transactional @Transactional
public void delete(String bh) { public void delete(String bh) {
@@ -115,10 +230,51 @@ public class StudentRecordsServiceImpl implements StudentRecordsService {
} }
Page<XYXX> page = new Page<>(query.getPageNum(), query.getPageSize()); Page<XYXX> page = new Page<>(query.getPageNum(), query.getPageSize());
Page<XYXX> result = xyxxMapper.selectPage(page, buildQueryWrapper(filter)); Page<XYXX> result = xyxxMapper.selectPage(page, buildQueryWrapper(filter));
fillListEcho(result.getRecords());
return new PageResult<>(result.getRecords(), result.getTotal(), return new PageResult<>(result.getRecords(), result.getTotal(),
query.getPageNum(), query.getPageSize()); query.getPageNum(), query.getPageSize());
} }
/**
* 当前班次编号关联学员队表、专业表、学员课程成绩,回显年级、专业、班次、考试情况、不及格门数、管理机构。
*/
private void fillListEcho(List<XYXX> records) {
if (records == null || records.isEmpty()) {
return;
}
List<String> ids = new ArrayList<>();
for (XYXX row : records) {
if (row != null && row.getBh() != null && !row.getBh().isEmpty()) {
ids.add(row.getBh());
}
}
if (ids.isEmpty()) {
return;
}
List<StudentListEchoVO> echos = xyxxMapper.selectEchoByStudentIds(ids);
if (echos == null || echos.isEmpty()) {
return;
}
Map<String, StudentListEchoVO> byId = new HashMap<>();
for (StudentListEchoVO echo : echos) {
if (echo != null && echo.getBh() != null) {
byId.put(echo.getBh(), echo);
}
}
for (XYXX row : records) {
StudentListEchoVO echo = byId.get(row.getBh());
if (echo == null) {
continue;
}
row.setNj(echo.getNj());
row.setZy(echo.getZy());
row.setBc(echo.getBc());
row.setKsqk(echo.getKsqk());
row.setBjgms(echo.getBjgms() == null ? 0 : echo.getBjgms());
row.setGljg(echo.getGljg());
}
}
/** /**
* 全字段动态查询条件。 * 全字段动态查询条件。
* <p> * <p>
@@ -135,6 +291,10 @@ public class StudentRecordsServiceImpl implements StudentRecordsService {
// 需要模糊匹配的字段(属性名) // 需要模糊匹配的字段(属性名)
Set<String> fuzzyFields = Set.of("xm", "lxdh", "txdz"); Set<String> fuzzyFields = Set.of("xm", "lxdh", "txdz");
for (Field field : XYXX.class.getDeclaredFields()) { for (Field field : XYXX.class.getDeclaredFields()) {
TableField tableField = field.getAnnotation(TableField.class);
if (tableField != null && !tableField.exist()) {
continue;
}
Object value = getFieldValue(field, query); Object value = getFieldValue(field, query);
if (value == null || !(value instanceof String) || ((String) value).isEmpty()) { if (value == null || !(value instanceof String) || ((String) value).isEmpty()) {
continue; continue;
@@ -191,13 +351,14 @@ public class StudentRecordsServiceImpl implements StudentRecordsService {
// ========== 学员课程成绩查询 ========== // ========== 学员课程成绩查询 ==========
@Override @Override
public PageResult<XYKCCJ> pageCourseGrades(PageQuery query, String xybh, Integer nd) { public PageResult<XYKCCJ> pageCourseGrades(PageQuery query, String kcbh, String xydbh, String xh, Integer nd) {
String studentId = xybh; String selfStudentId = null;
if (jwglRoleHelper.isStudent()) { if (jwglRoleHelper.isStudent()) {
studentId = jwglRoleHelper.requireStudentId(); selfStudentId = jwglRoleHelper.requireStudentId();
} }
Page<XYKCCJ> page = new Page<>(query.getPageNum(), query.getPageSize()); Page<XYKCCJ> page = new Page<>(query.getPageNum(), query.getPageSize());
Page<XYKCCJ> result = xykccjMapper.selectPageByCondition(page, studentId, nd); Page<XYKCCJ> result = xykccjMapper.selectPageByCondition(
page, trimToNull(kcbh), trimToNull(xydbh), trimToNull(xh), nd, selfStudentId);
return new PageResult<>(result.getRecords(), result.getTotal(), return new PageResult<>(result.getRecords(), result.getTotal(),
query.getPageNum(), query.getPageSize()); query.getPageNum(), query.getPageSize());
} }
@@ -387,6 +548,7 @@ public class StudentRecordsServiceImpl implements StudentRecordsService {
@Transactional @Transactional
public void addApplication(XYXJYDSQB entity) { public void addApplication(XYXJYDSQB entity) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
entity.setBh(UuidUtil.getUUID());
entity.setCjsj(now); entity.setCjsj(now);
entity.setXgsj(now); entity.setXgsj(now);
// 状态默认待审核(0) // 状态默认待审核(0)
@@ -668,7 +830,24 @@ public class StudentRecordsServiceImpl implements StudentRecordsService {
return list.size(); return list.size();
} }
@Override
public List<PXRW> listTrainingTasks(Integer ztpxrw) {
if (ztpxrw == null || (ztpxrw != 0 && ztpxrw != 1)) {
throw new ServiceException("主体培训任务只能为 0 或 1");
}
List<PXRW> list = pxrwMapper.selectByZtpxrw(ztpxrw);
return list == null ? new ArrayList<>() : list;
}
private String nvl(String value) { private String nvl(String value) {
return value == null ? "" : value; return value == null ? "" : value;
} }
private String trimToNull(String value) {
if (value == null) {
return null;
}
String text = value.trim();
return text.isEmpty() ? null : text;
}
} }
@@ -2,9 +2,12 @@ package com.roomroot.jwgl.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.roomroot.jwgl.entity.ZYJXJHB; import com.roomroot.jwgl.entity.ZYJXJHB;
import com.roomroot.jwgl.mapper.ZYJXJHBMapper; import com.roomroot.jwgl.mapper.ZYJXJHBMapper;
import com.roomroot.jwgl.service.ZYJXJHBService; import com.roomroot.jwgl.service.ZYJXJHBService;
import com.roomroot.jwgl.unit.PageQuery;
import com.roomroot.jwgl.unit.PageResult;
import com.roomroot.jwgl.utils.UuidUtil; import com.roomroot.jwgl.utils.UuidUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -65,11 +68,19 @@ public class ZYJXJHBServiceImpl implements ZYJXJHBService {
} }
@Override @Override
public List<ZYJXJHB> listByZydhAndTy(String zydh, Integer ty) { public PageResult<ZYJXJHB> pageByZydhAndTy(PageQuery query, String zydh, Integer ty) {
Page<ZYJXJHB> page = new Page<>(query.getPageNum(), query.getPageSize());
LambdaQueryWrapper<ZYJXJHB> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ZYJXJHB> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ZYJXJHB::getZydh, zydh) if (zydh != null && !zydh.isEmpty()) {
.eq(ZYJXJHB::getTy, ty); wrapper.eq(ZYJXJHB::getZydh, zydh);
return zyjxjhbMapper.selectList(wrapper); }
if (ty != null) {
wrapper.eq(ZYJXJHB::getTy, ty);
}
wrapper.orderByAsc(ZYJXJHB::getZydh);
Page<ZYJXJHB> result = zyjxjhbMapper.selectPage(page, wrapper);
return new PageResult<>(result.getRecords(), result.getTotal(),
query.getPageNum(), query.getPageSize());
} }
@Override @Override
@@ -0,0 +1,31 @@
package com.roomroot.jwgl.vo;
import lombok.Data;
/**
* 学员列表回显字段:年级、专业、班次、考试情况、不及格门数、管理机构。
*/
@Data
public class StudentListEchoVO {
/** 学员编号 */
private String bh;
/** 年级 */
private String nj;
/** 专业 */
private String zy;
/** 班次 */
private String bc;
/** 考试情况 */
private String ksqk;
/** 不及格门数 */
private Integer bjgms;
/** 管理机构 */
private String gljg;
}