|
@@ -36,6 +36,7 @@ import cn.com.qmth.am.bean.AiMarkingDto;
|
|
|
import cn.com.qmth.am.bean.AnswerImageDto;
|
|
|
import cn.com.qmth.am.bean.AutoScoreEnRequest;
|
|
|
import cn.com.qmth.am.bean.ImageSlice;
|
|
|
+import cn.com.qmth.am.bean.ModelSpeed;
|
|
|
import cn.com.qmth.am.bean.OcrDto;
|
|
|
import cn.com.qmth.am.bean.StudentScoreImageDto;
|
|
|
import cn.com.qmth.am.bean.StudentScoreInfo;
|
|
@@ -71,6 +72,9 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
@Autowired
|
|
|
private QuestionService questionService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ModelSpeed modelSpeed;
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public void saveByQuestion(List<QuestionEntity> qlist, List<String> examNumbers) {
|
|
@@ -130,6 +134,15 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
|
|
|
+ private void updateMarkingErr(Long id, String err) {
|
|
|
+ UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
+ LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
+ lw.set(StudentScoreEntity::getScoreStatus, DataStatus.FAILED);
|
|
|
+ lw.set(StudentScoreEntity::getErrMsg, err);
|
|
|
+ lw.eq(StudentScoreEntity::getId, id);
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public void createSlice(OcrDto ocrDto) {
|
|
@@ -313,13 +326,13 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- @Transactional
|
|
|
@Override
|
|
|
public void ocr(StudentScoreImageDto dto) {
|
|
|
try {
|
|
|
String ret = ocrDispose(dto);
|
|
|
if (ret != null) {
|
|
|
updateAnswer(dto.getStudentScoreId(), ret);
|
|
|
+ modelSpeed.addOcrCOunt();
|
|
|
} else {
|
|
|
ocrErr(dto, "ocr失败,返回null");
|
|
|
}
|
|
@@ -400,7 +413,6 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
// return this.list(wrapper);
|
|
|
// }
|
|
|
|
|
|
- @Transactional
|
|
|
@Override
|
|
|
public void aiMarking(StudentScoreEntity score) {
|
|
|
AiMarkingDto dto = new AiMarkingDto();
|
|
@@ -429,8 +441,9 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
stepScore.add(d);
|
|
|
}
|
|
|
updateScore(score.getId(), ret.getTotalScore(), stepScore);
|
|
|
+ modelSpeed.addMarkingCount();
|
|
|
} else {
|
|
|
- updateScoreNone(score.getId(), 0.0);
|
|
|
+ updateMarkingErr(score.getId(), "making失败,返回null");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
aiScoreErr(dto, e.getMessage());
|
|
@@ -476,17 +489,17 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
|
|
|
- private void updateScoreNone(Long id, Double aiScore) {
|
|
|
- UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
- LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
- lw.set(StudentScoreEntity::getScoreStatus, DataStatus.SUCCESS);
|
|
|
- lw.set(StudentScoreEntity::getAiScore, aiScore);
|
|
|
- lw.set(StudentScoreEntity::getStepScore, null);
|
|
|
- lw.set(StudentScoreEntity::getErrMsg, null);
|
|
|
- lw.set(StudentScoreEntity::getScoreNone, true);
|
|
|
- lw.eq(StudentScoreEntity::getId, id);
|
|
|
- this.update(wrapper);
|
|
|
- }
|
|
|
+ // private void updateScoreNone(Long id, Double aiScore) {
|
|
|
+ // UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
+ // LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
+ // lw.set(StudentScoreEntity::getScoreStatus, DataStatus.SUCCESS);
|
|
|
+ // lw.set(StudentScoreEntity::getAiScore, aiScore);
|
|
|
+ // lw.set(StudentScoreEntity::getStepScore, null);
|
|
|
+ // lw.set(StudentScoreEntity::getErrMsg, null);
|
|
|
+ // lw.set(StudentScoreEntity::getScoreNone, true);
|
|
|
+ // lw.eq(StudentScoreEntity::getId, id);
|
|
|
+ // this.update(wrapper);
|
|
|
+ // }
|
|
|
|
|
|
private void aiScoreErr(AiMarkingDto dto, String err) {
|
|
|
updateScoreErr(dto.getScoreInfo().getId(), err);
|