【修改】 修改查询学号-试卷ID-文件得查询方法,新增类型字段

This commit is contained in:
RENWEIBING\letre
2025-05-06 17:29:30 +08:00
parent 2f3cef4be6
commit e4848fe3e4
6 changed files with 40 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
package pc.exam.pp.module.judgement.controller.admin.WpsWord;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
@@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.judgement.service.wps_excel.JudgementWpsExcelService;
import pc.exam.pp.module.judgement.service.wps_word.JudgementWpsWordService;
import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO;
@@ -27,7 +29,8 @@ public class WpsWordController {
@Autowired
private JudgementWpsWordService judgementWpsWordService;
@Resource
JudgementWpsExcelService judgementWpsExcelService;
/**
* wps word
* @return 判分
@@ -36,5 +39,13 @@ public class WpsWordController {
public CommonResult<List<WordVO>> run_wps_word(String path) throws Exception {
return CommonResult.success(judgementWpsWordService.ProgrammingWpsWord(path));
}
/**
* wps word
* @return 判分
*/
@GetMapping("/run_wps_excel")
public CommonResult<String> run_wps_excel(String path) throws Exception {
return CommonResult.success(judgementWpsExcelService.ProgrammingWpsExcel(path));
}
}

View File

@@ -18,6 +18,7 @@ import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -121,7 +122,17 @@ public class AutoToolsServiceImpl implements AutoToolsService{
public CommonResult<Double> judgementScore(Long stuId, String paperId) throws Exception {
double score = 0;
// 1、通过学号,试卷ID查询文件路径
StuPaperFileDO stuPaperFileDO = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId);
List<StuPaperFileDO> stuPaperFileDOList = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId);
StuPaperFileDO stuPaperFileDO = null;
StuPaperFileDO noZipFileDO = null;
for (StuPaperFileDO stuPaperFileDOs : stuPaperFileDOList) {
if (stuPaperFileDO.getType() == 1) {
noZipFileDO = stuPaperFileDOs;
}
if (stuPaperFileDO.getType() == 0) {
stuPaperFileDO = stuPaperFileDOs;
}
}
// 2、判断文件路径是否存在
if (stuPaperFileDO == null) {
return CommonResult.error(100031, "试题文件没有上传,无法判分!");