From f6eeb01e5a77965facfb0ae9a517b09681b3f69f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 13 Jun 2022 14:45:29 +0800
Subject: [PATCH] 实操成绩修改申请,成绩修改申请修改,保安员证编号由内网处理

---
 src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java |  150 ++-----------------------------------------------
 1 files changed, 7 insertions(+), 143 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 d3778d5..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,22 +3,12 @@
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.AllArgsConstructor;
-import org.springblade.common.utils.DesensitizedUtil;
-import org.springblade.common.utils.QRCodeUtil;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.modules.FTP.FtpUtil;
-import org.springblade.modules.FTP.Monitor;
-import org.springblade.modules.FTP.Result;
-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.entity.SecurityPaper;
 import org.springblade.modules.securitypaper.service.SecurityPaperService;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IUserService;
@@ -29,12 +19,6 @@
 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.*;
 
 /**
@@ -161,95 +145,11 @@
 					user.setUserType(7);
 					//如果已有保安证编号,不更保安证编号信息
 					if (null == user.getSecuritynumber() || user.getSecuritynumber().equals("")) {
-						//去生成保安证编号
-						String pre = SecurityPaperUtil.getSecurityPaper();
-						//查询当前年份已有的保安证编号
-//						int count = userService.getSecurityPaperCount(pre);
-						//需调用内网查询
-						//生成随机数
-						String uuid = UUID.randomUUID().toString();
-
+						//去内网生成保安证编号,由内网生成,无需返回
 						//数据推送
 						Map<String, Object> map = new HashMap<>(1);
-						map.put(uuid,pre);
+						map.put("key",examScore);
 						myAsyncService.FTPSecurityNumberBit(map);
-
-						int count = 0;
-						Result result0 = new Result();
-						//调用ftp获取返回数据
-						while (true){
-							try {
-								Thread.sleep(1000);
-							} catch (InterruptedException e) {
-								e.printStackTrace();
-							}
-							//调用ftp获取返回数据
-							result0 = Monitor.getSecurityNumberBit(uuid);
-							//如果返回true,就退处
-							if (result0.getCode()==200){
-								break;
-							}else{
-								//计数
-								count++;
-								//如果超过100s 没有读取到,则退出
-								if (count == 100) {
-									break;
-								}
-							}
-						}
-						int max = Integer.parseInt(result0.getMsg());
-						String result = null;
-						if (max == 0) {
-							result = pre + "00001";
-						} else {
-							//格式化
-							DecimalFormat decimalFormat = new DecimalFormat("00000");
-							max++;
-							result = pre + (decimalFormat.format(max));
-						}
-						user.setSecuritynumber(result);
-						//修改为持证保安
-						user.setHold("1");
-						//创建保安证脱敏对象
-						User user1 = user;
-						//更新保安数据
-						user1.setSecuritynumber(DesensitizedUtil.desensitizedSecurityNumber(result));
-						userService.updateById(user1);
-
-						//生成保安证的同时向保安证管理表中插入一条数据
-						SecurityPaper securityPaper = new SecurityPaper();
-						securityPaper.setUserId(user.getId());
-						securityPaper.setNumber(result);
-						securityPaper.setCreateTime(new Date());
-						securityPaper.setIdCardNo(user.getCardid());
-						securityPaper.setPeopleName(user.getRealName());
-						securityPaper.setExamId(Long.parseLong(examScore.getExamId()));
-						securityPaper.setApplyId(examScore.getApplyId());
-						securityPaper.setSource(1);
-						//创建内网对象
-						SecurityPaper paper = Objects.requireNonNull(BeanUtil.copy(securityPaper,SecurityPaper.class));
-						//脱敏
-						securityPaper.setNumber(DesensitizedUtil.desensitizedSecurityNumber(result));
-						securityPaper.setIdCardNo("");
-						//新增保安员证信息
-						securityPaperService.save(securityPaper);
-
-						//设置id
-						paper.setId(securityPaper.getId());
-
-						//数据同步
-						String s1 = "insert into sys_security_paper(id,number,create_time,people_name,id_card_no,user_id,apply_id,exam_id,source) " +
-							"values(" + "'" + paper.getId() + "'" + "," +
-							"'" + paper.getNumber() + "'" + "," +
-							"," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(paper.getCreateTime()) + "'" +
-							"," + "'" + paper.getPeopleName() + "'" +
-							"," + "'" + paper.getIdCardNo() + "'" +
-							"," + "'" + paper.getUserId() + "'" +
-							"," + "'" + paper.getApplyId() + "'" +
-							"," + "'" + paper.getExamId() + "'" +
-							"," + "'" + paper.getSource() + "'"
-							+ ")";
-						myAsyncService.FTP(s1);
 					}
 				} else {
 					//不合格
@@ -374,46 +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);
-
-							//生成保安证的同时向保安证管理表中插入一条数据
-							SecurityPaper securityPaper = new SecurityPaper();
-							securityPaper.setUserId(user.getId());
-							securityPaper.setNumber(result);
-							securityPaper.setCreateTime(new Date());
-							securityPaper.setIdCardNo(user.getCardid());
-							securityPaper.setPeopleName(user.getRealName());
-							securityPaper.setExamId(Long.parseLong(examScore.getExamId()));
-							securityPaper.setApplyId(examScore.getApplyId());
-							securityPaper.setSource(1);
-							//新增保安员证信息
-							securityPaperService.save(securityPaper);
-
-//						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 {
 						//不合格
@@ -452,7 +317,6 @@
 							",user_type = " + "'" + user.getUserType() + "'" +
 							",is_train = " + "'" + user.getIsTrain() + "'" +
 							" " + "where id = " + "'" + user.getId() + "'";
-					//FtpUtil.sqlFileUpload(s1);
 					myAsyncService.FTP(s1);
 				}
 			}

--
Gitblit v1.9.3