From 04fa70b5c61f927e4b5e3c85e9fe9e116d79102e Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 18 十一月 2025 17:09:10 +0800
Subject: [PATCH] 2025年11月18日17:09:03
---
app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 107 insertions(+), 10 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
index 76837f2..c63c146 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
@@ -24,7 +24,7 @@
public class HdlMessageLogic {
private static volatile HdlMessageLogic sHdlMessageLogic;
- private final int pageSize = 50;//椤垫暟
+ private final int pageSize = 100;//椤垫暟
private List<MessageBean> mListMessage = new ArrayList<>();
@@ -224,7 +224,7 @@
}
} catch (Exception e) {
String mes = e.getMessage();
- HdlLogLogic.print("--->" + mes);
+ HdlLogLogic.print("---" + mes);
}
}
@@ -255,7 +255,7 @@
}
} catch (Exception e) {
String mes = e.getMessage();
- HdlLogLogic.print("--->" + mes);
+ HdlLogLogic.print("---" + mes);
}
}
@@ -311,7 +311,7 @@
* @param cloudCallBeak -
*/
public void getMessageUntreatedCount(String homeId, CloudCallBeak<UnCountBean> cloudCallBeak) {
- String requestUrl = HttpApi.POST_Message_UntreatedCount;
+ String requestUrl = HttpApi.POST_Message_Plan_UntreatedCount;
JsonObject json = new JsonObject();
if (!TextUtils.isEmpty(homeId)) {
json.addProperty("homeId", homeId);
@@ -378,7 +378,7 @@
* @param cloudCallBeak -
*/
private void getMessageList(String messageStateType, CloudCallBeak<List<MessageBean>> cloudCallBeak) {
- String requestUrl = HttpApi.POST_Message_List;
+ String requestUrl = HttpApi.POST_Message_Plan_List;
JsonObject json = new JsonObject();
if (!MessageStateType.all.equals(messageStateType)) {
@@ -462,7 +462,7 @@
* @param cloudCallBeak -
*/
public void getPageNoMessageList(int pageNo, String messageStateType, CloudCallBeak<MessageListClass> cloudCallBeak) {
- String requestUrl = HttpApi.POST_Message_List;
+ String requestUrl = HttpApi.POST_Message_Plan_List;
JsonObject json = new JsonObject();
if (!MessageStateType.all.equals(messageStateType)) {
@@ -499,6 +499,7 @@
}
+
/**
* 鑾峰彇鎸囧畾椤电殑鑾峰彇娑堟伅鍒楄〃
*
@@ -509,10 +510,21 @@
* @param deviceType_filter_value deviceType锛圛NV 锛氶�嗗彉鍣紱BMS 锛欱MS鎺у埗鐩掞紱BATTERY 锛氱數姹犲崟鍏冿級锛�
* type锛團AULT 锛氭晠闅滐紱 WARN 锛氬憡璀︼紱 EVENT 锛氫簨浠�(鎻愮ず)锛夛紱
* timeType锛圱ODAY 锛氫粖澶╋紱LAST_3_DAYS: 杩�3澶╋紱LAST_7_DAYS 锛氳繎7澶╋紱LAST_30_DAYS 锛氳繎30澶╋級锛�
+ * @param search_title 鎶ヨ鍚嶇О
* @param 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, CloudCallBeak<MessageListClass> cloudCallBeak) {
- String requestUrl = HttpApi.POST_Message_List;
+ 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_Plan_List;
JsonObject json = new JsonObject();
if (!TextUtils.isEmpty(homeId)) {
json.addProperty("homeId", homeId);
@@ -528,6 +540,9 @@
}
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);//椤垫暟
@@ -567,7 +582,7 @@
* @param cloudCallBeak -
*/
public void getMessageInfo(String msgId, CloudCallBeak<MessageBean> cloudCallBeak) {
- String requestUrl = HttpApi.POST_Message_Info;
+ String requestUrl = HttpApi.POST_Message_Plan_Info;
JsonObject json = new JsonObject();
json.addProperty("msgId", msgId);
HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
@@ -632,7 +647,7 @@
* @param cloudCallBeak -
*/
public void messageAllRead(String homeId, CloudCallBeak<Boolean> cloudCallBeak) {
- String requestUrl = HttpApi.POST_Message_AllRead;
+ String requestUrl = HttpApi.POST_Message_Plan_AllRead;
JsonObject json = new JsonObject();
if (!TextUtils.isEmpty(homeId)) {
json.addProperty("homeId", homeId);
@@ -657,6 +672,88 @@
}
+ /**
+ * 鑾峰彇娑堟伅浣忓畢鍒楄〃
+ *
+ * @param homeName 鐢电珯鍚嶇О锛堟悳绱㈢敤鐨勶級,濡傛灉鏄┖瀛楃涓查粯璁よ鍙栧叏閮�
+ * @param cloudCallBeak -
+ */
+ public void getMessageHouseList(String homeName, CloudCallBeak<List<MessageBean>> cloudCallBeak) {
+ String requestUrl = HttpApi.POST_Message_Plan_homeListByPage;
+ JsonObject json = new JsonObject();
+
+ if (!TextUtils.isEmpty(homeName)) {
+ json.addProperty("homeName", homeName);
+ }
+ json.addProperty("pageNo", 1);//椤电爜
+ json.addProperty("pageSize", 500);//椤垫暟
+
+ final List<MessageBean> list = new ArrayList<>();
+ 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 ArrayList<>());
+ }
+ return;
+ }
+ Gson gson = new Gson();
+ MessageListClass oldMessageListClass = gson.fromJson(jsonStr, MessageListClass.class);
+ list.addAll(oldMessageListClass.getList());
+ //鎬诲叡鏈夊灏戦〉
+ long totalPage = oldMessageListClass.totalPage;
+ if (totalPage < 2) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(list);
+ }
+ return;
+ }
+ //璁板綍璇锋眰鏉℃暟
+ AtomicInteger atomicInteger = new AtomicInteger(0);
+ //浠庣浜岄〉鑾峰彇鏁版嵁
+ for (int i = 2; i <= totalPage; i++) {
+ json.addProperty("pageNo", i);//鏇存柊椤电爜
+ HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
+ @Override
+ public void onSuccess(String jsonStr) {
+ atomicInteger.set(atomicInteger.get() + 1);
+ MessageListClass newMessageListClass = gson.fromJson(jsonStr, MessageListClass.class);
+ list.addAll(newMessageListClass.getList());
+ if (atomicInteger.get() == totalPage - 1) {
+ //鏈�鍚庝竴鏉¢��鍑�
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(list);
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ atomicInteger.set(atomicInteger.get() + 1);
+ if (atomicInteger.get() == totalPage - 1) {
+ //鏈�鍚庝竴鏉¢��鍑�
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(list);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onFailure(e);
+ }
+ }
+ });
+
+
+ }
+
+
public static class MessageListClass {
//鎬绘潯鏁�
--
Gitblit v1.8.0