ea3bcc24543202a55b22623cad8dd8900d550242..a0877d9c0e2cf8678c025ecd88a5045d6e581e56
2024-10-29 fuliqi
试卷标题不能为空
a0877d 对比 | 目录
2024-10-29 fuliqi
Merge remote-tracking branch 'origin/master'
c70945 对比 | 目录
2024-10-29 fuliqi
Merge remote-tracking branch 'origin/master'
8883d9 对比 | 目录
2024-10-29 fuliqi
交卷后不能作答
dc326b 对比 | 目录
5个文件已修改
43 ■■■■■ 已修改文件
src/docker/Dockerfile 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-prod.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/docker/Dockerfile
@@ -10,10 +10,10 @@
COPY simsun.ttc /usr/share/fonts/
# easyExcel字体
RUN apk add fontconfig && apk add --update ttf-dejavu && fc-cache --force
# 同步docker内部的时间
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 设置时区
ENV TZ=Asia/Shanghai
# 同步docker内部的时间
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
EXPOSE 8000
# 复制jar包到/user/local/java下
ARG JAR_FILE
src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
@@ -46,6 +46,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@@ -74,9 +75,12 @@
        examPaper.setScore(new BigDecimal(form.getScore()));
        //随机试卷
        if (ExamPaperTypeEnum.Random.getCode().equals(form.getPaperType())) {
            //校验题目数量
            //校验标题是否填写、校验题目数量
            List<PaperQuestionSettingDTO> questionSetting = form.getQuestionSetting();
            for (PaperQuestionSettingDTO settingDTO : questionSetting) {
                if(StringUtils.isEmpty(settingDTO.getTitle())){
                    return Result.fail(SystemCode.InnerError.getCode(),"标题不能为空");
                }
                Integer questionType = settingDTO.getQuestionType();
                for (PaperSettingItem item : settingDTO.getSettingList()) {
                    Integer num = item.getNum();
@@ -100,6 +104,12 @@
            return Result.ok();
        } else if (ExamPaperTypeEnum.Fixed.getCode().equals(form.getPaperType())) {
            //固定试卷
            List<PaperFixQuestionDTO> questionTitleList = form.getQuestionTitleList();
            for (PaperFixQuestionDTO dto : questionTitleList) {
                if(StringUtils.isEmpty(dto.getTitle())){
                    return Result.fail(SystemCode.InnerError.getCode(),"标题不能为空");
                }
            }
            examPaper.setContent(JSON.toJSONString(form.getQuestionTitleList()));
            baseMapper.insert(examPaper);
            return Result.ok();
@@ -116,6 +126,9 @@
                List<PaperSettingItem> settingList = settingDTO.getSettingList();
                List<PaperQuestion> questionList = new ArrayList<>();
                for (PaperSettingItem item : settingList) {
                    if(StringUtils.isEmpty(settingDTO.getTitle())){
                        return Result.fail(SystemCode.InnerError.getCode(),"标题不能为空");
                    }
                    Integer num = item.getNum();
                    Integer difficult = item.getDifficult();
                    //需要配置的题目数量为0则跳过
src/main/java/com/ycl/jxkg/service/impl/ExamServiceImpl.java
@@ -255,9 +255,9 @@
                .one();
        if (Objects.nonNull(hasJoin)) {
            // 允许提交后继续作答
//            if(ExamSubmitTempStatusEnum.finish.equals(hasJoin.getStatus())){
//                throw new RuntimeException("您已提交试卷,请勿重复作答");
//            }
            if(ExamSubmitTempStatusEnum.finish.equals(hasJoin.getStatus())){
                throw new RuntimeException("您已提交试卷,请勿重复作答");
            }
            StartExamVO startExamVO = new StartExamVO();
            startExamVO.setExamName(exam.getExamName());
            startExamVO.setId(hasJoin.getExamId());
@@ -382,7 +382,6 @@
                doQuestionVO.setQuestionType(item.getQuestionType());
                //增加题目分数
                doQuestionVO.setQuestionScore(question.getScore());
                // 题目副本
                QuestionAnswerCopyVO copy = new QuestionAnswerCopyVO();
                copy.setId(question.getId());
@@ -515,7 +514,6 @@
        ExamSubmitTemp one = new LambdaQueryChainWrapper<>(examSubmitTempMapper)
                .eq(ExamSubmitTemp::getExamId, submitData.getId())
                .eq(ExamSubmitTemp::getUserId, webContext.getCurrentUser().getId())
                .eq(ExamSubmitTemp::getDeleted, 0)
                .one();
        if (Objects.nonNull(one)) {
@@ -635,12 +633,14 @@
        for (PaperFixQuestionVO titleItem : titleItems) {
            for (DoQuestionVO doQuestionVO : titleItem.getQuestionList()) {
                Integer questionId = doQuestionVO.getId();
                Optional<QuestionAnswerCopyVO> first = answerList.stream().filter(answer -> questionId.equals(answer.getId())).findFirst();
                if (first.isPresent()) {
                    QuestionAnswerCopyVO answerCopyVO = first.get();
                    doQuestionVO.setQuestionAnswer(answerCopyVO.getCorrect());
                    doQuestionVO.setAnalyze(answerCopyVO.getAnalyze());
                    doQuestionVO.setDifficult(answerCopyVO.getDifficult());
                if(questionId!=null) {
                    Optional<QuestionAnswerCopyVO> first = answerList.stream().filter(answer -> questionId.equals(answer.getId())).findFirst();
                    if (first.isPresent()) {
                        QuestionAnswerCopyVO answerCopyVO = first.get();
                        doQuestionVO.setQuestionAnswer(answerCopyVO.getCorrect());
                        doQuestionVO.setAnalyze(answerCopyVO.getAnalyze());
                        doQuestionVO.setDifficult(answerCopyVO.getDifficult());
                    }
                }
            }
        }
src/main/resources/application-dev.yml
@@ -8,6 +8,7 @@
spring:
  config:
    # 教学资源访问路径
    url: http://localhost:8000
  datasource:
    url: jdbc:mysql://42.193.1.25:3306/xzs?useSSL=true&useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&allowMultiQueries=true
src/main/resources/application-prod.yml
@@ -7,6 +7,7 @@
spring:
  config:
    # 教学资源访问路径
    url: http://25.30.6.246:8000
  datasource:
    driver-class-name: dm.jdbc.driver.DmDriver