From 54f0b7f2a0af98b92734bb0196d8806446f40534 Mon Sep 17 00:00:00 2001 From: gaojuan1 Date: Fri, 26 Dec 2025 08:16:54 +0800 Subject: [PATCH] =?UTF-8?q?jdk=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=EF=BC=8C=E6=95=B0=E6=8D=AE=E8=B7=91=E5=AE=8C=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/fangjia-core/pom.xml | 38 ++-- .../jiangnanblank/TestEvaluation.groovy | 181 +++++++++++------- .../fangjia/script/util/OpenApiClient.groovy | 22 +-- 3 files changed, 141 insertions(+), 100 deletions(-) diff --git a/projects/fangjia-core/pom.xml b/projects/fangjia-core/pom.xml index 2a0d00ddd..4b5915438 100644 --- a/projects/fangjia-core/pom.xml +++ b/projects/fangjia-core/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.fangjia fangjia-core @@ -17,8 +17,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 + 8 + 8 GBK @@ -105,15 +105,15 @@ 3.5.0 - net.sourceforge.pinyin4j - pinyin4j - 2.5.0 + net.sourceforge.pinyin4j + pinyin4j + 2.5.0 - com.ibm.icu - icu4j - 3.4.4 - + com.ibm.icu + icu4j + 3.4.4 + net.sf.json-lib json-lib @@ -124,7 +124,7 @@ commons-beanutils 1.8.3 - + org.apache.httpcomponents httpclient @@ -155,11 +155,11 @@ hanlp portable-1.6.6 - - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 - + + org.codehaus.jackson + jackson-mapper-asl + 1.9.13 + com.alibaba.nacos nacos-client @@ -170,5 +170,11 @@ json RELEASE + + org.projectlombok + lombok + 1.18.20 + compile + diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy index 8a70933ab..aafc471e4 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/jiangnanblank/TestEvaluation.groovy @@ -379,7 +379,7 @@ class TestEvaluation { cat = 6 } def date = new Date() - rets << [d['E'], dist.city, dist.region, dist.name, dist.address,buildType,d['I'], d['J'].toString().toDouble().toInteger(), lng, lat, d['F'], date, date, cat, d['K'].toString().toDouble().toInteger()] + rets << [d['E'], dist.city, dist.region, dist.name, dist.address,buildType,d['I'], d['J'].toString().toDouble().toInteger(), lng, lat, d['F'], date, date, cat, d['K'].toString().toDouble().toInteger(), 2] } } },1) @@ -388,11 +388,11 @@ class TestEvaluation { } def addDataToDB(rows){ - def sqlstring = "insert into evaluation(user_id, city, region, district_name, address, build_type, house_area, total_price, lng, lat, org_code, create_time, update_time, cat, unit_price ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" + def sqlstring = "insert into evaluation(user_id, city, region, district_name, address, build_type, house_area, total_price, lng, lat, org_code, create_time, update_time, cat, unit_price,report_type,average_price ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" sql.withBatch(1, sqlstring){ ps-> for(def r : rows) { - ps.addBatch(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14]) + ps.addBatch(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15],r[14]) ps.toString() } } @@ -404,80 +404,94 @@ class TestEvaluation { def detailList = ExcelUtils.read("D:\\数据\\宏信息\\宏信房源台账-基准价-详情.xlsx", 0 , 1) ExcelUtils.modify("D:\\数据\\宏信息\\宏信项目-最终.xlsx", { d -> - if (d['G']) { - def dist = CommonDatautils.findDistrictById(d['G']) - if (dist) { - def ret = [] - ret << d['L'].toString().toDouble().toInteger() - def houses = [] - if(["住宅","别墅","公寓"].contains(d["B"])){ - def propertyType = 0 - if(d["B"] == "别墅"){ - propertyType = 1 + if (d['G'] && d['L'] && d['L'].toString().toDouble().toInteger()>=3472507) { + def rows = findEvaluationIdExists(d['L'].toString().toDouble().toInteger()) + if(!rows){ + def dist = CommonDatautils.findDistrictById(d['G']) + if (dist) { + def ret = [] + ret << d['L'].toString().toDouble().toInteger() + def houses = [] + if(["住宅","别墅","公寓"].contains(d["B"])){ + def propertyType = 0 + if(d["B"] == "别墅"){ + propertyType = 1 + } + def avgPrice = d['K'] + def minPrice = null + def maxPrice = null + if(avgPrice){ + minPrice = avgPrice + maxPrice = (int)(avgPrice + avgPrice * 0.1) + } + houses = OpenApiClient.newHouseAction(dist.city, dist.region, dist.name, propertyType.toString(), minPrice, maxPrice, 5) + + if(houses.size()<5){ + if(avgPrice){ + minPrice = avgPrice + maxPrice = (int)(avgPrice + avgPrice * 0.2) + } + houses = OpenApiClient.newHouseAction(dist.city, dist.region, dist.name, propertyType.toString(), minPrice, maxPrice, 15) + } } - def avgPrice = d['K'] - def minPrice = null - def maxPrice = null - if(avgPrice){ - minPrice = (int)(avgPrice - avgPrice * 0.1) - maxPrice = (int)(avgPrice + avgPrice * 0.1) + if(houses){ + ret << createHouse(houses) + }else{ + ret << [] + } + if(d['K']){ + ret << createTrend(d['K'].toString().toDouble().toInteger(), d['A']) + }else{ + ret << '{"trendSvg":""}' } - houses = OpenApiClient.newHouseAction(dist.city, dist.region, dist.name, propertyType.toString(), minPrice, maxPrice, 5) - } - if(houses){ - ret << houses - }else{ ret << [] + ret << "上海宏信建设发展有限公司" + ret << new Date() + ret << new Date() + ret << 1 + ret << d['A'] + ret << createAttachment(detailList, d['G'], d['B'], dist) +// rets.add(ret) + saveEvaluationEditData(ret) + } - if(d['K']){ - ret << createTrend(d['K'].toString().toDouble().toInteger(), d['A']) - }else{ - ret << '{"trendSvg":""}' - } - ret << [] - ret << "上海宏信建设发展有限公司" - ret << new Date() - ret << new Date() - ret << 1 - ret << d['A'] - ret << [createAttachment(detailList, d['G'], d['B'], dist)] - - rets.add(ret) - - def sqlstring = "insert into evaluation_edit_data(evaluation_id, house_samples, market_analysis, custom_properties, company, create_time, update_time, validity_period, subject_name, attachments) values (?,?,?,?,?,?,?,?,?,?)" - - sql.withBatch(1, sqlstring){ ps-> - for(def r : rets) { - - def houseSamplesJson = null - if (r[1]) { - // 修复中文转义 - houseSamplesJson = fixUnicodeEscapes(JsonOutput.toJson(r[1])) - } - def marketAnalysisJson = null - if (r[2]) { - // 修复中文转义 - marketAnalysisJson = fixUnicodeEscapes(JsonOutput.toJson(r[2])) - } - - def customPropertiesJson = r[1] ? JsonOutput.toJson(r[3]) : null - def attachmentsJson = null - if(r[9]){ - // 修复中文转义 - attachmentsJson = fixUnicodeEscapes(JsonOutput.toJson(r[9])) - } - - ps.addBatch(r[0], houseSamplesJson, marketAnalysisJson, customPropertiesJson, r[4], r[5], r[6], r[7], r[8], attachmentsJson) - ps.toString() - } - } - - } } }); + } + + def saveEvaluationEditData(r){ + + def sqlstring = "insert into evaluation_edit_data(evaluation_id, house_samples, market_analysis, custom_properties, company, create_time, update_time, validity_period, subject_name, attachments) values (?,?,?,?,?,?,?,?,?,?)" + + sql.withBatch(1, sqlstring){ ps-> + def houseSamplesJson = null + if (r[1]) { + // 修复中文转义 + houseSamplesJson = fixUnicodeEscapes(JsonOutput.toJson(r[1])) + } + def marketAnalysisJson = null + if (r[2]) { + // 修复中文转义 + marketAnalysisJson = fixUnicodeEscapes(JsonOutput.toJson(r[2])) + } + + def customPropertiesJson = r[1] ? JsonOutput.toJson(r[3]) : null + def attachmentsJson = null + if(r[9]){ + // 修复中文转义 + attachmentsJson = fixUnicodeEscapes(JsonOutput.toJson(r[9])) + } + + ps.addBatch(r[0], houseSamplesJson, marketAnalysisJson, customPropertiesJson, r[4], r[5], r[6], r[7], r[8], attachmentsJson) + ps.toString() + } + } + def findEvaluationIdExists(evaluationId){ + def query = "SELECT * FROM evaluation_edit_data WHERE evaluation_id = ? LIMIT 1" + return sql.firstRow(query, [evaluationId]) } def createTrend(price, name){ @@ -509,14 +523,24 @@ class TestEvaluation { def items = [] for(def data : detailList){ if(data["I"]==id && type==data['D']){ - def totalPrice = (int)(data['H'] * data['N']) - items << ["city":dist.city, "district":dist.region, "address":data['B'], "area":data['H'], "unitPrice":data['N'].toString().toDouble().toInteger(), "totalPrice":totalPrice] + def totalPrice = 0 + if (data['H'] && data['N']){ + totalPrice = (int)(data['H'] * data['N']) + } + def unitPrice = 0 + if(data['N']){ + unitPrice = data['N'].toString().toDouble().toInteger() + } + items << ["city":dist.city, "district":dist.region, "address":data['B'], "area":data['H'], "unitPrice":unitPrice, "totalPrice":totalPrice] } } - def time = new Date().getTime() - def resMap = ["id":"attachment_"+time, "title": "出售资产价格清单","type": 1,"editing": false,"items":items] - return resMap + if(items.size()>1){ + def time = new Date().getTime() + def resMap = ["id":"attachment_"+time, "title": "出售资产价格清单","type": 1,"editing": false,"items":items] + return [resMap] + } + return [] } @@ -556,5 +580,16 @@ class TestEvaluation { return result.toString() } + def createHouse(houses){ + def rets = [] + def i = 0 + def time = new Date().getTime() + for(def h : houses){ + def pdate = h.caseDate.replace("-","").substring(0,6) + rets << ["city":h.city, "district":h.district, "name":h.name, "publishDate":pdate, "unitPrice":h.unitPrice, "_uid":"sample_"+time+"_"+i,"source":h.source, "area":h.size, "distance":h.distance, "totalPrice":h.totalPrice] + i++ + } + return rets; + } } diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy index 7b8012be3..72e9652a6 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/util/OpenApiClient.groovy @@ -1617,20 +1617,20 @@ public class OpenApiClient { params.put("token", TOKEN); params.put("propertyType", propertyType) params.put("showSource", "1") -// if(minPrice){ -// params.put("minPrice", minPrice) -// } -// if(maxPrice){ -// params.put("maxPrice", maxPrice) -// } -// if(pageSize){ -// params.put("maxPrice", pageSize) -// } + if(minPrice){ + params.put("minPrice", minPrice.toString()) + } + if(maxPrice){ + params.put("maxPrice", maxPrice.toString()) + } + if(pageSize){ + params.put("pageSize", pageSize.toString()) + } - String content = new HttpRequest().get("http://open.fangjia.com/property/sellCase", params, "utf-8") + String content = new HttpRequest().get("http://localhost:8080/property/sellCase", params, "utf-8") JSONObject result = JSONObject.fromObject(content); while (result == null) { - result = HttpRequestUtil.getJsonContent("http://open.fangjia.com/property/sellCase", params, "utf-8") + result = HttpRequestUtil.getJsonContent("http://localhost:8080/property/sellCase", params, "utf-8") println("${city} ${name} 程序调用异常") Thread.sleep(6000) }