From 8d43111bd0e598bc0b2014cbfa69a32e74959dff Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 15 Dec 2021 19:24:05 +0800
Subject: [PATCH] ftp sql 同步封装

---
 src/main/java/org/springblade/modules/recordk/controller/RecordkController.java |   47 +++++++++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 16 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 fc63983..6c04e2f 100644
--- a/src/main/java/org/springblade/modules/recordk/controller/RecordkController.java
+++ b/src/main/java/org/springblade/modules/recordk/controller/RecordkController.java
@@ -28,7 +28,9 @@
 import org.springblade.core.tool.api.R;
 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.recordk.entity.Recordk;
 import org.springblade.modules.recordk.service.IRecordkService;
 import org.springblade.modules.recordk.vo.RecordkVO;
@@ -52,7 +54,7 @@
 public class RecordkController extends BladeController {
 
 	private final IRecordkService recordkService;
-
+	private final IInformationService informationService;
 	/**
 	 * 详情
 	 */
@@ -83,7 +85,22 @@
 	@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());
+//		if (recordk.getUsetype().equals("0")) {
+//			pages = recordkService.selectRecordkPage(Condition.getPage(query), recordk,null);
+//		} else if (recordk.getUsetype().equals("1")) {
+//			String childer = informationService.selJurchilder(recordk.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 = recordkService.selectRecordkPage(Condition.getPage(query), recordk,jurisdiction);
+//		} else {
+//			pages = recordkService.selectRecordkPage(Condition.getPage(query), recordk,null);
+//		}
 		return R.data(pages);
 	}
 
@@ -105,21 +122,15 @@
 		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,cardid)" +
+		//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_recordk(id,creditCode,enterpriseName,representative," +
+			"address,business,region,registration,industry,type,deptid,ptype,representativecell,contacts,contactscell,cardid,overtime,jurisdiction)" +
 			"values(" + "'" + recordk.getId() + "'" + "," + "'" + recordk.getCreditcode() + "'" + "," + "'" + recordk.getEnterprisename() + "'" + "," + "'"
-			+ recordk.getRepresentative() + "'" + "," +
-			"'" + formatStr + "'" + "," + "'" + recordk.getRegisteredcapital() + "'" + "," + "'"
-			+ recordk.getOrganizationcode() + "'" + "," + "'" + recordk.getRegistrationnumber() + "'" + "," +
-			"'" + recordk.getIdentificationnumber() + "'" + "," + "'" + recordk.getEnterprises() + "'" + "," + "'" +
+			+ 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 + "'"+ "," + "'" + recordk.getCardid() + "'"+")";
+			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()+"'"+")";
 		FtpUtil.sqlFileUpload(s);
 		return R.success("成功");
 	}
@@ -152,7 +163,11 @@
 	@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);
+		return R.status(b);
 	}
 
 	/**

--
Gitblit v1.9.3