Merge branch 'script_gj' into 'master'

Script gj

See merge request !1154
This commit is contained in:
2025-08-15 10:51:13 +08:00
3 changed files with 34 additions and 38 deletions
@@ -6,19 +6,13 @@ import com.fangjia.script.BatchOwner
import com.fangjia.script.Watcher import com.fangjia.script.Watcher
import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.common.DataHandleUtils import com.fangjia.script.common.DataHandleUtils
import com.fangjia.script.jusfoun.JusfounCommon
import com.fangjia.script.util.DateUtil
import com.fangjia.script.util.DateUtils import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject import com.mongodb.BasicDBObject
import com.mongodb.DBCollection import com.mongodb.DBCollection
import org.apache.commons.codec.digest.DigestUtils
import org.apache.commons.io.FileUtils
import org.bson.types.ObjectId import org.bson.types.ObjectId
import java.text.DecimalFormat import java.text.DecimalFormat
import java.util.concurrent.TimeUnit
/** /**
* 福州农商行-小区月均价数据导出 * 福州农商行-小区月均价数据导出
*/ */
@@ -34,7 +28,7 @@ class DistrictPriceExportBatch extends BaseBatch{
static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com") static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com")
def specialDistsPriceMap = ["津泰新村9-13号、15-18号":54000,"津泰新村14号":72000,"津泰新村1-6号、8号":35000,"津泰新村7号":75000,"津泰新村19号":25000] def specialDistsPriceMap = ["津泰新村9-13号、15-18号":37500,"津泰新村14号":51000,"津泰新村1-6号、8号":23500,"津泰新村7号":38000,"津泰新村19号":36000]
static main(args) { static main(args) {
runBatch(new DistrictPriceExportBatch(), args) runBatch(new DistrictPriceExportBatch(), args)
} }
@@ -164,7 +158,7 @@ class DistrictPriceExportBatch extends BaseBatch{
}else{ }else{
curPrice = specialDistsPriceMap.get(rMap.name) curPrice = specialDistsPriceMap.get(rMap.name)
if(curPrice){ if(curPrice){
def randMarkup = nextDouble(0, 1) def randMarkup = nextDouble(-1, 1)
curPrice = (int)(curPrice*randMarkup/100 + curPrice) curPrice = (int)(curPrice*randMarkup/100 + curPrice)
} }
} }
@@ -87,17 +87,14 @@ class NewPoiData {
} }
def calcuteDistance(){ def calcuteDistance(){
ExcelUtils.multiThreadingModify("d:\\数据\\写字楼测试-1118-新增.xlsx", { d -> ExcelUtils.multiThreadingModify("C:\\Users\\JLKJ0001\\Downloads\\商铺出租信息.xlsx", { d ->
if(d['F']){ if(d['I']){
if(d['A'].contains("北京")){ def arrs = d['I'].split(",")
def distance = GeoHelper.GetDistance(d['F'].toString().toDouble(), d['E'].toString().toDouble(), 39.996743, 116.481075) def distance = GeoHelper.GetDistance(arrs[1].toString().toDouble(),arrs[0].toDouble(), 22.512276,113.939156)
d['K'] = distance d['X'] = distance
}else if(d['A'].contains("烟台")){ println distance
def distance = GeoHelper.GetDistance(d['F'].toString().toDouble(), d['E'].toString().toDouble(), 37.459645, 121.438616)
d['K'] = distance
}
} }
}, 1) }, 0)
} }
@@ -2,7 +2,6 @@ package com.fangjia.script.gj.poc
import com.fangjia.script.ccbevaluation.CcbCommonUtils import com.fangjia.script.ccbevaluation.CcbCommonUtils
import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.util.DateUtil
import com.fangjia.script.util.DateUtils import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
@@ -15,7 +14,6 @@ import java.util.concurrent.CountDownLatch
import java.util.concurrent.ExecutorService import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicLong import java.util.concurrent.atomic.AtomicLong
/** /**
* 价格对比,第三方,成交,建行价格,自已家价格 * 价格对比,第三方,成交,建行价格,自已家价格
*/ */
@@ -23,8 +21,8 @@ class AddPriceTest {
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(50) public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(50)
def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse", // def pgsqlInstance = Sql.newInstance("jdbc:postgresql://192.168.0.236:5432/warehouse",
"postgres", "postgres", "org.postgresql.Driver") // "postgres", "postgres", "org.postgresql.Driver")
//235为房价网内部计算均价的库 //235为房价网内部计算均价的库
def pgsqlInstance235 = Sql.newInstance("jdbc:postgresql://192.168.0.235:5433/fangjia?stringtype=unspecified", def pgsqlInstance235 = Sql.newInstance("jdbc:postgresql://192.168.0.235:5433/fangjia?stringtype=unspecified",
@@ -38,15 +36,22 @@ class AddPriceTest {
task.run(); task.run();
} }
def run(){ def run(){
def filePath = "D:\\数据\\价格\\惠州.xlsx" // def districts = CommonDatautils.findAllDistrictsFromMg("西安","district", ["_id","city","region", "name", "lng","lat", "build_date", "household_count"])
// def rets = []
// rets << ["id","城市","区域","名称","经度","纬度","户数","建成年代","价格","可信度"]
// for(def d : districts){
// rets << [d._id.toString(), d.city, d.region,d.name,d.lng/10000000000.0, d.lat/10000000000.0, d.household_count, d.build_date]
// }
// ExcelUtils.write("d:\\数据\\数据建设\\西安楼盘.xlsx", rets, "西安")
def filePath = "d:\\数据\\数据建设\\西安楼盘.xlsx"
// addGXDPrice(filePath) // addGXDPrice(filePath)
// addCcbPrice(filePath) addCcbPrice(filePath)
// addThirdPrice(filePath) // addThirdPrice(filePath)
// addFjwPrice(filePath) // addFjwPrice(filePath)
// exportPkPrice() // exportPkPrice()
// addRegion() // addRegion()
// addTradePrice(filePath) // addTradePrice(filePath)
addThirdSamplePrice("D:\\数据\\建行\\房产估值\\指导价\\级联、国信达价格导入_0313.xlsx") // addThirdSamplePrice("D:\\数据\\建行\\房产估值\\指导价\\级联、国信达价格导入_0313.xlsx")
} }
@@ -216,25 +221,25 @@ class AddPriceTest {
def addCcbPrice(filepath){ def addCcbPrice(filepath){
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
ExcelUtils.multiThreadingModify(filepath,{ d-> ExcelUtils.multiThreadingModify(filepath,{ d->
if(d['A']){ if(d['B']){
def cityId = cityCodeDataMap.get(d['B']) def cityId = cityCodeDataMap.get(d['B'])
def map = findAvgPrice(d['A'], cityId) // def map = findAvgPrice(d['A'], cityId)
if(map){ // if(map){
d['I'] = map.avg_price // d['I'] = map.avg_price
d['J'] = map.month // d['J'] = map.month
// d['H'] = map.calc_type //// d['H'] = map.calc_type
// d['AM'] = map.credit_value //// d['AM'] = map.credit_value
} // }
def newPriceMap = findNewFjwAvgPrice(d['A'], cityId) def newPriceMap = findNewFjwAvgPrice(d['A'], cityId)
if(newPriceMap){ if(newPriceMap){
d['G'] = newPriceMap.avg_price d['I'] = newPriceMap.avg_price
d['H'] = newPriceMap.month d['K'] = newPriceMap.month
d['H'] = map.calc_type d['L'] = newPriceMap.calc_type
// d['AM'] = map.credit_value d['J'] = newPriceMap.credit_value
} }
} }
}) }, 1)
} }