From d540103feb027cfaee61cdeb6e5dac4e2b20b7ff Mon Sep 17 00:00:00 2001 From: gaojuan Date: Sat, 22 Apr 2023 16:27:24 +0800 Subject: [PATCH] updadte --- .../script/gj/crawl/OfficeProcess.groovy | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/OfficeProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/OfficeProcess.groovy index e422b860f..231a930c8 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/OfficeProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/OfficeProcess.groovy @@ -3,6 +3,7 @@ package com.fangjia.script.gj.crawl import com.fangjia.core.RegionData import com.fangjia.core.util.DataUtil import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.gj.ccb.FileUtils import com.fangjia.script.looplineinfo.InsidePolygon import com.fangjia.script.looplineinfo.Point import com.fangjia.script.util.CosineSimilarAlgorithm @@ -43,10 +44,10 @@ class OfficeProcess { // task.nameFiter(filePath) // task.typeFiter(filePath) // task.nameFlag(filePath) - task.updateFlagToDB(filePath) +// task.updateFlagToDB(filePath) // task.updateFlagToDB2(filePath) -// task.checkRegion() + task.checkRegion() } @@ -382,13 +383,26 @@ class OfficeProcess { def updateFlagToDB(filePath){ def datas = ExcelUtils.read(filePath,0,1) def total = datas.size() + println total def index = 0 + def rets = [] for(def d : datas){ def sql = "alter table office update option='${d['L']}', format_name='${d['K']}' where city='${d['B']}' and region='${d['C']}' and name='${d['D']}';" index++ - sqlInstance.executeUpdate(sql) - println index+"/"+ total + rets << sql + //sqlInstance.executeUpdate(sql) + //println index+"/"+ total + println sql } + + + def filePath1 = "d:\\Data1.txt" + File file = new File(filePath1) + def s = new StringBuffer() + for(def r : rets){ + s.append(r+"\n") + } + file.write(s.toString()) } @@ -457,7 +471,7 @@ class OfficeProcess { pstmt.setString(5, d['D']) println count+" "+d['L']+" "+d['K']+" "+d['B']+" "+d['C']+" "+d['D'] pstmt.addBatch() - if(count % 10 ==0) { + if(count % 100 ==0) { pstmt.executeBatch() } }