| | |
| | | import com.hdl.photovoltaic.listener.BaseSuccessFailureCallBeak; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean; |
| | | import com.hdl.photovoltaic.ui.bean.ContactBean; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceBean; |
| | | import com.hdl.photovoltaic.ui.bean.HouseInfoBean; |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | import com.hdl.photovoltaic.ui.bean.StatusOverviewBean; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkException; |
| | | import com.hdl.sdk.link.core.bean.gateway.GatewayBean; |
| | | import com.hdl.sdk.link.core.callback.GatewayCallBack; |
| | |
| | | } |
| | | |
| | | public void clearHouseList() { |
| | | if (houseInfoList == null) { |
| | | return; |
| | | if (mHouseIdList != null && mHouseIdList.size() > 0) { |
| | | mHouseIdList.clear(); |
| | | } |
| | | if (houseInfoList.size() > 0) { |
| | | if (houseInfoList != null && houseInfoList.size() > 0) { |
| | | houseInfoList.clear(); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 获取住宅(电站)ID列表 |
| | | * |
| | | * @param key 发电功率排序(powerSort); |
| | | * 今日发电量排序(todayElectricitySort); |
| | | * 创建时间排序(createTimeSort); |
| | | * @param keyValue (descending:降序 |
| | | * ascending:升序), |
| | | * @param pageNo 页码 |
| | | * @param pageSize 页数(一页多少数据) |
| | | * @param key 发电功率排序(powerSort); |
| | | * 今日发电量排序(todayElectricitySort); |
| | | * 创建时间排序(createTimeSort); |
| | | * @param keyValue (descending:降序 |
| | | * ascending:升序), |
| | | * @param installedCapacityMin 最小组串容量(装机容量) |
| | | * @param installedCapacityMax 最大组串容量(装机容量) |
| | | * @param gridType 并网状态 (全部 :"";FULL_GRID : 并网;OFFLINE :离网) |
| | | * @param powerStationStatus 电站状态 (全部 :"";1 : 正常;2 : 离线; 3 : 待接入;4 : 故障) |
| | | * @param pageNo 页码 |
| | | * @param pageSize 页数(一页多少数据) |
| | | */ |
| | | public void getResidenceIdList(String key, String keyValue, long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) { |
| | | public void getResidenceIdList( |
| | | String key, |
| | | String keyValue, |
| | | String installedCapacityMin, |
| | | String installedCapacityMax, |
| | | String gridType, |
| | | String powerStationStatus, |
| | | long pageNo, long pageSize, CloudCallBeak<HouseBeanClass> cloudCallBeak) { |
| | | |
| | | String requestUrl = HttpApi.POST_PowerStation_List; |
| | | JsonObject json = new JsonObject(); |
| | | if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(keyValue)) { |
| | | json.addProperty(key, keyValue);//发电功率排序(descending:降序ascending:升序) |
| | | } |
| | | if (!TextUtils.isEmpty(installedCapacityMin)) { |
| | | try { |
| | | int value = Integer.parseInt(installedCapacityMin);//可能有异常,用户输入值超时int最大致导致的 |
| | | json.addProperty("installedCapacityMin", value); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | if (!TextUtils.isEmpty(installedCapacityMax)) { |
| | | try { |
| | | int value = Integer.parseInt(installedCapacityMax);//可能有异常,用户输入值超时int最大致导致的 |
| | | json.addProperty("installedCapacityMax", value); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | if (!TextUtils.isEmpty(gridType)) { |
| | | try { |
| | | json.addProperty("gridType", gridType); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | if (!TextUtils.isEmpty(powerStationStatus)) { |
| | | try { |
| | | int value = Integer.parseInt(powerStationStatus); |
| | | json.addProperty("powerStationStatus", value); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | // json.addProperty("zoneType", "password");//区域 |
| | | json.addProperty("pageNo", pageNo);//页码 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 电站状态概览(安装商) |
| | | */ |
| | | public void getStatusOverview(CloudCallBeak<StatusOverviewBean> cloudCallBeak) { |
| | | String requestUrl = HttpApi.POST_statusOverview; |
| | | JsonObject json = new JsonObject(); |
| | | // json.addProperty("zoneType", zoneType);//区域 |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String jsonStr) { |
| | | if (TextUtils.isEmpty(jsonStr)) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(new StatusOverviewBean()); |
| | | } |
| | | } |
| | | Gson gson = new Gson(); |
| | | StatusOverviewBean statusOverviewBean = gson.fromJson(jsonStr, StatusOverviewBean.class); |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(statusOverviewBean); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 添加住宅(电站)到云端 |
| | | * |
| | | * @param houseInfoBean - |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 联系我们 |
| | | * |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void getResidenceUtilContact(CloudCallBeak<ContactBean> cloudCallBeak) { |
| | | String requestUrl = HttpApi.B_POST_GET_UTIL_CONTACT; |
| | | JsonObject json = new JsonObject(); |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String jsonStr) { |
| | | if (TextUtils.isEmpty(jsonStr)) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(new ContactBean()); |
| | | return; |
| | | } |
| | | } |
| | | ContactBean contactBean = new Gson().fromJson(jsonStr, ContactBean.class); |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(contactBean); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onFailure(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取用户自定义配置温度单位详情 |
| | | * |
| | |
| | | JsonObject json = new JsonObject(); |
| | | // json.addProperty("homeId", homeId); |
| | | |
| | | List<MessageBean> list = new ArrayList<>(); |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String jsonStr) { |