From 49c5471cc12d7ec57db3cad6964b7e4f61d472f2 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 06 May 2022 09:31:26 +0800
Subject: [PATCH] 枪支,考试成绩,保安员证编号生成,单位信息基本信息,许可证信息,主要管理人,出资人信息,社保记录信息新增导入敏感数据处理

---
 src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java b/src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java
index 6f8ec23..f8e0ee2 100644
--- a/src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java
+++ b/src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java
@@ -1,6 +1,7 @@
 package org.springblade.modules.exam.controller;
 
 import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.ApiOperation;
@@ -16,6 +17,8 @@
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.FTP.FtpUtil;
+import org.springblade.modules.FTP.Monitor;
+import org.springblade.modules.FTP.Result;
 import org.springblade.modules.exam.entity.ExamPaper;
 import org.springblade.modules.exam.entity.ExamScore;
 import org.springblade.modules.exam.excel.ExamScoreExcel;
@@ -34,6 +37,7 @@
 import org.springblade.modules.system.service.IUserService;
 import org.springblade.modules.system.service.MyAsyncService;
 import org.springblade.modules.system.vo.UserVO;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -63,6 +67,8 @@
 	private final SecurityPaperService securityPaperService;
 
 	private final MyAsyncService myAsyncService;
+
+	private final RedisTemplate redisTemplate;
 
 	/**
 	 * 自定义分页
@@ -172,9 +178,9 @@
 		if (null != examScore.getLearnGrade() && null != examScore.getTheoryGrade()) {
 			ExamScore examScore1 = examScoreService.getById(examScore.getId());
 			//查询当前保安信息
-			UserVO user = userService.getUserAgeById(Long.parseLong(examScore1.getUserId()));
+			UserVO user1 = userService.getUserAgeById(Long.parseLong(examScore1.getUserId()));
 			//再根据身份证号查询用户,方式用户考了试,被删除,又新建的情况,修改最新用户的状态信息
-			User user1 = userService.getUserInfoByIdCardNo(user.getCardid());
+//			User user1 = userService.getUserInfoByIdCardNo(user.getCardid());
 			//考试合格
 			if (examScore.getTheoryGrade() >= 60 && examScore.getLearnGrade() >= 60) {
 				//合格
@@ -189,7 +195,40 @@
 					//去生成保安证编号
 					String pre = SecurityPaperUtil.getSecurityPaper();
 					//查询当前年份已有的保安证编号
-					int max = userService.getSecurityPaperCount(pre);
+//					int max = userService.getSecurityPaperCount(pre);
+					//需调用内网查询
+					//生成随机数
+					String uuid = UUID.randomUUID().toString();
+
+					//数据推送
+					Map<String, Object> map = new HashMap<>(1);
+					map.put(uuid,pre);
+					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";
@@ -205,7 +244,7 @@
 					securityPaper.setUserId(user1.getId());
 					securityPaper.setNumber(result);
 					securityPaper.setCreateTime(new Date());
-					securityPaper.setIdCardNo(user.getCardid());
+					securityPaper.setIdCardNo(user1.getCardid());
 					securityPaper.setPeopleName(user1.getRealName());
 					securityPaper.setExamId(Long.parseLong(examScore1.getExamId()));
 					securityPaper.setApplyId(examScore1.getApplyId());
@@ -256,14 +295,14 @@
 				examScore.setQualified(1);
 			}
 			//总成绩
-			if (user.getAge() <= 50) {
+			if (user1.getAge() <= 50) {
 				if (null != examScore1.getTheoryGrade()) {
 					examScore.setAllGrade(Math.round((examScore.getLearnGrade() + examScore1.getTheoryGrade()) / 2));
 				} else {
 					examScore.setAllGrade(Math.round(examScore.getLearnGrade() / 2));
 				}
 			}
-			if (user.getAge() > 50) {
+			if (user1.getAge() > 50) {
 				if (null != examScore1.getTheoryGrade()) {
 					examScore.setAllGrade(Integer.parseInt(String.valueOf(Math.round(examScore1.getTheoryGrade() * 0.5)))
 						+ Integer.parseInt(String.valueOf(Math.round(examScore.getLearnGrade() * 0.5))));

--
Gitblit v1.9.3