diff --git a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DistrictController.java b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DistrictController.java index 25431fd9e..657388333 100644 --- a/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DistrictController.java +++ b/projects/fangjia-bkoff/src/main/java/com/fangjia/bkoff/controllers/DistrictController.java @@ -2013,6 +2013,23 @@ public class DistrictController { if (newName != null || newRegion != null) { districtUpdateTaskService.createTask(orgDis, 2, newName, newRegion); districtUpdateTaskService.createTask(orgDis, 6, newName, newRegion); + + District distTask = new District(); + distTask.setCity(orgDis.getCity()); + if(StringUtils.isNotBlank(newName)){ + distTask.setRegion(newRegion); + }else{ + distTask.setRegion(orgDis.getRegion()); + } + + distTask.setEstateType2(orgDis.getEstateType2()); + if(StringUtils.isNotBlank(newName)){ + distTask.setName(newName); + }else{ + distTask.setName(orgDis.getName()); + } + + districtUpdateTaskService.createTask(distTask, 5); } if (StringUtils.isNotBlank(district.getEstateType2()) diff --git a/projects/fangjia-bkoff/src/main/webapp/district/add.ftl b/projects/fangjia-bkoff/src/main/webapp/district/add.ftl index 8e659db8e..98b9daf40 100644 --- a/projects/fangjia-bkoff/src/main/webapp/district/add.ftl +++ b/projects/fangjia-bkoff/src/main/webapp/district/add.ftl @@ -365,7 +365,7 @@ - å°�区性质 + æ�ƒå±žç±»åˆ« diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/DistrictUpdateTaskDaoImpl.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/DistrictUpdateTaskDaoImpl.java index 416082c70..bbd3aec67 100644 --- a/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/DistrictUpdateTaskDaoImpl.java +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/dao/DistrictUpdateTaskDaoImpl.java @@ -94,6 +94,11 @@ public class DistrictUpdateTaskDaoImpl extends MongoDaoImpl task.setCreateDate(new Date()); task.setStatus(5); task.setName(district.getName()); + if(district.getEstateType2().contains("±ðÊû")){ + task.setEstateType("villa"); + }else{ + task.setEstateType("district"); + } this.save(task); } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java index 2b86ea7e3..cdaa46a50 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/PropertyController.java @@ -746,78 +746,75 @@ public class PropertyController { } } - if (model.getDetailLevel() != null && model.getDetailLevel() >= 1) { - districtInfoDto.setBlock(district.getBlock()); + districtInfoDto.setBlock(district.getBlock()); + districtInfoDto.setLoopLine(district.getLoopLineInfo()); + if (HouseValidator.validateBuildingType(district.getBuildType())) { + districtInfoDto.setBuildingType(district.getBuildType()); + } else { + districtInfoDto.setBuildingType(""); + } + districtInfoDto.setAlias(district.getMappingAlias()); + districtInfoDto.setAddressAlias(district.getAddrAlias()); + districtInfoDto.setCommunity(district.getStreetCommunity()); + districtInfoDto.setCommercialArea(district.getBusinessQuarter()); + if (district.getHouseholdCount() != null) { + districtInfoDto.setTotalUnitCount(SeaweedUtils.formatHouseholdCount(district.getHouseholdCount().toString())); + } else { + districtInfoDto.setTotalUnitCount(""); + } + districtInfoDto.setManagementFee(district.getEstateCharge()); + if (district.getCarSiteCount() != null) { + districtInfoDto.setParking(SeaweedUtils.formatCarSiteCount(district.getCarSiteCount().toString())); + } else { + districtInfoDto.setParking(""); + } + districtInfoDto.setParkingDescription(district.getCarSite()); + districtInfoDto.setOwnershipPeriod(district.getPropertyLife()); + districtInfoDto.setOwnershipType(district.getHouseProperty()); + districtInfoDto.setStartBuildTime(district.getStartBuildingDate()); + if (district.getOpenDate() != null) { + Date minDate = DateUtil.parseDate("1900-01-01", "yyyy-MM-dd"); + Date maxDate = DateUtil.parseDate("2025-01-01", "yyyy-MM-dd"); + if (district.getOpenDate().after(minDate) && district.getOpenDate().before(maxDate)) { + districtInfoDto + .setStartSellingTime(DateUtil.formatByPattern(district.getOpenDate(), "yyyy-MM-dd")); + } + } else { + districtInfoDto.setStartSellingTime(""); } - if (model.getDetailLevel() != null && model.getDetailLevel() >= 2) { - districtInfoDto.setLoopLine(district.getLoopLineInfo()); - if (HouseValidator.validateBuildingType(district.getBuildType())) { - districtInfoDto.setBuildingType(district.getBuildType()); - } else { - districtInfoDto.setBuildingType(""); - } - districtInfoDto.setAlias(district.getMappingAlias()); - districtInfoDto.setAddressAlias(district.getAddrAlias()); - districtInfoDto.setCommunity(district.getStreetCommunity()); - districtInfoDto.setCommercialArea(district.getBusinessQuarter()); - if (district.getHouseholdCount() != null) { - districtInfoDto.setTotalUnitCount(SeaweedUtils.formatHouseholdCount(district.getHouseholdCount().toString())); - } else { - districtInfoDto.setTotalUnitCount(""); - } - districtInfoDto.setManagementFee(district.getEstateCharge()); - if (district.getCarSiteCount() != null) { - districtInfoDto.setParking(SeaweedUtils.formatCarSiteCount(district.getCarSiteCount().toString())); - } else { - districtInfoDto.setParking(""); - } - districtInfoDto.setParkingDescription(district.getCarSite()); - districtInfoDto.setOwnershipPeriod(district.getPropertyLife()); - districtInfoDto.setOwnershipType(district.getHouseProperty()); - districtInfoDto.setStartBuildTime(district.getStartBuildingDate()); - if (district.getOpenDate() != null) { - Date minDate = DateUtil.parseDate("1900-01-01", "yyyy-MM-dd"); - Date maxDate = DateUtil.parseDate("2025-01-01", "yyyy-MM-dd"); - if (district.getOpenDate().after(minDate) && district.getOpenDate().before(maxDate)) { - districtInfoDto - .setStartSellingTime(DateUtil.formatByPattern(district.getOpenDate(), "yyyy-MM-dd")); - } - } else { - districtInfoDto.setStartSellingTime(""); - } - - districtInfoDto.setFinishBuildTime(district.getFinishBuildingDate()); - districtInfoDto.setMoveinTime(district.getLiveDate()); - districtInfoDto.setFloorSpace(SeaweedUtils.formatAllArea(district.getAllArea())); - districtInfoDto.setConstructionSpace(district.getBuildArea()); - districtInfoDto.setPlotRatio(SeaweedUtils.formatCubagePercent(district.getCubagePercent())); - districtInfoDto.setGreenPercentage(SeaweedUtils.formatVirescencePercent(district.getVirescencePercent())); - districtInfoDto.setPreSalePermit(district.getLicence()); - districtInfoDto.setDeveloper(district.getDeveloper()); - districtInfoDto.setDiscount(district.getDiscount()); - districtInfoDto.setPropertyManagement(district.getEstateCompany()); - if (HouseValidator.fetchFitmentInfo(district.getFitment()) == null) { - districtInfoDto.setDecorationStandard(""); - } else { - districtInfoDto.setDecorationStandard(HouseValidator.fetchFitmentInfo(district.getFitment())); - } - districtInfoDto.setBuildingStructure(district.getBuildStructure()); - districtInfoDto.setSupportingFacilities(district.getFacilities()); - districtInfoDto.setTransportation(district.getTraffic()); - districtInfoDto.setRelatedInfo(district.getRelateInfo()); - districtInfoDto.setDescription(district.getDescription()); - districtInfoDto.setSalesOfficeAdd(district.getSellAddress()); - districtInfoDto.setSalesPhoneNumber(district.getMobile()); - districtInfoDto.setTownship(district.getTownship()); - if (district.getLoudongCount() != null && district.getLoudongCount() > 0) { - districtInfoDto.setBuildingCount(district.getLoudongCount()); - } - Integer finishYear = districtService.getBuildYear(district); - if (finishYear != null) { - districtInfoDto.setFinishYear(finishYear); - } + districtInfoDto.setFinishBuildTime(district.getFinishBuildingDate()); + districtInfoDto.setMoveinTime(district.getLiveDate()); + districtInfoDto.setFloorSpace(SeaweedUtils.formatAllArea(district.getAllArea())); + districtInfoDto.setConstructionSpace(district.getBuildArea()); + districtInfoDto.setPlotRatio(SeaweedUtils.formatCubagePercent(district.getCubagePercent())); + districtInfoDto.setGreenPercentage(SeaweedUtils.formatVirescencePercent(district.getVirescencePercent())); + districtInfoDto.setPreSalePermit(district.getLicence()); + districtInfoDto.setDeveloper(district.getDeveloper()); + districtInfoDto.setDiscount(district.getDiscount()); + districtInfoDto.setPropertyManagement(district.getEstateCompany()); + if (HouseValidator.fetchFitmentInfo(district.getFitment()) == null) { + districtInfoDto.setDecorationStandard(""); + } else { + districtInfoDto.setDecorationStandard(HouseValidator.fetchFitmentInfo(district.getFitment())); } + districtInfoDto.setBuildingStructure(district.getBuildStructure()); + districtInfoDto.setSupportingFacilities(district.getFacilities()); + districtInfoDto.setTransportation(district.getTraffic()); + districtInfoDto.setRelatedInfo(district.getRelateInfo()); + districtInfoDto.setDescription(district.getDescription()); + districtInfoDto.setSalesOfficeAdd(district.getSellAddress()); + districtInfoDto.setSalesPhoneNumber(district.getMobile()); + districtInfoDto.setTownship(district.getTownship()); + if (district.getLoudongCount() != null && district.getLoudongCount() > 0) { + districtInfoDto.setBuildingCount(district.getLoudongCount()); + } +// Integer finishYear = districtService.getBuildYear(district); + Integer finishYear = districtService.getCreateYear(district); + if (finishYear != null) { + districtInfoDto.setFinishYear(finishYear); + } + mav.setModel(BasicModel.buildOKModel().setResult(districtInfoDto)); return mav; } diff --git a/projects/fangjia-script/pom.xml b/projects/fangjia-script/pom.xml index 811ec290c..cd1282a81 100644 --- a/projects/fangjia-script/pom.xml +++ b/projects/fangjia-script/pom.xml @@ -433,11 +433,17 @@ javadbf 1.9.2 - + + + ru.yandex.clickhouse + clickhouse-jdbc + 0.2.6 + + com.alibaba fastjson diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportAvgPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportAvgPrice.groovy index e85c93bdd..fb9821df4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportAvgPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/avgprice/ExportAvgPrice.groovy @@ -30,12 +30,12 @@ public class ExportAvgPrice { DSCollection dataStoreConnection = null; static main(args) { def task = new ExportAvgPrice(); - def weekends = ["2019-1-1","2019-2-1","2019-3-1","2019-4-1","2019-5-1","2019-6-1","2019-7-1","2019-8-1", "2019-9-1","2019-10-1","2019-11-1","2019-12-1","2020-1-1","2020-2-1","2020-3-1","2020-4-1","2020-5-1","2020-6-1","2020-7-1","2020-8-1", "2020-9-1","2020-10-1","2020-11-1","2020-12-1","2021-1-1","2021-2-1","2021-3-1","2021-4-1","2021-5-1","2021-6-1","2021-7-1","2021-8-1", "2021-9-1","2021-10-1"]; - def citys = ["ÎÂÖÝ"];//findAllCity(); -// task.exportAllCity(citys, weekends, "e:\\È«¹ú³ÇÊм¾¶È¾ù¼Û.csv"); - task.exportRegion(citys, weekends, "d:\\ÎÂÖÝÇøÓò¼¾¶È¾ù¼Û.csv"); + def weekends = ["2023-04-01","2023-03-01","2023-02-01","2023-01-01","2022-12-01","2022-11-01","2022-10-01","2022-09-01","2022-08-01","2022-07-01","2022-06-01","2022-05-01","2022-04-01","2022-03-01","2022-02-01","2022-01-01","2021-12-01","2021-11-01","2021-10-01","2021-09-01","2021-08-01","2021-07-01","2021-06-01","2021-05-01","2021-04-01"] + def citys = ["ÉϺ£"];//findAllCity(); +// task.exportAllCity(citys, weekends, "D:\\Êý¾Ý\\Ð¡Çø\\È«¹ú³ÇÊм¾¶È¾ù¼Û.csv"); +// task.exportRegion(citys, weekends, "D:\\Êý¾Ý\\Ð¡Çø\\ÇøÓò¼¾¶È¾ù¼Û.csv"); // task.exportBlock(citys, weekends, "e:\\ÇøÓò°å¿é¼¾¶È¾ù¼Û.csv"); -// task.exportDistrict(citys, weekends, "e:\\Ð¡Çø¼¾¶È¾ù¼Û.csv"); + task.exportDistrict(citys, weekends, "D:\\Êý¾Ý\\Ð¡Çø\\Ð¡Çø¼¾¶È¾ù¼Û.csv"); // task.exportRegionPrice("½­ËÕ"); } @@ -182,6 +182,7 @@ public class ExportAvgPrice { q.put("visible", 0); q.put("cat", "district"); q.put("city", city); +// q.put("name", "Áú°Ø¶þ´å") DSCursor cursor = getDataStoreConnection().find(q).sort(new BasicDBObject('bscore', -1)); Iterator iters = cursor.iterator() diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy new file mode 100644 index 000000000..0a601a6ec --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/AddSzDealData.groovy @@ -0,0 +1,36 @@ +package com.fangjia.script.ccbevaluation + +import com.fangjia.script.util.DateUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection + +def datas = ExcelUtils.read("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\³É½»\\ÉîÛÚÈýÔ·ݳɽ»Êý¾Ý.xls", 0, 1) +def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; +DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) + +for(def d : datas){ + def map = new BasicDBObject() + map.city = "ÉîÛÚ" + map.district_name = d['D'] + map.region = d['B'] + def roomStr = d['E'] + if(roomStr){ + def arrs = roomStr.split("-") + map.room = arrs[0].toString().toInteger() + map.hall = arrs[1].toString().toInteger() + map.toilet = arrs[3].toString().toInteger() + } + + map.area = d['F'].toString().toDouble() + map.total_price = (int)(d['G'].toString().toDouble().toInteger()*10000) + map.avg_price = (int)(d['H'].toString().toDouble()*10000) + def trade_date = DateUtils.getRandomDate("2023-03-01", "2023-03-31") + map.trade_date = DateUtils.parseFromTightByPattern(trade_date, "yyyy-MM-dd") + map.source = "Éî·¿¼Ò×å" + map.create_date = new Date() + map.m_date = new Date() + DEAL_PRICE_COLL.save(map) +} + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataCommunityBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataCommunityBatch.groovy index 4edbf78a5..345491bd5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataCommunityBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataCommunityBatch.groovy @@ -56,8 +56,8 @@ class BigdataCommunityBatch extends BaseBatch{ def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city","region", "name", "address","lat", "lng","all_area","build_area","virescence_percent","cubage_percent","car_site_count","finish_building_date","estate_type2","household_count","status","c_date","m_date","name_cat","street","street_number"]) -// def ccbMaps = CcbCommonUtils.findCcbDistrict(cityCodeDataMap.get(city)) //Èںϵ¼ÊýʱʹÓà - def ccbMaps = CcbCommonUtils.findPgCcbDistrict(cityCodeDataMap.get(city)) //¹ÀÖµµ¼ÊýʱʹÓà + def ccbMaps = CcbCommonUtils.findCcbDistrict(cityCodeDataMap.get(city)) //Èںϵ¼ÊýʱʹÓà +// def ccbMaps = CcbCommonUtils.findPgCcbDistrict(cityCodeDataMap.get(city)) //¹ÀÖµµ¼ÊýʱʹÓà def rets = createCityDatas(cityCodeDataMap, distCodeMap, dists) rets = addDeleteDist(dists, ccbMaps, rets) rows.addAll(rets) @@ -78,8 +78,8 @@ class BigdataCommunityBatch extends BaseBatch{ println "txt Éú³É->µ¼Oracle" - delPgData() - saveToPgSql(rows) +// delPgData() +// saveToPgSql(rows) // ExcelUtils.write("d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\excel\\bigdata_community.xlsx", allDatas, "Êý¾Ý") // def datas = readTxt("d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\BIGDATA_COMMUNITY_GJ.dat") diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy index e00fdeb41..5e7d45516 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/BigdataDealBatch.groovy @@ -67,50 +67,50 @@ class BigdataDealBatch extends BaseBatch{ } println "curDate:"+curDate -// for(def city : citys){ -//// if(!ccbCitys.contains(city)){ -// addDealPriceMatch(city); -//// } -// } - def rows = [] - def headers = []//["³ÇÊÐID","³É½»ID","³ÇÊÐÃû³Æ","ÐÐÕþÇøID","ÐÐÕþÇøÃû³Æ","½ÖµÀ","ÃÅÅÆºÅ","Ð¡ÇøID","Ð¡ÇøÃû³Æ","Â¥¶°ID","Â¥¶°±àºÅ","Â¥¶°Ãû³Æ","µ¥ÔªID","µ¥Ôª±àºÅ","µ¥ÔªÃû³Æ","»§ID","ÏêϸµØÖ·","½¨ÖþÄê´ú","ȨÊô","ȨÊôÄêÏÞ","ÆÚÊý","ËùÔÚÂ¥²ã","²ãÀàÐÍ","×ÜÂ¥²ãÊý","½¨ÖþÀàÐÍ","½¨Öþ½á¹¹","½¨ÖþÃæ»ý","Ì×ÄÚÃæ»ý","»§ÐÍ","ÊÒ","Ìü","³ø","ÎÀ","·¿ÎÝÓÃ;","ÊÒÄڽṹ","³¯Ïò","×°ÐÞÇé¿ö","ÆÀ¹À±àºÅ","³É½»µ¥¼Û","³É½»×ܼÛ","É걨×ܼÛ","ÆÀ¹À×ܼÛ","ÍøÇ©ºÏͬ±àºÅ","½»Ò×ÈÕÆÚ","½»Ò×ÀàÐÍ","³öÊÛ¸¶¿î·½Ê½","³É½»ÖÜÆÚ","ÊÇ·ñÓеçÌÝ","ÔùËÍÃæ»ý£¨µØÃ滨԰£©","ÔùËÍÃæ»ý£¨Â¶Ì¨£©","ÔùËÍÃæ»ý£¨Ñǫ̂£©","ÔùËÍÃæ»ý£¨Æ®´°£©","ÔùËÍÃæ»ý£¨¸óÂ¥£©","ÔùËÍÃæ»ý£¨³µ¿â£©","ÔùËÍÃæ»ý£¨µØÏÂÊÒ£©","ÔùËÍÃæ»ý£¨ÆäËû£©","·¿Ô´Êý¾ÝÀ´Ô´","Öн鹫˾ID","Öн鹫˾Ãû³Æ","±¸×¢","´´½¨Ê±¼ä","¸üÐÂʱ¼ä","À´Ô´¹«Ë¾","³É½»½ð¶î","Êý¾Ýʱ¼ä"] - def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() - def index = 0 for(def city : citys){ - index ++ - def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) - def ppeDists = [:] - - def statMap = [:]//getDistrictStatByCity(city, weekend) - if(city=="ÉϺ£"){ - def youDataTrade = getYouDaData(statMap) - def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda") - rows.addAll(youdaDatas) - println city +" "+youdaDatas.size() - } - - def trades = getCityData(city, statMap, ppeDists) - if(trades){ - def rets = createData(trades, cityCodeDataMap, distCodeMap, "other") - rows.addAll(rets) - println "¡¾${index}¡¿"+city +" ³É½»¹²£º"+rets.size() - - def cityDatas = [] - cityDatas << headers - cityDatas.addAll(rows) - } - +// if(!ccbCitys.contains(city)){ + addDealPriceMatch(city); +// } } - - def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat" - if(CommonDatautils.isWindow()){ - fileName = "d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\BIGDATA_DEAL_GJ.dat" - } - - FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false); - println "txt Éú³É " + rows.size() - - saveToPgSql(rows) +// def rows = [] +// def headers = []//["³ÇÊÐID","³É½»ID","³ÇÊÐÃû³Æ","ÐÐÕþÇøID","ÐÐÕþÇøÃû³Æ","½ÖµÀ","ÃÅÅÆºÅ","Ð¡ÇøID","Ð¡ÇøÃû³Æ","Â¥¶°ID","Â¥¶°±àºÅ","Â¥¶°Ãû³Æ","µ¥ÔªID","µ¥Ôª±àºÅ","µ¥ÔªÃû³Æ","»§ID","ÏêϸµØÖ·","½¨ÖþÄê´ú","ȨÊô","ȨÊôÄêÏÞ","ÆÚÊý","ËùÔÚÂ¥²ã","²ãÀàÐÍ","×ÜÂ¥²ãÊý","½¨ÖþÀàÐÍ","½¨Öþ½á¹¹","½¨ÖþÃæ»ý","Ì×ÄÚÃæ»ý","»§ÐÍ","ÊÒ","Ìü","³ø","ÎÀ","·¿ÎÝÓÃ;","ÊÒÄڽṹ","³¯Ïò","×°ÐÞÇé¿ö","ÆÀ¹À±àºÅ","³É½»µ¥¼Û","³É½»×ܼÛ","É걨×ܼÛ","ÆÀ¹À×ܼÛ","ÍøÇ©ºÏͬ±àºÅ","½»Ò×ÈÕÆÚ","½»Ò×ÀàÐÍ","³öÊÛ¸¶¿î·½Ê½","³É½»ÖÜÆÚ","ÊÇ·ñÓеçÌÝ","ÔùËÍÃæ»ý£¨µØÃ滨԰£©","ÔùËÍÃæ»ý£¨Â¶Ì¨£©","ÔùËÍÃæ»ý£¨Ñǫ̂£©","ÔùËÍÃæ»ý£¨Æ®´°£©","ÔùËÍÃæ»ý£¨¸óÂ¥£©","ÔùËÍÃæ»ý£¨³µ¿â£©","ÔùËÍÃæ»ý£¨µØÏÂÊÒ£©","ÔùËÍÃæ»ý£¨ÆäËû£©","·¿Ô´Êý¾ÝÀ´Ô´","Öн鹫˾ID","Öн鹫˾Ãû³Æ","±¸×¢","´´½¨Ê±¼ä","¸üÐÂʱ¼ä","À´Ô´¹«Ë¾","³É½»½ð¶î","Êý¾Ýʱ¼ä"] +// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() +// def index = 0 +// for(def city : citys){ +// index ++ +// def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) +// def ppeDists = [:] +// +// def statMap = [:]//getDistrictStatByCity(city, weekend) +// if(city=="ÉϺ£"){ +// def youDataTrade = getYouDaData(statMap) +// def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda") +// rows.addAll(youdaDatas) +// println city +" "+youdaDatas.size() +// } +// +// def trades = getCityData(city, statMap, ppeDists) +// if(trades){ +// def rets = createData(trades, cityCodeDataMap, distCodeMap, "other") +// rows.addAll(rets) +// println "¡¾${index}¡¿"+city +" ³É½»¹²£º"+rets.size() +// +// def cityDatas = [] +// cityDatas << headers +// cityDatas.addAll(rows) +// } +// +// } +// +// def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat" +// if(CommonDatautils.isWindow()){ +// fileName = "d:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\BIGDATA_DEAL_GJ.dat" +// } +// +// FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false); +// println "txt Éú³É " + rows.size() +// +// saveToPgSql(rows) } def createData(def rets, cityCodeDatas, distCodeMap, source){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy index 845b06548..de1e2d965 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/CcbCommonUtils.groovy @@ -430,6 +430,7 @@ class CcbCommonUtils { q.put("visible",0) q.put("cat", cat); q.put("city", city); + q.put("c_date", new BasicDBObject('$lt', DateUtils.parseFromTightYYYYMMDD("2023-05-01")))//Òò5ÔÂ1ÈÕÐÂÔö¹ý¶à£¬ËùÒÔÔÝÇÒÏÈÈ¥µô // q.put("name","½õÄÏÆÖÈýÐ¡Çø") // q.put("name_cat", 0); // q.put("estate_type2", new BasicDBObject('$in', ["ÆÕͨסլ","ÉÌס"])) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy index d579b79f1..cdad2a607 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/DealAndThirdPriceDataProcess.groovy @@ -375,12 +375,12 @@ class DealPriceDataProcess { def deleteThirdPartyData(){ def citys = CcbCommonUtils.citys_all - def month = 202302 + def month = 202303 def rows = [] def cityCodeDatas = CcbCommonUtils.findCityCodeValue() def set = new HashSet() for(def city : citys) { - def rets = findPeGteThirdParty2(city, 202303) + def rets = findPeGteThirdParty2(city, 202304) def total = 0 println city +" "+rets.size() if(rets){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/FjwPricePkCcbPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/FjwPricePkCcbPrice.groovy index 4c9574fd8..5c2e8c26c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/FjwPricePkCcbPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/FjwPricePkCcbPrice.groovy @@ -33,8 +33,8 @@ class FjwPricePkCcbPrice { def task = new FjwPricePkCcbPrice() // task.run() // task.updatePrice() - task.addFjwPrice() -// task.addCcbPrice() +// task.addFjwPrice() +// task.addCcbPrice()//oracle // task.addCcbPriceFromGuided() // task.addMarketPrice() @@ -42,21 +42,36 @@ class FjwPricePkCcbPrice { // task.exportFjwPriceAndCcbPrice() // task.addNewDistPrice() -// task.addCcbPrice2() -// task.addCcbPrice3() + task.addCcbPrice2()//°´id²é +// task.addCcbPrice3()//°´city,region,name²é // task.standRegion() +// task.addGuidPrice() } + def addCcbPrice2(){ def cityCodeMap = CcbCommonUtils.findCityCodeValue() - ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\ÆäËü\\²âÊÔµØÖ·-¹À¼Ò¿Æ¼¼V1 (6).xlsx", { d -> - if(d['R']){ - def map = findAvgPrice(d['R'], cityCodeMap.get(d['S'])) + ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Ö¸µ¼¼Û\\ÉîÛÚÕþ¸®Ö¸µ¼¼Û_²¹³ä.xlsx", { d -> + if(d['C']){ + def map = findAvgPrice(d['C'], cityCodeMap.get(d['E'])) if(map){ - d['AG'] = map.avg_price - d['AH'] = map.calc_type - d['AI'] = map.credit_value - d['AJ'] = map.month + d['K'] = map.avg_price + d['L'] = map.calc_type +// d['AI'] = map.credit_value + d['M'] = map.month + } + } + }) + } + + def addGuidPrice(){ + def cityCodeMap = CcbCommonUtils.findCityCodeValue() + ExcelUtils.multiThreadingModify("D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Ö¸µ¼¼Û\\ÉîÛÚÕþ¸®Ö¸µ¼¼Û_230421.xlsx", { d -> + if(d['M']){ + def map = findGuidePrice(d['C'], d['E']) + if(map){ + d['M'] = map.avg_price + d['N'] = map.date.toString() } } }) @@ -474,4 +489,14 @@ class FjwPricePkCcbPrice { }) return map } + + def findGuidePrice(def commid, def city){ + def sql = "SELECT gujia_bds_drc_prc,gujia_drc_dt from base.t0831_guided_price_gj_h where urbn_nm='${city}' and gujia_bds_id='${commid}' ORDER BY gujia_drc_dt desc limit 1" + def map = [:] + pgsqlInstance.eachRow(sql, { r -> + map.avg_price = r.gujia_bds_drc_prc + map.date = r.gujia_drc_dt + }) + return map + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy index 716114623..b78a31710 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/GuiDingPriceBatch.groovy @@ -52,7 +52,7 @@ class GuiDingPriceBatch extends BaseBatch{ def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) //Ìí¼Ó×Ô¼º¿âÖеÄÈ˹¤Ö¸µ¼¼Û - def prices = CcbCommonUtils.findPersonPrice(city, "2023-03-21", "2023-04-21") + def prices = CcbCommonUtils.findPersonPrice(city, "2023-03-21", "2023-04-26") // def prices = CcbCommonUtils.findPersonPrice(city, "2022-01-01", "2022-11-22") if(prices){ def distMap = getDistrictMap(city) @@ -85,7 +85,7 @@ class GuiDingPriceBatch extends BaseBatch{ saveToPgSql(rows) //¸üо²Ì¬Êý¾Ý±í - updateVersion(DateUtils.formatDateByPattern(new Date(), "yyyy-MM")+"-28") +// updateVersion(DateUtils.formatDateByPattern(new Date(), "yyyy-MM")+"-28") } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy index 5474a893c..db8fef0a1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/Test.groovy @@ -71,33 +71,33 @@ def DBCollection youda_esfhouse_coll = MongoUtils.getCollectionByName2("business // //}) -def countCitys = ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\pgsql-city.xlsx",0,1) -def allCitys = CcbCommonUtils.citys_all -def cityCodeMap = CcbCommonUtils.findCityCodeValue() -def index = 0 -for(def c : allCitys){ - def cityCode = cityCodeMap.get(c) - def count = null; - index++ - for(def r : countCitys){ - if(cityCode.toString() == r['A'].toString().toDouble().toInteger().toString()){ - count = r['B'] - break - } - } - println index +" "+ c+" "+count -} - -def findCcbPriceCredit(sqlInstance, cityid, commid){ - def sql = "select * from (select CONFIDENCE,year_month,avg_price from community_base_price_gj where cityid='${cityid}' and commid='${commid}' order by year_month desc) WHERE ROWNUM <= 1" - def map = [:] - sqlInstance.eachRow(sql,{r-> - map.month = r.year_month - map.credit = r.CONFIDENCE - map.price = r.avg_price - }); - return map -} +//def countCitys = ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\pgsql-city.xlsx",0,1) +//def allCitys = CcbCommonUtils.citys_all +//def cityCodeMap = CcbCommonUtils.findCityCodeValue() +//def index = 0 +//for(def c : allCitys){ +// def cityCode = cityCodeMap.get(c) +// def count = null; +// index++ +// for(def r : countCitys){ +// if(cityCode.toString() == r['A'].toString().toDouble().toInteger().toString()){ +// count = r['B'] +// break +// } +// } +// println index +" "+ c+" "+count +//} +// +//def findCcbPriceCredit(sqlInstance, cityid, commid){ +// def sql = "select * from (select CONFIDENCE,year_month,avg_price from community_base_price_gj where cityid='${cityid}' and commid='${commid}' order by year_month desc) WHERE ROWNUM <= 1" +// def map = [:] +// sqlInstance.eachRow(sql,{r-> +// map.month = r.year_month +// map.credit = r.CONFIDENCE +// map.price = r.avg_price +// }); +// return map +//} def findThirdPriceBySource(sqlInstance, cityid, commid){ def sql = "select * from (select data_source, price_date, community_price,commid from bigdata_third_party_price_gj where cityid='${cityid}' and commid='${commid}' and data_source in ('±´¿Ç','Á´¼Ò') \n" + @@ -1314,6 +1314,24 @@ def findAvgPrice(def commid, def pgsqlInstance, def cityid){ +def fileName = "C:\\Users\\gaojuan\\Desktop\\·¿¼ÛÍøÐÂÔöÐ¡ÇøÊý¾Ý_0427.xlsx" +ExcelUtils.multiThreadingModify(fileName, { d -> + def count = CommonDatautils.findDistrictCount(null, d['B'], d['C'], "district") + if(count && count==1){ + def dist = CommonDatautils.findDistrict(null, d['B'], d['C'], "district") + d['E'] = dist.city + } + +// def dist = CommonDatautils.findDistrictById(d['A']) +// if(dist){ +// d['B'] = dist.region +// d['C'] = dist.name +// d['J'] = dist.status +// } +// def newRegion = RegionData.formatRegion(d['A'], d['B']) +// d['F'] = newRegion +},0) + //ExcelUtils.modify(fileName, {d-> // if(d['A']){ // def sql = "update guided_price_gj set dealdate=to_date('2022-09-20','yyyy-MM-dd') where id='${d['A']}'" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy index 076edf823..3c0226e81 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/TradeStatLog.groovy @@ -92,13 +92,13 @@ class TradeStatLog { def run(){ def citys = CcbCommonUtils.citys_all; def rets = [] - rets << ["³ÇÊÐ","12ÔÂ×ÜÁ¿","23Äê1ÔÂ×ÜÁ¿","23Äê2ÔÂ×ÜÁ¿","Õ¼±È","±´¿Ç","Á´¼Ò", "ÎÒ°®ÎÒ¼Ò","·¿ÌìÏÂ","ÖÐÔ­"] + rets << ["³ÇÊÐ","23Äê1ÔÂ×ÜÁ¿","23Äê2ÔÂ×ÜÁ¿","23Äê3ÔÂ×ÜÁ¿","Õ¼±È","±´¿Ç","Á´¼Ò", "ÎÒ°®ÎÒ¼Ò","·¿ÌìÏÂ","ÖÐÔ­"] def sources = ["±´¿ÇÕÒ·¿","Á´¼ÒÔÚÏß","ÎÒ°®ÎÒ¼Ò","·¿ÌìÏÂ","ÖÐÔ­µØ²ú"] //def startDate = "2021-05-01" - def startDate = "2022-12-01" - def date = "2023-01-01" - def endDate = "2023-02-01" - def newDate = "2023-03-01" + def startDate = "2023-01-01" + def date = "2023-02-01" + def endDate = "2023-03-01" + def newDate = "2023-04-01" for(def city : citys){ def lastMonthCount = findTradesCount(city, null, DateUtils.parseFromTightByPattern(startDate,"yyyy-MM-dd"), DateUtils.parseFromTightByPattern(date,"yyyy-MM-dd")) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy index 9ed8300cc..5a38c237e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/BigdataCitypriceBatch.groovy @@ -61,8 +61,8 @@ class BigdataCitypriceBatch extends BaseBatch{ def dealStartDate = DateUtils.addMonth(DateUtils.parseFromTightByPattern(startDate.toString(), "yyyyMMdd"), -1) def lastYearDate = DateUtils.addMonth(startDate.toString(),-12, "yyyyMMdd").toInteger(); -// cityRun(citys, startDate, endDate, cityCodeMap) -// regionRun(citys, startDate, endDate, cityCodeMap) + cityRun(citys, startDate, endDate, cityCodeMap) + regionRun(citys, startDate, endDate, cityCodeMap) districtRun(citys, startDate, endDate, dealStartDate, lastYearDate, cityCodeMap) } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy index ce4355ead..43132328a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/ccbevaluation/ronghe/ExportDistrictRongHe.groovy @@ -34,6 +34,7 @@ class ExportDistrictRongHe extends BaseBatch{ @Override void process(Object args) { def queryDate = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM").toInteger() + def houseStartDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(), -1), "yyyy-MM-dd") citys = CcbCommonUtils.getRunningCitys(args) @@ -76,7 +77,7 @@ class ExportDistrictRongHe extends BaseBatch{ // exportBigdataModelingBase(lastMonth) //2ÔÂ8ºÅ ÁÙʱµ¼³öËÕÖÝÒ»ÄêµÄÊý¾Ý - exportPgBigdataForsale("2023-03-01",DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyy-MM-dd"),new_dists)//Èںϰ´·¢²¼Ê±¼äµ¼£¬¹ÀÖµ°´updatetimeµ¼³ö + exportPgBigdataForsale(houseStartDate,DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyy-MM-dd"),new_dists)//Èںϰ´·¢²¼Ê±¼äµ¼£¬¹ÀÖµ°´updatetimeµ¼³ö } if(curDate.toString().endsWith("28")){ @@ -1012,7 +1013,7 @@ class ExportDistrictRongHe extends BaseBatch{ def exportPgThirdPartyPrice2(price_date, new_dists){ - def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "10"; + def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28"; def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat" if (CommonDatautils.isWindow()) { fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat" @@ -1184,7 +1185,7 @@ class ExportDistrictRongHe extends BaseBatch{ }); } - def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10" + def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28" def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" if(CommonDatautils.isWindow()){ fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat" @@ -1273,7 +1274,7 @@ class ExportDistrictRongHe extends BaseBatch{ def exportPgCommunityPdescribeGj(month){ - def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10" + def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28" def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat" if(CommonDatautils.isWindow()){ fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat" @@ -1381,7 +1382,7 @@ class ExportDistrictRongHe extends BaseBatch{ def exportPgGuideStatistics(time){ - def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10" + def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28" def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_GUIDE_STATISTICS_ADD_${curDate}_0001.dat" if(CommonDatautils.isWindow()){ fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_GUIDE_STATISTICS_ADD_${curDate}_0001.dat" @@ -1417,7 +1418,7 @@ class ExportDistrictRongHe extends BaseBatch{ def exportPgBigdataSupplierStatistics(time){ - def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10" + def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28" def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_SUPPLIER_STATISTICS_ADD_${curDate}_0001.dat" if(CommonDatautils.isWindow()){ fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_SUPPLIER_STATISTICS_ADD_${curDate}_0001.dat" @@ -1532,7 +1533,7 @@ class ExportDistrictRongHe extends BaseBatch{ def exportPgBigdataModelingBase(time){ - def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"10" + def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28" def fileName = "/ccb_rh/${curDate}/FJW_000000_000000_BIGDATA_MODELING_BASE_ADD_${curDate}_0001.dat" if(CommonDatautils.isWindow()){ fileName = "D:\\Êý¾Ý\\½¨ÐÐ\\·¿²ú¹ÀÖµ\\Êý¾ÝÎļþ\\txt\\ccb_rh\\${curDate}\\FJW_000000_000000_BIGDATA_MODELING_BASE_ADD_${curDate}_0001.dat" diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy index cae3e60b2..b7bf2feb6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/commData/CommonDatautils.groovy @@ -622,7 +622,10 @@ class CommonDatautils { public static def findDistrictCount(String city, String region, String name, String cat){ DBObject q = new BasicDBObject(); - q.put("city", city); + if(city){ + q.put("city", city); + } + if(region){ q.put("region", region); } @@ -639,7 +642,10 @@ class CommonDatautils { public static def findDistrict(String city, String region, String name, String cat){ DBObject q = new BasicDBObject(); - q.put("city", city); + if(city){ + q.put("city", city); + } + if(region){ q.put("region", region); } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy index 2da506d11..917ddfc5e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/FzDataResultStat.groovy @@ -25,7 +25,7 @@ class FzDataResultStat { static main(args) { def task = new FzDataResultStat() task.priceMarkupRun(); -// task.regionPriceTrendRun() + task.regionPriceTrendRun() //// task.margeExcel() // task.saveCsvData() } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy index 89347b833..e26dc05dd 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/Test1.groovy @@ -14,7 +14,7 @@ import com.mongodb.DBCollection //¸£ÖݵÚÈý·½¾ù¼Ûͳ¼Æ,·¢ËͶ¤¶¤ÏûÏ¢ //def datas = ExcelUtils.read("d:\\Êý¾Ý\\¸£ÖÝ\\¸£ÖÝ4ÔÂ2.xlsx",0,1) //def datas = CsvUtils.read("d:\\Êý¾Ý\\¸£ÖÝ\\FJW_THIRD_PARTY_AVG_PRICE_202105.csv"); -def datas = readTxt("d:\\Êý¾Ý\\¸£ÖÝ\\FJW_THIRD_PARTY_AVG_PRICE_202302.csv") +def datas = readTxt("d:\\Êý¾Ý\\¸£ÖÝ\\FJW_THIRD_PARTY_AVG_PRICE_202303.csv") def count0 = 0 def count1 = 0 def count2 = 0 diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy index 7ed37c86c..8ccb30a9a 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/AddAvgpriceBatch.groovy @@ -24,7 +24,13 @@ class AddAvgpriceBatch { static main(args) { def task = new AddAvgpriceBatch(); - task.run1(); +// task.run1(); + task.test() + } + + def test(){ + //·¢ÖØËã¾ù¼ÛÃüÁî + addPrice("ÉϺ£","ãÉÐÐ","¾ýÁ«ãɶ¼ÑÅÔ·", "ÆÕͨסլ", DateUtils.parseFromTightByPattern('2023-04-23','yyyy-MM-dd'),DateUtils.parseFromTightByPattern('2023-04-30','yyyy-MM-dd')) } def run(){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FiledStrand.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FiledStrand.groovy index cdbeaefd7..805c41944 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FiledStrand.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/FiledStrand.groovy @@ -2,6 +2,7 @@ package com.fangjia.script.gj import com.fangjia.core.util.DateUtil import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.linxsh.util.AddressUtil import com.fangjia.script.util.DbUtils import com.fangjia.script.util.ExcelUtils import com.mongodb.BasicDBObject @@ -263,8 +264,7 @@ class FiledStrand { if(all_area){ def v = getValue(all_area) if(v>=1000 && v<=10000000){ - - return v.toString() + return v.toString().toDouble().toInteger() } } return null @@ -273,7 +273,7 @@ class FiledStrand { static def processCarSite(car_site_count){ def v = getValue(car_site_count.toString()); if(v){ - if(v>=1 && v<=100000){ + if(v>5 && v<=100000){ try { return v.toString().toInteger(); }catch(Exception e){ @@ -284,6 +284,70 @@ class FiledStrand { return null } + static def processCarSiteDesc(car_site){ + if(car_site && car_site.size()<=20){ + return car_site.toString() + } + return null + } + + + static def processPropertyLife(car_site_count){ + def v = getValue(car_site_count.toString()); + if(v){ + if([40,50,70].contains(v)){ + try { + return v.toString()+"Äê"; + }catch(Exception e){ + println e.getMessage() + } + } + } + return null + } + + static def processAlias(esVal, name, alias){ + if(esVal){ + if(esVal!=name){ + if(!alias){ + alias = [] + } + def arr = alias.split(",") + for(def s : arr){ + if(!alias.contains(s)){ + alias << esVal + } + } + + if(alias){ + return alias + } + } + } + return null + } + + static def processAddress(def esAddress, def city){ + if(esAddress){ + def formatAddress = AddressUtil.formatAddress(city, esAddress) + if(formatAddress && isRoad(formatAddress)){ + return formatAddress + } + } + return null + } + + static def isRoad(def s){ + def pattern = Pattern.compile("[·|½Ö|´óµÀ|Ïï]"); + def matcher = pattern.matcher(s) + if(matcher.find()){ + return true; + } + return false + } + + + static def addBuildAreaToData(def dist, def updateFile){ def build_area = null; if(dist.build_area){ @@ -324,18 +388,12 @@ class FiledStrand { return updateFile; } - public static def processCubagePercent(cubage_percent, estate_type2){ + public static def processCubagePercent(cubage_percent){ if(cubage_percent){ def v = getValue(cubage_percent) if(v){ - if(estate_type2 == "±ðÊû"){ - if(v>=0.3 && v<=1){ - return v.toString() - } - }else{ - if(v>1 && v<=10){ - return v.toString() - } + if(v>=0.3 && v<=10){ + return v.toString() } } } @@ -418,26 +476,26 @@ class FiledStrand { estateCharege = estateCharege.toDouble() if(estateType2=="ÆÕͨסլ"){ if(city=="ÉϺ£" || city=="±±¾©" || city=="¹ãÖÝ" || city=="º¼ÖÝ"){ - if(estateCharege>=0.6 && estateCharege<=3.5){ + if(estateCharege>=0.3 && estateCharege<=40){ return estateCharege }else{ return null; } }else{ - if(estateCharege>=0.2 && estateCharege<=3.5){ + if(estateCharege>=0.2 && estateCharege<=20){ return estateCharege }else{ return null; } } }else if(estateType2=="±ðÊû"){ - if(estateCharege>=3){ + if(estateCharege>=1){ return estateCharege; }else{ return null; } }else if(estateType2=="ÉÌס"){ - if(estateCharege>=4){ + if(estateCharege>=2){ return estateCharege; }else{ return null; @@ -454,13 +512,13 @@ class FiledStrand { if(household_count){ household_count = household_count.toInteger() if(estateType2=="ÆÕͨסլ" || estateType2=="ÉÌס"){ - if(household_count>=50 && household_count<=100000){ + if(household_count>=15 && household_count<=100000){ return household_count; }else{ return null; } }else if(estateType2=="±ðÊû"){ - if(household_count>=20 && household_count<=100000){ + if(household_count>=10 && household_count<=100000){ return household_count; }else{ return null; @@ -470,6 +528,20 @@ class FiledStrand { return null; } + static def processLoudongCount(loudongCount){ + def v = getValue(loudongCount.toString()); + if(v){ + if(v>=1 && v<=10000){ + try { + return v.toString().toInteger(); + }catch(Exception e){ + println e.getMessage() + } + } + } + return null + } + static def processFinishBuildingDate(def finishBuildingDate){ if(finishBuildingDate){ Pattern pat1 = Pattern.compile("\\d{4}[Äê\\-\\.]\\d{2}[ÔÂ\\-\\.]\\d{2}"); @@ -493,6 +565,39 @@ class FiledStrand { } + static def processCompany(val){ + if(val){ + if(val.length()>20){ + return null + }else{ + if(val.contains("ÎÞ")){ + return null + } + def fiterChars = [",",".","?","/","Êý¾Ý",'-','?',' ',' '] + for(def s : fiterChars){ + val = val.replace(s, '') + } + + if(val.length()<1){ + return null + } + + if(val.toString().isNumber()){ + return null + } + + Pattern pattern = Pattern.compile("\\d{4}Äê"); + if (pattern.matcher(val).matches()) { + return null + } + return val + } + } + + return null; + } + + def converList(def dbCursor){ def list = [] for(def dbo : dbCursor){ diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy index 210802c58..e4e5016ec 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/OpenApiUtils.groovy @@ -143,17 +143,8 @@ class OpenApiUtils { def result = queryMaxSimilarAddress(city, name) if(result){ for(def ret : result){ - if(ret && ret.lat){ - try{ - def gmap = GeocodeUtils.getGaodeToBaidu(ret.lng.toDouble(), ret.lat.toDouble()) - ret.lng2 = gmap.get("lng") - ret.lat2 = gmap.get("lat") - ret.estateType = ret.type - ret.source = "¸ßµÂ" - }catch (Exception e){ - - } - } + ret.estateType = ret.type + ret.source = "¸ßµÂ" } } return result @@ -161,11 +152,17 @@ class OpenApiUtils { public static def queryMaxSimilarAddress(String city, String address, boolean isFullMatch = false){ - if(StringUtils.isEmpty(city) || StringUtils.isEmpty(address)){ +// if(StringUtils.isEmpty(city)){ +// return null +// } + if(StringUtils.isEmpty(address)){ return null; } address = address.trim().replace(" ","") - String url = "https://restapi.amap.com/v3/place/text?keywords=" + address + "&types=120000&city=" + city + "&output=json&offset=20&page=1&key=2af0b8533415a612b98d59bb93d664b9&extensions=all" +// String url = "https://restapi.amap.com/v3/place/text?keywords=" + address + "&types=120000&city=" + city + "&output=json&offset=20&page=1&key=2af0b8533415a612b98d59bb93d664b9&extensions=all" + //key:8796b9dfb3889b57c38e2fff1b7e51bd »¨Ç®ÂòµÄ + String url = "https://restapi.amap.com/v3/place/text?keywords=" + address + "&city=" + city + "&output=json&offset=20&page=1&key=8796b9dfb3889b57c38e2fff1b7e51bd&extensions=all&citylimit=true"//citylimitÏÞÖÆ³ÇÊÐ + List poiList = null; com.alibaba.fastjson.JSONObject result = null; @@ -553,6 +550,35 @@ class OpenApiUtils { return null; } + static def similarRank(proCode, cityCode, regionCode, name, area, floor, height){ + def url = "http://localhost:8080/fangjia-open/house/similar?aboveFloorAmount=${height}&buildingName=${name}&city=${cityCode}&district=${regionCode}&" + + "propertyTypeCode=01&province=${proCode}&floorNumber=${floor}&strctureArea=${area}" + println url + String content = new HttpRequest().get(url, "utf-8"); + def dto = [] + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.code ==200 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } + + static def financialRating(city, address){ + def url = "http://open.fangjia.com/address/financialRating?city=${city}&address=${address}&token=2C5B1EDE22A17EDA191B1863B8BD319308E3D89AFBDC76DCD511B639DDF1FC404DA43FE52CB5D8BC666444D9753B39378041962D82A67C4BB45A0E481EE0CA3FF8438C2696B9B57F85B7C110E088361345E89BFEA62FB65442C4ED4508DCEAA931B6C2C05402A3A3" + String content = new HttpRequest().get(url, "utf-8"); + if(content){ + def doc = new JsonSlurper().parseText(content) + if(doc && doc.code ==0 && doc.result){ + def dtos = doc.result + return dtos + } + } + return null; + } + } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy index 52f2ea980..0842f9b06 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/YouDaDataParser.groovy @@ -48,11 +48,11 @@ class YouDaDataParser { def final AtomicInteger count_ = new AtomicInteger(0) - static def statDate = "2023-01-01" + static def statDate = "2023-03-01" static main(args) { def task = new YouDaDataParser(); // task.newHouseparse();//ÓÑ´ïÒ»ÊÖ·¿´æÈëmongo -// task.esfParser("D:\\Êý¾Ý\\ÓÑ´ï\\2023Äê2ÔÂ\\²éѯ1.DBF");//ÓÑ´ï¶þÊÖ·¿´æÈëmongo +// task.esfParser("D:\\Êý¾Ý\\ÓÑ´ï\\2023Äê3ÔÂ\\²éѯ1.DBF");//ÓÑ´ï¶þÊÖ·¿´æÈëmongo // task.newhouseToSaveEs();//з¿±£´æµ½es task.esfhouseToSaveEs();//¶þÊÖ·¿±£´æµ½es // task.updateFinishDateByEsfTrade();//¸ù¾Ý¶þÊֳɽ»µÄ¿¢¹¤Ê±¼äÐÞ¸Äseaweed¿âÖеĿ¢¹¤Ê±¼ä diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ZheShengBank.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ZheShengBank.groovy index 2817d78ee..73ea03b09 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ZheShengBank.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/ZheShengBank.groovy @@ -3,6 +3,7 @@ package com.fangjia.script.gj import com.fangjia.core.Constants import com.fangjia.core.util.DateUtil import com.fangjia.core.util.Mongo3Utils +import com.fangjia.script.gj.ccb.FileUtils import com.fangjia.script.util.ExcelUtils import com.mongodb.BasicDBObject import com.mongodb.client.MongoCollection @@ -12,29 +13,106 @@ import org.bson.Document import static com.mongodb.client.model.Filters.* MongoCollection OPEN_URI_LOG = Mongo3Utils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log") -def startDate = DateUtil.parseDate("20210301", "yyyyMMdd") -def endDate = DateUtil.parseDate("20230401", "yyyyMMdd") +//def startDate = DateUtil.parseDate("20210301", "yyyyMMdd") +//def endDate = DateUtil.parseDate("20230401", "yyyyMMdd") +//Calendar calendar = Calendar.getInstance() +//calendar.setTime(startDate) +//def data = [[ "¹«Ë¾Ãû³Æ","·ÃÎÊÁ´½Ó", "·ÃÎÊʱ¼ä", "×ÜÁ¿"]] +//def rMap = [:] +//def index = 0 +//OPEN_URI_LOG.find(and(eq("user_id", "1007569"), eq("request_uri", "/address/risk"), eq("code", 200))).each { Document doc -> +// index++ +// def day = doc.c_date.format("yyyy-MM-dd") +// def count = rMap.get(day) +// if (!count) { +// rMap.put(day, 1) +// } else { +// rMap.put(day, count + 1) +// } +// if(index%10000==0){ +// println index+" "+new Date().toString() +// } +//} +// +//rMap.each {k,val-> +// println k+" "+val +//} + +//def startDate = DateUtil.parseDate("20230416", "yyyyMMdd") +//def endDate = DateUtil.parseDate("20230418", "yyyyMMdd") +//Calendar calendar = Calendar.getInstance() +//calendar.setTime(startDate) +//def count = 0 +//def hashSet = [] +//def data = [["Óû§ID", "Óû§Ãû³Æ", "IP", "·ÃÎÊÁ´½Ó", "·ÃÎÊʱ¼ä", "dataStatus", "code", "msg", "²ÎÊý", "resMap"]] +//while (startDate.before(endDate)) { +// calendar.add(Calendar.DATE, 1) +// def nextDate = calendar.getTime() +// count++ +// def total = 0 +// OPEN_URI_LOG.find(and(eq("user_id", "1007569"), eq("request_uri", "/address/risk"), eq("data_status", 1), lt("c_date", nextDate), gte("c_date", startDate))).each { Document doc -> +// total++ +// def result = JSONObject.fromObject(doc.res_map.result) +//// if (!hashSet.contains(result)) { +// def item = [doc._id.toString(), "neiping2017@czbank", doc.ip, doc.request_uri, doc.c_date.format("yyyy-MM-dd HH:mm:ss"), doc.data_status, doc.code, doc.msg, JSONObject.fromObject(doc.parameter_map).toString(), result.toString()] +// data << item +// hashSet << result +// println total+" "+ nextDate +//// } else { +//// println("ÒÑ´æÔÚ") +//// } +// } +// if (count % 7 == 0) { +// hashSet.clear() +// } +// +// startDate = nextDate +// +//} +// +////FileUtils.batchCreateFile(data, "d:\\ÕãÉ̵÷ÓÃÏêÇé1.csv",null, "utf-8", false); +//ExcelUtils.write("D:\\ÕãÉ̵÷ÓÃÏêÇé${startDate.format('yyyyMM')}.xlsx", data, "²éѯÈÕÖ¾") + + + + +def startDate = DateUtil.parseDate("20230501", "yyyyMMdd") +def endDate = DateUtil.parseDate("20230508", "yyyyMMdd") Calendar calendar = Calendar.getInstance() calendar.setTime(startDate) -def data = [[ "¹«Ë¾Ãû³Æ","·ÃÎÊÁ´½Ó", "·ÃÎÊʱ¼ä", "×ÜÁ¿"]] -def rMap = [:] -def index = 0 -OPEN_URI_LOG.find(and(eq("user_id", "1007569"), eq("request_uri", "/address/risk"), eq("code", 200))).each { Document doc -> - index++ - def day = doc.c_date.format("yyyy-MM-dd") - def count = rMap.get(day) - if (!count) { - rMap.put(day, 1) - } else { - rMap.put(day, count + 1) - } - if(index%10000==0){ - println index+" "+new Date().toString() - } -} +def count = 0 +def hashSet = [] +def data = [["Óû§ID", "Óû§Ãû³Æ", "IP", "·ÃÎÊÁ´½Ó", "·ÃÎÊʱ¼ä", "dataStatus", "code", "msg", "²ÎÊý", "resMap"]] -rMap.each {k,val-> - println k+" "+val +OPEN_URI_LOG.find(and(eq("user_id", "1007779"), eq("data_status", 1), lt("c_date", endDate), gte("c_date", startDate))).each { Document doc -> + def result = JSONObject.fromObject(doc.res_map.result) + def item = [doc._id.toString(), "ÁÉÄþ׿ÐÅÆÕ»ÝÕ÷ÐÅ", doc.ip, doc.request_uri, doc.c_date.format("yyyy-MM-dd HH:mm:ss"), doc.data_status, doc.code, doc.msg, JSONObject.fromObject(doc.parameter_map).toString(), result.toString()] + data << item + hashSet << result } +//FileUtils.batchCreateFile(data, "d:\\ÕãÉ̵÷ÓÃÏêÇé1.csv",null, "utf-8", false); +ExcelUtils.write("D:\\ÁÉÄþ׿ÐÅÆÕ»ÝÕ÷ÐÅ${startDate.format('yyyyMM')}.xlsx", data, "²éѯÈÕÖ¾") + + +//def startDate = DateUtil.parseDate("20221201", "yyyyMMdd") +//def endDate = DateUtil.parseDate("20230506", "yyyyMMdd") +//Calendar calendar = Calendar.getInstance() +//calendar.setTime(startDate) +//def count = 0 +//def hashSet = [] +//def data = [["Óû§ID", "Óû§Ãû³Æ", "IP", "·ÃÎÊÁ´½Ó", "·ÃÎÊʱ¼ä", "dataStatus", "code", "msg", "²ÎÊý", "resMap"]] +// +//OPEN_URI_LOG.find(and(eq("request_uri", "/property/detail"), eq("data_status", 1), lt("c_date", endDate), gte("c_date", startDate))).each { Document doc -> +// def result = JSONObject.fromObject(doc.res_map.result) +// def item = [doc._id.toString(), doc.user_id, doc.ip, doc.request_uri, doc.c_date.format("yyyy-MM-dd HH:mm:ss"), doc.data_status, doc.code, doc.msg, JSONObject.fromObject(doc.parameter_map).toString(), result.toString()] +// data << item +// hashSet << result +// count++ +// println count +//} +// +// +////FileUtils.batchCreateFile(data, "d:\\ÕãÉ̵÷ÓÃÏêÇé1.csv",null, "utf-8", false); +//ExcelUtils.write("D:\\Ð¡ÇøÏêÇé${startDate.format('yyyyMM')}.xlsx", data, "²éѯÈÕÖ¾") \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistrictMatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistrictMatch.groovy index b28cc2770..269b5be9e 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistrictMatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/crawl/AnjukeDistrictMatch.groovy @@ -33,11 +33,14 @@ class AnjukeDistrictMatch { "postgres", "postgres", "org.postgresql.Driver") static main(args) { +// def name = "½¼Ò×ì±õ½­ÖÐÐÄN2×ù" +// name = name.replaceAll("-?\\w+(ºÅд×ÖÂ¥|ºÅÂ¥|Â¥|×ù|¶°)","") +// println name def task = new AnjukeDistrictMatch(); // task.run(); // task.runCsv(); // task.updateCredit() -// task.matchCommunity()//²éѯesÐ¡ÇøÊý¾Ý + task.matchCommunity()//²éѯesÐ¡ÇøÊý¾Ý // task.run1() // task.updateGreenRateField()//¸ù¾ÝµÚÈý·½Êý¾ÝÌî²¹¿âÖÐ×Ö¶Î // task.updteGreenRateFieldByCsv() @@ -50,7 +53,7 @@ class AnjukeDistrictMatch { // task.updteBuildAreaFieldByCsv() // task.updadteAllAreaFieldByCsv() // task.updatePlotRateFieldByCsv() - task.updateFinishDateFieldByCsv() +// task.updateFinishDateFieldByCsv() } def updateCredit(){ @@ -728,16 +731,17 @@ class AnjukeDistrictMatch { def run(){ - def datas = readTxt("D:\\Êý¾Ý\\½¨ÐÐ\\¶þÆÚ\\µÚÈý·½Ð¡Çø×ֶβ¹³ä\\µÚÈý·½ÍøÕ¾ÂÌ»¯ÂÊ (3).csv") - def filePath = "D:\\Êý¾Ý\\½¨ÐÐ\\¶þÆÚ\\µÚÈý·½Ð¡Çø×ֶβ¹³ä\\È«¹úÂÌ»¯ÂÊ.xlsx" +// def datas = readTxt("D:\\Êý¾Ý\\½¨ÐÐ\\¶þÆÚ\\µÚÈý·½Ð¡Çø×ֶβ¹³ä\\µÚÈý·½ÍøÕ¾ÂÌ»¯ÂÊ (3).csv") + def filePath = "D:\\Êý¾Ý\\Ð¡Çø\\ѺƷ·¢ÏÖÐÂÔöÐ¡ÇøÈ·ÈÏ£¨½á¹û£©0406.xlsx" def index = 0 ExcelUtils.multiThreadingModify(filePath,{row-> index++ if(row['A'] && row['B']){ def city = row['A'] - def name = row['C'] - def region = row['B'] + def name = row['B'] + def region = null +// def region = row['B'] if(name && name.contains("¡¤")){ name = name.replace("¡¤", "") @@ -785,27 +789,27 @@ class AnjukeDistrictMatch { row['AC'] = jsonObject.get("credit") } } - println index +" "+row['Y'] -// if(row['G']){ -// def dbo = CommonDatautils.findDistrictById(row['G']) -// if(dbo){ -// row['H'] = dbo.estate_type2 -// row['I'] = dbo.name_cat -// -// def count = findBigdataCommunity(row['G']) -// if(count){ -// row['E'] = "ÊÇ" -// } -// } -// } +// println index +" "+row['Y'] + if(row['G']){ + def dbo = CommonDatautils.findDistrictById(row['G']) + if(dbo){ + row['H'] = dbo.estate_type2 + row['I'] = dbo.name_cat + + def count = findBigdataCommunity(row['G']) + if(count){ + row['E'] = "ÊÇ" + } + } + } } }) } def matchCommunity(){ - def filePath = "D:\\Êý¾Ý\\Ð¡Çø\\ѺƷ·¢ÏÖÐÂÔöÐ¡ÇøÈ·ÈÏ£¨½á¹û£©3.24_2.xlsx" + def filePath = "D:\\Êý¾Ý\\Ð¡Çø\\ѺƷ·¢ÏÖÐÂÔöÐ¡ÇøÈ·ÈÏ£¨½á¹û£©0406-1.xlsx" ExcelUtils.modify(filePath, { row -> - if (row['A'] && row['B'] && row['I']) { + if (row['A'] && row['B'] && !row['O']) { def rets = findAllEsData(row['A'], row['B']) if(rets){ def dbo = rets[0] 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 231a930c8..55ce0ed8f 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 @@ -480,7 +480,7 @@ class OfficeProcess { } def checkRegion(){ - def citys = ["±±¾©","¹ãÖÝ","ÖØÇì","Ìì½ò","³É¶¼","ÄϾ©"]//"ÉϺ£","ÉîÛÚ", + def citys = ["º¼ÖÝ","ËÕÖÝ"]//"ÉϺ£","ÉîÛÚ","±±¾©","¹ãÖÝ","ÖØÇì","³É¶¼", for(def city : citys){ def regionPointsMap = findRegionRange(city) def addDatas = findAddDatasByClickhouse(city) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/FieldStat.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/FieldStat.groovy index 6b07a6159..62666390b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/FieldStat.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/data/FieldStat.groovy @@ -16,7 +16,140 @@ class FieldStat { // task.run() // task.run1() // task.run2() - task.run3() +// task.run3() +// task.offircRun() + task.distRun() + task.shopRun() + } + + def distRun(){ + def citys = CommonDatautils.findAllCity() + def cityMap = [:] + def fileds = ["region","name","alias","address","addr_alias","estate_type2","build_type","block","loop_line_info","street_community","household_count","curr_household_count","virescence_percent","cubage_percent","all_area","build_area","estate_charge","car_site","car_site_count","developer","estate_company","finish_building_date","live_date","start_building_date","open_date","property_life","floor_info","fitment","fitment_materials","build_structure","traffic","facilities","characteristic","sell_address","relate_info","description","total_price","mobile","building_status","licence","build_designer","garden_designer","business_quarter","bay_area","payment_pattern","land_plan_license","prj_plan_license","land_use_license","cons_license","elevators_count","build_date","divisible","status","metro_info","metro_names","cons_company","sells_company","contact_people","parking_fee","delivery_level","fitment_level","land_car_site","underground_car_site","avg_price","sell_price","standard_area","pics","loudong_count","committee","house_structure","usage_card","mainTypeArea"] + for(def c : citys){ + def dbo = findCoverPrecent(c) + if(dbo && dbo.containsField("district_detail")){ + def officeDetail = dbo.district_detail + cityMap.put(c, officeDetail) + }else{ + cityMap.put(c, [:]) + } + } + + def rets = [] + rets << ["³ÇÊÐ","ÊýÁ¿","ÇøÓò","Ãû³Æ","±ðÃû","µØÖ·","µØÖ·±ðÃû","ÎïÒµÀàÐÍ","½¨ÖþÀàÐÍ","°å¿é","»·ÏßλÖÃ","½ÖµÀÉçÇø","»§Êý","µ±Ç°»§Êý","ÂÌ»¯ÂÊ","ÈÝ»ýÂÊ","Õ¼µØÃæ»ý","½¨ÖþÃæ»ý","ÎïÒµ·Ñ","Í£³µÎ»","Í£³µÎ»Êý","¿ª·¢ÉÌ","ÎïÒµ¹«Ë¾","¿¢¹¤Ê±¼ä","Èëסʱ¼ä","¿ª¹¤Ê±¼ä","¿ªÅÌʱ¼ä","²úȨÄêÏÞ","Â¥²ãÇé¿ö","×°ÐÞÇé¿ö","×°ÐÞ²ÄÁÏ","½¨Öþ½á¹¹","½»Í¨Çé¿ö","ÖܱßÅä","Ð¡ÇøÌØÕ÷","ÊÛÂ¥µØÖ·","Ïà¹ØÐÅÏ¢","ÃèÊö","×ܼÛ","µç»°","½¨Öþ״̬","Ô¤ÊÛÐí¿ÉÖ¤","½¨Öþµ¥Î»","Ô°ÒÕÉè¼Æµ¥Î»","ÉÌȦ","»§ÐÍÃæ»ý","Ö§¸¶·½Ê½","Óõع滮Ðí¿ÉÖ¤","¹¤³Ì¹æ»®Ðí¿ÉÖ¤","ÍÁµØÊ¹ÓÃÖ¤","Ê©¹¤Ðí¿ÉÖ¤","µçÌÝÊýÁ¿","½¨ÔìÄê´ú","ÊÇ·ñ¿É·Ö¸î","״̬","µØÌúÑØÏß","µØÌúÕ¾Ãû","Ê©¹¤µ¥Î»","ÏúÊÛÆóÒµ","ÁªÏµÈË","Í£³µ·Ñ","½»¸¶±ê×¼","×°ÐÞ±ê×¼","µØÉϳµÎ»Êý","µØÏ³µÎ»Êý","¾ù¼Û","³öÊÛ¼Û¸ñ","±ê×¼²ãÃæ»ý","ͼƬ","Â¥¶°×ÜÊý","¾Óί»á","·¿Îݽṹ","ÍÁµØÊ¹ÓÃȨ֤ºÅ","Ö÷Á¦»§ÐÍ"] + def ret = [] + ret << "city" + ret << "count" + for(def f : fileds){ + ret << f + } + rets << ret + cityMap.each {k,v-> + def row = [] + row << k + row << CommonDatautils.findAllDistrictCount("district", k) + for(def filed : fileds){ + if(v){ + def val = v.get(underlineToCamel(filed)) + if(val){ + row << val.toDouble()*100 + }else{ + row << "" + } + } + } + rets << row + } + + ExcelUtils.write("d:\\Êý¾Ý\\д×ÖÂ¥\\д×ÖÂ¥¸²¸ÇÂÊ.xlsx", rets, "Ð¡Çø") + } + + def shopRun(){ + def citys = CommonDatautils.findAllCity() + def cityMap = [:] + def fileds = ["region","name","alias","address","business_quarter","property_status","rent_type","lease_term","payment_pattern","sell_price","household_count","mobile","floor","floor_info","bay_area","finish_building_date","live_date","divisible","unified_manage","car_site_count","car_site","all_area","build_area","estate_charge","developer","estate_company","metro_info","metro_names","facilities","property_info","traffic","surrounding","business_status","url","description","open_date","sell_address","block","height","loop_line_info","cubage_percent","virescence_percent","characteristic","sells_company","licence","build_designer","cons_company","property_life","insidepos","delivery_level","start_building_date","land_plan_license","prj_plan_license","land_use_license","cons_license","fitment","build_structure","enter_company","build_type","elevators_count","estate_type2","status","standard_area","relate_info","garden_designer","fitment_level","build_date","fitment_materials","rent_price","out_pics","pics","land_car_site","underground_car_site","addr_alias"] + for(def c : citys){ + def dbo = findCoverPrecent(c) + if(dbo && dbo.containsField("shop_detail")){ + def officeDetail = dbo.shop_detail + cityMap.put(c, officeDetail) + }else{ + cityMap.put(c, [:]) + } + } + + def rets = [] + rets << ["³ÇÊÐ","ÊýÁ¿","ÇøÓò","Ãû³Æ","±ðÃû","µØÖ·","ÉÌȦ","½¨Öþ״̬","×âÊÛÀàÐÍ","×âÁÞÄêÏÞ","¸¶¿î·½Ê½","³öÊÛ¼Û¸ñ","×Ü»§Êý","µç»°","½¨ÖþÂ¥²ã","Â¥²ã×´¿ö","¿ª¼äÃæ»ý","¿¢¹¤Ê±¼ä","¿ªÒµÊ±¼ä","¿É·Ö¸î","ͳһ¹ÜÀí","³µÎ»ÊýÁ¿","³µÎ»ÃèÊö","Õ¼µØÃæ»ý","½¨ÖþÃæ»ý","ÎïÒµ·Ñ","¿ª·¢ÉÌ","ÎïÒµ¹«Ë¾","µØÌúÑØÏß","µØÌúÕ¾Ãû","ÅäÌ×ÉèÊ©","ÎïÒµ¸Å¿ö","½»Í¨Çé¿ö","ÖܱßÇé¿ö","¾­ÓªÒµÌ¬","À´Ô´url","ÃèÊö","¿ªÅÌʱ¼ä","ÊÛÂ¥µØÖ·","°å¿é","Â¥¸ß","»·ÏßλÖÃ","ÈÝ»ýÂÊ","ÂÌ»¯ÂÊ","ÉÌÒµÌØÉ«","ÏúÊÛÆóÒµ","ÏúÊÛÐí¿ÉÖ¤","Éè¼Æµ¥Î»","Ê©¹¤µ¥Î»","²úȨÄêÏÞ","½»Í¨Î»ÖÃ","½»¸¶±ê×¼","¿ª¹¤Ê±¼ä","Óõع滮Ðí¿ÉÖ¤","¹¤³Ì¹æ»®Ðí¿ÉÖ¤","ÍÁµØÊ¹ÓÃÖ¤","Ê©¹¤Ðí¿ÉÖ¤","×°ÐÞ","½¨Öþ½á¹¹","ÈëפÆóÒµ","½¨ÖþÀàÐÍ","µçÌÝÊýÁ¿","ÎïÒµÀàÐÍ","״̬","±ê×¼²ãÃæ»ý","Ïà¹ØÐÅÏ¢","¾°¹ÛÉè¼Æµ¥Î»","×°ÐÞ±ê×¼","½¨ÔìÄê´ú","½¨²Ä×°ÐÞ","³ö×â¼Û¸ñ","Í⾰ͼ","ÆäËüͼ","µØÉϳµÎ»Êý","µØÏ³µÎ»Êý","µØÖ·±ðÃû"] + def ret = [] + ret << "city" + ret << "count" + for(def f : fileds){ + ret << f + } + rets << ret + cityMap.each {k,v-> + def row = [] + row << k + row << CommonDatautils.findAllDistrictCount("shop", k) + for(def filed : fileds){ + if(v){ + def val = v.get(underlineToCamel(filed)) + if(val){ + row << val.toDouble()*100 + }else{ + row << "" + } + } + } + rets << row + } + + ExcelUtils.write("d:\\Êý¾Ý\\д×ÖÂ¥\\д×ÖÂ¥¸²¸ÇÂÊ.xlsx", rets, "ÉÌÆÌ") + } + + def offircRun(){ + def citys = CommonDatautils.findAllCity() + def cityMap = [:] + def fileds = ["region","name","alias","latLng","latLng2","address","addrAlias","bedKind","estateType2","buildType","block","businessQuarter","loopLineInfo","licence","sideset","realUsePercent","buildDesigner","consCompany","estateCharge","carSiteCount","carSite","undergroundCarSite","landCarSite","parkingFee","sight","propertyLife","lobbyHeight","standardHeight","clearHeight","standardArea","foreign","register","lightingVentilation","conditionerTime","","elevatorsCount","personElevatorsCount","goodsElevatorCount","openDate","finishBuildingDate","liveDate","allArea","buildArea","cubagePercent","virescencePercent","developer","estateCompany","networkWay","fitmentLevel","buildStructure"] + for(def c : citys){ + def dbo = findCoverPrecent(c) + if(dbo && dbo.containsField("office_detail")){ + def officeDetail = dbo.office_detail + cityMap.put(c, officeDetail) + }else{ + cityMap.put(c, [:]) + } + } + + def rets = [] + rets << ["³ÇÊÐ","ÊýÁ¿","ÇøÓò","Ãû³Æ","Ãû³Æ±ðÃû","¾­Î³¶È£¨°Ù¶È£©","¾­Î³¶È£¨¸ßµÂ£©","µØÖ·","µØÖ·±ðÃû","д×ÖÂ¥µÈ¼¶","д×ÖÂ¥ÀàÐÍ","½¨ÖþÀà±ð","°å¿é","ÉÌȦ","»·ÏßλÖÃ","Ô¤ÊÛÐí¿ÉÖ¤","ÊÇ·ñ¿É·Ö¸î","µÃ·¿ÂÊ","Éè¼Æµ¥Î»","Ê©¹¤µ¥Î»","ÎïÒµ·Ñ","Í£³µÎ»Êý","Í£³µÃèÊö","µØÉϳµÎ»Êý","µØÏ³µÎ»Êý","³µÎ»×â½ð","¿ª¼äÃæ»ý","²úȨÄêÏÞ","´óÌòã¸ß","±ê×¼²ã¸ß","¾»¸ß","±ê×¼²ãÃæ»ý","ÊÇ·ñÉæÍâ","ÊÇ·ñ¿É×¢²á","¿Õµ÷","¿Õµ÷¿ª·Åʱ¼ä","¿Õµ÷·ÑÓÃ","µçÌÝÊýÁ¿","¿ÍÌÝÊý","»õÌÝÊý","¿ªÅÌʱ¼ä","¿¢¹¤Ê±¼ä","Èëסʱ¼ä","Õ¼µØÃæ»ý","½¨ÖþÃæ»ý","ÈÝ»ýÂÊ","ÂÌ»¯ÂÊ","¿ª·¢ÉÌ","ÎïÒµ¹«Ë¾","ÍøÂç","×°ÐÞ×´¿ö","½á¹¹"] + def ret = [] + ret << "³ÇÊÐ" + ret << "ÊýÁ¿" + for(def f : fileds){ + ret << f + } + rets << ret + cityMap.each {k,v-> + def row = [] + row << k + row << CommonDatautils.findAllDistrictCount("office", k) + for(def filed : fileds){ + if(v){ + def val = v.get(filed) + if(val){ + row << val.toDouble()*100 + }else{ + row << "" + } + } + } + rets << row + } + + ExcelUtils.write("d:\\Êý¾Ý\\д×ÖÂ¥\\д×ÖÂ¥¸²¸ÇÂÊ.xlsx", rets, "д×ÖÂ¥") + } def run3(){ @@ -136,4 +269,24 @@ class FieldStat { } return obj } + + + public static String underlineToCamel(String param){ + if (param==null||"".equals(param.trim())){ + return ""; + } + int len=param.length(); + StringBuilder sb=new StringBuilder(len); + for (int i = 0; i < len; i++) { + char c=param.charAt(i); + if (c=="_"){ + if (++i + if (d['A']) { + def results = com.fangjia.script.gj.OpenApiUtils.financialRating(d['A'], d['B']+d['C']) + if(results){ + d['D'] = results.consumptionRating + } + } + }) + } + + def similarRunTest(){ + + ExcelUtils.modify("D:\\Êý¾Ý\\½­ÄÏÅ©ÉÌÐÐ\\סլÐÅÏ¢V2-²îÒì°¸Àý£¨·´À¡£©.xlsx", { d -> + if(d['A']){ + def cityCode = d['U'].toString().toDouble().toInteger() + def proCode = d['V'].toString().toDouble().toInteger() + def regionCode = d['T'].toString().toDouble().toInteger() + def name = d['D'] + def area = d['F'] + def floor = d['H'].toString().toDouble().toInteger() + def height = d['G'].toString().toDouble().toInteger() + def results = com.fangjia.script.gj.OpenApiUtils.similarRank(proCode, cityCode,regionCode, name, area, floor, height) + if(results){ + def str = "" + for(def r : results){ + str = str + r.buildingName+"-"+r.strctureArea+"-"+r.unitPrice+"\n" + } + d['Y'] = str + } + } + }) + } + + def rankRunTest(){ def dists = CommonDatautils.findAllDistrictByCity("ÉϺ£","district", ["city","region","name"]) //def dists = CommonDatautils.findDistrictByCityAndRegions("ÉϺ£","district", ["ÆÖ¶«"], ["city","region","name"]) def rets = createCityDatas(dists) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictFieldAddBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictFieldAddBatch.groovy new file mode 100644 index 000000000..d32f3e459 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/DistrictFieldAddBatch.groovy @@ -0,0 +1,417 @@ +package com.fangjia.script.gj.district + +import com.fangjia.script.BaseBatch +import com.fangjia.script.BatchOwner +import com.fangjia.script.Watcher +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.common.DataHandleUtils +import com.fangjia.script.gj.FiledStrand +import com.fangjia.script.lixue.util.DBUtils +import com.fangjia.script.util.DbUtils +import com.fangjia.script.util.ElasticUtils +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.fangjia.script.util.OpenApiClient +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection +import com.rabbitmq.client.impl.AMQImpl +import org.bson.types.ObjectId + +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.CountDownLatch +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.atomic.AtomicLong +import java.util.regex.Pattern + +/** + * Ð¡Çø×Ö¶ÎÈë¿â£¨×Ô¶¯Èë¿â£© + */ +@BatchOwner(Watcher.GaoJuan) +class DistrictFieldAddBatch extends BaseBatch{ + + public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10) + + DBCollection SEAWEEDMAP_COLL = MongoUtils.getCollectionByName("fangjia", "seaweedmap", "192.168.0.235", 27018) + //"°²¾Ó¿Í":"°²¾Ó¿ÍС³ÌÐò","Á´¼Ò":"Á´¼Ò","ÐÒ¸£Àï":"ÐÒ¸£Àï","³ÇÊз¿²ú":"³ÇÊз¿²úС³ÌÐò","ËÑ·¿":"ËÑ·¿" + + //,"°²¾Ó¿Í":"°²¾Ó¿ÍС³ÌÐò","Á´¼Ò":"Á´¼Ò","ÐÒ¸£Àï":"ÐÒ¸£Àï","³ÇÊз¿²ú":"³ÇÊз¿²úС³ÌÐò","ËÑ·¿":"ËÑ·¿","ÎÒ°®ÎÒ¼Ò":"ÎÒ°®ÎÒ¼Ò" + def sourceMap = ["°²¾Ó¿Í-з¿":"°²¾Ó¿Í-з¿","ìûÌ©":"Öйú·¿¼ÛÐÐÇé","°²¾Ó¿Í":"°²¾Ó¿ÍС³ÌÐò","Á´¼Ò":"Á´¼Ò","ÐÒ¸£Àï":"ÐÒ¸£Àï","³ÇÊз¿²ú":"³ÇÊз¿²úС³ÌÐò","ËÑ·¿":"ËÑ·¿","ÎÒ°®ÎÒ¼Ò":"ÎÒ°®ÎÒ¼Ò"] //key:ÄÂÈںϱíµÄÀ´Ô´ valve:es½âÎö±íµÄÀ´Ô´ + + //"alias":"alias", + def fieldsMap = ["estate_charge":"property_fee","estate_type2":"estate_type2","build_date":"build_year","estate_company":"property_company","developer":"developer","virescence_percent":"greening_rate","cubage_percent":"plot_ratio","build_area":"build_area","all_area":"land_area","household_count":"households","car_site_count":"parking_cnt","car_site":"parking_cnt","property_life":"land_usage_period","address":"address"]//key:seaweed±í×Ö¶Î value:es±í×Ö¶Î + + static main(args) { + runBatch(new DistrictFieldAddBatch(), args) + } + + @Override + void process(Object args) { + def citys = ["ÕÄÖÝ","¸£ÖÝ","³£ÖÝ","ÁúÑÒ","ÏÃÃÅ","ÑïÖÝ","ÐìÖÝ","Õò½­","ÄÏͨ","Ì©ÖÝ","Á¬ÔƸÛ","ÑγÇ","»´°²","ËÞǨ","ÄϾ©","ËÕÖÝ","ºÏ·Ê","ÎÞÎý","ÉϺ£","±±¾©","À¥Ã÷","Çíº£","ºôºÍºÆÌØ","ÄÏÆ½","Çൺ","³£µÂ","»ÆÊ¯","»Æ¸Ô","ººÖÐ","°²¿µ","ÓÜÁÖ","Äϳä","ãòÖÝ","×ÊÑô","¿ËÀ­ÂêÒÀ","¾£ÃÅ","Í­´¨","ÄÚ½­","´ïÖÝ","°ÍÖÐ","¶õÖÝ","Ê®Ñß","ËìÄþ","ËæÖÝ","¹ã°²","¾£ÖÝ","ÏÌÄþ","°¢¿ËËÕ","¿¦Ê²","²ý¼ª","ͳ·¬","¹þÃÜ","ºÍÌï","Ëþ³Ç","°¢ÀÕÌ©","²©¶ûËþÀ­","°ÍÒô¹ùÀã","¿Ë×ÎÀÕËÕ","ÒÁÀç","¶÷Ê©","ÏÌÑô","Ò˱ö","×Ô¹±","ÅÊÖ¦»¨","ÑÓ°²","µÂÑô","Î÷°²","ÖØÇì","³É¶¼","ÃàÑô","ÎÚ³ľÆë","Ò˲ý","Î人","ÀÖɽ","üɽ","±¦¼¦","ÏåÑô","Т¸Ð","À­Èø","ÉîÛÚ","ÈýÃÅÏ¿","º¼ÖÝ","»³»¯","ÁijÇ","Í¼Ä¾Êæ¿Ë","μÄÏ","½ð»ª","ÄþµÂ","ÈýÃ÷","ȪÖÝ","ÆÎÌï","Óª¿Ú","ĵµ¤½­","Å̽õ","±¾Ïª","ÌúÁë","ÆëÆë¹þ¶û","ËÄÆ½","ÁÉÔ´","½õÖÝ","¼Ñľ˹","°×ɽ","Ë绯","¼¦Î÷","Æß̨ºÓ","°×³Ç","³¯Ñô","˫Ѽɽ","ͨ»¯","º×¸Ú","ºÚºÓ","¸·ÐÂ","¸§Ë³","ºù«µº","ÒÁ´º","ËÉÔ­","´óÐ˰²Áë","ÑÓ±ß","¼ªÁÖ","ÉòÑô","´óÁ¬","³¤´º","¹þ¶û±õ","°°É½","´óÇì","µ¤¶«"] //"¹ãÖÝ", "³É¶¼","º¼ÖÝ", "ÉîÛÚ", "ÖØÇì","ËÕÖÝ","ÉϺ£","±±¾©" + + + def analysRets = [] + for(def c : citys){ + def totalCount = CommonDatautils.findAllDistrictCount("district", c) +// addFieldFromRonghe(c, totalCount) + analysRets = addFieldFromMatch(c, totalCount, analysRets) + } + println analysRets.toString() + + ExcelUtils.write("D:\\Êý¾Ý\\Ð¡Çø\\¸²¸ÇÂÊ.xlsx", analysRets, "Êý¾Ý") + } + + def addFieldFromMatch(c, totalCount, analysRets){ + sourceMap.each { seaweedmapSource, esWebSource -> + def esRets = findEsDatas(c, esWebSource) + def matchRets1 = matchApi(esRets) + def matchRets2 = selectRestByCredit(matchRets1) + println esWebSource +" ץȡÁ¿£º"+esRets.size()+" Æ¥ÅäÁ¿£º"+matchRets1.size()+" 0.9·ÖÒÔÉÏÁ¿£º"+matchRets2.size() + + def updateRets = processFieldsFromMatch(c , matchRets2) + println "¡¾Í¨¹ýÆ¥ÅäÌî³ä×ֶΡ¿ÍøÕ¾£º"+seaweedmapSource +" Es:"+esRets.size()+" ÈÚºÏÐ¡ÇøÕ¼±È£º"+DataHandleUtils.getDoubleRound(2, matchRets2.size()*100/totalCount)+"%" + def precentMap = fieldUpdate(totalCount, updateRets) + println c +" "+precentMap.toString() + updateDB(c, updateRets) + println "------------------------------------------------------------------------------" + def pre1 = 0 + def pre2 = 0 + if(esRets){ + pre1 = DataHandleUtils.getDoubleRound(2, matchRets1.size()*100/esRets.size()) + pre2 = DataHandleUtils.getDoubleRound(2, matchRets2.size()*100/esRets.size()) + } + analysRets << [seaweedmapSource, c, precentMap.get("property_fee"), esRets.size(), matchRets1.size(), matchRets2.size(), pre1, pre2] + } + return analysRets; + } + + + + + def addFieldFromRonghe(c, totalCount){ + sourceMap.each{seaweedmapSource,esWebSource-> + def rhRets = findRongheDists(c, seaweedmapSource) + def esRets = findEsDistrict(c, esWebSource) + def updateRets = processFieldsFromRh(c, rhRets, esRets) + + println "¡¾Í¨¹ýÈںϹØÏµÌî³ä×ֶΡ¿ÍøÕ¾£º"+seaweedmapSource +" µÚÈý·½ÈÚºÏ±í£º"+rhRets.size() +" Es:"+esRets.size()+" ÈÚºÏÐ¡ÇøÕ¼±È£º"+DataHandleUtils.getDoubleRound(2, rhRets.size()*100/totalCount)+"%" + def precentMap = fieldUpdate(totalCount, updateRets) + println c +" "+precentMap.toString() + updateDB(c, updateRets) + println "----------------------------------------------------------------------------------" + } + } + + def processFieldsFromRh(c, rhRets, esRets){ + def fields = fieldsMap.keySet() as List + def fieldValueMap = [:] + for(def rhDist : rhRets){ + def dist = CommonDatautils.findDistrictFieldById(rhDist.commid, fields) + if(!dist){ + println c+" "+rhDist.commid+" ²»´æÔÚ" + continue + } + def esDbo = esRets.get(c + "#" + rhDist.id) + if(!esDbo){ + println c+" "+rhDist.id+" ²»´æÔÚ[ES]" + continue + } + def newValues = [:] + fieldsMap.each{seaweedfield,esField-> + def val = dist.get(seaweedfield) + if(!val){ + def esVal = esDbo.get(esField) + if(esVal){ + def newVal = null + if(seaweedfield == "estate_charge"){ + newVal = FiledStrand.processEstateCharge(c, FiledStrand.getNumber(esVal), dist.estate_type2) + newVal = newVal.toString() + } + if(seaweedfield == "build_date"){ + newVal = FiledStrand.processFinishBuildingDate(esVal) + } + if(newVal){ + newValues.put(seaweedfield, newVal) + } + } + } + } + if(newValues){ + fieldValueMap.put(dist._id.toString(), newValues) + } + } + + println fieldValueMap.size() + return fieldValueMap; + + } + + def processFieldsFromMatch(c,matchRets){ + def fields = fieldsMap.keySet() as List + fields << "city" + def fieldValueMap = [:] + for(def matchDist : matchRets){ + + def dist = CommonDatautils.findDistrictFieldById(matchDist.match_id, fields) + if(!dist){ + println c+" "+matchDist.match_id+" ²»´æÔÚ" + continue + } + + def newValues = [:] + fieldsMap.each{seaweedfield,esField-> + def val = dist.get(seaweedfield) + if(!val){ + def esVal = matchDist.get(esField) + if(esVal){ + def newVal = null + if(seaweedfield == "estate_charge"){ + newVal = FiledStrand.processEstateCharge(c, FiledStrand.getNumber(esVal), dist.estate_type2) + newVal = newVal.toString() + } + if(seaweedfield == "build_date"){ + newVal = FiledStrand.processFinishBuildingDate(esVal) + } + if(seaweedfield == "estate_company" || seaweedfield == "developer"){ + newVal = FiledStrand.processCompany(esVal) + } + if(seaweedfield =="virescence_percent"){ + newVal = FiledStrand.processVirescencePercent(esVal) + } + + if(seaweedfield =="cubage_percent"){ + newVal = FiledStrand.processCubagePercent(esVal) + } + + if(seaweedfield =="all_area" || seaweedfield =="build_area"){ + newVal = FiledStrand.processArea(esVal) + newVal = newVal.toString() + } + if(seaweedfield =="household_count"){ + newVal = FiledStrand.processHouseholdCount(esVal, dist.estate_type2) + } + + if(seaweedfield =="loudong_count"){ + newVal = FiledStrand.processLoudongCount(esVal) + } + + if(seaweedfield =="car_site_count"){ + newVal = FiledStrand.processCarSite(esVal) + } + if(seaweedfield =="car_site"){ + newVal = FiledStrand.processCarSiteDesc(esVal) + } + + if(seaweedfield =="property_life"){ + newVal = FiledStrand.processPropertyLife(esVal) + } + + if(seaweedfield =="alias"){ + newVal = FiledStrand.processAlias(esVal, dist.name, dist.alias) + } + + if(seaweedfield =="address"){ + newVal = FiledStrand.processAddress(esVal, dist.city) + } + + if(newVal){ + newValues.put(seaweedfield, newVal) + } + } + } + } + if(newValues){ + println dist._id.toString()+" "+newValues.toString() + fieldValueMap.put(dist._id.toString(), newValues) + } + } + + return fieldValueMap; + } + + + + def findRongheDists(def city, def source){ + def keys = new BasicDBObject() + keys.put("commid", 1) + keys.put("city", 1) + keys.put("id", 1) + keys.put("source", 1) + def dbcursor = SEAWEEDMAP_COLL.find(new BasicDBObject().append("city", city).append("source", source), keys) + def rets = [] + for(def d : dbcursor){ + rets << ["commid":d.commid, "city":d.city, "source":d.source, "id":d.id] + } + return rets; + } + + def findEsDistrict(c, esWebSource){ + def map = [:] + ElasticUtils.executeSqlQuery("select * from community where city='${c}' and source='${esWebSource}'", {r-> + if(r.id && !map.containsKey(c+"#"+r.id)){ + map.put(c+"#"+r.id, r) + } + }) + return map + } + + + def findEsDatas(c, esWebSource){ + def list = [] + ElasticUtils.executeSqlQuery("select * from community where city='${c}' and source='${esWebSource}'", {r-> + list << r + }) + return list + } + + def fieldUpdate(total,updateRets){ + + def countMap = [:] + + for(def rm : updateRets){ + def valMap = rm.value + fieldsMap.each{seaweedfield,esField-> + if(valMap.containsKey(seaweedfield)) { + if(countMap.containsKey(seaweedfield)) { + countMap.put(seaweedfield, countMap.get(seaweedfield) + 1) + }else{ + countMap.put(seaweedfield, 1) + } + } + } + } + + println countMap.toString() + def precentMap = [:] + fieldsMap.each() {key,skey-> + if(countMap.containsKey(key)) { + precentMap.put(skey, DataHandleUtils.getDoubleRound(2, countMap.get(key)*100/total)) + }else { + precentMap.put(skey, 0) + } + } + return precentMap; + } + + + def matchApi(esRets){ + def rets = new CopyOnWriteArrayList() + def totalCount = new AtomicLong() + final CountDownLatch latch = new CountDownLatch(esRets.size()) + for(def i=0;i=0.9){ + matchRets1 << r + } + } + return matchRets1 + } + + def matching(data){ + def name = data.name + if(data.name && data.name.contains("¡¤")){ + name = data.name.replace("¡¤", "") + } + + def flag = "Ãû³ÆÆ¥Åä" + def dist = matchDist(data.city, data.region, name) + + if(!dist){ + dist = CommonDatautils.findSeaweedByMappingAlias(data.city, data.region, name,"district") + flag = "Ó³Éä±ðÃûÆ¥Åä" + } + if(!dist) { + def rets = CommonDatautils.findDistrictByAlias(data.city, data.region, name, "district") + if(rets && rets.size()==1){ + flag = "±ðÃûÆ¥Åä" + dist = rets[0] + } + } + + if(dist){ + data.flag = flag + data.match_id = dist._id.toString() + data.match_region = dist.region + data.match_name = dist.name + data.credit = 0.95 + }else{ + def jsonObject = OpenApiClient.addressMatch(data.city, name, "property", false,data.region, null) + if(jsonObject!=null && jsonObject.precise==-1){ + if(data.address && isStandardRoad(data.address)){ + jsonObject = OpenApiClient.addressMatch(data.city, data.address, "property", false,data.region, name) + }else{ + data.flag = "Æ¥Åä½Ó¿Ú-µØÖ·" + } + }else{ + data.flag = "Æ¥Åä½Ó¿Ú-Ãû³Æ" + } + if(jsonObject != null && jsonObject.precise!=-1) { + data.match_id = jsonObject.get("id") + data.match_region = jsonObject.get("district") + data.match_name = jsonObject.get("name") + data.credit = jsonObject.get("credit") + } + } + if(data.match_id){ + return data + } + return null + } + + + def updateDB(c, updateRets){ + + for(def rm : updateRets) { + def id = rm.key + def valMap = rm.value + + BasicDBObject udata = new BasicDBObject() + valMap.each {k,v-> + udata.put(k,v) + } + udata.put("m_date", new Date()) + DbUtils.seaweed.update(new BasicDBObject('_id',new ObjectId(id)),new BasicDBObject('$set',udata)) + } + } + + def matchDist(city, region, name){ + def dist = CommonDatautils.findDistrict(city, region, name, "district") + return dist; + } + + + + def isStandardRoad(def s){ + def pattern = Pattern.compile("[·|½Ö|´óµÀ|Ïï]\\d+(ºÅ|Ū)"); + def matcher = pattern.matcher(s) + if(matcher.find()){ + return true; + } + return false + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/SameDistName.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/SameDistName.groovy new file mode 100644 index 000000000..945227e7a --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/district/SameDistName.groovy @@ -0,0 +1,71 @@ +package com.fangjia.script.gj.district + +import com.fangjia.core.RegionData +import com.fangjia.script.commData.CommonDatautils +import com.fangjia.script.looplineinfo.InsidePolygon +import com.fangjia.script.looplineinfo.Point +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.MongoUtils +import com.mongodb.BasicDBObject +import com.mongodb.DBCollection + +class SameDistName { + + static DBCollection POLYLINECOLL = MongoUtils.getCollectionByAuth20190102("fangjia_crawl", "region_polyline") + + static main(args) { + def task = new SameDistName() + task.run() + } + + def run(){ + def dists = CommonDatautils.findAllDistrictByCity("³£ÖÝ", "district", ["city","region", "name", "address","lat", "lng"]) + def map = [:] + for(def d : dists){ + def list = map.get(d.name) + if(!list){ + list = [] + map.put(d.name, list) + } + list << d + } + + def datas = [] + map.each {k,v-> + if(v && v.size()>=2){ + datas.addAll(v) + } + } + + def retDats = [] + retDats << ["³ÇÊÐ","ÇøÓò","Ãû³Æ","µØÖ·","ÇøÓò×´¿ö"] + if(datas){ + def regionPointsMap = findRegionRange("³£ÖÝ") + for(def d : datas){ + def lng = d.lng/10000000000.0 + def lat = d.lat/10000000000.0 + def flag = isInArea(lng, lat, regionPointsMap.get(d.region)) + retDats << [d.city, d.region, d.name, d.address, flag] + } + } + ExcelUtils.write("D:\\Êý¾Ý\\Ð¡Çø\\ÏàÍ¬Ð¡Çø²»Í¬ÇøÓò.xlsx", retDats, "Êý¾Ý") + } + + def findRegionRange(city){ + def q = new BasicDBObject() + q.put("city",city) + def dbcursor = POLYLINECOLL.find(q) + def regionMap = [:] + for(def d : dbcursor){ + def region = RegionData.formatRegion(city,d.region) + regionMap.put(region, d.polyline) + } + return regionMap + } + + def isInArea(lng, lat, points){ + List pointList = InsidePolygon.createPoint2(points); + def flag = InsidePolygon.isPtInPoly(lng, lat, pointList) + return flag; + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/FangjiaCorestieLogAnaly.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/FangjiaCorestieLogAnaly.groovy index c133d7283..aa3c3c62c 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/FangjiaCorestieLogAnaly.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/FangjiaCorestieLogAnaly.groovy @@ -1,6 +1,8 @@ package com.fangjia.script.gj.es +import com.fangjia.core.util.DateUtil import com.fangjia.script.util.ElasticUtils +import com.fangjia.script.util.ExcelUtils import org.elasticsearch.index.query.QueryBuilder import org.elasticsearch.index.query.QueryBuilders import org.elasticsearch.xpack.sql.jdbc.EsDataSource @@ -8,16 +10,39 @@ import org.elasticsearch.xpack.sql.jdbc.EsDataSource EsDataSource dataSource = new EsDataSource(); String address = "jdbc:es://http://192.168.0.86:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"; -findLogs() +//findLogs() +//findFangjiaLogs() +stat() +def stat(){ + def datas = ExcelUtils.read("D:\\Êý¾Ý\\fjw-Ìá½».xlsx",0,1) + def map=[:] + for(def d : datas){ + def count = map.get(d['C']) + if(!count){ + map.put(d['C'], 1) + }else{ + map.put(d['C'], count+1) + } + } + + map.each {k,v-> + println k +" "+v + } +} def findLogs(){ def total = 0 try{ // String sql = "select * from fangjia-log* where request like '/jnBank%'" // BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); + +// def startDate = DateUtil.parseDate("20230427", "yyyyMMdd") +// def endDate = DateUtil.parseDate("20230428", "yyyyMMdd") +// QueryBuilder date_range = QueryBuilders.rangeQuery("time_local").from(startDate).to(endDate).includeLower(true).includeUpper(false); + def q = QueryBuilders.fuzzyQuery("domain", ".fangjia.com") - QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(q) + QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(q).must(date_range) def houses = ElasticUtils.executeSimpleQuery("192.168.0.86", "fangjia-log*", queryBuilder); println houses.size() def set = new HashSet() @@ -39,4 +64,48 @@ def findLogs(){ } return total +} + + +def findFangjiaLogs(){ + + def startDate = DateUtil.parseDate("20230329", "yyyyMMdd") + def endDate = DateUtil.parseDate("20230429", "yyyyMMdd") + Calendar calendar = Calendar.getInstance() + calendar.setTime(startDate) + def list = [] + def data = [["mid", "ip", "·ÃÎÊʱ¼ä"]] + while (startDate.before(endDate)) { + calendar.add(Calendar.DATE, 1) + def nextDate = calendar.getTime() + +// def startDate = DateUtil.parseDate("20230427", "yyyyMMdd") +// def endDate = DateUtil.parseDate("20230428", "yyyyMMdd") + QueryBuilder date_range = QueryBuilders.rangeQuery("@timestamp").from(startDate).to(nextDate).includeLower(true).includeUpper(false); + + + def q = QueryBuilders.fuzzyQuery("request", "/doAdd2") + QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(q).must(date_range) + def houses = ElasticUtils.executeSimpleQuery("192.168.0.86", "fangjia-log*", queryBuilder); + println houses.size() + + if (houses) { + for (def d : houses) { + def reqStr = d.request.toString() + def mid = null + if (reqStr.contains("mid=")) { + + mid = reqStr.substring(reqStr.indexOf("mid=") + 4, reqStr.indexOf("mid=") + 8) + } + def time = d.get("@timestamp").toString() + time = time.substring(0, time.indexOf("T")) + def ip = d.remote_addr + data << [mid, ip, time] + } + } + + startDate = nextDate + } + + ExcelUtils.write("D:\\Êý¾Ý\\fjw-Ìá½».xlsx", data, "²éѯÈÕÖ¾") } \ No newline at end of file diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/JnBlankLog.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/JnBlankLog.groovy index 444fddbfc..ea7d46e2b 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/JnBlankLog.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/es/JnBlankLog.groovy @@ -1,5 +1,6 @@ package com.fangjia.script.gj.es +import com.fangjia.core.util.DateUtil import com.fangjia.script.util.ElasticUtils import org.elasticsearch.index.query.BoolQueryBuilder import org.elasticsearch.index.query.QueryBuilder @@ -9,14 +10,18 @@ import org.elasticsearch.xpack.sql.jdbc.EsDataSource EsDataSource dataSource = new EsDataSource(); String address = "jdbc:es://http://192.168.0.25:9200/timezone=UTC&page.size=250&connect.timeout=120s&network.timeout=120s&page.timeout=120s"; -findLogs() - +//findLogs() +findFangjiaLogs() def findLogs(){ def total = 0 try{ // String sql = "select * from fangjia-log* where request like '/jnBank%'" // BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); + def startDate = DateUtil.parseDate("20230427", "yyyyMMdd") + def endDate = DateUtil.parseDate("20230428", "yyyyMMdd") + + QueryBuilder date_range = QueryBuilders.rangeQuery("time_local").from(startDate).to(endDate).includeLower(true).includeUpper(false); def q = QueryBuilders.fuzzyQuery("request", "/jnBank") QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(q) def houses = ElasticUtils.executeSimpleQuery("192.168.0.25", "fangjia-log*", queryBuilder); @@ -53,3 +58,35 @@ def findLogs(){ return total } + + + + + +def findFangjiaLogs(){ + def total = 0 + try{ + +// String sql = "select * from fangjia-log* where request like '/jnBank%'" +// BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); + def startDate = DateUtil.parseDate("20230427", "yyyyMMdd") + def endDate = DateUtil.parseDate("20230428", "yyyyMMdd") + + QueryBuilder date_range = QueryBuilders.rangeQuery("time_local").from(startDate).to(endDate).includeLower(true).includeUpper(false); + def q = QueryBuilders.fuzzyQuery("request", "/enquire") + QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(q) + def houses = ElasticUtils.executeSimpleQuery("192.168.0.25", "fangjia-log*", queryBuilder); + println houses.size() + def set = new HashSet() + if(houses) { + for (def d : houses) { + + } + } + println set + }catch(Exception e){ + e.printStackTrace() + } + + return total +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/location/GaoDeMapSearchTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/location/GaoDeMapSearchTest.groovy new file mode 100644 index 000000000..ee95b0621 --- /dev/null +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/location/GaoDeMapSearchTest.groovy @@ -0,0 +1,556 @@ +package com.fangjia.script.gj.location + +import com.fangjia.core.RegionData +import com.fangjia.core.util.BaiDuApiUtils +import com.fangjia.core.util.GeocodeUtils +import com.fangjia.core.util.HttpRequest +import com.fangjia.script.gj.OpenApiUtils +import com.fangjia.script.gj.district.FangjiaClientUtils +import com.fangjia.script.linxsh.util.AddressUtil +import com.fangjia.script.util.CosineSimilarAlgorithm +import com.fangjia.script.util.ExcelUtils +import com.fangjia.script.util.OpenApiClient +import net.sf.json.JSONObject + +import java.util.regex.Pattern + +class GaoDeMapSearchTest { + + def baiduCityCodeMap = ["±±¾©": "131", "Ìì½ò": "332", "ʯ¼Òׯ": "150", "ÌÆÉ½": "265", "ÇØ»Êµº": "148", "ºªµ¦": "151", "ÐĮ̈": "266", "±£¶¨": "307", "ÕżҿÚ": "264", "³ÐµÂ": "207", "²×ÖÝ": "149", "ÀÈ·»": "191", "ºâË®": "208", "̫ԭ": "176", "´óͬ": "355", "ÑôȪ": "357", "³¤ÖÎ": "356", "½ú³Ç": "290", "Ë·ÖÝ": "237", "½úÖÐ": "238", "Ô˳Ç": "328", "ÐÃÖÝ": "367", "ÁÙ·Ú": "368", "ÂÀÁº": "327", "ºôºÍºÆÌØ": "321", "°üÍ·": "229", "ÎÚº£": "123", "³à·å": "297", "ͨÁÉ": "64", "¶õ¶û¶à˹": "283", "ºôÂ×±´¶û": "61", "°ÍÑåÄ×¶û": "169", "ÎÚÀ¼²ì²¼": "168", "Ð˰²ÃË": "62", "ÎýÁÖ¹ùÀÕÃË": "63", "°¢À­ÉÆÃË": "230", "ÉòÑô": "58", "´óÁ¬": "167", "°°É½": "320", "¸§Ë³": "184", "±¾Ïª": "227", "µ¤¶«": "282", "½õÖÝ": "166", "Óª¿Ú": "281", "¸·ÐÂ": "59", "ÁÉÑô": "351", "Å̽õ": "228", "ÌúÁë": "60", "³¯Ñô": "280", "ºù«µº": "319", "³¤´º": "53", "¼ªÁÖÊÐ": "55", "ËÄÆ½": "56", "ÁÉÔ´": "183", "ͨ»¯": "165", "°×ɽ": "57", "ËÉÔ­": "52", "°×³Ç": "51", "Ñӱ߳¯ÏÊ×å×ÔÖÎÖÝ": "54", "¹þ¶û±õ": "48", "ÆëÆë¹þ¶û": "41", "¼¦Î÷": "46", "º×¸Ú": "43", "˫Ѽɽ": "45", "´óÇì": "50", "ÒÁ´º": "40", "¼Ñľ˹": "42", "Æß̨ºÓ": "47", "ĵµ¤½­": "49", "ºÚºÓ": "39", "Ë绯": "44", "´óÐ˰²ÁëµØÇø": "38", "ÉϺ£": "289", "ÄϾ©": "315", "ÎÞÎý": "317", "ÐìÖÝ": "316", "³£ÖÝ": "348", "ËÕÖÝ": "224", "ÄÏͨ": "161", "Á¬ÔƸÛ": "347", "»´°²": "162", "ÑγÇ": "223", "ÑïÖÝ": "346", "Õò½­": "160", "Ì©ÖÝ": "276", "ËÞǨ": "277", "º¼ÖÝ": "179", "Äþ²¨": "180", "ÎÂÖÝ": "178", "¼ÎÐË": "334", "ºþÖÝ": "294", "ÉÜÐË": "293", "½ð»ª": "333", "áéÖÝ": "243", "ÖÛɽ": "245", "̨ÖÝ": "244", "ÀöË®": "292", "ºÏ·Ê": "127", "Îߺþ": "129", "°ö²º": "126", "»´ÄÏ": "250", "Âí°°É½": "358", "»´±±": "253", "Í­Áê": "337", "°²Çì": "130", "»ÆÉ½": "252", "³üÖÝ": "189", "¸·Ñô": "128", "ËÞÖÝ": "370", "³²ºþ": "251", "Áù°²": "298", "ÙñÖÝ": "188", "³ØÖÝ": "299", "Ðû³Ç": "190", "¸£ÖÝ": "300", "ÏÃÃÅ": "194", "ÆÎÌï": "195", "ÈýÃ÷": "254", "ȪÖÝ": "134", "ÕÄÖÝ": "255", "ÄÏÆ½": "133", "ÁúÑÒ": "193", "ÄþµÂ": "192", "Äϲý": "163", "¾°µÂÕò": "225", "ƼÏç": "350", "¾Å½­": "349", "ÐÂÓà": "164", "ӥ̶": "279", "¸ÓÖÝ": "365", "¼ª°²": "318", "ÒË´º": "278", "¸§ÖÝ": "226", "ÉÏÈÄ": "364", "¼ÃÄÏ": "288", "Çൺ": "236", "×Ͳ©": "354", "Ôæ×¯": "172", "¶«Óª": "174", "ÑĮ̀": "326", "Ϋ·»": "287", "¼ÃÄþ": "286", "Ì©°²": "325", "Íþº£": "175", "ÈÕÕÕ": "173", "À³Îß": "124", "ÁÙÒÊ": "234", "µÂÖÝ": "372", "ÁijÇ": "366", "±õÖÝ": "235", "ºÊÔó": "353", "Ö£ÖÝ": "268", "¿ª·â": "210", "ÂåÑô": "153", "ƽ¶¥É½": "213", "°²Ñô": "267", "º×±Ú": "215", "ÐÂÏç": "152", "½¹×÷": "211", "å§Ñô": "209", "Ðí²ý": "155", "äðºÓ": "344", "ÈýÃÅÏ¿": "212", "ÄÏÑô": "309", "ÉÌÇð": "154", "ÐÅÑô": "214", "ÖÜ¿Ú": "308", "פÂíµê": "269", "Î人": "218", "»ÆÊ¯": "311", "Ê®Ñß": "216", "Ò˲ý": "270", "ÏåÑô": "156", "¶õÖÝ": "122", "¾£ÃÅ": "217", "Т¸Ð": "310", "¾£ÖÝ": "157", "»Æ¸Ô": "271", "ÏÌÄþ": "362", "ËæÖÝ": "371", "¶÷Ê©ÍÁ¼Ò×åÃç×å×ÔÖÎÖÝ": "373", "ÏÉÌÒ": "1713", "DZ½­": "1293", "ÌìÃÅ": "2654", "ÉñÅ©¼ÜÁÖÇø": "2734", "³¤É³": "158", "ÖêÖÞ": "222", "ÏæÌ¶": "313", "ºâÑô": "159", "ÉÛÑô": "273", "ÔÀÑô": "220", "³£µÂ": "219", "Õżҽç": "312", "ÒæÑô": "272", "³»ÖÝ": "275", "ÓÀÖÝ": "314", "»³»¯": "363", "¦µ×": "221", "ÏæÎ÷ÍÁ¼Ò×åÃç×å×ÔÖÎÖÝ": "274", "¹ãÖÝ": "257", "ÉØ¹Ø": "137", "ÉîÛÚ": "340", "Ö麣": "140", "ÉÇÍ·": "303", "·ðɽ": "138", "½­ÃÅ": "302", "Õ¿½­": "198", "ïÃû": "139", "ÕØÇì": "338", "»ÝÖÝ": "301", "÷ÖÝ": "141", "ÉÇβ": "339", "ºÓÔ´": "200", "Ñô½­": "199", "ÇåÔ¶": "197", "¶«Ý¸": "119", "ÖÐɽ": "187", "³±ÖÝ": "201", "½ÒÑô": "259", "ÔÆ¸¡": "258", "ÄÏÄþ": "261", "ÁøÖÝ": "305", "¹ðÁÖ": "142", "ÎàÖÝ": "304", "±±º£": "295", "·À³Ç¸Û": "204", "ÇÕÖÝ": "145", "¹ó¸Û": "341", "ÓñÁÖ": "361", "°ÙÉ«": "203", "ºØÖÝ": "260", "ºÓ³Ø": "143", "À´±ö": "202", "³ç×ó": "144", "º£¿Ú": "125", "ÈýÑÇ": "121", "Îåָɽ": "1644", "Çíº£": "2358", "ÙÙÖÝ": "1215", "ÎIJý": "2758", "ÍòÄþ": "1216", "¶«·½": "2634", "¶¨°²": "1214", "ÍͲý": "1641", "³ÎÂõ": "2757", "ÁÙ¸ß": "2033", "°×ɳÀè×å×ÔÖÎ": "2359", "²ý½­Àè×å×ÔÖÎ": "1642", "ÀÖ¶«Àè×å×ÔÖÎ": "2032", "ÁêË®Àè×å×ÔÖÎ": "1643", "±£Í¤Àè×åÃç×å×ÔÖÎ": "1217", "ÇíÖÐÀè×åÃç×å×ÔÖÎ": "2031", "ÖØÇì": "132", "³É¶¼": "75", "×Ô¹±": "78", "ÅÊÖ¦»¨": "81", "ãòÖÝ": "331", "µÂÑô": "74", "ÃàÑô": "240", "¹ãÔª": "329", "ËìÄþ": "330", "ÄÚ½­": "248", "ÀÖɽ": "79", "Äϳä": "291", "üɽ": "77", "Ò˱ö": "186", "¹ã°²": "241", "´ïÖÝ": "369", "ÑŰ²": "76", "°ÍÖÐ": "239", "×ÊÑô": "242", "°¢°Ó²Ø×åǼ×å×ÔÖÎÖÝ": "185", "¸Ê×βØ×å×ÔÖÎÖÝ": "73", "Á¹É½ÒÍ×å×ÔÖÎÖÝ": "80", "¹óÑô": "146", "ÁùÅÌË®": "147", "×ñÒå": "262", "°²Ë³": "263", "Í­ÈʵØÇø": "205", "Ç­Î÷Äϲ¼ÒÀ×åÃç×å×ÔÖÎÖÝ": "343", "±Ï½ÚµØÇø": "206", "Ç­¶«ÄÏÃç×å¶±×å×ÔÖÎÖÝ": "342", "Ç­Äϲ¼ÒÀ×åÃç×å×ÔÖÎÖÝ": "306", "À¥Ã÷": "104", "Çú¾¸": "249", "ÓñϪ": "106", "±£É½": "112", "ÕÑͨ": "336", "Àö½­": "114", "ÁÙ²×": "110", "³þÐÛÒÍ×å×ÔÖÎÖÝ": "105", "ºìºÓ¹þÄá×åÒÍ×å×ÔÖÎÖÝ": "107", "ÎÄɽ׳×åÃç×å×ÔÖÎÖÝ": "177", "ÆÕ¶ý": "108", "Î÷Ë«°æÄÉ´ö×å×ÔÖÎÖÝ": "109", "´óÀí°××å×ÔÖÎÖÝ": "111", "µÂºê´ö×å¾°ÆÄ×å×ÔÖÎÖÝ": "116", "Å­½­ÀüËÛ×å×ÔÖÎÖÝ": "113", "µÏÇì²Ø×å×ÔÖÎÖÝ": "115", "À­Èø": "100", "²ý¶¼µØÇø": "99", "ɽÄϵØÇø": "97", "ÈÕ¿¦ÔòµØÇø": "102", "ÄÇÇúµØÇø": "101", "°¢ÀïµØÇø": "103", "ÁÖÖ¥µØÇø": "98", "Î÷°²": "233", "Í­´¨": "232", "±¦¼¦": "171", "ÏÌÑô": "323", "μÄÏ": "170", "ÑÓ°²": "284", "ººÖÐ": "352", "ÓÜÁÖ": "231", "°²¿µ": "324", "ÉÌÂå": "285", "À¼ÖÝ": "36", "¼ÎÓø¹Ø": "33", "½ð²ý": "34", "°×Òø": "35", "ÌìË®": "196", "ÎäÍþ": "118", "ÕÅÒ´": "117", "ƽÁ¹": "359", "¾ÆÈª": "37", "ÇìÑô": "135", "¶¨Î÷": "136", "¤ÄÏ": "256", "ÁÙÏÄ»Ø×å×ÔÖÎÖÝ": "182", "¸ÊÄϲØ×å×ÔÖÎÖÝ": "247", "Î÷Äþ": "66", "º£¶«µØÇø": "69", "º£±±²Ø×å×ÔÖÎÖÝ": "67", "»ÆÄϲØ×å×ÔÖÎÖÝ": "70", "º£ÄϲØ×å×ÔÖÎÖÝ": "68", "¹ûÂ岨×å×ÔÖÎÖÝ": "72", "ÓñÊ÷²Ø×å×ÔÖÎÖÝ": "71", "º£Î÷ÃɹÅ×岨×å×ÔÖÎÖÝ": "65", "Òø´¨": "360", "ʯ×ìɽ": "335", "ÎâÖÒ": "322", "¹ÌÔ­": "246", "ÖÐÎÀ": "181", "ÎÚ³ľÆë": "92", "¿ËÀ­ÂêÒÀ": "95", "ͳ·¬µØÇø": "89", "¹þÃܵØÇø": "91", "²ý¼ª»Ø×å×ÔÖÎÖÝ": "93", "²©¶ûËþÀ­ÃɹÅ×ÔÖÎÖÝ": "88", "°ÍÒô¹ùÀãÃɹÅ×ÔÖÎÖÝ": "86", "°¢¿ËËÕµØÇø": "85", "¿Ë×ÎÀÕËտ¶û¿Ë×Î×ÔÖÎÖÝ": "84", "¿¦Ê²µØÇø": "83", "ºÍÌïµØÇø": "82", "ÒÁÀç": "90", "Ëþ³ÇµØÇø": "94", "°¢ÀÕÌ©µØÇø": "96", "ʯºÓ×Ó": "770", "°¢À­¶û": "731", "Í¼Ä¾Êæ¿Ë": "792", "Îå¼ÒÇþ": "789", "Ïã¸ÛÌØ±ðÐÐÕþÇø": "2912", "°ÄÃÅÌØ±ðÐÐÕþÇø": "2911"] + + + static main(args) { + def task = new GaoDeMapSearchTest(); + def path = "D:\\Êý¾Ý\\¹â´ó\\¹â´ó²âÊÔ-V2.xlsx" + +// task.structureV2(path) +// task.match(path) +// task.mapSearch(path) + task.baiduMapSearch(path) + task.checkTrue(path) + } + + def checkTrue(path){ + ExcelUtils.multiThreadingModify(path,{row-> + if(!row['Z']){ + if(row['Q']){ + row['Z'] = "T" + }else{ + if(row['Y']){ + def address = '' + def poi = row['G'] + if(row['E']){ + address = address + row['E'] + } + if(row['F']){ + address = address + row['F'] + } + if(address && isStandardRoad(address)){ + def mapAddr = row['U'] + if(mapAddr && mapAddr.contains(address)){ + row['Z'] = "T" + } + }else if(poi){ + def mapName = row['T'] + if(mapName && mapName==poi){ + row['Z'] = "T" + } + } + } + } + } + }) + } + + + def isStandardRoad(def s){ + def pattern = Pattern.compile("[·|½Ö|´óµÀ|Ïï]\\d+(ºÅ|Ū)"); + def matcher = pattern.matcher(s) + if(matcher.find()){ + return true; + } + return false + } + + + def mapSearch(filePath){ + ExcelUtils.multiThreadingModify(filePath,{row-> + if(!row['M'] && !row['R']){ + def city = row['C'] + def region = row['D'] + def address = '' + def poi = row['G'] + if(row['E']){ + address = address + row['E'] + } + if(row['F']){ + address = address + row['F'] + } + def rets = [] + if(address){ + def ret1 = OpenApiUtils.getGaoDeSearchLocation(city, region, address) + rets.addAll(ret1) + } + if(!rets && poi){ + def ret2 = OpenApiUtils.getGaoDeSearchLocation(city, region, poi) + rets.addAll(ret2) + } + +// if(!map && rets && rets.size()>0){ +// map = rets[0] +// } + + def bdRes = searchMapBySimilar(city, region, poi, address, rets); + if (bdRes) { + row['R'] = bdRes.uid + row['S'] = bdRes.region + row['T'] = bdRes.name + row['U'] = bdRes.address + row['V'] = bdRes.type + row['W'] = bdRes.score + if(bdRes.matchType){ + row['X'] = bdRes.matchType + } + row['Y'] = "¸ßµÂ" + } + } + },0) + } + + + + def findStandardObject(def city, def name, def rets) { + def map; + if (rets) { + if (rets.size() >= 1) { + //ÏàËÆÀïÕÒÓо«È·µØÖ· + for (def mapObj : rets) { + mapObj.address = com.fangjia.script.util.DataUtil.formateAddress(city, mapObj.address); + if (mapObj.address && findPattern(mapObj.address)) { + map = mapObj; + break; + } + } + if(!map){ + //½»´øÓн»²æ¿ÚµØÖ· + for (def mapObj : rets) { + if (mapObj.address && (mapObj.address.contains("½»»ã")||mapObj.address.contains("½»²æ"))) { + if(!mapObj.address.contains("Óë;") && !mapObj.address.startsWith("·") && !mapObj.address.startsWith("·;")){ + map = mapObj; + break; + } + } + } + } + } +// if (!map) { +// map = rets[0] +// } + } + return map; + } + + + def structureV2(path){ + ExcelUtils.multiThreadingModify(path, { row -> + if(row['A']){ + def jsonObj = FangjiaClientUtils.addressStructure(null, row['A']) + if(jsonObj && jsonObj.result){ + if(jsonObj.result.province){ + row['B'] = jsonObj.result.province + } + if(jsonObj.result.city){ + def cityStr = null + if(jsonObj.result.city=="ÊÐÏ½Çø"){ + cityStr = jsonObj.result.province + }else{ + cityStr = jsonObj.result.city + } + row['C'] = RegionData.formatCity(cityStr) + } + + if(jsonObj.result.district){ + row['D'] = jsonObj.result.district + } + + if(jsonObj.result.street){ + row['E'] = jsonObj.result.street + } + + if(jsonObj.result.streetNumber){ + row['F'] = jsonObj.result.streetNumber + } + + if(jsonObj.result.name){ + row['G'] = jsonObj.result.name + } + + if(jsonObj.result.buildingNumber){ + row['H'] = jsonObj.result.buildingNumber + } + + if(jsonObj.result.unitNumber){ + row['I'] = jsonObj.result.unitNumber + } + if(jsonObj.result.roomNumber){ + row['J'] = jsonObj.result.roomNumber + } + + if(jsonObj.result.formatAddress){ + row['K'] = jsonObj.result.formatAddress + } + + if(jsonObj.result.addrVerify){ + row['L'] = jsonObj.result.addrVerify + } + } + } + }) + } + + + + //¿ÉÒÔ¸ù¾Ý²âÊÔÊý¾ÝÌí¼Ó ÍÆ¼öÂ¥ÅÌÃû + def match(path){ + ExcelUtils.modify(path, { row -> + def city = row['C'] + if(city && !row['M']){ + def address = '' + def suggestName = row['G'] + if(row['E']){ + address = address + row['E'] + } + if(row['F']){ + address = address + row['F'] + } + def region = row['D'] + if(!row['M'] && address){ + city = RegionData.formatCity(city) + if(city){ + region = RegionData.formatRegion(city, region) + } + println "[match] city:"+city+" region:"+region+" address:"+address + def jsonObject = OpenApiClient.addressMatch(city, address, null, true, region, suggestName)//"property" + Thread.sleep(2000) + if(jsonObject != null && jsonObject.precise!=-1) { + row['M'] = jsonObject.get("city") + row['N'] = jsonObject.get("district") + row['O'] = jsonObject.get("name") + row['P'] = jsonObject.get("propertyType") + row['Q'] = jsonObject.get("id") + } + } + } + }) + } + + def baiduMapSearch(path){ + ExcelUtils.multiThreadingModify(path, { row -> + if(row['C'] && !row['M'] && !row['R']){ + def city = row['C'] + def region = row['D'] + def address = '' + def poi = row['G'] + if(row['E']){ + address = address + row['E'] + } + if(row['F']){ + address = address + row['F'] + } + def baiduCode = getBaiduMapCode(city); + if(baiduCode){ + def rets = null + if(address && row['G']){ + rets = getBiduSearchDatas(baiduCode , address, row['G'], null) + }else if(row['G']){ + rets = getBiduSearchDatas(baiduCode , null, row['G'], rets) + }else if(address){ + rets = getBiduSearchDatas(baiduCode , null, address, rets) + } + + def bdRes = searchMapBySimilar(city, region, poi, address, rets); + if (bdRes) { + row['R'] = bdRes.uid + row['S'] = bdRes.region + row['T'] = bdRes.name + row['U'] = bdRes.address + row['V'] = bdRes.type + row['W'] = bdRes.score + if(bdRes.matchType){ + row['X'] = bdRes.matchType + } + row['Y'] = "°Ù¶È" + } + println row['B'] +" "+ bdRes + } + } + }); + } + + + def getSimpleAddress(city, address){ + def jsonObj = FangjiaClientUtils.addressStructure(city, address) + def old_addr = "" + def map = [:] + if(jsonObj && jsonObj.result){ + + if(jsonObj.result.province){ + map.pro = jsonObj.result.province + } + + if(jsonObj.result.city){ + if(jsonObj.result.city=="ÊÐÏ½Çø"){ + map.city = jsonObj.result.province + }else{ + map.city = jsonObj.result.city + } + map.city = RegionData.formatCity(map.city) + } + + if(jsonObj.result.district){ + map.region = jsonObj.result.district + } + if(jsonObj.result.street){ + def street = jsonObj.result.street + if(street){ + old_addr = street + map.street = street.replace("½»²æ¿Ú","").replace("½»²æ","") + } + } + if(jsonObj.result.streetNumber){ + def street_number = jsonObj.result.streetNumber + if(street_number){ + old_addr = old_addr + street_number + } + } + } + map.addr = old_addr.replace("½»²æ¿Ú","").replace("½»²æ","") + return map; + } + + def getBaiduMapCode(city){ + if(city){ + return baiduCityCodeMap[city] + } + return city + } + + def getBiduSearchDatas(baiduCode , simpleAddr, nameKey, rets){ + def searchKey = "" + if(simpleAddr){ + searchKey = simpleAddr +" "+nameKey + }else{ + searchKey = nameKey + } + def datas = searchBaiDuMap(searchKey, baiduCode.toInteger()); + if(!rets){ + return datas; + }else{ + def ids = [] + for(def r : rets){ + if(!ids.contains(r.uid)){ + ids << r.uid + } + } + for(def d : datas){ + if(!ids.contains(d.uid)){ + rets << d + } + } + return rets; + } + return null; + } + + + static def searchBaiDuMap(String address, int cityCode) { + def rets = [] + try { + Thread.sleep(500) + // String url = "https://map.baidu.com/?newmap=1&reqflag=pcmap&biz=1&from=webmap&da_par=baidu&pcevaname=pc4.1&qt=s&da_src=searchBox.button&wd="+URLEncoder.encode(address,"UTF-8")+"&c=${cityCode}&src=0&wd2=&pn=0&sug=0&l=11&from=webmap&sug_forward=&device_ratio=1&tn=B_NORMAL_MAP&nn=0&u_loc=13509900,3640104&ie=utf-8&t=${System.currentTimeMillis()}&&auth=Dae1RaNR1LK8xdJTxN8SQOTRa2AH%3DL7vuxLNVENTxRBt6BG6B6WJWwGvzBU%40yYxvkGcuVtvvhguVtvyheuVtcvY1SGpuLtB2QKAZzvCQMuVtvIPcuxtw8wkv7uvZgMuVtv%40vcuVtvc3CuVtvcPPuztxgHxwBVDzvFosSE21wiKDv7uvhgMuzVVtvrMhuENLtSrrlrIKHf0wd0vyMO7FOUySy&seckey=Im7p%2FanwNmQx078ijew%2FsyQrDC7YJnynqrZ43JVFlM0%3D%2C0-Ulo82T3hd3wuKMf_tTM-ZXYa3S1Y21RX3DV_l5MHgI_1U55ZQrzxTIKi3BRb2x59mVOurDjnW_8CwMEmjK3y8JfHyV0kv70GMQXxnIEcHpM3Dqhs5EdrN6ciDtoxyrcRfowp_xTBkEgU49ZrCz2KeLyujCOypqjKS3rAmPOfEp1kIZPD4W6RDQzrsWTe7a"; + String url = "https://map.baidu.com/?newmap=1&reqflag=pcmap&biz=1&from=webmap&da_par=after_baidu&pcevaname=pc4.1&qt=s&da_src=searchBox.button&wd="+URLEncoder.encode(address,"UTF-8")+"&c=${cityCode}&src=0&wd2=&pn=0&sug=0&l=19&from=webmap&sug_forward=&auth=E8LCawOwRbEOx6JVTvCIBI6W7zSz5vSXuxLNVENTRVLtUDHUDUYKYyHxzBU%40yYxvkGcuVtvvhguVtvyheuVtvCMGuVtvCQMuVtvIPcuxtw8wkv7uvZgMuVtv%40vcuVtvc3CuVtvcPPuztxgHxwDWBWvveh3uxtwiKDv7uvhgMuzVVtcvY1SGpuxRtKHZz3VP8JSrrlrIKHf0wd0vyMO7FOUS7F&seckey=Im7p%2FanwNmQx078ijew%2FsyQrDC7YJnynqrZ43JVFlM0%3D%2C0-Ulo82T3hd3wuKMf_tTM-ZXYa3S1Y21RX3DV_l5MHgI_1U55ZQrzxTIKi3BRb2x59mVOurDjnW_8CwMEmjK3y8JfHyV0kv70GMQXxnIEcHpM3Dqhs5EdrN6ciDtoxyrcRfowp_xTBkEgU49ZrCz2KeLyujCOypqjKS3rAmPOfEp1kIZPD4W6RDQzrsWTe7a&device_ratio=2&tn=B_NORMAL_MAP&nn=0&u_loc=13513133,3631861&ie=utf-8&t=${System.currentTimeMillis()}&newfrom=zhuzhan_webmap" + def content = new HttpRequest().get(url, null, "utf-8") + JSONObject json = JSONObject.fromObject(content) + if (json && json.content && json.content.size() > 0) { + for (def loc : json.content) { +// String name = formatName(address) + def x = loc.x + def y = loc.y + if(x){ + x = x/100 + } + if(y){ + y = y/100 + } + if(x && y){ + def locJson = BaiDuApiUtils.geoconv(x, y, 6) + if(locJson){ + def baiduCity = RegionData.parseCityInAddress(loc.area_name) + def bean = [:] +// def lng2 = locJson.get("x") +// def lat2 = locJson.get("y") +// def gmap = GeocodeUtils.geoconvBaiduToGoogle(lng2, lat2) +// def lng = gmap.get("lng") +// def lat = gmap.get("lat") + bean.uid = loc.uid +// bean.baidu_lng2 = lng2 +// bean.baidu_lat2 = lat2 +// bean.longitude = lng +// bean.latitude = lat + bean.name = loc.name +// if(loc.address_norm){ +// bean.address = getAddressInfo(loc.address_norm, loc.addr); +// } + bean.address = loc.addr + + if(!baiduCity){ + baiduCity = RegionData.formatCity(loc.city_name) + } + bean.cityname = baiduCity + if(loc.city_name){ + def regionStr = loc.area_name.replace(loc.city_name, "") + def baiduRegion = RegionData.formatRegion(baiduCity, regionStr); + bean.region = baiduRegion + } + + if(loc.std_tag){ + bean.type = loc.std_tag + } + bean.flag = loc.acc_flag + rets << bean; + } + } + } + } + } catch(Exception e) { + searchBaiDuMap(address, cityCode) + } + return rets; + } + + + def searchMapBySimilar(def city, def region, def newKey, def inpAddr, def rets){ + def bo = null; + if(rets){ + def maxScore = 0; + if(!bo || !maxScore){ + for(def o :rets){ + def addr = o.address + def mapKey = o.name + if(mapKey){ + def score = 0 + def nameScore = 0 + if(newKey){ + nameScore = CosineSimilarAlgorithm.getSimilarityRatio(mapKey, newKey); + } + + def addr_score = 0 + if(inpAddr) { + def baidu_addr_map = getSimpleAddress(o.cityname, o.address) + if(!baidu_addr_map.addr){ + baidu_addr_map.addr = AddressUtil.formatAddress(o.cityname, o.address) + } +// def baidu_addr_map = AddressUtil.formatAddress(o.cityname, o.address) + if(!baidu_addr_map.addr){ + if(o.region && !region.contains(o.region)){ + continue; + } + if(city!=o.cityname){ + continue; + } + } + if (baidu_addr_map.addr) { + if(baidu_addr_map.addr.contains("Óë")){ + def arrs = baidu_addr_map.addr.split("Óë") + for(def s1 : arrs){ + def temp_addr_score = CosineSimilarAlgorithm.getSimilarityRatio(inpAddr, s1); + if(temp_addr_score > addr_score && (inpAddr.contains(baidu_addr_map.addr) || baidu_addr_map.addr.contains(inpAddr))){ + addr_score = temp_addr_score + } + } + }else{ + addr_score = CosineSimilarAlgorithm.getSimilarityRatio(inpAddr, baidu_addr_map.addr); + if(addr_score>0 && inpAddr && baidu_addr_map.street && !inpAddr.contains(baidu_addr_map.street) && !baidu_addr_map.street.contains(inpAddr)){ + addr_score = 0 + } + } + + } + } + + if(addr_score>0 && score==0){ + addr_score = addr_score/2 + } + def total_score = nameScore + addr_score +// if(city==o.cityname){ + if(total_score > maxScore){ + maxScore = total_score; + o.city = o.cityname + bo = o + bo.score = maxScore + + def list = [] + if(addr_score>0){ + list << "µØÖ·ÓйØ" + } + if(nameScore>0){ + list << "Ãû³ÆÏàËÆ" + } + if(list){ + o.matchType = list.join(",") + } + } +// if(bo && score!=1){ +// if(inpAddr){ +// def baidu_addr = getSimpleAddress(o.cityname, o.old_addr) +// if(baidu_addr){ +// def addr_score = CosineSimilarAlgorithm.getSimilarityRatio(inpAddr, baidu_addr); +// //if(addr_score==1){ +// // o.matchType = "³ÇÊÐÏàͬ£¬Ãû³ÆÏàËÆ£¬µØÖ·ÓйØ" +// bo.score = bo.score + addr_score +// maxScore = bo.score; +// //} +// } +// } + +// for(def word : filters){ +// if(mapKeyName.toString().endsWith(word)){ +// mapKeyName = mapKeyName.replace(word, "") +// } +// if(newName.toString().endsWith(word)){ +// newName = newName.replace(word, ""); +// } +// } +// +// +// if(mapKeyName && newName && mapKeyName.length()>=2){ +// score = CosineSimilarAlgorithm.getSimilarityRatio(mapKeyName, newName); +// if(score > maxScore){ +// maxScore = score +// o.matchType = "Ãû³ÆÏàËÆ" +// o.city = obj.city +// bo = o +// bo.score = maxScore +// }else{ +// if(mapKeyName.length() == newName.length()){ +// def mapKeyNameBY = com.fangjia.core.util.DataUtil.hanyuQuanpin(mapKeyName, " ") +// def newNameBY = com.fangjia.core.util.DataUtil.hanyuQuanpin(newName, " ") +// if(mapKeyNameBY == newNameBY){ +// maxScore = 0.977; +// o.matchType = "Æ´ÒôÏàËÆ" +// o.city = obj.city +// bo = o +// bo.score = maxScore +// } +// } +// } +// } +// } +// } + } + } + } + } + return bo; + } +} diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy index f641c214c..2aae0edb5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/BeiKeCrawlByChrome.groovy @@ -32,7 +32,7 @@ public class BeiKeCrawlByChrome { def DBCollection thirdPartyColl = CrawalDBUtil.getThirdPartyCol(); def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) - def startMonth = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyy-MM"), -2, "yyyy-MM") + def startMonth = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyy-MM"), -1, "yyyy-MM") static main(args) { def task = new BeiKeCrawlByChrome(); @@ -44,7 +44,7 @@ public class BeiKeCrawlByChrome { def run(){ - System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe"); + System.setProperty("webdriver.chrome.driver", "D:\\Program Files\\chrome-driver\\chromedriver.exe"); System.setProperty("http.nonProxyHosts", "localhost"); WebDriver driver = new ChromeDriver() @@ -112,18 +112,20 @@ public class BeiKeCrawlByChrome { def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) for(def m : citys){ - driver.get(m.url+"/chengjiao/") + def city = m[0] + def url = m[1] + driver.get(url+"/chengjiao/") Thread.sleep(10000) def doc = Jsoup.parse(driver.getPageSource()); def regions = JQueryUtils.select(".position dl:contains(λÖÃ)+dl a", doc) if(regions){ for(def r : regions){ def regionText = r.text() - def href = m.url+ r.attr("href") + def href = url+ r.attr("href") - println "¿ªÊ¼×¥È¡¡¾${m.city}¡¿¡¾${regionText}¡¿¡¾${href}¡¿" - def detailUrls = getPageDeail(driver, m.city, href, regionText) - println m.url +" ÏêÇéÁ´½Ó£º"+detailUrls.size() + println "¿ªÊ¼×¥È¡¡¾${city}¡¿¡¾${regionText}¡¿¡¾${href}¡¿" + def detailUrls = getPageDeail(driver, city, href, regionText) + println url +" ÏêÇéÁ´½Ó£º"+detailUrls.size() } } @@ -183,7 +185,7 @@ public class BeiKeCrawlByChrome { def durl = e.select(".title a").attr("href") def dealDate = e.select(".dealDate").text() dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd") - def endDate = DateUtils.parseFromTightByPattern(startMonth + "-20", "yyyy-MM-dd") + def endDate = DateUtils.parseFromTightByPattern(startMonth + "-01", "yyyy-MM-dd") if(dealDate && dealDate.getTime()>=endDate.getTime()){ detailUrls << durl parse(city, e, region) @@ -398,16 +400,13 @@ public class BeiKeCrawlByChrome { def cityDoc = Jsoup.parse(driver.getPageSource()); def cityEles = JQueryUtils.select(".city_list_ul .city_province a", cityDoc) def list = [] + def citys = ["ÏÌÑô","¾Å½­","À¥É½","Ö£ÖÝ","ÀÈ·»","ÕÄÖÝ","³¤´º"] if(cityEles){ for(def e : cityEles){ - def href = e.attr("href") -// if(e.text().contains("¸£ÖÝ")){ - def cityMap = [:] - cityMap.city = e.text() - cityMap.url = "https:"+href - list << cityMap -// cityMap.put(e.text(), "https:"+href) -// } + def href = "https:"+e.attr("href") + if (citys.contains(e.text())){ + list << [e.text(), href] + } } } return list @@ -432,6 +431,7 @@ public class BeiKeCrawlByChrome { elemPassword.sendKeys("12qwaszx"); btn.submit(); // µã»÷ÐÐΪ£» + Thread.sleep(10000) } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy index 3c869e61b..343a4a3a4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/paimai/LianjiaCrawlByChrome.groovy @@ -31,7 +31,7 @@ public class LianjiaCrawlByChrome { def DBCollection thirdPartyColl = CrawalDBUtil.getThirdPartyCol(); def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) - def startMonth = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyy-MM"), -2, "yyyy-MM") + def startMonth = DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyy-MM"), -1, "yyyy-MM") static main(args) { def task = new LianjiaCrawlByChrome(); @@ -117,10 +117,11 @@ public class LianjiaCrawlByChrome { } def run(){ - System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe"); + System.setProperty("webdriver.chrome.driver", "D:\\Program Files\\chrome-driver\\chromedriver.exe"); System.setProperty("http.nonProxyHosts", "localhost"); WebDriver driver = new ChromeDriver() def cityMap = getAllCityUrls(driver) +// cityMap = cityMap.reverse() getLogin(driver) crawlData(driver, cityMap) @@ -184,12 +185,15 @@ public class LianjiaCrawlByChrome { } } - def crawlData(driver, cityMap){ + def crawlData(driver, cityList){ def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017"; DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl) - cityMap.each{city, cityUrl-> + for(def ret : cityList){ + def city = ret[0] + def cityUrl = ret[1] //def detailUrls = getPageUrls(driver, cityUrl) driver.get(cityUrl+"chengjiao/") + Thread.sleep(10000) def doc = Jsoup.parse(driver.getPageSource()); def regions = JQueryUtils.select(".position dl:contains(λÖÃ)+dl a", doc) if(regions){ @@ -251,7 +255,7 @@ public class LianjiaCrawlByChrome { def durl = e.select(".title a").attr("href") def dealDate = e.select(".dealDate").text() dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd") - def endDate = DateUtils.parseFromTightByPattern(startMonth + "-20", "yyyy-MM-dd") + def endDate = DateUtils.parseFromTightByPattern(startMonth + "-01", "yyyy-MM-dd") if(dealDate.getTime()>=endDate.getTime()){ detailUrls << durl parse(city, e, regionText) @@ -473,17 +477,17 @@ public class LianjiaCrawlByChrome { Thread.sleep(8000) def cityDoc = Jsoup.parse(driver.getPageSource()); def cityEles = JQueryUtils.select(".city_province a", cityDoc) - def cityMap = [:] - def citys= ["ËÕÖÝ"] + def cityList = [] + def citys= ["À¥É½","¾Å½­","Ö£ÖÝ","ÀÈ·»","ÕÄÖÝ","ÏÌÑô","³¤´º","ÖØÇì"] if(cityEles){ for(def e : cityEles) { def href = e.attr("href") if (!href.contains("fang.lianjia") && citys.contains(e.text())){ - cityMap.put(e.text(), href) + cityList << [e.text(), href] } } } - return cityMap + return cityList } def getLogin(driver){ @@ -505,6 +509,7 @@ public class LianjiaCrawlByChrome { elemPassword.sendKeys("12qwaszx"); btn.submit(); // µã»÷ÐÐΪ£» + Thread.sleep(20000) } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy index b994fde09..f419acf6d 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/poc/AddPriceTest.groovy @@ -21,10 +21,10 @@ class AddPriceTest { task.run(); } def run(){ - def filePath = "D:\\Êý¾Ý\\ÕÐÉÌ\\ÕÐÉÌ.xlsx" -// addGXDPrice(filePath) + def filePath = "C:\\Users\\gaojuan\\Desktop\\ÉîÛÚÕþ¸®Ö¸µ¼¼Û.xlsx" + addGXDPrice(filePath) // addCcbPrice(filePath) - addThirdPrice(filePath) +// addThirdPrice(filePath) } @@ -104,12 +104,13 @@ class AddPriceTest { def addGXDPrice(filepath){ ExcelUtils.multiThreadingModify(filepath, { d -> - if (d['M']) { - def dist = CommonDatautils.findDistrictById(d['M']) - if(dist){ - def gxdPrice = findGXDPrice(dist.city, dist.region, dist.name) - d['AO'] = gxdPrice - } + if (d['B']) { +// def dist = CommonDatautils.findDistrictById(d['B']) +// if(dist){ +// def gxdPrice = findGXDPrice(dist.city, dist.region, dist.name) + def gxdPrice = findGXDPrice(d['D'], d['E'], d['C']) + d['G'] = gxdPrice +// } } }) } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ChongQingBlankTest.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ChongQingBlankTest.groovy index 1bdbfcdc7..07ab82cce 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ChongQingBlankTest.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/test/ChongQingBlankTest.groovy @@ -23,11 +23,16 @@ class ChongQingBlankTest { static main(args) { def task = new ChongQingBlankTest() task.run() + } def run(){ - ExcelUtils.modify("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\ÖØÇìÅ©ÉÌÐвâÊÔÑù±¾£¨·¿¼ÛÍøv.1.2£©.xlsx",{row-> + allRegionMap.each{k,v-> + println k+" "+v.size() + } + + /* ExcelUtils.modify("D:\\Êý¾Ý\\ÖØÇìÅ©ÉÌÐÐ\\ÖØÇìÅ©ÉÌÐвâÊÔÑù±¾£¨·¿¼ÛÍøv.1.2£©.xlsx",{row-> if(row['B'].toString()=="ÖØÇìÊоÅÁúÆÂÇø½¨¹¤Èý´å7ºÅ"){ def city = CommonUtils.parseCityInAddress(row["B"]) if(!city){ @@ -197,7 +202,7 @@ class ChongQingBlankTest { } } } - }, 0) + }, 0)*/ } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy index a254cbdd7..175b2ebd1 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/SynchDistrictPrice.groovy @@ -27,8 +27,7 @@ class SynchDistrictPrice extends BaseBatch{ // "¼ªÎÝ":"¼ªÎÝ","365ÌÔ·¿":"365ÌÔ·¿","ÎÒ°®ÎÒ¼Ò":"ÎÒ°®ÎÒ¼Ò","Öî¸ðÕÒ·¿APP":"Öî¸ðÕÒ·¿","±´¿Ç":"±´¿ÇÕÒ·¿","Á´¼Ò":"Á´¼Ò","Q·¿":"Q·¿","ÂóÌï":"ÂóÌï", // "ÖÐÔ­µØ²ú":"ÖÐÔ­µØ²ú","°²¾Ó¿ÍС³ÌÐò":"°²¾Ó¿Í","ËÑ·¿":"ËÑ·¿","ÀÖÓмÒ":"ÀÖÓмÒ","C21":"C21","³ÇÊз¿²ú":"³ÇÊз¿²ú","Íò©Ê¿PC¶Ë":"Íò©Ê¿" // def esSources = ["ÎÒ°®ÎÒ¼Ò":"ÎÒ°®ÎÒ¼Ò","Íò©Ê¿PC¶Ë":"Íò©Ê¿","¼ªÎÝ":"¼ªÎÝ","±´¿ÇÕÒ·¿":"±´¿ÇÕÒ·¿","ÀÖÓмÒ":"ÀÖÓмÒ","365ÌÔ·¿":"365ÌÔ·¿","Öî¸ðÕÒ·¿APP":"Öî¸ðÕÒ·¿","Á´¼Ò":"Á´¼Ò","Q·¿":"Q·¿","ÂóÌï":"ÂóÌï","ÖÐÔ­µØ²ú":"ÖÐÔ­µØ²ú","°²¾Ó¿ÍС³ÌÐò":"°²¾Ó¿Í","ËÑ·¿":"ËÑ·¿","C21":"C21","³ÇÊз¿²ú":"³ÇÊз¿²ú"] - def esSources = ["ÎÒ°®ÎÒ¼Ò":"ÎÒ°®ÎÒ¼Ò","Íò©Ê¿PC¶Ë":"Íò©Ê¿","¼ªÎÝ":"¼ªÎÝ","±´¿ÇÕÒ·¿":"±´¿ÇÕÒ·¿","ÀÖÓмÒ":"ÀÖÓмÒ","365ÌÔ·¿":"365ÌÔ·¿","Öî¸ðÕÒ·¿APP":"Öî¸ðÕÒ·¿","Á´¼Ò":"Á´¼Ò","Q·¿":"Q·¿","ÂóÌï":"ÂóÌï","ÖÐÔ­µØ²ú":"ÖÐÔ­µØ²ú","°²¾Ó¿ÍС³ÌÐò":"°²¾Ó¿Í","ËÑ·¿":"ËÑ·¿","C21":"C21","³ÇÊз¿²ú":"³ÇÊз¿²ú"] - + def esSources = ["ÎÒ°®ÎÒ¼Ò":"ÎÒ°®ÎÒ¼Ò","Íò©Ê¿PC¶Ë":"Íò©Ê¿","¼ªÎÝ":"¼ªÎÝ","±´¿ÇÕÒ·¿":"±´¿ÇÕÒ·¿","ÀÖÓмÒ":"ÀÖÓмÒ","365ÌÔ·¿":"365ÌÔ·¿","Öî¸ðÕÒ·¿APP":"Öî¸ðÕÒ·¿","Á´¼Ò":"Á´¼Ò","Q·¿":"Q·¿","ÂóÌï":"ÂóÌï","ÖÐÔ­µØ²ú":"ÖÐÔ­µØ²ú","°²¾Ó¿ÍС³ÌÐò":"°²¾Ó¿Í","ËÑ·¿":"ËÑ·¿","C21":"C21","³ÇÊз¿²úС³ÌÐò":"³ÇÊз¿²ú"] static main(args) { runBatch(new SynchDistrictPrice(), args); diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy index 5f9a10997..bdd887539 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/thirdPriceCrawl/TestCrawlTotalCount.groovy @@ -14,8 +14,8 @@ class TestCrawlTotalCount { def run(){ def sources = ["·¿¹À¹À","Öî¸ðÕÒ·¿","°²¾Ó¿Í","ËÑ·¿","ÖÐÔ­µØ²ú","¸Ï¼¯","Á´¼Ò","Íò©Ê¿","³ÇÊз¿²ú","±´¿ÇÕÒ·¿","Q·¿","Q·¿(ÐÂ)","ÖÐÔ­µØ²ú(ÐÂ)","ÀÖÓмÒ","ÀÖÓмÒ(ÐÂ)","·¿Ì½","·¿¶à¶à","С×ʼÒ","ÎÒ°®ÎÒ¼Ò","ÂóÌï","·¿Í¾","C21","ÀÖ¾Ó","·¿²ú³¬ÊÐ","58ͬ³Ç","365ÌÔ·¿","¼ªÎÝ"] for(def source :sources){ - def count1 = findTotalCount(source, 202301); - def count2 = findTotalCount(source, 202302); + def count1 = findTotalCount(source, 202302); + def count2 = findTotalCount(source, 202303); println source +" "+count1 +" "+count2 } } diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java index b45bffb81..5c48fa0b4 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictService.java @@ -563,6 +563,8 @@ public interface DistrictService extends ModeService { */ Integer getBuildYear(District district); + Integer getCreateYear(District district); + /** * in²éÑ¯Ð¡ÇøÐÅÏ¢ * diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java index db0bfca4b..4f9dc8686 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/datastore/DistrictServiceImpl.java @@ -2667,6 +2667,15 @@ public class DistrictServiceImpl implements DistrictService { } } + public Integer getCreateYear(District district) { + Integer buildYear = getYearFormDate(district.getCreateYear()); + int minYear = Integer.MAX_VALUE; + if (buildYear != null && buildYear < minYear) { + minYear = buildYear; + } + return minYear; + } + public Integer getBuildYear(District district) { Integer finishYear = getYearFormDate(district.getFinishBuildingDate());