| | |
| | | import com.hdl.photovoltaic.internet.api.HttpApi; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | import com.hdl.photovoltaic.ui.bean.UnCountBean; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | |
| | | public class HdlMessageLogic { |
| | | private static volatile HdlMessageLogic sHdlMessageLogic; |
| | | |
| | | private final int pageSize = 50;//页数 |
| | | private final int pageSize = 100;//页数 |
| | | private List<MessageBean> mListMessage = new ArrayList<>(); |
| | | |
| | | |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | String mes = e.getMessage(); |
| | | HdlLogLogic.print("--->" + mes); |
| | | HdlLogLogic.print("---" + mes); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | String mes = e.getMessage(); |
| | | HdlLogLogic.print("--->" + mes); |
| | | HdlLogLogic.print("---" + mes); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void getMessageUntreatedCount(String homeId, CloudCallBeak<String> cloudCallBeak) { |
| | | public void getMessageUntreatedCount(String homeId, CloudCallBeak<UnCountBean> cloudCallBeak) { |
| | | String requestUrl = HttpApi.POST_Message_UntreatedCount; |
| | | JsonObject json = new JsonObject(); |
| | | if (!TextUtils.isEmpty(homeId)) { |
| | |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String str) { |
| | | if (TextUtils.isEmpty(str)) { |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(new UnCountBean()); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | UnCountBean unCountBean = new Gson().fromJson(str, UnCountBean.class); |
| | | if (cloudCallBeak != null) { |
| | | cloudCallBeak.onSuccess(str); |
| | | cloudCallBeak.onSuccess(unCountBean); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取指定页的获取消息列表(用于C端) |
| | | * 获取指定页的获取消息列表 |
| | | * |
| | | * @param homeId 电站id |
| | | * @param homeId 电站id(填""默认账号下所有消息) |
| | | * @param pageNo 页码 |
| | | * @param messageStateType all:全部,UNTREATED:未处理,PROCESSED:已处理; |
| | | * @param deviceType_filter_key 类型(设备,等级,时间) |
| | | * @param deviceType_filter_value deviceType(INV :逆变器;BMS :BMS控制盒;BATTERY :电池单元); |
| | | * type(FAULT :故障; WARN :告警; EVENT :事件(提示)); |
| | | * timeType(TODAY :今天;LAST_3_DAYS: 近3天;LAST_7_DAYS :近7天;LAST_30_DAYS :近30天); |
| | | * @param search_title 报警名称 |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void getPageNoMessageList_C(String homeId, int pageNo, String messageStateType, String deviceType_filter_key, String deviceType_filter_value, String type_filter_key, String type_filter_value, String timeType_filter_key, String timeType_filter_value, CloudCallBeak<MessageListClass> cloudCallBeak) { |
| | | public void getPageNoMessageList( |
| | | String homeId, |
| | | int pageNo, |
| | | String messageStateType, |
| | | String deviceType_filter_key, |
| | | String deviceType_filter_value, |
| | | String type_filter_key, |
| | | String type_filter_value, |
| | | String timeType_filter_key, |
| | | String timeType_filter_value, |
| | | String search_title, CloudCallBeak<MessageListClass> cloudCallBeak) { |
| | | String requestUrl = HttpApi.POST_Message_List; |
| | | JsonObject json = new JsonObject(); |
| | | if (!TextUtils.isEmpty(homeId)) { |
| | |
| | | } |
| | | if (!TextUtils.isEmpty(timeType_filter_key) && !TextUtils.isEmpty(timeType_filter_value)) { |
| | | json.addProperty(timeType_filter_key, timeType_filter_value); |
| | | } |
| | | if (!TextUtils.isEmpty(search_title)) { |
| | | json.addProperty("title", search_title); |
| | | } |
| | | json.addProperty("pageNo", pageNo);//页码 |
| | | json.addProperty("pageSize", pageSize);//页数 |
| | |
| | | /** |
| | | * 消息全部已读 |
| | | * |
| | | * @param homeId 消息id |
| | | * @param homeId 消息id(不传已读所有电站的,传值已读指定电站的) |
| | | * @param cloudCallBeak - |
| | | */ |
| | | public void messageAllRead(String homeId, CloudCallBeak<Boolean> cloudCallBeak) { |
| | | String requestUrl = HttpApi.POST_Message_AllRead; |
| | | JsonObject json = new JsonObject(); |
| | | json.addProperty("homeId", homeId); |
| | | if (!TextUtils.isEmpty(homeId)) { |
| | | json.addProperty("homeId", homeId); |
| | | } |
| | | HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String str) { |