|
|
@ -147,17 +147,19 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
|
* 获取百度天气
|
|
|
*/
|
|
|
public JSONObject getBaiduWeather(){
|
|
|
try {
|
|
|
String url = "https://api.map.baidu.com/weather/v1/?district_id=330100&data_type=now&ak=0vjnCSReegE7A47a941ohjv9a07ONiMC";
|
|
|
String response = httpClientUtil.get(url,"UTF-8");
|
|
|
JSONObject responseObj = JSONObject.parseObject(response);
|
|
|
if (responseObj.getInteger("status")==0){
|
|
|
JSONObject now = responseObj.getJSONObject("result").getJSONObject("now");
|
|
|
return now;
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
// try {
|
|
|
// String url = "https://api.map.baidu.com/weather/v1/?district_id=330100&data_type=now&ak=0vjnCSReegE7A47a941ohjv9a07ONiMC";
|
|
|
// String response = httpClientUtil.get(url,"UTF-8");
|
|
|
// JSONObject responseObj = JSONObject.parseObject(response);
|
|
|
// if (responseObj!=null&&responseObj.getInteger("status")!=null&&responseObj.getInteger("status")==0){
|
|
|
// if(responseObj.getJSONObject("result")!=null){
|
|
|
// JSONObject now = responseObj.getJSONObject("result").getJSONObject("now");
|
|
|
// return now;
|
|
|
// }
|
|
|
// }
|
|
|
// }catch (Exception e){
|
|
|
// e.printStackTrace();
|
|
|
// }
|
|
|
return new JSONObject();
|
|
|
}
|
|
|
|