From fb79e70a672b199a8223b5e623637c24a66610ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Thu, 1 Aug 2024 09:56:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangjia/open/controllers/AddrSvcController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java index f368e6055..d5e0ffc43 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/AddrSvcController.java @@ -32,6 +32,7 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.DefaultProxyRoutePlanner; import org.apache.http.util.EntityUtils; +import org.sothis.core.util.CollectionUtils; import org.sothis.core.util.Pager; import sun.misc.BASE64Encoder; @@ -42,6 +43,7 @@ import java.net.PasswordAuthentication; import java.net.Proxy; import java.nio.charset.Charset; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -607,7 +609,8 @@ public class AddrSvcController { params.put("type", type); params.put("showFullValue", "2"); Pager pager = new Pager(1, 1); - VillageIdentify villageResult = villageIdentifyService.findAll(villageType, model.getCity(), model.getAddress(), pager).get(0); + List villageIdentifyList = villageIdentifyService.findAll(villageType, model.getCity(), model.getAddress(), pager); + VillageIdentify villageResult = CollectionUtils.isNotEmpty(villageIdentifyList) ? villageIdentifyList.get(0) : null; if (villageResult != null && StringUtils.isNotBlank(villageResult.getVerifyFlag())) { Map resultMap = new HashMap(); resultMap.put("province",villageResult.getProvince());