jdk版本升级,数据跑完后,需还原

This commit is contained in:
2025-12-26 08:16:54 +08:00
parent 5abf2ddaaa
commit 54f0b7f2a0
3 changed files with 141 additions and 100 deletions
@@ -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;
}
}
@@ -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)
}