From 0dee81f06575d115d64adde8fc3a4ea94607f9ef Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 06 Aug 2021 11:44:17 +0800
Subject: [PATCH] 1.考试报名新增判断,同一人,同一场考试,已报名且未考试,审核通过和待审核的不能再次报名 2.考试接口修改

---
 src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java |   90 ++++++++++++++++++++++++++++++++------------
 1 files changed, 65 insertions(+), 25 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 4ec1800..fbdcb02 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
@@ -10,14 +10,18 @@
 import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
 import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
 import org.springblade.common.utils.arg;
+import org.springblade.core.mp.support.Condition;
 import org.springblade.modules.apply.entity.Apply;
 import org.springblade.modules.apply.excel.ApplyExcel;
+import org.springblade.modules.apply.excel.ApplyInfoExcel;
 import org.springblade.modules.apply.mapper.ApplyMapper;
 import org.springblade.modules.apply.service.ApplyService;
 import org.springblade.modules.apply.vo.ApplyPaPerVO;
 import org.springblade.modules.apply.vo.ApplyVO;
 import org.springblade.modules.exam.entity.ExamPaper;
 import org.springblade.modules.exam.service.ExamPaperService;
+import org.springblade.modules.system.entity.User;
+import org.springblade.modules.system.service.IUserService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -37,6 +41,8 @@
 
 
 	private final ExamPaperService examPaperService;
+
+	private final IUserService userService;
 
 	/**
 	 * 自定义分页数据
@@ -81,26 +87,24 @@
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void importApply(List<ApplyExcel> data, Boolean isCovered) {
-		data.forEach(applyExcel -> {
-			Apply apply = new Apply();
-			//设置数据
-			apply.setExamId(applyExcel.getExamId());
-			apply.setUserId(applyExcel.getUserId());
-			apply.setApplyTime(new Date());
-			apply.setApplyStatus(2);
-			//去生成准考证号码
-			apply.setCandidateNo(getCandidateNo(apply));
-			//去生成考试编号
-			apply.setApplyCode(getApplyCode(apply));
-			//插入数据
-			this.save(apply);
-			//内网新增
-			try {
-				arg.test01(arg.url+"/apply/save",apply);
-			} catch (Exception e) {
-				e.printStackTrace();
+	public void importApply(List<ApplyInfoExcel> data, Boolean isCovered) {
+		data.forEach(applyInfoExcel -> {
+			//通过准考证号
+			if (null!=applyInfoExcel.getCandidateNo() && applyInfoExcel.getIdCardNo()!=""){
+				Apply apply = new Apply();
+				apply.setCandidateNo(applyInfoExcel.getCandidateNo());
+				//查询报名信息
+				Apply apply1 = baseMapper.selectOne(Condition.getQueryWrapper(apply));
+				apply1.setIsExam(2);
+				baseMapper.updateById(apply1);
+				//内网新增
+				try {
+//					arg.test01(arg.url+"/apply/update",apply1);
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
 			}
+
 		});
 	}
 
@@ -246,12 +250,48 @@
 	 */
 	@Override
 	public ApplyPaPerVO getApplyInfo(Apply apply) {
-		ApplyPaPerVO applyPaPerVO = baseMapper.getApplyInfo(apply);
+		//正式考试
+		if (apply.getApplyExamType()==1){
+			ApplyPaPerVO applyPaPerVO = baseMapper.getApplyInfo(apply);
+			String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[0];
+			String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[1];
+			String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getEndTime()).split(" ")[1];
+			applyPaPerVO.setStringTime(time+" "+startTime.substring(0,startTime.length()-3) +"-"+ endTime.substring(0,endTime.length()-3));
+			return applyPaPerVO;
+		}
 
-		String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[0];
-		String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[1];
-		String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getEndTime()).split(" ")[1];
-		applyPaPerVO.setStringTime(time+" "+startTime.substring(0,startTime.length()-3) +"-"+ endTime.substring(0,endTime.length()-3));
-		return applyPaPerVO;
+		//模拟考试
+		if (apply.getApplyExamType()==2){
+			ApplyPaPerVO applyPaPerVO = baseMapper.getTrainApplyInfo(apply);
+			String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[0];
+			String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[1];
+			String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getEndTime()).split(" ")[1];
+			applyPaPerVO.setStringTime(time+" "+startTime.substring(0,startTime.length()-3) +"-"+ endTime.substring(0,endTime.length()-3));
+			return applyPaPerVO;
+		}
+
+
+
+		return null;
+	}
+
+	/**
+	 * 导出报名数数据
+	 * @param apply 报名对象
+	 * @return
+	 */
+	@Override
+	public List<ApplyInfoExcel> getApplyExcelList(Apply apply) {
+		return baseMapper.getApplyExcelList(apply);
+	}
+
+	/**
+	 * 查询人员是否已报名
+	 * @param apply
+	 * @return
+	 */
+	@Override
+	public Integer getIsApply(Apply apply) {
+		return baseMapper.getIsApply(apply);
 	}
 }

--
Gitblit v1.9.3