添加学员培训记录管理和统计功能

dev
zhangyue 2026-01-31 08:59:14 +08:00
parent 2bda8de692
commit 74d18fd83c
17 changed files with 242 additions and 8 deletions

View File

@ -43,6 +43,7 @@ public class ArchivesController {
public SingleResponse<PersonArchivesDTO> getAttendanceRecord(@RequestBody ClassArchivesQry qry) { public SingleResponse<PersonArchivesDTO> getAttendanceRecord(@RequestBody ClassArchivesQry qry) {
return studentService.getAttendanceRecord(qry); return studentService.getAttendanceRecord(qry);
} }
@ApiOperation("查询学习档案") @ApiOperation("查询学习档案")
@PostMapping("/getStudyArchives") @PostMapping("/getStudyArchives")
public SingleResponse<PersonArchivesDTO> getStudyArchives(@RequestBody ClassArchivesQry qry) { public SingleResponse<PersonArchivesDTO> getStudyArchives(@RequestBody ClassArchivesQry qry) {

View File

@ -48,6 +48,11 @@ public class StudentController {
public PageResponse<StudentCO> page(@RequestBody StudentPageQry qry) { public PageResponse<StudentCO> page(@RequestBody StudentPageQry qry) {
return studentService.listPage(qry); return studentService.listPage(qry);
} }
@ApiOperation("培训记录管理分页")
@PostMapping("/listPageClassByStudent")
public PageResponse<StudentCO> listPageClassByStudent(@RequestBody StudentPageQry qry) {
return studentService.listPageClassByStudent(qry);
}
@ApiOperation("所有数据") @ApiOperation("所有数据")
@GetMapping("/listAll") @GetMapping("/listAll")
@ -55,18 +60,32 @@ public class StudentController {
return MultiResponse.of(new ArrayList<StudentCO>()); return MultiResponse.of(new ArrayList<StudentCO>());
} }
@ApiOperation("查询用户统计")
@PostMapping("/listStudentCount")
public MultiResponse<StudentCO> listStudentCount(@RequestBody StudentCountQry qry) {
return studentService.listStudentCount(qry);
}
@ApiOperation("详情") @ApiOperation("详情")
@GetMapping("/{id}") @GetMapping("/{id}")
public SingleResponse<StudentCO> getInfoById(@PathVariable("id") Long id) { public SingleResponse<StudentCO> getInfoById(@PathVariable("id") Long id) {
return SingleResponse.of(new StudentCO()); return SingleResponse.of(new StudentCO());
} }
@ApiOperation("查看学员详情")
@GetMapping("/getInfoByStudentId/{studentId}")
public SingleResponse<StudentCO> getInfoByStudentId(@PathVariable("studentId") String studentId) {
return studentService.getInfoByStudentId(studentId);
}
@ApiOperation("班级内学员数") @ApiOperation("班级内学员数")
@GetMapping("/countStudent/{classId}") @GetMapping("/countStudent/{classId}")
public SingleResponse<Long> countStudent(@PathVariable("classId") String classId) { public SingleResponse<Long> countStudent(@PathVariable("classId") String classId) {
return SingleResponse.of(studentService.countStudent(classId)); return SingleResponse.of(studentService.countStudent(classId));
} }
@ApiOperation("班级内学员数") @ApiOperation("根据企业统计学员")
@PostMapping("/countStudentByCorpId") @PostMapping("/countStudentByCorpId")
public MultiResponse<StudentCO> countStudentByCorpId(@RequestBody StudentCountQry qry) { public MultiResponse<StudentCO> countStudentByCorpId(@RequestBody StudentCountQry qry) {
return studentService.countStudentByCorpId(qry); return studentService.countStudentByCorpId(qry);

View File

@ -57,6 +57,13 @@ public class StudentQueryExe {
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex()); return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
} }
public PageResponse<StudentCO> executelistPageClassByStudent(StudentPageQry studentPageQry) {
Map<String, Object> params = PageQueryHelper.toHashMap(studentPageQry);
PageResponse<StudentDO> pageResponse = studentRepository.listPageClassByStudent(params);
List<StudentCO> examCenterCOS = studentCoConvertor.converDOsToCOs(pageResponse.getData());
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
}
public SingleResponse<PersonArchivesDTO> executeAttendanceRecord(ClassArchivesQry qry){ public SingleResponse<PersonArchivesDTO> executeAttendanceRecord(ClassArchivesQry qry){
StudentDO studentDO = studentRepository.getById(qry.getStuId()); StudentDO studentDO = studentRepository.getById(qry.getStuId());
StudentE studentE = new StudentE(); StudentE studentE = new StudentE();
@ -216,6 +223,17 @@ public class StudentQueryExe {
List<StudentCO> studentCOList = BeanUtil.copyToList(studentDOList, StudentCO.class); List<StudentCO> studentCOList = BeanUtil.copyToList(studentDOList, StudentCO.class);
return MultiResponse.of(studentCOList); return MultiResponse.of(studentCOList);
} }
public MultiResponse<StudentCO> executeListStudentCount(StudentCountQry qry){
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
List<StudentDO> studentDOList = studentRepository.listStudentCount(params);
List<StudentCO> studentCOList = BeanUtil.copyToList(studentDOList, StudentCO.class);
return MultiResponse.of(studentCOList);
}
public SingleResponse<StudentCO> executeGetInfoByStudentId(String studentId){
StudentDO studentDO = studentRepository.findInfoByStudentId(studentId);
StudentCO studentCO = BeanUtil.copyProperties(studentDO, StudentCO.class);
return SingleResponse.of(studentCO);
}
} }

View File

@ -42,6 +42,11 @@ public class StudentServiceImpl implements StudentServiceI {
return studentQueryExe.execute(qry); return studentQueryExe.execute(qry);
} }
@Override
public PageResponse<StudentCO> listPageClassByStudent(StudentPageQry qry) {
return studentQueryExe.executelistPageClassByStudent(qry);
}
@Override @Override
public SingleResponse add(List<StudentAddCmd> cmdList) { public SingleResponse add(List<StudentAddCmd> cmdList) {
@ -97,5 +102,15 @@ public class StudentServiceImpl implements StudentServiceI {
public MultiResponse<StudentCO> countStudentByCorpId(StudentCountQry qry) { public MultiResponse<StudentCO> countStudentByCorpId(StudentCountQry qry) {
return studentQueryExe.executeCountStudentByCorpId(qry); return studentQueryExe.executeCountStudentByCorpId(qry);
} }
@Override
public MultiResponse<StudentCO> listStudentCount(StudentCountQry qry) {
return studentQueryExe.executeListStudentCount(qry);
}
@Override
public SingleResponse<StudentCO> getInfoByStudentId(String studentId) {
return studentQueryExe.executeGetInfoByStudentId(studentId);
}
} }

View File

@ -24,6 +24,8 @@ import java.util.List;
public interface StudentServiceI { public interface StudentServiceI {
PageResponse<StudentCO> listPage(StudentPageQry qry); PageResponse<StudentCO> listPage(StudentPageQry qry);
PageResponse<StudentCO> listPageClassByStudent(StudentPageQry qry);
SingleResponse<StudentCO> add(List<StudentAddCmd> cmdList); SingleResponse<StudentCO> add(List<StudentAddCmd> cmdList);
void edit(StudentUpdateCmd cmd); void edit(StudentUpdateCmd cmd);
@ -45,5 +47,9 @@ public interface StudentServiceI {
SingleResponse<ClassArchivesDTO> getClassExamResult(ClassArchivesQry qry); SingleResponse<ClassArchivesDTO> getClassExamResult(ClassArchivesQry qry);
MultiResponse<StudentCO> countStudentByCorpId(StudentCountQry qry); MultiResponse<StudentCO> countStudentByCorpId(StudentCountQry qry);
MultiResponse<StudentCO> listStudentCount(StudentCountQry qry);
SingleResponse<StudentCO> getInfoByStudentId(String studentId);
} }

View File

@ -110,6 +110,11 @@ public class StudentCO extends ClientObject {
@ApiModelProperty(value = "完成班级数")
@TableField(exist = false)
private String departmentName;

View File

@ -51,7 +51,7 @@ public class ClassArchivesDTO {
private Long corpinfoId; private Long corpinfoId;
//所属单位名称 //所属单位名称
@ApiModelProperty(value = "所属单位名称") @ApiModelProperty(value = "所属单位名称")
private Long corpName; private String corpName;
//状态1-未申请 2-待开班 3- 培训中 4-培训结束 //状态1-未申请 2-待开班 3- 培训中 4-培训结束
@ApiModelProperty(value = "状态1-未申请 2-待开班 3- 培训中 4-培训结束 ") @ApiModelProperty(value = "状态1-未申请 2-待开班 3- 培训中 4-培训结束 ")
private Integer state; private Integer state;

View File

@ -31,6 +31,7 @@ public class StudentCountQry {
private String likeName; private String likeName;
private String likeInterestedIds; private String likeInterestedIds;
private List<Long> corpinfoIds; private List<Long> corpinfoIds;
private List<String> phones;
} }

View File

@ -28,6 +28,7 @@ public class StudentPageQry extends PageQuery {
private String likeProjectNames; private String likeProjectNames;
private String likeName; private String likeName;
private String likeInterestedIds; private String likeInterestedIds;
private String likeClassName;
private Integer state;
} }

View File

@ -52,6 +52,9 @@ public class ClassArchivesE extends BaseE {
//机构ID //机构ID
@ApiModelProperty(value = "机构ID") @ApiModelProperty(value = "机构ID")
private Long corpinfoId; private Long corpinfoId;
// 机构名称
@ApiModelProperty(value = "机构名称")
private String corpName;
//状态1-未申请 2-待开班 3- 培训中 4-培训结束 //状态1-未申请 2-待开班 3- 培训中 4-培训结束
@ApiModelProperty(value = "状态1-未申请 2-待开班 3- 培训中 4-培训结束 ") @ApiModelProperty(value = "状态1-未申请 2-待开班 3- 培训中 4-培训结束 ")
private Integer state; private Integer state;

View File

@ -37,6 +37,8 @@ public class ClassE extends BaseE {
private String trainingLocation; private String trainingLocation;
//机构ID //机构ID
private Long corpinfoId; private Long corpinfoId;
//机构名称
private String corpName;
//状态1-未申请 2-待开班 3- 培训中 4-培训结束 //状态1-未申请 2-待开班 3- 培训中 4-培训结束
private Integer state; private Integer state;
//培训有效期日期 开始时间 //培训有效期日期 开始时间

View File

@ -112,6 +112,11 @@ public class StudentDO extends BaseDO {
private Integer completeClassCount; private Integer completeClassCount;
@ApiModelProperty(value = "部门名称")
@TableField(exist = false)
private String departmentName;
//班级名称 //班级名称
@ApiModelProperty(value = "班级名称") @ApiModelProperty(value = "班级名称")
@TableField(exist = false) @TableField(exist = false)

View File

@ -1,6 +1,8 @@
package com.zcloud.edu.persistence.mapper.study; package com.zcloud.edu.persistence.mapper.study;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zcloud.edu.persistence.dataobject.study.ClassDO; import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import com.zcloud.edu.persistence.dataobject.study.StudentDO; import com.zcloud.edu.persistence.dataobject.study.StudentDO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO; import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO;
@ -18,6 +20,9 @@ import java.util.Map;
*/ */
@Mapper @Mapper
public interface StudentMapper extends BaseMapper<StudentDO> { public interface StudentMapper extends BaseMapper<StudentDO> {
IPage<StudentDO> listPageClassByStudent(IPage<StudentDO> page, @Param("params") Map<String, Object> params);
long postponeUpdateStudent(String classId); long postponeUpdateStudent(String classId);
List<ClassDO> countStudentByClass(List<String> classIds); List<ClassDO> countStudentByClass(List<String> classIds);
@ -33,6 +38,8 @@ public interface StudentMapper extends BaseMapper<StudentDO> {
List<StudentDO> countStudentByCorpId(@Param("params") Map<String, Object> params); List<StudentDO> countStudentByCorpId(@Param("params") Map<String, Object> params);
List<StudentDO> listStudentCount(@Param("params") Map<String, Object> params);
StudentDO findInfoByStudentId(@Param("studentId") String studentId);
} }

View File

@ -64,10 +64,7 @@ public class ClassCurriculumChapterRepositoryImpl extends BaseRepositoryImpl<Cla
@Override @Override
public List<ClassCurriculumChapterDO> listByClassCurriculumIds(List<String> classCurriculumIds) { public List<ClassCurriculumChapterDO> listByClassCurriculumIds(List<String> classCurriculumIds) {
QueryWrapper<ClassCurriculumChapterDO> queryWrapper = new QueryWrapper<>(); return classCurriculumChapterMapper.listByClassCurriculumIds(classCurriculumIds);
queryWrapper.in("class_curriculum_id", classCurriculumIds);
queryWrapper.eq("delete_enum", "FALSE");
return classCurriculumChapterMapper.selectList(queryWrapper);
} }

View File

@ -40,6 +40,13 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl<StudentMapper, Stu
return PageHelper.pageToResponse(result, result.getRecords()); return PageHelper.pageToResponse(result, result.getRecords());
} }
@Override
public PageResponse<StudentDO> listPageClassByStudent(Map<String, Object> params) {
IPage<StudentDO> iPage = new Query<StudentDO>().getPage(params);
IPage<StudentDO> result = studentMapper.listPageClassByStudent(iPage, params);
return PageHelper.pageToResponse(result, result.getRecords());
}
@Override @Override
public Boolean addBatch(List<StudentDO> studentDOs) { public Boolean addBatch(List<StudentDO> studentDOs) {
saveBatch(studentDOs); saveBatch(studentDOs);
@ -112,5 +119,10 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl<StudentMapper, Stu
return studentMapper.countStudentByCorpId(params); return studentMapper.countStudentByCorpId(params);
} }
@Override
public List<StudentDO> listStudentCount(Map<String, Object> params) {
return studentMapper.listStudentCount(params);
}
} }

View File

@ -17,6 +17,7 @@ import java.util.Map;
*/ */
public interface StudentRepository extends BaseRepository<StudentDO> { public interface StudentRepository extends BaseRepository<StudentDO> {
PageResponse<StudentDO> listPage(Map<String, Object> params); PageResponse<StudentDO> listPage(Map<String, Object> params);
PageResponse<StudentDO> listPageClassByStudent(Map<String, Object> params);
Boolean addBatch(List<StudentDO> studentDOs); Boolean addBatch(List<StudentDO> studentDOs);
Long countByClassId(String classId); Long countByClassId(String classId);
@ -40,5 +41,7 @@ public interface StudentRepository extends BaseRepository<StudentDO> {
void updateStudent(Map<String, Object> params); void updateStudent(Map<String, Object> params);
List<StudentDO> countStudentByCorpId(Map<String, Object> params); List<StudentDO> countStudentByCorpId(Map<String, Object> params);
List<StudentDO> listStudentCount(Map<String, Object> params);
} }

View File

@ -78,6 +78,7 @@
count(CASE WHEN s.state = 1 THEN 1 END) complete_class_count count(CASE WHEN s.state = 1 THEN 1 END) complete_class_count
FROM FROM
student s student s
left join class c on c.class_id = s.class_id
<where> <where>
<if test="params.inCorpinfoId != null"> <if test="params.inCorpinfoId != null">
AND s.phone in AND s.phone in
@ -86,6 +87,8 @@
</foreach> </foreach>
</if> </if>
and s.delete_enum = 'FALSE' and s.delete_enum = 'FALSE'
and c.delete_enum = 'FALSE'
and c.state != 1
</where> </where>
group by s.phone group by s.phone
</select> </select>
@ -121,7 +124,7 @@
<select id="countStudentByCorpId" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO"> <select id="countStudentByCorpId" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
select select
count(*) student_count, count(DISTINCT s.phone) student_count,
s.class_corpinfo_id s.class_corpinfo_id
from from
student s student s
@ -130,10 +133,146 @@
s.delete_enum = 'FALSE' s.delete_enum = 'FALSE'
and c.delete_enum = 'FALSE' and c.delete_enum = 'FALSE'
and c.state != 1 and c.state != 1
<if test="params.corpinfoIds != null and params.corpinfoIds.size > 0">
s.class_corpinfo_id in
<foreach item="item" collection="params.corpinfoIds" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where> </where>
group by group by
s.class_corpinfo_id s.class_corpinfo_id
</select> </select>
<select id="listStudentCount" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
SELECT
s.phone,
count(*) class_count,
count(CASE WHEN s.state = 1 THEN 1 END) complete_class_count,
d.name as department_name
FROM
student s
left join user u on u.phone = s.phone
left join department d on d.department_id = u.department_id
left join class c on c.class_id = s.class_id
<where>
<if test="params.phones != null">
AND s.phone in
<foreach collection="params.phones" item="phone" open="(" close=")" separator=",">
#{phone}
</foreach>
</if>
and s.delete_enum = 'FALSE'
and c.delete_enum = 'FALSE'
and c.state != 1
</where>
group by s.phone
</select>
<select id="listPageClassByStudent" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
select
s.id,
s.student_id,
s.user_id,
s.class_id,
s.name,
s.class_corpinfo_id,
s.phone,
s.user_id_card,
s.nation,
s.nation_name,
s.user_avatar_url,
s.current_address,
s.location_address,
s.cultural_level,
s.cultural_level_name,
s.marital_status,
s.marital_status_name,
s.political_affiliation,
s.political_affiliation_name,
s.post_name,
s.sign_flag,
s.exam_sign_flag,
case when s.state = 1 then 1
when s.state = 0 and c.start_time > now() then 0
when s.state = 0 and c.start_time &lt;= now() and c.end_time &gt;= now() then 2
end as state,
s.interested_ids,
s.interested_names,
s.project_ids,
s.project_names,
c.name as class_name,
c.start_time,
c.end_time
from
student s
left join class c on c.class_id = s.class_id
<where>
s.delete_enum = 'FALSE'
and c.delete_enum = 'FALSE'
and c.state != 1
<if test="params.phone != null and params.phone != ''">
and s.phone = #{params.phone}
</if>
<if test="params.likeClassName != null and params.likeClassName != ''">
and c.name like concat('%',#{params.likeClassName},'%')
</if>
<if test="params.state != null and params.state != ''">
<if test="params.state == 0">
and s.state = 0
and c.start_time > now()
</if>
<if test="params.state == 1">
and s.state = #{params.state}
</if>
<if test="params.state == 2">
and s.state = 0
and c.start_time &lt;= now()
and c.end_time &gt;= now()
</if>
</if>
</where>
</select>
<!-- findInfoByStudentId -->
<select id="findInfoByStudentId" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
select
s.id,
s.student_id,
s.class_id,
s.name,
s.class_corpinfo_id,
s.phone,
s.user_id_card,
s.nation,
s.nation_name,
s.user_avatar_url,
s.current_address,
s.location_address,
s.cultural_level,
s.cultural_level_name,
s.marital_status,
s.marital_status_name,
s.political_affiliation,
s.political_affiliation_name,
s.post_name,
s.sign_flag,
s.exam_sign_flag,
s.state,
s.interested_ids,
s.interested_names,
s.project_ids,
s.project_names,
u.user_avatar_url,
u.usse_id
from
student s
left join user u on u.phone = s.phone
<where>
s.student_id = #{params.studentId}
</where>
group by s.student_id
</select>
</mapper> </mapper>