【修改】 修改查询学号-试卷ID-文件得查询方法,新增类型字段
This commit is contained in:
@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学生-试卷-文件 Mapper
|
* 学生-试卷-文件 Mapper
|
||||||
*
|
*
|
||||||
@@ -13,6 +15,6 @@ import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface StuPaperFileMapper extends BaseMapperX<StuPaperFileDO> {
|
public interface StuPaperFileMapper extends BaseMapperX<StuPaperFileDO> {
|
||||||
StuPaperFileDO findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
List<StuPaperFileDO> findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||||
|
|
||||||
}
|
}
|
@@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface StuPaperFileService {
|
public interface StuPaperFileService {
|
||||||
|
|
||||||
StuPaperFileDO findByStuIDAndPaperId(Long stuID, String paperID);
|
List<StuPaperFileDO> findByStuIDAndPaperId(Long stuID, String paperID);
|
||||||
|
|
||||||
void insertStuPaperFile(StuPaperFileDO stuPaperFileDO);
|
void insertStuPaperFile(StuPaperFileDO stuPaperFileDO);
|
||||||
|
|
||||||
|
@@ -6,6 +6,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
||||||
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperFileMapper;
|
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperFileMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学生-试卷-文件 Service 实现类
|
* 学生-试卷-文件 Service 实现类
|
||||||
*
|
*
|
||||||
@@ -19,7 +21,7 @@ public class StuPaperFileServiceImpl implements StuPaperFileService {
|
|||||||
private StuPaperFileMapper stuPaperFileMapper;
|
private StuPaperFileMapper stuPaperFileMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StuPaperFileDO findByStuIDAndPaperId(Long stuID, String paperID) {
|
public List<StuPaperFileDO> findByStuIDAndPaperId(Long stuID, String paperID) {
|
||||||
return stuPaperFileMapper.findByStuIdAndPaperId(stuID, paperID);
|
return stuPaperFileMapper.findByStuIdAndPaperId(stuID, paperID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,8 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static pc.exam.pp.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static pc.exam.pp.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
import static pc.exam.pp.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||||
|
|
||||||
@@ -103,7 +105,13 @@ public class FileServiceImpl implements FileService {
|
|||||||
fileMapper.insert(file);
|
fileMapper.insert(file);
|
||||||
// 需要更新学生表
|
// 需要更新学生表
|
||||||
// 1、先查询学生,试卷 是否已经存在数据
|
// 1、先查询学生,试卷 是否已经存在数据
|
||||||
StuPaperFileDO stuPaperFileDO = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId);
|
List<StuPaperFileDO> stuPaperFileDOList = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId);
|
||||||
|
StuPaperFileDO stuPaperFileDO = null;
|
||||||
|
for (StuPaperFileDO fileUrl : stuPaperFileDOList) {
|
||||||
|
if (fileUrl.getType() == 0) {
|
||||||
|
stuPaperFileDO = fileUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (stuPaperFileDO == null) {
|
if (stuPaperFileDO == null) {
|
||||||
// 说明没有上传过,需要新增进去
|
// 说明没有上传过,需要新增进去
|
||||||
StuPaperFileDO stuPaperFile = new StuPaperFileDO();
|
StuPaperFileDO stuPaperFile = new StuPaperFileDO();
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package pc.exam.pp.module.judgement.controller.admin.WpsWord;
|
package pc.exam.pp.module.judgement.controller.admin.WpsWord;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import pc.exam.pp.framework.common.pojo.CommonResult;
|
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.service.wps_word.JudgementWpsWordService;
|
||||||
import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO;
|
import pc.exam.pp.module.judgement.utils.wps_word.vo.WordVO;
|
||||||
|
|
||||||
@@ -27,7 +29,8 @@ public class WpsWordController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private JudgementWpsWordService judgementWpsWordService;
|
private JudgementWpsWordService judgementWpsWordService;
|
||||||
|
@Resource
|
||||||
|
JudgementWpsExcelService judgementWpsExcelService;
|
||||||
/**
|
/**
|
||||||
* wps word
|
* wps word
|
||||||
* @return 判分
|
* @return 判分
|
||||||
@@ -36,5 +39,13 @@ public class WpsWordController {
|
|||||||
public CommonResult<List<WordVO>> run_wps_word(String path) throws Exception {
|
public CommonResult<List<WordVO>> run_wps_word(String path) throws Exception {
|
||||||
return CommonResult.success(judgementWpsWordService.ProgrammingWpsWord(path));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ import java.math.BigDecimal;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.util.List;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
@@ -121,7 +122,17 @@ public class AutoToolsServiceImpl implements AutoToolsService{
|
|||||||
public CommonResult<Double> judgementScore(Long stuId, String paperId) throws Exception {
|
public CommonResult<Double> judgementScore(Long stuId, String paperId) throws Exception {
|
||||||
double score = 0;
|
double score = 0;
|
||||||
// 1、通过学号,试卷ID查询文件路径
|
// 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、判断文件路径是否存在
|
// 2、判断文件路径是否存在
|
||||||
if (stuPaperFileDO == null) {
|
if (stuPaperFileDO == null) {
|
||||||
return CommonResult.error(100031, "试题文件没有上传,无法判分!");
|
return CommonResult.error(100031, "试题文件没有上传,无法判分!");
|
||||||
|
Reference in New Issue
Block a user