From 42d9bfd2ec530f263da8a10a4639949adf3b6015 Mon Sep 17 00:00:00 2001 From: Liuyf Date: Wed, 12 Mar 2025 11:01:55 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=E5=9C=A8=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=BD=91=E5=85=B3=E7=95=8C=E9=9D=A2=E5=BD=93=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=87=BA=E7=BD=91=E5=85=B3=E6=97=B6=E7=BD=91=E5=85=B3=E6=8B=94?= =?UTF-8?q?=E6=8E=89=E7=94=B5=E6=BA=90=EF=BC=8C=E5=B7=A6=E4=B8=8A=E9=94=AE?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=86=8D=E7=82=B9=E4=B8=8B=E4=B8=80=E6=AD=A5?= =?UTF-8?q?=E5=BA=94=E6=B2=A1=E6=9C=89=E8=AF=A5=E7=BD=91=E5=85=B3=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../remoteUnlocking/remoteUnlocking_page.dart | 17 ++++-- .../gatewayDetail/gatewayDetail_logic.dart | 10 ++++ .../gatewayDetail/gatewayDetail_page.dart | 2 + .../selectGetewayList_entity.dart | 58 ++++++++++++++----- lib/network/api.dart | 1 + lib/network/api_provider.dart | 8 ++- lib/network/api_repository.dart | 12 +++- pubspec.lock | 8 +++ 8 files changed, 92 insertions(+), 24 deletions(-) diff --git a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart index 3489df75..dd061929 100755 --- a/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart +++ b/lib/main/lockDetail/lockSet/remoteUnlocking/remoteUnlocking_page.dart @@ -1,4 +1,4 @@ - +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -19,7 +19,8 @@ class RemoteUnlockingPage extends StatefulWidget { State createState() => _RemoteUnlockingPageState(); } -class _RemoteUnlockingPageState extends State with RouteAware { +class _RemoteUnlockingPageState extends State + with RouteAware { final RemoteUnlockingLogic logic = Get.put(RemoteUnlockingLogic()); final RemoteUnlockingState state = Get.find().state; @@ -62,16 +63,20 @@ class _RemoteUnlockingPageState extends State with RouteAwa ], ); }), + Padding( + padding: EdgeInsets.only(top: 20.h), + child: Text('功能开启后,你将可以通过网关远程开锁。此功能的开启和关闭只能在锁附近通过手机蓝牙进行。'.tr, + style: TextStyle(fontSize: 20.sp)), + ), SizedBox( height: 40.h, ), Obx(() => SubmitBtn( - btnName: state.remoteEnable.value == 1 - ? '关闭'.tr - : '开启'.tr, + btnName: state.remoteEnable.value == 1 ? '关闭'.tr : '开启'.tr, onClick: () { //全自动锁只判断是否开启远程开锁 - bool isContains = BlueManage().connectDeviceName.contains('T9A'); + bool isContains = + BlueManage().connectDeviceName.contains('T9A'); if (isContains) { logic.remoteUnlockingOpenOrClose(); } else { diff --git a/lib/mine/gateway/gatewayDetail/gatewayDetail_logic.dart b/lib/mine/gateway/gatewayDetail/gatewayDetail_logic.dart index d7487983..cde446fc 100644 --- a/lib/mine/gateway/gatewayDetail/gatewayDetail_logic.dart +++ b/lib/mine/gateway/gatewayDetail/gatewayDetail_logic.dart @@ -5,6 +5,7 @@ import '../../../login/login/entity/LoginEntity.dart'; import '../../../network/api_repository.dart'; import '../../../tools/eventBusEventManage.dart'; import '../../../tools/showTipView.dart'; +import '../../mineSet/transferGateway/selectGetewayList_entity.dart'; import 'gatewayDetail_state.dart'; class GatewayDetailLogic extends BaseGetXController { @@ -40,4 +41,13 @@ class GatewayDetailLogic extends BaseGetXController { }); } } + + Future getGatewayDetail() async { + final GetewayInfoEntity entity = await ApiRepository.to + .getGatewayDetailData( + gatewayId: state.getewayItemData.value.gatewayId ?? 0, timeout: 60); + if (entity.errorCode!.codeIsSuccessful) { + state.getewayItemData.value = entity.data!; + } + } } diff --git a/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart b/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart index b700ba28..612aba33 100755 --- a/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart +++ b/lib/mine/gateway/gatewayDetail/gatewayDetail_page.dart @@ -84,6 +84,8 @@ class _GatewayDetailPageState extends State { action: () { Get.toNamed(Routers.gatewayConnectionLockPage, arguments: { 'gatewayId': state.getewayItemData.value.gatewayId ?? 0 + })?.then((value) { + logic.getGatewayDetail(); }); }), // CommonItem( diff --git a/lib/mine/mineSet/transferGateway/selectGetewayList_entity.dart b/lib/mine/mineSet/transferGateway/selectGetewayList_entity.dart index e115265a..b6f476e2 100755 --- a/lib/mine/mineSet/transferGateway/selectGetewayList_entity.dart +++ b/lib/mine/mineSet/transferGateway/selectGetewayList_entity.dart @@ -1,5 +1,4 @@ class GetewayDataEntity { - GetewayDataEntity( {this.errorCode, this.description, this.errorMsg, this.data}); @@ -9,6 +8,7 @@ class GetewayDataEntity { errorMsg = json['errorMsg']; data = json['data'] != null ? GetewayListData.fromJson(json['data']) : null; } + int? errorCode; String? description; String? errorMsg; @@ -27,8 +27,8 @@ class GetewayDataEntity { } class GetewayListData { - - GetewayListData({this.list, this.pageNo, this.pageSize, this.pages, this.total}); + GetewayListData( + {this.list, this.pageNo, this.pageSize, this.pages, this.total}); GetewayListData.fromJson(Map json) { if (json['list'] != null) { @@ -42,6 +42,7 @@ class GetewayListData { pages = json['pages']; total = json['total']; } + List? list; int? pageNo; int? pageSize; @@ -62,20 +63,19 @@ class GetewayListData { } class GetewayItemData { - GetewayItemData( {this.serialNumber, - this.gatewayMac, - this.gatewayName, - this.gatewayType, - this.networkName, - this.networkMac, - this.lockNum, - this.isOnline, - this.firmwareInfo, - this.needUpgrade, - this.version, - this.gatewayId}); + this.gatewayMac, + this.gatewayName, + this.gatewayType, + this.networkName, + this.networkMac, + this.lockNum, + this.isOnline, + this.firmwareInfo, + this.needUpgrade, + this.version, + this.gatewayId}); GetewayItemData.fromJson(Map json) { serialNumber = json['serialNumber']; @@ -96,6 +96,7 @@ class GetewayItemData { version = json['version']; gatewayId = json['gatewayId']; } + String? serialNumber; String? gatewayMac; String? gatewayName; @@ -130,3 +131,30 @@ class GetewayItemData { } } +class GetewayInfoEntity { + GetewayInfoEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + GetewayInfoEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? GetewayItemData.fromJson(json['data']) : null; + } + + int? errorCode; + String? description; + String? errorMsg; + GetewayItemData? data; + + Map toJson() { + final Map data = {}; + data['errorCode'] = errorCode; + data['description'] = description; + data['errorMsg'] = errorMsg; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} diff --git a/lib/network/api.dart b/lib/network/api.dart index a1be47c2..db9ccf33 100755 --- a/lib/network/api.dart +++ b/lib/network/api.dart @@ -158,6 +158,7 @@ abstract class Api { final String gatewaykListURL = '/gateway/list'; // 网关列表 final String addGatewayURL = '/gateway/add'; // 添加网关 final String deletGatewayURL = '/gateway/delete'; // 删除网关 + final String gatewayDetailURL = '/gateway/detail'; // 网关列表 final String transferGatewayConfirmURL = '/plug/transferPlugConfirm'; // 转移网关确认 final String transferGatewayURL = '/plug/transfer'; // 转移网关 diff --git a/lib/network/api_provider.dart b/lib/network/api_provider.dart index cf7b064e..4cad97cc 100755 --- a/lib/network/api_provider.dart +++ b/lib/network/api_provider.dart @@ -1742,6 +1742,11 @@ class ApiProvider extends BaseProvider { jsonEncode({'pageNo': pageNo, 'pageSize': pageSize}), timeout: timeout); + // 获取网关详情 + Future getGatewayDetailData(int gatewayId, int timeout) => + post(gatewayDetailURL.toUrl, jsonEncode({'gatewayId': gatewayId}), + timeout: timeout); + // 添加网关 Future addGatewayNetwork( String gatewayName, @@ -1823,7 +1828,8 @@ class ApiProvider extends BaseProvider { post(getGatewayConfigURL.toUrl, jsonEncode({}), timeout: timeout); Future getGatewayConfigurationNotLoading(int timeout) => - post(getGatewayConfigURL.toUrl, jsonEncode({}), timeout: timeout,isUnShowLoading: true); + post(getGatewayConfigURL.toUrl, jsonEncode({}), + timeout: timeout, isUnShowLoading: true); Future gatewayConnectionLockListLoadData( int gatewayId, int timeout) => diff --git a/lib/network/api_repository.dart b/lib/network/api_repository.dart index c2732880..b5e09c33 100755 --- a/lib/network/api_repository.dart +++ b/lib/network/api_repository.dart @@ -496,10 +496,12 @@ class ApiRepository { final res = await apiProvider.getLockSettingInfoData(lockId); return LockSetInfoEntity.fromJson(res.body); } + // 获取所有锁设置信息(不显示加载框) Future getLockSettingInfoDataIsNotLoadingIcon( {required String lockId}) async { - final res = await apiProvider.getLockSettingInfoDataIsNotLoadingIcon(lockId); + final res = + await apiProvider.getLockSettingInfoDataIsNotLoadingIcon(lockId); return LockSetInfoEntity.fromJson(res.body); } @@ -1928,6 +1930,13 @@ class ApiRepository { return GetewayDataEntity.fromJson(res.body); } + // 获取网关详情 + Future getGatewayDetailData( + {required int gatewayId, required int timeout}) async { + final res = await apiProvider.getGatewayDetailData(gatewayId, timeout); + return GetewayInfoEntity.fromJson(res.body); + } + // 添加网关 Future gatewayDistributionNetwork( {required String gatewayName, @@ -2027,7 +2036,6 @@ class ApiRepository { return GetGatewayConfigurationEntity.fromJson(res.body); } - // 移除坏锁 Future removeBrokenLockData( {required List lockIdList}) async { diff --git a/pubspec.lock b/pubspec.lock index 3eff3ffe..9b40c4b0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1045,6 +1045,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.13" + jverify: + dependency: "direct main" + description: + name: jverify + sha256: "26d1667d8c71403b77a2620a8c618625f8b4bfc950dac285b8f35ebc5e60fa5a" + url: "https://pub.dev" + source: hosted + version: "3.0.0" leak_tracker: dependency: transitive description: