| | |
| | | return new HashMap(); |
| | | } |
| | | } |
| | | |
| | | public static Map<String,Object> GetEquipmentAlertInfo(String url,String token,Integer id){ |
| | | OkHttpClient okHttpClient = new OkHttpClient(); |
| | | // MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); |
| | | // RequestBody formBody = RequestBody.create(mediaType, ""); |
| | | RequestBody formBody = new Builder() |
| | | .add("partid", String.valueOf(id)) |
| | | .build(); |
| | | Request request = new Request.Builder().url(url).post(formBody).addHeader("roadflow-token",token).build(); |
| | | Response response = null; |
| | | try { |
| | | response = okHttpClient.newCall(request).execute(); |
| | | } catch (IOException e1) { |
| | | // TODO Auto-generated catch block |
| | | e1.printStackTrace(); |
| | | } |
| | | |
| | | ResponseBody responseBody = response.body(); |
| | | |
| | | try { |
| | | String message = responseBody.string(); |
| | | System.out.println(message); |
| | | Map<String,Object> result = (Map<String, Object>) JSON.parse(message); |
| | | return result; |
| | | } catch (IOException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | return new HashMap(); |
| | | } |
| | | } |
| | | } |