实现学生批量添加和班级管理功能
parent
f03a838499
commit
8d3bf31835
|
|
@ -36,7 +36,7 @@ public class ClassController {
|
|||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<ClassCO> add(@Validated @RequestBody ClassAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
|
||||
return classService.add(cmd);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-adapter
|
||||
|
|
@ -35,9 +36,10 @@ public class StudentController {
|
|||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<StudentCO> add(@Validated @RequestBody StudentAddCmd cmd) {
|
||||
public SingleResponse<StudentCO> add(@Validated @RequestBody List<StudentAddCmd> cmdList) {
|
||||
System.out.println(cmdList);
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
return studentService.add(cmd);
|
||||
return studentService.add(cmdList);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
|
|
@ -59,7 +61,7 @@ public class StudentController {
|
|||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
@PostMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
studentService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.zcloud.edu.command.study;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.sun.org.apache.xml.internal.security.Init;
|
||||
import com.zcloud.edu.domain.gateway.study.ClassGateway;
|
||||
import com.zcloud.edu.domain.model.study.ClassE;
|
||||
import com.zcloud.edu.dto.study.ClassAddCmd;
|
||||
|
|
@ -24,7 +27,10 @@ public class ClassAddExe {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(ClassAddCmd cmd) {
|
||||
ClassE classE = new ClassE();
|
||||
|
||||
BeanUtils.copyProperties(cmd, classE);
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
classE.initSave(ssoUser.getTenantId());
|
||||
boolean res = false;
|
||||
try {
|
||||
res = classGateway.add(classE);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import com.alibaba.cola.exception.BizException;
|
|||
import com.zcloud.edu.domain.gateway.study.ClassGateway;
|
||||
import com.zcloud.edu.domain.model.study.ClassE;
|
||||
import com.zcloud.edu.dto.study.ClassUpdateCmd;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.StudentRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -20,11 +23,31 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class ClassUpdateExe {
|
||||
private final ClassGateway classGateway;
|
||||
private final StudentRepository studentRepository;
|
||||
private final ClassCurriculumRepository classCurriculumRepository;
|
||||
private final ClassExamPaperRepository classExamPaperRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(ClassUpdateCmd classUpdateCmd) {
|
||||
ClassE classE = new ClassE();
|
||||
BeanUtils.copyProperties(classUpdateCmd, classE);
|
||||
if(classUpdateCmd.getUpdateType() == 2){
|
||||
Long studentCount = studentRepository.countByClassId(classE.getClassId());
|
||||
if(studentCount <= 0){
|
||||
throw new BizException("班级下未添加学员,请先添加学员");
|
||||
}
|
||||
Long curriculumCount = classCurriculumRepository.countByClassId(classE.getClassId());
|
||||
if(curriculumCount <= 0){
|
||||
throw new BizException("班级下未添加课程,请先添加课程");
|
||||
}
|
||||
if(classE.getExamination() == 1){
|
||||
Long examPaperCount = classExamPaperRepository.countByClassId(classE.getClassId());
|
||||
if(examPaperCount <= 0){
|
||||
throw new BizException("班级下未添加考试,请先添加考试");
|
||||
}
|
||||
}
|
||||
}
|
||||
classE.initUpdate();
|
||||
boolean res = classGateway.update(classE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
|
|
|
|||
|
|
@ -1,14 +1,29 @@
|
|||
package com.zcloud.edu.command.study;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.edu.domain.gateway.study.StudentGateway;
|
||||
import com.zcloud.edu.domain.model.study.StudentE;
|
||||
import com.zcloud.edu.dto.study.StudentAddCmd;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
|
||||
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.StudentRepository;
|
||||
import com.zcloud.gbscommon.zclouduser.facade.ZcloudUserFacade;
|
||||
import com.zcloud.gbscommon.zclouduser.response.ZcloudUserCo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
|
|
@ -20,14 +35,27 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class StudentAddExe {
|
||||
private final StudentGateway studentGateway;
|
||||
private final StudentRepository studentRepository;
|
||||
private final ClassRepository classRepository;
|
||||
@DubboReference
|
||||
private ZcloudUserFacade zcloudUserFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(StudentAddCmd cmd) {
|
||||
public boolean execute(List<StudentAddCmd> cmdList) {
|
||||
StudentE studentE = new StudentE();
|
||||
BeanUtils.copyProperties(cmd, studentE);
|
||||
if (cmdList == null || cmdList.size() == 0){
|
||||
throw new BizException("请选择要加入班级的学员。");
|
||||
}
|
||||
List<StudentE> studentEList = BeanUtil.copyToList(cmdList, StudentE.class);
|
||||
List<String> userNameList = cmdList.stream().map(StudentAddCmd::getPhone).distinct().collect(Collectors.toList());
|
||||
MultiResponse<ZcloudUserCo> userResponse = zcloudUserFacade.listUserByUserName(userNameList);
|
||||
ClassDO classDO = classRepository.getByClassId(studentEList.get(0).getClassId());
|
||||
List<ZcloudUserCo> userList = userResponse.getData();
|
||||
Map<String, ZcloudUserCo> userMap = userList.stream().collect(HashMap::new, (k, v) -> k.put(v.getUsername(), v), HashMap::putAll);
|
||||
studentE.initStudentList(studentEList, userMap, classDO.getCorpinfoId());
|
||||
boolean res = false;
|
||||
try {
|
||||
res = studentGateway.add(studentE);
|
||||
res = studentRepository.addBatch(BeanUtil.copyToList(studentEList, StudentDO.class));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ package com.zcloud.edu.command.study;
|
|||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.edu.domain.gateway.study.StudentGateway;
|
||||
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
|
||||
import com.zcloud.edu.persistence.repository.study.StudentExamRecordItemRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.StudentExamRecordRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.StudentRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -17,10 +21,16 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class StudentRemoveExe {
|
||||
private final StudentGateway studentGateway;
|
||||
private final StudentRepository studentRepository;
|
||||
private final StudentExamRecordRepository studentExamRecordRepository;
|
||||
private final StudentExamRecordItemRepository studentExamRecordItemRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
StudentDO studentDO = studentRepository.getById(id);
|
||||
boolean res = studentGateway.deletedStudentById(id);
|
||||
studentExamRecordRepository.deleteByStudentId(studentDO.getStudentId());
|
||||
studentExamRecordItemRepository.deleteByStudentId(studentDO.getStudentId());
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import com.zcloud.edu.dto.study.StudentUpdateCmd;
|
|||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
|
|
@ -35,9 +37,9 @@ public class StudentServiceImpl implements StudentServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(StudentAddCmd cmd) {
|
||||
public SingleResponse add(List<StudentAddCmd> cmdList) {
|
||||
|
||||
studentAddExe.execute(cmd);
|
||||
studentAddExe.execute(cmdList);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.zcloud.edu.dto.study.StudentAddCmd;
|
|||
import com.zcloud.edu.dto.study.StudentPageQry;
|
||||
import com.zcloud.edu.dto.study.StudentUpdateCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
|
|
@ -16,7 +18,7 @@ import com.zcloud.edu.dto.study.StudentUpdateCmd;
|
|||
public interface StudentServiceI {
|
||||
PageResponse<StudentCO> listPage(StudentPageQry qry);
|
||||
|
||||
SingleResponse<StudentCO> add(StudentAddCmd cmd);
|
||||
SingleResponse<StudentCO> add(List<StudentAddCmd> cmdList);
|
||||
|
||||
void edit(StudentUpdateCmd cmd);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.zcloud.edu.dto.clientobject.study;
|
|||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -46,10 +47,10 @@ public class ClassCO extends ClientObject {
|
|||
private String trainingLocation;
|
||||
//机构ID
|
||||
@ApiModelProperty(value = "机构ID")
|
||||
private String corpinfoId;
|
||||
private Long corpinfoId;
|
||||
//状态:1-未申请 2-待开班 3- 培训中 4-培训结束
|
||||
@ApiModelProperty(value = "状态:1-未申请 2-待开班 3- 培训中 4-培训结束 ")
|
||||
private String state;
|
||||
private Integer state;
|
||||
//培训有效期日期 开始时间
|
||||
@ApiModelProperty(value = "培训有效期日期 开始时间")
|
||||
private String validStartTime;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
|||
* web-client
|
||||
*
|
||||
* @Author zhangyue
|
||||
* @Date 2026-01-13 14:18:14
|
||||
* @Date 2026-01-14 14:37:55
|
||||
*/
|
||||
@Data
|
||||
public class StudentCO extends ClientObject {
|
||||
|
|
@ -20,12 +20,18 @@ public class StudentCO extends ClientObject {
|
|||
//业务id
|
||||
@ApiModelProperty(value = "业务id")
|
||||
private String studentId;
|
||||
//学员userid
|
||||
@ApiModelProperty(value = "学员userid")
|
||||
private Integer userId;
|
||||
//班级id
|
||||
@ApiModelProperty(value = "班级id")
|
||||
private String classId;
|
||||
//学员姓名
|
||||
@ApiModelProperty(value = "学员姓名")
|
||||
private String name;
|
||||
private Long corpinfoId;
|
||||
//学员所属班级的企业id
|
||||
@ApiModelProperty(value = "学员所属班级的企业id")
|
||||
private Long classCorpinfoId;
|
||||
//手机号
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import javax.validation.constraints.NotNull;
|
|||
@AllArgsConstructor
|
||||
public class ClassAddCmd extends Command {
|
||||
@ApiModelProperty(value = "业务id", name = "classId", required = true)
|
||||
@NotEmpty(message = "业务id不能为空")
|
||||
private String classId;
|
||||
|
||||
@ApiModelProperty(value = "班级名称", name = "name", required = true)
|
||||
|
|
@ -58,12 +57,10 @@ public class ClassAddCmd extends Command {
|
|||
private String trainingLocation;
|
||||
|
||||
@ApiModelProperty(value = "机构ID", name = "corpinfoId", required = true)
|
||||
@NotEmpty(message = "机构ID不能为空")
|
||||
private String corpinfoId;
|
||||
private Long corpinfoId;
|
||||
|
||||
@ApiModelProperty(value = "状态:1-未申请 2-待开班 3- 培训中 4-培训结束 ", name = "state", required = true)
|
||||
@NotEmpty(message = "状态:1-未申请 2-待开班 3- 培训中 4-培训结束 不能为空")
|
||||
private String state;
|
||||
private Integer state;
|
||||
|
||||
@ApiModelProperty(value = "培训有效期日期 开始时间", name = "validStartTime", required = true)
|
||||
@NotEmpty(message = "培训有效期日期 开始时间不能为空")
|
||||
|
|
@ -78,7 +75,6 @@ public class ClassAddCmd extends Command {
|
|||
private Integer examination;
|
||||
|
||||
@ApiModelProperty(value = "考试次数只有考试时候有用", name = "numberofexams", required = true)
|
||||
@NotNull(message = "考试次数只有考试时候有用不能为空")
|
||||
private Integer numberofexams;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,5 +24,6 @@ public class ClassCurriculumPageQry extends PageQuery {
|
|||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private String likeClassCurriculumId;
|
||||
private String eqClassId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,5 +24,13 @@ public class ClassPageQry extends PageQuery {
|
|||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private String likeClassId;
|
||||
private String likeName;
|
||||
private String eqTrainType;
|
||||
private Integer eqState;
|
||||
private String geStartTime;
|
||||
private String leStartTime;
|
||||
private String geEndTime;
|
||||
private String leEndTime;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,14 @@ import javax.validation.constraints.NotNull;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClassUpdateCmd extends Command {
|
||||
@ApiModelProperty(value = "${column.comment}", name = "id", required = true)
|
||||
@NotNull(message = "${column.comment}不能为空")
|
||||
|
||||
|
||||
@ApiModelProperty(value = "修改方式 1-修改未申请班级。2-正式保存班级", name = "修改方式", required = true)
|
||||
@NotNull(message = "修改方式不能为空")
|
||||
private Integer updateType;
|
||||
|
||||
@ApiModelProperty(value = "主键不能为空", name = "id", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务id", name = "classId", required = true)
|
||||
@NotEmpty(message = "业务id不能为空")
|
||||
|
|
@ -52,11 +58,9 @@ public class ClassUpdateCmd extends Command {
|
|||
@NotEmpty(message = "培训地点不能为空")
|
||||
private String trainingLocation;
|
||||
@ApiModelProperty(value = "机构ID", name = "corpinfoId", required = true)
|
||||
@NotEmpty(message = "机构ID不能为空")
|
||||
private String corpinfoId;
|
||||
private Long corpinfoId;
|
||||
@ApiModelProperty(value = "状态:1-未申请 2-待开班 3- 培训中 4-培训结束 ", name = "state", required = true)
|
||||
@NotEmpty(message = "状态:1-未申请 2-待开班 3- 培训中 4-培训结束 不能为空")
|
||||
private String state;
|
||||
private Integer state;
|
||||
@ApiModelProperty(value = "培训有效期日期 开始时间", name = "validStartTime", required = true)
|
||||
@NotEmpty(message = "培训有效期日期 开始时间不能为空")
|
||||
private String validStartTime;
|
||||
|
|
@ -67,7 +71,7 @@ public class ClassUpdateCmd extends Command {
|
|||
@NotNull(message = "1考试0不考试不能为空")
|
||||
private Integer examination;
|
||||
@ApiModelProperty(value = "考试次数只有考试时候有用", name = "numberofexams", required = true)
|
||||
@NotNull(message = "考试次数只有考试时候有用不能为空")
|
||||
private Integer numberofexams;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,14 +7,13 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author zhangyue
|
||||
* @Date 2026-01-13 14:18:14
|
||||
* @Date 2026-01-14 14:37:55
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
|
|
@ -25,21 +24,21 @@ public class StudentAddCmd extends Command {
|
|||
@NotEmpty(message = "业务id不能为空")
|
||||
private String studentId;
|
||||
|
||||
@ApiModelProperty(value = "${column.comment}", name = "userId", required = true)
|
||||
@NotNull(message = "${column.comment}不能为空")
|
||||
@ApiModelProperty(value = "学员userid", name = "userId", required = true)
|
||||
@NotNull(message = "学员userid不能为空")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "班级id", name = "classId", required = true)
|
||||
@NotEmpty(message = "班级id不能为空")
|
||||
private String classId;
|
||||
|
||||
@ApiModelProperty(value = "${column.comment}", name = "name", required = true)
|
||||
@NotEmpty(message = "${column.comment}不能为空")
|
||||
@ApiModelProperty(value = "学员姓名", name = "name", required = true)
|
||||
@NotEmpty(message = "学员姓名不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "${column.comment}", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "${column.comment}不能为空")
|
||||
private Long corpinfoId;
|
||||
@ApiModelProperty(value = "学员所属班级的企业id", name = "classCorpinfoId", required = true)
|
||||
@NotNull(message = "学员所属班级的企业id不能为空")
|
||||
private Long classCorpinfoId;
|
||||
|
||||
@ApiModelProperty(value = "手机号", name = "phone", required = true)
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ public class StudentPageQry extends PageQuery {
|
|||
* - `le`: 小于等于比较查询
|
||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private String likeStudentId;
|
||||
private String eqStudentId;
|
||||
private String eqClassId;
|
||||
private String likeProjectNames;
|
||||
private String likeName;
|
||||
private String likeInterestedIds;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,38 +7,37 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author zhangyue
|
||||
* @Date 2026-01-13 14:18:15
|
||||
* @Date 2026-01-14 14:37:56
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StudentUpdateCmd extends Command {
|
||||
@ApiModelProperty(value = "${column.comment}", name = "id", required = true)
|
||||
@NotNull(message = "${column.comment}不能为空")
|
||||
@ApiModelProperty(value = "主键ID", name = "id", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务id", name = "studentId", required = true)
|
||||
@NotEmpty(message = "业务id不能为空")
|
||||
private String studentId;
|
||||
@ApiModelProperty(value = "${column.comment}", name = "userId", required = true)
|
||||
@NotNull(message = "${column.comment}不能为空")
|
||||
@ApiModelProperty(value = "学员userid", name = "userId", required = true)
|
||||
@NotNull(message = "学员userid不能为空")
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "班级id", name = "classId", required = true)
|
||||
@NotEmpty(message = "班级id不能为空")
|
||||
private String classId;
|
||||
@ApiModelProperty(value = "${column.comment}", name = "name", required = true)
|
||||
@NotEmpty(message = "${column.comment}不能为空")
|
||||
@ApiModelProperty(value = "学员姓名", name = "name", required = true)
|
||||
@NotEmpty(message = "学员姓名不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "${column.comment}", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "${column.comment}不能为空")
|
||||
private Long corpinfoId;
|
||||
@ApiModelProperty(value = "学员所属班级的企业id", name = "classCorpinfoId", required = true)
|
||||
@NotNull(message = "学员所属班级的企业id不能为空")
|
||||
private Long classCorpinfoId;
|
||||
@ApiModelProperty(value = "手机号", name = "phone", required = true)
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
private String phone;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package com.zcloud.edu.domain.model.study;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.DateUtil;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
|
|
@ -33,9 +36,9 @@ public class ClassE extends BaseE {
|
|||
//培训地点
|
||||
private String trainingLocation;
|
||||
//机构ID
|
||||
private String corpinfoId;
|
||||
private Long corpinfoId;
|
||||
//状态:1-未申请 2-待开班 3- 培训中 4-培训结束
|
||||
private String state;
|
||||
private Integer state;
|
||||
//培训有效期日期 开始时间
|
||||
private String validStartTime;
|
||||
//培训有效期日期 结束时间
|
||||
|
|
@ -44,6 +47,8 @@ public class ClassE extends BaseE {
|
|||
private Integer examination;
|
||||
//考试次数只有考试时候有用
|
||||
private Integer numberofexams;
|
||||
// 修改方式 1-修改未申请班级。2-正式保存班级
|
||||
private Integer updateType;
|
||||
//删除标识true false
|
||||
private String deleteEnum;
|
||||
//备注
|
||||
|
|
@ -68,5 +73,22 @@ public class ClassE extends BaseE {
|
|||
private Long updateId;
|
||||
//环境
|
||||
private String env;
|
||||
|
||||
public void initSave(Long corpInfoId){
|
||||
this.classId = Tools.get32UUID();
|
||||
this.corpinfoId = corpInfoId;
|
||||
this.state = 1;
|
||||
}
|
||||
public void initUpdate(){
|
||||
if(this.updateType == 2){
|
||||
if(DateUtil.isBeforeThan(this.startTime)){
|
||||
this.state = 2;
|
||||
} else if(DateUtil.isBeforeThan(this.endTime)){
|
||||
this.state = 3;
|
||||
} else {
|
||||
this.state = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
package com.zcloud.edu.domain.model.study;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zclouduser.response.ZcloudUserCo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
|
|
@ -20,7 +24,7 @@ public class StudentE extends BaseE {
|
|||
//班级id
|
||||
private String classId;
|
||||
private String name;
|
||||
private Long corpinfoId;
|
||||
private Long classCorpinfoId;
|
||||
//手机号
|
||||
private String phone;
|
||||
//身份证号
|
||||
|
|
@ -87,5 +91,30 @@ public class StudentE extends BaseE {
|
|||
private Long createId;
|
||||
//修改人id
|
||||
private Long updateId;
|
||||
|
||||
public void initStudentList(List<StudentE> studentEList, Map<String, ZcloudUserCo> userMap, Long classCorpinfoId){
|
||||
for (StudentE studentE : studentEList){
|
||||
studentE.studentId = Tools.get32UUID();
|
||||
studentE.signFlag = 0;
|
||||
studentE.examSignFlag = 0;
|
||||
studentE.state = 0;
|
||||
studentE.setClassCorpinfoId(classCorpinfoId);
|
||||
ZcloudUserCo zcloudUserCo = userMap.get(studentE.getPhone());
|
||||
studentE.setUserIdCard(zcloudUserCo.getUserIdCard());
|
||||
studentE.setNation(zcloudUserCo.getNation());
|
||||
studentE.setNationName(zcloudUserCo.getNationName());
|
||||
studentE.setUserAvatarUrl(zcloudUserCo.getUserAvatarUrl());
|
||||
studentE.setCurrentAddress(zcloudUserCo.getCurrentAddress());
|
||||
studentE.setLocationAddress(zcloudUserCo.getLocationAddress());
|
||||
studentE.setCulturalLevel(zcloudUserCo.getCulturalLevel());
|
||||
studentE.setCulturalLevelName(zcloudUserCo.getCulturalLevelName());
|
||||
studentE.setMaritalStatus(zcloudUserCo.getMaritalStatus());
|
||||
studentE.setMaritalStatusName(zcloudUserCo.getMaritalStatusName());
|
||||
studentE.setPoliticalAffiliation(zcloudUserCo.getPoliticalAffiliation());
|
||||
studentE.setPoliticalAffiliationName(zcloudUserCo.getPoliticalAffiliationName());
|
||||
studentE.setPostName(zcloudUserCo.getPostName());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ public class ClassDO extends BaseDO {
|
|||
private String trainingLocation;
|
||||
//机构ID
|
||||
@ApiModelProperty(value = "机构ID")
|
||||
private String corpinfoId;
|
||||
private Long corpinfoId;
|
||||
//状态:1-未申请 2-待开班 3- 培训中 4-培训结束
|
||||
@ApiModelProperty(value = "状态:1-未申请 2-待开班 3- 培训中 4-培训结束 ")
|
||||
private String state;
|
||||
private Integer state;
|
||||
//培训有效期日期 开始时间
|
||||
@ApiModelProperty(value = "培训有效期日期 开始时间")
|
||||
private String validStartTime;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.zcloud.edu.persistence.dataobject.study;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -11,7 +11,7 @@ import lombok.NoArgsConstructor;
|
|||
* web-infrastructure
|
||||
*
|
||||
* @Author zhangyue
|
||||
* @Date 2026-01-13 14:18:15
|
||||
* @Date 2026-01-14 14:37:55
|
||||
*/
|
||||
@Data
|
||||
@TableName("student")
|
||||
|
|
@ -21,12 +21,18 @@ public class StudentDO extends BaseDO {
|
|||
//业务id
|
||||
@ApiModelProperty(value = "业务id")
|
||||
private String studentId;
|
||||
//学员userid
|
||||
@ApiModelProperty(value = "学员userid")
|
||||
private Integer userId;
|
||||
//班级id
|
||||
@ApiModelProperty(value = "班级id")
|
||||
private String classId;
|
||||
//学员姓名
|
||||
@ApiModelProperty(value = "学员姓名")
|
||||
private String name;
|
||||
private Long corpinfoId;
|
||||
//学员所属班级的企业id
|
||||
@ApiModelProperty(value = "学员所属班级的企业id")
|
||||
private Long classCorpinfoId;
|
||||
//手机号
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassCurriculumDO;
|
||||
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
|
||||
import com.zcloud.edu.persistence.mapper.study.ClassCurriculumMapper;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
|
|
@ -42,5 +43,13 @@ public class ClassCurriculumRepositoryImpl extends BaseRepositoryImpl<ClassCurri
|
|||
queryWrapper.eq("curriculum_id", curriculumId);
|
||||
return classCurriculumMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countByClassId(String classId) {
|
||||
QueryWrapper<ClassCurriculumDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("class_id", classId);
|
||||
queryWrapper.eq("delete_enum", "FALSE");
|
||||
return classCurriculumMapper.selectCount(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.zcloud.edu.persistence.dataobject.study.ClassExamPaperDO;
|
||||
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
|
||||
import com.zcloud.edu.persistence.mapper.study.ClassExamPaperMapper;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
|
|
@ -42,5 +43,13 @@ public class ClassExamPaperRepositoryImpl extends BaseRepositoryImpl<ClassExamPa
|
|||
queryWrapper.eq("exam_paper_id", examPaperId);
|
||||
return classExamPaperMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countByClassId(String classId) {
|
||||
QueryWrapper<ClassExamPaperDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("class_id", classId);
|
||||
queryWrapper.eq("delete_enum", "FALSE");
|
||||
return classExamPaperMapper.selectCount(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,5 +35,12 @@ public class ClassRepositoryImpl extends BaseRepositoryImpl<ClassMapper, ClassDO
|
|||
IPage<ClassDO> result = classMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassDO getByClassId(String classId) {
|
||||
QueryWrapper<ClassDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("class_id", classId);
|
||||
return classMapper.selectOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.zcloud.edu.persistence.repository.impl.study;
|
|||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
|
|
@ -35,5 +36,14 @@ public class StudentExamRecordItemRepositoryImpl extends BaseRepositoryImpl<Stud
|
|||
IPage<StudentExamRecordItemDO> result = studentExamRecordItemMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByStudentId(String studentId) {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("student_id", studentId);
|
||||
updateWrapper.eq("delete_enum", "FALSE");
|
||||
updateWrapper.set("delete_enum", "TRUE");
|
||||
studentExamRecordItemMapper.update(null, updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.zcloud.edu.persistence.repository.impl.study;
|
|||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
|
|
@ -35,5 +36,14 @@ public class StudentExamRecordRepositoryImpl extends BaseRepositoryImpl<StudentE
|
|||
IPage<StudentExamRecordDO> result = studentExamRecordMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByStudentId(String studentId) {
|
||||
UpdateWrapper updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("student_id", studentId);
|
||||
updateWrapper.eq("delete_enum", "FALSE");
|
||||
updateWrapper.set("delete_enum", "TRUE");
|
||||
studentExamRecordMapper.update(null, updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.zcloud.gbscommon.utils.Query;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -35,5 +36,19 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl<StudentMapper, Stu
|
|||
IPage<StudentDO> result = studentMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addBatch(List<StudentDO> studentDOs) {
|
||||
saveBatch(studentDOs);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countByClassId(String classId) {
|
||||
QueryWrapper<StudentDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("class_id", classId);
|
||||
queryWrapper.eq("delete_enum", "FALSE");
|
||||
return studentMapper.selectCount(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,5 +16,7 @@ public interface ClassCurriculumRepository extends BaseRepository<ClassCurriculu
|
|||
PageResponse<ClassCurriculumDO> listPage(Map<String, Object> params);
|
||||
|
||||
Long getCountByCurriculumId(String curriculumId);
|
||||
|
||||
Long countByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,5 +16,7 @@ public interface ClassExamPaperRepository extends BaseRepository<ClassExamPaperD
|
|||
PageResponse<ClassExamPaperDO> listPage(Map<String, Object> params);
|
||||
|
||||
Long getCountByExamPaperId(String examPaperId);
|
||||
|
||||
Long countByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ import java.util.Map;
|
|||
*/
|
||||
public interface ClassRepository extends BaseRepository<ClassDO> {
|
||||
PageResponse<ClassDO> listPage(Map<String, Object> params);
|
||||
|
||||
ClassDO getByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ import java.util.Map;
|
|||
*/
|
||||
public interface StudentExamRecordItemRepository extends BaseRepository<StudentExamRecordItemDO> {
|
||||
PageResponse<StudentExamRecordItemDO> listPage(Map<String, Object> params);
|
||||
|
||||
void deleteByStudentId(String studentId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ import java.util.Map;
|
|||
*/
|
||||
public interface StudentExamRecordRepository extends BaseRepository<StudentExamRecordDO> {
|
||||
PageResponse<StudentExamRecordDO> listPage(Map<String, Object> params);
|
||||
|
||||
void deleteByStudentId(String studentId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageResponse;
|
|||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -14,5 +15,8 @@ import java.util.Map;
|
|||
*/
|
||||
public interface StudentRepository extends BaseRepository<StudentDO> {
|
||||
PageResponse<StudentDO> listPage(Map<String, Object> params);
|
||||
Boolean addBatch(List<StudentDO> studentDOs);
|
||||
|
||||
Long countByClassId(String classId);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue