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/recordk/controller/RecordkController.java |  122 +++++++++++++++++++++++++++++++---------
 1 files changed, 94 insertions(+), 28 deletions(-)

diff --git a/src/main/java/org/springblade/modules/recordk/controller/RecordkController.java b/src/main/java/org/springblade/modules/recordk/controller/RecordkController.java
index ed0b0b0..a0b6657 100644
--- a/src/main/java/org/springblade/modules/recordk/controller/RecordkController.java
+++ b/src/main/java/org/springblade/modules/recordk/controller/RecordkController.java
@@ -22,25 +22,35 @@
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
+import org.springblade.common.utils.DesensitizedUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.FTP.FtpUtil;
+import org.springblade.modules.information.service.IInformationService;
 import org.springblade.modules.permit.entity.Permit;
+import org.springblade.modules.permit.vo.PermitVO;
+import org.springblade.modules.record.dto.RecordDTO;
+import org.springblade.modules.record.entity.Record;
+import org.springblade.modules.recordk.dto.RecordkDTO;
 import org.springblade.modules.recordk.entity.Recordk;
 import org.springblade.modules.recordk.service.IRecordkService;
 import org.springblade.modules.recordk.vo.RecordkVO;
+import org.springblade.modules.system.service.MyAsyncService;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 /**
- *  控制器
+ * 控制器
  *
  * @author BladeX
  * @since 2021-07-12
@@ -52,6 +62,8 @@
 public class RecordkController extends BladeController {
 
 	private final IRecordkService recordkService;
+	private final IInformationService informationService;
+	private final MyAsyncService myAsyncService;
 
 	/**
 	 * 详情
@@ -83,7 +95,8 @@
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入recordk")
 	public R<IPage<RecordkVO>> page(RecordkVO recordk, Query query) {
-		IPage<RecordkVO> pages = recordkService.selectRecordkPage(Condition.getPage(query), recordk);
+		IPage<RecordkVO> pages;
+		pages = recordkService.selectRecordkPage(Condition.getPage(query), recordk, recordk.getJurisdiction());
 		return R.data(pages);
 	}
 
@@ -96,48 +109,79 @@
 	public R save(@Valid @RequestBody Recordk recordk) {
 		String cardid = recordk.getCardid();
 		String ptype = recordk.getPtype();
-		Map map = recordkService.selectIn(cardid,ptype);
-		if (map!=null){
+		Map map = recordkService.selectIn(cardid, ptype);
+		if (map != null) {
 			String id = map.get("id").toString();
 			recordkService.removeByIds(Func.toLongList(id));
 		}
 		recordk.setStorage("1");
 		recordk.setType("2");
 		recordk.setPermitime(new Date());
-		recordkService.save(recordk);
-		String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(recordk.getEstablishtime());
-		String offtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(recordk.getOfficetime());
-		String pertime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(recordk.getPermitime());
-		String s = "insert into sys_record(id,creditCode,enterpriseName,representative,establishtime," +
-			"registeredCapital,organizationCode,registrationNumber,identificationNumber,enterprises," +
-			"address,business,region,registration,industry,type,permitime,deptid,ptype,representativecell,contacts,contactscell,perid,offices,officetime,jurisdiction)" +
-			"values(" + "'" + recordk.getId() + "'" + "," + "'" + recordk.getCreditcode() + "'" + "," + "'" + recordk.getEnterprisename() + "'" + "," + "'"
-			+ recordk.getRepresentative() + "'" + "," +
-			"'" + formatStr + "'" + "," + "'" + recordk.getRegisteredcapital() + "'" + "," + "'"
-			+ recordk.getOrganizationcode() + "'" + "," + "'" + recordk.getRegistrationnumber() + "'" + "," +
-			"'" + recordk.getIdentificationnumber() + "'" + "," + "'" + recordk.getEnterprises() + "'" + "," + "'" +
+
+		//脱敏处理
+		Recordk recordk1 = Objects.requireNonNull(BeanUtil.copy(recordk, Recordk.class));
+		//敏感数据处理
+		if (null!=recordk1.getRepresentativecell() && !recordk1.getRepresentativecell().equals("")) {
+			recordk1.setRepresentativecell(DesensitizedUtil.desensitizedPhoneNumber(recordk1.getRepresentativecell()));
+		}
+		if (null!=recordk1.getContacts() && !recordk1.getContacts().equals("")) {
+			recordk1.setContacts(DesensitizedUtil.desensitizedName(recordk1.getContacts()));
+		}
+		if (null!=recordk1.getContactscell() && !recordk1.getContactscell().equals("")) {
+			recordk1.setContactscell(DesensitizedUtil.desensitizedPhoneNumber(recordk1.getContactscell()));
+		}
+		recordkService.save(recordk1);
+		String s = "insert into sys_recordk(id,creditCode,enterpriseName,representative," +
+			"address,business,region,registration,industry,type,deptid,ptype,representativecell,contacts,contactscell,cardid,overtime," +
+			"jurisdiction," +
+			"ksecuritys," +
+			"kproject," +
+			"kzipcode," +
+			"kservicetime," +
+			"kaddress" +
+			")" +
+			"values(" + "'" + recordk1.getId() + "'" + "," + "'" +
+			recordk.getCreditcode() + "'" + "," + "'" + recordk.getEnterprisename() + "'" + "," + "'"
+			+ recordk.getRepresentative() + "'" + "," + "'" +
 			recordk.getAddress() + "'" + "," + "'" + recordk.getBusiness() + "'" + "," + "'" +
-			recordk.getRegion() + "'" + "," + "'" + recordk.getRegistration() + "'" + "," + "'" + recordk.getIndustry() + "'" + "," + "'" + recordk.getType() + "'" + "," + "'" + pertime + "'" + "," + "'" + recordk.getDeptid() + "'" + "," + "'" + recordk.getPtype() + "'" + "," +
-			"'" + recordk.getRepresentativecell() + "'" + "," + "'" + recordk.getContacts() + "'" + "," + "'" + recordk.getContactscell() + "'" + "," +
-			"'" + recordk.getPerid() + "'" + "," + "'" + recordk.getOffices() + "'" + "," + "'" + offtime + "'" + "," + "'"+ ")";
-		FtpUtil.sqlFileUpload(s);
+			recordk.getRegion() + "'" + "," + "'" + recordk.getRegistration() + "'" + "," + "'" +
+			recordk.getIndustry() + "'" + "," + "'" + recordk.getType() + "'" + "," + "'" +
+			recordk.getDeptid() + "'" + "," + "'" + recordk.getPtype() + "'" + "," +
+			"'" + recordk.getRepresentativecell() + "'" + "," + "'" + recordk.getContacts() + "'" + "," + "'" +
+			recordk.getContactscell() + "'" + "," +
+			"'" + recordk.getCardid() + "'" + "," +
+			"'" + new SimpleDateFormat("yyyy-MM-dd").format(recordk.getOvertime()) + "'" + "," +
+			"'" + recordk.getJurisdiction() + "'" + "," +
+			"'" + recordk.getKsecuritys() + "'" + "," +
+			"'" + recordk.getKproject() + "'" + "," +
+			"'" + recordk.getKzipcode() + "'" + "," +
+			"'" + recordk.getKservicetime() + "'" + "," +
+			"'" + recordk.getKaddress() + "'" +
+			")";
+//		System.out.println(s);
+//		System.out.println(recordk.getKsecuritys());
+//		System.out.println(recordk.getKproject());
+//		System.out.println(recordk.getKzipcode());
+//		System.out.println(recordk.getKservicetime());
+//		System.out.println(recordk.getKaddress());
+//		System.out.println(recordk);
+//		FtpUtil.sqlFileUpload(s);
 		return R.success("成功");
 	}
 
 	/**
-	 *暂存
+	 * 暂存
 	 */
 	@PostMapping("/recorkstorage")
 	@ApiOperation(value = "新增", notes = "传入permit")
 	public R recorkstorage(@Valid @RequestBody Recordk recordk) {
 		String cardid = recordk.getCardid();
 		String ptype = recordk.getPtype();
-		Map map = recordkService.selectIn(cardid,ptype);
-		if (map!=null){
+		Map map = recordkService.selectIn(cardid, ptype);
+		if (map != null) {
 			recordk.setStorage("0");
 			recordkService.updateById(recordk);
-		}
-		else {
+		} else {
 			recordk.setStorage("0");
 			recordk.setPermitime(new Date());
 			recordkService.save(recordk);
@@ -152,7 +196,12 @@
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入recordk")
 	public R update(@Valid @RequestBody Recordk recordk) {
-		return R.status(recordkService.updateById(recordk));
+		boolean b = recordkService.updateById(recordk);
+		String s1 = "update sys_recordk set type = " + "'" + 0 + "'" + ",approve = " + "'" + recordk.getApprove() + "'" +
+			" " + "where id = " + "'" + recordk.getId() + "'";
+		//FtpUtil.sqlFileUpload(s1);
+		myAsyncService.FTP(s1);
+		return R.status(b);
 	}
 
 	/**
@@ -173,14 +222,31 @@
 	@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_recordk where id = " + "'" + id + "'";
+			myAsyncService.FTP(s1);
+		});
 		return R.status(recordkService.removeByIds(Func.toLongList(ids)));
 	}
 
 
 	@PostMapping("/selectIn")
-	public R selectIn(String cardid,String type) {
-		Map map = recordkService.selectIn(cardid,type);
+	public R selectIn(String cardid, String type) {
+		Map map = recordkService.selectIn(cardid, type);
 		return R.data(map);
 	}
 
+	/**
+	 * 保安公司项目备案信息(基本信息和附件列表信息)
+	 * @param record
+	 * @return
+	 */
+	@GetMapping("/details")
+	public R details(RecordkDTO record) {
+		RecordkDTO detail = recordkService.getDetails(record);
+		return R.data(detail);
+	}
 }

--
Gitblit v1.9.3