From e0a5ebeb7ab4480a89cc22bc1093cea71046edd7 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 14 七月 2025 15:22:43 +0800 Subject: [PATCH] 2025年07月14日14:57:30 --- app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java | 4 + app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java | 2 + app/src/main/java/com/hdl/photovoltaic/ui/me/MeChangePasswordActivity.java | 7 ++- app/src/main/java/com/hdl/photovoltaic/other/HdlJpushLogic.java | 8 +++ app/src/main/java/com/hdl/photovoltaic/ui/me/UnregisterActivity.java | 3 + app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java | 5 +- app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java | 31 +++++++++++++++ app/src/main/java/com/hdl/photovoltaic/ui/me/SetActivity.java | 7 +++ app/src/main/java/com/hdl/photovoltaic/HDLApp.java | 7 +++ app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java | 26 +++++++++++- app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 3 + app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java | 5 +- 12 files changed, 92 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java index 17b3b7d..ae50d6e 100644 --- a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java +++ b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java @@ -20,6 +20,7 @@ import com.google.gson.Gson; import com.hdl.hdlhttp.HxHttpConfig; import com.hdl.linkpm.sdk.HDLLinkPMSdk; +import com.hdl.linkpm.sdk.core.exception.HDLException; import com.hdl.linkpm.sdk.user.HDLLinkPMUser; import com.hdl.linkpm.sdk.user.callback.IOnReloginListener; import com.hdl.linkpm.sdk.utils.HDLSDKSPUtils; @@ -28,6 +29,7 @@ import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.enums.LowerTagType; import com.hdl.photovoltaic.enums.NetworkType; +import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlDeviceLogic; import com.hdl.photovoltaic.other.HdlFileLogic; import com.hdl.photovoltaic.other.HdlLogLogic; @@ -234,6 +236,7 @@ HDLLinkPMUser.getInstance().setOnReloginListener(new IOnReloginListener() { @Override public void onReLogin(int type) { + if (100 == type) { new Handler().postDelayed(new Runnable() { @Override @@ -246,10 +249,12 @@ }, 500); } else { HdlLogLogic.print("鐩戝惉鍒扮櫥褰曢��鍑�---" + type, true); + //鍒犻櫎鎺ㄩ�乀oken +// HdlResidenceLogic.getInstance().pushDel(null); //type: 0:姝e父閫�鍑� 1锛氭瀬鍏夋帹閫佸己鍒堕��鍑� //鏀跺埌鐧诲綍澶勭悊閫氱煡锛屽叧闂墍鏈夐〉闈㈠苟鎵撳紑鐧诲綍椤甸潰 AppManagerUtils.getAppManager().finishAllActivity(); -// HDLSDKSPUtils.clear();//搴曞眰鑷繁娓呯┖ + // HDLSDKSPUtils.clear();//搴曞眰鑷繁娓呯┖ //娓呯┖浣忓畢id UserConfigManage.getInstance().setHomeId(""); diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java b/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java index 0e31d14..7024e93 100644 --- a/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java +++ b/app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java @@ -4,6 +4,8 @@ //娣诲姞鎺ㄩ�乀oken public static final String POST_push_add = "/smart-footstone/app/push-information/add"; + //鍒犻櫎鎺ㄩ�乀oken + public static final String POST_push_del = "/smart-footstone/app/push-information/delete"; //region **********銆怋绔�戝拰銆怌绔�戝叡鐢ㄦ帴鍙�********** //mqtt杩炴帴闇�瑕侊紙璇泙鎺ュ彛鍦板潃:https://hdl-gz.yuque.com/wnkbmh/cdrglh/totdnt#40b28997锛� diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java index 3956571..5cc4457 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java @@ -19,6 +19,7 @@ import com.hdl.photovoltaic.ui.bean.AuthorizationAccountBean; import com.hdl.photovoltaic.ui.bean.BUserInfo; import com.hdl.photovoltaic.ui.bean.CUserInfo; +import com.hdl.photovoltaic.utils.SharedPreUtils; import java.io.File; import java.lang.reflect.Type; @@ -499,7 +500,7 @@ * @param account 璐﹀彿 (鎵嬫満鎴栬�呴偖绠�) * @param loginPwd 瀵嗙爜 * @param verifyCode 楠岃瘉鐮� - * @param phonePrefix 鎵嬫満鍙峰墠缂� + * @param phonePrefix 鎵嬫満鍙峰墠缂� * @param cloudCallBeak - */ public void registerAccount_C(boolean isPhone, String account, String loginPwd, String verifyCode, String phonePrefix, CloudCallBeak<Boolean> cloudCallBeak) { @@ -543,7 +544,7 @@ * @param account 璐﹀彿 (鎵嬫満鎴栬�呴偖绠�) * @param loginPwd 鏂板瘑鐮� * @param verifyCode 楠岃瘉鐮� - * @param phonePrefix 鎵嬫満鍙峰墠缂� + * @param phonePrefix 鎵嬫満鍙峰墠缂� * @param cloudCallBeak - */ public void changePassword_C(boolean isPhone, String account, String loginPwd, String verifyCode, String phonePrefix, CloudCallBeak<Boolean> cloudCallBeak) { @@ -614,7 +615,7 @@ * * @param memberPhone 鎵嬫満鍙凤紙鏈粦瀹氭墜鏈哄彿鍙傛暟浼爊ull锛� * @param memberEmail 閭锛堟湭缁戝畾閭鍙傛暟浼爊ull锛� - * @param phonePrefix 鎵嬫満鍙峰墠缂� + * @param phonePrefix 鎵嬫満鍙峰墠缂� * @param verifyCode 楠岃瘉鐮� */ public void bindingAccount_C(String memberPhone, String memberEmail, String verifyCode, String phonePrefix, CloudCallBeak<Boolean> cloudCallBeak) { @@ -815,6 +816,25 @@ } /** + * 閫�鍑虹櫥褰� + */ + public void logout() { + HdlResidenceLogic.getInstance().pushDel(new CloudCallBeak<String>() { + @Override + public void onSuccess(String obj) { +// SharedPreUtils.putBoolean("pushAddCache", true); + HDLLinkPMUser.getInstance().logout(0); + } + + @Override + public void onFailure(HDLException e) { +// SharedPreUtils.putBoolean("pushAddCache", false); + HDLLinkPMUser.getInstance().logout(0); + } + }); + } + + /** * 鐧诲綍鎴愬姛淇濆瓨鐧诲綍淇℃伅 */ private void saveUserData(HDLLoginBean obj) { diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlJpushLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlJpushLogic.java index 4d43c80..611ad4c 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlJpushLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlJpushLogic.java @@ -11,6 +11,7 @@ import com.hdl.photovoltaic.jpush.JPushMessageInfoBean; import com.hdl.photovoltaic.ui.BPowerStationActivity; import com.hdl.photovoltaic.ui.bean.MessageBean; +import com.hdl.photovoltaic.utils.SharedPreUtils; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; import org.greenrobot.eventbus.EventBus; @@ -49,7 +50,7 @@ public void JpushPushCommonData(Context context, JPushMessageInfoBean jPushMessageInfoBean, boolean isOpened) { if (UserConfigManage.getInstance().isBAccount()) { //娣诲姞鎺ㄩ�佹暟鎹埌缂撳瓨鍒楄〃涓�; - this.addPushDataToMemoryList(jPushMessageInfoBean); +// this.addPushDataToMemoryList(jPushMessageInfoBean); if (isOpened) { //瀹夎鍟嗚烦杞晫闈� Intent intent = new Intent(context, BPowerStationActivity.class); @@ -100,6 +101,11 @@ */ private void addPushDataToMemoryList(JPushMessageInfoBean jPushMessageInfoBean) { try { + boolean isPushAddCache = SharedPreUtils.getBoolean("pushAddCache"); + if (!isPushAddCache) { + //鏈夊彲鑳藉垹闄ゆ帹閫乀oken鎺ュ彛澶辫触锛屾崲璐﹀彿鍚庯紝渚濈劧涔熶細鏀跺埌涓婃璐﹀彿鐨勬帹閫�; + return; + } if (TextUtils.isEmpty(jPushMessageInfoBean.getExpantContent())) { return; } diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java index afd5eaf..0c7bf1d 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlResidenceLogic.java @@ -1119,6 +1119,37 @@ } + /** + * 鍒犻櫎鎺ㄩ�乀oken + * + * @param cloudCallBeak - + */ + public void pushDel(CloudCallBeak<String> cloudCallBeak) { + String requestUrl = HttpApi.POST_push_del; + JsonObject json = new JsonObject(); + json.addProperty("pushId", UserConfigManage.getInstance().getPushId()); + json.addProperty("pushToken", UserConfigManage.getInstance().getRegistrationID()); + + HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { + @Override + public void onSuccess(String jsonStr) { + if (cloudCallBeak != null) { + cloudCallBeak.onSuccess(jsonStr); + } + + } + + @Override + public void onFailure(HDLException e) { + if (cloudCallBeak != null) { + cloudCallBeak.onFailure(e); + } + } + }); + + + } + public static class HouseBeanClass { //鎬绘潯鏁� diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java index 36530ca..c3b16be 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java @@ -714,7 +714,8 @@ //uni閫氱煡鍘熺敓閫�鍑虹櫥褰� case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOGOUT: { HdlLogLogic.print("uni閫氱煡鍘熺敓閫�鍑虹櫥褰�---", true); - HDLLinkPMUser.getInstance().logout(0); +// HDLLinkPMUser.getInstance().logout(0); + HdlAccountLogic.getInstance().logout(); } break; //鏈湴瀵嗛挜鑾峰彇 diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java index f348334..888a2ef 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/BPowerStationActivity.java @@ -282,14 +282,15 @@ } } if (!TextUtils.isEmpty(registrationID)) { - UserConfigManage.getInstance().setRegistrationID(registrationID); - UserConfigManage.getInstance().Save(); +// UserConfigManage.getInstance().setRegistrationID(registrationID); +// UserConfigManage.getInstance().Save(); String finalRegistrationID = registrationID; HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() { @Override public void onSuccess(String pushId) { if (!TextUtils.isEmpty(pushId)) { + UserConfigManage.getInstance().setRegistrationID(finalRegistrationID); UserConfigManage.getInstance().setPushId(pushId); UserConfigManage.getInstance().Save(); } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java index bdb7fd7..f4b38e3 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java @@ -357,14 +357,15 @@ } } if (!TextUtils.isEmpty(registrationID)) { - UserConfigManage.getInstance().setRegistrationID(registrationID); - UserConfigManage.getInstance().Save(); +// UserConfigManage.getInstance().setRegistrationID(registrationID); +// UserConfigManage.getInstance().Save(); String finalRegistrationID = registrationID; HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() { @Override public void onSuccess(String pushId) { if (!TextUtils.isEmpty(pushId)) { + UserConfigManage.getInstance().setRegistrationID(finalRegistrationID); UserConfigManage.getInstance().setPushId(pushId); UserConfigManage.getInstance().Save(); } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/me/MeChangePasswordActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/me/MeChangePasswordActivity.java index 2798636..f0e31e5 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/me/MeChangePasswordActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/me/MeChangePasswordActivity.java @@ -124,7 +124,6 @@ * @param newPsw 鏂板瘑鐮� */ private void sendChangePassword(String oldPsw, String newPsw) { - if (UserConfigManage.getInstance().isBAccount()) { //B绔洿鏀逛釜浜哄瘑鐮� HdlAccountLogic.getInstance().updatePassword_B(oldPsw, newPsw, new CloudCallBeak<String>() { @@ -132,7 +131,8 @@ public void onSuccess(String str) { HdlLogLogic.print("B绔洿鏀逛釜浜哄瘑鐮侀��鍑虹櫥褰�--->", true); // HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_pws_reset_succeeded), 0); - HDLLinkPMUser.getInstance().logout(0); +// HDLLinkPMUser.getInstance().logout(0); + HdlAccountLogic.getInstance().logout(); } @Override @@ -146,7 +146,8 @@ @Override public void onSuccess(String obj) { HdlLogLogic.print("C绔洿鏀逛釜浜哄瘑鐮侀��鍑虹櫥褰�--->", true); - HDLLinkPMUser.getInstance().logout(0); +// HDLLinkPMUser.getInstance().logout(0); + HdlAccountLogic.getInstance().logout(); } diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/me/SetActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/me/SetActivity.java index 5c0183d..380d866 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/me/SetActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/me/SetActivity.java @@ -7,13 +7,17 @@ import androidx.annotation.Nullable; +import com.hdl.linkpm.sdk.core.exception.HDLException; import com.hdl.linkpm.sdk.user.HDLLinkPMUser; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.base.CustomBaseActivity; import com.hdl.photovoltaic.config.AppConfigManage; import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.databinding.ActivitySetBinding; +import com.hdl.photovoltaic.listener.CloudCallBeak; +import com.hdl.photovoltaic.other.HdlAccountLogic; import com.hdl.photovoltaic.other.HdlLogLogic; +import com.hdl.photovoltaic.other.HdlResidenceLogic; import com.hdl.photovoltaic.ui.test.TestMainActivity; import com.hdl.photovoltaic.utils.LocalManageUtil; import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; @@ -168,7 +172,8 @@ public void Confirm() { dialog.dismiss(); HdlLogLogic.print("璁剧疆鐣岄潰閫�鍑虹櫥褰�---", true); - HDLLinkPMUser.getInstance().logout(0); + HdlAccountLogic.getInstance().logout(); + } }); dialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/me/UnregisterActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/me/UnregisterActivity.java index 638505e..25b6efc 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/me/UnregisterActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/me/UnregisterActivity.java @@ -113,7 +113,8 @@ public void Confirm() { dialog.dismiss(); HdlLogLogic.print("娉ㄩ攢璐﹀彿閫�鍑虹櫥褰�---", true); - HDLLinkPMUser.getInstance().logout(0); +// HDLLinkPMUser.getInstance().logout(0); + HdlAccountLogic.getInstance().logout(); } }); dialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { diff --git a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java index 9d28b39..9a111c7 100644 --- a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java +++ b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java @@ -17,6 +17,7 @@ import com.hdl.photovoltaic.config.AppConfigManage; import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.enums.LowerTagType; +import com.hdl.photovoltaic.other.HdlAccountLogic; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; @@ -176,7 +177,8 @@ HdlLogLogic.print("鏀跺埌灏忕▼搴忛�氱煡,鍥炶皟浜嬩欢涓簄ull,鏃犳硶鍥炶皟浜嬩欢骞舵墽琛屼笟鍔¢�昏緫---event=" + event + "\r\n" + "data=" + data, true); //鏈夊彲鑳芥槸绯荤粺鍥炴敹鎺塧ctivity瀵艰嚧鍥炶皟涓簄ull锛岃繖鏍锋儏鍐典笅寮哄埗杩斿洖鐧诲綍鐣岄潰锛� //todo 闀挎椂闂存病鍝嶅簲灏嗛��鍑虹櫥褰曠晫闈㈤噸鏂扮櫥褰� - HDLLinkPMUser.getInstance().logout(0); +// HDLLinkPMUser.getInstance().logout(0); + HdlAccountLogic.getInstance().logout(); } } } -- Gitblit v1.8.0