From b27c25847dbf344efa2e8c6b3295e32098825279 Mon Sep 17 00:00:00 2001 From: yz <3614508250@qq.com> Date: Tue, 23 Apr 2024 14:35:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=80=83=E8=AF=95=E6=A1=88?= =?UTF-8?q?=E4=BE=8B=E9=A2=98=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E3=80=81?= =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=A1=88=E4=BE=8B=E8=AE=B0=E5=BD=95=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../financial_bigdata/config/Constant.java | 2 - .../controller/stu/TheoryTestController.java | 34 +- .../entity/StuTrainingStepRecord.java | 64 +++ .../entity/StuTrainingStepRecordExample.java | 479 ++++++++++++++++++ .../entity/stu_dto/StuCommitCaseDto.java | 26 + .../stu_dto/StuTheoryTestRecordDto.java | 20 + .../mapper/StuTrainingStepRecordMapper.java | 38 ++ .../stu/impl/TheoryTestServiceImpl.java | 13 +- src/main/resources/application.yml | 2 +- .../mapper/StuTrainingStepRecordMapper.xml | 251 +++++++++ 10 files changed, 918 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecord.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecordExample.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuCommitCaseDto.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryTestRecordDto.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/mapper/StuTrainingStepRecordMapper.java create mode 100644 src/main/resources/mapper/StuTrainingStepRecordMapper.xml diff --git a/src/main/java/com/sztzjy/financial_bigdata/config/Constant.java b/src/main/java/com/sztzjy/financial_bigdata/config/Constant.java index 8264f51..be7de89 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/config/Constant.java +++ b/src/main/java/com/sztzjy/financial_bigdata/config/Constant.java @@ -33,6 +33,4 @@ public class Constant { public static final String THEORY = "理论考试模块"; public static final String RESOURCE = "资源中心模块"; - private String aaa="aaa"; - private String aadadwada="cccaaa"; } diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java index 1025d20..bd98c4f 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/TheoryTestController.java @@ -4,12 +4,12 @@ package com.sztzjy.financial_bigdata.controller.stu; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; -import com.sztzjy.financial_bigdata.entity.StuTheoryExam; -import com.sztzjy.financial_bigdata.entity.StuTheoryRecord; -import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion; +import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto; import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto; +import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestRecordDto; import com.sztzjy.financial_bigdata.mapper.StuTheoryRecordMapper; +import com.sztzjy.financial_bigdata.mapper.StuUserMapper; import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService; import com.sztzjy.financial_bigdata.util.ResultEntity; import io.swagger.annotations.Api; @@ -30,6 +30,8 @@ public class TheoryTestController { ITheoryTestService theoryTestService; @Autowired StuTheoryRecordMapper recordMapper; + @Autowired + StuUserMapper userMapper; //开始考试 选择 35道单选,每题2分,5道多选每题4分,10道判断每题1分 @GetMapping("startTheoryTest") @@ -124,9 +126,31 @@ public class TheoryTestController { @GetMapping("getTheoryRecord") @ApiOperation("获取理论考试记录数据") @AnonymousAccess - public ResultEntity getTheoryRecord(String userId){ + public ResultEntity getTheoryRecord(String userId){ + StuUser stuUser = userMapper.selectByPrimaryKey(userId); + String schoolId = stuUser.getSchoolId(); + //查询该学校下的所有平均分 按高低排序 + StuTheoryRecordExample example = new StuTheoryRecordExample(); + example.createCriteria().andSchoolIdEqualTo(schoolId); + example.setOrderByClause("average_score desc"); + List stuTheoryRecords = recordMapper.selectByExample(example); + Integer paiming=null; + if(stuTheoryRecords==null){ + return null; + }else { + for (int i = 0; i < stuTheoryRecords.size(); i++) { + if(stuTheoryRecords.get(i).getUserId().equals(userId)){ + paiming= i+1; + } + } + } StuTheoryRecord stuTheoryRecord = recordMapper.selectByPrimaryKey(userId); - return new ResultEntity<>(HttpStatus.OK, "获取理论考试记录数据成功",stuTheoryRecord); + StuTheoryTestRecordDto stuTheoryRecordDto = new StuTheoryTestRecordDto(); + stuTheoryRecordDto.setExamCount(stuTheoryRecord.getExamCount()); + stuTheoryRecordDto.setAverageScore(stuTheoryRecord.getAverageScore()); + stuTheoryRecordDto.setRank(paiming); + + return new ResultEntity<>(HttpStatus.OK, "获取理论考试记录数据成功",stuTheoryRecordDto); } } diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecord.java b/src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecord.java new file mode 100644 index 0000000..3504c54 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecord.java @@ -0,0 +1,64 @@ +package com.sztzjy.financial_bigdata.entity; + +import io.swagger.annotations.ApiModelProperty; +/** + * + * @author xcj + * stu_training_step_record + */ +public class StuTrainingStepRecord { + @ApiModelProperty("学生实训 案例题步骤记录id") + private String recordId; + + @ApiModelProperty("用户id") + private String userId; + + @ApiModelProperty("案例题id") + private String caseId; + + @ApiModelProperty("案例题步骤id") + private String caseStepId; + + @ApiModelProperty("学生答案") + private String stuAnswer; + + public String getRecordId() { + return recordId; + } + + public void setRecordId(String recordId) { + this.recordId = recordId == null ? null : recordId.trim(); + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId == null ? null : userId.trim(); + } + + public String getCaseId() { + return caseId; + } + + public void setCaseId(String caseId) { + this.caseId = caseId == null ? null : caseId.trim(); + } + + public String getCaseStepId() { + return caseStepId; + } + + public void setCaseStepId(String caseStepId) { + this.caseStepId = caseStepId == null ? null : caseStepId.trim(); + } + + public String getStuAnswer() { + return stuAnswer; + } + + public void setStuAnswer(String stuAnswer) { + this.stuAnswer = stuAnswer == null ? null : stuAnswer.trim(); + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecordExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecordExample.java new file mode 100644 index 0000000..821ee14 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/StuTrainingStepRecordExample.java @@ -0,0 +1,479 @@ +package com.sztzjy.financial_bigdata.entity; + +import java.util.ArrayList; +import java.util.List; + +public class StuTrainingStepRecordExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public StuTrainingStepRecordExample() { + oredCriteria = new ArrayList<>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andRecordIdIsNull() { + addCriterion("record_id is null"); + return (Criteria) this; + } + + public Criteria andRecordIdIsNotNull() { + addCriterion("record_id is not null"); + return (Criteria) this; + } + + public Criteria andRecordIdEqualTo(String value) { + addCriterion("record_id =", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdNotEqualTo(String value) { + addCriterion("record_id <>", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdGreaterThan(String value) { + addCriterion("record_id >", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdGreaterThanOrEqualTo(String value) { + addCriterion("record_id >=", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdLessThan(String value) { + addCriterion("record_id <", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdLessThanOrEqualTo(String value) { + addCriterion("record_id <=", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdLike(String value) { + addCriterion("record_id like", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdNotLike(String value) { + addCriterion("record_id not like", value, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdIn(List values) { + addCriterion("record_id in", values, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdNotIn(List values) { + addCriterion("record_id not in", values, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdBetween(String value1, String value2) { + addCriterion("record_id between", value1, value2, "recordId"); + return (Criteria) this; + } + + public Criteria andRecordIdNotBetween(String value1, String value2) { + addCriterion("record_id not between", value1, value2, "recordId"); + 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 values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List 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 Criteria andCaseIdIsNull() { + addCriterion("case_id is null"); + return (Criteria) this; + } + + public Criteria andCaseIdIsNotNull() { + addCriterion("case_id is not null"); + return (Criteria) this; + } + + public Criteria andCaseIdEqualTo(String value) { + addCriterion("case_id =", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotEqualTo(String value) { + addCriterion("case_id <>", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdGreaterThan(String value) { + addCriterion("case_id >", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdGreaterThanOrEqualTo(String value) { + addCriterion("case_id >=", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdLessThan(String value) { + addCriterion("case_id <", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdLessThanOrEqualTo(String value) { + addCriterion("case_id <=", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdLike(String value) { + addCriterion("case_id like", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotLike(String value) { + addCriterion("case_id not like", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdIn(List values) { + addCriterion("case_id in", values, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotIn(List values) { + addCriterion("case_id not in", values, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdBetween(String value1, String value2) { + addCriterion("case_id between", value1, value2, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotBetween(String value1, String value2) { + addCriterion("case_id not between", value1, value2, "caseId"); + 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 values) { + addCriterion("case_step_id in", values, "caseStepId"); + return (Criteria) this; + } + + public Criteria andCaseStepIdNotIn(List 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 static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuCommitCaseDto.java b/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuCommitCaseDto.java new file mode 100644 index 0000000..9c10008 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuCommitCaseDto.java @@ -0,0 +1,26 @@ +package com.sztzjy.financial_bigdata.entity.stu_dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class StuCommitCaseDto { + @ApiModelProperty("用户id") + private String userId; + + @ApiModelProperty("学生实训id") + private String stuTrainingId; + + @ApiModelProperty("案例题id") + private String caseId; + + @ApiModelProperty("案例题步骤id") + private String caseStepId; + + @ApiModelProperty("学生答案") + private String stuAnswer; + + +} diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryTestRecordDto.java b/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryTestRecordDto.java new file mode 100644 index 0000000..40ce8b0 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/stu_dto/StuTheoryTestRecordDto.java @@ -0,0 +1,20 @@ +package com.sztzjy.financial_bigdata.entity.stu_dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@NoArgsConstructor +public class StuTheoryTestRecordDto { + @ApiModelProperty("考试次数") + private Integer examCount; + + @ApiModelProperty("平均分") + private BigDecimal averageScore; + + @ApiModelProperty("排名") + private Integer rank; +} diff --git a/src/main/java/com/sztzjy/financial_bigdata/mapper/StuTrainingStepRecordMapper.java b/src/main/java/com/sztzjy/financial_bigdata/mapper/StuTrainingStepRecordMapper.java new file mode 100644 index 0000000..3234626 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/mapper/StuTrainingStepRecordMapper.java @@ -0,0 +1,38 @@ +package com.sztzjy.financial_bigdata.mapper; + +import com.sztzjy.financial_bigdata.entity.StuTrainingStepRecord; +import com.sztzjy.financial_bigdata.entity.StuTrainingStepRecordExample; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface StuTrainingStepRecordMapper { + long countByExample(StuTrainingStepRecordExample example); + + int deleteByExample(StuTrainingStepRecordExample example); + + int deleteByPrimaryKey(String recordId); + + int insert(StuTrainingStepRecord record); + + int insertSelective(StuTrainingStepRecord record); + + List selectByExampleWithBLOBs(StuTrainingStepRecordExample example); + + List selectByExample(StuTrainingStepRecordExample example); + + StuTrainingStepRecord selectByPrimaryKey(String recordId); + + int updateByExampleSelective(@Param("record") StuTrainingStepRecord record, @Param("example") StuTrainingStepRecordExample example); + + int updateByExampleWithBLOBs(@Param("record") StuTrainingStepRecord record, @Param("example") StuTrainingStepRecordExample example); + + int updateByExample(@Param("record") StuTrainingStepRecord record, @Param("example") StuTrainingStepRecordExample example); + + int updateByPrimaryKeySelective(StuTrainingStepRecord record); + + int updateByPrimaryKeyWithBLOBs(StuTrainingStepRecord record); + + int updateByPrimaryKey(StuTrainingStepRecord record); +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java index 671e891..80b93f6 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java +++ b/src/main/java/com/sztzjy/financial_bigdata/service/stu/impl/TheoryTestServiceImpl.java @@ -47,6 +47,10 @@ public class TheoryTestServiceImpl implements ITheoryTestService { StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0); Date currentTime = new Date(); Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时 + if(stuTheoryExam.getAnswered()){ + List objectiveQuestionList = GenerateTest(userId); + return objectiveQuestionList; + } if (stuTheoryExam.getExamTime().before(twoHoursAgo)) { //已超出两个小时 从新生成新试卷 List objectiveQuestionList = GenerateTest(userId); return objectiveQuestionList; @@ -199,7 +203,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService { errorMapper.insert(stuError); } else { StuErrorWithBLOBs stuError = stuErrors.get(0); - if (!stuError.getSingleIds().isEmpty()) { + if (stuError.getSingleIds()!=null) { List stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", ")); List singleErrorIds = theoryTestDto.getSingleErrorIds(); @@ -211,7 +215,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService { } else { stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds())); } - if (!stuError.getMultipleIds().isEmpty()) { + if (stuError.getMultipleIds()!=null) { List stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", ")); List multipleErrorIds = theoryTestDto.getMultipleErrorIds(); @@ -223,7 +227,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService { } else { stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds())); } - if (!stuError.getJudgeIds().isEmpty()) { + if (stuError.getJudgeIds()!=null) { List stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", ")); List judgeErrorIds = theoryTestDto.getJudgeErrorIds(); List combinedList = new ArrayList<>(stringList); @@ -388,6 +392,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService { return null; } else { //根据考试时间排序 查询最近的一条 StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0); + if(stuTheoryExam.getAnswered()){ + return null; + } Date currentTime = new Date(); Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时 if (stuTheoryExam.getExamTime().before(twoHoursAgo)) { //已超出两个小时 从新生成新试卷 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 0afff0a..952bceb 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -80,6 +80,6 @@ spring: mybatis: type-aliases-package: com.sztzjy.financial_bigdata.entity - mapper-locations: classpath*:/mappers/*.xml + mapper-locations: classpath*:/mapper/*.xml diff --git a/src/main/resources/mapper/StuTrainingStepRecordMapper.xml b/src/main/resources/mapper/StuTrainingStepRecordMapper.xml new file mode 100644 index 0000000..f282450 --- /dev/null +++ b/src/main/resources/mapper/StuTrainingStepRecordMapper.xml @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + record_id, user_id, case_id, case_step_id + + + stu_answer + + + + + + delete from stu_training_step_record + where record_id = #{recordId,jdbcType=VARCHAR} + + + delete from stu_training_step_record + + + + + + insert into stu_training_step_record (record_id, user_id, case_id, + case_step_id, stu_answer) + values (#{recordId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR}, + #{caseStepId,jdbcType=VARCHAR}, #{stuAnswer,jdbcType=LONGVARCHAR}) + + + insert into stu_training_step_record + + + record_id, + + + user_id, + + + case_id, + + + case_step_id, + + + stu_answer, + + + + + #{recordId,jdbcType=VARCHAR}, + + + #{userId,jdbcType=VARCHAR}, + + + #{caseId,jdbcType=VARCHAR}, + + + #{caseStepId,jdbcType=VARCHAR}, + + + #{stuAnswer,jdbcType=LONGVARCHAR}, + + + + + + update stu_training_step_record + + + record_id = #{record.recordId,jdbcType=VARCHAR}, + + + user_id = #{record.userId,jdbcType=VARCHAR}, + + + case_id = #{record.caseId,jdbcType=VARCHAR}, + + + case_step_id = #{record.caseStepId,jdbcType=VARCHAR}, + + + stu_answer = #{record.stuAnswer,jdbcType=LONGVARCHAR}, + + + + + + + + update stu_training_step_record + set record_id = #{record.recordId,jdbcType=VARCHAR}, + user_id = #{record.userId,jdbcType=VARCHAR}, + case_id = #{record.caseId,jdbcType=VARCHAR}, + case_step_id = #{record.caseStepId,jdbcType=VARCHAR}, + stu_answer = #{record.stuAnswer,jdbcType=LONGVARCHAR} + + + + + + update stu_training_step_record + set record_id = #{record.recordId,jdbcType=VARCHAR}, + user_id = #{record.userId,jdbcType=VARCHAR}, + case_id = #{record.caseId,jdbcType=VARCHAR}, + case_step_id = #{record.caseStepId,jdbcType=VARCHAR} + + + + + + update stu_training_step_record + + + user_id = #{userId,jdbcType=VARCHAR}, + + + case_id = #{caseId,jdbcType=VARCHAR}, + + + case_step_id = #{caseStepId,jdbcType=VARCHAR}, + + + stu_answer = #{stuAnswer,jdbcType=LONGVARCHAR}, + + + where record_id = #{recordId,jdbcType=VARCHAR} + + + update stu_training_step_record + set user_id = #{userId,jdbcType=VARCHAR}, + case_id = #{caseId,jdbcType=VARCHAR}, + case_step_id = #{caseStepId,jdbcType=VARCHAR}, + stu_answer = #{stuAnswer,jdbcType=LONGVARCHAR} + where record_id = #{recordId,jdbcType=VARCHAR} + + + update stu_training_step_record + set user_id = #{userId,jdbcType=VARCHAR}, + case_id = #{caseId,jdbcType=VARCHAR}, + case_step_id = #{caseStepId,jdbcType=VARCHAR} + where record_id = #{recordId,jdbcType=VARCHAR} + + \ No newline at end of file