From ba65fbde975845fd84212f853bb640c1e07e5d02 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Mon, 06 Nov 2023 21:26:24 +0800
Subject: [PATCH] 答题下一题接口修改

---
 src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java b/src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
index 18f2be5..6743cfa 100644
--- a/src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
+++ b/src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
@@ -596,7 +596,8 @@
 	 * @return
 	 */
 	@Override
-	public boolean refreshTrainExamInfo(UpdateParamVo updateParamVo) {
+	public Object refreshTrainExamInfo(UpdateParamVo updateParamVo) {
+		Map<String, Object> map = new HashMap<>();
 		if (null != updateParamVo.getScoreId()) {
 			ExamScore examScore = this.getById(updateParamVo.getScoreId());
 			//获取成绩数据,准考证号,用户id,报名培训id,考试id
@@ -636,6 +637,15 @@
 				}
 				//培训考试
 				if (paper.getExamType() == 2) {
+					// 判断是否在考试时间内,如果不是则无法重置
+					long l = System.currentTimeMillis();
+					long endTime = paper.getEndTime().getTime();
+					if (l>endTime){
+						map.put("msg","已过考试时间,无法重置考试");
+						map.put("code",400);
+						// 已过考试时间
+						return map;
+					}
 					//1.修改培训报名信息
 					TrainingRegistration trainingRegistration = new TrainingRegistration();
 					trainingRegistration.setId(examScore.getApplyId());
@@ -654,16 +664,18 @@
 					this.removeById(updateParamVo.getScoreId());
 
 					//4.内网数据同步
-					String s1 =
-						"update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
-							" " + "where id = " + "'" + trainingRegistration.getId() + "';" +
-							"update blade_user set is_train = " + "'" + user.getIsTrain() + "'" +
-							" " + "where id = " + "'" + user.getId() + "';" +
-							"delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'";
-					//FtpUtil.sqlFileUpload(s1);
-					myAsyncService.dataSync(s1);
-
-					return true;
+//					String s1 =
+//						"update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
+//							" " + "where id = " + "'" + trainingRegistration.getId() + "';" +
+//							"update blade_user set is_train = " + "'" + user.getIsTrain() + "'" +
+//							" " + "where id = " + "'" + user.getId() + "';" +
+//							"delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'";
+//					//FtpUtil.sqlFileUpload(s1);
+//					myAsyncService.dataSync(s1);
+					map.put("msg","重置成功");
+					map.put("code",200);
+					// 已过考试时间
+					return map;
 				}
 			}
 		}

--
Gitblit v1.9.3