Merge remote-tracking branch 'origin/dev-tmp1' into dev-tmp1
commit
728ed85b90
|
|
@ -31,6 +31,24 @@ public class ClassManagementController {
|
|||
return SingleResponse.success(classManagementService.saveClass(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("完成")
|
||||
@PostMapping("/complete")
|
||||
public SingleResponse<Boolean> complete(@RequestBody ClassManagementDTO dto) {
|
||||
return SingleResponse.success(classManagementService.complete(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("延期")
|
||||
@PostMapping("/delay")
|
||||
public SingleResponse<Boolean> delay(@RequestBody ClassManagementDTO dto) {
|
||||
return SingleResponse.success(classManagementService.delay(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("绑定试卷")
|
||||
@PostMapping("/bindPaper")
|
||||
public SingleResponse<Boolean> bindPaper(@RequestBody ClassManagementDTO dto) {
|
||||
return SingleResponse.success(classManagementService.bindPaper(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("班级详情")
|
||||
@GetMapping("/get")
|
||||
public SingleResponse<ClassManagementVO> get(@ApiParam("主键ID") @RequestParam Long id) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package org.qinan.cedu.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ClassStatusEnum {
|
||||
NOT_APPLIED(0, "未申请"),
|
||||
PENDING_START(1, "待开班"),
|
||||
IN_PROGRESS(2, "培训中"),
|
||||
FINISHED(3, "培训结束");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
public static ClassStatusEnum fromCode(int code) {
|
||||
for (ClassStatusEnum status : values()) {
|
||||
if (status.code == code) return status;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -76,4 +76,22 @@ public class ClassManagementDTO {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime delayTime;
|
||||
|
||||
/**
|
||||
* 试卷类型(如:1自动生成试卷、2平台组卷等)
|
||||
*/
|
||||
@ApiModelProperty("试卷类型(如:1自动生成试卷、2平台组卷等)")
|
||||
private Integer paperType;
|
||||
|
||||
/**
|
||||
* 考试时长(分)
|
||||
*/
|
||||
@ApiModelProperty("考试时长(分)")
|
||||
private Integer examMinutes;
|
||||
|
||||
/**
|
||||
* 试卷id
|
||||
*/
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long paperId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ public class ClassStudentExamRecordDTO {
|
|||
private Long classId;
|
||||
|
||||
@ApiModelProperty("试卷名称")
|
||||
private String examName;
|
||||
private String paperName;
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long examId;
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("得分")
|
||||
private BigDecimal score;
|
||||
|
|
|
|||
|
|
@ -77,4 +77,22 @@ public class ClassManagementDO extends BaseEntity {
|
|||
|
||||
@TableField("delay_time")
|
||||
private LocalDateTime delayTime;
|
||||
|
||||
/**
|
||||
* 试卷类型(如:1自动生成试卷、2平台组卷等)
|
||||
*/
|
||||
@TableField("paper_type")
|
||||
private Integer paperType;
|
||||
|
||||
/**
|
||||
* 考试时长(分)
|
||||
*/
|
||||
@TableField("exam_minutes")
|
||||
private Integer examMinutes;
|
||||
|
||||
/**
|
||||
* 试卷id
|
||||
*/
|
||||
@TableField("paper_id")
|
||||
private Long paperId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ public class ClassStudentExamRecordDO extends BaseEntity {
|
|||
@TableField("class_id")
|
||||
private Long classId;
|
||||
|
||||
@TableField("exam_name")
|
||||
private String examName;
|
||||
@TableField("paper_name")
|
||||
private String paperName;
|
||||
|
||||
@TableField("exam_id")
|
||||
private Long examId;
|
||||
@TableField("paper_id")
|
||||
private Long paperId;
|
||||
|
||||
@TableField("score")
|
||||
private BigDecimal score;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class ClassStudentExamRecordPageQuery extends BasePageQuery {
|
|||
private Long studentId;
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long examId;
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("是否通过(0-未通过,1-通过)")
|
||||
private Integer passed;
|
||||
|
|
|
|||
|
|
@ -75,4 +75,22 @@ public class ClassManagementVO extends BaseVO {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime delayTime;
|
||||
|
||||
/**
|
||||
* 试卷类型(如:1自动生成试卷、2平台组卷等)
|
||||
*/
|
||||
@ApiModelProperty("试卷类型(如:1自动生成试卷、2平台组卷等)")
|
||||
private Integer paperType;
|
||||
|
||||
/**
|
||||
* 考试时长(分)
|
||||
*/
|
||||
@ApiModelProperty("考试时长(分)")
|
||||
private Integer examMinutes;
|
||||
|
||||
/**
|
||||
* 试卷id
|
||||
*/
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long paperId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ public class ClassStudentExamRecordVO extends BaseVO {
|
|||
private Long classId;
|
||||
|
||||
@ApiModelProperty("试卷名称")
|
||||
private String examName;
|
||||
private String paperName;
|
||||
|
||||
@ApiModelProperty("试卷id")
|
||||
private Long examId;
|
||||
private Long paperId;
|
||||
|
||||
@ApiModelProperty("得分")
|
||||
private BigDecimal score;
|
||||
|
|
|
|||
|
|
@ -21,4 +21,10 @@ public interface ClassManagementService extends IService<ClassManagementDO> {
|
|||
boolean updateClass(ClassManagementDTO dto);
|
||||
|
||||
boolean deleteById(Long id);
|
||||
|
||||
Boolean complete(ClassManagementDTO dto);
|
||||
|
||||
Boolean bindPaper(ClassManagementDTO dto);
|
||||
|
||||
Boolean delay(ClassManagementDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.qinan.cedu.convertor.ClassManagementConvertor;
|
||||
import org.qinan.cedu.enums.ClassStatusEnum;
|
||||
import org.qinan.cedu.enums.DeleteEnum;
|
||||
import org.qinan.cedu.mapper.ClassManagementMapper;
|
||||
import org.qinan.cedu.model.dto.ClassManagementDTO;
|
||||
|
|
@ -14,9 +15,12 @@ import org.qinan.cedu.service.ClassManagementService;
|
|||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 班级管理服务实现
|
||||
|
|
@ -91,4 +95,55 @@ public class ClassManagementServiceImpl extends ServiceImpl<ClassManagementMappe
|
|||
.eq(ClassManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean complete(ClassManagementDTO dto) {
|
||||
LocalDate start = dto.getStartDate().toLocalDate();
|
||||
LocalDate end = dto.getDelayTime().toLocalDate();;
|
||||
if (Objects.isNull(end)) {
|
||||
end = dto.getEndDate().toLocalDate();
|
||||
}
|
||||
LocalDate now = LocalDate.now();
|
||||
ClassStatusEnum pendingStart;
|
||||
if (now.isBefore(start)) {
|
||||
pendingStart = ClassStatusEnum.PENDING_START;
|
||||
} else if (now.isAfter(start) && now.isBefore(end)) {
|
||||
pendingStart = ClassStatusEnum.IN_PROGRESS;
|
||||
} else if (now.isAfter(end)){
|
||||
pendingStart = ClassStatusEnum.FINISHED;
|
||||
} else {
|
||||
pendingStart = ClassStatusEnum.NOT_APPLIED;
|
||||
}
|
||||
return this.lambdaUpdate()
|
||||
.set(ClassManagementDO::getStatus, pendingStart.getCode())
|
||||
.set(ClassManagementDO::getUpdateTime, LocalDateTime.now())
|
||||
.eq(ClassManagementDO::getId, dto.getId())
|
||||
.eq(ClassManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean bindPaper(ClassManagementDTO dto) {
|
||||
return this.lambdaUpdate()
|
||||
.set(ClassManagementDO::getPaperId, dto.getPaperId())
|
||||
.set(ClassManagementDO::getPaperType, dto.getPaperType())
|
||||
.set(ClassManagementDO::getExamMinutes, dto.getExamMinutes())
|
||||
.set(ClassManagementDO::getUpdateTime, LocalDateTime.now())
|
||||
.eq(ClassManagementDO::getId, dto.getId())
|
||||
.eq(ClassManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delay(ClassManagementDTO dto) {
|
||||
this.lambdaUpdate()
|
||||
.set(ClassManagementDO::getDelayTime, dto.getDelayTime())
|
||||
.set(ClassManagementDO::getUpdateTime, LocalDateTime.now())
|
||||
.eq(ClassManagementDO::getId, dto.getId())
|
||||
.eq(ClassManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.update();
|
||||
// 判断状态
|
||||
return complete(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ClassStudentExamRecordServiceImpl extends ServiceImpl<ClassStudentE
|
|||
.eq(ClassStudentExamRecordDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.eq(query.getClassId() != null, ClassStudentExamRecordDO::getClassId, query.getClassId())
|
||||
.eq(query.getStudentId() != null, ClassStudentExamRecordDO::getStudentId, query.getStudentId())
|
||||
.eq(query.getExamId() != null, ClassStudentExamRecordDO::getExamId, query.getExamId())
|
||||
.eq(query.getPaperId() != null, ClassStudentExamRecordDO::getPaperId, query.getPaperId())
|
||||
.eq(query.getPassed() != null, ClassStudentExamRecordDO::getPassed, query.getPassed())
|
||||
.orderByDesc(ClassStudentExamRecordDO::getCreateTime)
|
||||
.page(new Page<>(query.getCurrent(), query.getSize()))
|
||||
|
|
|
|||
Loading…
Reference in New Issue