xiatian 1 year ago
parent
commit
9e3adabb11

+ 2 - 2
db/am_db.sql

@@ -25,7 +25,7 @@ CREATE TABLE `am_student` (
   `exam_id` bigint NOT NULL,
   `student_code` varchar(255) COLLATE utf8mb4_bin NOT NULL,
   `subject_code` varchar(255) COLLATE utf8mb4_bin NOT NULL,
-  `err_msg` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL,
+  `err_msg` varchar(2000) COLLATE utf8mb4_bin DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `IDX_STUDENT_01` (`exam_id`, `subject_code`, `student_code`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -39,7 +39,7 @@ CREATE TABLE `am_student_score` (
   `answer_status` varchar(255) NOT NULL,
   `score_status` varchar(255) NOT NULL,
   `answer` longtext COLLATE utf8mb4_bin DEFAULT NULL,
-  `err_msg` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL,
+  `err_msg` varchar(2000) COLLATE utf8mb4_bin DEFAULT NULL,
   `main_number` int NOT NULL,
   `marking_score` double DEFAULT NULL,
   `score_ratio` double DEFAULT NULL,

+ 3 - 2
src/main/java/cn/com/qmth/am/service/impl/StudentScoreServiceImpl.java

@@ -526,7 +526,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 			req.setSubjectName(q.getSubjectName());
 			Double ret = aiMarkingDispose(dto, org, req);
 			if (ret != null) {
-				updateScore(score.getId(), Calculator.multiply(q.getFullScore(), ret));
+				updateScore(score.getId(), Calculator.multiply(q.getFullScore(), ret),ret);
 				if (allSuccess(score.getStudentId())) {
 					studentService.updateStatus(score.getStudentId(), DataStatus.PROCESSING, DataStatus.SUCCESS);
 				}
@@ -579,11 +579,12 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 		}
 	}
 
-	private void updateScore(Long id, Double aiScore) {
+	private void updateScore(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.eq(StudentScoreEntity::getId, id);
 		this.update(wrapper);
 	}

+ 4 - 1
src/main/java/cn/com/qmth/am/service/impl/StudentServiceImpl.java

@@ -267,7 +267,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 		Map<Integer,AnswerImageDto> answerImages=new HashMap<>();
 		for(StudentScoreEntity score:scores) {
 			if(DataStatus.WAITING.equals(score.getAnswerStatus())) {
-				createSlice(score,quetions,answerImages);
+				studentService.createSlice(score,quetions,answerImages);
 			}
 		}
 	}
@@ -279,6 +279,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 		if(q==null) {
 			studentScoreService.updateAnswerErr(score.getId(),"未找到试题信息");
 			updateStatus(score.getStudentId(),DataStatus.PROCESSING,DataStatus.FAILED);
+			return;
 		}
 		try {
 			studentScoreService.createSlice(score,q,answerImages);
@@ -315,6 +316,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 		lw.eq(StudentEntity::getDataStatus, from);
 		this.update(wrapper);
 	}
+	
+	@Transactional
 	@Override
 	public void resetStatus() {
 		UpdateWrapper<StudentEntity> wrapper = new UpdateWrapper<>();

+ 1 - 1
src/main/java/cn/com/qmth/am/task/AiMarkingJob.java

@@ -17,7 +17,7 @@ public class AiMarkingJob {
 	@Autowired
 	private ConcurrentService concurrentService;
 
-	@Scheduled(fixedDelay = 30 * 1000, initialDelay = 20 * 1000)
+	@Scheduled(fixedDelay = 5 * 1000, initialDelay = 20 * 1000)
 	public void doJob() {
 		boolean lock = concurrentService.getReadWriteLock(LockType.AI_MARKING.name()).writeLock().tryLock();
 		try {

+ 1 - 1
src/main/java/cn/com/qmth/am/task/BiuldImageJob.java

@@ -52,7 +52,7 @@ public class BiuldImageJob {
 
 	}
 
-	@Scheduled(fixedDelay = 30 * 1000, initialDelay = 20 * 1000)
+	@Scheduled(fixedDelay = 5 * 1000, initialDelay = 20 * 1000)
 	public void doJob() {
 		boolean lock = concurrentService.getReadWriteLock(LockType.OCR.name()).writeLock().tryLock();
 		try {