package com.mindskip.xzs.service.impl;
import com.mindskip.xzs.domain.*;
import com.mindskip.xzs.domain.enums.ExamPaperAnswerStatusEnum;
import com.mindskip.xzs.domain.enums.ExamPaperTypeEnum;
import com.mindskip.xzs.domain.enums.QuestionTypeEnum;
import com.mindskip.xzs.domain.exam.ExamPaperTitleItemObject;
import com.mindskip.xzs.domain.other.KeyValue;
import com.mindskip.xzs.domain.other.ExamPaperAnswerUpdate;
import com.mindskip.xzs.domain.task.TaskItemAnswerObject;
import com.mindskip.xzs.repository.*;
import com.mindskip.xzs.repository.ExamPaperAnswerMapper;
import com.mindskip.xzs.repository.ExamPaperMapper;
import com.mindskip.xzs.repository.QuestionMapper;
import com.mindskip.xzs.repository.TaskExamCustomerAnswerMapper;
import com.mindskip.xzs.service.ExamPaperAnswerService;
import com.mindskip.xzs.service.ExamPaperQuestionCustomerAnswerService;
import com.mindskip.xzs.service.TextContentService;
import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.ExamUtil;
import com.mindskip.xzs.utility.JsonUtil;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM;
import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mindskip.xzs.domain.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer> implements ExamPaperAnswerService {
private final ExamPaperAnswerMapper examPaperAnswerMapper;
private final ExamPaperMapper examPaperMapper;
private final TextContentService textContentService;
private final QuestionMapper questionMapper;
private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
private final TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper;
@Autowired
public ExamPaperAnswerServiceImpl(ExamPaperAnswerMapper examPaperAnswerMapper, ExamPaperMapper examPaperMapper, TextContentService textContentService, QuestionMapper questionMapper, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper) {
super(examPaperAnswerMapper);
this.examPaperAnswerMapper = examPaperAnswerMapper;
this.examPaperMapper = examPaperMapper;
this.textContentService = textContentService;
this.questionMapper = questionMapper;
this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
this.taskExamCustomerAnswerMapper = taskExamCustomerAnswerMapper;
}
@Override
public PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM) {
return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
examPaperAnswerMapper.studentPage(requestVM));
}
@Override
public ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVM examPaperSubmitVM, User user) {
ExamPaperAnswerInfo examPaperAnswerInfo = new ExamPaperAnswerInfo();
Date now = new Date();
ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperSubmitVM.getId());
ExamPaperTypeEnum paperTypeEnum = ExamPaperTypeEnum.fromCode(examPaper.getPaperType());
//任务试卷只能做一次
if (paperTypeEnum == ExamPaperTypeEnum.Task) {
ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.getByPidUid(examPaperSubmitVM.getId(), user.getId());
if (null != examPaperAnswer)
return null;
}
String frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId()).getContent();
List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent, ExamPaperTitleItemObject.class);
List<Integer> questionIds = examPaperTitleItemObjects.stream().flatMap(t -> t.getQuestionItems().stream().map(q -> q.getId())).collect(Collectors.toList());
List<Question> questions = questionMapper.selectByIds(questionIds);
//将题目结构的转化为题目答案
List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers = examPaperTitleItemObjects.stream()
.flatMap(t -> t.getQuestionItems().stream()
.map(q -> {
Question question = questions.stream().filter(tq -> tq.getId().equals(q.getId())).findFirst().get();
ExamPaperSubmitItemVM customerQuestionAnswer = examPaperSubmitVM.getAnswerItems().stream()
.filter(tq -> tq.getQuestionId().equals(q.getId()))
.findFirst()
.orElse(null);
return ExamPaperQuestionCustomerAnswerFromVM(question, customerQuestionAnswer, examPaper, q.getItemOrder(), user, now);
})
).collect(Collectors.toList());
ExamPaperAnswer examPaperAnswer = ExamPaperAnswerFromVM(examPaperSubmitVM, examPaper, examPaperQuestionCustomerAnswers, user, now);
examPaperAnswerInfo.setExamPaper(examPaper);
examPaperAnswerInfo.setExamPaperAnswer(examPaperAnswer);
examPaperAnswerInfo.setExamPaperQuestionCustomerAnswers(examPaperQuestionCustomerAnswers);
return examPaperAnswerInfo;
}
@Override
@Transactional
public String judge(ExamPaperSubmitVM examPaperSubmitVM) {
ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(examPaperSubmitVM.getId());
List<ExamPaperSubmitItemVM> judgeItems = examPaperSubmitVM.getAnswerItems().stream().filter(d -> d.getDoRight() == null).collect(Collectors.toList());
List<ExamPaperAnswerUpdate> examPaperAnswerUpdates = new ArrayList<>(judgeItems.size());
Integer customerScore = examPaperAnswer.getUserScore();
Integer questionCorrect = examPaperAnswer.getQuestionCorrect();
for (ExamPaperSubmitItemVM d : judgeItems) {
ExamPaperAnswerUpdate examPaperAnswerUpdate = new ExamPaperAnswerUpdate();
examPaperAnswerUpdate.setId(d.getId());
examPaperAnswerUpdate.setCustomerScore(ExamUtil.scoreFromVM(d.getScore()));
boolean doRight = examPaperAnswerUpdate.getCustomerScore().equals(ExamUtil.scoreFromVM(d.getQuestionScore()));
examPaperAnswerUpdate.setDoRight(doRight);
examPaperAnswerUpdates.add(examPaperAnswerUpdate);
customerScore += examPaperAnswerUpdate.getCustomerScore();
if (examPaperAnswerUpdate.getDoRight()) {
++questionCorrect;
}
}
examPaperAnswer.setUserScore(customerScore);
examPaperAnswer.setQuestionCorrect(questionCorrect);
examPaperAnswer.setStatus(ExamPaperAnswerStatusEnum.Complete.getCode());
examPaperAnswerMapper.updateByPrimaryKeySelective(examPaperAnswer);
examPaperQuestionCustomerAnswerService.updateScore(examPaperAnswerUpdates);
ExamPaperTypeEnum examPaperTypeEnum = ExamPaperTypeEnum.fromCode(examPaperAnswer.getPaperType());
switch (examPaperTypeEnum) {
case Task:
//任务试卷批改完成后,需要更新任务的状态
ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperAnswer.getExamPaperId());
Integer taskId = examPaper.getTaskExamId();
Integer userId = examPaperAnswer.getCreateUser();
TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswerMapper.getB
没有合适的资源?快使用搜索试试~ 我知道了~
基于springboot+vue答题系统,前端对应pc的网页,和对应微信的小程序端,前期主要对微信小程序进行完善
共2000个文件
png:1024个
js:287个
java:207个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 18 浏览量
2024-05-25
23:48:56
上传
评论
收藏 17.31MB ZIP 举报
温馨提示
该项目利用了基于springboot + vue + mysql的开发模式框架实现的课设系统,包括了项目的源码资源、sql文件、相关指引文档等等。 【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。 【技术】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes
资源推荐
资源详情
资源评论
收起资源包目录
基于springboot+vue答题系统,前端对应pc的网页,和对应微信的小程序端,前期主要对微信小程序进行完善 (2000个子文件)
.browserslistrc 21B
.browserslistrc 21B
mvnw.cmd 5KB
index.css 414KB
index.css 414KB
index.74782572.css 246KB
chunk-vendors.4bd9a591.css 231KB
ueditor.css 34KB
ueditor.css 34KB
ueditor.min.css 34KB
ueditor.min.css 34KB
image.css 14KB
image.css 14KB
ui.css 9KB
ui.css 9KB
fui.min.css 7KB
fui.min.css 7KB
fui.css 7KB
fui.css 7KB
chunk-5454b879.a2dca667.css 6KB
chunk-77ccc064.4aededf5.css 6KB
index.a993eb8d.css 5KB
chunk-c7b9eaf2.03972c94.css 5KB
chunk-889ecf22.03972c94.css 5KB
chunk-vendors.ee57d822.css 3KB
chunk-1159e38a.a13e9690.css 3KB
codemirror.css 2KB
codemirror.css 2KB
chunk-71f81c10.d7c9fb7c.css 2KB
dialogbase.css 1KB
dialogbase.css 1KB
scrollbar.css 1KB
scrollbar.css 1KB
edittable.css 878B
edittable.css 878B
chunk-6e3b3ca0.60f7ef12.css 846B
chunk-bd32f434.c49a2505.css 712B
webuploader.css 428B
webuploader.css 428B
base.css 361B
base.css 361B
chunk-5e362585.5ecbdb83.css 260B
chunk-7aa4492c.a60a6ff1.css 260B
chunk-00a370fd.aeeb5c93.css 260B
chunk-4472f2d7.6aadbd54.css 162B
chunk-37f7a892.b6b9412a.css 114B
chunk-63af86fe.b6b9412a.css 114B
chunk-5025ea04.b6b9412a.css 114B
chunk-448755e2.b6b9412a.css 114B
chunk-913f50a6.b6b9412a.css 114B
chunk-07d991b3.b6b9412a.css 114B
chunk-c2aa2eac.b6b9412a.css 114B
chunk-04b6c2be.b6b9412a.css 114B
chunk-4cf8ab8c.b6b9412a.css 114B
chunk-b917c4bc.eaab2862.css 114B
chunk-038d4306.eaab2862.css 114B
chunk-096af9f1.eaab2862.css 114B
chunk-8ea99dc6.eaab2862.css 114B
page.css 102B
page.css 102B
iframe.css 85B
iframe.css 85B
.env.dev 25B
.env.dev 25B
Dockerfile 703B
.editorconfig 121B
.editorconfig 121B
.env 11B
.env 11B
.eslintignore 70B
.eslintignore 66B
401.gif 160KB
401.gif 160KB
avatar.gif 57KB
avatar.d25a6cc8.gif 57KB
icons.gif 20KB
icons.gif 20KB
icons-all.gif 4KB
icons-all.gif 4KB
loading.gif 2KB
loading.gif 2KB
videologo.gif 2KB
videologo.gif 2KB
cancelbutton.gif 1KB
cancelbutton.gif 1KB
button-bg.gif 1KB
button-bg.gif 1KB
lock.gif 1KB
lock.gif 1KB
word.gif 1019B
word.gif 1019B
loading.gif 734B
loading.gif 734B
icons.gif 453B
icons.gif 453B
success.gif 445B
success.gif 445B
cursor_v.gif 370B
cursor_v.gif 370B
cursor_h.gif 253B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
枫蜜柚子茶
- 粉丝: 9018
- 资源: 5350
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 【多智能体控制】基于matlab自适应领导者与追随者动态规划仿真【含Matlab源码 8003期】.mp4
- 压合半自动组装线体工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 移动式液压伸缩提升机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- sgg慕尚花坊项目代码
- 折弯激光焊接设备工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 已生产的插针机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 纸盒成型机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 智能仓库穿梭车工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 纸盒六面包膜机覆膜机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 自动Mylar贴合机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 自动裁切机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 自动调节双轴变位机单边基座工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 自动裁布机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 自动焊管机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 自制点胶系统工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 自动覆膜设备工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功