Merge branch 'master' of http://gitlab.fangjia.com/dev0/main into script_gj
# Conflicts: # projects/fangjia-core/src/main/java/com/fangjia/core/util/GeoUtils.java
This commit is contained in:
@@ -78,7 +78,7 @@ class PoseidonOnce {
|
||||
// DBCursor cur = coll.find()
|
||||
// println cur.count()
|
||||
String url = "http://www.fangjia.com";
|
||||
DBCollection coll = MongoUtils.getCollectionByName("fangjia", "test2", "192.168.0.188")
|
||||
DBCollection coll = MongoUtils.getCollectionByName("fangjia", "FiveLevelTest", "192.168.0.188")
|
||||
// for(int i=426000;i<1000000;i++) {
|
||||
// String s = url + i + "_" + url.hashCode()
|
||||
// DBObject dbo = new BasicDBObject()
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ class MsbPocTest {
|
||||
// match(inputfile)
|
||||
matchOld(inputfile)
|
||||
// addPrice("D:\\数据\\美术宝\\美术宝测试数据(价格).xlsx")
|
||||
// test("D:\\数据\\美术宝\\test2.xlsx")
|
||||
// test("D:\\数据\\美术宝\\FiveLevelTest.xlsx")
|
||||
|
||||
// cityPrice()
|
||||
// mergeMatchPrice("D:\\数据\\美术宝\\美术宝-新接口价格.xlsx")
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.fangjia.script.majintao
|
||||
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import net.sf.json.JSONObject
|
||||
|
||||
|
||||
String excelFilePath = "F:\\估家\\文件\\北交所\\testcopy1.xlsx";
|
||||
ExcelUtils.removeEmptyRow(excelFilePath)
|
||||
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
|
||||
|
||||
String comprehensiveUrl = "http://localhost:9180/comprehensiveQuery/houseValueInformation";
|
||||
String communityUrl = "http://open.fangjia.com/addrSvc/avgPrice";
|
||||
String valueUrl = "http://open.fangjia.com/property/addressEvaluate";
|
||||
String caseUrl = "http://open.fangjia.com/house/case";
|
||||
String poiUrl = "http://open.fangjia.com/district/addrFacilitys";
|
||||
|
||||
HttpRequest httpRequest = new HttpRequest();
|
||||
map = new HashMap<String, String>()
|
||||
|
||||
String city = items['A']
|
||||
String address = items['B']
|
||||
double size = items['C']
|
||||
|
||||
System.out.println(city + "---" + address + "----" + size);
|
||||
|
||||
map.put("city", city)
|
||||
map.put("address", address)
|
||||
map.put("size", size.toString())
|
||||
map.put("strctureArea", size.toString())
|
||||
map.put("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB")
|
||||
|
||||
if (!address.contains("%")) {
|
||||
// 发送HTTP请求
|
||||
long start
|
||||
long end
|
||||
|
||||
// start = System.currentTimeMillis();
|
||||
// httpRequest.getJsonContent(communityUrl, map, "UTF-8")
|
||||
//
|
||||
//
|
||||
// end = System.currentTimeMillis();
|
||||
// items['D'] = String.valueOf(end - start);
|
||||
//
|
||||
// start = System.currentTimeMillis();
|
||||
// httpRequest.getJsonContent(valueUrl, map, "UTF-8")
|
||||
// end = System.currentTimeMillis();
|
||||
// items['E'] = String.valueOf(end - start);
|
||||
//
|
||||
// start = System.currentTimeMillis();
|
||||
// httpRequest.getJsonContent(caseUrl, map, "UTF-8")
|
||||
// end = System.currentTimeMillis();
|
||||
// items['F'] = String.valueOf(end - start);
|
||||
//
|
||||
// start = System.currentTimeMillis();
|
||||
// httpRequest.getJsonContent(poiUrl, map, "UTF-8")
|
||||
// end = System.currentTimeMillis();
|
||||
// items['G'] = String.valueOf(end - start);
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
def content = httpRequest.getJsonContent(comprehensiveUrl, map, "UTF-8")
|
||||
end = System.currentTimeMillis();
|
||||
items['H'] = String.valueOf(end - start);
|
||||
println content.get("msg")
|
||||
if(content.get("msg").contains("该地址不支持估价!")) {
|
||||
items['I'] = "该地址不支持估价!"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import org.bson.types.ObjectId
|
||||
|
||||
a = new ObjectId()
|
||||
print(a)
|
||||
+6
-18
@@ -1,28 +1,16 @@
|
||||
package com.fangjia.script.trade
|
||||
|
||||
|
||||
import java.util.regex.Matcher
|
||||
|
||||
package com.fangjia.script.sync
|
||||
|
||||
import com.fangjia.core.Constants
|
||||
import com.fangjia.script.BaseBatch;
|
||||
import com.fangjia.script.BatchOwner
|
||||
import com.fangjia.script.util.DateUtils;
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.fangjia.core.util.StringUtil;
|
||||
import com.fangjia.datastore.driver.DSCollection;
|
||||
import com.fangjia.datastore.driver.DSCursor
|
||||
import com.fangjia.datastore.driver.DataStore
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBObject
|
||||
import com.fangjia.script.util.MongoUtils;
|
||||
import com.fangjia.core.util.MongoUtils;
|
||||
import com.fangjia.script.Watcher;
|
||||
import com.mongodb.Bytes
|
||||
import org.apache.commons.io.FileUtils
|
||||
|
||||
/**
|
||||
* ½«ÏßÉÏopen uriÊý¾Ýͬ²½µ½192.168.0.60ÉÏ
|
||||
* @author gaojuan
|
||||
@@ -31,7 +19,7 @@ import org.apache.commons.io.FileUtils
|
||||
class CopyOpenUriLog extends BaseBatch{
|
||||
|
||||
|
||||
static DBCollection DESC_OPEN = MongoUtils.getCollectionByName("business", "open_uri_log", "seawater.mongo.db.fangjia.com", 27020)
|
||||
static DBCollection DESC_OPEN = MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI, "business", "open_uri_log")
|
||||
public static final DBCollection SOURCE_OPEN = MongoUtils.getCollectionByName("business", "open_uri_log", "log.mongo.db.fangjia.com", 52002)
|
||||
static main(String[] args){
|
||||
runBatch(new CopyOpenUriLog(), args)
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.fangjia.script.util
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.HttpRequest
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
@@ -192,6 +193,19 @@ public class CommonUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static void recalcAverage(String city, String region, String name, Integer count =1 , String category="sell", Boolean retainHistory=true){
|
||||
def url = "http://192.168.0.100:38080/FangJiaDataService/districtPriceCalculate";
|
||||
def params = new HashMap<String,String>();
|
||||
params.city = city;
|
||||
params.region = region;
|
||||
params.name = name;
|
||||
params.count = count.toString();
|
||||
params.category = category;
|
||||
params.retainHistory = retainHistory.toString();
|
||||
HttpRequest request = new HttpRequest();
|
||||
println(request.get(url, params, "UTF-8"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 重算小区均价
|
||||
* @param city
|
||||
@@ -221,7 +235,7 @@ public class CommonUtils {
|
||||
cmd.put("name", name)
|
||||
cmd.put('estate_type', estateType)
|
||||
cmd.put("calc_date", calcDate)
|
||||
cmd.put("calc_type", 0)
|
||||
cmd.put("calc_type", calcType)
|
||||
println(cmd)
|
||||
DBObject data = new BasicDBObject()
|
||||
data.put("category", "sell")
|
||||
|
||||
@@ -43,15 +43,15 @@ class Test {
|
||||
|
||||
static main(args) {
|
||||
// String test1 = " qwdwqd ssss ";
|
||||
// String test2 = " qwdwqd ss";
|
||||
// String FiveLevelTest = " qwdwqd ss";
|
||||
// String test3 = "qwdwqd dd";
|
||||
//
|
||||
// test1 = test1.replaceAll(" |\\s+", " ");
|
||||
// test2 = test2.replaceAll(" |\\s+", " ");
|
||||
// FiveLevelTest = FiveLevelTest.replaceAll(" |\\s+", " ");
|
||||
// test3 = test3.replaceAll(" |\\s+", " ");
|
||||
//
|
||||
// String[] arrs1 = test1.split("\\s+")
|
||||
// String[] arrs2 = test2.split("\\s+")
|
||||
// String[] arrs2 = FiveLevelTest.split("\\s+")
|
||||
// String[] arrs3 = test3.split("\\s+")
|
||||
//
|
||||
// println arrs1
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.fangjia.script.wenyan
|
||||
|
||||
import com.fangjia.core.ProvinceData
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DateUtil
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
import com.fangjia.script.util.CommonUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import org.bson.Document
|
||||
import org.elasticsearch.action.get.GetRequest
|
||||
import org.elasticsearch.action.get.GetResponse
|
||||
import org.elasticsearch.client.RequestOptions
|
||||
import org.elasticsearch.client.RestHighLevelClient
|
||||
|
||||
////def data = []
|
||||
////data << ["ID","城市","区域","名称","地址", "财力评级"]
|
||||
//RestHighLevelClient client = ElasticUtils.getClient89("192.168.0.89")
|
||||
//district_analy_data_client = Mongo3Utils.getDbCollection("fangjia_stat", "district_analy_data")
|
||||
//level_map = ["1": "S", "2": "A", "3": "B", "4": "C", "5": "D"]
|
||||
//level_maps = new HashMap<>()
|
||||
//for(def key in level_map.keySet()){
|
||||
// level_maps.put(level_map[key], key)
|
||||
//}
|
||||
//ExcelUtils.modify("C:\\Users\\goojia\\Desktop\\财力评级-厦门.xlsx",{List item->
|
||||
//// GetResponse response = client.get(new GetRequest("community_summary", item["A"] as String), RequestOptions.DEFAULT)
|
||||
//// def query = new Document("city", item['B'].toString().replace("市", ""))
|
||||
//// query.append("region", item['C'].replace("区", ""))
|
||||
//// query.append("district_name", item["D"])
|
||||
//// def stat = district_analy_data_client.find(query).first()
|
||||
//// println(query)
|
||||
//// item["F"] = response.getSourceAsMap()?.consumption_rating
|
||||
//// item["G"] = stat?.community_rating
|
||||
// item["G"] = level_maps.get(item["G"], null)
|
||||
//// println(item)
|
||||
//})
|
||||
//System.exit(0)
|
||||
////for (def region in ["思明", "翔安", "湖里"]) {
|
||||
//// DbUtils.seaweed.find(new BasicDBObject("city", "厦门").append("region", region).append("cat", "district").append("status", 0)).each { BasicDBObject dbo ->
|
||||
//// println("${dbo._id.toString()}\t${dbo.city}市\t${dbo.region}区\t${dbo.name}\t${dbo.address}")
|
||||
//// }
|
||||
////}
|
||||
|
||||
ExcelUtils.read("C:\\Users\\goojia\\Desktop\\海南省城市均价.xlsx",1).each {List item->
|
||||
def yearMonth = DateUtil.formatByPattern(item[0], "yyyyMM").toInteger()
|
||||
|
||||
println(item)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.fangjia.script.wenyan.xiamen
|
||||
|
||||
import com.fangjia.core.util.DataUtil
|
||||
import com.fangjia.core.util.GeoUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
|
||||
ExcelUtils.multiThreadingModify("D:\\本地化部署\\厦门银行数据\\网点经纬度业务选择网点.xlsx",{List item ->
|
||||
def location = item['E']
|
||||
if(location){
|
||||
def lng = location.toString().split(",")[0].toDouble()
|
||||
def lat = location.toString().split(",")[1].toDouble()
|
||||
def bounds = GeoUtils.getAround(lat, lng, 3000)
|
||||
item["G"] = "${DataUtil.getRound(6, bounds[2])},${DataUtil.getRound(6,bounds[0])},${DataUtil.getRound(6,bounds[3])},${DataUtil.getRound(6,bounds[1])}"
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user