| | |
| | | import android.text.TextUtils; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.other.HdlFileLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlResidenceLogic; |
| | | import com.hdl.photovoltaic.ui.bean.HouseInfoBean; |
| | | import com.hdl.photovoltaic.utils.SharedPreUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | private String userId; |
| | | //当前的住宅ID |
| | | private String homeId; |
| | | |
| | | |
| | | private String homeName; |
| | | //是否登录状态 |
| | | private boolean isLogin; |
| | | //本地通讯秘钥 |
| | | private String localSecret; |
| | | |
| | | //是否是B端账号登录 |
| | | //是否是B端账号登录(true=B端) |
| | | private boolean isB_account; |
| | | |
| | | |
| | |
| | | //判断当前时间点是否能够自动登录 |
| | | public boolean isAutoLogin() { |
| | | //7天内自动登录 |
| | | return ((System.currentTimeMillis() - loginDateTime) < 7 * 24 * 60 * 60); |
| | | return ((System.currentTimeMillis() - loginDateTime) < (7 * 24 * 60 * 60 * 1000)); |
| | | } |
| | | |
| | | //是否同意隐私政策 |
| | |
| | | //远程连接的Mqtt的客户端ID |
| | | public String connEmqClientId; |
| | | //当前登录的账号是不是之前的账号 |
| | | public boolean theSameLoginAccount; |
| | | private boolean theSameLoginAccount; |
| | | |
| | | //绑定手机号 |
| | | private String bingPhone; |
| | | //绑定邮箱 |
| | | private String bingEmail; |
| | | |
| | | //温度单位(C摄氏度;F=华氏度) |
| | | private String temperature_unit = "℃"; |
| | | |
| | | //app当前的语言 |
| | | private String currentAppLanguage; |
| | | |
| | | public String getCurrentAppLanguage() { |
| | | return currentAppLanguage; |
| | | } |
| | | |
| | | public void setCurrentAppLanguage(String currentAppLanguage) { |
| | | this.currentAppLanguage = currentAppLanguage; |
| | | } |
| | | |
| | | public String getTemperature_unit() { |
| | | return temperature_unit; |
| | | } |
| | | |
| | | public void setTemperature_unit(String temperature_unit) { |
| | | this.temperature_unit = temperature_unit; |
| | | } |
| | | |
| | | public String getBingPhone() { |
| | | return bingPhone == null ? "" : bingPhone; |
| | | } |
| | | |
| | | public void setBingPhone(String bingPhone) { |
| | | this.bingPhone = bingPhone; |
| | | } |
| | | |
| | | |
| | | public String getBingEmail() { |
| | | return bingEmail == null ? "" : bingEmail; |
| | | } |
| | | |
| | | public void setBingEmail(String bingEmail) { |
| | | this.bingEmail = bingEmail; |
| | | } |
| | | |
| | | /** |
| | | * 用户名称 |
| | | * |
| | | * @return - |
| | | */ |
| | | public String getUserName() { |
| | | |
| | | return TextUtils.isEmpty(userName) ? account : userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | private String userName;//用户名称 |
| | | |
| | | public String getRefreshToken() { |
| | | return refreshToken == null ? "" : refreshToken; |
| | |
| | | this.homeId = homeId; |
| | | } |
| | | |
| | | public String getHomeName() { |
| | | return homeName == null ? "" : homeName; |
| | | } |
| | | |
| | | public void setHomeName(String homeName) { |
| | | this.homeName = homeName; |
| | | } |
| | | |
| | | public boolean isAcceiptPolicy() { |
| | | return acceiptPolicy; |
| | | } |
| | |
| | | this.theSameLoginAccount = theSameLoginAccount; |
| | | } |
| | | |
| | | /** |
| | | * 是否是B端账号登录(true=B端) |
| | | * |
| | | * @return - |
| | | */ |
| | | public boolean isBAccount() { |
| | | return isB_account; |
| | | } |
| | |
| | | * 刷新 |
| | | */ |
| | | private void reFresh() { |
| | | String str = HdlFileLogic.getInstance().readFile(FILENAME); |
| | | String str = HdlFileLogic.getInstance().readFile(HdlFileLogic.getInstance().getUserFilePath()); |
| | | // String str =SharedPreUtils.getSharedPreferencesKey("UserConfigManage.json",HDLApp.getInstance()); |
| | | if (!TextUtils.isEmpty(str) && str.length() > 0) { |
| | | //读取保存的数据 |
| | | Gson gson = new Gson(); |
| | | sUserConfigManage = gson.fromJson(str, UserConfigManage.class); |
| | | if (sUserConfigManage == null) { |
| | | sUserConfigManage = new UserConfigManage(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存 |
| | | */ |
| | | public void Save() { |
| | | if (sUserConfigManage == null) { |
| | | HdlLogLogic.print("UserConfigManage", "保存用户信息文件失败"); |
| | | HdlLogLogic.print("UserConfigManage保存用户信息文件失败", false); |
| | | return; |
| | | } |
| | | Gson gson = new Gson(); |
| | | String json = gson.toJson(sUserConfigManage); |
| | | HdlFileLogic.getInstance().writeFile(FILENAME, json); |
| | | HdlFileLogic.getInstance().writeFile(HdlFileLogic.getInstance().getUserFilePath(), json); |
| | | // SharedPreUtils.saveMyDataInfo("UserConfigManage.json", json, HDLApp.getInstance()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Config文件名 |
| | | /// </summary> |
| | | private static final String FILENAME = "UserConfigManage.json"; |
| | | |
| | | |
| | | } |