Merge branch 'script_gj' into 'master'

建行临时导出一个文件

See merge request !713
This commit is contained in:
2023-08-28 11:03:42 +08:00
5 changed files with 149 additions and 21 deletions
@@ -34,20 +34,19 @@ class ExportPgsqlEvaluationResult {
def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM")); def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM"));
//计算结果相关 //计算结果相关
exportAvmEvaluationGJNB(curMonth) // exportAvmEvaluationGJNB(curMonth)
exportAVMEvaluationItemGJNB(curMonth) // exportAVMEvaluationItemGJNB(curMonth)
//
exportCityPrice(curMonth) // exportCityPrice(curMonth)
exportRegionPrice(curMonth) // exportRegionPrice(curMonth)
//
exportCommunityBasePrice(curMonth) // exportCommunityBasePrice(curMonth)
// exportCommunityBasePrice1(curMonth)
exportCommunityPdescribeGj(curMonth) exportCommunityPdescribeGj(curMonth)
exportCommCaseDetailGj(curMonth) // exportCommCaseDetailGj(curMonth)
//
exportInOk() exportInOk()
//
SSHHelperTest jschCommand = new SSHHelperTest(); SSHHelperTest jschCommand = new SSHHelperTest();
System.out.println(jschCommand.executeCommand("sh /home/ccb_evaluation/output/eval_package.sh ${curDate}")); System.out.println(jschCommand.executeCommand("sh /home/ccb_evaluation/output/eval_package.sh ${curDate}"));
@@ -38,10 +38,10 @@ class AmapAddressUpdate {
static main(args) { static main(args) {
def task = new AmapAddressUpdate() def task = new AmapAddressUpdate()
def path = "d:\\数据\\小区\\福州小区地址与高德地图V2.xlsx" def path = "d:\\数据\\小区\\福建省小区地址与高德地图V2.xlsx"
def addr = task.formatAddress("福州", "北三环路201号") // def addr = task.formatAddress("福州", "北三环路201号")
println addr // println addr
// task.run(path) task.run(path)
// task.similarMatch(path) // task.similarMatch(path)
// task.addressRun(path) // task.addressRun(path)
// task.addressSource(path) // task.addressSource(path)
@@ -52,7 +52,7 @@ class AmapAddressUpdate {
// task.updateLocation(path)//更新经纬度 // task.updateLocation(path)//更新经纬度
} }
def run(path){ def run(path){
def citys = ["福州"]//CommonDatautils.findAllCity() def citys = ["三明","宁德","泉州","厦门","福州","漳州","南平","龙岩","莆田"]//CommonDatautils.findAllCity()
def allrets = [] def allrets = []
allrets << ["城市","区域","名称","地址","地址别名","高德区域","高德名称","高德地址","高德地址格式化","高德经度","高德纬度"] allrets << ["城市","区域","名称","地址","地址别名","高德区域","高德名称","高德地址","高德地址格式化","高德经度","高德纬度"]
for (def city : citys) { for (def city : citys) {
@@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong
@BatchOwner(Watcher.GaoJuan) @BatchOwner(Watcher.GaoJuan)
class GaoDePoiDataProcess extends BaseBatch{ class GaoDePoiDataProcess extends BaseBatch{
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20) public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1)
public static def version = new Date().getTime() public static def version = new Date().getTime()
@@ -62,7 +62,8 @@ class GaoDePoiDataProcess extends BaseBatch{
def synchCompany(){ def synchCompany(){
def citys = ["三明市","宁德市","泉州市","厦门市","福州市","漳州市","南平市","龙岩市","莆田市","重庆市"] //"三明市","宁德市","泉州市","厦门市","福州市","漳州市","南平市","龙岩市","莆田市",
def citys = ["重庆市"]
for(def c : citys){ for(def c : citys){
def townMap = findTownRange(c) def townMap = findTownRange(c)
def companyDatas = findCompanyDatas(c) def companyDatas = findCompanyDatas(c)
@@ -0,0 +1,124 @@
package com.fangjia.script.gj.xiamen
import com.fangjia.core.util.GeoUtils
import com.fangjia.datastore.driver.DSCursor
import com.fangjia.script.BaseBatch
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import com.mongodb.DBObject
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
class NetworkDistanceBatch extends BaseBatch{
def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
DBCollection SEAWEED_CONN = MongoUtils.getCollectionByName2("fangjia", "seaweed", MONGO100_URL)
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20)
final DBCollection NETWORK_COLL = MongoUtils.getCollectionByName("business", "xm_network", "192.168.0.43")
static main(args) {
runBatch(new NetworkDistanceBatch(), args)
}
@Override
void process(Object args) {
def networks = ExcelUtils.read("D:\\数据\\厦门\\网点.xlsx", 0, 1)
def citys = ["厦门","三明","宁德","泉州","福州","漳州","南平","龙岩","莆田","重庆"]
for(def c : citys){
run(c, "district", networks)
}
}
def run(city, cat, networks){
def datas = findDistrictData(city, cat, ["city","region", "name", "category", "location"])
def rets = new CopyOnWriteArrayList()
def totalCount = new AtomicLong()
final CountDownLatch latch = new CountDownLatch(datas.size())
for(def i=0;i<datas.size();i++){
final def dist = datas[i]
fixedThreadPool.execute(new Runnable() {
void run() {
try{
totalCount.addAndGet(1)
def map = createData(dist, networks)
if(map){
rets << map
}
// println city +" "+cat +" "+totalCount.get() +"/"+datas.size()+" "+dist.name+" "+dist._id
} catch (Exception e) {
e.printStackTrace()
println dist.city +" "+dist.name
} finally {
latch.countDown()
}
}
});
}
latch.await()
saveDatas(rets);
println cat +" "+city +" 总量:"+datas.size()+" 在5公里内总量:"+rets.size()
}
def saveDatas(def rets){
NETWORK_COLL.insert(rets)
}
def createData(dist, networks){
def lastRest = null
def minDistance = Integer.MAX_VALUE
for(def row : networks){
def locationstr = row['D']
if(locationstr){
def arrs = locationstr.split(",")
def distance = GeoUtils.calculateDistance(dist.location.lon, dist.location.lat, arrs[0].toString().toDouble(), arrs[1].toString().toDouble())
if(distance <= minDistance){
minDistance = distance
lastRest = row
}
}
}
if(minDistance<=5000){
def obj = new BasicDBObject()
obj.put("_id", dist._id);
obj.put("city", dist.city);
obj.put("region", dist.region);
obj.put("name", dist.name);
obj.put("distance", (int)minDistance);
obj.put("network", lastRest['B'])
return obj
}
return null;
}
def findDistrictData(def city, cat, fields){
DBObject q = new BasicDBObject();
q.put("status", 0);
q.put("category", cat);
q.put("city", city);
DBObject keys = new BasicDBObject();
if(fields){
for(def field : fields){
keys.put(field, 1);
}
}
return SEAWEED_CONN.find(q, keys).toList();
}
}
@@ -45,7 +45,7 @@ class SeaweedDataSynch {
} }
def updating(city, cat){ def updating(city, cat){
def dists = CommonDatautils.findAllDistricts(city, cat, ["city","region","name","address","block","alias","addr_alias","cat","estate_type2","status","township","lng","lat","build_type","household_count","committee","estate_charge","car_site_count","property_life","house_property","build_area","all_area","build_structure","developer","estate_company","cubage_percent","virescence_percent","loudong_count","schools","main_type","main_type_area"]) def dists = CommonDatautils.findAllDistricts(city, cat, ["city","region","name","address","block","alias","addr_alias","cat","estate_type2","status","township","lng","lat","build_type","household_count","committee","estate_charge","car_site_count","property_life","house_property","build_area","all_area","build_structure","developer","estate_company","cubage_percent","virescence_percent","loudong_count","schools","main_type","main_type_area","create_year"])
def rets = new CopyOnWriteArrayList() def rets = new CopyOnWriteArrayList()
def totalCount = new AtomicLong() def totalCount = new AtomicLong()
final CountDownLatch latch = new CountDownLatch(dists.size()) final CountDownLatch latch = new CountDownLatch(dists.size())
@@ -103,6 +103,7 @@ class SeaweedDataSynch {
map.estate_type = dist.estate_type2 map.estate_type = dist.estate_type2
map.status = dist.status map.status = dist.status
map.township = dist.township map.township = dist.township
map.finish_build_time = dist.create_year?dist.create_year.toString():null
if(dist.lng){ if(dist.lng){
def loc = [:] def loc = [:]
loc.lon = DataHandleUtils.getDoubleRound(8, dist.lng/10000000000.0) loc.lon = DataHandleUtils.getDoubleRound(8, dist.lng/10000000000.0)
@@ -132,7 +133,10 @@ class SeaweedDataSynch {
map.households = dist.household_count map.households = dist.household_count
map.committee = dist.committee map.committee = dist.committee
if(dist.estate_charge && dist.estate_charge.toString().isNumber()){ if(dist.estate_charge && dist.estate_charge.toString().isNumber()){
map.property_fee = dist.estate_charge.toString().toFloat() def fee = dist.estate_charge.toString().toFloat()
if(fee < 100){
map.property_fee = DataHandleUtils.getDoubleRound(2, fee)
}
} }
if(dist.car_site_count && dist.car_site_count.toString().isNumber()){ if(dist.car_site_count && dist.car_site_count.toString().isNumber()){
@@ -164,7 +168,7 @@ class SeaweedDataSynch {
map.schools = dist.schools map.schools = dist.schools
map.main_house_type = dist.main_type map.main_house_type = dist.main_type
if(dist.main_type_area && dist.main_type_area.toString().isNumber()){ if(dist.main_type_area && dist.main_type_area.toString().isNumber()){
map.main_house_area = dist.main_type_area.toString().toFloat() map.main_house_area = DataHandleUtils.getDoubleRound(2, dist.main_type_area.toString().toFloat())
} }
// map.update_date = org.apache.commons.httpclient.util.DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss").replace(" ","T") // map.update_date = org.apache.commons.httpclient.util.DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss").replace(" ","T")
return map return map