From b0625931bc528429d592f642bdd759e7dbdfb1c3 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 19 Oct 2021 22:21:07 +0800
Subject: [PATCH] 1.保安员新增接口修改,单个新增保安员默认密码为身份证号后6位,账号为身份证号, 2.考试成绩可以按天导出 3.个人图片批量导入接口修改 4.保安员批量导入修改,如有重复的账号导入的跳过,导入完成后返回提示信息

---
 src/main/java/org/springblade/modules/system/controller/UserController.java |   42 ++++++++++++++++--------------------------
 1 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/controller/UserController.java b/src/main/java/org/springblade/modules/system/controller/UserController.java
index b34520c..6c4ee81 100644
--- a/src/main/java/org/springblade/modules/system/controller/UserController.java
+++ b/src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -235,15 +235,7 @@
 		User user1 = userService.getById(user.getId());
 		user.setPassword(user1.getPassword());
 		userService.updateById(user);
-		Date birthday1 = user.getBirthday();
-		String birthday;
 		String rtime;
-		if (user.getBirthday() == null) {
-			birthday = null;
-		} else {
-			birthday = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getBirthday());
-		}
-
 		if (user.getRtime() == null) {
 			rtime = null;
 		} else {
@@ -602,10 +594,6 @@
 	public R securitySave(@Valid @RequestBody Map<String, Object> userMap) {
 		//获取user
 		User user = JSON.parseObject(JSON.toJSONString(userMap.get("user")), User.class);
-		//判断是否为空
-//		if (null!=user.getHold()){
-		//持证
-//			if (user.getHold().equals("1")){
 		//分配保安角色
 		Role role = new Role();
 		role.setRoleAlias("保安");
@@ -613,6 +601,7 @@
 		user.setRoleId(oneRole.getId().toString());
 		user.setDispatch("1");
 		user.setExaminationType("0");
+		user.setAccount(user.getCardid());
 
 		Integer userCount = userService.selectCount(user.getAccount());
 		if (userCount > 0 && Func.isEmpty(user.getId())) {
@@ -629,27 +618,20 @@
 //			}
 //		}
 		//密码加密
-		if (Func.isNotEmpty(user.getPassword())) {
-			user.setPassword(DigestUtil.encrypt(user.getPassword()));
+		if (Func.isNotEmpty(user.getCardid())) {
+//			user.setPassword(DigestUtil.encrypt(user.getPassword()));
+			//取身份证号码后6位作为密码
+			user.setPassword(DigestUtil.encrypt(user.getCardid().substring(user.getCardid().length() - 6)));
 		}
 		user.setTenantId("000000");
 		//用户新增
 		boolean status = userService.save(user);
-
-		String birthday;
 		String rtime;
-		if (user.getBirthday() == null) {
-			birthday = null;
-		} else {
-			birthday = new SimpleDateFormat("yyyy-MM-dd").format(user.getBirthday());
-		}
-
 		if (user.getRtime() == null) {
 			rtime = null;
 		} else {
 			rtime = new SimpleDateFormat("yyyy-MM-dd").format(user.getRtime());
 		}
-
 		//头像
 		if (null!=user.getAvatar() && !user.getAvatar().equals("")) {
 			user.setAvatar(FtpConfig.ip + user.getAvatar().substring(26));
@@ -662,9 +644,17 @@
 
 		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,rtime,securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch) " +
-			"values(" + "'" + user.getId() + "'" + "," + "'" + user.getTenantId() + "'" + "," + "'" + user.getAccount() + "'" + "," +
-			"'" + user.getPassword() + "'" + "," + "'" + user.getName() + "'" + "," + "'" + user.getRealName() + "'" + "," + "'" + user.getAvatar() + "'" + "," +
-			"'" + user.getEmail() + "'" + "," + "'" + user.getPhone() + "'" + "," + "'" + user.getSex() + "'" + "," + "'" + user.getRoleId() + "'" +
+			"values(" + "'" + user.getId() + "'" +
+			"," + "'" + user.getTenantId() + "'" +
+			"," + "'" + user.getAccount() + "'" +
+			"," + "'" + user.getPassword() + "'" +
+			"," + "'" + user.getName() + "'" +
+			"," + "'" + user.getRealName() + "'" +
+			"," + "'" + user.getAvatar() + "'" +
+			"," + "'" + user.getEmail() + "'" +
+			"," + "'" + user.getPhone() + "'" +
+			"," + "'" + user.getSex() + "'" +
+			"," + "'" + user.getRoleId() + "'" +
 			"," + "'" + user.getDeptId() + "'" +
 			"," + "'" + user.getCardid() + "'" +
 			"," + "'" + user.getNativeplace() + "'" +

--
Gitblit v1.9.3