Merge branch 'master' of http://gitlab.fangjia.com/dev0/main
This commit is contained in:
+8
-7
@@ -45,7 +45,7 @@ try {
|
||||
// 3. 修改表头,添加结果列
|
||||
allData[0] = ["序号", "城市", "地址", "返回城市", "返回区域", "返回街道","返回道路","返回门牌号",
|
||||
"小区名称", "物业类型", "匹配级别", "匹配置信度",
|
||||
"参考价格", "典型总价", "更新时间", "耗时(ms)", "异常信息"]
|
||||
"参考价格", "典型总价", "更新时间", "耗时(ms)", "异常信息", "周边一公里住宅均价"]
|
||||
|
||||
// 4. 为每一行数据添加空的结果列
|
||||
for (int i = 1; i < allData.size(); i++) {
|
||||
@@ -61,10 +61,10 @@ try {
|
||||
|
||||
// 6. 使用 ExcelUtils.multiThreadingModify 多线程调用接口
|
||||
println "\n开始多线程测试接口..."
|
||||
println "接口地址:http://localhost:9180/efund/match"
|
||||
println "接口地址:http://open.fangjia.com/efund/match"
|
||||
println "线程数:CPU核心数 × 4 = ${Runtime.getRuntime().availableProcessors() * 4}"
|
||||
|
||||
ExcelUtils.multiThreadingModify(outputFile, { List row ->
|
||||
ExcelUtils.modify(outputFile, { List row ->
|
||||
HttpRequest request = new HttpRequest()
|
||||
long startTime = System.currentTimeMillis()
|
||||
|
||||
@@ -79,7 +79,7 @@ try {
|
||||
params.put("city", city)
|
||||
}
|
||||
|
||||
String response = request.get("http://localhost:9180/efund/match", params, "UTF-8")
|
||||
String response = request.get("http://open.fangjia.com/efund/match", params, "UTF-8")
|
||||
long duration = System.currentTimeMillis() - startTime
|
||||
|
||||
// 解析响应
|
||||
@@ -103,6 +103,7 @@ try {
|
||||
row[14] = result.optString("update_time", "")
|
||||
row[15] = duration
|
||||
row[16] = "" // 无异常
|
||||
row[17] = result.optString("residential_1km_price", "")
|
||||
} else {
|
||||
// 接口返回异常
|
||||
row[15] = duration
|
||||
@@ -138,13 +139,13 @@ try {
|
||||
List row = finalData[i]
|
||||
|
||||
// 统计成功/失败
|
||||
String errorMsg = row[14]?.toString() ?: ""
|
||||
String errorMsg = row[16]?.toString() ?: ""
|
||||
if (errorMsg == "") {
|
||||
successCount++
|
||||
|
||||
// 统计耗时
|
||||
if (row[13] instanceof Number) {
|
||||
int duration = ((Number)row[13]).intValue()
|
||||
if (row[15] instanceof Number) {
|
||||
int duration = ((Number)row[15]).intValue()
|
||||
totalTime += duration
|
||||
|
||||
// 耗时分布
|
||||
|
||||
Reference in New Issue
Block a user