From 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 16 Jun 2022 14:36:07 +0800
Subject: [PATCH] 模拟考试修改

---
 src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java |  110 +++++++++++++++++-------------------------------------
 1 files changed, 35 insertions(+), 75 deletions(-)

diff --git a/src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java b/src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java
index ad0d782..551faab 100644
--- a/src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java
+++ b/src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java
@@ -3,35 +3,23 @@
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.AllArgsConstructor;
-import org.springblade.common.utils.QRCodeUtil;
-import org.springblade.modules.FTP.FtpUtil;
-import org.springblade.modules.accreditation.excel.ExportSecurityPaperExcel;
 import org.springblade.modules.exam.entity.ExamScore;
 import org.springblade.modules.exam.entity.ScoreAuditRecords;
 import org.springblade.modules.exam.mapper.ScoreAuditRecordsMapper;
 import org.springblade.modules.exam.service.ExamScoreService;
 import org.springblade.modules.exam.service.ScoreAuditRecordsService;
-import org.springblade.modules.exam.util.SecurityPaperUtil;
 import org.springblade.modules.exam.vo.ScoreAuditRecordsVO;
+import org.springblade.modules.securitypaper.service.SecurityPaperService;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IUserService;
+import org.springblade.modules.system.service.MyAsyncService;
 import org.springblade.modules.system.vo.UserVO;
 import org.springblade.modules.training.entity.TrainingRegistration;
 import org.springblade.modules.training.service.TrainingRegistrationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 考试成绩修改申请记录服务实现类
@@ -48,6 +36,11 @@
 
 	@Autowired
 	private TrainingRegistrationService trainingRegistrationService;
+
+	@Autowired
+	private SecurityPaperService securityPaperService;
+	@Autowired
+	private  MyAsyncService myAsyncService;
 
 	/**
 	 * 自定义分页
@@ -87,8 +80,15 @@
 			ExamScore examScore = examScoreService.getById(auditRecords.getExamScoreId());
 			//1.修改培训报名考试状态
 			TrainingRegistration trainingRegistration = trainingRegistrationService.getById(examScore.getApplyId());
-			//已考试
-			trainingRegistration.setIsExam(2);
+			//考试状态修改
+			if(trainingRegistration.getIsExam()==4) {
+				//考试状态修改为纸质考试
+				trainingRegistration.setIsExam(5);
+				trainingRegistration.setCancel(1);
+			}else {
+				//考试结束
+				trainingRegistration.setIsExam(2);
+			}
 			//修改
 			trainingRegistrationService.updateById(trainingRegistration);
 
@@ -130,10 +130,12 @@
 						",qualified = " + "'" + examScore.getQualified() + "'" +
 						" " + "where id = " + "'" + examScore.getId() + "';"+
 					"update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
+						",cancel = " + "'" + trainingRegistration.getCancel() + "'" +
 						" " + "where id = " + "'" + trainingRegistration.getId() + "';"+
 					"update blade_user set is_train = " + "'" +  user.getIsTrain() + "'" +
 						" " + "where id = " + "'" + user.getId() + "'";
-				FtpUtil.sqlFileUpload(s1);
+				//FtpUtil.sqlFileUpload(s1);
+				myAsyncService.FTP(s1);
 			} else {
 				//实操成绩不为空
 				if (examScore.getTheoryGrade() >= 60 && examScore.getLearnGrade() >= 60) {
@@ -143,33 +145,11 @@
 					user.setUserType(7);
 					//如果已有保安证编号,不更保安证编号信息
 					if (null == user.getSecuritynumber() || user.getSecuritynumber().equals("")) {
-						//去生成保安证编号
-						String pre = SecurityPaperUtil.getSecurityPaper();
-						//查询当前年份已有的保安证编号
-						int count = userService.getSecurityPaperCount(pre);
-						String result = null;
-						if (count == 0) {
-							result = pre + "00001";
-						} else {
-							//格式化
-							DecimalFormat decimalFormat = new DecimalFormat("00000");
-							count++;
-							result = pre + (decimalFormat.format(count));
-						}
-						user.setSecuritynumber(result);
-						//发证日期
-//					user.setPaperTime(new Date());
-						//修改为持证保安
-						user.setHold("1");
-						//更新保安数据
-						userService.updateById(user);
-
-//						String s1 =
-//							"update blade_user set hold = " + "'" + user.getHold() + "'" +
-//								",securitynumber = " + "'" + user.getSecuritynumber() + "'" +
-//								",is_train = " + "'" + user.getIsTrain() + "'" +
-//								" " + "where id = " + "'" + user.getId() + "'";
-//						FtpUtil.sqlFileUpload(s1);
+						//去内网生成保安证编号,由内网生成,无需返回
+						//数据推送
+						Map<String, Object> map = new HashMap<>(1);
+						map.put("key",examScore);
+						myAsyncService.FTPSecurityNumberBit(map);
 					}
 				} else {
 					//不合格
@@ -202,13 +182,14 @@
 						",qualified = " + "'" + examScore.getQualified() + "'" +
 						" " + "where id = " + "'" + examScore.getId() + "';"+
 					"update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
+						",cancel = " + "'" + trainingRegistration.getCancel() + "'" +
 						" " + "where id = " + "'" + trainingRegistration.getId() + "';"+
 					"update blade_user set hold = " + "'" + user.getHold() + "'" +
 						",securitynumber = " + "'" + user.getSecuritynumber() + "'" +
 						",user_type = " + "'" + user.getUserType() + "'" +
 						",is_train = " + "'" + user.getIsTrain() + "'" +
 						" " + "where id = " + "'" + user.getId() + "'";
-				FtpUtil.sqlFileUpload(s1);
+				myAsyncService.FTP(s1);
 			}
 		}
 		//审核时间
@@ -282,7 +263,8 @@
 							" " + "where id = " + "'" + trainingRegistration.getId() + "';"+
 						"update blade_user set is_train = " + "'" +  user.getIsTrain() + "'" +
 							" " + "where id = " + "'" + user.getId() + "'";
-					FtpUtil.sqlFileUpload(s1);
+					//FtpUtil.sqlFileUpload(s1);
+					myAsyncService.FTP(s1);
 				} else {
 					//实操成绩不为空
 					if (examScore.getTheoryGrade() >= 60 && examScore.getLearnGrade() >= 60) {
@@ -292,33 +274,11 @@
 						user.setUserType(7);
 						//如果已有保安证编号,不更保安证编号信息
 						if (null == user.getSecuritynumber() || user.getSecuritynumber().equals("")) {
-							//去生成保安证编号
-							String pre = SecurityPaperUtil.getSecurityPaper();
-							//查询当前年份已有的保安证编号
-							int count = userService.getSecurityPaperCount(pre);
-							String result = null;
-							if (count == 0) {
-								result = pre + "00001";
-							} else {
-								//格式化
-								DecimalFormat decimalFormat = new DecimalFormat("00000");
-								count++;
-								result = pre + (decimalFormat.format(count));
-							}
-							user.setSecuritynumber(result);
-							//发证日期
-//					user.setPaperTime(new Date());
-							//修改为持证保安
-							user.setHold("1");
-							//更新保安数据
-							userService.updateById(user);
-
-//						String s1 =
-//							"update blade_user set hold = " + "'" + user.getHold() + "'" +
-//								",securitynumber = " + "'" + user.getSecuritynumber() + "'" +
-//								",is_train = " + "'" + user.getIsTrain() + "'" +
-//								" " + "where id = " + "'" + user.getId() + "'";
-//						FtpUtil.sqlFileUpload(s1);
+							//去内网生成保安证编号,由内网生成,无需返回
+							//数据推送
+							Map<String, Object> map = new HashMap<>(1);
+							map.put("key",examScore);
+							myAsyncService.FTPSecurityNumberBit(map);
 						}
 					} else {
 						//不合格
@@ -357,7 +317,7 @@
 							",user_type = " + "'" + user.getUserType() + "'" +
 							",is_train = " + "'" + user.getIsTrain() + "'" +
 							" " + "where id = " + "'" + user.getId() + "'";
-					FtpUtil.sqlFileUpload(s1);
+					myAsyncService.FTP(s1);
 				}
 			}
 			//审核时间

--
Gitblit v1.9.3