From 116143f2237156ff892d6951d6943285fa304f0e Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 08 Dec 2021 17:33:23 +0800
Subject: [PATCH] 考试成绩查询,导出修改,实操成绩导入去除准考证号,保安员导入新增身份证住址校验

---
 src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java |  102 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 74 insertions(+), 28 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 ae31613..f68f678 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
@@ -44,6 +44,8 @@
 import org.springblade.modules.accreditation.service.AccreditationRecordsService;
 import org.springblade.modules.auth.enums.UserEnum;
 import org.springblade.modules.dispatcher.vo.DispatcherVO;
+import org.springblade.modules.experience.entity.Experience;
+import org.springblade.modules.experience.service.IExperienceService;
 import org.springblade.modules.information.entity.Information;
 import org.springblade.modules.information.service.IInformationService;
 import org.springblade.modules.jurisdiction.entity.Jurisdiction;
@@ -60,6 +62,7 @@
 import org.springblade.modules.system.wrapper.UserWrapper;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import sun.java2d.pipe.SpanShapeRenderer;
 
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -89,7 +92,7 @@
 	private final IInformationService iInformationService;
 	private final IDeptService deptService;
 	private final JurisdictionService jurisdictionService;
-	private final AccreditationRecordsService accreditationRecordsService;
+	private final IExperienceService experienceService;
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
@@ -832,6 +835,10 @@
 			if (null==user.getCardid() || user.getCardid().equals("")){
 				throw new ServiceException("导入失败!身份证号码不能为空!");
 			}
+			//身份证住址校验
+			if (null==user.getRegistered() || user.getRegistered().equals("")){
+				throw new ServiceException("导入失败!身份证住址不能为空!");
+			}
 			if (null!=user.getCardid() && !user.getCardid().equals("")){
 				//去除所有空格
 				String cardid = user.getCardid().replaceAll(" ", "");
@@ -899,14 +906,27 @@
 					if (userCount > 0 && Func.isEmpty(user.getId())) {
 						throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
 					}
+					user.setCreateTime(new Date());
 					//新增
 					this.save(user);
+
+
+					//从业记录新增
+					Experience experience = new Experience();
+					experience.setCardid(user.getCardid());
+					experience.setSecurityid(user.getId().toString());
+					experience.setCompanyname(userExcel.getDeptId());
+					experience.setName(user.getRealName());
+					experience.setPost("保安员");
+					experience.setEntrytime(new Date());
+					experienceService.save(experience);
+
 					//内网同步
 					String s = "insert into blade_user(" +
 						"id,tenant_id,account,password,name,real_name,avatar,email,phone,sex," +
 						"role_id,dept_id,cardid,nativePlace,nation,fingerprint,education," +
 						"politicaloutlook,healstats,height,address,registered," +
-						"securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch) " +
+						"securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time) " +
 						"values(" + "'" + user.getId() + "'" +
 						"," + "'" + user.getTenantId() + "'" +
 						"," + "'" + user.getAccount() + "'" +
@@ -935,7 +955,18 @@
 						"," + "'" + user.getExaminationType() + "'" +
 						"," + "'" + user.getStatus() + "'" +
 						"," + "'" + user.getIsDeleted() + "'" +
-						"," + "'" + user.getDispatch() + "'" + ")";
+						"," + "'" + user.getDispatch() + "'" +
+						"," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateTime()) + "'" + ");"+
+					"insert into sys_experience(id,name,post,entryTime," +
+						"cardId,companyname,securityId) " +
+						"values(" + "'" + experience.getId() + "'" + "," +
+						"'" + experience.getName() + "'" + "," +
+						"'" + experience.getPost() + "'" + "," +
+						"," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" +
+						"," + "'" + experience.getCardid() + "'" +
+						"," + "'" + experience.getCompanyname() + "'" +
+						"," + "'" + experience.getSecurityid() + "'"
+						+ ")";
 					FtpUtil.sqlFileUpload(s);
 //				}else {
 //					agetStatus.set(false);
@@ -966,11 +997,13 @@
 							user2.setRegistered("");
 						}
 						//更新用户数据
+						user2.setUpdateTime(new Date());
 						this.updateById(user2);
 						String s1 =
 							"update blade_user set hold = " + "'" + user2.getHold() + "'"
 								+ ",securitynumber = " + "'" + user2.getSecuritynumber() + "'"
 								+ ",dept_id = " + "'" + user2.getDeptId() + "'"
+								+ ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user2.getUpdateTime()) + "'"
 								+ ",registered = " + "'" + user2.getRegistered() + "'"
 								+ " " + "where id = " + "'" + user2.getId() + "'";
 						FtpUtil.sqlFileUpload(s1);
@@ -999,12 +1032,14 @@
 					}else {
 						user2.setRegistered("");
 					}
+					user2.setUpdateTime(new Date());
 					//更新用户数据
 					this.updateById(user2);
 					String s1 =
 						"update blade_user set hold = " + "'" + user2.getHold() + "'"
 							+ ",securitynumber = " + "'" + user2.getSecuritynumber() + "'"
 							+ ",registered = " + "'" + user2.getRegistered() + "'"
+							+ ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user2.getUpdateTime()) + "'"
 							+ " " + "where id = " + "'" + user2.getId() + "'";
 					FtpUtil.sqlFileUpload(s1);
 				}
@@ -1035,7 +1070,7 @@
 
 	@Override
 	public void importSecurityYy(List<SecurityYyExcel> data, Boolean isCovered, String deptId) {
-//将不能导入的保安员账号存起来
+		//将不能导入的保安员账号存起来
 		List<String> errorList = new ArrayList<>();
 		//将需要新增的保安员信息存入集合
 		List<String> ageErrorList = new ArrayList<>();
@@ -1060,9 +1095,13 @@
 				throw new ServiceException("导入失败!公司名:["+user.getDeptId()+"]不存在!");
 			}
 
-			//身份证校验
+			//身份证号码校验
 			if (null==user.getCardid() || user.getCardid().equals("")){
 				throw new ServiceException("导入失败!身份证号码不能为空!");
+			}
+			//身份证住址校验
+			if (null==user.getRegistered() || user.getRegistered().equals("")){
+				throw new ServiceException("导入失败!身份证住址不能为空!");
 			}
 			if (null!=user.getCardid() && !user.getCardid().equals("")){
 				//去除所有空格
@@ -1130,34 +1169,26 @@
 				if (userCount > 0 && Func.isEmpty(user.getId())) {
 					throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
 				}
+				user.setCreateTime(new Date());
 				//新增
 				this.save(user);
+
+				//从业记录新增
+				Experience experience = new Experience();
+				experience.setCardid(user.getCardid());
+				experience.setSecurityid(user.getId().toString());
+				experience.setCompanyname(userExcel.getDeptId());
+				experience.setName(user.getRealName());
+				experience.setPost("保安员");
+				experience.setEntrytime(new Date());
+				experienceService.save(experience);
+
 				//内网同步
-//				String s = "insert into blade_user(" +
-//					"id,tenant_id,account,password,real_name,phone,sex,role_id,dept_id," +
-//					"cardid,nation,registered,securitynumber,hold,status,is_deleted) " +
-//					"values(" + "'" + user.getId() + "'" + "," +
-//					"'" + user.getTenantId() + "'" + "," +
-//					"'" + user.getAccount() + "'" + "," +
-//					"'" + user.getPassword() + "'" + "," +
-//					"'" + user.getRealName() + "'" + "," +
-//					"'" + user.getPhone() + "'" + "," +
-//					"'" + user.getSex() + "'" + "," +
-//					"'" + user.getRoleId() + "'" +
-//					"," + "'" + user.getDeptId() + "'" +
-//					"," + "'" + user.getCardid() + "'" +
-//					"," + "'" + user.getNation() + "'" +
-//					"," + "'" + user.getRegistered() + "'" +
-//					"," + "'" + user.getSecuritynumber() + "'" +
-//					"," + "'" + user.getHold() + "'" +
-//					"," + "'" + user.getStatus() + "'" +
-//					"," + "'" + user.getIsDeleted() + "'"
-//					+ ")";
 				String s = "insert into blade_user(" +
 					"id,tenant_id,account,password,name,real_name,avatar,email,phone,sex," +
 					"role_id,dept_id,cardid,nativePlace,nation,fingerprint,education," +
 					"politicaloutlook,healstats,height,address,registered," +
-					"securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,guncode) " +
+					"securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time,guncode) " +
 					"values(" + "'" + user.getId() + "'" +
 					"," + "'" + user.getTenantId() + "'" +
 					"," + "'" + user.getAccount() + "'" +
@@ -1186,8 +1217,19 @@
 					"," + "'" + user.getExaminationType() + "'" +
 					"," + "'" + user.getStatus() + "'" +
 					"," + "'" + user.getIsDeleted() + "'" +
-					"," + "'" + user.getIsDeleted() + "'" +
-					"," + "'" + user.getGuncode() + "'" + ")";
+					"," + "'" + user.getDispatch() + "'" +
+					"," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateTime()) + "'" +
+				"," + "'" + user.getGuncode() + "'" + ");"+
+				"insert into sys_experience(id,name,post,entryTime," +
+					"cardId,companyname,securityId) " +
+					"values(" + "'" + experience.getId() + "'" + "," +
+					"'" + experience.getName() + "'" + "," +
+					"'" + experience.getPost() + "'" + "," +
+					"," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" +
+					"," + "'" + experience.getCardid() + "'" +
+					"," + "'" + experience.getCompanyname() + "'" +
+					"," + "'" + experience.getSecurityid() + "'"
+					+ ")";
 				FtpUtil.sqlFileUpload(s);
 			}
 			else {
@@ -1221,12 +1263,14 @@
 						}else {
 							user2.setRegistered("");
 						}
+						user2.setUpdateTime(new Date());
 						//更新用户数据
 						this.updateById(user2);
 						String s1 =
 							"update blade_user set hold = " + "'" + user2.getHold() + "'"
 								+ ",securitynumber = " + "'" + user2.getSecuritynumber() + "'"
 								+ ",dept_id = " + "'" + user2.getDeptId() + "'"
+								+ ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user2.getUpdateTime()) + "'"
 								+ ",registered = " + "'" + user2.getRegistered() + "'"
 								+ " " + "where id = " + "'" + user2.getId() + "'";
 						FtpUtil.sqlFileUpload(s1);
@@ -1255,12 +1299,14 @@
 					}else {
 						user2.setRegistered("");
 					}
+					user2.setUpdateTime(new Date());
 					//更新用户数据
 					this.updateById(user2);
 					String s1 =
 						"update blade_user set hold = " + "'" + user2.getHold() + "'"
 							+ ",securitynumber = " + "'" + user2.getSecuritynumber() + "'"
 							+ ",registered = " + "'" + user2.getRegistered() + "'"
+							+ ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user2.getUpdateTime()) + "'"
 							+ " " + "where id = " + "'" + user2.getId() + "'";
 					FtpUtil.sqlFileUpload(s1);
 				}

--
Gitblit v1.9.3