use of itor.topnetwork.com.dxditor.bean.SpzWarning in project Dxditor by kimi2009.
the class SpzModel method getWarningData.
@Override
public void getWarningData(final ValueCallBack<ArrayList<SpzWarning>> callBack) {
if (Constants.testData) {
ArrayList<SpzWarning> temp = new ArrayList<SpzWarning>();
temp.add(new SpzWarning("", "京津线03号桥梁声屏障(2米处)声屏障位移", "120", "", "mm"));
temp.add(new SpzWarning("", "丰沙线11号桥梁声屏障(0.9米处)声屏障位移", "80", "", "mm"));
temp.add(new SpzWarning("", "京包线19号桥梁声屏障(2.4米处)声屏障位移", "74", "", "mm"));
spzWarnings = temp;
callBack.onSuccess(spzWarnings);
} else {
/*//Form表单格式的参数传递
FormBody formBody = new FormBody
.Builder()
.add("bridgeCode", Constants.BRIDGECODE)//设置参数名称和参数值
.build();*/
Request request = new Request.Builder().url(Constants.getAppSoundBarrierNewOneAlarm).build();
okHttpClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String res = response.body().string();
System.out.println("getAppSoundBarrierNewOneAlarm:" + res);
try {
JSONObject js = new JSONObject(res);
if (js.getBoolean("success")) {
spzWarnings = gson.fromJson(js.getString("data"), new TypeToken<ArrayList<SpzWarning>>() {
}.getType());
callBack.onSuccess(spzWarnings);
} else {
callBack.onFail("01");
}
} catch (Exception e) {
callBack.onFail("01");
e.printStackTrace();
}
}
});
}
}
Aggregations