xiatian 1 år sedan
förälder
incheckning
ce711cc62b

+ 1 - 0
db/am_db.sql

@@ -59,6 +59,7 @@ CREATE TABLE `am_student_score` (
   `score_ratio` double DEFAULT NULL,
   `marking_score` double DEFAULT NULL,
   `err_msg` varchar(2000) COLLATE utf8mb4_bin DEFAULT NULL,
+  `score_none` bit(1) DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `IDX_STUDENT_SCORE_01` (`student_id`, `question_id`),
   UNIQUE KEY `IDX_STUDENT_SCORE_02` (`exam_id`, `subject_code`, `student_code`,`main_number`, `sub_number`)

+ 11 - 0
src/main/java/cn/com/qmth/am/entity/StudentScoreEntity.java

@@ -37,6 +37,9 @@ public class StudentScoreEntity extends IdEntity {
 	//错误信息
     @TableField(updateStrategy = FieldStrategy.IGNORED)
 	private String errMsg;
+    
+    //机评返回null
+    private Boolean scoreNone;
 
 	public Long getStudentId() {
 		return studentId;
@@ -151,4 +154,12 @@ public class StudentScoreEntity extends IdEntity {
 		this.questionId = questionId;
 	}
 
+	public Boolean getScoreNone() {
+		return scoreNone;
+	}
+
+	public void setScoreNone(Boolean scoreNone) {
+		this.scoreNone = scoreNone;
+	}
+
 }

+ 17 - 5
src/main/java/cn/com/qmth/am/service/impl/StudentScoreServiceImpl.java

@@ -508,7 +508,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 			if (ret != null) {
 				updateAnswer(dto.getStudentScoreId(), ret);
 			}else{
-				ocrErr(dto, "ocr失败");
+				ocrErr(dto, "ocr失败,返回null");
 			}
 		} catch (Exception e) {
 			ocrErr(dto, e.getMessage());
@@ -587,11 +587,11 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 			Double ret = aiMarkingDispose(dto, org, req);
 			if (ret != null) {
 				updateScore(score.getId(), Calculator.multiply(q.getFullScore(), ret),ret);
-				if (allSuccess(score.getStudentId())) {
-					studentService.updateStatus(score.getStudentId(),DataStatus.SUCCESS);
-				}
 			} else {
-				aiScoreErr(dto, "aiScore异常");
+				updateScoreNone(score.getId(), 0.0, 0.0);
+			}
+			if (allSuccess(score.getStudentId())) {
+				studentService.updateStatus(score.getStudentId(),DataStatus.SUCCESS);
 			}
 		} catch (Exception e) {
 			aiScoreErr(dto, e.getMessage());
@@ -649,6 +649,18 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 		lw.eq(StudentScoreEntity::getId, id);
 		this.update(wrapper);
 	}
+	
+	private void updateScoreNone(Long id, Double aiScore,Double scoreRatio) {
+		UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
+		LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
+		lw.set(StudentScoreEntity::getScoreStatus, DataStatus.SUCCESS);
+		lw.set(StudentScoreEntity::getAiScore, aiScore);
+		lw.set(StudentScoreEntity::getScoreRatio, scoreRatio);
+		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);