From a543c926d2c994c96acd1923cecc5253d5cf45f2 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期日, 08 十月 2023 11:40:31 +0800 Subject: [PATCH] 2023年10月08日11:40:28 --- app/src/main/java/com/hdl/photovoltaic/internet/api/HttpApi.java | 2 +- app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java | 2 +- app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java | 41 ++++++++++++++++++++++++++++------------- 3 files changed, 30 insertions(+), 15 deletions(-) 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 8092d99..9e0bbf1 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 @@ -54,7 +54,7 @@ //region -----璁惧绠$悊--------- //娣诲姞閫嗗彉鍣� - public static final String POST_Device_Add = "/home-wisdom/app/device/independentRegister"; + public static final String POST_Device_Add = "/home-wisdom/program/device/independentRegister"; //鑾峰彇閫嗗彉鍣ㄥ垪琛� public static final String POST_Device_List = "/home-wisdom/app/device/inverter/list"; //鍒犻櫎閫嗗彉鍣� diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java index 39ee3a0..89a07ba 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java @@ -542,6 +542,12 @@ removeInverter(removeSidList.get(i)); } + for (int i = 0; i < list.size(); i++) { + CloudInverterDeviceBean cloudInverterDeviceBean = list.get(i); + GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(cloudInverterDeviceBean.getSid()); + objectAssignment(cloudInverterDeviceBean, gatewayBean); + } + if (cloudCallBeak != null) { cloudCallBeak.onSuccess(true); } @@ -573,19 +579,7 @@ CloudInverterDeviceBean cloudInverterDeviceBean = list.get(i); //浜戠瀵硅薄鏁版嵁浜ゆ崲鍒版湰鍦板璞� GatewayBean gatewayBean = new GatewayBean(); - gatewayBean.setOid(cloudInverterDeviceBean.getOid()); - gatewayBean.setSid(cloudInverterDeviceBean.getSid()); - gatewayBean.setGatewayId(cloudInverterDeviceBean.getGatewayId()); - gatewayBean.setOnline(cloudInverterDeviceBean.isOnline()); - gatewayBean.setDevice_mac(cloudInverterDeviceBean.getOsn());//璁惧mac - gatewayBean.setDevice_name(cloudInverterDeviceBean.getGatewayName()); - gatewayBean.setHomeId(UserConfigManage.getInstance().getHomeId()); - gatewayBean.setLocalEncrypt(true); - gatewayBean.setMaster("true"); - gatewayBean.setSystemStatusDesc(cloudInverterDeviceBean.getSystemStatusDesc()); - gatewayBean.setHwVersion(cloudInverterDeviceBean.getHwVersion()); - gatewayBean.setCategorySecondName(cloudInverterDeviceBean.getCategorySecondName()); - gatewayBean.setDeviceId(cloudInverterDeviceBean.getDeviceId()); + objectAssignment(cloudInverterDeviceBean, gatewayBean); //娣诲姞缃戝叧 HDLLinkLocalGateway.getInstance().getGatewayList().add(gatewayBean); @@ -631,6 +625,27 @@ HDLLinkLocalGateway.getInstance().refreshGatewayByHomeIdAndSpk(UserConfigManage.getInstance().getHomeId(), spks, true, gatewayCallBack); } + + private void objectAssignment(CloudInverterDeviceBean cloudInverterDeviceBean, GatewayBean gatewayBean) { + if (cloudInverterDeviceBean == null || gatewayBean == null) { + return; + } + gatewayBean.setOid(cloudInverterDeviceBean.getOid()); + gatewayBean.setSid(cloudInverterDeviceBean.getSid()); + gatewayBean.setGatewayId(cloudInverterDeviceBean.getGatewayId()); + gatewayBean.setOnline(cloudInverterDeviceBean.isOnline()); + gatewayBean.setDevice_mac(cloudInverterDeviceBean.getOsn());//璁惧mac + gatewayBean.setDevice_name(cloudInverterDeviceBean.getGatewayName()); + gatewayBean.setHomeId(UserConfigManage.getInstance().getHomeId()); + gatewayBean.setLocalEncrypt(true); + gatewayBean.setMaster("true"); + gatewayBean.setSystemStatusDesc(cloudInverterDeviceBean.getSystemStatusDesc()); + gatewayBean.setHwVersion(cloudInverterDeviceBean.getHwVersion()); + gatewayBean.setCategorySecondName(cloudInverterDeviceBean.getCategorySecondName()); + gatewayBean.setDeviceId(cloudInverterDeviceBean.getDeviceId()); + + } + /** * 鑾峰彇缃戝叧spk鍒楄〃 * diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java index 18a3270..9f38e75 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java @@ -219,7 +219,7 @@ HdlAccountLogic.getInstance().regionByAccount(account, new CloudCallBeak<HDLUserRegionBean>() { @Override public void onSuccess(HDLUserRegionBean obj) { - AppConfigManage.setUserRegionUrl("http://59.41.255.150:7777");//obj.getRegionUrl() + AppConfigManage.setUserRegionUrl(obj.getRegionUrl()); HDLLinkPMUser.getInstance().setUserRegionUrl(AppConfigManage.getUserRegionUrl()); HdlAccountLogic.getInstance().loginByPassword(account, password, new ILoginCallBack() { @Override -- Gitblit v1.8.0