楼栋数据修改城市
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ class BigdataBuildingBatch extends BaseBatch{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(Object args) {
|
public void process(Object args) {
|
||||||
def citys = CcbCommonUtils.citys;
|
def citys = CcbCommonUtils.citys_all;
|
||||||
def rows = []
|
def rows = []
|
||||||
def headers = []
|
def headers = []
|
||||||
for (def city : citys) {
|
for (def city : citys) {
|
||||||
|
|||||||
+61
-18
@@ -10,6 +10,8 @@ import com.fangjia.script.util.ExcelUtils
|
|||||||
import com.fangjia.script.util.MongoUtils
|
import com.fangjia.script.util.MongoUtils
|
||||||
import com.mongodb.BasicDBObject
|
import com.mongodb.BasicDBObject
|
||||||
import com.mongodb.DBCollection
|
import com.mongodb.DBCollection
|
||||||
|
import groovy.sql.Sql
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 建行模型估值项目
|
* 建行模型估值项目
|
||||||
* 区域数据同步
|
* 区域数据同步
|
||||||
@@ -17,33 +19,74 @@ import com.mongodb.DBCollection
|
|||||||
@BatchOwner(Watcher.GaoJuan)
|
@BatchOwner(Watcher.GaoJuan)
|
||||||
class BigdataDistrictBatch extends BaseBatch{
|
class BigdataDistrictBatch extends BaseBatch{
|
||||||
|
|
||||||
|
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||||
|
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||||
|
|
||||||
static main(args) {
|
static main(args) {
|
||||||
runBatch(new BigdataDistrictBatch(), args);
|
runBatch(new BigdataDistrictBatch(), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(Object args) {
|
public void process(Object args) {
|
||||||
def citys = CcbCommonUtils.citys;
|
def datas = readText("D:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DISTRICT_GJ.txt")
|
||||||
def rows = []
|
|
||||||
for(def city : citys){
|
|
||||||
def datas = findDistrictCodeValue(city)
|
|
||||||
if(datas){
|
|
||||||
rows.addAll(datas)
|
|
||||||
}
|
|
||||||
println city+" "+ datas.size()
|
|
||||||
}
|
|
||||||
|
|
||||||
def allDatas = createDatas(rows)
|
|
||||||
|
|
||||||
def headers = ["行政区ID","行政区名称","行政区名称拼音","城市ID","国标码","显示顺序","行政区类别","备注","创建时间","更新时间","来源公司","逻辑行政区","逻辑行政区划代码","行政区划代码","数据时间"]
|
|
||||||
|
|
||||||
def rets = []
|
def rets = []
|
||||||
rets << headers
|
def index = 0
|
||||||
rets.addAll(allDatas)
|
for(def line : datas){
|
||||||
ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\BIGDATA_DISTRICT_GJ.xlsx", rets, "数据")
|
def arrs = line[0].split("\\|@\\|")
|
||||||
FileUtils.batchCreateFile(allDatas, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DISTRICT_GJ.dat",headers, "utf-8",false);
|
def sql = "select count(*) as count from BIGDATA_DISTRICT_GJ where distid='${arrs[0]}'";
|
||||||
|
def count = 0
|
||||||
|
sqlInstance.eachRow(sql, { r ->
|
||||||
|
count = r.count
|
||||||
|
})
|
||||||
|
if(count==0){
|
||||||
|
rets << line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeTxt(rets, "D:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DISTRICT_GJ_add.txt")
|
||||||
|
// def citys = CcbCommonUtils.citys_all;
|
||||||
|
// def rows = []
|
||||||
|
// for(def city : citys){
|
||||||
|
// def datas = findDistrictCodeValue(city)
|
||||||
|
// if(datas){
|
||||||
|
// rows.addAll(datas)
|
||||||
|
// }
|
||||||
|
// println city+" "+ datas.size()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// def allDatas = createDatas(rows)
|
||||||
|
//
|
||||||
|
// def headers = ["行政区ID","行政区名称","行政区名称拼音","城市ID","国标码","显示顺序","行政区类别","备注","创建时间","更新时间","来源公司","逻辑行政区","逻辑行政区划代码","行政区划代码","数据时间"]
|
||||||
|
//
|
||||||
|
// def rets = []
|
||||||
|
// rets << headers
|
||||||
|
// rets.addAll(allDatas)
|
||||||
|
// ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\BIGDATA_DISTRICT_GJ.xlsx", rets, "数据")
|
||||||
|
// FileUtils.batchCreateFile(allDatas, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DISTRICT_GJ.dat",headers, "utf-8",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def writeTxt(def rows, def path){
|
||||||
|
StringBuilder builder = new StringBuilder()
|
||||||
|
for(def row : rows){
|
||||||
|
builder.append(row)
|
||||||
|
builder.append('\n')
|
||||||
|
}
|
||||||
|
org.apache.commons.io.FileUtils.writeStringToFile(new File(path), builder.toString(), "GBK")
|
||||||
|
}
|
||||||
|
private def readText(def fileName){
|
||||||
|
File file = new File(fileName)
|
||||||
|
def ret = [];
|
||||||
|
//对文件内容的每一行进行分割处理,比较常用在处理csv文件
|
||||||
|
file.splitEachLine(" ") {
|
||||||
|
def temp = it
|
||||||
|
ret << temp;
|
||||||
|
}
|
||||||
|
//转为Writable对象,可重定向输出
|
||||||
|
file.asWritable()
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def createDatas(rows){
|
def createDatas(rows){
|
||||||
def allRows = []
|
def allRows = []
|
||||||
def index = 1
|
def index = 1
|
||||||
|
|||||||
+52
-52
@@ -53,62 +53,62 @@ class BigdataCommunityGJRHBatch extends BaseBatch {
|
|||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// addBigdataDistrictFJW()
|
addBigdataDistrictFJW()
|
||||||
|
|
||||||
def citySeqnoMap = CcbCommonUtils.findDistrictSeqno();
|
// def citySeqnoMap = CcbCommonUtils.findDistrictSeqno();
|
||||||
|
|
||||||
def index = 0
|
|
||||||
for (def city : citys) {
|
|
||||||
index++
|
|
||||||
def districts = CcbCommonUtils.findAllDistrictsByOracle(cityCodeDataMap.get(city))
|
|
||||||
//
|
//
|
||||||
// for(int i=0;i<10;i++){
|
// def index = 0
|
||||||
// if(districts.size()==0){
|
// for (def city : citys) {
|
||||||
// Thread.sleep(1000*60)
|
// index++
|
||||||
// districts = CcbCommonUtils.findAllDistrictsByOracle(cityCodeDataMap.get(city))
|
// def districts = CcbCommonUtils.findAllDistrictsByOracle(cityCodeDataMap.get(city))
|
||||||
// }else{
|
////
|
||||||
// break
|
//// for(int i=0;i<10;i++){
|
||||||
|
//// if(districts.size()==0){
|
||||||
|
//// Thread.sleep(1000*60)
|
||||||
|
//// districts = CcbCommonUtils.findAllDistrictsByOracle(cityCodeDataMap.get(city))
|
||||||
|
//// }else{
|
||||||
|
//// break
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// def distMap = CommonDatautils.findAllDistricMaptByCity(city, "district", ["address","build_structure","estate_type2","finish_building_date","alias","build_type","estate_charge"])
|
||||||
|
//
|
||||||
|
// for(def dist : districts){
|
||||||
|
// def obj = distMap.get(dist.commid)//CommonDatautils.findDistrictFieldById(dist.commid,["build_structure","estate_type2","finish_building_date","alias","build_type","estate_charge","estate_type2"])
|
||||||
|
// if(obj){
|
||||||
|
// if(obj.alias && obj.alias.size()>0){
|
||||||
|
// dist.commalias = obj.alias.get(0)
|
||||||
|
// }else{
|
||||||
|
// dist.commalias = ""
|
||||||
|
// }
|
||||||
|
// dist.buildstru = CcbCodeUtils.getBuildStructureCode(obj.build_structure)
|
||||||
|
// dist.housetype = CcbCodeUtils.getDistHouseTypeCode(obj.estate_type2)
|
||||||
|
// dist.buildyear = CcbCodeUtils.getBuildYear(obj.finish_building_date);
|
||||||
|
// dist.houseuse = "11"
|
||||||
|
// dist.buildtype = CcbCodeUtils.parseBuildType(dist.build_type)
|
||||||
|
// dist.compid = new ObjectId() //物业公司id
|
||||||
|
// dist.estatecharge = CcbCodeUtils.processEstateCharge(dist.city, obj.estate_charge, obj.estate_type2)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
// println index +" "+city +" 小区加载完成 "+districts.size()
|
||||||
def distMap = CommonDatautils.findAllDistricMaptByCity(city, "district", ["address","build_structure","estate_type2","finish_building_date","alias","build_type","estate_charge"])
|
// addBigdataCommunityGJRH(districts, cityCodeDataMap.get(city))
|
||||||
|
// println index +" "+city +" 1.小区表完成"
|
||||||
for(def dist : districts){
|
// addBigdataCommbuildstruGJ(districts, cityCodeDataMap.get(city))
|
||||||
def obj = distMap.get(dist.commid)//CommonDatautils.findDistrictFieldById(dist.commid,["build_structure","estate_type2","finish_building_date","alias","build_type","estate_charge","estate_type2"])
|
// println index +" "+city +" 2.小区建筑结构表"
|
||||||
if(obj){
|
// addBigdataCommhousetypeGJ(districts, cityCodeDataMap.get(city))
|
||||||
if(obj.alias && obj.alias.size()>0){
|
// println index +" "+city +" 3.小区房屋类型表"
|
||||||
dist.commalias = obj.alias.get(0)
|
// addBigdataCommbuildyearGj(districts, cityCodeDataMap.get(city))
|
||||||
}else{
|
// println index +" "+city +" 4.小区建筑年代表"
|
||||||
dist.commalias = ""
|
// addBigdataCommfeeGj(districts, cityCodeDataMap.get(city))
|
||||||
}
|
// println index +" "+city +" 5.小区费用表"
|
||||||
dist.buildstru = CcbCodeUtils.getBuildStructureCode(obj.build_structure)
|
// addBigdataCommhouseuseGJ(districts, cityCodeDataMap.get(city))
|
||||||
dist.housetype = CcbCodeUtils.getDistHouseTypeCode(obj.estate_type2)
|
// println index +" "+city +" 6.小区房屋用途表"
|
||||||
dist.buildyear = CcbCodeUtils.getBuildYear(obj.finish_building_date);
|
// addBigdataPositionGJ(districts, cityCodeDataMap.get(city), citySeqnoMap)
|
||||||
dist.houseuse = "11"
|
// println index +" "+ city + " 7.地理位置表"
|
||||||
dist.buildtype = CcbCodeUtils.parseBuildType(dist.build_type)
|
//
|
||||||
dist.compid = new ObjectId() //物业公司id
|
//// addDealFieldInfo(distMap, cityCodeDataMap.get(city));//修改成交记录housestyle 一定要运行
|
||||||
dist.estatecharge = CcbCodeUtils.processEstateCharge(dist.city, obj.estate_charge, obj.estate_type2)
|
//
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
println index +" "+city +" 小区加载完成 "+districts.size()
|
|
||||||
addBigdataCommunityGJRH(districts, cityCodeDataMap.get(city))
|
|
||||||
println index +" "+city +" 1.小区表完成"
|
|
||||||
addBigdataCommbuildstruGJ(districts, cityCodeDataMap.get(city))
|
|
||||||
println index +" "+city +" 2.小区建筑结构表"
|
|
||||||
addBigdataCommhousetypeGJ(districts, cityCodeDataMap.get(city))
|
|
||||||
println index +" "+city +" 3.小区房屋类型表"
|
|
||||||
addBigdataCommbuildyearGj(districts, cityCodeDataMap.get(city))
|
|
||||||
println index +" "+city +" 4.小区建筑年代表"
|
|
||||||
addBigdataCommfeeGj(districts, cityCodeDataMap.get(city))
|
|
||||||
println index +" "+city +" 5.小区费用表"
|
|
||||||
addBigdataCommhouseuseGJ(districts, cityCodeDataMap.get(city))
|
|
||||||
println index +" "+city +" 6.小区房屋用途表"
|
|
||||||
addBigdataPositionGJ(districts, cityCodeDataMap.get(city), citySeqnoMap)
|
|
||||||
println index +" "+ city + " 7.地理位置表"
|
|
||||||
|
|
||||||
// addDealFieldInfo(distMap, cityCodeDataMap.get(city));//修改成交记录housestyle 一定要运行
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def addBigdataCommunityGJRH(def districts, def cityid){
|
def addBigdataCommunityGJRH(def districts, def cityid){
|
||||||
|
|||||||
Reference in New Issue
Block a user