From 2b5ca6cea92ff6a67582c3331a0704480e63b9b4 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 02 Sep 2021 11:28:17 +0800
Subject: [PATCH] 1.正式考试,模拟考试考试申请接口修改 2.用户头像批量上传(压缩zip 包上传) 3.通知公告接口修改

---
 src/main/java/org/springblade/modules/apply/controller/ApplyController.java |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/springblade/modules/apply/controller/ApplyController.java b/src/main/java/org/springblade/modules/apply/controller/ApplyController.java
index c6d0d84..3055948 100644
--- a/src/main/java/org/springblade/modules/apply/controller/ApplyController.java
+++ b/src/main/java/org/springblade/modules/apply/controller/ApplyController.java
@@ -175,7 +175,18 @@
 	@PostMapping("import-apply")
 	@ApiOperation(value = "导入报名考试数据", notes = "传入excel")
 	public R importUser(MultipartFile file, Integer isCovered) {
-		ApplyImporter applyImporter = new ApplyImporter(applyService, false);
+		ApplyImporter applyImporter = new ApplyImporter(applyService, false,null);
+		ExcelUtil.save(file, applyImporter, ApplyExcel.class);
+		return R.success("操作成功");
+	}
+
+	/**
+	 * 导入报名考试数据(已生成考试)
+	 */
+	@PostMapping("import-applys")
+	@ApiOperation(value = "导入报名考试数据", notes = "传入excel")
+	public R importUser(MultipartFile file, Integer isCovered,Long examId) {
+		ApplyImporter applyImporter = new ApplyImporter(applyService, false,examId);
 		ExcelUtil.save(file, applyImporter, ApplyExcel.class);
 		return R.success("操作成功");
 	}
@@ -592,13 +603,14 @@
 
 
 	/**
-	 * 生成试卷,报名
+	 * 生成考试,报名
 	 * @param ids 报名ids
 	 */
 	@PostMapping("/batchExam")
 	public R batchExam(@RequestParam String ids,
 					   String examTime,
 					   @RequestParam Date startTime,
+					   @RequestParam Integer number,
 					   Date endTime){
 		if (!ids.equals("")){
 			List<String> list = Arrays.asList(ids.split(","));
@@ -634,7 +646,7 @@
 					applyService.updateById(apply);
 
 					String s1 =
-						"update sys_apply set exam_id = " + apply.getExamId() + "candidate_no = " + "'" + apply.getCandidateNo() + "'" +
+						"update sys_apply set exam_id = " + apply.getExamId() + ",candidate_no = " + "'" + apply.getCandidateNo() + "'" +
 							" " +"where id = " + "'" + apply.getId() + "'";
 					FtpUtil.sqlFileUpload(s1);
 				});
@@ -642,7 +654,7 @@
 
 		}else {
 			//查询已报名未关联试卷的人员
-			List<Long> applyIds = applyService.getApplyIds();
+			List<Long> applyIds = applyService.getApplyIds(number);
 			if (applyIds.size()>0){
 				//生成考试
 				ExamPaper examPaper = new ExamPaper();
@@ -666,7 +678,6 @@
 					"values(" + "'" + sid + "'" + "," + "'" + examPaper.getExamName() + "'" + "," + "'" + examPaper.getExamType() +
 					"'" + ","  +"'" + format + "'" + ")";
 				FtpUtil.sqlFileUpload(s);
-
 
 				//修改报名信息
 				applyIds.forEach(id ->{
@@ -728,13 +739,13 @@
 		//内网同步
 		Long sid = examScore.getId();
 		String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examScore.getExamTime());
-		String s = "insert into exam_score(id,exam_time,user_id,exam_id,apply_id) " +
-			"values(" + "'" + sid + "'" + "," + "'" +
-			format + "'" + "," + "'" +
-			examScore.getUserId() +"'" + ","  +"'" +
-			examScore.getExamId() +"'" + ","  +"'" +
-			examScore.getApplyId() + "'" + ")";
-		FtpUtil.sqlFileUpload(s);
+//		String s = "insert into exam_score(id,exam_time,user_id,exam_id,apply_id) " +
+//			"values(" + "'" + sid + "'" + "," + "'" +
+//			format + "'" + "," + "'" +
+//			examScore.getUserId() +"'" + ","  +"'" +
+//			examScore.getExamId() +"'" + ","  +"'" +
+//			examScore.getApplyId() + "'" + ")";
+//		FtpUtil.sqlFileUpload(s);
 		return examScore;
 	}
 
@@ -751,6 +762,7 @@
 		String s3 = "select * from ksxt_exam";
 		FtpUtil.sqlFileUpload(s1);
 		FtpUtil.sqlFileUpload(s2);
+//		FtpUtil.sqlFileUpload(s3);
 		String json1 = JSON.toJSONString(s3);
 		String response1 = String.valueOf((new Date()).getTime());
 		OutJson.createJsonFile(json1, localPath, "f"+response1);

--
Gitblit v1.9.3