|
@@ -6,6 +6,7 @@ import java.util.List;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.qmth.boot.core.exception.ParameterException;
|
|
|
import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
|
|
|
+import com.qmth.teachcloud.mark.bean.UriVo;
|
|
|
import com.qmth.teachcloud.mark.bean.answercard.AnswerCardSaveDomain;
|
|
|
import com.qmth.teachcloud.mark.bean.answercard.AnswerCardVo;
|
|
|
import com.qmth.teachcloud.mark.bean.answercard.CardFile;
|
|
@@ -167,4 +169,32 @@ public class ScanAnswerCardServiceImpl extends ServiceImpl<ScanAnswerCardMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public UriVo adapteUpload(Long examId, String coursePaperId, Integer cardNumber, String md5, Integer dpi,
|
|
|
+ MultipartFile file, String remark) {
|
|
|
+ MarkPaper mp = markPaperService.getByExamIdAndCoursePaperId(examId,coursePaperId);
|
|
|
+ if (MarkPaperStatus.FINISH.equals(mp.getStatus())) {
|
|
|
+ throw new ParameterException("阅卷已结束");
|
|
|
+ }
|
|
|
+ ScanAnswerCard card = findByExamAndNumber(examId, cardNumber);
|
|
|
+ if (card == null) {
|
|
|
+ throw new ParameterException("未找到卡格式信息");
|
|
|
+ }
|
|
|
+ if (!card.getNeedAdapte()) {
|
|
|
+ throw new ParameterException("卡格式无需适配");
|
|
|
+ }
|
|
|
+ String filePath = null;
|
|
|
+ try {
|
|
|
+ fileService.uploadAdapteFile(file.getInputStream(), md5, examId, cardNumber);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new ParameterException("文件上传失败", e);
|
|
|
+ }
|
|
|
+ card.setAdapteMd5(md5);
|
|
|
+ card.setAdapteUri(filePath);
|
|
|
+ UriVo vo=new UriVo();
|
|
|
+ vo.setUri(filePath);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
}
|