update bug
This commit is contained in:
+15
-12
@@ -3,6 +3,7 @@ package com.fangjia.script.gj.level
|
|||||||
import com.fangjia.core.util.HttpRequest
|
import com.fangjia.core.util.HttpRequest
|
||||||
import com.fangjia.httpclient.UserAgents
|
import com.fangjia.httpclient.UserAgents
|
||||||
import com.fangjia.script.BaseBatch
|
import com.fangjia.script.BaseBatch
|
||||||
|
import com.fangjia.script.ccbevaluation.CcbCommonUtils
|
||||||
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.gj.ccb.FileUtils
|
import com.fangjia.script.gj.ccb.FileUtils
|
||||||
@@ -45,7 +46,7 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
|
|
||||||
static def targetUrl = "http://192.168.0.12:9200/district_comp_potential/_doc"
|
static def targetUrl = "http://192.168.0.12:9200/district_comp_potential/_doc"
|
||||||
|
|
||||||
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30)
|
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(40)
|
||||||
|
|
||||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||||
@@ -60,15 +61,17 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
}
|
}
|
||||||
|
|
||||||
def run(){
|
def run(){
|
||||||
|
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
|
||||||
def citys = ["上海"]//CommonDatautils.findAllCity();
|
def citys = ["上海"]//CommonDatautils.findAllCity();
|
||||||
for(def city : citys){
|
for(def city : citys){
|
||||||
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2"])
|
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2"])
|
||||||
// dists = dists[0..20]
|
// dists = dists[0..20]
|
||||||
calcute(city, dists)
|
def code = cityCodeDatas.get(city)
|
||||||
|
calcute(city, dists, code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def calcute(city, dists){
|
def calcute(city, dists, citycode){
|
||||||
def weekend = DateUtils.getFirstDayOfWeek(new Date());
|
def weekend = DateUtils.getFirstDayOfWeek(new Date());
|
||||||
def priceMap = CommonDatautils.queryDistrictPrice(city, weekend)
|
def priceMap = CommonDatautils.queryDistrictPrice(city, weekend)
|
||||||
def costDatas = getCostByCity(city)
|
def costDatas = getCostByCity(city)
|
||||||
@@ -91,7 +94,7 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
avg_charge = gtAvgEstateCharge(list)
|
avg_charge = gtAvgEstateCharge(list)
|
||||||
rank = getPriceInRegionRank(d, list, priceMap)
|
rank = getPriceInRegionRank(d, list, priceMap)
|
||||||
}
|
}
|
||||||
def total_price = getHousePrice(d, dists, priceMap);
|
def total_price = getHousePrice(d, dists, priceMap, citycode);
|
||||||
def avg_cost = getAvgCost(d, costDatas)
|
def avg_cost = getAvgCost(d, costDatas)
|
||||||
|
|
||||||
def total_price_index = 0
|
def total_price_index = 0
|
||||||
@@ -123,7 +126,7 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
map.city = d.city
|
map.city = d.city
|
||||||
map.region = d.region
|
map.region = d.region
|
||||||
map.name = d.name
|
map.name = d.name
|
||||||
map.avg_total_price = total_price
|
map.avg_total_price = total_price_index
|
||||||
map.avg_estate_charge = avg_charge
|
map.avg_estate_charge = avg_charge
|
||||||
map.price_rank = rank
|
map.price_rank = rank
|
||||||
map.avg_cost = avg_cost
|
map.avg_cost = avg_cost
|
||||||
@@ -157,9 +160,9 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
// ExcelUtils.write("D:\\数据\\评级\\上海综合潜力.xlsx", datas, "数据")
|
// ExcelUtils.write("D:\\数据\\评级\\上海综合潜力.xlsx", datas, "数据")
|
||||||
}
|
}
|
||||||
|
|
||||||
def getHousePrice(d, dists, priceMap){
|
def getHousePrice(d, dists, priceMap, citycode){
|
||||||
//def areas = findHouse(d, 20200101, 20220101)
|
//def areas = findHouse(d, 20200101, 20220101)
|
||||||
def areas = findHouseByOracle(d._id.toString());
|
def areas = findHouseByOracle(d._id.toString(), citycode);
|
||||||
def avg_area = null
|
def avg_area = null
|
||||||
if(areas){
|
if(areas){
|
||||||
avg_area = areas.sum()/areas.size();
|
avg_area = areas.sum()/areas.size();
|
||||||
@@ -198,7 +201,7 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
}
|
}
|
||||||
|
|
||||||
def idstr = ids.join("','")
|
def idstr = ids.join("','")
|
||||||
def allAreas = findHouseByOracle2(idstr);
|
def allAreas = findHouseByOracle2(idstr,citycode);
|
||||||
if(allAreas){
|
if(allAreas){
|
||||||
avg_area = allAreas.sum()/allAreas.size();
|
avg_area = allAreas.sum()/allAreas.size();
|
||||||
}
|
}
|
||||||
@@ -327,9 +330,9 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def findHouseByOracle(def distId){
|
def findHouseByOracle(def distId, def citycode){
|
||||||
|
|
||||||
def sql = "select BUILDAREA from bigdata_forsale_gj where CITYID='440100' AND COMMID='${distId}'";
|
def sql = "select BUILDAREA from bigdata_forsale_gj where CITYID='${citycode}' AND COMMID='${distId}'";
|
||||||
def allRows = []
|
def allRows = []
|
||||||
sqlInstance.eachRow(sql,{r->
|
sqlInstance.eachRow(sql,{r->
|
||||||
allRows << r.BUILDAREA
|
allRows << r.BUILDAREA
|
||||||
@@ -337,9 +340,9 @@ class DistrictIndexBatch extends BaseBatch{
|
|||||||
return allRows
|
return allRows
|
||||||
}
|
}
|
||||||
|
|
||||||
def findHouseByOracle2(def idstr){
|
def findHouseByOracle2(def idstr, def citycode){
|
||||||
|
|
||||||
def sql = "select BUILDAREA from bigdata_forsale_gj where CITYID='440100' AND COMMID in ('${idstr}')";
|
def sql = "select BUILDAREA from bigdata_forsale_gj where CITYID='${citycode}' AND COMMID in ('${idstr}')";
|
||||||
def allRows = []
|
def allRows = []
|
||||||
sqlInstance.eachRow(sql,{r->
|
sqlInstance.eachRow(sql,{r->
|
||||||
allRows << r.BUILDAREA
|
allRows << r.BUILDAREA
|
||||||
|
|||||||
Reference in New Issue
Block a user