培训资源管理
parent
ada5223c61
commit
5d03409fb6
|
|
@ -32,7 +32,7 @@ public class ExamPaperController {
|
|||
|
||||
@ApiOperation("新增试卷")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<ExamPaperCO> add(@Validated @RequestParam ExamPaperAddCmd cmd) {
|
||||
public SingleResponse<ExamPaperCO> add(@Validated ExamPaperAddCmd cmd) {
|
||||
return examPaperService.add(cmd);
|
||||
}
|
||||
|
||||
|
|
@ -42,12 +42,6 @@ public class ExamPaperController {
|
|||
return examPaperService.listPage(qry);
|
||||
}
|
||||
|
||||
/* @ApiOperation("所有数据")
|
||||
@GetMapping("/listAll")
|
||||
public MultiResponse<ExamPaperCO> listAll() {
|
||||
return MultiResponse.of(new ArrayList<ExamPaperCO>());
|
||||
}*/
|
||||
|
||||
@ApiOperation("试卷详情")
|
||||
@PostMapping("/getInfoById")
|
||||
public SingleResponse<ExamPaperCO> getInfoById(@RequestParam("id") Long id) {
|
||||
|
|
@ -63,8 +57,8 @@ public class ExamPaperController {
|
|||
|
||||
@ApiOperation("修改")
|
||||
@PostMapping("/edit")
|
||||
public SingleResponse edit(@Validated @RequestPart(value = "file") MultipartFile file, @RequestParam(value = "examPaperUpdateCmd") ExamPaperUpdateCmd examPaperUpdateCmd) {
|
||||
examPaperService.edit(file,examPaperUpdateCmd);
|
||||
public SingleResponse edit( @RequestBody ExamPaperUpdateCmd examPaperUpdateCmd) {
|
||||
examPaperService.edit(examPaperUpdateCmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
* @Author SondonYong
|
||||
* @Date 2025-11-27 14:06:10
|
||||
*/
|
||||
@Api(tags = "课件习题信息")
|
||||
@Api(tags = "习题信息")
|
||||
@RequestMapping("/${application.gateway}/question")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
@ -35,7 +35,7 @@ public class QuestionController {
|
|||
|
||||
@ApiOperation("新增习题")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<QuestionCO> add(@Validated @RequestBody QuestionAddCmd cmd) {
|
||||
public SingleResponse<ExamPaperCO> add(@Validated @RequestBody QuestionAddCmd cmd) {
|
||||
return questionService.add(cmd);
|
||||
}
|
||||
|
||||
|
|
@ -72,9 +72,9 @@ public class QuestionController {
|
|||
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/remove")
|
||||
public Response remove(@RequestParam(value = "id") Long id) {
|
||||
questionService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
public SingleResponse<ExamPaperCO> remove(@RequestParam(value = "id") Long id) {
|
||||
ExamPaperCO examPaperCO =questionService.remove(id);
|
||||
return SingleResponse.of(examPaperCO);
|
||||
}
|
||||
|
||||
@ApiOperation("删除多个")
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class ExamPaperQueryExe {
|
|||
PageResponse<ExamPaperDO> pageResponse = examPaperRepository.listPage(params);
|
||||
List<ExamPaperCO> examCenterCOS = examPaperCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
examCenterCOS.forEach(examCenterCO -> {
|
||||
if(examCenterCO.getCreateId().equals(AuthContext.getUserId())){
|
||||
if(AuthContext.getUserId().equals(examCenterCO.getCreateId())){
|
||||
//是本人
|
||||
examCenterCO.setIsUserCreate(true);
|
||||
}
|
||||
|
|
@ -78,10 +78,10 @@ public class ExamPaperQueryExe {
|
|||
}
|
||||
ExamPaperCO examPaperCO =new ExamPaperCO();
|
||||
BeanUtil.copyProperties(examPaperDO,examPaperCO);
|
||||
//查找课题
|
||||
/* //查找课题
|
||||
List<QuestionDO> questionDOList = questionRepository.getListByExamPaperId(examPaperDO.getExamPaperId());
|
||||
List<QuestionCO> questionCOS = questionCoConvertor.converDOsToCOs(questionDOList);
|
||||
examPaperCO.setQuestionCOList(questionCOS);
|
||||
examPaperCO.setQuestionCOList(questionCOS);*/
|
||||
return examPaperCO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.zcloud.edu.domain.gateway.resource.CurriculumGateway;
|
|||
import com.zcloud.edu.persistence.dataobject.CurriculumDO;
|
||||
import com.zcloud.edu.persistence.repository.resource.CorpInfoRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.CurriculumRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -22,6 +23,7 @@ public class CurriculumRemoveExe {
|
|||
private final CurriculumGateway curriculumGateway;
|
||||
private final CorpInfoRepository corpInfoRepository;
|
||||
private final CurriculumRepository curriculumRepository;
|
||||
private final ClassCurriculumRepository classCurriculumRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
|
|
@ -35,8 +37,11 @@ public class CurriculumRemoveExe {
|
|||
if(!corpInfoRepository.isSupper() && b){
|
||||
throw new BizException("股份端数据不能删除");
|
||||
}
|
||||
//TODO 校验是否被使用
|
||||
|
||||
// 校验是否被使用
|
||||
Long count= classCurriculumRepository.getCountByCurriculumId(curriculumDO.getCurriculumId());
|
||||
if(count>0){
|
||||
throw new BizException("该课程已绑定班级,不能删除");
|
||||
}
|
||||
boolean res = curriculumGateway.deletedCurriculumById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
|
|
@ -57,8 +62,11 @@ public class CurriculumRemoveExe {
|
|||
if(!corpInfoRepository.isSupper() && b){
|
||||
throw new BizException("股份端数据不能删除");
|
||||
}
|
||||
//TODO 校验是否被使用
|
||||
|
||||
// 校验是否被使用
|
||||
Long count= classCurriculumRepository.getCountByCurriculumId(curriculumDO.getCurriculumId());
|
||||
if(count>0){
|
||||
throw new BizException("该课程已绑定班级,不能删除");
|
||||
}
|
||||
}
|
||||
|
||||
boolean res = curriculumGateway.deletedCurriculumByIds(ids);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.zcloud.edu.persistence.dataobject.CurriculumDO;
|
|||
import com.zcloud.edu.persistence.repository.resource.CorpInfoRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.CurriculumChapterRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.CurriculumRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassCurriculumRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -38,6 +39,7 @@ public class CurriculumUpdateExe {
|
|||
private final CurriculumChapterCoConvertor curriculumChapterCoConvertor;
|
||||
private final CurriculumChapterGateway curriculumChapterGateway;
|
||||
private final CorpInfoRepository corpInfoRepository;
|
||||
private final ClassCurriculumRepository classCurriculumRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(CurriculumUpdateCmd curriculumUpdateCmd) {
|
||||
|
|
@ -55,7 +57,11 @@ public class CurriculumUpdateExe {
|
|||
if(!corpInfoRepository.isSupper() && b){
|
||||
throw new BizException("股份端数据不能编辑");
|
||||
}
|
||||
//TODo 校验是否 被使用
|
||||
// 校验是否 被使用
|
||||
Long count= classCurriculumRepository.getCountByCurriculumId(curriculumDO.getCurriculumId());
|
||||
if(count>0){
|
||||
throw new BizException("该课程已绑定班级,不能编辑");
|
||||
}
|
||||
|
||||
CurriculumE curriculumE = new CurriculumE();
|
||||
BeanUtils.copyProperties(curriculumUpdateCmd, curriculumE);
|
||||
|
|
@ -96,9 +102,13 @@ public class CurriculumUpdateExe {
|
|||
if(!corpInfoRepository.isSupper() && b){
|
||||
throw new BizException("股份端数据不能修改状态");
|
||||
}
|
||||
//TODO 校验是否被使用,如果是下架判断是否被使用
|
||||
// 校验是否被使用,如果是下架判断是否被使用
|
||||
if(CurriculumSellFlagEnum.UNENABLED.getCode().equals(cmd.getSellFlag())){
|
||||
|
||||
// 校验是否 被使用
|
||||
Long count= classCurriculumRepository.getCountByCurriculumId(curriculumDO.getCurriculumId());
|
||||
if(count>0){
|
||||
throw new BizException("该课程已绑定班级,不能编辑");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.zcloud.edu.persistence.dataobject.ExamPaperDO;
|
|||
import com.zcloud.edu.persistence.repository.resource.CorpInfoRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.ExamPaperRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -29,6 +30,7 @@ public class ExamPaperRemoveExe {
|
|||
private final ExamPaperRepository examPaperRepository;
|
||||
private final QuestionRepository questionRepository;
|
||||
private final CorpInfoRepository corpInfoRepository;
|
||||
private final ClassExamPaperRepository classExamPaperRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
|
|
@ -46,8 +48,11 @@ public class ExamPaperRemoveExe {
|
|||
throw new BizException("股份端数据不能修改状态");
|
||||
}
|
||||
|
||||
//TODO 是否被使用
|
||||
|
||||
// 是否被使用
|
||||
Long count= classExamPaperRepository.getCountByExamPaperId(examPaperDO.getExamPaperId());
|
||||
if(count>0){
|
||||
throw new BizException("该试卷已绑定班级,不能删除");
|
||||
}
|
||||
|
||||
boolean res = examPaperGateway.deletedExamPaperById(id);
|
||||
if (!res) {
|
||||
|
|
@ -77,7 +82,12 @@ public class ExamPaperRemoveExe {
|
|||
throw new BizException("股份端数据不能修改状态");
|
||||
}
|
||||
|
||||
//TODO 判断是否被使用
|
||||
// 判断是否被使用
|
||||
// 是否被使用
|
||||
Long count= classExamPaperRepository.getCountByExamPaperId(examPaperDO.getExamPaperId());
|
||||
if(count>0){
|
||||
throw new BizException("该试卷已绑定班级,不能删除");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
|||
import com.zcloud.edu.persistence.repository.resource.CorpInfoRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.ExamPaperRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
||||
import com.zcloud.edu.persistence.repository.study.ClassExamPaperRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -34,10 +35,10 @@ public class ExamPaperUpdateExe {
|
|||
private final ExamPaperGateway examPaperGateway;
|
||||
private final ExamPaperRepository examPaperRepository;
|
||||
private final CorpInfoRepository corpInfoRepository;
|
||||
private final QuestionRepository questionRepository;
|
||||
private final ClassExamPaperRepository classExamPaperRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(MultipartFile file, ExamPaperUpdateCmd examPaperUpdateCmd) {
|
||||
public void execute( ExamPaperUpdateCmd examPaperUpdateCmd) {
|
||||
ExamPaperDO examPaperDO = examPaperRepository.getById(examPaperUpdateCmd.getId());
|
||||
if( examPaperDO == null){
|
||||
throw new BizException("试卷不存在");
|
||||
|
|
@ -48,32 +49,7 @@ public class ExamPaperUpdateExe {
|
|||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
if (!file.isEmpty()) {
|
||||
//删除之前的试题
|
||||
questionRepository.removeByExampaperId( examPaperDO.getExamPaperId());
|
||||
|
||||
QuestionE questionE = new QuestionE();
|
||||
List<QuestionE> questionES = questionE.parseImportTemplateData(file, null, examPaperE.getExamPaperId(), CoursewareTypeEnum.EXAM_QUESTION.getCode());
|
||||
|
||||
BigDecimal examScore = questionES.stream().map(QuestionE::getScore).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//判断总分数量是否一致
|
||||
if (examScore.compareTo(examPaperE.getExamScore()) != 0) {
|
||||
throw new BizException("总分数和试题分数不一致");
|
||||
}
|
||||
|
||||
// 批量插入
|
||||
boolean questionRes = false;
|
||||
try {
|
||||
questionRes = questionRepository.saveBatch(BeanUtil.copyToList(questionES, QuestionDO.class));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!questionRes) {
|
||||
throw new BizException("试题导入失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void editSellFlag(ExamPaperUpdateCmd examPaperUpdateCmd) {
|
||||
|
|
@ -87,8 +63,11 @@ public class ExamPaperUpdateExe {
|
|||
if (!corpInfoRepository.isSupper() && b) {
|
||||
throw new BizException("股份端数据不能修改状态");
|
||||
}
|
||||
//TODO 是否被使用
|
||||
|
||||
// 是否被使用
|
||||
Long count= classExamPaperRepository.getCountByExamPaperId(examPaperDO.getExamPaperId());
|
||||
if(count>0){
|
||||
throw new BizException("该试卷已绑定班级,不能修改状态");
|
||||
}
|
||||
|
||||
ExamPaperE examPaperE = new ExamPaperE();
|
||||
BeanUtils.copyProperties(examPaperUpdateCmd, examPaperE);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import com.zcloud.edu.domain.enums.CoursewareTypeEnum;
|
||||
import com.zcloud.edu.domain.gateway.resource.QuestionGateway;
|
||||
import com.zcloud.edu.domain.model.resource.QuestionE;
|
||||
import com.zcloud.edu.dto.clientobject.resource.ExamPaperCO;
|
||||
import com.zcloud.edu.dto.resource.QuestionAddCmd;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.edu.persistence.dataobject.ExamPaperDO;
|
||||
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
||||
import com.zcloud.edu.persistence.repository.resource.ExamPaperRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -14,6 +17,7 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
|
@ -28,9 +32,10 @@ import java.util.List;
|
|||
public class QuestionAddExe {
|
||||
private final QuestionGateway questionGateway;
|
||||
private final QuestionRepository questionRepository;
|
||||
private final ExamPaperRepository examPaperRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(QuestionAddCmd cmd) {
|
||||
public ExamPaperCO execute(QuestionAddCmd cmd) {
|
||||
QuestionE questionE = new QuestionE();
|
||||
BeanUtils.copyProperties(cmd, questionE);
|
||||
questionE.checkQuestion(questionE);
|
||||
|
|
@ -44,7 +49,25 @@ public class QuestionAddExe {
|
|||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
|
||||
//如果是试卷习题,需要修改试卷对应的总分
|
||||
if(CoursewareTypeEnum.EXAM_QUESTION.getCode().equals(cmd.getCoursewareType())){
|
||||
//修改试卷对应总分
|
||||
|
||||
String examPaperId = cmd.getExamPaperId();
|
||||
ExamPaperDO examPaperDO = examPaperRepository.getInfoByUUid(examPaperId);
|
||||
if(examPaperDO == null){
|
||||
return null;
|
||||
}
|
||||
ExamPaperCO examPaperCO = new ExamPaperCO();
|
||||
examPaperRepository.updateExamScore(examPaperDO.getId(),cmd.getScore());
|
||||
ExamPaperDO examPaperDONew = examPaperRepository.getInfoByUUid(examPaperId);
|
||||
BeanUtils.copyProperties(examPaperDONew, examPaperCO);
|
||||
|
||||
return examPaperCO;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
package com.zcloud.edu.command.resource;
|
||||
|
||||
import com.zcloud.edu.domain.enums.CoursewareTypeEnum;
|
||||
import com.zcloud.edu.domain.gateway.resource.QuestionGateway;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.edu.dto.clientobject.resource.ExamPaperCO;
|
||||
import com.zcloud.edu.persistence.dataobject.ExamPaperDO;
|
||||
import com.zcloud.edu.persistence.dataobject.QuestionDO;
|
||||
import com.zcloud.edu.persistence.repository.resource.ExamPaperRepository;
|
||||
import com.zcloud.edu.persistence.repository.resource.QuestionRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -17,14 +24,36 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class QuestionRemoveExe {
|
||||
private final QuestionGateway questionGateway;
|
||||
private final QuestionRepository questionRepository;
|
||||
private final ExamPaperRepository examPaperRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
public ExamPaperCO execute(Long id) {
|
||||
QuestionDO questionDO = questionRepository.getById(id);
|
||||
if(questionDO == null){
|
||||
throw new BizException("试题不存在");
|
||||
}
|
||||
boolean res = questionGateway.deletedQuestionById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
//如果是试卷习题,需要修改试卷对应的总分
|
||||
if(CoursewareTypeEnum.EXAM_QUESTION.getCode().equals(questionDO.getCoursewareType())){
|
||||
//修改试卷对应总分
|
||||
|
||||
String examPaperId = questionDO.getExamPaperId();
|
||||
ExamPaperDO examPaperDO = examPaperRepository.getInfoByUUid(examPaperId);
|
||||
if(examPaperDO == null){
|
||||
return null;
|
||||
}
|
||||
ExamPaperCO examPaperCO = new ExamPaperCO();
|
||||
examPaperRepository.updateExamScore(examPaperDO.getId(), questionDO.getScore().negate());
|
||||
ExamPaperDO examPaperDONew = examPaperRepository.getInfoByUUid(examPaperId);
|
||||
BeanUtils.copyProperties(examPaperDONew, examPaperCO);
|
||||
return examPaperCO;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
|
|||
|
|
@ -69,10 +69,9 @@ public class QuestionUpdateExe {
|
|||
if(examPaperDO == null){
|
||||
throw new BizException("试卷不存在");
|
||||
}
|
||||
BigDecimal add = examPaperDO.getExamScore().add(bigDecimal);
|
||||
examPaperDO.setExamScore(add);
|
||||
examPaperRepository.updateById(examPaperDO);
|
||||
BeanUtils.copyProperties(examPaperDO, examPaperCO);
|
||||
examPaperRepository.updateExamScore(examPaperDO.getId(),bigDecimal);
|
||||
ExamPaperDO examPaperDONew = examPaperRepository.getInfoByUUid(examPaperId);
|
||||
BeanUtils.copyProperties(examPaperDONew, examPaperCO);
|
||||
}
|
||||
return examPaperCO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,19 +35,18 @@ public class TeacherRemoveExe {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
SingleResponse<TeacherDO> teacherDO = teacherRepository.getInfoById(id);
|
||||
|
||||
if(teacherDO.getData() == null || teacherDO.getData() == null){
|
||||
TeacherDO teacherDO = teacherRepository.getById(id);
|
||||
if(teacherDO== null){
|
||||
throw new BizException("数据不存在");
|
||||
}
|
||||
|
||||
TeacherE teacherE = new TeacherE();
|
||||
List<VideoCoursewareDO> videoCoursewareDOS = videoCoursewareRepository.listByTeacherId(teacherDO.getData().getTeacherId());
|
||||
List<VideoCoursewareDO> videoCoursewareDOS = videoCoursewareRepository.listByTeacherId(teacherDO.getTeacherId());
|
||||
teacherE.checkList(videoCoursewareDOS == null ? 0 : videoCoursewareDOS.size());
|
||||
|
||||
boolean res = teacherGateway.deletedTeacherById(id);
|
||||
if(res){
|
||||
String teacherId = teacherDO.getData().getTeacherId();
|
||||
String teacherId = teacherDO.getTeacherId();
|
||||
teacherCertificateRepository.removeByTeacherId(teacherId);
|
||||
}
|
||||
if (!res) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class TrainingTypeRemoveExe {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
// todo 校验是否有其他业务调用
|
||||
// 校验是否有其他业务调用
|
||||
TrainingTypeDO trainingTypeDO = trainingTypeRepository.getById(id);
|
||||
if(trainingTypeDO==null){
|
||||
return true;
|
||||
|
|
@ -50,7 +50,7 @@ public class TrainingTypeRemoveExe {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
// todo 校验是否有其他业务调用
|
||||
// 校验是否有其他业务调用
|
||||
|
||||
boolean res = trainingTypeGateway.deletedTrainingTypeByIds(ids);
|
||||
if(!res){
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ public class ExamPaperServiceImpl implements ExamPaperServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void edit(MultipartFile file,ExamPaperUpdateCmd examPaperUpdateCmd) {
|
||||
examPaperUpdateExe.execute(file,examPaperUpdateCmd);
|
||||
public void edit(ExamPaperUpdateCmd examPaperUpdateCmd) {
|
||||
examPaperUpdateExe.execute(examPaperUpdateCmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ public class QuestionServiceImpl implements QuestionServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(QuestionAddCmd cmd) {
|
||||
questionAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
public SingleResponse<ExamPaperCO> add(QuestionAddCmd cmd) {
|
||||
ExamPaperCO examPaperCO = questionAddExe.execute(cmd);
|
||||
return SingleResponse.of(examPaperCO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -60,8 +60,8 @@ public class QuestionServiceImpl implements QuestionServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
questionRemoveExe.execute(id);
|
||||
public ExamPaperCO remove(Long id) {
|
||||
return questionRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public interface ExamPaperServiceI {
|
|||
|
||||
SingleResponse<ExamPaperCO> add(ExamPaperAddCmd cmd);
|
||||
|
||||
void edit(MultipartFile file,ExamPaperUpdateCmd cmd);
|
||||
void edit(ExamPaperUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ public interface QuestionServiceI {
|
|||
|
||||
SingleResponse<QuestionCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<QuestionCO> add(QuestionAddCmd cmd);
|
||||
SingleResponse<ExamPaperCO> add(QuestionAddCmd cmd);
|
||||
|
||||
void edit(QuestionUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
ExamPaperCO remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,6 @@ public class ExamPaperCO {
|
|||
@ApiModelProperty(value = "是否是当前用户创建的数据")
|
||||
private Boolean isUserCreate = false;
|
||||
|
||||
private List<QuestionCO> questionCOList;
|
||||
// private List<QuestionCO> questionCOList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ public class ExamPaperAddCmd {
|
|||
private String examName;
|
||||
|
||||
@ApiModelProperty(value = "试卷总分数", name = "examScore", required = true)
|
||||
@NotEmpty(message = "试卷总分数不能为空")
|
||||
@NotNull(message = "试卷总分数不能为空")
|
||||
private BigDecimal examScore;
|
||||
|
||||
@ApiModelProperty(value = "合格分数", name = "passScore", required = true)
|
||||
@NotEmpty(message = "合格分数不能为空")
|
||||
@NotNull(message = "合格分数不能为空")
|
||||
private BigDecimal passScore;
|
||||
|
||||
@ApiModelProperty(value = "是否上架(0否 1是)", name = "sellFlag", required = true)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ public class QuestionUpdateCmd extends Command {
|
|||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "主键id", name = "questionId", required = true)
|
||||
@NotEmpty(message = "主键id不能为空")
|
||||
private String questionId;
|
||||
|
||||
@ApiModelProperty(value = "课件id", name = "videoCoursewareId")
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.zcloud.edu.persistence.dataobject.ExamPaperDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -19,5 +20,7 @@ public interface ExamPaperMapper extends BaseMapper<ExamPaperDO> {
|
|||
IPage<ExamPaperDO> listPage(IPage<ExamPaperDO> iPage, Map<String, Object> params);
|
||||
|
||||
ExamPaperDO getInfoById(Long id);
|
||||
|
||||
void updateExamScore(Long id, BigDecimal examScore);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.zcloud.gbscommon.utils.Query;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -51,5 +52,11 @@ public class ExamPaperRepositoryImpl extends BaseRepositoryImpl<ExamPaperMapper,
|
|||
queryWrapper.eq("exam_paper_id", examPaperId);
|
||||
return examPaperMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExamScore(Long id, BigDecimal examScore) {
|
||||
//分数相加
|
||||
examPaperMapper.updateExamScore(id, examScore);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,5 +35,12 @@ public class ClassCurriculumRepositoryImpl extends BaseRepositoryImpl<ClassCurri
|
|||
IPage<ClassCurriculumDO> result = classCurriculumMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getCountByCurriculumId(String curriculumId) {
|
||||
QueryWrapper<ClassCurriculumDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("curriculum_id", curriculumId);
|
||||
return classCurriculumMapper.selectCount(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,5 +35,12 @@ public class ClassExamPaperRepositoryImpl extends BaseRepositoryImpl<ClassExamPa
|
|||
IPage<ClassExamPaperDO> result = classExamPaperMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getCountByExamPaperId(String examPaperId) {
|
||||
QueryWrapper<ClassExamPaperDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("exam_paper_id", examPaperId);
|
||||
return classExamPaperMapper.selectCount(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageResponse;
|
|||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.edu.persistence.dataobject.ExamPaperDO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -21,5 +22,7 @@ public interface ExamPaperRepository extends BaseRepository<ExamPaperDO> {
|
|||
List<ExamPaperDO> getListByIdList(List<Long> list);
|
||||
|
||||
ExamPaperDO getInfoByUUid(String examPaperId);
|
||||
|
||||
void updateExamScore(Long id, BigDecimal bigDecimal);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ import java.util.Map;
|
|||
*/
|
||||
public interface ClassCurriculumRepository extends BaseRepository<ClassCurriculumDO> {
|
||||
PageResponse<ClassCurriculumDO> listPage(Map<String, Object> params);
|
||||
|
||||
Long getCountByCurriculumId(String curriculumId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ import java.util.Map;
|
|||
*/
|
||||
public interface ClassExamPaperRepository extends BaseRepository<ClassExamPaperDO> {
|
||||
PageResponse<ClassExamPaperDO> listPage(Map<String, Object> params);
|
||||
|
||||
Long getCountByExamPaperId(String examPaperId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
left join corp_info c on ep.corpinfo_id = c.id
|
||||
where ep.delete_enum = 'FALSE'
|
||||
<if test="params.inCorpinfoId != null">
|
||||
AND c.corpinfo_id in
|
||||
AND ep.corpinfo_id in
|
||||
<foreach collection="params.inCorpinfoId" item="corpinfoId" open="(" close=")" separator=",">
|
||||
#{corpinfoId}
|
||||
</foreach>
|
||||
|
|
@ -26,10 +26,10 @@
|
|||
<if test="params.sellFlag != null">
|
||||
AND ep.sell_flag = #{params.sellFlag}
|
||||
</if>
|
||||
<if test="params.uploadStartTime != null">
|
||||
<if test="params.uploadStartTime != null and params.uploadEndTime!=''">
|
||||
and DATE(ep.create_time) <![CDATA[>=]]> #{params.uploadStartTime}
|
||||
</if>
|
||||
<if test="params.uploadEndTime != null">
|
||||
<if test="params.uploadEndTime != null and params.uploadEndTime!=''">
|
||||
and DATE(ep.create_time) <![CDATA[<=]]> #{params.uploadStartTime}
|
||||
</if>
|
||||
order by ep.create_time desc
|
||||
|
|
@ -44,5 +44,10 @@
|
|||
where ep.delete_enum = 'FALSE'
|
||||
and ep.id = #{id}
|
||||
</select>
|
||||
<update id="updateExamScore">
|
||||
update exam_paper
|
||||
set exam_score = exam_score + #{examScore}
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue