Compare commits

..

7 Commits

Author SHA1 Message Date
王文艳 9dd8e2e9c4 Use numeric build number for asset version 2026-10-27 21:07:13 +08:00
王文艳 721277a84b Use build version for static assets 2026-10-27 21:00:13 +08:00
王文艳 b6166e2e79 Fix duplicate Elasticsearch JDBC driver 2026-10-27 18:26:53 +08:00
王文艳 9e729f5366 fix(deploy): use projects/fangjia-script/target/fangjia-script.jar for scp 2026-09-30 21:19:31 +08:00
王文艳 e6eb4d5c03 fix(deploy): fix docker compose directory and jar package path in Jenkinsfile for fangjia-script 2026-09-30 21:14:47 +08:00
王文艳 f9967af738 修复厦门数据跑批脚本 2026-09-30 21:05:56 +08:00
王文艳 40b7c67b34 修复厦门数据跑批脚本 2026-09-30 20:58:04 +08:00
11 changed files with 168 additions and 81 deletions
+18 -1
View File
@@ -18,7 +18,24 @@
"Bash(chmod +x /tmp/search_all.sh)",
"Bash(/tmp/search_all.sh)",
"Bash(chmod +x /tmp/extract_classes.sh)",
"Bash(/tmp/extract_classes.sh)"
"Bash(/tmp/extract_classes.sh)",
"Bash(curl -s -m 10 -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":200}}}}')",
"Bash(curl -s -m 15 -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":300}}}}' -o /tmp/es_types.json)",
"Bash(echo \"exit=$?\")",
"Bash(curl -s -m 15 -v -u elastic:elasticsearch \"http://192.168.0.89:9200/\")",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":300}}}}' -o /tmp/es_types.json)",
"Bash(python -c ' *)",
"Bash(curl -s -m 30 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":3000}}}}' -o /tmp/es_types_all.json)",
"Bash(curl -s -m 60 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggs\":{\"types\":{\"terms\":{\"field\":\"small_type\",\"size\":3000}}}}' -o es_types_all.json)",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=1\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"small_type\":\"小学\"}}}')",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=1\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"small_type\":\"小学\"}}}' -o /tmp/es_doc.json)",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=2\" -o /tmp/es_doc.json)",
"Bash(python -X utf8 -c ' *)",
"Bash(curl -s -m 15 --noproxy '*' -u elastic:elasticsearch \"http://192.168.0.89:9200/didata_map_poi_2024/_search?size=2\" -o es_doc.json)",
"Bash(python -X utf8 -)",
"Bash(awk 'NR>=351 && NR<=630' \"projects\\\\fangjia-open\\\\src\\\\main\\\\java\\\\com\\\\fangjia\\\\open\\\\controllers\\\\PropertyController.java\")",
"Bash(awk 'NR>=351 && NR<=560 && / };/{print NR\": \"$0; exit}' \"projects\\\\fangjia-open\\\\src\\\\main\\\\java\\\\com\\\\fangjia\\\\open\\\\controllers\\\\PropertyController.java\")",
"Bash(mvn compile *)"
]
}
}
Vendored
+3 -3
View File
@@ -102,7 +102,7 @@ pipeline {
def buildDir = cfg.buildDir ?: params.PROJECT_NAME
dir("deliverables/${buildDir}") {
withMaven(globalMavenSettingsConfig: '426b9a25-aa0d-47d3-a24c-8abdfc4421ff', jdk: "JDK8") {
sh 'mvn clean package -Dmaven.test.skip=true'
sh 'mvn clean package -Dmaven.test.skip=true -Dasset.version="$BUILD_NUMBER"'
}
}
}
@@ -162,12 +162,12 @@ pipeline {
projects/fangjia-script/crontab.txt \
${deployUser}@${cfg.deployHost}:/home/docker/fangjia-script/crontab.txt
# 热重载
# 重启容器
ssh -o StrictHostKeyChecking=no \
-o HostKeyAlgorithms=+ssh-rsa \
-o PubkeyAcceptedKeyTypes=+ssh-rsa \
${deployUser}@${cfg.deployHost} \
'docker compose shutdown && docker compose pull && docker compose up -d'
'cd ${cfg.deployBase}/${cfg.composeDir} && docker compose down && docker compose pull && docker compose up -d'
"""
} else {
if(cfg.deployHost instanceof String){
+13
View File
@@ -8,9 +8,22 @@
<name>fangjia-coresite</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<asset.version>${maven.build.timestamp}</asset.version>
</properties>
<build>
<finalName>fangjia-coresite</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes><exclude>asset-version.properties</exclude></excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes><include>asset-version.properties</include></includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -1,6 +1,8 @@
package com.fangjia.coresite.model;
import java.io.UnsupportedEncodingException;
import java.io.InputStream;
import java.io.IOException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Calendar;
@@ -9,6 +11,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
import org.sothis.core.util.Pager;
@@ -37,6 +40,25 @@ public class BaseModel extends ModelAndViewSupport {
private static final long serialVersionUID = 1L;
private String debugFtl;
private final static FangjiaConfig CONFIG = FangjiaConfig.getConfig();
private static final String ASSET_VERSION = loadAssetVersion();
private static String loadAssetVersion() {
InputStream input = BaseModel.class.getResourceAsStream("/asset-version.properties");
if (input != null) {
try {
Properties properties = new Properties();
properties.load(input);
String version = properties.getProperty("asset.version");
if (version != null && version.length() > 0 && !version.startsWith("${")) {
return version;
}
} catch (IOException ignored) {
} finally {
try { input.close(); } catch (IOException ignored) { }
}
}
return String.valueOf(System.currentTimeMillis());
}
private final static String STATIC_URL = "http://" + CONFIG.getStaticDomainName()
+ (CONFIG.isDevelopmentEnvironment() ? "/fangjia-static" : "/stc");
@@ -216,7 +238,7 @@ public class BaseModel extends ModelAndViewSupport {
}
public final String getVersion() {
return String.valueOf(System.currentTimeMillis());
return ASSET_VERSION;
}
public final String getHisCityUrl() {
@@ -638,4 +660,4 @@ public class BaseModel extends ModelAndViewSupport {
}
}
@@ -0,0 +1 @@
asset.version=${asset.version}
+6
View File
@@ -53,6 +53,12 @@
<goals><goal>shade</goal></goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<artifactSet>
<excludes>
<!-- The driver is loaded from lib; shading it too triggers its duplicate-version check. -->
<exclude>org.elasticsearch.plugin:x-pack-sql-jdbc</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
@@ -4995,8 +4995,7 @@ class CommonDatautils {
q.put("city", city)
q.put("region", region)
q.put("name", name)
q.put("s_date", new BasicDBObject('$gte', startDate).append('$lte',endDate))
q.put("s_date", new BasicDBObject('$gte', startDate).append('$lte', endDate))
def dbcursor = thirdpartColl.find(q).sort(new BasicDBObject("s_date", -1))
def map = [:]
for(def db : dbcursor){
@@ -5,6 +5,7 @@ import com.fangjia.core.util.HttpRequest
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.EsUtils
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.fangjia.script.util.MongoUtils
@@ -14,30 +15,55 @@ import com.mongodb.DBCollection
import java.util.concurrent.atomic.AtomicInteger
class GongShu {
static DBCollection DISTRICT_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_sell_stat", "mongo.db.fangjia.com")
static main(args) {
def task = new GongShu();
task.run();
}
def run() {
String path1 = "D:\\数据\\福州\\福州200个小区抽样价格核验202603.xlsx";
// String path1 = "D:\\数据\\福州\\价格比对_20240915.xlsx";
String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
String path3 = "E:\\goojia\\file\\excel文件\\福州\\福州贝壳小区.xlsx";
// String path2 = "E:\\goojia\\file\\excel文件\\福州\\1.xlsx";
// String path1 = "E:\\goojia\\file\\excel文件\\福州\\福州全部小区.xlsx";
// findID(path2)
// findDelDistrict(path2)
// findDistrictByAlias(path2)
// match19UseMAP(path2)
// addFjwPrice(path2)
def data = [["ID","区域","小区名称","供数价格","贝壳成交价","安居客价格(挂牌价*0.9)","麦田价格(挂牌价*0.9)","房天下价格(挂牌价*0.9)","城市房产价格(挂牌价*0.9)","供数价格与贝壳成交价差异"]]
DbUtils.seaweed.find(DbUtils.buildSeaweedQuery("福州"), new BasicDBObject("region", 1).append("name", 1)).each {
data << [it._id.toString(), it.region, it.name]
}
for(def yearMonth in [202604,202605,202606, 202607]){
// ExcelUtils.write("D:\\数据\\福州\\福州200个小区抽样价格核验${yearMonth}.xlsx", data, "sheet1")
// def query = new BasicDBObject()
// query.append("city", "福州")
// query.append("date", yearMonth)
// def stat = [:]
// DISTRICT_SELL_STAT.find(query, new BasicDBObject("region", 1).append("district_name", 1).append("avg_price", 1)).each {
// stat.put("${it.region}_${it.district_name}".toString(), it.avg_price)
// }
// ExcelUtils.multiThreadingModify("D:\\数据\\福州\\福州200个小区抽样价格核验${yearMonth}.xlsx",{List item->
// item["D"] = stat.get("${item['B']}_${item['C']}".toString(), null)
// })
priceAvg("D:\\数据\\福州\\福州200个小区抽样价格核验${yearMonth}.xlsx")
}
// match(path2, path1)
// match2(path3, path1)
// houseCase(path2)
thirdPrice(path1)
priceAvg(path1)
// String path1 = "D:\\福州200个小区抽样价格核验202604.xlsx";
//// String path1 = "D:\\数据\\福州\\价格比对_20240915.xlsx";
// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
//// String path2 = "E:\\goojia\\file\\excel文件\\福州\\福州202410小区价格.xlsx";
// String path3 = "E:\\goojia\\file\\excel文件\\福州\\福州贝壳小区.xlsx";
//// String path2 = "E:\\goojia\\file\\excel文件\\福州\\1.xlsx";
//// String path1 = "E:\\goojia\\file\\excel文件\\福州\\福州全部小区.xlsx";
//// findID(path2)
//// findDelDistrict(path2)
//// findDistrictByAlias(path2)
//// match19UseMAP(path2)
//// addFjwPrice(path2)
//
//// match(path2, path1)
//// match2(path3, path1)
//// houseCase(path2)
// thirdPrice(path1)
// priceAvg(path1)
// futurePrice(path2)
// rePrice(path2)
}
@@ -319,7 +345,7 @@ class GongShu {
})
}
//查找三方价格
def thirdPrice(path1) {
def thirdPrice(path1 ,yearMonth) {
def count = 0
ExcelUtils.multiThreadingModify( path1, { List d ->
count++
@@ -329,7 +355,7 @@ class GongShu {
def city = "福州"
def region = d['B']
def name = d['C']
def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202512, 202603)
def valusMap = CommonDatautils.findThirdPartyPrice(city, region, name, 202601, yearMonth)
if (valusMap) {
def dataMap = valusMap.get(city + "##" + region + "##" + name)
if (dataMap.get("anjuke_esf_price")) {
@@ -794,7 +794,7 @@ class OpenApiUtils {
static def addrVerifyXiameng(city, address, type){
address = URLEncoder.encode(address, "utf-8");
def url = "http://192.168.0.80:32080/FangJiaAddressService/v7/villageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB"
def url = "http://192.168.0.80:32080/FangJiaAddressService/v7/villageIdentify?address=${address}&ai=1&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB"
// def url = "http://localhost:8080/fangjia-open/addrSvc/njcbVillageIdentify?address=${address}&type=${type}&token=F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB"
if(city){
url = url + "&city=${city}"
@@ -9,6 +9,7 @@ import com.fangjia.script.util.DateUtil
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelRow
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.fangjia.script.wenyan.taobao.BidRecordsParseBatch
@@ -26,6 +27,7 @@ class HongXingMonthBatch extends BaseBatch{
static DBCollection OFFICE_RENT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "office_rent_stat", "mongo.db.fangjia.com")
static DBCollection OFFICE_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "office_sell_stat", "mongo.db.fangjia.com")
static DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "deal_price", "mongo.db.fangjia.com")
static String matchIdLabel = "AM"
static main(args) {
runBatch(new HongXingMonthBatch(), args);
}
@@ -36,10 +38,11 @@ class HongXingMonthBatch extends BaseBatch{
// createTestFile();
// mergeFile()
// mergeMatchId()
def fileName = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\宏信楼盘5月监测20260520交付.xlsx"
def removeAddrFile = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\20260520宏信.xlsx"
def fileName = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\宏信楼盘9月监测20260920交付.xlsx"
def removeAddrFile = "C:\\Users\\wenyan\\Desktop\\宏信交付数据\\20260920宏信.xlsx"
def addAddrData = ExcelUtils.read(removeAddrFile, 2, 1)
def removeAddrs = []
ExcelUtils.read(removeAddrFile, 0).each {List item->
ExcelUtils.read(removeAddrFile, 1).each {List item->
removeAddrs << item["C"]
}
ExcelUtils.modify(fileName,{List item->
@@ -49,7 +52,7 @@ class HongXingMonthBatch extends BaseBatch{
}
})
def fixPriceAddrs = [:]
ExcelUtils.read(removeAddrFile, 1).each {List item->
ExcelUtils.read(removeAddrFile, 0).each {List item->
if(item["A"] && item["B"]){
fixPriceAddrs.put(item["A"],item["B"].toString().toDouble().toInteger())
}
@@ -57,7 +60,7 @@ class HongXingMonthBatch extends BaseBatch{
}
def stat = [:]
//获取上个月的交付价格
def lastMonthPriceRowId = "P" //上个月均价所在列号
def lastMonthPriceRowId = "R" //上个月均价所在列号
ExcelUtils.read(fileName).each{List item->
if(item[lastMonthPriceRowId]){
stat.put(item["C"], item[lastMonthPriceRowId])
@@ -68,6 +71,20 @@ class HongXingMonthBatch extends BaseBatch{
def count = findCurMonthPrice(lastMonthStr)
if(count > 0){
def datas = ExcelUtils.read(fileName)
for(def item in addAddrData){
def buffer = new ExcelRow()
buffer['C'] = item["A"]
buffer['I'] = item["B"]
buffer[matchIdLabel] = item["D"]
buffer["F"] = item["E"]
buffer["G"] = item["F"]
buffer['A'] = item["G"]
buffer["B"] = item["H"]
datas.add(buffer)
if(item["A"] && item["C"]){
fixPriceAddrs.put(item["A"],item["C"].toString().toDouble().toInteger())
}
}
def newDatas = createDatas(datas, lastMonthStr, fixPriceAddrs)
def curDateStr = DateUtils.formatDateByPattern(new Date(),"yyyyMMdd")
ExcelUtils.write(fileName, newDatas,"结果${curDateStr}")
@@ -123,8 +140,8 @@ class HongXingMonthBatch extends BaseBatch{
def createDatas(datas, lastMonthStr, Map fixPriceAddrs){
def rows = []
rows << ["物业类型","名称","地址","期房/现房","处置状态","省份","城市","城市排名","面积","1月评估单价(元)","1月评估总价(元)","2月评估单价(元)","2月评估总价(元)","3月评估单价", "3月评估总价(元)","4月评估单价", "4月评估总价(元)","5月评估单价", "5月评估总价(元)"
,"环比涨跌幅(%)","计算方式","定基涨跌幅(相比首月波动)","5月区域均价","5月区域均价涨跌幅(%)","4月楼盘所在区域价格的排名(仅针对住宅)","5月楼盘所在区域价格的排名(仅针对住宅)","楼盘所在区域排名变化(仅针对住宅)","近3个月内成交量","近6个月成交量","3个月挂牌量","匹配ID-新","备注","情况说明"]
rows << ["物业类型","名称","地址","期房/现房","处置状态","省份","城市","城市排名","面积","1月评估单价(元)","1月评估总价(元)","2月评估单价(元)","2月评估总价(元)","3月评估单价", "3月评估总价(元)","4月评估单价", "4月评估总价(元)","5月评估单价","5月评估总价(元)","6月评估单价", "6月评估总价(元)","7月评估单价", "7月评估总价(元)","8月评估单价", "8月评估总价(元)","9月评估单价", "9月评估总价(元)"
,"环比涨跌幅(%)","计算方式","定基涨跌幅(相比首月波动)","9月区域均价","9月区域均价涨跌幅(%)","8月楼盘所在区域价格的排名(仅针对住宅)","9月楼盘所在区域价格的排名(仅针对住宅)","楼盘所在区域排名变化(仅针对住宅)","近3个月内成交量","近6个月成交量","3个月挂牌量","匹配ID-新","备注","情况说明"]
def index = 1
for(def d : datas){
println d['B']
@@ -147,13 +164,21 @@ class HongXingMonthBatch extends BaseBatch{
row << d['O']
row << d['P']
row << d['Q']
row << d['R']
row << d['S']
row << d['T']
row << d['U']
row << d['V']
row << d['W']
row << d['X']
row << d['Y']
if(d['E'] == "已处置"){
rows << row
continue
}
def currMonthUnitPriceLabel = "R"
def preMonthUnitPriceLabel = "P"
def matchIdLabel = "AE"
def currMonthUnitPriceLabel = "Z"
def preMonthUnitPriceLabel = "X"
def matchIdLabel = "AM"
if(!["商铺","办公楼"].contains(d['A'])){
def dist = CommonDatautils.findDistrictById(d[matchIdLabel])
if(dist){
@@ -209,7 +234,6 @@ class HongXingMonthBatch extends BaseBatch{
row << ""
row << ""
row << ""
}
def regionPriceObj = findRegionPrice(dist.city, dist.region, lastMonthStr)
@@ -243,7 +267,7 @@ class HongXingMonthBatch extends BaseBatch{
row << findHouse(dist)
}else{
println d[matchIdLabel] +" 未找到该id的楼盘"
println d[matchIdLabel] +" 未找到该id的楼盘:${d}"
}
}else{
def dist = CommonDatautils.findDistrictById(d[matchIdLabel])
@@ -253,6 +277,13 @@ class HongXingMonthBatch extends BaseBatch{
if(d['A'] == "办公楼"){
cityMarkupObj = findRentOfficeMarkup(dist.city, null, lastMonthStr, "city")
regionMarkupObj = findSellOfficeMarkup(dist.city, dist.region, lastMonthStr, "district")
println(dist.city)
if(cityMarkupObj.mom == null){
def lastMonthPreStr = com.fangjia.core.util.DateUtil.add(com.fangjia.core.util.DateUtil.parseDate(lastMonthStr, "yyyyMM"), Calendar.MONTH, -1).format("yyyyMM")
def cityMarkupObjPre = findRentOfficeMarkup(dist.city, null, lastMonthPreStr, "city")
cityMarkupObj.mom = DataUtil.getRound(2, (cityMarkupObj.avg_price - cityMarkupObjPre.avg_price)*100/cityMarkupObjPre.avg_price)
println(cityMarkupObj)
}
if(cityMarkupObj){
println cityMarkupObj
cityMarkupObj.mom = cityMarkupObj.mom / 100
@@ -267,6 +298,9 @@ class HongXingMonthBatch extends BaseBatch{
regionMarkupObj = findSellShopMarkup(dist.city, dist.region, lastMonthStr, "district")
}
if(cityMarkupObj){
if(fixPriceAddrs.containsKey(d['C'])){
d[currMonthUnitPriceLabel] = fixPriceAddrs[d['c']]
}
if(d[currMonthUnitPriceLabel]){
def newAvgPrice = d[currMonthUnitPriceLabel]
row << DataUtil.getRound(newAvgPrice)
@@ -347,8 +381,8 @@ class HongXingMonthBatch extends BaseBatch{
}
}
row << d[matchIdLabel]
row << d['AF']
row << d['AG']
row << d['AN']
row << d['AO']
rows << row
}
@@ -1,43 +1,12 @@
package com.fangjia.script.wenyan.temp
import com.fangjia.core.Constants
import com.fangjia.core.util.DataUtil
import com.fangjia.core.util.MongoUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.OpenApiClient
import com.mongodb.BasicDBObject
import net.sf.json.JSONObject
import java.util.regex.Matcher
import java.util.regex.Pattern
def school = MongoUtils.getDbCollection(Constants.FANGJIA_CRAWL_MONGO_URI, "fangjia_craw", "school2")
new File("D:\\数据\\学校数据").eachFile {File file->
ExcelUtils.read(file.getAbsolutePath(), 0).each {List item->
BasicDBObject dbo = new BasicDBObject()
dbo.city = item["A"]
dbo.region = item["B"]
dbo.name = item["C"]
dbo.address = item["E"]
dbo.attribute = item["G"]
dbo.property = item["H"]
dbo.category = "小学"
dbo.location = [DataUtil.roundDouble(item["I"], 6), DataUtil.roundDouble(item["J"], 6)]
school.insert(dbo)
println(dbo)
}
ExcelUtils.read(file.getAbsolutePath(), 1).each {List item->
BasicDBObject dbo = new BasicDBObject()
dbo.city = item["A"]
dbo.region = item["B"]
dbo.name = item["C"]
dbo.address = item["E"]
dbo.attribute = item["G"]
dbo.property = item["H"]
dbo.category = "中学"
dbo.location = [item["I"], item["J"]]
school.save(dbo)
println(item)
}
}
ExcelUtils.multiThreadingModify("C:\\Users\\wenyan\\Desktop\\估家基础数据统计.xlsx",{List item->
ElasticUtils.executeSqlQuery("select count(*) as cnt FROM didata_map_poi_single_new_45 where city like '${item['B']}%' and small_type='商务写字楼'",{Map doc->
item["D"] = doc['cnt']
item['E'] = Math.max(item["D"], item["C"])
println(doc)
})
})