1;获取店铺名接口 解析报错问题处理

This commit is contained in:
wangshuai 2024-07-28 12:29:38 +08:00
parent 5e84bb7239
commit 0452fc3071
1 changed files with 19 additions and 19 deletions

View File

@ -603,19 +603,19 @@ public class MeituanServiceImpl implements IMeituanService {
String result = null;
try {
result = EntityUtils.toString(client.execute(request).getEntity());
if (result != null){
JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString(("code"));
if ("0".equals(code)) {
JSONObject data = jsonObject.getJSONObject("data");
JSONObject wmPoiData = data.getJSONObject("wmPoiData");
String wmPoiName = wmPoiData.getString("wmPoiName");
return wmPoiName;
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
if (result != null){
JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString(("code"));
if ("0".equals(code)) {
JSONObject data = jsonObject.getJSONObject("data");
JSONObject wmPoiData = data.getJSONObject("wmPoiData");
String wmPoiName = wmPoiData.getString("wmPoiName");
return wmPoiName;
}
}
return null;
}
@ -637,18 +637,18 @@ public class MeituanServiceImpl implements IMeituanService {
String result = null;
try {
result = EntityUtils.toString(client.execute(request).getEntity());
if (result != null){
JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString(("code"));
if ("0".equals(code)) {
JSONObject data = jsonObject.getJSONObject("data");
String wmPoiName = data.getString("wmPoiName");
return wmPoiName;
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
if (result != null){
JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString(("code"));
if ("0".equals(code)) {
JSONObject data = jsonObject.getJSONObject("data");
String wmPoiName = data.getString("wmPoiName");
return wmPoiName;
}
}
return null;
}
/**