From 425fb772c347a85fe8c9cb38a7a386d6368402cd Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 05 Nov 2021 16:36:57 +0800
Subject: [PATCH] 1.许可

---
 src/main/java/org/springblade/modules/record/controller/RecordController.java |   86 +++++++++++++++++++++++++-----------------
 1 files changed, 51 insertions(+), 35 deletions(-)

diff --git a/src/main/java/org/springblade/modules/record/controller/RecordController.java b/src/main/java/org/springblade/modules/record/controller/RecordController.java
index 9f90273..3d773d7 100644
--- a/src/main/java/org/springblade/modules/record/controller/RecordController.java
+++ b/src/main/java/org/springblade/modules/record/controller/RecordController.java
@@ -35,6 +35,7 @@
 import org.springblade.modules.FTP.FtpUtil;
 import org.springblade.modules.information.entity.Information;
 import org.springblade.modules.information.service.IInformationService;
+import org.springblade.modules.permit.vo.PermitVO;
 import org.springblade.modules.record.entity.Record;
 import org.springblade.modules.record.service.IRecordService;
 import org.springblade.modules.record.vo.RecordVO;
@@ -101,7 +102,22 @@
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入record")
 	public R<IPage<RecordVO>> page(RecordVO record, Query query) {
-		IPage<RecordVO> pages = recordService.selectRecordPage(Condition.getPage(query), record);
+		IPage<RecordVO> pages;
+		if (record.getUsetype().equals("0")) {
+			pages = recordService.selectRecordPage(Condition.getPage(query), record, null);
+		} else if (record.getUsetype().equals("1")) {
+			String childer = informationService.selJurchilder(record.getJurisdiction());
+			String[] split = childer.split(",");
+			String strArrays = "";
+			for (int j = 0; j < split.length; j++) {
+				strArrays += "'" + split[j] + "',";
+			}
+			String jurisdiction = strArrays.substring(0, strArrays.length() - 1);
+			pages = recordService.selectRecordPage(Condition.getPage(query), record, jurisdiction);
+		} else {
+			pages = recordService.selectRecordPage(Condition.getPage(query), record, null);
+		}
+
 		return R.data(pages);
 	}
 
@@ -114,26 +130,27 @@
 	public R save(@Valid @RequestBody Record record) {
 		String cardid = record.getCardid();
 		String type = record.getPtype();
-		Map map = recordService.selectIn(cardid,type);
+		Map map = recordService.selectIn(cardid, type);
 		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);
 		}
 		record.setStorage("1");
 		record.setType("2");
 		record.setPermitime(new Date());
 		recordService.save(record);
-		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,enterpriseName,representative," +
-			"address,business,registration,industry,type,permitime,ptype,representativecell,contacts,contactscell,perid,offices,officetime,jurisdiction,cardid,storage,overtime)" +
-			"values(" + "'" + record.getId() + "'"+ "," + "'" + record.getEnterprisename() + "'" + "," +
-			"'" + record.getRepresentative() + "'"+ "," + "'" +
-			record.getAddress() + "'" + "," + "'" + record.getBusiness() + "'" + "," + "'" + record.getRegistration() + "'" + "," + "'" + record.getIndustry() + "'" + "," + "'" + record.getType() + "'" + "," + "'" + pertime + "'" + "," + "'" + record.getPtype() + "'" + "," +
-			"'" + record.getRepresentativecell() + "'" + "," + "'" + record.getContacts() + "'" + "," + "'" + record.getContactscell() + "'" + "," +"'" + record.getPerid() + "'" + "," + "'" + record.getOffices() + "'" + "," +
-			"'" + offtime + "'" + "," + "'" + record.getJurisdiction() + "'" +
-			"," + "'" + record.getCardid() + "'"+
-			"," + "'" + record.getStorage() + "'"+
+		//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," +
+			"address,business,registration,industry,type,ptype,representativecell,contacts,contactscell,perid,offices,jurisdiction,cardid,storage,overtime)" +
+			"values(" + "'" + record.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() + "'" +
+			"," + "'" + record.getCardid() + "'" +
+			"," + "'" + record.getStorage() + "'" +
 			"," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(record.getOvertime()) + "'"
 			+ ")";
 		FtpUtil.sqlFileUpload(s);
@@ -149,7 +166,7 @@
 	public R rocordsave(@Valid @RequestBody Record record) {
 		String cardid = record.getCardid();
 		String type = record.getPtype();
-		Map map = recordService.selectIn(cardid,type);
+		Map map = recordService.selectIn(cardid, type);
 		if (map != null) {
 			record.setStorage("0");
 			record.setPermitime(new Date());
@@ -173,7 +190,7 @@
 		//审核通过
 		if (record.getType().equals("0")) {
 			//新增组织机构和单位信息
-			Information information =new Information();
+			Information information = new Information();
 			information.setCreditcode(record.getCreditcode());
 			information.setEnterprisename(record.getEnterprisename());
 			information.setRepresentative(record.getRepresentative());
@@ -192,7 +209,7 @@
 			information.setContactscell(record.getContactscell());
 			Dept dept = new Dept();
 			//本市公司
-			if (record.getPtype().equals("2")){
+			if (record.getPtype().equals("2")) {
 				Long i = 1425366663452196865L;
 				dept.setParentId(i);
 				dept.setAncestors("0,1425366663452196865");
@@ -222,26 +239,25 @@
 			user.setPassword(initPassword);
 			boolean b = userService.saveOrUpdate(user);
 			//把附件添加单位id
-			attachService.updat(information.getDepartmentid(),record.getCardid());
+			attachService.updat(information.getDepartmentid(), record.getCardid());
 			String s1 = "update sys_record set type = " + "'" + record.getType() + "'" +
-				",papprove = " + "'" + record.getPapprove() + "'"+
-				",xapprove = " + "'" + record.getXapprove() + "'"+
-				",sapprove = " + "'" + record.getSapprove() + "'"+
-				",popinion = " + "'" + record.getPopinion() + "'"+
-				",sopinion = " + "'" + record.getSopinion() + "'"+
-				",xopinion = " + "'" + record.getXopinion() + "'"+
-				" " +"where id = " + "'" + record.getId() + "'";
+				",papprove = " + "'" + record.getPapprove() + "'" +
+				",xapprove = " + "'" + record.getXapprove() + "'" +
+				",sapprove = " + "'" + record.getSapprove() + "'" +
+				",popinion = " + "'" + record.getPopinion() + "'" +
+				",sopinion = " + "'" + record.getSopinion() + "'" +
+				",xopinion = " + "'" + record.getXopinion() + "'" +
+				" " + "where id = " + "'" + record.getId() + "'";
 			FtpUtil.sqlFileUpload(s1);
-		}
-		else {
+		} else {
 			String s1 = "update sys_record set type = " + "'" + record.getType() + "'" +
-				",papprove = " + "'" + record.getPapprove() + "'"+
-				",xapprove = " + "'" + record.getXapprove() + "'"+
-				",sapprove = " + "'" + record.getSapprove() + "'"+
-				",popinion = " + "'" + record.getPopinion() + "'"+
-				",sopinion = " + "'" + record.getSopinion() + "'"+
-				",xopinion = " + "'" + record.getXopinion() + "'"+
-				" " +"where id = " + "'" + record.getId() + "'";
+				",papprove = " + "'" + record.getPapprove() + "'" +
+				",xapprove = " + "'" + record.getXapprove() + "'" +
+				",sapprove = " + "'" + record.getSapprove() + "'" +
+				",popinion = " + "'" + record.getPopinion() + "'" +
+				",sopinion = " + "'" + record.getSopinion() + "'" +
+				",xopinion = " + "'" + record.getXopinion() + "'" +
+				" " + "where id = " + "'" + record.getId() + "'";
 			FtpUtil.sqlFileUpload(s1);
 		}
 		return R.status(recordService.saveOrUpdate(record));
@@ -270,8 +286,8 @@
 
 
 	@PostMapping("/selectIn")
-	public R selectIn(String cardid,String type) {
-		Map map = recordService.selectIn(cardid,type);
+	public R selectIn(String cardid, String type) {
+		Map map = recordService.selectIn(cardid, type);
 		return R.data(map);
 	}
 }

--
Gitblit v1.9.3