【新增】 临时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

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,19 +176,6 @@ 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());
@@ -198,9 +187,9 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
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 是否通过
*/
@@ -80,20 +82,7 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
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 {
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -104,9 +93,9 @@ 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;
}
}

View File

@@ -32,8 +32,10 @@ public class AutoForCServiceImpl implements AutoForCService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
/**
* 自动判题C语言
*
* @param stuInfoVo 学生考试信息
* @return 是否通过
*/
@@ -81,20 +83,8 @@ 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());
@@ -105,9 +95,9 @@ public class AutoForCServiceImpl implements AutoForCService {
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,18 +140,6 @@ 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());
@@ -160,9 +150,9 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
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,18 +172,6 @@ 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());
@@ -204,11 +182,11 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
insertInfo.setSubjectName("选择题");
insertInfo.setIsTrue(1);
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
}
}
if (fileInputStream != null) {
try {
fileInputStream.close();
@@ -244,18 +222,6 @@ 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());
@@ -266,11 +232,11 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
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 是否通过
*/
@@ -86,20 +88,7 @@ public class AutoForFileServiceImpl implements AutoForFileService {
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 {
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -110,9 +99,9 @@ public class AutoForFileServiceImpl implements AutoForFileService {
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 是否通过
*/
@@ -84,20 +86,7 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
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 {
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -108,9 +97,9 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
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;

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,20 +77,7 @@ 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 {
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -101,9 +88,9 @@ public class AutoForPsServiceImpl implements AutoForPsService{
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,10 +61,10 @@ 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);
String jsxTargetPath = PsUtil.runTwoPsdsInOneScript(path, jsxTemplatePath, photoshopExe);
jsxPath = Paths.get(jsxTargetPath);
appendToFile(answerLogPath, "Photoshop脚本执行完毕");
@@ -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,20 +83,7 @@ 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 {
// 4、需要新增生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -107,9 +94,9 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
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,20 +83,7 @@ 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 {
// 4、需要新增生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -107,9 +94,9 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
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,7 +46,6 @@ public class EndNoteing {
}
/**
* 获取尾注内容
* "declare namespace w='http://schemas.openxmlformats.org/wordprocessingml/2006/main' "
@@ -114,5 +113,4 @@ public class EndNoteing {
}
}

View File

@@ -80,20 +80,7 @@ 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 {
// 4、需要新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -104,9 +91,9 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
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>