【修改】 监控管理中学生分数不一致的问题
This commit is contained in:
@@ -75,12 +75,12 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode DEMO03_PAPER_SESSION_EXISTS = new ErrorCode(1_001_401_001, "请开启考场设置!");
|
||||
|
||||
// ========== 试卷方案 1-001-901-900 ==========
|
||||
ErrorCode DEMO03_PAPER_TASK_DEL_EXISTS = new ErrorCode(1-001-901-901, "该方案下已有试卷不能删除!");
|
||||
ErrorCode DEMO03_PAPER_TASK_ADD_EXISTS = new ErrorCode(1-001-901-901, "该方案下已有试卷不能新增!");
|
||||
ErrorCode DEMO03_PAPER_SCHEMES_ADD_EXISTS = new ErrorCode(1-001-902-902, "该方案下已有相同的题型!");
|
||||
ErrorCode DEMO03_PAPER_TASK_DEL_EXISTS = new ErrorCode(1_001_901_901, "该方案下已有试卷不能删除!");
|
||||
ErrorCode DEMO03_PAPER_TASK_ADD_EXISTS = new ErrorCode(1_001_901_901, "该方案下已有试卷不能新增!");
|
||||
ErrorCode DEMO03_PAPER_SCHEMES_ADD_EXISTS = new ErrorCode(1_001_902_902, "该方案下已有相同的题型!");
|
||||
// ========== 监控管理 1-001-606-000 ==========
|
||||
ErrorCode DEMO03_MONITOR_TIME_EXISTS = new ErrorCode(1-001-606-001, "该考试不在考场时间范围内!");
|
||||
ErrorCode DEMO03_MONITOR_SESSION_EXISTS = new ErrorCode(1-001-606-002, "考生状态未在考试中!请联系管理员");
|
||||
ErrorCode DEMO03_MONITOR_TIME_EXISTS = new ErrorCode(1_001_606_001, "该考试不在考场时间范围内!");
|
||||
ErrorCode DEMO03_MONITOR_SESSION_EXISTS = new ErrorCode(1_001_606_002, "考生状态未在考试中!请联系管理员");
|
||||
|
||||
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ public class FileController {
|
||||
public CommonResult<String> uploadStuFile(StuFileUploadReqVO uploadReqVO) throws Exception {
|
||||
MultipartFile file = uploadReqVO.getFile();
|
||||
String path = uploadReqVO.getPath();
|
||||
return success(fileService.createStuFile(uploadReqVO.getStuId(), uploadReqVO.getPaperId(), file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
|
||||
return success(fileService.createStuFile(uploadReqVO.getStuId(), uploadReqVO.getPaperId(), uploadReqVO.getTemporaryId(), file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
|
||||
}
|
||||
|
||||
@GetMapping("/{configId}/get/**")
|
||||
|
@@ -22,4 +22,7 @@ public class StuFileUploadReqVO {
|
||||
@Schema(description = "试卷ID")
|
||||
private String paperId;
|
||||
|
||||
@Schema(description = "临时ID,每次做题都会变")
|
||||
private String temporaryId;
|
||||
|
||||
}
|
||||
|
@@ -36,10 +36,11 @@ public interface FileService {
|
||||
*
|
||||
* @param name 文件名称
|
||||
* @param path 文件路径
|
||||
* @param temporaryId 临时ID
|
||||
* @param content 文件内容
|
||||
* @return 文件路径
|
||||
*/
|
||||
String createStuFile(Long stuId, String paperId, String name, String path, byte[] content);
|
||||
String createStuFile(Long stuId, String paperId, String temporaryId, String name, String path, byte[] content);
|
||||
|
||||
/**
|
||||
* 创建文件
|
||||
|
@@ -78,7 +78,7 @@ public class FileServiceImpl implements FileService {
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public String createStuFile(Long stuId, String paperId, String name, String path, byte[] content) {
|
||||
public String createStuFile(Long stuId, String paperId, String temporaryId, String name, String path, byte[] content) {
|
||||
// 计算默认的 path 名
|
||||
String type = FileTypeUtils.getMineType(content, name);
|
||||
if (StrUtil.isEmpty(path)) {
|
||||
@@ -88,7 +88,6 @@ public class FileServiceImpl implements FileService {
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
name = path;
|
||||
}
|
||||
|
||||
// 上传到文件存储器
|
||||
FileClient client = fileConfigService.getMasterFileClient();
|
||||
Assert.notNull(client, "客户端(master) 不能为空");
|
||||
@@ -105,19 +104,22 @@ public class FileServiceImpl implements FileService {
|
||||
fileMapper.insert(file);
|
||||
// 需要更新学生表
|
||||
// 1、先查询学生,试卷 是否已经存在数据
|
||||
List<StuPaperFileDO> stuPaperFileDOList = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId);
|
||||
List<StuPaperFileDO> stuPaperFileDOList = stuPaperFileService.findByStuIDAndPaperId(stuId, paperId, temporaryId);
|
||||
StuPaperFileDO stuPaperFileDO = null;
|
||||
// 如果查询出来数据得话,需要进行替换
|
||||
for (StuPaperFileDO fileUrl : stuPaperFileDOList) {
|
||||
if (fileUrl.getType() == 0) {
|
||||
stuPaperFileDO = fileUrl;
|
||||
}
|
||||
}
|
||||
// 如果没有查询到,需要新增
|
||||
if (stuPaperFileDO == null) {
|
||||
// 说明没有上传过,需要新增进去
|
||||
StuPaperFileDO stuPaperFile = new StuPaperFileDO();
|
||||
stuPaperFile.setPaperId(paperId);
|
||||
stuPaperFile.setStuId(stuId);
|
||||
stuPaperFile.setUrl(url);
|
||||
stuPaperFile.setTemporaryId(temporaryId);
|
||||
stuPaperFile.setType(0);
|
||||
stuPaperFileService.insertStuPaperFile(stuPaperFile);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user