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/recordLegalperson/controller/RecordLegalpersonController.java |   62 ++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/springblade/modules/recordLegalperson/controller/RecordLegalpersonController.java b/src/main/java/org/springblade/modules/recordLegalperson/controller/RecordLegalpersonController.java
index 5e0ed92..266afc5 100644
--- a/src/main/java/org/springblade/modules/recordLegalperson/controller/RecordLegalpersonController.java
+++ b/src/main/java/org/springblade/modules/recordLegalperson/controller/RecordLegalpersonController.java
@@ -26,6 +26,7 @@
 import org.springblade.common.cache.ParamCache;
 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.log.exception.ServiceException;
@@ -33,20 +34,24 @@
 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.BeanUtil;
 import org.springblade.core.tool.utils.DigestUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.FTP.FtpUtil;
 import org.springblade.modules.information.entity.Information;
 import org.springblade.modules.information.service.IInformationService;
+import org.springblade.modules.record.entity.Record;
 import org.springblade.modules.recordLegalperson.dto.RecordLegalpersonDTO;
 import org.springblade.modules.recordLegalperson.entity.RecordLegalperson;
 import org.springblade.modules.recordLegalperson.service.IRecordLegalpersonService;
 import org.springblade.modules.recordLegalperson.vo.RecordLegalpersonVO;
+import org.springblade.modules.recordk.entity.Recordk;
 import org.springblade.modules.resource.service.IAttachService;
 import org.springblade.modules.system.entity.Dept;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IDeptService;
 import org.springblade.modules.system.service.IUserService;
+import org.springblade.modules.system.service.MyAsyncService;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -54,6 +59,7 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD;
 import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
@@ -75,6 +81,7 @@
 	private final IInformationService informationService;
 	private final IUserService userService;
 	private final IAttachService attachService;
+	private final MyAsyncService myAsyncService;
 
 	/**
 	 * 详情
@@ -139,22 +146,37 @@
 		if (map != null) {
 			String id = map.get("id").toString();
 			recordService.removeByIds(Func.toLongList(id));
-			String s1 = "delete from sys_record where id = " + "'" + id + "'";
-			FtpUtil.sqlFileUpload(s1);
+			String s1 = "delete from sys_record_legalperson where id = " + "'" + id + "'";
+			//FtpUtil.sqlFileUpload(s1);
+			myAsyncService.FTP(s1);
 		}
 		record.setStorage("1");
 		record.setType("2");
 		record.setPermitime(new Date());
-		recordService.save(record);
+
+		//脱敏处理
+		RecordLegalperson record1 = Objects.requireNonNull(BeanUtil.copy(record, RecordLegalperson.class));
+		//敏感数据处理
+		if (null!=record1.getRepresentativecell() && !record1.getRepresentativecell().equals("")) {
+			record1.setRepresentativecell(DesensitizedUtil.desensitizedPhoneNumber(record1.getRepresentativecell()));
+		}
+		if (null!=record1.getContacts() && !record1.getContacts().equals("")) {
+			record1.setContacts(DesensitizedUtil.desensitizedName(record1.getContacts()));
+		}
+		if (null!=record1.getContactscell() && !record1.getContactscell().equals("")) {
+			record1.setContactscell(DesensitizedUtil.desensitizedPhoneNumber(record1.getContactscell()));
+		}
+
+		recordService.save(record1);
 		//String offtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(record.getOfficetime());
 		//String pertime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(record.getPermitime());
-		String s = "insert into sys_record(id,representative," +
+		String s = "insert into sys_record_legalperson(id,representative," +
 			"address,business,registration,industry,type,ptype,representativecell,contacts,contactscell,perid,offices,jurisdiction,cardid,storage," +
 			"overtime," +
 			"changecontacts," +
 			"changecontactscell" +
 			")" +
-			"values(" + "'" + record.getId() + "'" + "," +
+			"values(" + "'" + record1.getId() + "'" + "," +
 			"'" + record.getRepresentative() + "'" + "," + "'" +
 			record.getAddress() + "'" + "," + "'" + record.getBusiness() + "'" + "," + "'" + record.getRegistration() + "'" + "," + "'" + record.getIndustry() + "'" + "," + "'" + record.getType() + "'" + "," + "'" + record.getPtype() + "'" + "," +
 			"'" + record.getRepresentativecell() + "'" + "," + "'" + record.getContacts() + "'" + "," + "'" + record.getContactscell() + "'" + "," + "'" + record.getPerid() + "'" + "," + "'" + record.getOffices() + "'" + "," + "'" + record.getJurisdiction() + "'" +
@@ -164,7 +186,8 @@
 			"," + "'" + record.getChangecontacts() + "'" +
 			"," + "'" + record.getChangecontactscell() + "'" +
 			")";
-		FtpUtil.sqlFileUpload(s);
+		//FtpUtil.sqlFileUpload(s);
+		myAsyncService.FTP(s);
 		return R.success("成功");
 	}
 
@@ -216,13 +239,14 @@
 				recordService.updateById(record);
 				status = true;
 				//数据同步到内网
-				String s1 = "update sys_record set type = " + "'" + record.getType() + "'" +
+				String s1 = "update sys_record_legalperson set type = " + "'" + record.getType() + "'" +
 							",approve = " + "'" + record.getApprove() + "'" +
 							" " + "where id = " + "'" + record.getId() + "';" +
 							"update sys_information set representative = " + "'" + information1.getRepresentative() + "'" +
 							",representativecell = " + "'" + information1.getRepresentativecell()  + "'" +
 							" " + "where id = " + "'" + information1.getId() + "'";
-				FtpUtil.sqlFileUpload(s1);
+				//FtpUtil.sqlFileUpload(s1);
+				myAsyncService.FTP(s1);
 			}else {
 				//按组织机构查询
 				Information information2 = new Information();
@@ -239,23 +263,25 @@
 					recordService.updateById(record);
 					status = true;
 					//数据同步到内网
-					String s1 = "update sys_record set type = " + "'" + record.getType() + "'" +
+					String s1 = "update sys_record_legalperson set type = " + "'" + record.getType() + "'" +
 						",approve = " + "'" + record.getApprove() + "'" +
 						" " + "where id = " + "'" + record.getId() + "';" +
 						"update sys_information set representative = " + "'" + information1.getRepresentative() + "'" +
 						",representativecell = " + "'" + information1.getRepresentativecell()  + "'" +
 						" " + "where id = " + "'" + information1.getId() + "'";
-					FtpUtil.sqlFileUpload(s1);
+					//FtpUtil.sqlFileUpload(s1);
+					myAsyncService.FTP(s1);
 				}else {
 					//设置未审核不通过
 					record.setType("1");
 					record.setApprove("当前公司单位未保安服务系统存在,请先注册!");
 					recordService.updateById(record);
 					//数据同步到内网
-					String s1 = "update sys_record set type = " + "'" + record.getType() + "'" +
+					String s1 = "update sys_record_legalperson set type = " + "'" + record.getType() + "'" +
 						",approve = " + "'" + record.getApprove() + "'" +
 						" " + "where id = " + "'" + record.getId() + "'";
-					FtpUtil.sqlFileUpload(s1);
+					//FtpUtil.sqlFileUpload(s1);
+					myAsyncService.FTP(s1);
 					throw new ServiceException("当前公司单位未保安服务系统存在,请先注册!");
 				}
 			}
@@ -265,10 +291,11 @@
 			//更新
 			recordService.updateById(record);
 			//数据同步
-			String s1 = "update sys_record set type = " + "'" + record.getType() + "'" +
+			String s1 = "update sys_record_legalperson set type = " + "'" + record.getType() + "'" +
 				",approve = " + "'" + record.getApprove() + "'" +
 				" " + "where id = " + "'" + record.getId() + "'";
-			FtpUtil.sqlFileUpload(s1);
+			//FtpUtil.sqlFileUpload(s1);
+			myAsyncService.FTP(s1);
 		}
 		//返回数据
 		return R.status(status);
@@ -292,6 +319,13 @@
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		//内网删除
+		List<Long> list = Func.toLongList(ids);
+		list.forEach(id -> {
+			//内网同步
+			String s1 = "delete from sys_record_legalperson where id = " + "'" + id + "'";
+			myAsyncService.FTP(s1);
+		});
 		return R.status(recordService.removeByIds(Func.toLongList(ids)));
 	}
 

--
Gitblit v1.9.3