From c09f79b3f0c32b09520b7d4ff948aa8aae222a69 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 07 六月 2024 12:05:11 +0800
Subject: [PATCH] 2024年06月07日12:05:03
---
app/src/main/java/com/hdl/photovoltaic/ui/bean/StaffBean.java | 51 ++++++++++
app/src/main/java/com/hdl/photovoltaic/other/HdlMemberLogic.java | 231 ++++++++++++++++++++++++++++++++++++++++++++++
app/src/main/java/com/hdl/photovoltaic/ui/bean/SocialContributionBean.java | 4
3 files changed, 285 insertions(+), 1 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlMemberLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlMemberLogic.java
new file mode 100644
index 0000000..38c7558
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlMemberLogic.java
@@ -0,0 +1,231 @@
+package com.hdl.photovoltaic.other;
+
+import android.text.TextUtils;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.google.gson.reflect.TypeToken;
+import com.hdl.linkpm.sdk.core.exception.HDLException;
+import com.hdl.linkpm.sdk.user.HDLLinkPMUser;
+import com.hdl.linkpm.sdk.user.bean.HDLLoginBean;
+import com.hdl.linkpm.sdk.user.callback.ILoginCallBack;
+import com.hdl.photovoltaic.bean.PageNumberObject;
+import com.hdl.photovoltaic.config.UserConfigManage;
+import com.hdl.photovoltaic.internet.HttpClient;
+import com.hdl.photovoltaic.internet.api.HttpApi;
+import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean;
+import com.hdl.photovoltaic.ui.bean.StaffBean;
+
+import java.lang.reflect.Type;
+import java.util.List;
+
+/**
+ * 鎴愬憳閫昏緫
+ */
+public class HdlMemberLogic {
+ private static volatile HdlMemberLogic sHdlMemberLogic;
+
+ /**
+ * 鑾峰彇褰撳墠瀵硅薄
+ *
+ * @return HdlAccountLogic
+ */
+ public static synchronized HdlMemberLogic getInstance() {
+ if (sHdlMemberLogic == null) {
+ synchronized (HdlMemberLogic.class) {
+ if (sHdlMemberLogic == null) {
+ sHdlMemberLogic = new HdlMemberLogic();
+ }
+ }
+
+ }
+ return sHdlMemberLogic;
+ }
+
+ /**
+ * 鑾峰彇鍛樺伐鍒楄〃
+ *
+ * @param pageNo 椤电爜
+ * @param pageSize 椤垫暟锛堜竴椤靛灏戞暟鎹級
+ * @param cloudCallBeak -
+ */
+ public void getStaffList(long pageNo, long pageSize, CloudCallBeak<PageNumberObject<List<StaffBean>>> cloudCallBeak) {
+ String requestUrl = "/home-wisdom/app/powerStation/user/manage/listByPage";// HttpApi.POST_PowerStation_List;
+ JsonObject json = new JsonObject();
+ json.addProperty("pageNo", pageNo);
+ json.addProperty("pageSize", pageNo);
+ 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 PageNumberObject<>());
+ }
+ }
+ Gson gson = new Gson();
+ Type type = new TypeToken<PageNumberObject<List<StaffBean>>>() {
+ }.getType();
+ PageNumberObject<List<StaffBean>> pageNumberObject = gson.fromJson(jsonStr, type);
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(pageNumberObject);
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onFailure(e);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * 鑾峰彇鍛樺伐璇︽儏
+ *
+ * @param userId -
+ * @param cloudCallBeak -
+ */
+ public void getStaffInfo(String userId, CloudCallBeak<PageNumberObject<StaffBean>> cloudCallBeak) {
+ String requestUrl = "/home-wisdom/app/powerStation/user/manage/info";// HttpApi.POST_PowerStation_List;
+ JsonObject json = new JsonObject();
+ json.addProperty("userId", userId);
+ 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 PageNumberObject<>());
+ }
+ }
+ Gson gson = new Gson();
+ Type type = new TypeToken<PageNumberObject<StaffBean>>() {
+ }.getType();
+ PageNumberObject<StaffBean> pageNumberObject = gson.fromJson(jsonStr, type);
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(pageNumberObject);
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onFailure(e);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * 鍛樺伐娣诲姞
+ *
+ * @param staffBean 鍛樺伐瀵硅薄
+ * @param cloudCallBeak -
+ */
+ public void getStaffAdd(StaffBean staffBean, CloudCallBeak<Boolean> cloudCallBeak) {
+ String requestUrl = "/home-wisdom/app/powerStation/user/manage/create";// HttpApi.POST_PowerStation_List;
+ JsonObject json = new JsonObject();
+ if (!TextUtils.isEmpty(staffBean.getUserName())) {
+ json.addProperty("userName", staffBean.getUserName());
+ }
+ if (staffBean.getUserSex() != 0) {
+ json.addProperty("userSex", staffBean.getUserSex());
+ }
+ if (!TextUtils.isEmpty(staffBean.getUserPhone())) {
+ json.addProperty("userPhone", staffBean.getUserPhone());
+ }
+ if (!TextUtils.isEmpty(staffBean.getUserEmail())) {
+ json.addProperty("userEmail", staffBean.getUserEmail());
+ }
+ HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
+ @Override
+ public void onSuccess(String jsonStr) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(true);
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onFailure(e);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * 鍛樺伐缂栬緫
+ *
+ * @param staffBean 鍛樺伐瀵硅薄
+ * @param cloudCallBeak -
+ */
+ public void getStaffEdit(StaffBean staffBean, CloudCallBeak<Boolean> cloudCallBeak) {
+ String requestUrl = "/home-wisdom/app/powerStation/user/manage/edit";// HttpApi.POST_PowerStation_List;
+ JsonObject json = new JsonObject();
+ if (!TextUtils.isEmpty(staffBean.getUserId())) {
+ json.addProperty("userId", staffBean.getUserId());
+ }
+ if (!TextUtils.isEmpty(staffBean.getUserName())) {
+ json.addProperty("userName", staffBean.getUserName());
+ }
+ if (staffBean.getUserSex() != 0) {
+ json.addProperty("userSex", staffBean.getUserSex());
+ }
+ if (!TextUtils.isEmpty(staffBean.getUserPhone())) {
+ json.addProperty("userPhone", staffBean.getUserPhone());
+ }
+ if (!TextUtils.isEmpty(staffBean.getUserEmail())) {
+ json.addProperty("userEmail", staffBean.getUserEmail());
+ }
+ HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
+ @Override
+ public void onSuccess(String jsonStr) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(true);
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onFailure(e);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * 鍛樺伐鍒犻櫎
+ *
+ * @param staffBean 鍛樺伐瀵硅薄
+ * @param cloudCallBeak -
+ */
+ public void getStaffDelete(StaffBean staffBean, CloudCallBeak<Boolean> cloudCallBeak) {
+ String requestUrl = "/home-wisdom/app/powerStation/user/manage/delete";// HttpApi.POST_PowerStation_List;
+ JsonObject json = new JsonObject();
+ json.addProperty("userId", staffBean.getUserId());
+
+ HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
+ @Override
+ public void onSuccess(String jsonStr) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(true);
+ }
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onFailure(e);
+ }
+ }
+ });
+
+ }
+}
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/bean/SocialContributionBean.java b/app/src/main/java/com/hdl/photovoltaic/ui/bean/SocialContributionBean.java
index 473a94a..da013d8 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/bean/SocialContributionBean.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/bean/SocialContributionBean.java
@@ -1,9 +1,11 @@
package com.hdl.photovoltaic.ui.bean;
+import java.io.Serializable;
+
/**
* 绀句細璐$尞瀹炰綋绫�
*/
-public class SocialContributionBean {
+public class SocialContributionBean implements Serializable {
private String coal;//鑺傜害鏍囧噯鐓�
private String co2;//CO2鍑忔帓閲�
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/bean/StaffBean.java b/app/src/main/java/com/hdl/photovoltaic/ui/bean/StaffBean.java
new file mode 100644
index 0000000..7fb184c
--- /dev/null
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/bean/StaffBean.java
@@ -0,0 +1,51 @@
+package com.hdl.photovoltaic.ui.bean;
+
+import java.io.Serializable;
+
+public class StaffBean implements Serializable {
+ private String userId;//鐢ㄦ埛ID
+ private String userName;//鐢ㄦ埛鍚嶇О
+ private String userPhone;//鐢ㄦ埛鎵嬫満鍙�
+ private String userEmail;//鐢ㄦ埛閭
+ private int userSex;//鐢ㄦ埛鎬у埆(1锛氱敺,2锛氬コ)
+
+ public String getUserId() {
+ return userId == null ? "" : userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserName() {
+ return userName == null ? "" : userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getUserPhone() {
+ return userPhone == null ? "" : userPhone;
+ }
+
+ public void setUserPhone(String userPhone) {
+ this.userPhone = userPhone;
+ }
+
+ public String getUserEmail() {
+ return userEmail == null ? "" : userEmail;
+ }
+
+ public void setUserEmail(String userEmail) {
+ this.userEmail = userEmail;
+ }
+
+ public int getUserSex() {
+ return userSex;
+ }
+
+ public void setUserSex(int userSex) {
+ this.userSex = userSex;
+ }
+}
--
Gitblit v1.8.0