【新增】 临时ID,防止考试数据继续互相干扰

This commit is contained in:
dlaren
2025-08-14 23:13:52 +08:00
parent b6d2594256
commit df3245a2dd
22 changed files with 477 additions and 629 deletions

446
pom.xml
View File

@@ -1,236 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.exam</groupId>
<artifactId>exam</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>stu</name>
<description>Student end grading</description>
<groupId>com.example.exam</groupId>
<artifactId>exam</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>stu</name>
<description>Student end grading</description>
<properties>
<java.version>17</java.version>
<lombok.version>1.18.30</lombok.version>
</properties>
<properties>
<java.version>17</java.version>
<lombok.version>1.18.30</lombok.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.18.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- office文件-->
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>5.2.0</version> <!-- 升级后的版本 -->
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>12.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.26.0</version> <!-- 或使用最新版本 -->
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version> <!-- 建议使用最新版 -->
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.18.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- office文件-->
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>5.2.0</version> <!-- 升级后的版本 -->
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>12.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.26.0</version> <!-- 或使用最新版本 -->
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version> <!-- 建议使用最新版 -->
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-lite</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>4.4.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-core</artifactId>
<version>11.5.4</version> <!-- 或使用最新版本 -->
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-MOXy</artifactId>
<version>11.5.4</version>
</dependency>
<!-- 必须加这个,不然 marshaltoString 会报错 -->
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-Internal</artifactId>
<version>8.3.9</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
<version>11.4.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-lite</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>4.4.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-core</artifactId>
<version>11.5.4</version> <!-- 或使用最新版本 -->
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-MOXy</artifactId>
<version>11.5.4</version>
</dependency>
<!-- 必须加这个,不然 marshaltoString 会报错 -->
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-Internal</artifactId>
<version>8.3.9</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
<version>11.4.9</version>
</dependency>
</dependencies>
</dependencies>
<build>
<!-- 设置构建的 jar 包名 -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.5.3</version>
<!-- <configuration>-->
<!-- <layout>ZIP</layout>-->
<!-- </configuration>-->
<configuration>
<mainClass>com.example.exam.exam.StuApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- <version>3.10.1</version>-->
<!-- <configuration>-->
<!-- <source>${java.version}</source>-->
<!-- <target>${java.version}</target>-->
<!-- <annotationProcessorPaths>-->
<!-- <path>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- <version>${lombok.version}</version>-->
<!-- </path>-->
<!-- </annotationProcessorPaths>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <layout>ZIP</layout>-->
<!-- <excludes>-->
<!-- <exclude>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- </exclude>-->
<!-- </excludes>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
</build>
<build>
<!-- 设置构建的 jar 包名 -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.5.3</version>
<!-- <configuration>-->
<!-- <layout>ZIP</layout>-->
<!-- </configuration>-->
<configuration>
<mainClass>com.example.exam.exam.StuApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- <version>3.10.1</version>-->
<!-- <configuration>-->
<!-- <source>${java.version}</source>-->
<!-- <target>${java.version}</target>-->
<!-- <annotationProcessorPaths>-->
<!-- <path>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- <version>${lombok.version}</version>-->
<!-- </path>-->
<!-- </annotationProcessorPaths>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <layout>ZIP</layout>-->
<!-- <excludes>-->
<!-- <exclude>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- </exclude>-->
<!-- </excludes>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
</build>
</project>

View File

@@ -1,24 +0,0 @@
package com.example.exam.exam.controller;
import com.example.exam.exam.dal.ExamAppCheck;
import com.example.exam.exam.service.appcheck.ExamAppCheckService;
import com.example.exam.exam.utils.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/exam/app")
public class ExamAppCheckController {
@Resource
ExamAppCheckService examAppCheckService;
@GetMapping("/getAppCheck")
public Result<ExamAppCheck> getAppCheckList(){
// 使用传入的IP进行ping查看是否存在连接并返回信号的强度
return Result.success(examAppCheckService.getAppList());
}
}

View File

@@ -60,7 +60,7 @@ public class AutoController {
@GetMapping("/getStuSource")
public Result<BigDecimal> getStuSource(StuInfoVo stuInfoVo){
BigDecimal source = new BigDecimal(0);
List<StuPaperScoreDO> stuPaperScoreDOList = stuPaperScoreService.findByStuIDAndPaperId(stuInfoVo.getStuId(), stuInfoVo.getPaperId());
List<StuPaperScoreDO> stuPaperScoreDOList = stuPaperScoreService.findByStuIDAndPaperId(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), stuInfoVo.getTemporaryId());
for (StuPaperScoreDO stuPaperScoreDO : stuPaperScoreDOList){
source = source.add(stuPaperScoreDO.getScore());
}

View File

@@ -31,4 +31,7 @@ public class StuInfoVo {
// 学校名称
private String schoolName;
// 随机ID
private String temporaryId;
}

View File

@@ -36,6 +36,10 @@ public class StuPaperScoreDO{
* 试题ID
*/
private String quId;
/**
* 临时ID每次做题都会变
*/
private String temporaryId;
/**
* 得分
*/

View File

@@ -15,7 +15,7 @@ import java.util.List;
@Mapper
public interface StuPaperScoreMapper extends BaseMapper<StuPaperScoreDO> {
List<StuPaperScoreDO> findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId);
List<StuPaperScoreDO> findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId, @Param("temporaryId") String temporaryId);
// 通过学生ID试卷ID 试题ID查询数据
StuPaperScoreDO findByStuIdAndPaperIdAndQuestionId(@Param("stuId") Long stuId, @Param("paperId") String paperId, @Param("quId") String questionId);

View File

@@ -19,7 +19,6 @@ public class ExamAppCheckServiceImpl implements ExamAppCheckService {
@Override
public ExamAppCheck getAppList() {
ExamAppCheck appList = examAppCheckMapper.selectById("1");
return appList;
return examAppCheckMapper.selectById("1");
}
}

View File

@@ -40,8 +40,10 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
SystemTenantService systemTenantService;
@Autowired
private EducationPaperMapper educationPaperMapper;
/**
* 自动判题选择题
*
* @param stuInfoVo 学生考试信息
* @return 是否通过
*/
@@ -54,13 +56,13 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
String edgeAnswerValue = stuInfoVo.getEdgeAnswerValues();
// 保存ID路径
String filePath = stuInfoVo.getFilePath();
File file = new File(filePath + "/"+ quId +"@EdgeDummy.json");
File file = new File(filePath + "/" + quId + "@EdgeDummy.json");
if (!file.exists()) {
LogFileUtils.createFile(filePath + "/"+ quId +"@EdgeDummy.json");
LogFileUtils.createFile(filePath + "/" + quId + "@EdgeDummy.json");
}
Map<String, String> map = new HashMap<>();
map.put(edgeAnswerKey, edgeAnswerValue);
return writeMapToJson(map, filePath + "/"+ quId +"@EdgeDummy.json");
return writeMapToJson(map, filePath + "/" + quId + "@EdgeDummy.json");
}
@Override
@@ -105,7 +107,7 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
}
}
// 查询哪些文件已经进行获取到学生作答文件了
for (String str: trueFileQuid) {
for (String str : trueFileQuid) {
// 查询到学生文件
Optional<File> fileResult = resultFile.stream().filter(resultFiles -> resultFiles.getName().contains(str)).findFirst();
if (fileResult.isPresent()) {
@@ -174,33 +176,20 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
}
}
judgementStr += "<p>试题得分: " + oneScore + " </p>";
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(oneScore));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName("windows网络设置");
int isTrue = oneScore == 0 ? 1 : oneScore == Double.parseDouble(quScore) ? 0 : 2;
stuPaperScoreDO.setIsTrue(isTrue);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(oneScore));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("windows网络设置");
int isTrue = oneScore == 0 ? 1 : oneScore == Double.parseDouble(quScore) ? 0 : 2;
insertInfo.setIsTrue(isTrue);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(oneScore));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("windows网络设置");
int isTrue = oneScore == 0 ? 1 : oneScore == Double.parseDouble(quScore) ? 0 : 2;
insertInfo.setIsTrue(isTrue);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
if (fileInputStream != null) {
try {
fileInputStream.close();
@@ -215,7 +204,7 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
}
}
// 没有作答的题目直接0分
for (String str: noFileQuid) {
for (String str : noFileQuid) {
String quId = str;
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperQu> resultss = educationPaperQus.stream().filter(entry -> entry.getQuId().equals(quId))

View File

@@ -34,8 +34,10 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
/**
* 自动判题文件处理
*
* @param stuInfoVo 学生考试信息
* @return 是否通过
*/
@@ -65,35 +67,22 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
// 3、根据题号进行查询试题的相关信息
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = judgementBrowerService.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
// 3、根据题号进行查询试题的相关信息
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = judgementBrowerService.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -104,10 +93,10 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
break;
}
}
}

View File

@@ -32,8 +32,10 @@ public class AutoForCServiceImpl implements AutoForCService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
/**
* 自动判题C语言
*
* @param stuInfoVo 学生考试信息
* @return 是否通过
*/
@@ -56,7 +58,7 @@ public class AutoForCServiceImpl implements AutoForCService {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quNumber = stFile.getName();
String quNumber = stFile.getName();
// 需要根据题号获取试题ID
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuNumber(quNumber);
String quId = examQuestion.getQuId();
@@ -81,33 +83,21 @@ public class AutoForCServiceImpl implements AutoForCService {
BigDecimal dangSource = new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
judgementStr += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
// 直接进行新增,不需要进行更新
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
break;
}
}

View File

@@ -38,8 +38,10 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
SystemTenantService systemTenantService;
@Autowired
private EducationPaperMapper educationPaperMapper;
/**
* 自动判题选择题
*
* @param stuInfoVo 学生考试信息
* @return 是否通过
*/
@@ -138,31 +140,19 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
judgementStr += "<p>得分0 </p>";
isRight = false;
}
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(isRight ? new BigDecimal(quScore) : new BigDecimal(0));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName("选择题");
stuPaperScoreDO.setIsTrue(isRight ? 0 : 1);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(isRight ? new BigDecimal(quScore) : new BigDecimal(0));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("选择题");
insertInfo.setIsTrue(isRight ? 0 : 1);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(isRight ? new BigDecimal(quScore) : new BigDecimal(0));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("选择题");
insertInfo.setIsTrue(isRight ? 0 : 1);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
} else {
// 根据ID查询试题
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
@@ -182,31 +172,19 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
judgementStr += "<p>学生答案: 未作答 </p>";
judgementStr += "<p>正确答案:" + trueAbswerSort + "</p>";
judgementStr += "<p>得分0 </p>";
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(0));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName("选择题");
stuPaperScoreDO.setIsTrue(1);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(0));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("选择题");
insertInfo.setIsTrue(1);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(0));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("选择题");
insertInfo.setIsTrue(1);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
}
if (fileInputStream != null) {
@@ -244,31 +222,19 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
judgementStr += "<p>学生答案: 未作答 </p>";
judgementStr += "<p>正确答案:" + trueAbswerSort + "</p>";
judgementStr += "<p>得分0 </p>";
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(0));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName("选择题");
stuPaperScoreDO.setIsTrue(1);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(0));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("选择题");
insertInfo.setIsTrue(1);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(0));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName("选择题");
insertInfo.setIsTrue(1);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
}
return score;
@@ -309,7 +275,6 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
}
public static String convertToLetter(int number) {
// 判断是否在 1 到 26 的范围内
if (number >= 1 && number <= 26) {

View File

@@ -40,8 +40,10 @@ public class AutoForFileServiceImpl implements AutoForFileService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
/**
* 自动判题文件处理
*
* @param stuInfoVo 学生考试信息
* @return 是否通过
*/
@@ -77,43 +79,30 @@ public class AutoForFileServiceImpl implements AutoForFileService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
break;
}
}
}

View File

@@ -34,8 +34,10 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
/**
* 自动判题C语言
*
* @param stuInfoVo 学生考试信息
* @return 是否通过
*/
@@ -67,53 +69,40 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
// 3、根据题号进行查询试题的相关信息
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
if (wjFile.getName().contains(".sql")) {
// 3、根据题号进行查询试题的相关信息
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
if (wjFile.getName().contains(".sql")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = mysqlLocalService.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
System.out.println(judgementStr);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = mysqlLocalService.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
System.out.println(judgementStr);
}
break;
break;
}
}

View File

@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Optional;
@Service
public class AutoForPsServiceImpl implements AutoForPsService{
public class AutoForPsServiceImpl implements AutoForPsService {
@Resource
PsService psService;
@@ -77,33 +77,20 @@ public class AutoForPsServiceImpl implements AutoForPsService{
score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = wordpojo.getText();
judgementStr += "<p>试题得分:" + wordpojo.getScore() + "</p>";
// 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
break;
}
}

View File

@@ -27,8 +27,8 @@ import java.util.*;
import java.util.stream.Collectors;
@Service
public class PsServiceImpl implements PsService{
static String answerLogPath ; // 文件路径
public class PsServiceImpl implements PsService {
static String answerLogPath; // 文件路径
@Resource
private ExamQuestionAnswerMapper examQuestionAnswerMapper;
private static final DateTimeFormatter formatter =
@@ -61,11 +61,11 @@ public class PsServiceImpl implements PsService{
String sthJsonPath = path.replaceAll("(?i)\\.psd$", ".json");
Path jsonFilePath = Paths.get(sthJsonPath);
Path jsxPath=null;
Path jsxPath = null;
// 执行 Photoshop 脚本
try {
String jsxTargetPath= PsUtil.runTwoPsdsInOneScript(path, jsxTemplatePath, photoshopExe);
jsxPath = Paths.get(jsxTargetPath);
String jsxTargetPath = PsUtil.runTwoPsdsInOneScript(path, jsxTemplatePath, photoshopExe);
jsxPath = Paths.get(jsxTargetPath);
appendToFile(answerLogPath, "Photoshop脚本执行完毕");
} catch (Exception e) {
@@ -103,7 +103,7 @@ public class PsServiceImpl implements PsService{
sourceAndText.setText(judgementStr);
sourceAndText.setScore(0.0);
return sourceAndText;
}finally {
} finally {
// 检查文件是否存在
if (Files.exists(jsonFilePath)) {
try {
@@ -141,11 +141,11 @@ public class PsServiceImpl implements PsService{
if (isCorrect) {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, currentPath + "" + correctValue + "】【✅】");
appendToFile(answerLogPath, currentPath + "" + correctValue + ""+"【√】");
appendToFile(answerLogPath, currentPath + "" + correctValue + "" + "【√】");
result.setScore(result.getScore() + Double.parseDouble(item.getRate()));
} else {
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, currentPath + "" + correctValue + ""+"【❌】");
appendToFile(answerLogPath, currentPath + "" + correctValue + ""+"【×】");
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, currentPath + "" + correctValue + "" + "【❌】");
appendToFile(answerLogPath, currentPath + "" + correctValue + "" + "【×】");
}
result.setText(judgementStr);
@@ -220,9 +220,6 @@ public class PsServiceImpl implements PsService{
}
/**
* 构建答案树形结构
*/

View File

@@ -12,7 +12,7 @@ import java.util.List;
*/
public interface StuPaperScoreService {
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId);
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId, String temporaryId);
void insertStuPaperScore(StuPaperScoreDO stuPaperScoreDO);

View File

@@ -25,8 +25,8 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
private EducationPaperMapper educationPaperMapper;
@Override
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId) {
return stuPaperScoreMapper.findByStuIdAndPaperId(stuId, paperId);
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId, String temporaryId) {
return stuPaperScoreMapper.findByStuIdAndPaperId(stuId, paperId, temporaryId);
}
@Override

View File

@@ -83,33 +83,20 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
judgementStr = excelpojo.getText();
BigDecimal dangSource = new BigDecimal(excelpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
judgementStr += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
// 4、需要新增生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
break;
}
}

View File

@@ -83,33 +83,20 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
judgementStr = pptxpojo.getText();
BigDecimal dangSource = new BigDecimal(pptxpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
judgementStr += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
// 4、需要新增生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
break;
}
}

View File

@@ -46,10 +46,9 @@ public class EndNoteing {
}
/**
* 获取尾注内容
* "declare namespace w='http://schemas.openxmlformats.org/wordprocessingml/2006/main' "
* "declare namespace w='http://schemas.openxmlformats.org/wordprocessingml/2006/main' "
*/
public static String getEndNoteContent(XmlCursor endnoteRefCursor, CTEndnotes endnotes) {
if (endnoteRefCursor == null || endnotes == null) return null;
@@ -114,5 +113,4 @@ public class EndNoteing {
}
}

View File

@@ -80,33 +80,20 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
judgementStr = wordpojo.getText();
BigDecimal dangSource = new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
judgementStr += "<p>试题得分:" + dangSource + "</p>";
// 4、需要新学生试题得分,首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
// 4、需要新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
break;
}
}

View File

@@ -9,13 +9,25 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="findByStuIdAndPaperId" resultType="com.example.exam.exam.dal.StuPaperScoreDO">
SELECT * FROM exam_stu_paper_score WHERE stu_id = #{stuId} AND paper_id = #{paperId} order by sort ASC
SELECT *
FROM exam_stu_paper_score
WHERE stu_id = #{stuId}
AND paper_id = #{paperId}
AND temporary_id = #{temporaryId}
order by sort ASC
</select>
<select id="findByStuIdAndPaperIdAndQuestionId" resultType="com.example.exam.exam.dal.StuPaperScoreDO">
SELECT * FROM exam_stu_paper_score WHERE stu_id = #{stuId} AND paper_id = #{paperId} AND qu_id = #{quId}
SELECT *
FROM exam_stu_paper_score
WHERE stu_id = #{stuId}
AND paper_id = #{paperId}
AND qu_id = #{quId}
</select>
<delete id="deleteByStuIdAndPaperId">
DELETE FROM exam_stu_paper_score WHERE stu_id = #{stuId} AND paper_id = #{paperId}
DELETE
FROM exam_stu_paper_score
WHERE stu_id = #{stuId}
AND paper_id = #{paperId}
</delete>