use of itor.topnetwork.com.dxditor.hybrid.bean.spz.SpzEchartsBean in project Dxditor by kimi2009.
the class SpzModel method getTrendData.
@Override
public void getTrendData(final ValueCallBack<String> callBack, int position) {
spzTrends = new ArrayList<SpzTrend>();
if (Constants.testData) {
SpzEchartsBean spzBean = new SpzEchartsBean();
if (position == 0) {
for (int i = 0; i < 9; i++) {
spzTrends.add(new SpzTrend(Float.parseFloat("10" + i), "03-2" + i + " 08:00"));
}
} else if (position == 1) {
for (int i = 0; i < 9; i++) {
spzTrends.add(new SpzTrend(Float.parseFloat("8" + i), "03-2" + i + " 08:00"));
}
} else if (position == 2) {
for (int i = 0; i < 9; i++) {
spzTrends.add(new SpzTrend(Float.parseFloat("7" + i), "03-2" + i + " 08:00"));
}
}
List<String> time = new ArrayList<>();
for (int i = 0; i < spzTrends.size(); i++) {
time.add(spzTrends.get(i).getStorageTime());
}
spzBean.xData = time;
List<Float> lineDatas = new ArrayList<>();
for (int i = 0; i < spzTrends.size(); i++) {
lineDatas.add(spzTrends.get(i).getTypeData());
}
spzBean.seriesData = lineDatas;
callBack.onSuccess(gson.toJson(spzBean));
} else {
// Form表单格式的参数传递
FormBody formBody = new FormBody.Builder().add("bridgeCode", spzWarnings.get(position).getBridgeCode()).add("type", spzWarnings.get(position).getType()).add("storageTime", Constants.MONTH).build();
Request request = new Request.Builder().post(formBody).url(Constants.getAppSoundBarrierInfo).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("getAppSoundBarrierInfo:" + res);
try {
JSONObject js = new JSONObject(res);
if (js.getBoolean("success")) {
spzTrends = gson.fromJson(js.getString("data"), new TypeToken<ArrayList<SpzTrend>>() {
}.getType());
SpzEchartsBean spzBean = new SpzEchartsBean();
// bridgeBean.initValue =;
List<String> time = new ArrayList<>();
for (int i = 0; i < spzTrends.size(); i++) {
time.add(spzTrends.get(i).getStorageTime());
}
spzBean.xData = time;
List<Float> lineDatas = new ArrayList<>();
for (int i = 0; i < spzTrends.size(); i++) {
lineDatas.add(spzTrends.get(i).getTypeData());
}
spzBean.seriesData = lineDatas;
callBack.onSuccess(gson.toJson(spzBean));
} else {
callBack.onFail("01");
}
} catch (Exception e) {
callBack.onFail("01");
e.printStackTrace();
}
}
});
}
}
use of itor.topnetwork.com.dxditor.hybrid.bean.spz.SpzEchartsBean in project Dxditor by kimi2009.
the class EchartsDataBean method getInstance.
public static synchronized EchartsDataBean getInstance() {
if (okHttpClient == null) {
okHttpClient = new OkHttpClient();
echartsDataBean = new EchartsDataBean();
gson = new Gson();
lineBean = new EchartsLineBean();
barBean = new EchartsBarBean();
pieBean = new EchartsPieBean();
totalBean = new TotalBean();
bridgeBean = new BridgeBean();
spzEchartsBean = new SpzEchartsBean();
ztTopEchartsBean = new ZtTopEchartsBean();
}
return echartsDataBean;
}
Aggregations