From e1c2b533d242571e7d321b05b3a9da3803004399 Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Tue, 22 Feb 2022 09:26:30 +0800
Subject: [PATCH] 保安员证电子信息查询修改

---
 src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java |  106 +++++++++++++++++++++++++++--------------------------
 1 files changed, 54 insertions(+), 52 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
index a703122..cba4196 100644
--- a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
+++ b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -23,7 +23,6 @@
 import com.google.zxing.WriterException;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.ibatis.annotations.Param;
 import org.springblade.common.cache.SysCache;
 import org.springblade.common.constant.AgeUtil;
 import org.springblade.common.constant.CommonConstant;
@@ -63,7 +62,6 @@
 import org.springblade.modules.system.wrapper.UserWrapper;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -190,11 +188,11 @@
 			List<UserVO> userVOS = baseMapper.selectUserPagesByAge(page, user);
 			//机构名称拼接
 			userVOS.forEach(userVO -> {
-				if (null != userVO.getCardid() && userVO.getCardid() != "") {
-					userVO.setAge(AgeUtil.idCardToAge(userVO.getCardid()));
-				} else {
-					userVO.setAge(null);
-				}
+//				if (null != userVO.getCardid() && userVO.getCardid() != "") {
+//					userVO.setAge(AgeUtil.idCardToAge(userVO.getCardid()));
+//				} else {
+//					userVO.setAge(null);
+//				}
 				if (null!=userVO.getDeptId()) {
 					List<String> list = baseMapper.getDeptName(userVO.getDeptId());
 					if (list.size() > 1) {
@@ -220,11 +218,11 @@
 			List<UserVO> userVOS = baseMapper.selectUserPages(page, user);
 			//机构名称拼接
 			userVOS.forEach(userVO -> {
-				if (null != userVO.getCardid() && userVO.getCardid() != "") {
-					userVO.setAge(AgeUtil.idCardToAge(userVO.getCardid()));
-				} else {
-					userVO.setAge(null);
-				}
+//				if (null != userVO.getCardid() && userVO.getCardid() != "") {
+//					userVO.setAge(AgeUtil.idCardToAge(userVO.getCardid()));
+//				} else {
+//					userVO.setAge(null);
+//				}
 				if (null!=userVO.getDeptId()) {
 					List<String> list = baseMapper.getDeptName(userVO.getDeptId());
 					if (list.size() > 1) {
@@ -1477,8 +1475,8 @@
 	 * @return
 	 */
 	@Override
-	public UserVO getUserInfoBySecurityNumber(String securityNumber) {
-		UserVO userVO = baseMapper.getUserInfoBySecurityNumber(securityNumber);
+	public UserVO getUserInfoBySecurityNumber(String securityNumber,String cardid) {
+		UserVO userVO = baseMapper.getUserInfoBySecurityNumber(securityNumber,cardid);
 		//查询派遣信息
 		if (null!=userVO) {
 			DispatcherVO dispatcherVO = baseMapper.getUserDispatcherInfo(userVO.getId());
@@ -1589,49 +1587,53 @@
 	 */
 	@Override
 	public void importQrCode(List<QrCodeExcel> data, Boolean isCovered, String deptId) {
-//		String url = "http://223.82.109.183:2080/securityInfo.html";
-//		data.forEach(qrCodeExcel -> {
-//			if (null!=qrCodeExcel.getSecuritynumber()) {
-//				String encoded = null;
-//				try {
-//					//中文字符串编码
-//					encoded = URLEncoder.encode(qrCodeExcel.getSecuritynumber(),"UTF-8");
-//				} catch (UnsupportedEncodingException e) {
-//					e.printStackTrace();
-//				}
-//				//url 拼接
-//				String content = url + "?securityNumber=" + encoded;
-//				byte[] qrCodeImage = new byte[0];
-//				try {
-//					//生成二维码字节流
-//					qrCodeImage = QRCodeUtil.getQRCodeImage(content, 350, 350);
-//				} catch (WriterException e) {
-//					e.printStackTrace();
-//				} catch (IOException e) {
-//					e.printStackTrace();
-//				}
-//				String path = "D:\\QrCode\\";
-//				FileOutputStream fileOutputStream = null;
-//				try {
-//					fileOutputStream = new FileOutputStream(path+qrCodeExcel.getSecuritynumber()+".png");
-//				} catch (FileNotFoundException e) {
-//					e.printStackTrace();
-//				}
-//				try {
-//					//图片下载到本地
-//					fileOutputStream.write(qrCodeImage,0,qrCodeImage.length);
-//					fileOutputStream.flush();
-//					fileOutputStream.close();
-//				} catch (IOException e) {
-//					e.printStackTrace();
-//				}
-//			}
-//		});
+		String url = "http://223.82.109.183:2080/securityInfo.html";
+		//二维码生成
+		data.forEach(qrCodeExcel -> {
+			if (null!=qrCodeExcel.getSecuritynumber()) {
+				String encoded = null;
+				try {
+					//中文字符串编码
+					encoded = URLEncoder.encode(qrCodeExcel.getSecuritynumber(),"UTF-8");
+				} catch (UnsupportedEncodingException e) {
+					e.printStackTrace();
+				}
+				//url 拼接
+				String content = url + "?securityNumber=" + encoded;
+				byte[] qrCodeImage = new byte[0];
+				try {
+					//生成二维码字节流
+					qrCodeImage = QRCodeUtil.getQRCodeImage(content, 350, 350);
+				} catch (WriterException e) {
+					e.printStackTrace();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+				String path = "D:\\QrCode\\";
+				FileOutputStream fileOutputStream = null;
+				try {
+					fileOutputStream = new FileOutputStream(path+qrCodeExcel.getSecuritynumber()+".png");
+				} catch (FileNotFoundException e) {
+					e.printStackTrace();
+				}
+				try {
+					//图片下载到本地
+					fileOutputStream.write(qrCodeImage,0,qrCodeImage.length);
+					fileOutputStream.flush();
+					fileOutputStream.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		});
 		//头像生成
 		data.forEach(qrCodeExcel -> {
 			if (null!=qrCodeExcel.getSecuritynumber()) {
 				//查询用户头像url
 				User user = new User();
+				user.setRealName(qrCodeExcel.getRealName());
+				user.setStatus(1);
+				user.setIsDeleted(0);
 				user.setSecuritynumber(qrCodeExcel.getSecuritynumber());
 				User user1 = this.getOne(Condition.getQueryWrapper(user));
 				//url 拼接

--
Gitblit v1.9.3