From 767f8e4c5b8bdb9b87c7529fe01220f7fa3671b1 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 16 Aug 2021 21:52:17 +0800
Subject: [PATCH] 1.取消报名接口修改, 2.批量报名接口修改

---
 src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java b/src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java
index a702dba..07a59a0 100644
--- a/src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java
+++ b/src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java
@@ -23,6 +23,8 @@
 import org.springblade.modules.exam.service.ExamPaperService;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IUserService;
+import org.springblade.modules.training.entity.TrainingRegistration;
+import org.springblade.modules.training.service.TrainingRegistrationService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -42,6 +44,8 @@
 	private final ExamPaperService examPaperService;
 
 	private final IUserService userService;
+
+	private final TrainingRegistrationService trainingRegistrationService;
 
 	/**
 	 * 自定义分页数据
@@ -111,7 +115,7 @@
 					user1.setIsApply(1);
 					userService.updateById(user1);
 				}else {
-					if (user1.getIsApply()==2) {
+					if (user1.getIsApply()==2 || -1==user.getIsApply()) {
 						Apply apply1 = new Apply();
 						apply1.setApplyStatus(2);
 						//默认为未考试状态
@@ -395,4 +399,38 @@
 	public ApplyVO getSecurityApplyDetail(ApplyVO apply) {
 		return baseMapper.getSecurityApplyDetail(apply);
 	}
+
+
+	/**
+	 * 修改考试状态
+	 * @param apply 报名信息,包含userId,applyid
+	 * @return
+	 */
+	@Override
+	public void updateApplyStatus(ApplyVO apply) {
+		//正式考
+		if (apply.getExamType()==1){
+			//考试中
+			apply.setIsExam(3);
+			baseMapper.updateById(apply);
+		}
+		//模拟考
+		if (apply.getExamType()==2){
+			TrainingRegistration trainingRegistration = new TrainingRegistration();
+			trainingRegistration.setId(apply.getId());
+			//考试中
+			trainingRegistration.setIsExam(3);
+			trainingRegistrationService.updateById(trainingRegistration);
+		}
+	}
+
+	/**
+	 * 查询报名信息,取最新的一条(即当前userId,)applyId最大的一条记录
+	 * @param userId
+	 * @return
+	 */
+	@Override
+	public Apply getMaxApplyIdByUserIdInfo(Long userId) {
+		return baseMapper.getMaxApplyIdByUserIdInfo(userId);
+	}
 }

--
Gitblit v1.9.3