From 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 16 Jun 2022 14:36:07 +0800
Subject: [PATCH] 模拟考试修改

---
 src/main/java/org/springblade/modules/information/controller/InformationController.java |  104 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/src/main/java/org/springblade/modules/information/controller/InformationController.java b/src/main/java/org/springblade/modules/information/controller/InformationController.java
index 9cac3ca..3bc4f69 100644
--- a/src/main/java/org/springblade/modules/information/controller/InformationController.java
+++ b/src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -26,6 +26,7 @@
 import org.springblade.common.cache.DictCache;
 import org.springblade.common.config.FtpConfig;
 import org.springblade.common.enums.DictEnum;
+import org.springblade.common.utils.DesensitizedUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.excel.util.ExcelUtil;
@@ -34,12 +35,10 @@
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.support.Kv;
-import org.springblade.core.tool.utils.DateUtil;
-import org.springblade.core.tool.utils.DigestUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.modules.FTP.FtpUtil;
 import org.springblade.modules.FTP.OutJson;
+import org.springblade.modules.dispatcher.entity.DispatcherUnit;
 import org.springblade.modules.information.entity.Information;
 import org.springblade.modules.information.excel.ExportInformationExcel;
 import org.springblade.modules.information.excel.ExportInformationSecurityStatistics;
@@ -193,8 +192,20 @@
 
 		information.setCreateTime(new Date());
 
+		Information information1 = Objects.requireNonNull(BeanUtil.copy(information, Information.class));
+		//敏感数据处理
+		if (null!=information1.getRepresentativecell() && !information1.getRepresentativecell().equals("")) {
+			information1.setRepresentativecell(DesensitizedUtil.desensitizedPhoneNumber(information1.getRepresentativecell()));
+		}
+		if (null!=information1.getContacts() && !information1.getContacts().equals("")) {
+			information1.setContacts(DesensitizedUtil.desensitizedName(information1.getContacts()));
+		}
+		if (null!=information1.getContactscell() && !information1.getContactscell().equals("")) {
+			information1.setContactscell(DesensitizedUtil.desensitizedPhoneNumber(information1.getContactscell()));
+		}
+
 		//公司新增
-		boolean status = informationService.save(information);
+		boolean status = informationService.save(information1);
 
 		//公司新增成功则创建默认账户,公司名即为账号名,默认密码为 123456
 		if (status) {
@@ -230,7 +241,7 @@
 					",registeredCapital,organizationCode,registrationNumber, enterprises, address," +
 					" business,region,registration,industry,departmentid,stats,jurisdiction,representativecell," +
 					"contacts,contactscell,create_time,create_user_id) " +
-					"values(" + "'" + information.getId() + "'" +
+					"values(" + "'" + information1.getId() + "'" +
 					"," + "'" + information.getCreditcode() + "'" +
 					"," + "'" + information.getEnterprisename() + "'" +
 					"," + "'" + information.getRepresentative() + "'" +
@@ -284,7 +295,18 @@
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入information")
 	public R update(@Valid @RequestBody Information information) throws Exception {
-		boolean b = informationService.updateById(information);
+		Information information1 = Objects.requireNonNull(BeanUtil.copy(information, Information.class));;
+		//敏感数据处理
+		if (null!=information1.getRepresentativecell() && !information1.getRepresentativecell().equals("")) {
+			information1.setRepresentativecell(DesensitizedUtil.desensitizedPhoneNumber(information1.getRepresentativecell()));
+		}
+		if (null!=information1.getContacts() && !information1.getContacts().equals("")) {
+			information1.setContacts(DesensitizedUtil.desensitizedName(information1.getContacts()));
+		}
+		if (null!=information1.getContactscell() && !information1.getContactscell().equals("")) {
+			information1.setContactscell(DesensitizedUtil.desensitizedPhoneNumber(information1.getContactscell()));
+		}
+		boolean b = informationService.updateById(information1);
 		if (b) {
 			String businessLicense = null;
 			String businessLicenses = null;
@@ -303,32 +325,54 @@
 			} else {
 				licences = "";
 			}
+
 			if (information.getEstablishtime() != null && !"".equals(information.getEstablishtime())) {
 				format = new SimpleDateFormat("yyyy-MM-dd").format(information.getEstablishtime());
+				//内网同步
+				String s1 = "update sys_information set creditCode = " + "'" + information.getCreditcode() + "'" +
+					",enterpriseName = " + "'" + information.getEnterprisename() + "'" +
+					",representative = " + "'" + information.getRepresentative() + "'" +
+					",establishTime = " + "'" + format + "'" +
+					",registeredCapital = " + "'" + information.getRegisteredcapital() + "'" +
+					",jurisdiction = " + "'" + information.getJurisdiction() + "'" +
+					",enterprises = " + "'" + information.getEnterprises() + "'" +
+					",address = " + "'" + information.getAddress() + "'" +
+					",business = " + "'" + information.getBusiness() + "'" +
+					",region = " + "'" + information.getRegion() + "'" +
+					",registration = " + "'" + information.getRegistration() + "'" +
+					",industry = " + "'" + information.getIndustry() + "'" +
+					",departmentid = " + "'" + information.getDepartmentid() + "'" +
+					",stats = " + "'" + information.getStats() + "'" +
+					",representativecell = " + "'" + information.getRepresentativecell() + "'" +
+					",contacts = " + "'" + information.getContacts() + "'" +
+					",contactscell = " + "'" + information.getContactscell() + "'" +
+					",business_License = " + "'" + businessLicenses + "'" +
+					",licence = " + "'" + licences + "'" +
+					" " + "where id = " + "'" + information.getId() + "'";
+			}else {
+				//内网同步
+				String s1 = "update sys_information set creditCode = " + "'" + information.getCreditcode() + "'" +
+					",enterpriseName = " + "'" + information.getEnterprisename() + "'" +
+					",representative = " + "'" + information.getRepresentative() + "'" +
+					",registeredCapital = " + "'" + information.getRegisteredcapital() + "'" +
+					",jurisdiction = " + "'" + information.getJurisdiction() + "'" +
+					",enterprises = " + "'" + information.getEnterprises() + "'" +
+					",address = " + "'" + information.getAddress() + "'" +
+					",business = " + "'" + information.getBusiness() + "'" +
+					",region = " + "'" + information.getRegion() + "'" +
+					",registration = " + "'" + information.getRegistration() + "'" +
+					",industry = " + "'" + information.getIndustry() + "'" +
+					",departmentid = " + "'" + information.getDepartmentid() + "'" +
+					",stats = " + "'" + information.getStats() + "'" +
+					",representativecell = " + "'" + information.getRepresentativecell() + "'" +
+					",contacts = " + "'" + information.getContacts() + "'" +
+					",contactscell = " + "'" + information.getContactscell() + "'" +
+					",business_License = " + "'" + businessLicenses + "'" +
+					",licence = " + "'" + licences + "'" +
+					" " + "where id = " + "'" + information.getId() + "'";
+				//FtpUtil.sqlFileUpload(s1);
+				myAsyncService.FTP(s1);
 			}
-			//内网同步
-			String s1 = "update sys_information set creditCode = " + "'" + information.getCreditcode() + "'" +
-				",enterpriseName = " + "'" + information.getEnterprisename() + "'" +
-				",representative = " + "'" + information.getRepresentative() + "'" +
-				",establishTime = " + "'" + format + "'" +
-				",registeredCapital = " + "'" + information.getRegisteredcapital() + "'" +
-				",jurisdiction = " + "'" + information.getJurisdiction() + "'" +
-				",enterprises = " + "'" + information.getEnterprises() + "'" +
-				",address = " + "'" + information.getAddress() + "'" +
-				",business = " + "'" + information.getBusiness() + "'" +
-				",region = " + "'" + information.getRegion() + "'" +
-				",registration = " + "'" + information.getRegistration() + "'" +
-				",industry = " + "'" + information.getIndustry() + "'" +
-				",departmentid = " + "'" + information.getDepartmentid() + "'" +
-				",stats = " + "'" + information.getStats() + "'" +
-				",representativecell = " + "'" + information.getRepresentativecell() + "'" +
-				",contacts = " + "'" + information.getContacts() + "'" +
-				",contactscell = " + "'" + information.getContactscell() + "'" +
-				",business_License = " + "'" + businessLicenses + "'" +
-				",licence = " + "'" + licences + "'" +
-				" " + "where id = " + "'" + information.getId() + "'";
-			//FtpUtil.sqlFileUpload(s1);
-			myAsyncService.FTP(s1);
 		}
 		return R.success("修改成功");
 	}

--
Gitblit v1.9.3