From e7ab1bbde7d604278de8092a44453e035b9c13ad Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 27 Aug 2021 09:11:11 +0800
Subject: [PATCH] 1.许可审批

---
 src/main/java/org/springblade/modules/record/controller/RecordController.java |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 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 e53259f..54bdc57 100644
--- a/src/main/java/org/springblade/modules/record/controller/RecordController.java
+++ b/src/main/java/org/springblade/modules/record/controller/RecordController.java
@@ -39,7 +39,7 @@
 import java.util.Map;
 
 /**
- *  控制器
+ * 控制器
  *
  * @author BladeX
  * @since 2021-07-12
@@ -70,6 +70,7 @@
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入record")
 	public R<IPage<Record>> list(Record record, Query query) {
+		record.setStorage("1");
 		IPage<Record> pages = recordService.page(Condition.getPage(query), Condition.getQueryWrapper(record));
 		return R.data(pages);
 	}
@@ -93,28 +94,29 @@
 	@ApiOperation(value = "新增", notes = "传入record")
 	public R save(@Valid @RequestBody Record record) {
 		String cardid = record.getCardid();
-		Map map = recordService.selectIn(cardid);
-		if (map!=null){
+		String type = record.getPtype();
+		Map map = recordService.selectIn(cardid,type);
+		if (map != null) {
 			String id = map.get("id").toString();
 			recordService.removeByIds(Func.toLongList(id));
 		}
 		record.setStorage("1");
+		record.setType("2");
 		record.setPermitime(new Date());
 		recordService.save(record);
 		String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(record.getEstablishtime());
 		String offtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(record.getOfficetime());
-		String s = "insert into sys_record(id,creditCode,enterpriseName,representative,establishTime," +
+		String pertime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(record.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)" +
-			"values(" + "'" + record.getId() + "'" + "," + "'" + record.getCreditcode() + "'" + "," + "'" + record.getEnterprisename() + "'" + "," + "'"
-			+ record.getRepresentative() + "'" + "," +
+			"address,business,region,registration,industry,type,permitime,deptid,ptype,representativecell,contacts,contactscell,perid,offices,officetime,jurisdiction)" +
+			"values(" + "'" + record.getId() + "'" + "," + "'" + record.getCreditcode() + "'" + "," + "'" + record.getEnterprisename() + "'" + "," + "'"+ record.getRepresentative() + "'" + "," +
 			"'" + formatStr + "'" + "," + "'" + record.getRegisteredcapital() + "'" + "," + "'"
 			+ record.getOrganizationcode() + "'" + "," + "'" + record.getRegistrationnumber() + "'" + "," +
 			"'" + record.getIdentificationnumber() + "'" + "," + "'" + record.getEnterprises() + "'" + "," + "'" +
 			record.getAddress() + "'" + "," + "'" + record.getBusiness() + "'" + "," + "'" +
-			record.getRegion() + "'" + "," + "'" + record.getRegistration() + "'" + "," + "'" + record.getIndustry()+ "'" + "," + "'"+ record.getType() + "'" + "," +"'" + record.getPermitime() + "'" + "," + "'" + record.getDeptid() + "'" + "," + "'" + record.getPtype() + "'" + "," +
-			"'" + record.getRepresentativecell() + "'" + "," + "'" + record.getContacts() + "'" + "," + "'" + record.getContactscell() + "'"+"," +
-			"'" + record.getPerid() + "'"+"," + "'" + record.getOffices() + "'"+"," + "'" + offtime + "'"+")" ;
+			record.getRegion() + "'" + "," + "'" + record.getRegistration() + "'" + "," + "'" + record.getIndustry() + "'" + "," + "'" + record.getType() + "'" + "," + "'" + pertime + "'" + "," + "'" + record.getDeptid() + "'" + "," + "'" + record.getPtype() + "'" + "," +
+			"'" + record.getRepresentativecell() + "'" + "," + "'" + record.getContacts() + "'" + "," + "'" + record.getContactscell() + "'" + "," +"'" + record.getPerid() + "'" + "," + "'" + record.getOffices() + "'" + "," + "'" + offtime + "'" + "," + "'" + record.getJurisdiction() + "'" + ")";
 		FtpUtil.sqlFileUpload(s);
 		return R.success("成功");
 	}
@@ -127,16 +129,15 @@
 	@ApiOperation(value = "新增", notes = "传入record")
 	public R rocordsave(@Valid @RequestBody Record record) {
 		String cardid = record.getCardid();
-		Map map = recordService.selectIn(cardid);
-		if (map!=null){
+		String type = record.getPtype();
+		Map map = recordService.selectIn(cardid,type);
+		if (map != null) {
 			record.setStorage("0");
 			record.setPermitime(new Date());
 			recordService.updateById(record);
-		}
-		else {
+		} else {
 			record.setStorage("0");
 			record.setType("2");
-			record.setPtype("2");
 			record.setPermitime(new Date());
 			recordService.save(record);
 		}
@@ -176,8 +177,8 @@
 
 
 	@PostMapping("/selectIn")
-	public R selectIn(String cardid) {
-		Map map = recordService.selectIn(cardid);
+	public R selectIn(String cardid,String type) {
+		Map map = recordService.selectIn(cardid,type);
 		return R.data(map);
 	}
 }

--
Gitblit v1.9.3