提前统计房源数据

This commit is contained in:
mjt
2023-12-26 15:48:04 +08:00
parent 991900e4e7
commit 5a7b65c704
17 changed files with 158 additions and 33 deletions
@@ -32,7 +32,8 @@ public enum Watcher {
BaYi('15300424133','bayi@fangjia.com'), BaYi('15300424133','bayi@fangjia.com'),
WeiLei('18101751850','weilei@fangjia.com'), WeiLei('18101751850','weilei@fangjia.com'),
JiangYaHui('13684913780','jiangyahui@fangjia.com'), JiangYaHui('13684913780','jiangyahui@fangjia.com'),
ShenJian('13764369683', 'shenjian@fangjia.com') ShenJian('13764369683', 'shenjian@fangjia.com'),
MaJinTao('13607600062','majintao@fangjia.com')
private final String mobile; private final String mobile;
private final String email; private final String email;
@@ -0,0 +1,57 @@
import com.fangjia.core.ProvinceData
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
import com.lowagie.text.Row
import javafx.scene.control.Cell
import jxl.Sheet
import jxl.Workbook
import org.apache.poi.ss.usermodel.WorkbookFactory
String excelFilePath = "F:\\估家\\文件\\安徽省联社\\全国省级行政区房屋覆盖情况表 - 副本.xlsx"
ExcelUtils.removeEmptyRow(excelFilePath)
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
province1 = items['A']
if (!province1.equals('黑龙江省') || !province1.equals('内蒙古自治区')) {
province = province1.substring(0, 2)
} else {
province = province1.substring(0, 3)
}
println('province: ' + province)
def citys = ProvinceData.getAllCity(province)
println(citys)
if (citys.size() > 0) {
ExcelUtils.writeToExcel(excelFilePath, citys, province)
}
})
//
//import com.fangjia.core.ProvinceData
//
//import com.fangjia.script.util.ExcelUtils
//
//
//String excelFilePath = "F:\\估家\\文件\\安徽省联社\\全国省级行政区房屋覆盖情况表.xlsx"
//ExcelUtils.removeEmptyRow(excelFilePath)
//ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
//
// def province1 = items['A']
// def province
//
// if (!province1.equals('黑龙江省') && !province1.equals('内蒙古自治区')) {
// province = province1.substring(0, 2)
// } else {
// province = province1.substring(0, 3)
// }
//
// println('province: ' + province)
//
// def citys = ProvinceData.getAllCity(province)
// println(citys)
// items['D'] = citys.toString()
//
//})
@@ -5,14 +5,15 @@ import com.fangjia.script.util.ExcelUtils
import net.sf.json.JSONObject import net.sf.json.JSONObject
ExcelUtils.removeEmptyRow("F:\\估家\\文件\\北交所\\testcopy.xlsx") String excelFilePath = "F:\\估家\\文件\\北交所\\testcopy1.xlsx";
ExcelUtils.singleThreadingModify("F:\\估家\\文件\\北交所\\testcopy.xlsx", { List items -> ExcelUtils.removeEmptyRow(excelFilePath)
String excelFilePath = "F:\\估家\\文件\\北交所\\testcopy.xlsx"; ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
String comprehensiveUrl = "http://192.168.10.15:9180/comprehensiveQuery/houseValueInformation";
String communityUrl = "http://192.168.10.15:9180/addrSvc/avgPrice"; String comprehensiveUrl = "http://open.fangjia.com/comprehensiveQuery/houseValueInformation";
String valueUrl = "http://192.168.10.15:9180/property/addressEvaluate"; String communityUrl = "http://open.fangjia.com/addrSvc/avgPrice";
String caseUrl = "http://192.168.10.15:9180/house/case"; String valueUrl = "http://open.fangjia.com/property/addressEvaluate";
String poiUrl = "http://192.168.10.15:9180/district/addrFacilitys"; String caseUrl = "http://open.fangjia.com/house/case";
String poiUrl = "http://open.fangjia.com/district/addrFacilitys";
HttpRequest httpRequest = new HttpRequest(); HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>() map = new HashMap<String, String>()
@@ -34,27 +35,27 @@ ExcelUtils.singleThreadingModify("F:\\
long start long start
long end long end
// start = System.currentTimeMillis(); start = System.currentTimeMillis();
// httpRequest.getJsonContent(communityUrl, map, "UTF-8") httpRequest.getJsonContent(communityUrl, map, "UTF-8")
//
//
// end = System.currentTimeMillis(); end = System.currentTimeMillis();
// items['D'] = String.valueOf(end - start); items['D'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis(); start = System.currentTimeMillis();
// httpRequest.getJsonContent(valueUrl, map, "UTF-8") httpRequest.getJsonContent(valueUrl, map, "UTF-8")
// end = System.currentTimeMillis(); end = System.currentTimeMillis();
// items['E'] = String.valueOf(end - start); items['E'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis(); start = System.currentTimeMillis();
// httpRequest.getJsonContent(caseUrl, map, "UTF-8") httpRequest.getJsonContent(caseUrl, map, "UTF-8")
// end = System.currentTimeMillis(); end = System.currentTimeMillis();
// items['F'] = String.valueOf(end - start); items['F'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis(); start = System.currentTimeMillis();
// httpRequest.getJsonContent(poiUrl, map, "UTF-8") httpRequest.getJsonContent(poiUrl, map, "UTF-8")
// end = System.currentTimeMillis(); end = System.currentTimeMillis();
// items['G'] = String.valueOf(end - start); items['G'] = String.valueOf(end - start);
start = System.currentTimeMillis(); start = System.currentTimeMillis();
def content = httpRequest.getJsonContent(comprehensiveUrl, map, "UTF-8") def content = httpRequest.getJsonContent(comprehensiveUrl, map, "UTF-8")
@@ -0,0 +1,54 @@
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:\\估家\\文件\\北交所\\暂时不能估值数据 - 副本.xlsx";
ExcelUtils.removeEmptyRow(excelFilePath)
ExcelUtils.singleThreadingModify(excelFilePath, { List items ->
String comprehensiveUrl = "http://open.fangjia.com/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
def addressValue = httpRequest.getJsonContent(communityUrl, map, "UTF-8")
items['D'] = addressValue.get('result').toString()
def value = httpRequest.getJsonContent(valueUrl, map, "UTF-8")
items['E'] = value.get('result').toString()
def houseCase = httpRequest.getJsonContent(caseUrl, map, "UTF-8")
items['F'] = houseCase.get('result').toString()
def poi = httpRequest.getJsonContent(poiUrl, map, "UTF-8")
items['G'] = poi.get('result').toString()
}
})
@@ -0,0 +1,13 @@
package com.fangjia.script.sync
import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner
import com.fangjia.script.Watcher
@BatchOwner(Watcher.MaJinTao)
class CommunityHouseSampleBatch extends BaseBatch{
@Override
void process(Object args) {
}
}
@@ -456,7 +456,7 @@ public class ExcelUtils{
def body = data.subList(1, data.size()) def body = data.subList(1, data.size())
def nThread = Runtime.getRuntime().availableProcessors() * 3 def nThread = Runtime.getRuntime().availableProcessors() * 3
println nThread println nThread
ExecutorService executorService = Executors.newFixedThreadPool(3) ExecutorService executorService = Executors.newFixedThreadPool(1)
final AtomicInteger counter = new AtomicInteger(0) final AtomicInteger counter = new AtomicInteger(0)
final double total = body.size() final double total = body.size()
for(int i = 0 ; i < body.size(); i++){ for(int i = 0 ; i < body.size(); i++){
@@ -467,8 +467,7 @@ public class CzbankSampleServiceImpl implements CzbankSampleService {
//将数据放入样本仓库 //将数据放入样本仓库
for (Map.Entry<String, List<SampleWrapper>> entry : map.entrySet()) { for (Map.Entry<String, List<SampleWrapper>> entry : map.entrySet()) {
//超过两个,只取两个 //超过两个,只取两个
// 取三个 if (entry.getValue().size()>=2){
if (entry.getValue().size()>=3){
querySamples.addAll(entry.getValue().subList(0,2)); querySamples.addAll(entry.getValue().subList(0,2));
}else { }else {
// 不超过两个,全部放入 // 不超过两个,全部放入