This commit is contained in:
2023-04-22 16:27:24 +08:00
parent 832450a795
commit d540103feb
@@ -3,6 +3,7 @@ package com.fangjia.script.gj.crawl
import com.fangjia.core.RegionData import com.fangjia.core.RegionData
import com.fangjia.core.util.DataUtil import com.fangjia.core.util.DataUtil
import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.ccb.FileUtils
import com.fangjia.script.looplineinfo.InsidePolygon import com.fangjia.script.looplineinfo.InsidePolygon
import com.fangjia.script.looplineinfo.Point import com.fangjia.script.looplineinfo.Point
import com.fangjia.script.util.CosineSimilarAlgorithm import com.fangjia.script.util.CosineSimilarAlgorithm
@@ -43,10 +44,10 @@ class OfficeProcess {
// task.nameFiter(filePath) // task.nameFiter(filePath)
// task.typeFiter(filePath) // task.typeFiter(filePath)
// task.nameFlag(filePath) // task.nameFlag(filePath)
task.updateFlagToDB(filePath) // task.updateFlagToDB(filePath)
// task.updateFlagToDB2(filePath) // task.updateFlagToDB2(filePath)
// task.checkRegion() task.checkRegion()
} }
@@ -382,13 +383,26 @@ class OfficeProcess {
def updateFlagToDB(filePath){ def updateFlagToDB(filePath){
def datas = ExcelUtils.read(filePath,0,1) def datas = ExcelUtils.read(filePath,0,1)
def total = datas.size() def total = datas.size()
println total
def index = 0 def index = 0
def rets = []
for(def d : datas){ 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']}';" 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++ index++
sqlInstance.executeUpdate(sql) rets << sql
println index+"/"+ total //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']) pstmt.setString(5, d['D'])
println count+" "+d['L']+" "+d['K']+" "+d['B']+" "+d['C']+" "+d['D'] println count+" "+d['L']+" "+d['K']+" "+d['B']+" "+d['C']+" "+d['D']
pstmt.addBatch() pstmt.addBatch()
if(count % 10 ==0) { if(count % 100 ==0) {
pstmt.executeBatch() pstmt.executeBatch()
} }
} }