|
@@ -16,6 +16,7 @@ import cn.com.qmth.examcloud.core.oe.admin.service.bean.OfflineExamCourseInfo;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordDataBean;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordDataBean;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordFileAnswerInfo;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordFileAnswerInfo;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentBean;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentBean;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.uploadfile.FileInfo;
|
|
import cn.com.qmth.examcloud.core.questions.api.ExtractConfigCloudService;
|
|
import cn.com.qmth.examcloud.core.questions.api.ExtractConfigCloudService;
|
|
import cn.com.qmth.examcloud.core.questions.api.request.GetPaperReq;
|
|
import cn.com.qmth.examcloud.core.questions.api.request.GetPaperReq;
|
|
import cn.com.qmth.examcloud.core.questions.api.response.GetPaperResp;
|
|
import cn.com.qmth.examcloud.core.questions.api.response.GetPaperResp;
|
|
@@ -27,7 +28,6 @@ import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
|
|
import cn.com.qmth.examcloud.web.filestorage.FileStoragePathEnvInfo;
|
|
import cn.com.qmth.examcloud.web.filestorage.FileStoragePathEnvInfo;
|
|
import cn.com.qmth.examcloud.web.filestorage.YunPathInfo;
|
|
import cn.com.qmth.examcloud.web.filestorage.YunPathInfo;
|
|
import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
-import com.mysql.cj.util.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -263,7 +263,9 @@ public class OfflineExamServiceImpl implements OfflineExamService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
- public void submitPaper(Long examRecordDataId, File tempFile, String fileType) throws Exception {
|
|
|
|
|
|
+ public void submitPaper(Long examRecordDataId, FileInfo fileInfo) throws Exception {
|
|
|
|
+ Check.isNull(examRecordDataId, "examRecordDataId不能为空");
|
|
|
|
+
|
|
SysPropertyCacheBean stuClientLoginLimit = CacheHelper.getSysProperty("STU_CLIENT_LOGIN_LIMIT");
|
|
SysPropertyCacheBean stuClientLoginLimit = CacheHelper.getSysProperty("STU_CLIENT_LOGIN_LIMIT");
|
|
Boolean stuClientLoginLimitBoolean = false;
|
|
Boolean stuClientLoginLimitBoolean = false;
|
|
if (stuClientLoginLimit.getHasValue()) {
|
|
if (stuClientLoginLimit.getHasValue()) {
|
|
@@ -272,36 +274,30 @@ public class OfflineExamServiceImpl implements OfflineExamService {
|
|
if (stuClientLoginLimitBoolean) {
|
|
if (stuClientLoginLimitBoolean) {
|
|
throw new StatusException("4001", "系统维护中... ...");
|
|
throw new StatusException("4001", "系统维护中... ...");
|
|
}
|
|
}
|
|
- ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
|
- if (examRecordDataEntity == null) {
|
|
|
|
|
|
+
|
|
|
|
+ ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
|
+ if (examRecordData == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- ExamRecordDataBean bean = of(examRecordDataEntity);
|
|
|
|
- String fileName = tempFile.getName();
|
|
|
|
- String fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase();
|
|
|
|
|
|
|
|
//上传文件至又拍云
|
|
//上传文件至又拍云
|
|
- ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
|
- String fileNewName = createOfflineFileName(bean) + "." + fileSuffix;
|
|
|
|
|
|
+ ExamRecordDataBean bean = of(examRecordData);
|
|
|
|
+ String fileNewName = createOfflineFileName(bean) + fileInfo.getFileSuffix();
|
|
String relativePath = upyunUploadUrl + examRecordData.getExamId() + "/" + fileNewName;
|
|
String relativePath = upyunUploadUrl + examRecordData.getExamId() + "/" + fileNewName;
|
|
|
|
|
|
//通用存储
|
|
//通用存储
|
|
FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
env.setRootOrgId(String.valueOf(bean.getRootOrgId()));
|
|
env.setRootOrgId(String.valueOf(bean.getRootOrgId()));
|
|
env.setRelativePath(relativePath);
|
|
env.setRelativePath(relativePath);
|
|
- YunPathInfo pi = FileStorageUtil.saveFile("offlineFile", env, tempFile, null);
|
|
|
|
- tempFile.delete();
|
|
|
|
|
|
+ YunPathInfo pi = FileStorageUtil.saveFile("offlineFile", env, fileInfo.getFileBytes(), false);
|
|
|
|
|
|
examRecordForMarkingService.saveOffLineExamRecordForMarking(bean, fileNewName, pi.getRelativePath());
|
|
examRecordForMarkingService.saveOffLineExamRecordForMarking(bean, fileNewName, pi.getRelativePath());
|
|
- if (!StringUtils.isNullOrEmpty(fileType)) {
|
|
|
|
- fileType = fileType.toLowerCase();
|
|
|
|
- }
|
|
|
|
- saveExamRecordFileAnswer(examRecordDataId, fileName, fileNewName, pi.getRelativePath(), fileType, fileSuffix);
|
|
|
|
|
|
|
|
- //更新考试记录状态
|
|
|
|
- examRecordDataEntity.setExamRecordStatus(ExamRecordStatus.EXAM_END);
|
|
|
|
- examRecordDataEntity.setEndTime(new Date());//交卷(上传)时间
|
|
|
|
- examRecordDataRepo.save(examRecordDataEntity);
|
|
|
|
|
|
+ saveExamRecordFileAnswer(examRecordDataId, fileInfo.getOriginalFileName(), fileNewName, pi.getRelativePath(),
|
|
|
|
+ fileInfo.getFileType().toLowerCase(), fileInfo.getFileSuffix().toLowerCase());
|
|
|
|
+
|
|
|
|
+ //更新考试记录状态,交卷(上传)时间
|
|
|
|
+ examRecordDataRepo.updateExamRecordStatusById(examRecordDataId, ExamRecordStatus.EXAM_END, new Date());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|