实战考核所有功能

newBigdata
yz 11 months ago
parent e8fda05a6b
commit b771b1e3cf

@ -3,6 +3,9 @@ package com.sztzjy.financial_bigdata.controller.common;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.SysCourse;
import com.sztzjy.financial_bigdata.entity.SysCourseChapter;
import com.sztzjy.financial_bigdata.entity.SysCourseChapterExample;
import com.sztzjy.financial_bigdata.mapper.SysCourseChapterMapper;
import com.sztzjy.financial_bigdata.service.common.ICourseService;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import io.swagger.annotations.Api;
@ -12,12 +15,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Api(tags = "课程相关")
@RequestMapping("api/common/chapterController")
public class CourseController {
@Autowired
ICourseService courseService;
@Autowired
SysCourseChapterMapper chapterMapper;
//查看课程
@GetMapping("selectCourse")
@ -30,6 +37,18 @@ public class CourseController {
return new ResultEntity(HttpStatus.OK, "展示成功", pageInfo);
}
//根据课程id查询该课程下的所有章节
@GetMapping("selectChapterByCourseId")
@ApiOperation("查询课程下的所有章节")
@AnonymousAccess
public ResultEntity<List<SysCourseChapter>> selectChapterByCourseId(@RequestParam String courseId){
SysCourseChapterExample example = new SysCourseChapterExample();
example.createCriteria().andCourseIdEqualTo(courseId);
List<SysCourseChapter> chapterList = chapterMapper.selectByExample(example);
return new ResultEntity(HttpStatus.OK, "展示成功", chapterList);
}
//增加课程
@PostMapping("insertCourse")
@ApiOperation("增加课程")

@ -1,14 +0,0 @@
package com.sztzjy.financial_bigdata.controller.common;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//客观题
@RestController
@Api(tags = "客观题相关")
@RequestMapping("api/common/objectiveController")
public class ObjectiveController {
}

@ -1,9 +1,13 @@
package com.sztzjy.financial_bigdata.controller.stu;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuCommitCaseDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuCommitCaseExamDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import com.sztzjy.financial_bigdata.mapper.StuStudentExamMapper;
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper;
import com.sztzjy.financial_bigdata.mapper.TeaExamManageMapper;
import com.sztzjy.financial_bigdata.service.stu.IExamService;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import io.swagger.annotations.Api;
@ -13,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController
@ -21,6 +27,10 @@ import java.util.List;
public class ExamController {
@Autowired
IExamService examService;
@Autowired
TeaExamManageMapper manageMapper;
@Autowired
StuStudentExamMapper studentExamMapper;
//实战考核基础知识题目展示(开始考试)
@ -28,8 +38,12 @@ public class ExamController {
@ApiOperation("基础知识(开始考试)")
@AnonymousAccess
public ResultEntity<List<SysObjectiveQuestion>> basicKnowledge(@ApiParam("考试管理id") @RequestParam String examManageId,
@RequestParam String userId) {
List<SysObjectiveQuestion> list=examService.basicKnowledge(examManageId,userId);
@RequestParam String userId,
@RequestParam String classId) {
List<SysObjectiveQuestion> list=examService.basicKnowledge(examManageId,userId,classId);
if(list==null){
return new ResultEntity<>(HttpStatus.OK, "考试已结束");
}
for (int i = 0; i < list.size(); i++) {
list.get(i).setSchoolId(String.valueOf(i+1));
}
@ -37,17 +51,78 @@ public class ExamController {
}
//交卷
@GetMapping("commitExam")
@ApiOperation("考试交卷")
@PostMapping("commitExam")
@ApiOperation("基础知识考试交卷")
@AnonymousAccess
public ResultEntity commitExam(@RequestBody StuTheoryTestDto theoryTestDto){
int flag=examService.commitExam(theoryTestDto);
public ResultEntity commitExam(@RequestBody StuTheoryTestDto theoryTestDto,@RequestParam String examManageId){
int flag=examService.commitExam(theoryTestDto,examManageId);
if(flag==1){
return new ResultEntity<>(HttpStatus.OK, "提交试卷成功");
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "已提交过考试、请勿重复提交");
}else if(flag==0){
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "没有考试开始记录");
}else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "提交试卷失败");
return new ResultEntity<>(HttpStatus.OK, "交卷成功");
}
}
//案例考核
@GetMapping("startCase")
@ApiOperation("案例考核开始考试")
@AnonymousAccess
public ResultEntity<List<SysCaseQuestionStep>> startCase(@RequestParam String examManageId,@RequestParam String userId,@RequestParam String classId,@ApiParam("默认差第一条 传递first")@RequestParam String caseId){
List<SysCaseQuestionStep> list=examService.startCase(examManageId,userId,classId,caseId);
if(list==null){
return new ResultEntity<>(HttpStatus.OK, "考试已结束");
}else {
return new ResultEntity<>(HttpStatus.OK, "返回成功",list);
}
}
//获取案例题数量
@GetMapping("getCaseIdList")
@ApiOperation("获取考试案例题caseId集合")
@AnonymousAccess
public ResultEntity startCase(@RequestParam String examManageId){
TeaExamManageWithBLOBs examManage = manageMapper.selectByPrimaryKey(examManageId);
String caseIdlist = examManage.getCaseIdlist();
if(caseIdlist.contains(",")){
List<String> caseIdList = Arrays.asList(caseIdlist.split(","));
return new ResultEntity<>(HttpStatus.OK, "获取考试案例题id集合成功",caseIdList);
}else {
ArrayList<String> list = new ArrayList<>();
list.add(caseIdlist);
return new ResultEntity<>(HttpStatus.OK, "获取考试案例题id集合成功",list);
}
}
//案例题交卷
@PostMapping("commitCaseExam")
@ApiOperation("案例考核案例题交卷")
@AnonymousAccess
public ResultEntity commitCaseExam(@RequestBody StuCommitCaseExamDto commitCaseExamDto) {
Boolean flag = examService.commitCaseExam(commitCaseExamDto);
if (flag){
return new ResultEntity<>(HttpStatus.OK, "该步骤提交成功");
}else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "该步骤重复提交");
}
}
//客观题考试记录查询
@GetMapping("selectExamStartTime")
@ApiOperation("客观题开始考试时间查询")
@AnonymousAccess
public ResultEntity<StuStudentExam> selectExamStartTime(@RequestParam String examManageId,@RequestParam String userId){
StuStudentExamExample stuStudentExamExample = new StuStudentExamExample();
stuStudentExamExample.createCriteria().andExamManageIdEqualTo(examManageId).andUseridEqualTo(userId);
List<StuStudentExam> stuStudentExams = studentExamMapper.selectByExample(stuStudentExamExample);
return new ResultEntity<>(HttpStatus.OK, "该步骤提交成功",stuStudentExams.get(0));
}
//成绩详情条件查询
//基础知识得分详情
//案例题考核得分详情
}

@ -83,7 +83,7 @@ public class ExerciseExperimentalTraining {
@PostMapping("commitCase")
@ApiOperation("提交案例题")
@AnonymousAccess
public ResultEntity getCaseStepInfo(@RequestParam StuCommitCaseDto commitCaseDto) {
public ResultEntity commitCase(@RequestBody StuCommitCaseDto commitCaseDto) {
//执行记录操作
Boolean flag = stepService.commitCase(commitCaseDto);

@ -1,5 +1,6 @@
package com.sztzjy.financial_bigdata.controller.stu;// 后端代码
import com.alibaba.fastjson.JSONObject;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import io.swagger.annotations.Api;
@ -7,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
import org.python.core.CompileMode;
import org.python.core.Py;
import org.python.core.PyCode;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
@ -14,8 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.*;
@RestController
@Api(tags = "python接口")
@ -25,33 +26,82 @@ public class PythonController {
@PostMapping("/validate")
@ApiOperation("代码检验")
@AnonymousAccess
public ResultEntity validatePythonCode(@RequestBody String code) {
public ResultEntity validatePythonCode(@RequestBody JSONObject upCodeJson) {
String upCode = upCodeJson.getString("code");
// 对 Python 代码进行检验
String head="# -- coding: utf-8 --\n";
String code=head+upCode;
PythonInterpreter interpreter = new PythonInterpreter();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
InputStream stream = new ByteArrayInputStream(code.getBytes());
PyCode pyCode = Py.compile(stream, "<string>", CompileMode.exec);
// 重定向输出到 outputStream
interpreter.setOut(outputStream);
interpreter.exec(pyCode);
return new ResultEntity<>(HttpStatus.OK, "语法正确");
// 获取运行结果
String result = outputStream.toString();
return new ResultEntity<>(HttpStatus.OK, result);
} catch (Exception e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "语法有误",e.getMessage());
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "语法有误", e.getMessage());
} finally {
interpreter.close();
}
}
public static void main(String[] args) {
String code="if True:\n" +
" print (\"True\")\n" +
"else:\n" +
" print (\"False\")\n";
PythonInterpreter interpreter = new PythonInterpreter();
try {
InputStream stream = new ByteArrayInputStream(code.getBytes());
PyCode pyCode = Py.compile(stream, "<string>", CompileMode.exec);
interpreter.exec(pyCode);
// 构建Python命令和代码
String pythonCommand = "python";
String pythonCode = "#读取数据\n" +
"import pandas as pd\n" +
"df = pd.read_excel('IT行业收入表.xlsx')#读取excel表\n" +
"df.head()#使用函数,显示前几行数据\n" +
"\n" +
"# 此时的工龄为自变量,薪水为因变量,通过如下代码进行自变量、因变量选取\n" +
"X = df[['工龄']]\n" +
"Y = df['薪水']\n" +
"\n" +
"# 通过如下代码可以将此时的散点图绘制出来:\n" +
"from matplotlib import pyplot as plt\n" +
"%matplotlib inline\n" +
"plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签\n" +
"plt.scatter(X,Y)#绘制散点图\n" +
"plt.xlabel('工龄')#设置x轴标签\n" +
"plt.ylabel('薪水')#设置y轴标签\n" +
"plt.show()";
System.out.println("2");
} catch (Exception e) {
System.out.println(e.getMessage()); }
// 创建进程构建器
ProcessBuilder processBuilder = new ProcessBuilder(pythonCommand);
// 启动进程
Process process = processBuilder.start();
// 获取标准输入流
InputStream inputStream = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
// 将Python代码写入标准输入流
process.getOutputStream().write(pythonCode.getBytes());
process.getOutputStream().flush();
process.getOutputStream().close();
// 读取和打印Python解释器的输出
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
// 等待进程执行完成
int exitCode = process.waitFor();
System.out.println("Exit Code: " + exitCode);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}

@ -73,12 +73,12 @@ public class TheoryTestController {
@AnonymousAccess
public ResultEntity<List<SysObjectiveQuestion>> selectErrors(@RequestParam String userId){
List<SysObjectiveQuestion> list=theoryTestService.selectErrors(userId);
for (int i = 0; i < list.size(); i++) {
list.get(i).setSchoolId(String.valueOf(i+1));
}
if(list==null){
return new ResultEntity<>(HttpStatus.OK, "没有错题",null);
}
for (int i = 0; i < list.size(); i++) {
list.get(i).setSchoolId(String.valueOf(i+1));
}
return new ResultEntity<>(HttpStatus.OK, "错题集展示成功",list);
}

@ -3,9 +3,9 @@ package com.sztzjy.financial_bigdata.controller.tea;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.SysCaseQuestion;
import com.sztzjy.financial_bigdata.entity.SysCourse;
import com.sztzjy.financial_bigdata.entity.SysCourseChapter;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.mapper.SysCaseQuestionMapper;
import com.sztzjy.financial_bigdata.mapper.SysCaseQuestionStepMapper;
import com.sztzjy.financial_bigdata.service.tea.ITeaCaseService;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import io.swagger.annotations.Api;
@ -19,11 +19,15 @@ import java.util.List;
@RestController
@Api(tags = "教师端--资源中心-实训案例")
@Api(tags = "教师端--资源中心-实训案例 新增考试-案例题预览")
@RequestMapping("api/tea/caseController")
public class TeaCaseController {
@Autowired
ITeaCaseService caseService;
@Autowired
SysCaseQuestionStepMapper stepMapper;
@Autowired
SysCaseQuestionMapper questionMapper;
//实训案例新增 内置数据必须附带章节id 老师上传的数据不需要
@PostMapping("insertCase")
@ -61,7 +65,7 @@ public class TeaCaseController {
@ApiOperation("案例题详情查询、案例题编辑回显")
public ResultEntity<SysCaseQuestion> selectCaseDetails(@RequestParam String caseId) {
SysCaseQuestion sysCaseQuestion = caseService.selectCaseDetails(caseId);
return new ResultEntity<>(HttpStatus.OK, "案例题新增成功",sysCaseQuestion);
return new ResultEntity<>(HttpStatus.OK, "案例题详情查询成功",sysCaseQuestion);
}
//案例题批量删除
@ -137,4 +141,25 @@ public class TeaCaseController {
List<SysCaseQuestion> list=caseService.selectAllCaseByChapterId(chapterId);
return new ResultEntity<>(HttpStatus.OK, "案例题库选择案例题内容展示成功",list);
}
//新增考试案例题预览
@GetMapping("selectCaseStepDetailByCaseId")
@ApiOperation("新增考试-案例题预览-步骤信息查询")
@AnonymousAccess
public ResultEntity<List<SysCaseQuestionStep>> selectCaseStepDetailByCaseId(@RequestParam String caseId){
//根据caseid 查询案例步骤表中的所有数据
SysCaseQuestionStepExample example = new SysCaseQuestionStepExample();
example.createCriteria().andCaseIdEqualTo(caseId);
List<SysCaseQuestionStep> stepList = stepMapper.selectByExample(example);
return new ResultEntity<>(HttpStatus.OK, "新增考试案例题预览展示成功",stepList);
}
//案例题基础信息查询
@GetMapping("selectCaseDetailByCaseId")
@ApiOperation("新增考试-案例题预览-案例信息查询")
@AnonymousAccess
public ResultEntity<SysCaseQuestion> selectCaseDetailByCaseId(@RequestParam String caseId){
SysCaseQuestion sysCaseQuestion = questionMapper.selectByPrimaryKey(caseId);
return new ResultEntity<>(HttpStatus.OK, "案例信息查询成功",sysCaseQuestion);
}
}

@ -1,5 +1,6 @@
package com.sztzjy.financial_bigdata.controller.tea;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.SysResourceData;
import com.sztzjy.financial_bigdata.service.tea.ITeaResourceDataService;
import com.sztzjy.financial_bigdata.util.ResultEntity;
@ -24,6 +25,7 @@ public class TeaResourceDataController {
//数据集上传
@GetMapping("uploadResourceData")
@ApiOperation("数据集文件上传")
@AnonymousAccess
public ResultEntity uploadResourceData(@RequestParam MultipartFile file,
@ApiParam("学校id") @RequestParam(required = false) String schoolId,
@ApiParam("案例题id") @RequestParam String caseId) {
@ -38,6 +40,7 @@ public class TeaResourceDataController {
//数据集信息查询
@GetMapping("selectResourceDataList")
@ApiOperation("数据集信息查询")
@AnonymousAccess
public ResultEntity<List<SysResourceData>> selectResourceDataList(@ApiParam("案例题id") @RequestParam String caseId) {
List<SysResourceData> resourceDataList = resourceDataService.selectResourceDataList(caseId);
return new ResultEntity<>(HttpStatus.OK, "数据集信息查询成功",resourceDataList);
@ -47,6 +50,7 @@ public class TeaResourceDataController {
//数据集删除
@GetMapping("deleteResourceData")
@ApiOperation("数据集删除")
@AnonymousAccess
public ResultEntity deleteResourceData(@ApiParam("数据集Id") @RequestParam String resourceDataId,
@RequestParam String schoolId) {
Boolean flag = resourceDataService.deleteResourceData(schoolId, resourceDataId);
@ -60,6 +64,7 @@ public class TeaResourceDataController {
//数据集下载
@GetMapping("downloadResourceData")
@ApiOperation("数据集下载")
@AnonymousAccess
public void downloadResourceData(@ApiParam("资源ID") @RequestParam String resourceDataId, HttpServletResponse response) {
resourceDataService.downloadResourceData(resourceDataId, response);
}

@ -25,6 +25,11 @@ public class StuExamCase {
@ApiModelProperty("学生得分")
private BigDecimal caseScore;
@ApiModelProperty("案例题步骤id")
private String caseStepId;
private String userId;
public String getExamCaseId() {
return examCaseId;
}
@ -64,4 +69,20 @@ public class StuExamCase {
public void setCaseScore(BigDecimal caseScore) {
this.caseScore = caseScore;
}
public String getCaseStepId() {
return caseStepId;
}
public void setCaseStepId(String caseStepId) {
this.caseStepId = caseStepId == null ? null : caseStepId.trim();
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
}

@ -444,6 +444,146 @@ public class StuExamCaseExample {
addCriterion("case_score not between", value1, value2, "caseScore");
return (Criteria) this;
}
public Criteria andCaseStepIdIsNull() {
addCriterion("case_step_id is null");
return (Criteria) this;
}
public Criteria andCaseStepIdIsNotNull() {
addCriterion("case_step_id is not null");
return (Criteria) this;
}
public Criteria andCaseStepIdEqualTo(String value) {
addCriterion("case_step_id =", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdNotEqualTo(String value) {
addCriterion("case_step_id <>", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdGreaterThan(String value) {
addCriterion("case_step_id >", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdGreaterThanOrEqualTo(String value) {
addCriterion("case_step_id >=", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdLessThan(String value) {
addCriterion("case_step_id <", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdLessThanOrEqualTo(String value) {
addCriterion("case_step_id <=", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdLike(String value) {
addCriterion("case_step_id like", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdNotLike(String value) {
addCriterion("case_step_id not like", value, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdIn(List<String> values) {
addCriterion("case_step_id in", values, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdNotIn(List<String> values) {
addCriterion("case_step_id not in", values, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdBetween(String value1, String value2) {
addCriterion("case_step_id between", value1, value2, "caseStepId");
return (Criteria) this;
}
public Criteria andCaseStepIdNotBetween(String value1, String value2) {
addCriterion("case_step_id not between", value1, value2, "caseStepId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -0,0 +1,24 @@
package com.sztzjy.financial_bigdata.entity.stu_dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class StuCommitCaseExamDto {
@ApiModelProperty("用户id")
private String userId;
@ApiModelProperty("考试管理ID")
private String examManageId;
@ApiModelProperty("案例题id")
private String caseId;
@ApiModelProperty("案例题步骤id")
private String caseStepId;
@ApiModelProperty("学生答案")
private String stuAnswer;
}

@ -3,8 +3,10 @@ package com.sztzjy.financial_bigdata.mapper;
import com.sztzjy.financial_bigdata.entity.StuExamCase;
import com.sztzjy.financial_bigdata.entity.StuExamCaseExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface StuExamCaseMapper {
long countByExample(StuExamCaseExample example);

@ -1,12 +1,18 @@
package com.sztzjy.financial_bigdata.service.stu;
import com.sztzjy.financial_bigdata.entity.SysCaseQuestionStep;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuCommitCaseExamDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import java.util.List;
public interface IExamService {
List<SysObjectiveQuestion> basicKnowledge(String examManageId, String userId);
List<SysObjectiveQuestion> basicKnowledge(String examManageId, String userId,String classId);
int commitExam(StuTheoryTestDto theoryTestDto);
int commitExam(StuTheoryTestDto theoryTestDto,String examManageId);
List<SysCaseQuestionStep> startCase(String examManageId, String userId, String classId,String caseId);
Boolean commitCaseExam(StuCommitCaseExamDto commitCaseExamDto);
}

@ -1,17 +1,15 @@
package com.sztzjy.financial_bigdata.service.stu.impl;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.TeaExamManageWithBLOBs;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuCommitCaseExamDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper;
import com.sztzjy.financial_bigdata.mapper.TeaExamManageMapper;
import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.service.stu.IExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
@Service
public class ExamServiceImpl implements IExamService {
@ -19,21 +17,68 @@ public class ExamServiceImpl implements IExamService {
TeaExamManageMapper examManageMapper;
@Autowired
SysObjectiveQuestionMapper objectiveQuestionMapper;
@Autowired
StuStudentExamMapper studentExamMapper;
@Autowired
SysCaseQuestionStepMapper stepMapper;
@Autowired
StuExamCaseMapper stuExamCaseMapper;
//如果学生考试表查询不到 则新增一条数据
//根据examManageId 查询该考试的题目idlist 再通过idlist查询题目信息进行返回
//先判断是否考试过 如果结束考试状态不为true 判断考试时间是否超过答题时间 超过时间则不允许答题、并回显考试内容\没超过时间 则重新答题
// 如果结束考试状态为true,则直接回显题目和考生的答题记录
@Override
public List<SysObjectiveQuestion> basicKnowledge(String examManageId, String userId) {
//查询
public List<SysObjectiveQuestion> basicKnowledge(String examManageId, String userId,String classId) {
//判断考试时间是否已经超过
TeaExamManageWithBLOBs teaExamManageWithBLOBs = examManageMapper.selectByPrimaryKey(examManageId);
if(teaExamManageWithBLOBs.getEndTime().before(new Date())){
return null;
}
//查询学生考试记录
StuStudentExamExample example = new StuStudentExamExample();
example.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examManageId);
List<StuStudentExamWithBLOBs> stuStudentExams = studentExamMapper.selectByExampleWithBLOBs(example);
if(stuStudentExams==null || stuStudentExams.size()==0){
StuStudentExamWithBLOBs stuExam = new StuStudentExamWithBLOBs();
stuExam.setStudentExamId(String.valueOf(UUID.randomUUID()));
stuExam.setExamManageId(examManageId);
stuExam.setUserid(userId);
stuExam.setClassId(classId);
stuExam.setStartTime(new Date());
studentExamMapper.insert(stuExam);
List<SysObjectiveQuestion> objectiveQuestionList = GenerateExam(examManageId);
return objectiveQuestionList;
}else {
StuStudentExamWithBLOBs stuExam = stuStudentExams.get(0);
if("true".equals(stuExam.getExamEndStatus())){ //代表已经考完
return null;
}else { //先判断考试时间是否超时
// Date currentTime = new Date();
// Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时
// if (stuExam.getStartTime().before(twoHoursAgo)) { //已超出两个小时 不允许交卷 并更新studentExam参数
// stuExam.setObjectiveScore(BigDecimal.ZERO);
// stuExam.setExamEndStatus("true");
// studentExamMapper.updateByPrimaryKeyWithBLOBs(stuExam);
// return null;
// }else { //没超过两个小时
List<SysObjectiveQuestion> objectiveQuestionList = GenerateExam(examManageId);
return objectiveQuestionList;
// }
}
}
}
public List<SysObjectiveQuestion> GenerateExam(String examManageId){
TeaExamManageWithBLOBs teaExamManageWithBLOBs = examManageMapper.selectByPrimaryKey(examManageId);
String singleIds = teaExamManageWithBLOBs.getSingleIdlist();
String manyIds = teaExamManageWithBLOBs.getManyIdlist();
String judgeIds = teaExamManageWithBLOBs.getJudgeIdlist();
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
List<String> manyIdList = Arrays.asList(manyIds.substring(1, manyIds.length() - 1).split(", "));
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
List<String> singleIdList = Arrays.asList(singleIds.substring(0, singleIds.length() ).split(","));
List<String> manyIdList = Arrays.asList(manyIds.substring(0, manyIds.length()).split(","));
List<String> judgeIdList = Arrays.asList(judgeIds.substring(0, judgeIds.length()).split(","));
List<SysObjectiveQuestion> objectiveQuestionList=new ArrayList<>();
for (int i = 0; i < singleIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i));
@ -50,8 +95,142 @@ public class ExamServiceImpl implements IExamService {
return objectiveQuestionList;
}
//先判断是否提交过考试
@Override
public int commitExam(StuTheoryTestDto theoryTestDto,String examManageId) {
String userId = theoryTestDto.getUserId();
StuStudentExamExample example = new StuStudentExamExample();
example.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examManageId);
List<StuStudentExamWithBLOBs> stuStudentExams = studentExamMapper.selectByExampleWithBLOBs(example);
if(stuStudentExams==null){ //没有考试开始记录
return 0;
}else {
StuStudentExamWithBLOBs stuStudentExam = stuStudentExams.get(0);
String examEndStatus = stuStudentExam.getExamEndStatus();
if("true".equals(examEndStatus)){ //已提交过考试 不能重复提交
return 1;
}
//未提交过考试 将客观题得分、总分 ids保存
stuStudentExam.setObjectiveScore(theoryTestDto.getScore());
if(stuStudentExam.getTotalScore()==null){
stuStudentExam.setTotalScore(theoryTestDto.getScore());
}else {
stuStudentExam.setTotalScore(stuStudentExam.getTotalScore().add(theoryTestDto.getScore()));
}
stuStudentExam.setSingleStuAnswerIds(String.valueOf(theoryTestDto.getSingleStuAnswer()));
stuStudentExam.setManyStuAnswerIds(String.valueOf(theoryTestDto.getMultipleStuAnswer()));
stuStudentExam.setJudgeStuAnswerIds(String.valueOf(theoryTestDto.getJudgeStuAnswer()));
stuStudentExam.setExamEndStatus("true");
studentExamMapper.updateByPrimaryKeyWithBLOBs(stuStudentExam);
return 2;
}
}
//案例开始答题
//先查询当前时间是否在考试时间之内
//在考试时间外 返回不在考试时间内
//考试时间内
//根据传递的caseid查询所有step数据判断是否查询第一个案例数据
//根据casestepid、userid、exammanageid 查询该案例的数据 如果有 代表之前提交过 则替换返回的答案 没有 则返回上一步查询的数据 并设置答案为null
@Override
public int commitExam(StuTheoryTestDto theoryTestDto) {
return 0;
public List<SysCaseQuestionStep> startCase(String examManageId, String userId, String classId,String caseId) {
TeaExamManageWithBLOBs manage = examManageMapper.selectByPrimaryKey(examManageId);
Date endTime = manage.getEndTime();
if(endTime.before(new Date())){
return null;
}else {
String caseIdlist = manage.getCaseIdlist();
List<String> caseIdList = Arrays.asList(caseIdlist.split(", "));
SysCaseQuestionStepExample example = new SysCaseQuestionStepExample();
if(caseId.equals("first")){
String caseIdFirst = caseIdList.get(0);
//根据caseid 到casestep表中查询所有step
example.createCriteria().andCaseIdEqualTo(caseIdFirst);
List<SysCaseQuestionStep> stepList = stepMapper.selectByExample(example);
for (int i = 0; i < stepList.size(); i++) {
StuExamCaseExample stuExamCaseExample = new StuExamCaseExample();
stuExamCaseExample.createCriteria().andCaseStepIdEqualTo(stepList.get(i).getCaseStepId()).andUserIdEqualTo(userId).andExamManageIdEqualTo(examManageId);
List<StuExamCase> stuExamCases = stuExamCaseMapper.selectByExample(stuExamCaseExample);
if(stuExamCases==null || stuExamCases.size()==0){
stepList.get(i).setAnswer("");
stepList.get(i).setAnswerOriginal("");
continue;
}else {
stepList.get(i).setAnswerOriginal(stuExamCases.get(0).getStudentAnswer());
}
}
return stepList;
}else {
example.createCriteria().andCaseIdEqualTo(caseId);
List<SysCaseQuestionStep> stepList = stepMapper.selectByExample(example);
for (int i = 0; i < stepList.size(); i++) {
StuExamCaseExample stuExamCaseExample = new StuExamCaseExample();
stuExamCaseExample.createCriteria().andCaseStepIdEqualTo(stepList.get(i).getCaseStepId()).andUserIdEqualTo(userId).andExamManageIdEqualTo(examManageId);
List<StuExamCase> stuExamCases = stuExamCaseMapper.selectByExample(stuExamCaseExample);
if(stuExamCases==null || stuExamCases.size()==0){
stepList.get(i).setAnswer("");
stepList.get(i).setAnswerOriginal("");
continue;
}else {
stepList.get(i).setAnswerOriginal(stuExamCases.get(0).getStudentAnswer());
}
}
return stepList;
}
}
}
//先根据commitCaseExamDto.caseStepId userid、examManageId查询stuExamCaseMapper表中是否有数据 有的话 表示该步骤已经提交
//没有数据 代表可以提交 根据caseStepId到案例题库表中查询答案 判断案例题库中的答案和dto中的答案是否相同
//如果相同 则新增一条学生考试案例表 并设置分数、基础信息、学生答案
//如果不同 则新增一条学生考试案例表 并设置分数、基础信息、学生答案
@Override
public Boolean commitCaseExam(StuCommitCaseExamDto commitCaseExamDto) {
StuExamCaseExample example = new StuExamCaseExample();
example.createCriteria().andCaseStepIdEqualTo(commitCaseExamDto.getCaseStepId()).andUserIdEqualTo(commitCaseExamDto.getUserId()).andExamManageIdEqualTo(commitCaseExamDto.getExamManageId());
List<StuExamCase> stuExamCases = stuExamCaseMapper.selectByExample(example);
String caseStepId = commitCaseExamDto.getCaseStepId();
SysCaseQuestionStep sysCaseQuestionStep = stepMapper.selectByPrimaryKey(caseStepId);
if(stuExamCases==null || stuExamCases.size()==0){
StuExamCase stuExamCase = new StuExamCase();
stuExamCase.setCaseId(String.valueOf(UUID.randomUUID()));
stuExamCase.setExamManageId(commitCaseExamDto.getExamManageId());
stuExamCase.setCaseId(commitCaseExamDto.getCaseId());
stuExamCase.setStudentAnswer(commitCaseExamDto.getStuAnswer());
stuExamCase.setCaseStepId(caseStepId);
stuExamCase.setUserId(commitCaseExamDto.getUserId());
if(sysCaseQuestionStep.getAnswerOriginal().equals(commitCaseExamDto.getStuAnswer())){
stuExamCase.setCaseScore(sysCaseQuestionStep.getScore());
}else {
stuExamCase.setCaseScore(BigDecimal.ZERO);
}
stuExamCaseMapper.insert(stuExamCase);
//设置stustudentexam中的案例题得分、总分、案例题结束状态
StuStudentExamExample stuStudentExamExample = new StuStudentExamExample();
stuStudentExamExample.createCriteria().andUseridEqualTo(commitCaseExamDto.getUserId()).andExamManageIdEqualTo(commitCaseExamDto.getExamManageId());
List<StuStudentExam> stuStudentExams = studentExamMapper.selectByExample(stuStudentExamExample);
if(stuStudentExams==null || stuStudentExams.size()==0){
return false;
}else {
StuStudentExam stuStudentExam = stuStudentExams.get(0);
if(stuStudentExam.getCaseScore()==null){ //案例题分数
stuStudentExam.setCaseScore(sysCaseQuestionStep.getScore());
}else {
stuStudentExam.setCaseScore(stuStudentExam.getCaseScore().add(sysCaseQuestionStep.getScore()));
}
if(stuStudentExam.getTotalScore()==null){ //总分
stuStudentExam.setTotalScore(sysCaseQuestionStep.getScore());
}else {
stuStudentExam.setTotalScore(stuStudentExam.getTotalScore().add(sysCaseQuestionStep.getScore()));
}
//平均正确率
}
return true;
}else {
return false;
}
}
}

@ -67,7 +67,7 @@ public class ExerciseServiceImpl implements IExerciseService {
return dtos;
}else {
if(bloBs.getLearningEvalAnswer()==null){ //判断是否提交过 未提交
List<String> learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(", "));
List<String> learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(","));
for (int i = 0; i < learningEvalIdlist.size(); i++) {
String objectiveId = learningEvalIdlist.get(i);
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveId);
@ -76,8 +76,8 @@ public class ExerciseServiceImpl implements IExerciseService {
}
return dtos;
}else { //提交
List<String> learningEvalAnswerList = Arrays.asList(bloBs.getLearningEvalAnswer().substring(1, bloBs.getLearningEvalAnswer().length() - 1).split(", "));
List<String> learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(", "));
List<String> learningEvalAnswerList = Arrays.asList(bloBs.getLearningEvalAnswer().substring(1, bloBs.getLearningEvalAnswer().length() - 1).split(","));
List<String> learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(","));
for (int i = 0; i < learningEvalIdlist.size(); i++) {
String objectiveId = learningEvalIdlist.get(i);
String stuAnswer = learningEvalAnswerList.get(i);

@ -55,25 +55,23 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
List<SysObjectiveQuestion> objectiveQuestionList = GenerateTest(userId);
return objectiveQuestionList;
} else { //在两个小时内 返回最近的一条试卷
List<SysObjectiveQuestion> returnQuestionList = new ArrayList();
String singleIds = stuTheoryExam.getSingleIds();
String multipleIds = stuTheoryExam.getMultipleIds();
String judgeIds = stuTheoryExam.getJudgeIds();
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
for (int i = 0; i < singleIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i));
returnQuestionList.add(objectiveQuestion);
}
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
for (int i = 0; i < multipleIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(multipleIdList.get(i));
returnQuestionList.add(objectiveQuestion);
}
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
for (int i = 0; i < judgeIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(judgeIdList.get(i));
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(","));
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(","));
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(","));
List<String> idlist=new ArrayList<>();
idlist.addAll(singleIdList);
idlist.addAll(multipleIdList);
idlist.addAll(judgeIdList);
List<SysObjectiveQuestion> returnQuestionList = new ArrayList();
for (int i = 0; i < idlist.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(idlist.get(i));
returnQuestionList.add(objectiveQuestion);
}
// List<SysObjectiveQuestion> returnQuestionList = objectiveQuestionMapper.selectBatchByIdList(idlist);
return returnQuestionList;
}
}
@ -204,7 +202,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} else {
StuErrorWithBLOBs stuError = stuErrors.get(0);
if (stuError.getSingleIds()!=null) {
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", "));
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(","));
List<String> singleErrorIds = theoryTestDto.getSingleErrorIds();
List<String> combinedList = new ArrayList<>(stringList);
@ -216,7 +214,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds()));
}
if (stuError.getMultipleIds()!=null) {
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", "));
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(","));
List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds();
List<String> combinedList = new ArrayList<>(stringList);
@ -228,7 +226,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
}
if (stuError.getJudgeIds()!=null) {
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", "));
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(","));
List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds();
List<String> combinedList = new ArrayList<>(stringList);
combinedList.addAll(judgeErrorIds);
@ -256,7 +254,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
StuErrorWithBLOBs stuError = stuErrors.get(0);
String singleIds = stuError.getSingleIds();
if (!singleIds.isEmpty()) {
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(","));
for (int i = 0; i < singleIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i));
objectiveQuestionList.add(objectiveQuestion);
@ -264,7 +262,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
String multipleIds = stuError.getMultipleIds();
if (!multipleIds.isEmpty()) {
List<String> stringList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
List<String> stringList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(","));
for (int i = 0; i < stringList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i));
objectiveQuestionList.add(objectiveQuestion);
@ -272,7 +270,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
String judgeIds = stuError.getJudgeIds();
if (!judgeIds.isEmpty()) {
List<String> stringList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
List<String> stringList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(","));
for (int i = 0; i < stringList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i));
objectiveQuestionList.add(objectiveQuestion);
@ -292,7 +290,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
StuErrorWithBLOBs error = stuErrors.get(0);
if (Constant.OBJECTIVE_TYPE_SINGLE.equals(type)) {
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", "));
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(","));
Set<String> set = new LinkedHashSet<>(stringList);
set.remove(objectiveQuestionId);
if(set.isEmpty()){
@ -303,7 +301,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
}
if (Constant.OBJECTIVE_TYPE_Many.equals(type)) {
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", ")));
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(",")));
set.remove(objectiveQuestionId);
if(set.isEmpty()){
error.setMultipleIds(null);
@ -313,7 +311,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
}
if(Constant.OBJECTIVE_TYPE_JUDGE.equals(type)){
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", ")));
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(",")));
set.remove(objectiveQuestionId);
if(set.isEmpty()){
error.setJudgeIds(null);
@ -341,18 +339,18 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId);
String singleIds = theoryExam.getSingleIds();
ArrayList<String> idsList = new ArrayList<>();
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(","));
String multipleIds = theoryExam.getMultipleIds();
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(","));
String judgeIds = theoryExam.getJudgeIds();
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(","));
idsList.addAll(singleIdList);
idsList.addAll(multipleIdList);
idsList.addAll(judgeIdList);
ArrayList<String> answerList = new ArrayList<>();
List<String> singleStuAnswer =Arrays.asList(theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(", "));
List<String> multipleStuAnswer = Arrays.asList(theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(", "));
List<String> judgeStuAnswer = Arrays.asList(theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(", "));
List<String> singleStuAnswer =Arrays.asList(theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(","));
List<String> multipleStuAnswer = Arrays.asList(theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(","));
List<String> judgeStuAnswer = Arrays.asList(theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(","));
answerList.addAll(singleStuAnswer);
answerList.addAll(multipleStuAnswer);
answerList.addAll(judgeStuAnswer);

@ -7,6 +7,8 @@
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
<result column="student_answer" jdbcType="VARCHAR" property="studentAnswer" />
<result column="case_score" jdbcType="DECIMAL" property="caseScore" />
<result column="case_step_id" jdbcType="VARCHAR" property="caseStepId" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -67,7 +69,8 @@
</where>
</sql>
<sql id="Base_Column_List">
exam_case_id, exam_manage_id, case_id, student_answer, case_score
exam_case_id, exam_manage_id, case_id, student_answer, case_score, case_step_id,
user_id
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuExamCaseExample" resultMap="BaseResultMap">
select
@ -101,9 +104,11 @@
</delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuExamCase">
insert into stu_exam_case (exam_case_id, exam_manage_id, case_id,
student_answer, case_score)
student_answer, case_score, case_step_id,
user_id)
values (#{examCaseId,jdbcType=VARCHAR}, #{examManageId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
#{studentAnswer,jdbcType=VARCHAR}, #{caseScore,jdbcType=DECIMAL})
#{studentAnswer,jdbcType=VARCHAR}, #{caseScore,jdbcType=DECIMAL}, #{caseStepId,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuExamCase">
insert into stu_exam_case
@ -123,6 +128,12 @@
<if test="caseScore != null">
case_score,
</if>
<if test="caseStepId != null">
case_step_id,
</if>
<if test="userId != null">
user_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="examCaseId != null">
@ -140,6 +151,12 @@
<if test="caseScore != null">
#{caseScore,jdbcType=DECIMAL},
</if>
<if test="caseStepId != null">
#{caseStepId,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuExamCaseExample" resultType="java.lang.Long">
@ -166,6 +183,12 @@
<if test="record.caseScore != null">
case_score = #{record.caseScore,jdbcType=DECIMAL},
</if>
<if test="record.caseStepId != null">
case_step_id = #{record.caseStepId,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -177,7 +200,9 @@
exam_manage_id = #{record.examManageId,jdbcType=VARCHAR},
case_id = #{record.caseId,jdbcType=VARCHAR},
student_answer = #{record.studentAnswer,jdbcType=VARCHAR},
case_score = #{record.caseScore,jdbcType=DECIMAL}
case_score = #{record.caseScore,jdbcType=DECIMAL},
case_step_id = #{record.caseStepId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -197,6 +222,12 @@
<if test="caseScore != null">
case_score = #{caseScore,jdbcType=DECIMAL},
</if>
<if test="caseStepId != null">
case_step_id = #{caseStepId,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
</set>
where exam_case_id = #{examCaseId,jdbcType=VARCHAR}
</update>
@ -205,7 +236,9 @@
set exam_manage_id = #{examManageId,jdbcType=VARCHAR},
case_id = #{caseId,jdbcType=VARCHAR},
student_answer = #{studentAnswer,jdbcType=VARCHAR},
case_score = #{caseScore,jdbcType=DECIMAL}
case_score = #{caseScore,jdbcType=DECIMAL},
case_step_id = #{caseStepId,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR}
where exam_case_id = #{examCaseId,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save