dev:视频课件维护代码开发
parent
1d8565f97e
commit
123df8e6f4
|
|
@ -19,8 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-adapter
|
* web-adapter
|
||||||
|
|
@ -81,5 +80,12 @@ public class QuestionController {
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导入题目-视频课件")
|
||||||
|
@PostMapping("/importQuestionVideoTable")
|
||||||
|
public Response importQuestionVideoTable(@RequestPart(value = "file") MultipartFile file, @RequestParam(value = "videoCoursewareId") String videoCoursewareId) {
|
||||||
|
questionService.importQuestionVideoTable(file, videoCoursewareId);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,7 @@ package com.zcloud.edu.web;
|
||||||
|
|
||||||
|
|
||||||
import com.zcloud.edu.api.VideoCoursewareServiceI;
|
import com.zcloud.edu.api.VideoCoursewareServiceI;
|
||||||
import com.zcloud.edu.dto.VideoCoursewareAddCmd;
|
import com.zcloud.edu.dto.*;
|
||||||
import com.zcloud.edu.dto.VideoCoursewarePageQry;
|
|
||||||
import com.zcloud.edu.dto.VideoCoursewareListQry;
|
|
||||||
import com.zcloud.edu.dto.VideoCoursewareUpdateCmd;
|
|
||||||
import com.zcloud.edu.dto.VideoCoursewareRemoveCmd;
|
|
||||||
import com.zcloud.edu.dto.clientobject.VideoCoursewareCO;
|
import com.zcloud.edu.dto.clientobject.VideoCoursewareCO;
|
||||||
import com.alibaba.cola.dto.MultiResponse;
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
|
@ -49,6 +45,13 @@ public class VideoCoursewareController {
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("启用/禁用")
|
||||||
|
@PutMapping("/editState")
|
||||||
|
public SingleResponse editState(@Validated @RequestBody VideoCoursewareUpdateStateCmd cmd) {
|
||||||
|
videoCoursewareService.editState(cmd);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("分页")
|
@ApiOperation("分页")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public PageResponse<VideoCoursewareCO> page(@RequestBody VideoCoursewarePageQry qry) {
|
public PageResponse<VideoCoursewareCO> page(@RequestBody VideoCoursewarePageQry qry) {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,19 @@
|
||||||
package com.zcloud.edu.command;
|
package com.zcloud.edu.command;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.zcloud.edu.domain.gateway.QuestionGateway;
|
import com.zcloud.edu.domain.gateway.QuestionGateway;
|
||||||
import com.zcloud.edu.domain.model.QuestionE;
|
import com.zcloud.edu.domain.model.QuestionE;
|
||||||
import com.zcloud.edu.dto.QuestionAddCmd;
|
import com.zcloud.edu.dto.QuestionAddCmd;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
||||||
|
import com.zcloud.edu.persistence.repository.QuestionRepository;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,11 +26,14 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class QuestionAddExe {
|
public class QuestionAddExe {
|
||||||
private final QuestionGateway questionGateway;
|
private final QuestionGateway questionGateway;
|
||||||
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(QuestionAddCmd cmd) {
|
public boolean execute(QuestionAddCmd cmd) {
|
||||||
QuestionE questionE = new QuestionE();
|
QuestionE questionE = new QuestionE();
|
||||||
BeanUtils.copyProperties(cmd, questionE);
|
BeanUtils.copyProperties(cmd, questionE);
|
||||||
|
questionE.checkQuestion(questionE);
|
||||||
|
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
try {
|
try {
|
||||||
res = questionGateway.add(questionE);
|
res = questionGateway.add(questionE);
|
||||||
|
|
@ -36,5 +45,23 @@ public class QuestionAddExe {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void importQuestionVideoTable(MultipartFile file, String videoCoursewareId){
|
||||||
|
QuestionE questionE = new QuestionE();
|
||||||
|
Integer maxQuestionNumber = questionRepository.getMaxQuestionNumber(videoCoursewareId);
|
||||||
|
List<QuestionE> questionES = questionE.parseImportTemplateData(file, videoCoursewareId, maxQuestionNumber);
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
boolean res = false;
|
||||||
|
try {
|
||||||
|
res = questionRepository.saveBatch(BeanUtil.copyToList(questionES, QuestionDO.class));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (!res) {
|
||||||
|
throw new BizException("导入失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ public class QuestionUpdateExe {
|
||||||
public void execute(QuestionUpdateCmd cmd) {
|
public void execute(QuestionUpdateCmd cmd) {
|
||||||
QuestionE questionE = new QuestionE();
|
QuestionE questionE = new QuestionE();
|
||||||
BeanUtils.copyProperties(cmd, questionE);
|
BeanUtils.copyProperties(cmd, questionE);
|
||||||
|
questionE.checkQuestion(questionE);
|
||||||
boolean res = questionGateway.update(questionE);
|
boolean res = questionGateway.update(questionE);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
throw new BizException("修改失败");
|
throw new BizException("修改失败");
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,12 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.zcloud.edu.domain.gateway.TeacherGateway;
|
import com.zcloud.edu.domain.gateway.TeacherGateway;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.zcloud.edu.domain.model.TeacherE;
|
||||||
import com.zcloud.edu.persistence.dataobject.TeacherDO;
|
import com.zcloud.edu.persistence.dataobject.TeacherDO;
|
||||||
|
import com.zcloud.edu.persistence.dataobject.VideoCoursewareDO;
|
||||||
import com.zcloud.edu.persistence.repository.TeacherCertificateRepository;
|
import com.zcloud.edu.persistence.repository.TeacherCertificateRepository;
|
||||||
import com.zcloud.edu.persistence.repository.TeacherRepository;
|
import com.zcloud.edu.persistence.repository.TeacherRepository;
|
||||||
|
import com.zcloud.edu.persistence.repository.VideoCoursewareRepository;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -28,6 +31,7 @@ public class TeacherRemoveExe {
|
||||||
private final TeacherGateway teacherGateway;
|
private final TeacherGateway teacherGateway;
|
||||||
private final TeacherRepository teacherRepository;
|
private final TeacherRepository teacherRepository;
|
||||||
private final TeacherCertificateRepository teacherCertificateRepository;
|
private final TeacherCertificateRepository teacherCertificateRepository;
|
||||||
|
private final VideoCoursewareRepository videoCoursewareRepository;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(Long id) {
|
public boolean execute(Long id) {
|
||||||
|
|
@ -37,6 +41,10 @@ public class TeacherRemoveExe {
|
||||||
throw new BizException("数据不存在");
|
throw new BizException("数据不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TeacherE teacherE = new TeacherE();
|
||||||
|
List<VideoCoursewareDO> videoCoursewareDOS = videoCoursewareRepository.listByTeacherId(teacherDO.getData().getTeacherId());
|
||||||
|
teacherE.checkList(videoCoursewareDOS == null ? 0 : videoCoursewareDOS.size());
|
||||||
|
|
||||||
boolean res = teacherGateway.deletedTeacherById(id);
|
boolean res = teacherGateway.deletedTeacherById(id);
|
||||||
if(res){
|
if(res){
|
||||||
String teacherId = teacherDO.getData().getTeacherId();
|
String teacherId = teacherDO.getData().getTeacherId();
|
||||||
|
|
@ -55,10 +63,14 @@ public class TeacherRemoveExe {
|
||||||
throw new BizException("数据不存在");
|
throw new BizException("数据不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> teacherIds = teacherDOS.stream().map(TeacherDO::getTeacherId).collect(Collectors.toList());
|
||||||
|
List<VideoCoursewareDO> videoCoursewareDOS = videoCoursewareRepository.listByTeacherIds(teacherIds);
|
||||||
|
TeacherE teacherE = new TeacherE();
|
||||||
|
teacherE.checkList(videoCoursewareDOS == null ? 0 : videoCoursewareDOS.size());
|
||||||
|
|
||||||
boolean res = teacherGateway.deletedTeacherByIds(ids);
|
boolean res = teacherGateway.deletedTeacherByIds(ids);
|
||||||
|
|
||||||
if(res){
|
if(res){
|
||||||
List<String> teacherIds = teacherDOS.stream().map(TeacherDO::getTeacherId).collect(Collectors.toList());
|
|
||||||
teacherCertificateRepository.removeByTeacherIds(teacherIds);
|
teacherCertificateRepository.removeByTeacherIds(teacherIds);
|
||||||
}
|
}
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.exception.BizException;
|
||||||
import com.zcloud.edu.domain.gateway.VideoCoursewareGateway;
|
import com.zcloud.edu.domain.gateway.VideoCoursewareGateway;
|
||||||
import com.zcloud.edu.domain.model.VideoCoursewareE;
|
import com.zcloud.edu.domain.model.VideoCoursewareE;
|
||||||
import com.zcloud.edu.dto.VideoCoursewareUpdateCmd;
|
import com.zcloud.edu.dto.VideoCoursewareUpdateCmd;
|
||||||
|
import com.zcloud.edu.dto.VideoCoursewareUpdateStateCmd;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -30,5 +31,15 @@ public class VideoCoursewareUpdateExe {
|
||||||
throw new BizException("修改失败");
|
throw new BizException("修改失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void execute(VideoCoursewareUpdateStateCmd cmd) {
|
||||||
|
VideoCoursewareE videoCoursewareE = new VideoCoursewareE();
|
||||||
|
BeanUtils.copyProperties(cmd, videoCoursewareE);
|
||||||
|
boolean res = videoCoursewareGateway.update(videoCoursewareE);
|
||||||
|
if (!res) {
|
||||||
|
throw new BizException("修改失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-app
|
* web-app
|
||||||
|
|
@ -66,5 +67,10 @@ public class QuestionServiceImpl implements QuestionServiceI {
|
||||||
public void removeBatch(Long[] ids) {
|
public void removeBatch(Long[] ids) {
|
||||||
questionRemoveExe.execute(ids);
|
questionRemoveExe.execute(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void importQuestionVideoTable(MultipartFile file, String videoCoursewareId) {
|
||||||
|
questionAddExe.importQuestionVideoTable(file, videoCoursewareId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ import com.zcloud.edu.command.VideoCoursewareAddExe;
|
||||||
import com.zcloud.edu.command.VideoCoursewareRemoveExe;
|
import com.zcloud.edu.command.VideoCoursewareRemoveExe;
|
||||||
import com.zcloud.edu.command.VideoCoursewareUpdateExe;
|
import com.zcloud.edu.command.VideoCoursewareUpdateExe;
|
||||||
import com.zcloud.edu.command.query.VideoCoursewareQueryExe;
|
import com.zcloud.edu.command.query.VideoCoursewareQueryExe;
|
||||||
import com.zcloud.edu.dto.VideoCoursewareAddCmd;
|
import com.zcloud.edu.dto.*;
|
||||||
import com.zcloud.edu.dto.VideoCoursewarePageQry;
|
|
||||||
import com.zcloud.edu.dto.VideoCoursewareListQry;
|
|
||||||
import com.zcloud.edu.dto.VideoCoursewareUpdateCmd;
|
|
||||||
import com.zcloud.edu.dto.clientobject.VideoCoursewareCO;
|
import com.zcloud.edu.dto.clientobject.VideoCoursewareCO;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
|
@ -57,6 +54,11 @@ public class VideoCoursewareServiceImpl implements VideoCoursewareServiceI {
|
||||||
videoCoursewareUpdateExe.execute(cmd);
|
videoCoursewareUpdateExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void editState(VideoCoursewareUpdateStateCmd cmd) {
|
||||||
|
videoCoursewareUpdateExe.execute(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(Long id) {
|
public void remove(Long id) {
|
||||||
videoCoursewareRemoveExe.execute(id);
|
videoCoursewareRemoveExe.execute(id);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.zcloud.edu.dto.clientobject.QuestionCO;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-client
|
* web-client
|
||||||
|
|
@ -30,5 +31,7 @@ public interface QuestionServiceI {
|
||||||
void remove(Long id);
|
void remove(Long id);
|
||||||
|
|
||||||
void removeBatch(Long[] ids);
|
void removeBatch(Long[] ids);
|
||||||
|
|
||||||
|
void importQuestionVideoTable(MultipartFile file, String videoCoursewareId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package com.zcloud.edu.api;
|
package com.zcloud.edu.api;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.MultiResponse;
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
import com.zcloud.edu.dto.VideoCoursewareAddCmd;
|
import com.zcloud.edu.dto.*;
|
||||||
import com.zcloud.edu.dto.VideoCoursewarePageQry;
|
|
||||||
import com.zcloud.edu.dto.VideoCoursewareListQry;
|
|
||||||
import com.zcloud.edu.dto.VideoCoursewareUpdateCmd;
|
|
||||||
import com.zcloud.edu.dto.clientobject.VideoCoursewareCO;
|
import com.zcloud.edu.dto.clientobject.VideoCoursewareCO;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
|
@ -27,6 +24,8 @@ public interface VideoCoursewareServiceI {
|
||||||
|
|
||||||
void edit(VideoCoursewareUpdateCmd cmd);
|
void edit(VideoCoursewareUpdateCmd cmd);
|
||||||
|
|
||||||
|
void editState(VideoCoursewareUpdateStateCmd cmd);
|
||||||
|
|
||||||
void remove(Long id);
|
void remove(Long id);
|
||||||
|
|
||||||
void removeBatch(Long[] ids);
|
void removeBatch(Long[] ids);
|
||||||
|
|
|
||||||
|
|
@ -20,44 +20,31 @@ import javax.validation.constraints.*;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class QuestionAddCmd extends Command {
|
public class QuestionAddCmd extends Command {
|
||||||
@ApiModelProperty(value = "课件id", name = "videoCoursewareId", required = true)
|
|
||||||
@NotEmpty(message = "课件id不能为空")
|
@ApiModelProperty(value = "课件id", name = "videoCoursewareId")
|
||||||
private String videoCoursewareId;
|
private String videoCoursewareId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "试卷id", name = "examPaperId", required = true)
|
@ApiModelProperty(value = "试卷id", name = "examPaperId")
|
||||||
@NotEmpty(message = "试卷id不能为空")
|
|
||||||
private String examPaperId;
|
private String examPaperId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "题号", name = "questionNumber", required = true)
|
@ApiModelProperty(value = "试题类型(1单选题、2多选题、3判断题)", name = "questionType", required = true)
|
||||||
@NotNull(message = "题号不能为空")
|
@NotEmpty(message = "试题类型(单选题、多选题、判断题)不能为空")
|
||||||
private Integer questionNumber;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "试题类型(单选题、多选题、判断题、填空题)", name = "questionType", required = true)
|
|
||||||
@NotEmpty(message = "试题类型(单选题、多选题、判断题、填空题)不能为空")
|
|
||||||
private String questionType;
|
private String questionType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "试题类型名称", name = "questionTypeName", required = true)
|
|
||||||
@NotEmpty(message = "试题类型名称不能为空")
|
|
||||||
private String questionTypeName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "题干", name = "questionDry", required = true)
|
@ApiModelProperty(value = "题干", name = "questionDry", required = true)
|
||||||
@NotEmpty(message = "题干不能为空")
|
@NotEmpty(message = "题干不能为空")
|
||||||
private String questionDry;
|
private String questionDry;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项A", name = "optionA", required = true)
|
@ApiModelProperty(value = "选项A", name = "optionA", required = true)
|
||||||
@NotEmpty(message = "选项A不能为空")
|
|
||||||
private String optionA;
|
private String optionA;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项B", name = "optionB", required = true)
|
@ApiModelProperty(value = "选项B", name = "optionB", required = true)
|
||||||
@NotEmpty(message = "选项B不能为空")
|
|
||||||
private String optionB;
|
private String optionB;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项C", name = "optionC", required = true)
|
@ApiModelProperty(value = "选项C", name = "optionC", required = true)
|
||||||
@NotEmpty(message = "选项C不能为空")
|
|
||||||
private String optionC;
|
private String optionC;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项D", name = "optionD", required = true)
|
@ApiModelProperty(value = "选项D", name = "optionD", required = true)
|
||||||
@NotEmpty(message = "选项D不能为空")
|
|
||||||
private String optionD;
|
private String optionD;
|
||||||
|
|
||||||
@ApiModelProperty(value = "答案", name = "answer", required = true)
|
@ApiModelProperty(value = "答案", name = "answer", required = true)
|
||||||
|
|
@ -68,12 +55,10 @@ public class QuestionAddCmd extends Command {
|
||||||
@NotNull(message = "课件类型(1:视频课件、2:试卷习题)不能为空")
|
@NotNull(message = "课件类型(1:视频课件、2:试卷习题)不能为空")
|
||||||
private Integer coursewareType;
|
private Integer coursewareType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "答案解析", name = "descr", required = true)
|
@ApiModelProperty(value = "答案解析", name = "descr")
|
||||||
@NotEmpty(message = "答案解析不能为空")
|
|
||||||
private String descr;
|
private String descr;
|
||||||
|
|
||||||
@ApiModelProperty(value = "分值", name = "score", required = true)
|
@ApiModelProperty(value = "分值", name = "score")
|
||||||
@NotEmpty(message = "分值不能为空")
|
|
||||||
private String score;
|
private String score;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.zcloud.edu.dto;
|
package com.zcloud.edu.dto;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageQuery;
|
import com.alibaba.cola.dto.PageQuery;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-client
|
* web-client
|
||||||
|
|
@ -23,6 +26,11 @@ public class QuestionPageQry extends PageQuery {
|
||||||
* - `le`: 小于等于比较查询
|
* - `le`: 小于等于比较查询
|
||||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||||
*/
|
*/
|
||||||
private String likeQuestionId;
|
|
||||||
|
@ApiModelProperty(value = "视频课件id、2:试卷习题)", name = "eqVideoCoursewareId", required = true)
|
||||||
|
private String eqVideoCoursewareId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "试卷id", name = "eqExamPaperId", required = true)
|
||||||
|
private String eqExamPaperId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,53 +20,52 @@ import javax.validation.constraints.*;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class QuestionUpdateCmd extends Command {
|
public class QuestionUpdateCmd extends Command {
|
||||||
@ApiModelProperty(value = "${column.comment}", name = "id", required = true)
|
@ApiModelProperty(value = "id", name = "id", required = true)
|
||||||
@NotNull(message = "${column.comment}不能为空")
|
@NotNull(message = "id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
@ApiModelProperty(value = "业务主键id", name = "questionId", required = true)
|
|
||||||
@NotEmpty(message = "业务主键id不能为空")
|
@ApiModelProperty(value = "主键id", name = "questionNumber", required = true)
|
||||||
|
@NotEmpty(message = "主键id不能为空")
|
||||||
private String questionId;
|
private String questionId;
|
||||||
@ApiModelProperty(value = "课件id", name = "videoCoursewareId", required = true)
|
|
||||||
@NotEmpty(message = "课件id不能为空")
|
@ApiModelProperty(value = "课件id", name = "videoCoursewareId")
|
||||||
private String videoCoursewareId;
|
private String videoCoursewareId;
|
||||||
@ApiModelProperty(value = "试卷id", name = "examPaperId", required = true)
|
|
||||||
@NotEmpty(message = "试卷id不能为空")
|
@ApiModelProperty(value = "试卷id", name = "examPaperId")
|
||||||
private String examPaperId;
|
private String examPaperId;
|
||||||
@ApiModelProperty(value = "题号", name = "questionNumber", required = true)
|
|
||||||
@NotNull(message = "题号不能为空")
|
@ApiModelProperty(value = "试题类型(1单选题、2多选题、3判断题)", name = "questionType", required = true)
|
||||||
private Integer questionNumber;
|
@NotEmpty(message = "试题类型(单选题、多选题、判断题)不能为空")
|
||||||
@ApiModelProperty(value = "试题类型(单选题、多选题、判断题、填空题)", name = "questionType", required = true)
|
|
||||||
@NotEmpty(message = "试题类型(单选题、多选题、判断题、填空题)不能为空")
|
|
||||||
private String questionType;
|
private String questionType;
|
||||||
@ApiModelProperty(value = "试题类型名称", name = "questionTypeName", required = true)
|
|
||||||
@NotEmpty(message = "试题类型名称不能为空")
|
|
||||||
private String questionTypeName;
|
|
||||||
@ApiModelProperty(value = "题干", name = "questionDry", required = true)
|
@ApiModelProperty(value = "题干", name = "questionDry", required = true)
|
||||||
@NotEmpty(message = "题干不能为空")
|
@NotEmpty(message = "题干不能为空")
|
||||||
private String questionDry;
|
private String questionDry;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项A", name = "optionA", required = true)
|
@ApiModelProperty(value = "选项A", name = "optionA", required = true)
|
||||||
@NotEmpty(message = "选项A不能为空")
|
|
||||||
private String optionA;
|
private String optionA;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项B", name = "optionB", required = true)
|
@ApiModelProperty(value = "选项B", name = "optionB", required = true)
|
||||||
@NotEmpty(message = "选项B不能为空")
|
|
||||||
private String optionB;
|
private String optionB;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项C", name = "optionC", required = true)
|
@ApiModelProperty(value = "选项C", name = "optionC", required = true)
|
||||||
@NotEmpty(message = "选项C不能为空")
|
|
||||||
private String optionC;
|
private String optionC;
|
||||||
|
|
||||||
@ApiModelProperty(value = "选项D", name = "optionD", required = true)
|
@ApiModelProperty(value = "选项D", name = "optionD", required = true)
|
||||||
@NotEmpty(message = "选项D不能为空")
|
|
||||||
private String optionD;
|
private String optionD;
|
||||||
|
|
||||||
@ApiModelProperty(value = "答案", name = "answer", required = true)
|
@ApiModelProperty(value = "答案", name = "answer", required = true)
|
||||||
@NotEmpty(message = "答案不能为空")
|
@NotEmpty(message = "答案不能为空")
|
||||||
private String answer;
|
private String answer;
|
||||||
|
|
||||||
@ApiModelProperty(value = "课件类型(1:视频课件、2:试卷习题)", name = "coursewareType", required = true)
|
@ApiModelProperty(value = "课件类型(1:视频课件、2:试卷习题)", name = "coursewareType", required = true)
|
||||||
@NotNull(message = "课件类型(1:视频课件、2:试卷习题)不能为空")
|
@NotNull(message = "课件类型(1:视频课件、2:试卷习题)不能为空")
|
||||||
private Integer coursewareType;
|
private Integer coursewareType;
|
||||||
@ApiModelProperty(value = "答案解析", name = "descr", required = true)
|
|
||||||
@NotEmpty(message = "答案解析不能为空")
|
@ApiModelProperty(value = "答案解析", name = "descr")
|
||||||
private String descr;
|
private String descr;
|
||||||
@ApiModelProperty(value = "分值", name = "score", required = true)
|
|
||||||
@NotEmpty(message = "分值不能为空")
|
@ApiModelProperty(value = "分值", name = "score")
|
||||||
private String score;
|
private String score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.zcloud.edu.dto;
|
package com.zcloud.edu.dto;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageQuery;
|
import com.alibaba.cola.dto.PageQuery;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-client
|
* web-client
|
||||||
|
|
@ -24,5 +27,9 @@ public class TeacherListQry extends PageQuery {
|
||||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||||
*/
|
*/
|
||||||
private String eqCorpinfoId;
|
private String eqCorpinfoId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "corpFlag 监管端1,企业端2", value = "corpFlag", required = true)
|
||||||
|
@NotNull(message = "监管/企业标识不能为空")
|
||||||
|
private Integer corpFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import com.alibaba.cola.dto.PageQuery;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-client
|
* web-client
|
||||||
|
|
@ -32,5 +35,9 @@ public class TeacherPageQry extends PageQuery {
|
||||||
|
|
||||||
@ApiModelProperty(name = "qualificationType", value = "资格类型")
|
@ApiModelProperty(name = "qualificationType", value = "资格类型")
|
||||||
private String qualificationType;
|
private String qualificationType;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "corpFlag 监管端1,企业端2", value = "corpFlag", required = true)
|
||||||
|
@NotNull(message = "监管/企业标识不能为空")
|
||||||
|
private Integer corpFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,11 @@ import javax.validation.constraints.*;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class VideoCoursewareAddCmd extends Command {
|
public class VideoCoursewareAddCmd extends Command {
|
||||||
@ApiModelProperty(value = "企业ID", name = "corpinfoId", required = true)
|
|
||||||
@NotNull(message = "企业ID不能为空")
|
@ApiModelProperty(value = "课件id", name = "videoCoursewareId")
|
||||||
|
private String videoCoursewareId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业ID", name = "corpinfoId")
|
||||||
private Long corpinfoId;
|
private Long corpinfoId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "课件名称", name = "coursewareName", required = true)
|
@ApiModelProperty(value = "课件名称", name = "coursewareName", required = true)
|
||||||
|
|
@ -44,14 +47,6 @@ public class VideoCoursewareAddCmd extends Command {
|
||||||
@NotEmpty(message = "课件描述不能为空")
|
@NotEmpty(message = "课件描述不能为空")
|
||||||
private String coursewareIntroduce;
|
private String coursewareIntroduce;
|
||||||
|
|
||||||
@ApiModelProperty(value = "课件状态 0未启用, 1-启用", name = "state", required = true)
|
|
||||||
@NotNull(message = "课件状态 0未启用, 1-启用不能为空")
|
|
||||||
private Integer state;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "学时,单位分钟", name = "classHour", required = true)
|
|
||||||
@NotEmpty(message = "学时,单位分钟不能为空")
|
|
||||||
private String classHour;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "课件时长(视频时间)-分钟", name = "videoTime", required = true)
|
@ApiModelProperty(value = "课件时长(视频时间)-分钟", name = "videoTime", required = true)
|
||||||
@NotEmpty(message = "课件时长(视频时间)-分钟不能为空")
|
@NotEmpty(message = "课件时长(视频时间)-分钟不能为空")
|
||||||
private String videoTime;
|
private String videoTime;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,6 @@ public class VideoCoursewareListQry extends PageQuery {
|
||||||
* - `le`: 小于等于比较查询
|
* - `le`: 小于等于比较查询
|
||||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||||
*/
|
*/
|
||||||
private String likeVideoCoursewareId;
|
private String eqCorpinfoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.zcloud.edu.dto;
|
package com.zcloud.edu.dto;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageQuery;
|
import com.alibaba.cola.dto.PageQuery;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -23,6 +24,14 @@ public class VideoCoursewarePageQry extends PageQuery {
|
||||||
* - `le`: 小于等于比较查询
|
* - `le`: 小于等于比较查询
|
||||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||||
*/
|
*/
|
||||||
private String likeVideoCoursewareId;
|
|
||||||
|
@ApiModelProperty(value = "课件名称")
|
||||||
|
private String likeCoursewareName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "培训类型")
|
||||||
|
private String eqTrainingTypeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "启用:1, 禁用:0")
|
||||||
|
private Integer eqState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.zcloud.edu.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
*
|
||||||
|
* @Author SondonYong
|
||||||
|
* @Date 2025-11-27 14:05:32
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VideoCoursewareUpdateStateCmd extends Command {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id", name = "id", required = true)
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "课件状态:启用传1,禁用传0", name = "state", required = true)
|
||||||
|
@NotNull(message = "课件状态不能为空")
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -35,13 +35,9 @@ public class QuestionCO extends ClientObject {
|
||||||
|
|
||||||
private Integer questionNumber;
|
private Integer questionNumber;
|
||||||
//试题类型(单选题、多选题、判断题、填空题)
|
//试题类型(单选题、多选题、判断题、填空题)
|
||||||
@ApiModelProperty(value = "试题类型(单选题、多选题、判断题、填空题)")
|
@ApiModelProperty(value = "试题类型(1单选题、2多选题、3判断题)")
|
||||||
|
|
||||||
private String questionType;
|
private String questionType;
|
||||||
//试题类型名称
|
|
||||||
@ApiModelProperty(value = "试题类型名称")
|
|
||||||
|
|
||||||
private String questionTypeName;
|
|
||||||
//题干
|
//题干
|
||||||
@ApiModelProperty(value = "题干")
|
@ApiModelProperty(value = "题干")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,47 +18,56 @@ import java.time.LocalDate;
|
||||||
public class VideoCoursewareCO extends ClientObject {
|
public class VideoCoursewareCO extends ClientObject {
|
||||||
//id
|
//id
|
||||||
@ApiModelProperty(value = "id")
|
@ApiModelProperty(value = "id")
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
//业务主键id
|
//业务主键id
|
||||||
@ApiModelProperty(value = "业务主键id")
|
@ApiModelProperty(value = "业务主键id")
|
||||||
|
|
||||||
private String videoCoursewareId;
|
private String videoCoursewareId;
|
||||||
|
|
||||||
//企业ID
|
//企业ID
|
||||||
@ApiModelProperty(value = "企业ID")
|
@ApiModelProperty(value = "企业ID")
|
||||||
|
|
||||||
private Long corpinfoId;
|
private Long corpinfoId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业名称")
|
||||||
|
private String corpName;
|
||||||
|
|
||||||
//课件名称
|
//课件名称
|
||||||
@ApiModelProperty(value = "课件名称")
|
@ApiModelProperty(value = "课件名称")
|
||||||
|
|
||||||
private String coursewareName;
|
private String coursewareName;
|
||||||
|
|
||||||
//培训类型id
|
//培训类型id
|
||||||
@ApiModelProperty(value = "培训类型id")
|
@ApiModelProperty(value = "培训类型id")
|
||||||
|
|
||||||
private String trainingTypeId;
|
private String trainingTypeId;
|
||||||
|
|
||||||
|
//培训类型名称
|
||||||
|
@ApiModelProperty(value = "培训类型名称")
|
||||||
|
private String trainingTypeName;
|
||||||
|
|
||||||
//教师id
|
//教师id
|
||||||
@ApiModelProperty(value = "教师id")
|
@ApiModelProperty(value = "教师id")
|
||||||
|
|
||||||
private String teacherId;
|
private String teacherId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "教师名称")
|
||||||
|
private String teacherName;
|
||||||
|
|
||||||
//课件文件路径
|
//课件文件路径
|
||||||
@ApiModelProperty(value = "课件文件路径")
|
@ApiModelProperty(value = "课件文件路径")
|
||||||
|
|
||||||
private String videoFiles;
|
private String videoFiles;
|
||||||
|
|
||||||
//课件描述
|
//课件描述
|
||||||
@ApiModelProperty(value = "课件描述")
|
@ApiModelProperty(value = "课件描述")
|
||||||
|
|
||||||
private String coursewareIntroduce;
|
private String coursewareIntroduce;
|
||||||
|
|
||||||
//课件状态 0未启用, 1-启用
|
//课件状态 0未启用, 1-启用
|
||||||
@ApiModelProperty(value = "课件状态 0未启用, 1-启用")
|
@ApiModelProperty(value = "课件状态 0未启用, 1-启用")
|
||||||
|
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
//学时,单位分钟
|
//学时,单位分钟
|
||||||
@ApiModelProperty(value = "学时,单位分钟")
|
@ApiModelProperty(value = "学时,单位分钟")
|
||||||
|
|
||||||
private String classHour;
|
private String classHour;
|
||||||
|
|
||||||
//课件时长(视频时间)-分钟
|
//课件时长(视频时间)-分钟
|
||||||
@ApiModelProperty(value = "课件时长(视频时间)-分钟")
|
@ApiModelProperty(value = "课件时长(视频时间)-分钟")
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime videoTime;
|
private LocalDateTime videoTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.zcloud.edu.domain.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题类型(1单选题、2多选题、3判断题)
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum QuestionTypeEnum {
|
||||||
|
|
||||||
|
CHOICE("1","单选题"),
|
||||||
|
MULTIPLE("2","多选题"),
|
||||||
|
JUDGE("3","判断题"),
|
||||||
|
;
|
||||||
|
private final String code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
QuestionTypeEnum(String code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,22 @@
|
||||||
package com.zcloud.edu.domain.model;
|
package com.zcloud.edu.domain.model;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||||
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.jjb.saas.framework.domain.model.BaseE;
|
import com.jjb.saas.framework.domain.model.BaseE;
|
||||||
|
import com.zcloud.edu.domain.enums.QuestionTypeEnum;
|
||||||
|
import com.zcloud.gbscommon.excelEntity.QuestionVideoChoiceExcelImportEntity;
|
||||||
|
import com.zcloud.gbscommon.excelEntity.QuestionVideoJudgeExcelImportEntity;
|
||||||
|
import com.zcloud.gbscommon.excelEntity.QuestionVideoMultiselectExcelImportEntity;
|
||||||
|
import com.zcloud.gbscommon.excelEntity.RiskPointExcelImportEntity;
|
||||||
|
import com.zcloud.gbscommon.utils.ExcelUtils;
|
||||||
|
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-domain
|
* web-domain
|
||||||
|
|
@ -24,8 +37,6 @@ public class QuestionE extends BaseE {
|
||||||
private Integer questionNumber;
|
private Integer questionNumber;
|
||||||
//试题类型(单选题、多选题、判断题、填空题)
|
//试题类型(单选题、多选题、判断题、填空题)
|
||||||
private String questionType;
|
private String questionType;
|
||||||
//试题类型名称
|
|
||||||
private String questionTypeName;
|
|
||||||
//题干
|
//题干
|
||||||
private String questionDry;
|
private String questionDry;
|
||||||
//选项A
|
//选项A
|
||||||
|
|
@ -44,5 +55,196 @@ public class QuestionE extends BaseE {
|
||||||
private String descr;
|
private String descr;
|
||||||
//分值
|
//分值
|
||||||
private String score;
|
private String score;
|
||||||
}
|
|
||||||
|
|
||||||
|
public void checkQuestion(QuestionE questionE) {
|
||||||
|
if (questionE.getCoursewareType() == 1) {
|
||||||
|
// 视频课件
|
||||||
|
if (questionE.getVideoCoursewareId() == null) {
|
||||||
|
throw new RuntimeException("请选择正确的视频课件");
|
||||||
|
}
|
||||||
|
} else if (questionE.getCoursewareType() == 2) {
|
||||||
|
// 试卷习题
|
||||||
|
if (questionE.getExamPaperId() == null) {
|
||||||
|
throw new RuntimeException("请选择正确的试卷");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(questionE.getScore())) {
|
||||||
|
throw new RuntimeException("请填写正确的分值");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("请选择正确的课件类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (questionE.getQuestionType().equals("1")) {
|
||||||
|
// 单选题
|
||||||
|
if (questionE.getOptionA() == null || questionE.getOptionB() == null || questionE.getOptionC() == null || questionE.getOptionD() == null) {
|
||||||
|
throw new RuntimeException("单选题选项不能为空");
|
||||||
|
}
|
||||||
|
} else if (questionE.getQuestionType().equals("2")) {
|
||||||
|
// 多选题
|
||||||
|
if (questionE.getOptionA() == null || questionE.getOptionB() == null || questionE.getOptionC() == null || questionE.getOptionD() == null) {
|
||||||
|
throw new RuntimeException("多选题选项不能为空");
|
||||||
|
}
|
||||||
|
} else if (questionE.getQuestionType().equals("3")) {
|
||||||
|
// 判断题
|
||||||
|
if (questionE.getOptionA() == null || questionE.getOptionB() == null) {
|
||||||
|
throw new RuntimeException("判断题选项不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<QuestionE> parseImportTemplateData(MultipartFile file, String videoCoursewareId, Integer maxQuestionNumber) {
|
||||||
|
List<QuestionVideoChoiceExcelImportEntity> videoChoiceList = new ArrayList<>();
|
||||||
|
List<QuestionVideoMultiselectExcelImportEntity> videoMultiselectList = new ArrayList<>();
|
||||||
|
List<QuestionVideoJudgeExcelImportEntity> videoJudgeList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
ExcelUtils.readBatchBySheetAndRow(file, QuestionVideoChoiceExcelImportEntity.class, videoChoiceList, 0, 1);
|
||||||
|
ExcelUtils.readBatchBySheetAndRow(file, QuestionVideoMultiselectExcelImportEntity.class, videoMultiselectList, 1, 1);
|
||||||
|
ExcelUtils.readBatchBySheetAndRow(file, QuestionVideoJudgeExcelImportEntity.class, videoJudgeList, 2, 1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BizException("文件解析失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 错误消息集合
|
||||||
|
List<String> errList = new ArrayList<>();
|
||||||
|
// 校验
|
||||||
|
if (CollUtil.isNotEmpty(videoChoiceList)) {
|
||||||
|
for (int i = 0; i < videoChoiceList.size(); i++) {
|
||||||
|
QuestionVideoChoiceExcelImportEntity entity = videoChoiceList.get(i);
|
||||||
|
if (entity == null) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行数据为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getQuestionDry())) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行单选题目不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionA())) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行单选选项A不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionB())) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行单选选项B不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionC())) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行单选选项C不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionD())) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行单选选项D不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getAnswer())) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行单选答案不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getDescr())) {
|
||||||
|
errList.add("单选题第" + (i + 2) + "行答案解析不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(videoMultiselectList)) {
|
||||||
|
for (int i = 0; i < videoMultiselectList.size(); i++) {
|
||||||
|
QuestionVideoMultiselectExcelImportEntity entity = videoMultiselectList.get(i);
|
||||||
|
if (entity == null) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行数据为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getQuestionDry())) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行多选题目不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionA())) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行多选选项A不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionB())) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行多选选项B不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionC())) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行多选选项C不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getOptionD())) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行多选选项D不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getAnswer())) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行多选答案不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getDescr())) {
|
||||||
|
errList.add("多选题第" + (i + 2) + "行答案解析不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(videoJudgeList)) {
|
||||||
|
for (int i = 0; i < videoJudgeList.size(); i++) {
|
||||||
|
QuestionVideoJudgeExcelImportEntity entity = videoJudgeList.get(i);
|
||||||
|
if (entity == null) {
|
||||||
|
errList.add("判断题第" + (i + 2) + "行数据为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getQuestionDry())) {
|
||||||
|
errList.add("判断题第" + (i + 2) + "行判断题目不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getAnswer())) {
|
||||||
|
errList.add("判断题第" + (i + 2) + "行判断答案不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(entity.getDescr())) {
|
||||||
|
errList.add("判断题第" + (i + 2) + "行答案解析不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(errList)) {
|
||||||
|
throw new BizException("导入信息有误,请检查后重新导入。错误信息:" + String.join("", errList));
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer questionNumber = maxQuestionNumber + 1;
|
||||||
|
// 赋值
|
||||||
|
List<QuestionE> questionEList = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(videoChoiceList)) {
|
||||||
|
for (QuestionVideoChoiceExcelImportEntity entity : videoChoiceList) {
|
||||||
|
QuestionE questionE = new QuestionE();
|
||||||
|
questionE.setQuestionId(UuidUtil.get32UUID());
|
||||||
|
questionE.setVideoCoursewareId(videoCoursewareId);
|
||||||
|
questionE.setQuestionNumber(questionNumber++);
|
||||||
|
questionE.setQuestionType(QuestionTypeEnum.CHOICE.getCode());
|
||||||
|
questionE.setQuestionDry(entity.getQuestionDry());
|
||||||
|
questionE.setOptionA(entity.getOptionA());
|
||||||
|
questionE.setOptionB(entity.getOptionB());
|
||||||
|
questionE.setOptionC(entity.getOptionC());
|
||||||
|
questionE.setOptionD(entity.getOptionD());
|
||||||
|
questionE.setAnswer(entity.getAnswer());
|
||||||
|
questionE.setDescr(entity.getDescr());
|
||||||
|
questionE.setCoursewareType(1);
|
||||||
|
questionEList.add(questionE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(videoMultiselectList)) {
|
||||||
|
for (QuestionVideoMultiselectExcelImportEntity entity : videoMultiselectList) {
|
||||||
|
QuestionE questionE = new QuestionE();
|
||||||
|
questionE.setQuestionId(UuidUtil.get32UUID());
|
||||||
|
questionE.setVideoCoursewareId(videoCoursewareId);
|
||||||
|
questionE.setQuestionNumber(questionNumber++);
|
||||||
|
questionE.setQuestionType(QuestionTypeEnum.MULTIPLE.getCode());
|
||||||
|
questionE.setQuestionDry(entity.getQuestionDry());
|
||||||
|
questionE.setOptionA(entity.getOptionA());
|
||||||
|
questionE.setOptionB(entity.getOptionB());
|
||||||
|
questionE.setOptionC(entity.getOptionC());
|
||||||
|
questionE.setOptionD(entity.getOptionD());
|
||||||
|
questionE.setAnswer(entity.getAnswer());
|
||||||
|
questionE.setDescr(entity.getDescr());
|
||||||
|
questionE.setCoursewareType(1);
|
||||||
|
questionEList.add(questionE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(videoJudgeList)) {
|
||||||
|
for (QuestionVideoJudgeExcelImportEntity entity : videoJudgeList) {
|
||||||
|
QuestionE questionE = new QuestionE();
|
||||||
|
questionE.setQuestionId(UuidUtil.get32UUID());
|
||||||
|
questionE.setVideoCoursewareId(videoCoursewareId);
|
||||||
|
questionE.setQuestionNumber(questionNumber++);
|
||||||
|
questionE.setQuestionType(QuestionTypeEnum.JUDGE.getCode());
|
||||||
|
questionE.setQuestionDry(entity.getQuestionDry());
|
||||||
|
questionE.setAnswer(entity.getAnswer());
|
||||||
|
questionE.setDescr(entity.getDescr());
|
||||||
|
questionE.setCoursewareType(1);
|
||||||
|
questionEList.add(questionE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return questionEList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.zcloud.edu.domain.model;
|
package com.zcloud.edu.domain.model;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.jjb.saas.framework.domain.model.BaseE;
|
import com.jjb.saas.framework.domain.model.BaseE;
|
||||||
import com.zcloud.gbscommon.utils.UuidUtil;
|
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -76,5 +77,14 @@ public class TeacherE extends BaseE {
|
||||||
return teacherList;
|
return teacherList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教师是否被使用
|
||||||
|
*/
|
||||||
|
public void checkList(int size){
|
||||||
|
if(size > 0){
|
||||||
|
throw new BizException("该教师有负责的课件,无法删除。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
package com.zcloud.edu.gatewayimpl;
|
package com.zcloud.edu.gatewayimpl;
|
||||||
|
|
||||||
|
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||||
import com.zcloud.edu.domain.gateway.QuestionGateway;
|
import com.zcloud.edu.domain.gateway.QuestionGateway;
|
||||||
import com.zcloud.edu.domain.model.QuestionE;
|
import com.zcloud.edu.domain.model.QuestionE;
|
||||||
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
||||||
import com.zcloud.edu.persistence.repository.QuestionRepository;
|
import com.zcloud.edu.persistence.repository.QuestionRepository;
|
||||||
|
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -21,10 +24,24 @@ import java.util.Collections;
|
||||||
public class QuestionGatewayImpl implements QuestionGateway {
|
public class QuestionGatewayImpl implements QuestionGateway {
|
||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean add(QuestionE questionE) {
|
public Boolean add(QuestionE questionE) {
|
||||||
QuestionDO d = new QuestionDO();
|
QuestionDO d = new QuestionDO();
|
||||||
BeanUtils.copyProperties(questionE, d);
|
BeanUtils.copyProperties(questionE, d);
|
||||||
|
|
||||||
|
if(StringUtils.isEmpty(d.getQuestionId())){
|
||||||
|
d.setQuestionId(UuidUtil.get32UUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 题号
|
||||||
|
Integer maxQuestionNumber = 0;
|
||||||
|
if(d.getCoursewareType() == 1){
|
||||||
|
maxQuestionNumber = questionRepository.getMaxQuestionNumber(d.getVideoCoursewareId());
|
||||||
|
}else if(d.getCoursewareType() == 2){
|
||||||
|
// TODO 试卷类型
|
||||||
|
}
|
||||||
|
d.setQuestionNumber(maxQuestionNumber + 1);
|
||||||
questionRepository.save(d);
|
questionRepository.save(d);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +61,7 @@ public class QuestionGatewayImpl implements QuestionGateway {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean deletedQuestionByIds(Long[] ids) {
|
public Boolean deletedQuestionByIds(Long[] ids) {
|
||||||
return questionRepository.removeByIds(Collections.singletonList(ids));
|
return questionRepository.removeByIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,19 @@
|
||||||
package com.zcloud.edu.gatewayimpl;
|
package com.zcloud.edu.gatewayimpl;
|
||||||
|
|
||||||
|
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||||
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.edu.domain.gateway.VideoCoursewareGateway;
|
import com.zcloud.edu.domain.gateway.VideoCoursewareGateway;
|
||||||
import com.zcloud.edu.domain.model.VideoCoursewareE;
|
import com.zcloud.edu.domain.model.VideoCoursewareE;
|
||||||
import com.zcloud.edu.persistence.dataobject.VideoCoursewareDO;
|
import com.zcloud.edu.persistence.dataobject.VideoCoursewareDO;
|
||||||
import com.zcloud.edu.persistence.repository.VideoCoursewareRepository;
|
import com.zcloud.edu.persistence.repository.VideoCoursewareRepository;
|
||||||
|
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,6 +31,36 @@ public class VideoCoursewareGatewayImpl implements VideoCoursewareGateway {
|
||||||
public Boolean add(VideoCoursewareE videoCoursewareE) {
|
public Boolean add(VideoCoursewareE videoCoursewareE) {
|
||||||
VideoCoursewareDO d = new VideoCoursewareDO();
|
VideoCoursewareDO d = new VideoCoursewareDO();
|
||||||
BeanUtils.copyProperties(videoCoursewareE, d);
|
BeanUtils.copyProperties(videoCoursewareE, d);
|
||||||
|
|
||||||
|
if(StringUtils.isEmpty(d.getVideoCoursewareId())){
|
||||||
|
d.setVideoCoursewareId(UuidUtil.get32UUID());
|
||||||
|
}
|
||||||
|
if(d.getCorpinfoId() == null){
|
||||||
|
d.setCorpinfoId(AuthContext.getTenantId());
|
||||||
|
}
|
||||||
|
d.setState(1);
|
||||||
|
// 计算课时
|
||||||
|
if(StringUtils.isNotEmpty(d.getVideoTime())){
|
||||||
|
String videoTime = d.getVideoTime();
|
||||||
|
try {
|
||||||
|
// 将字符串转换为数字(分钟)
|
||||||
|
double minutes = Double.parseDouble(videoTime);
|
||||||
|
|
||||||
|
// 除以45,每45分钟为一课时
|
||||||
|
double classHours = minutes / 45.0;
|
||||||
|
|
||||||
|
// 四舍五入保留两位小数
|
||||||
|
BigDecimal result = new BigDecimal(classHours)
|
||||||
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
// 使用结果
|
||||||
|
d.setClassHour(result.toString());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 处理数字格式错误
|
||||||
|
throw new BizException("视频时间格式错误: " + videoTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
videoCoursewareRepository.save(d);
|
videoCoursewareRepository.save(d);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,8 @@ public class QuestionDO extends BaseDO {
|
||||||
@ApiModelProperty(value = "题号")
|
@ApiModelProperty(value = "题号")
|
||||||
private Integer questionNumber;
|
private Integer questionNumber;
|
||||||
//试题类型(单选题、多选题、判断题、填空题)
|
//试题类型(单选题、多选题、判断题、填空题)
|
||||||
@ApiModelProperty(value = "试题类型(单选题、多选题、判断题、填空题)")
|
@ApiModelProperty(value = "试题类型(1单选题、2多选题、3判断题)")
|
||||||
private String questionType;
|
private String questionType;
|
||||||
//试题类型名称
|
|
||||||
@ApiModelProperty(value = "试题类型名称")
|
|
||||||
private String questionTypeName;
|
|
||||||
//题干
|
//题干
|
||||||
@ApiModelProperty(value = "题干")
|
@ApiModelProperty(value = "题干")
|
||||||
private String questionDry;
|
private String questionDry;
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,19 @@ public class VideoCoursewareDO extends BaseDO {
|
||||||
//企业ID
|
//企业ID
|
||||||
@ApiModelProperty(value = "企业ID")
|
@ApiModelProperty(value = "企业ID")
|
||||||
private Long corpinfoId;
|
private Long corpinfoId;
|
||||||
|
private String corpName;
|
||||||
//课件名称
|
//课件名称
|
||||||
@ApiModelProperty(value = "课件名称")
|
@ApiModelProperty(value = "课件名称")
|
||||||
private String coursewareName;
|
private String coursewareName;
|
||||||
//培训类型id
|
//培训类型id
|
||||||
@ApiModelProperty(value = "培训类型id")
|
@ApiModelProperty(value = "培训类型id")
|
||||||
private String trainingTypeId;
|
private String trainingTypeId;
|
||||||
|
//培训类型名称
|
||||||
|
private String trainingTypeName;
|
||||||
//教师id
|
//教师id
|
||||||
@ApiModelProperty(value = "教师id")
|
@ApiModelProperty(value = "教师id")
|
||||||
private String teacherId;
|
private String teacherId;
|
||||||
|
private String teacherName;
|
||||||
//课件文件路径
|
//课件文件路径
|
||||||
@ApiModelProperty(value = "课件文件路径")
|
@ApiModelProperty(value = "课件文件路径")
|
||||||
private String videoFiles;
|
private String videoFiles;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
package com.zcloud.edu.persistence.mapper;
|
package com.zcloud.edu.persistence.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.zcloud.edu.persistence.dataobject.VideoCoursewareDO;
|
import com.zcloud.edu.persistence.dataobject.VideoCoursewareDO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-infrastructure
|
* web-infrastructure
|
||||||
|
|
@ -13,5 +18,12 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface VideoCoursewareMapper extends BaseMapper<VideoCoursewareDO> {
|
public interface VideoCoursewareMapper extends BaseMapper<VideoCoursewareDO> {
|
||||||
|
|
||||||
|
VideoCoursewareDO getInfoById(@Param("id") Long id);
|
||||||
|
|
||||||
|
IPage<VideoCoursewareDO> getVideoCoursewarePage(IPage<VideoCoursewareDO> page, @Param("ew") QueryWrapper<VideoCoursewareDO> queryWrapper);
|
||||||
|
|
||||||
|
List<VideoCoursewareDO> getVideoCoursewareList(@Param("ew") QueryWrapper<VideoCoursewareDO> queryWrapper);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ public interface QuestionRepository extends BaseRepository<QuestionDO> {
|
||||||
|
|
||||||
List<QuestionDO> list(Map<String, Object> params);
|
List<QuestionDO> list(Map<String, Object> params);
|
||||||
|
|
||||||
|
Integer getMaxQuestionNumber(String videoCoursewareId);
|
||||||
|
|
||||||
SingleResponse<QuestionDO> getInfoById(Long id);
|
SingleResponse<QuestionDO> getInfoById(Long id);
|
||||||
|
|
||||||
|
boolean saveBatch(List<QuestionDO> list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ public interface VideoCoursewareRepository extends BaseRepository<VideoCoursewar
|
||||||
|
|
||||||
List<VideoCoursewareDO> list(Map<String, Object> params);
|
List<VideoCoursewareDO> list(Map<String, Object> params);
|
||||||
|
|
||||||
|
List<VideoCoursewareDO> listByTeacherId(String teacherId);
|
||||||
|
|
||||||
|
List<VideoCoursewareDO> listByTeacherIds(List<String> teacherIds);
|
||||||
|
|
||||||
SingleResponse<VideoCoursewareDO> getInfoById(Long id);
|
SingleResponse<VideoCoursewareDO> getInfoById(Long id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class QuestionRepositoryImpl extends BaseRepositoryImpl<QuestionMapper, Q
|
||||||
IPage<QuestionDO> iPage = new Query<QuestionDO>().getPage(params);
|
IPage<QuestionDO> iPage = new Query<QuestionDO>().getPage(params);
|
||||||
QueryWrapper<QuestionDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<QuestionDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||||
queryWrapper.orderByDesc("create_time");
|
queryWrapper.orderByAsc("question_number");
|
||||||
IPage<QuestionDO> result = questionMapper.selectPage(iPage, queryWrapper);
|
IPage<QuestionDO> result = questionMapper.selectPage(iPage, queryWrapper);
|
||||||
return PageHelper.pageToResponse(result, result.getRecords());
|
return PageHelper.pageToResponse(result, result.getRecords());
|
||||||
}
|
}
|
||||||
|
|
@ -47,9 +47,22 @@ public class QuestionRepositoryImpl extends BaseRepositoryImpl<QuestionMapper, Q
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getMaxQuestionNumber(String videoCoursewareId) {
|
||||||
|
QueryWrapper<QuestionDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("video_courseware_id", videoCoursewareId);
|
||||||
|
return list(queryWrapper).stream().mapToInt(QuestionDO::getQuestionNumber).max().orElse(0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<QuestionDO> getInfoById(Long id) {
|
public SingleResponse<QuestionDO> getInfoById(Long id) {
|
||||||
return SingleResponse.of(questionMapper.selectById(id));
|
return SingleResponse.of(questionMapper.selectById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveBatch(List<QuestionDO> list) {
|
||||||
|
saveBatch(list);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.zcloud.edu.persistence.repository.impl;
|
package com.zcloud.edu.persistence.repository.impl;
|
||||||
|
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||||
import com.zcloud.edu.persistence.dataobject.TeacherDO;
|
import com.zcloud.edu.persistence.dataobject.TeacherDO;
|
||||||
import com.zcloud.edu.persistence.mapper.TeacherMapper;
|
import com.zcloud.edu.persistence.mapper.TeacherMapper;
|
||||||
|
|
@ -32,6 +33,12 @@ public class TeacherRepositoryImpl extends BaseRepositoryImpl<TeacherMapper, Tea
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResponse<TeacherDO> listPage(Map<String, Object> params) {
|
public PageResponse<TeacherDO> listPage(Map<String, Object> params) {
|
||||||
|
if(params.get("corpFlag") != null){
|
||||||
|
Integer corpFlag = (Integer)params.get("corpFlag");
|
||||||
|
if(corpFlag == 2){
|
||||||
|
params.put("eqCorpinfoId", AuthContext.getTenantId());
|
||||||
|
}
|
||||||
|
}
|
||||||
IPage<TeacherDO> iPage = new Query<TeacherDO>().getPage(params);
|
IPage<TeacherDO> iPage = new Query<TeacherDO>().getPage(params);
|
||||||
QueryWrapper<TeacherDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<TeacherDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params, "a.");
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params, "a.");
|
||||||
|
|
@ -53,6 +60,12 @@ public class TeacherRepositoryImpl extends BaseRepositoryImpl<TeacherMapper, Tea
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TeacherDO> list(Map<String, Object> params) {
|
public List<TeacherDO> list(Map<String, Object> params) {
|
||||||
|
if(params.get("corpFlag") != null){
|
||||||
|
Integer corpFlag = (Integer)params.get("corpFlag");
|
||||||
|
if(corpFlag == 2){
|
||||||
|
params.put("eqCorpinfoId", AuthContext.getTenantId());
|
||||||
|
}
|
||||||
|
}
|
||||||
QueryWrapper<TeacherDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<TeacherDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params, "a.");
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params, "a.");
|
||||||
queryWrapper.eq("a.delete_enum", "FALSE");
|
queryWrapper.eq("a.delete_enum", "FALSE");
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -32,24 +33,40 @@ public class VideoCoursewareRepositoryImpl extends BaseRepositoryImpl<VideoCours
|
||||||
public PageResponse<VideoCoursewareDO> listPage(Map<String, Object> params) {
|
public PageResponse<VideoCoursewareDO> listPage(Map<String, Object> params) {
|
||||||
IPage<VideoCoursewareDO> iPage = new Query<VideoCoursewareDO>().getPage(params);
|
IPage<VideoCoursewareDO> iPage = new Query<VideoCoursewareDO>().getPage(params);
|
||||||
QueryWrapper<VideoCoursewareDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<VideoCoursewareDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params, "a.");
|
||||||
queryWrapper.orderByDesc("create_time");
|
queryWrapper.eq("a.delete_enum", "FALSE");
|
||||||
IPage<VideoCoursewareDO> result = videoCoursewareMapper.selectPage(iPage, queryWrapper);
|
queryWrapper.orderByDesc("a.create_time");
|
||||||
|
IPage<VideoCoursewareDO> result = videoCoursewareMapper.getVideoCoursewarePage(iPage, queryWrapper);
|
||||||
return PageHelper.pageToResponse(result, result.getRecords());
|
return PageHelper.pageToResponse(result, result.getRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VideoCoursewareDO> list(Map<String, Object> params) {
|
public List<VideoCoursewareDO> list(Map<String, Object> params) {
|
||||||
QueryWrapper<VideoCoursewareDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<VideoCoursewareDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params, "a.");
|
||||||
queryWrapper.orderByDesc("create_time");
|
queryWrapper.eq("a.delete_enum", "FALSE");
|
||||||
List<VideoCoursewareDO> result = videoCoursewareMapper.selectList(queryWrapper);
|
queryWrapper.orderByDesc("a.create_time");
|
||||||
|
List<VideoCoursewareDO> result = videoCoursewareMapper.getVideoCoursewareList(queryWrapper);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VideoCoursewareDO> listByTeacherId(String teacherId) {
|
||||||
|
QueryWrapper<VideoCoursewareDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("teacher_id", teacherId);
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VideoCoursewareDO> listByTeacherIds(List<String> teacherIds) {
|
||||||
|
QueryWrapper<VideoCoursewareDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.in("teacher_id", teacherIds);
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<VideoCoursewareDO> getInfoById(Long id) {
|
public SingleResponse<VideoCoursewareDO> getInfoById(Long id) {
|
||||||
return SingleResponse.of(videoCoursewareMapper.selectById(id));
|
return SingleResponse.of(videoCoursewareMapper.getInfoById(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,51 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="com.zcloud.edu.persistence.mapper.VideoCoursewareMapper">
|
<mapper namespace="com.zcloud.edu.persistence.mapper.VideoCoursewareMapper">
|
||||||
|
|
||||||
|
<select id="getInfoById" resultType="com.zcloud.edu.persistence.dataobject.VideoCoursewareDO">
|
||||||
|
select
|
||||||
|
a.id,a.video_courseware_id,a.corpinfo_id,a.courseware_name,a.training_type_id,a.teacher_id,a.video_files,a.courseware_introduce,
|
||||||
|
a.`state`,a.class_hour,a.video_time,a.delete_enum,a.remarks,a.create_name,a.update_name,a.tenant_id,a.org_id,a.version,
|
||||||
|
a.create_time,a.update_time,a.create_id,a.update_id,a.env,
|
||||||
|
b.training_type_name as trainingTypeName,
|
||||||
|
c.teacher_name as teacherName,
|
||||||
|
d.corp_name as corpName
|
||||||
|
from video_courseware a
|
||||||
|
left join training_type b on a.training_type_id = b.training_type_id and b.delete_enum = 'FALSE'
|
||||||
|
left join teacher c on a.teacher_id = c.teacher_id and c.delete_enum = 'FALSE'
|
||||||
|
left join corp_info d on a.corpinfo_id = d.id
|
||||||
|
where a.id = #{id,jdbcType=BIGINT}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getVideoCoursewarePage" resultType="com.zcloud.edu.persistence.dataobject.VideoCoursewareDO">
|
||||||
|
select
|
||||||
|
a.id,a.video_courseware_id,a.corpinfo_id,a.courseware_name,a.training_type_id,a.teacher_id,a.video_files,a.courseware_introduce,
|
||||||
|
a.`state`,a.class_hour,a.video_time,a.delete_enum,a.remarks,a.create_name,a.update_name,a.tenant_id,a.org_id,a.version,
|
||||||
|
a.create_time,a.update_time,a.create_id,a.update_id,a.env,
|
||||||
|
b.training_type_name as trainingTypeName,
|
||||||
|
c.teacher_name as teacherName,
|
||||||
|
d.corp_name as corpName
|
||||||
|
from video_courseware a
|
||||||
|
left join training_type b on a.training_type_id = b.training_type_id and b.delete_enum = 'FALSE'
|
||||||
|
left join teacher c on a.teacher_id = c.teacher_id and c.delete_enum = 'FALSE'
|
||||||
|
left join corp_info d on a.corpinfo_id = d.id
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getVideoCoursewareList" resultType="com.zcloud.edu.persistence.dataobject.VideoCoursewareDO">
|
||||||
|
select
|
||||||
|
a.id,a.video_courseware_id,a.corpinfo_id,a.courseware_name,a.training_type_id,a.teacher_id,a.video_files,a.courseware_introduce,
|
||||||
|
a.`state`,a.class_hour,a.video_time,a.delete_enum,a.remarks,a.create_name,a.update_name,a.tenant_id,a.org_id,a.version,
|
||||||
|
a.create_time,a.update_time,a.create_id,a.update_id,a.env,
|
||||||
|
b.training_type_name as trainingTypeName,
|
||||||
|
c.teacher_name as teacherName,
|
||||||
|
d.corp_name as corpName
|
||||||
|
from video_courseware a
|
||||||
|
left join training_type b on a.training_type_id = b.training_type_id and b.delete_enum = 'FALSE'
|
||||||
|
left join teacher c on a.teacher_id = c.teacher_id and c.delete_enum = 'FALSE'
|
||||||
|
left join corp_info d on a.corpinfo_id = d.id
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue