From eab5d02a04a6f4c36e132825e050e3bc2eb75c2d Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Tue, 17 May 2022 16:52:59 +0800
Subject: [PATCH] 注册修改

---
 src/main/java/org/springblade/modules/zc/controller/ZcController.java |   72 ++++++++++++++++++++++++++---------
 1 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/src/main/java/org/springblade/modules/zc/controller/ZcController.java b/src/main/java/org/springblade/modules/zc/controller/ZcController.java
index a6b84d6..35a9b6b 100644
--- a/src/main/java/org/springblade/modules/zc/controller/ZcController.java
+++ b/src/main/java/org/springblade/modules/zc/controller/ZcController.java
@@ -22,6 +22,7 @@
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
+import org.springblade.common.utils.DesensitizedUtil;
 import org.springblade.common.vo.DeptVo;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
@@ -208,6 +209,32 @@
 		if (userCount > 0) {
 			throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前用户 [{}] 已存在!", zc.getUsername()));
 		}
+		//数据脱敏处理
+		String name = DesensitizedUtil.desensitizedName(zc.getSname());
+		String cardid = DesensitizedUtil.desensitizedIdNumber(zc.getCardid());
+		String phone = DesensitizedUtil.desensitizedPhoneNumber(zc.getPhone());
+
+		//帐号默认姓+身份证后四位
+		zc.setUsername(name.substring(0,1)+cardid.substring(cardid.length()-4));
+
+		//内网储存完整数据
+		String s = "insert into act_zc(id,username,password,sname,sex,phone,zctime,parent_id,jurisdiction,cardid,address)" +
+			"values(" + "'" + zc.getId() + "'" +
+			"," + "'" + zc.getUsername() + "'" +
+			"," + "'" + zc.getPassword() + "'" +
+			"," + "'" + zc.getSname() + "'" +
+			"," + "'" + zc.getSex() + "'" +
+			"," + "'" + zc.getPhone() + "'" +
+			"," + "'" + zc.getZctime() + "'" +
+			"," + "'" + zc.getParentId() + "'" +
+			"," + "'" + zc.getJurisdiction() + "'" +
+			"," + "'" + zc.getCardid() + "'" +
+			"," + "'" + zc.getAddress() + "'"
+			+ ")";
+		zc.setSname(name);
+		zc.setCardid(cardid);
+		zc.setPhone(phone);
+
 		zcService.inster(zc);
 		//同时新增到用户表
 		User user = new User();
@@ -216,34 +243,41 @@
 		user.setRealName(zc.getSname());
 		user.setSex(Integer.valueOf(zc.getSex()));
 		user.setPhone(zc.getPhone());
-		user.setDeptId(zc.getDeptid());
+		//user.setDeptId(zc.getDeptid());
 		user.setRoleId(zc.getParentId());
 		user.setWorkaddress(zc.getWorkaddress());
 		user.setWorkjurisdiction(zc.getWorkjurisdiction());
-		user.setJurisdiction(zc.getJurisdiction());
 		user.setExamination_type("0");
 		user.setExamination_mx("正常");
+		user.setFirstlogin("0");
 		user.setCardid(zc.getCardid());
-		if (zc.getSignal() != null) {
-			user.setSignal(zc.getSignal());
+		if (!zc.getSignals().equals("")) {
+			user.setSignals(zc.getSignals());
 		}
 		user.setStype("0");
-		user.setAddress(zc.getAddress());
+		if (!zc.getAddress().equals("")) {
+			user.setAddress(zc.getAddress());
+			user.setJurisdiction(zc.getJurisdiction());
+		}
+		if (!zc.getJobUnit().equals("")) {
+			user.setJobUnit(zc.getJobUnit());
+		}
 		iUserService.saveOrUpdate(user);
-		String s = "insert into act_zc(id,username,password,sname,sex,phone,zctime,deptid,parent_id,jurisdiction,cardid,address)" +
-			"values(" + "'" + zc.getId() + "'" +
-			"," + "'" + zc.getUsername() + "'" +
-			"," + "'" + zc.getPassword() + "'" +
-			"," + "'" + zc.getSname() + "'" +
-			"," + "'" + zc.getSex() + "'" +
-			"," + "'" + zc.getPhone() + "'" +
-			"," + "'" + zc.getZctime() + "'" +
-			"," + "'" + zc.getDeptid() + "'" +
-			"," + "'" + zc.getParentId() + "'" +
-			"," + "'" + zc.getJurisdiction() + "'" +
-			"," + "'" + zc.getCardid() + "'" +
-			"," + "'" + zc.getAddress() + "'"
-			+ ")";
+
+//		String s = "insert into act_zc(id,username,password,sname,sex,phone,zctime,deptid,parent_id,jurisdiction,cardid,address)" +
+//			"values(" + "'" + zc.getId() + "'" +
+//			"," + "'" + zc.getUsername() + "'" +
+//			"," + "'" + zc.getPassword() + "'" +
+//			"," + "'" + zc.getSname() + "'" +
+//			"," + "'" + zc.getSex() + "'" +
+//			"," + "'" + zc.getPhone() + "'" +
+//			"," + "'" + zc.getZctime() + "'" +
+//			"," + "'" + zc.getDeptid() + "'" +
+//			"," + "'" + zc.getParentId() + "'" +
+//			"," + "'" + zc.getJurisdiction() + "'" +
+//			"," + "'" + zc.getCardid() + "'" +
+//			"," + "'" + zc.getAddress() + "'"
+//			+ ")";
 		FtpUtil.sqlFileUpload(s);
 		return R.success("新增成功");
 	}

--
Gitblit v1.9.3