From 3be4a6b45ff76a4a6836c3a8d0b930f9a6d7d8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Wed, 1 Nov 2023 17:28:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0lockData=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ios/Runner.xcodeproj/project.pbxproj | 12 +- .../xcshareddata/xcschemes/Runner.xcscheme | 8 +- star_lock/lib/blue/blue_manage.dart | 4 +- star_lock/lib/blue/io_tool/io_tool.dart | 10 +- .../authorizedAdmin_state.dart | 8 +- .../authorizedAdminList_page.dart | 12 +- .../authorizedAdminList_state.dart | 9 +- .../checkingInDetail_state.dart | 5 +- .../checkingInList/checkingInList_state.dart | 7 +- .../checkingInSet/checkingInSet_state.dart | 4 +- .../checkingInSetWorkTime_state.dart | 5 +- .../checkingInSetWorkdaySet_state.dart | 6 +- .../checkingInAddStaff_state.dart | 4 +- .../checkingInStaffList_state.dart | 4 +- .../checkingInStaffDetail_state.dart | 4 +- .../electronicKeyList_page.dart | 12 +- .../electronicKeyList_state.dart | 9 +- .../sendElectronicKey_state.dart | 9 +- .../automaticBlocking_logic.dart | 14 +- .../automaticBlocking_state.dart | 25 +- .../basicInformation_logic.dart | 8 + .../basicInformation_page.dart | 256 ++++----- .../basicInformation_state.dart | 18 + .../editLockName/editLockName_logic.dart | 27 + .../editLockName/editLockName_page.dart | 29 +- .../editLockName/editLockName_state.dart | 18 + .../lockGroupList_entity.dart | 72 +++ .../lockSeletGrouping_logic.dart | 64 +++ .../lockSeletGrouping_page.dart | 124 ++--- .../lockSeletGrouping_state.dart | 21 + .../uploadElectricQuantity_page.dart | 13 +- .../burglarAlarm/burglarAlarm_logic.dart | 19 +- .../burglarAlarm/burglarAlarm_state.dart | 12 +- .../checkInCreatCompany_logic.dart | 8 +- .../checkInCreatCompany_page.dart | 6 +- .../checkInCreatCompany_state.dart | 8 +- .../configuringWifi_logic.dart | 2 +- .../lcokSet/diagnose/diagnose_logic.dart | 2 +- .../lcokSet/diagnose/diagnose_state.dart | 9 +- .../lockEscalation/lockEscalation_logic.dart | 14 +- .../lockEscalation/lockEscalation_state.dart | 2 - .../lockSet/checkingInInfoData_entity.dart | 60 +++ .../lcokSet/lockSet/lockSetInfo_entity.dart | 490 ++++++++++++++++++ .../lcokSet/lockSet/lockSet_logic.dart | 55 +- .../lcokSet/lockSet/lockSet_page.dart | 310 +++++------ .../lcokSet/lockSet/lockSet_state.dart | 19 +- .../lockSoundSet/lockSoundSet_logic.dart | 31 +- .../lockSoundSet/lockSoundSet_state.dart | 13 +- .../lockTime/getServerDatetime_entity.dart | 45 ++ .../lcokSet/lockTime/lockTime_logic.dart | 4 +- .../lcokSet/lockTime/lockTime_state.dart | 11 +- .../markedHouseState_logic.dart | 6 +- .../markedHouseState_state.dart | 12 +- .../getPassageModeConfig_entity.dart | 65 +++ .../normallyOpenMode_logic.dart | 14 +- .../normallyOpenMode_state.dart | 11 +- .../remoteUnlocking_logic.dart | 23 +- .../remoteUnlocking_state.dart | 11 +- .../resetButton/resetButton_logic.dart | 16 +- .../resetButton/resetButton_state.dart | 11 +- .../lockDetail/lockDetail_main_page.dart | 40 +- .../lockDetail/lockDetail_page.dart | 161 +++--- .../lockDetail/lockDetail_state.dart | 4 +- .../lockOperatingRecord_state.dart | 5 +- .../passwordKeyList/passwordKeyList_page.dart | 1 - .../passwordKeyList_state.dart | 7 +- .../passwordKeyManage_page.dart | 9 +- .../passwordKeyManage_tabbar.dart | 9 +- .../passwordKey_perpetual_page.dart | 15 +- .../demoModeLockDetail_page.dart | 15 +- .../lockMian/entity/lockListInfo_entity.dart | 304 +++++++++++ .../lockMian/lockList/lockListGroup_page.dart | 90 ++++ .../main/lockMian/lockList/lockList_page.dart | 143 ++++- .../lockMian/lockMain/lockMain_logic.dart | 59 ++- .../main/lockMian/lockMain/lockMain_page.dart | 14 +- .../lockMian/lockMain/lockMain_state.dart | 7 +- .../mine/addLock/saveLock/saveLock_logic.dart | 219 +++----- .../mine/addLock/saveLock/saveLock_state.dart | 6 + .../addAuthorizedAdministrator_state.dart | 7 +- star_lock/lib/network/api.dart | 15 +- star_lock/lib/network/api_provider.dart | 105 +++- star_lock/lib/network/api_repository.dart | 151 ++++-- star_lock/lib/tools/commonItem.dart | 25 +- star_lock/lib/tools/eventBusEventManage.dart | 8 +- 84 files changed, 2445 insertions(+), 1084 deletions(-) create mode 100644 star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_logic.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_state.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_state.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockGroupList_entity.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_logic.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_state.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart create mode 100644 star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart create mode 100644 star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart create mode 100644 star_lock/lib/main/lockMian/lockList/lockListGroup_page.dart diff --git a/star_lock/ios/Runner.xcodeproj/project.pbxproj b/star_lock/ios/Runner.xcodeproj/project.pbxproj index a90477c9..b17c5da7 100644 --- a/star_lock/ios/Runner.xcodeproj/project.pbxproj +++ b/star_lock/ios/Runner.xcodeproj/project.pbxproj @@ -393,7 +393,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = DWNXC92BQ6; + DEVELOPMENT_TEAM = 7D53BZAN75; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -401,7 +401,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021"; + PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -528,7 +528,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = DWNXC92BQ6; + DEVELOPMENT_TEAM = 7D53BZAN75; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -536,7 +536,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021"; + PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -557,7 +557,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = DWNXC92BQ6; + DEVELOPMENT_TEAM = 7D53BZAN75; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -565,7 +565,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021"; + PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c87d15a3..77bd9a21 100644 --- a/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -23,7 +23,7 @@ @@ -40,7 +40,7 @@ + buildConfiguration = "Release"> judgeReconnect(String deviceMAC, String deviceName, ConnectStateCallBack? connectStateCallBack, {bool isShowLoading = true}) async { - print("11111111$deviceConnectionState"); + // print("11111111$deviceConnectionState"); if(deviceConnectionState == DeviceConnectionState.connected){ - print("2222222:$deviceConnectionState"); + // print("2222222:$deviceConnectionState"); if(isShowLoading){ EasyLoading.show(); Future.delayed(const Duration(seconds: 10), () { //asynchronous delay diff --git a/star_lock/lib/blue/io_tool/io_tool.dart b/star_lock/lib/blue/io_tool/io_tool.dart index 25103157..6b7d0797 100644 --- a/star_lock/lib/blue/io_tool/io_tool.dart +++ b/star_lock/lib/blue/io_tool/io_tool.dart @@ -279,7 +279,15 @@ String asciiString(List codeUnits) { } String utf8String(List codeUnits) { - return utf8.decode(codeUnits); + codeUnits.reversed; + List uniqueList = []; + for (int i = 0; i < codeUnits.length; i++) { + if (codeUnits[i] != 0) { + uniqueList.add(codeUnits[i]); + } + } + uniqueList.reversed; + return utf8.decode(uniqueList).toString(); } bool compareTwoList({List? list1, List? list2}) { diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart index a6c74c8a..a699d8d1 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; class AuthorizedAdminState { final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框 @@ -13,8 +13,8 @@ class AuthorizedAdminState { late Contact contact; var type = ''.obs; - final keyInfo = KeyInfos().obs; - final lockMainEntity = LockMainEntity().obs; + final keyInfo = LockListInfoItemEntity().obs; + // final lockMainEntity = LockMainEntity().obs; final isAuthentication = false.obs; //是否可以实名认证 DateTime dateTime = DateTime.now(); final effectiveDateTime = DateTime.now().obs; @@ -32,7 +32,7 @@ class AuthorizedAdminState { var addUserId = ''.obs; AuthorizedAdminState() { Map map = Get.arguments; - lockMainEntity.value = map["lockMainEntity"]; + // lockMainEntity.value = map["lockMainEntity"]; keyInfo.value = map["keyInfo"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart index e1834dc2..ed1fae5b 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_page.dart @@ -65,7 +65,7 @@ class _AuthorizedAdminListPageState extends State { onClick: () { Navigator.pushNamed(context, Routers.authorizedAdminManagePage, arguments: { - "lockMainEntity": state.lockMainEntity.value, + // "lockMainEntity": state.lockMainEntity.value, "keyInfo": state.keyInfo.value }).then((val) { if (val != null) { @@ -188,12 +188,14 @@ class _AuthorizedAdminListPageState extends State { '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 - DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; + useDateStr = "永久"; } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 - DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; + useDateStr = "单次"; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart index 47ddc0b9..cc1afb14 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart @@ -1,10 +1,11 @@ import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; + +import '../../../lockMian/entity/lockListInfo_entity.dart'; class AuthorizedAdminListState { - final keyInfo = KeyInfos().obs; - final lockMainEntity = LockMainEntity().obs; + final keyInfo = LockListInfoItemEntity().obs; + // final lockMainEntity = LockMainEntity().obs; var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 final itemDataList = [].obs; @@ -12,7 +13,7 @@ class AuthorizedAdminListState { AuthorizedAdminListState() { Map map = Get.arguments; - lockMainEntity.value = map["lockMainEntity"]; + // lockMainEntity.value = map["lockMainEntity"]; keyInfo.value = map["keyInfo"]; } } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart index 9451c293..fce26a80 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart @@ -1,12 +1,11 @@ import 'package:get/get.dart'; - -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; import 'checkingInDetail_entity.dart'; class CheckingInDetailState{ - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final staffId = 0.obs; diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_state.dart index badbede3..ffd03b4b 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInList/checkingInList_state.dart @@ -1,15 +1,14 @@ - import 'package:date_format/date_format.dart'; import 'package:get/get.dart'; import '../../../../translations/trans_lib.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; import 'checkingInListDay_entity.dart'; import 'checkingInListMonth_entity.dart'; class CheckingInListState{ - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final listType = "1".obs;// 1早到榜 2迟到榜 3勤奋榜 @@ -26,6 +25,6 @@ class CheckingInListState{ var noPunchTimes = "".obs;// 未打车 CheckingInListState() { - getKeyInfosData.value = Get.arguments as KeyInfos; + getKeyInfosData.value = Get.arguments as LockListInfoItemEntity; } } diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart index 8af65e4c..8c4e4216 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSet/checkingInSet_state.dart @@ -2,11 +2,11 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; import 'checkingInSet_entity.dart'; class CheckingInSetState{ - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; var isCustom = true.obs; diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart index 4ebf9636..2f34b9d9 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart @@ -1,12 +1,11 @@ import 'package:get/get.dart'; - import '../../../../tools/dateTool.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; import '../checkingInSet/checkingInSet_entity.dart'; class CheckingInSetWorkTimeState{ - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final checkingInSetInfo = CheckingInSetInfo().obs; final companyId = "".obs; diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_state.dart index 1b478ee9..ebac46f5 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_state.dart @@ -1,8 +1,6 @@ - import 'package:get/get.dart'; - -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; import '../checkingInSet/checkingInSet_entity.dart'; class CheckingInSetWorkdaySetState{ @@ -10,7 +8,7 @@ class CheckingInSetWorkdaySetState{ var isSingledayWeekend = 2.obs; // 0单休 1双休 var weekDays = [].obs;// 工作天数 - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final checkingInSetInfo = CheckingInSetInfo().obs; final companyId = "".obs; diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart index 171c1ba5..d342c1ae 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart @@ -2,12 +2,12 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import '../../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../../lockMian/entity/lockListInfo_entity.dart'; import '../checkingInSetStaffList/checkingInStaffList_entity.dart'; import 'checkingInAddStaffSeletKey_entity.dart'; class CheckingInAddStaffState{ - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final staffListItemData = CheckingInAddStaffListItemEntity().obs; diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_state.dart index 6019d433..a2326a88 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_state.dart @@ -1,11 +1,11 @@ import 'package:get/get.dart'; -import '../../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../../lockMian/entity/lockListInfo_entity.dart'; import 'checkingInStaffList_entity.dart'; class CheckingInStaffManageState{ - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final staffListData = [].obs; diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart index bdff3ff6..aa1eeca8 100644 --- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart +++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkingInStaffDetail_state.dart @@ -1,11 +1,11 @@ import 'package:get/get.dart'; -import '../../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../../lockMian/entity/lockListInfo_entity.dart'; import '../checkingInSetStaffList/checkingInStaffList_entity.dart'; class CheckingInStaffDetailState{ - final getKeyInfosData = KeyInfos().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; final companyId = "".obs; final staffListItemData = CheckingInAddStaffListItemEntity().obs; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index b8d03e97..c779f6a4 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -86,7 +86,7 @@ class _ElectronicKeyListPageState extends State { onClick: () { Navigator.pushNamed( context, Routers.sendElectronicKeyManagePage, arguments: { - "lockMainEntity": state.lockMainEntity.value, + // "lockMainEntity": state.lockMainEntity.value, "keyInfo": state.keyInfo.value }).then((val) { if (val != null) { @@ -277,12 +277,14 @@ class _ElectronicKeyListPageState extends State { '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { //永久 - DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久'; + useDateStr = "永久"; } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { //单次 - DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); - useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次'; + useDateStr = "单次"; } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { //循环 useDateStr = '循环'; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart index f3c342a7..b07f8f75 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart @@ -1,19 +1,20 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; + +import '../../../lockMian/entity/lockListInfo_entity.dart'; class ElectronicKeyListState { TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框 - final keyInfo = KeyInfos().obs; - final lockMainEntity = LockMainEntity().obs; + final keyInfo = LockListInfoItemEntity().obs; + // final lockMainEntity = LockMainEntity().obs; var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 final itemDataList = [].obs; ElectronicKeyListState() { Map map = Get.arguments; - lockMainEntity.value = map["lockMainEntity"]; + // lockMainEntity.value = map["lockMainEntity"]; keyInfo.value = map["keyInfo"]; } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart index 1b79bc58..7b2c10ed 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; + +import '../../../../lockMian/entity/lockListInfo_entity.dart'; class SendElectronicKeyState { TextEditingController emailOrPhoneController = @@ -10,8 +11,8 @@ class SendElectronicKeyState { final FlutterContactPicker contactPicker = FlutterContactPicker(); late Contact contact; - final keyInfo = KeyInfos().obs; - final lockMainEntity = LockMainEntity().obs; + final keyInfo = LockListInfoItemEntity().obs; + // final lockMainEntity = LockMainEntity().obs; final isRemoteUnlock = false.obs; //是否允许远程开锁 final isAuthentication = false.obs; //是否可以实名认证 @@ -37,7 +38,7 @@ class SendElectronicKeyState { SendElectronicKeyState() { Map map = Get.arguments; - lockMainEntity.value = map["lockMainEntity"]; + // lockMainEntity.value = map["lockMainEntity"]; keyInfo.value = map["keyInfo"]; } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart index 27f49d92..04e5ca03 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_logic.dart @@ -33,15 +33,15 @@ class AutomaticBlockingLogic extends BaseGetXController{ } var entity = await ApiRepository.to.setAutoUnlock( - lockId: state.getKeyInfosData.value.lockId.toString(), - autoLockTime:autoTime, - type: "1", + lockId: state.lockSetInfoData.value.lockId!, + autoLockTime:int.parse(autoTime), + type: 1, ); if(entity.errorCode!.codeIsSuccessful){ state.autoLockTime.value = state.isOpen.value == false ? "0" : autoTime; - state.getKeyInfosData.value.autoLockTime = int.parse(autoTime); + state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(autoTime); eventBus.fire(RefreshLockListInfoDataEvent()); - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); } } @@ -140,7 +140,7 @@ class AutomaticBlockingLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.readSupportFunctionsWithParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 29, token: getTokenList, @@ -177,7 +177,7 @@ class AutomaticBlockingLogic extends BaseGetXController{ } print("autoTimeautoTimeautoTime:${autoTime}"); IoSenderManage.setSupportFunctionsWithParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 29, featureParaLength: 2, diff --git a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart index ab3d92e3..4892c72d 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_state.dart @@ -2,10 +2,11 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class AutomaticBlockingState { - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; var isOpen = false.obs;// 是否开启自动落锁 var autoLockTime = "5".obs; @@ -13,16 +14,18 @@ class AutomaticBlockingState { final TextEditingController timeController = TextEditingController(); AutomaticBlockingState() { - getKeyInfosData.value = Get.arguments as KeyInfos; - isOpen.value = getKeyInfosData.value.autoLockTime! > -1 ? true : false; - autoLockTime.value = getKeyInfosData.value.autoLockTime!.toString(); + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; - if((getKeyInfosData.value.autoLockTime! > 0) - && (getKeyInfosData.value.autoLockTime! != 5) - && (getKeyInfosData.value.autoLockTime! != 10) - && (getKeyInfosData.value.autoLockTime! != 15) - && (getKeyInfosData.value.autoLockTime! != 30) - && (getKeyInfosData.value.autoLockTime! != 60)){ + isOpen.value = lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false; + autoLockTime.value = lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString(); + + if((lockSetInfoData.value.lockSettingInfo!.autoLock! > 0) + && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 5) + && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 10) + && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 15) + && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 30) + && (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 60)){ isCustomLockTime.value = true; timeController.text = autoLockTime.value; } diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_logic.dart new file mode 100644 index 00000000..ffb4cc5e --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_logic.dart @@ -0,0 +1,8 @@ + +import '../../../../../tools/baseGetXController.dart'; +import 'basicInformation_state.dart'; + +class BasicInformationLogic extends BaseGetXController{ + final BasicInformationState state = BasicInformationState(); + +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart index b0a2bb7c..4b903b59 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart @@ -2,16 +2,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; -import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; -import 'package:star_lock/network/api_repository.dart'; -import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../appRouters.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/commonItem.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; +import '../../lockSet/lockSetInfo_entity.dart'; +import 'basicInformation_logic.dart'; class BasicInformationPage extends StatefulWidget { const BasicInformationPage({Key? key}) : super(key: key); @@ -21,145 +19,119 @@ class BasicInformationPage extends StatefulWidget { } class _BasicInformationPageState extends State { - late String _groupName = ""; - late KeyInfos keyInfo; - late LockMainEntity lockMainEntity; - late LockData _lockData; + final logic = Get.put(BasicInformationLogic()); + final state = Get.find().state; - @override - void initState() { - super.initState(); - _groupName = '未分组'; - } + // late String _groupName = ""; + // late LockData _lockData; + // + // @override + // void initState() { + // super.initState(); + // _groupName = '未分组'; + // } @override Widget build(BuildContext context) { - dynamic obj = ModalRoute.of(context)?.settings.arguments; - if (obj != null && (obj["keyInfo"] != null)) { - keyInfo = obj["keyInfo"]; - } - return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: TranslationLoader.lanKeys!.basicInformation!.tr, haveBack: true, backgroundColor: AppColors.mainColor), - body: FutureBuilder( - future: mockNetworkDataRequest(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - //请求结束 - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - //请求失败 - return const Text('请求失败'); - } else { - //请求成功 - final LockData itemData = snapshot.data!; - - return Column( - children: [ - Expanded( - child: ListView( - children: [ - CommonItem( - leftTitel: - TranslationLoader.lanKeys!.lockNumber!.tr, - rightTitle: itemData.lockAlias, - allHeight: 70.h, - isHaveLine: true), - CommonItem( - leftTitel: "MAC/ID", - rightTitle: itemData.lockMac, - allHeight: 70.h, - isHaveLine: false), - SizedBox( - height: 10.h, - ), - CommonItem( - leftTitel: TranslationLoader - .lanKeys!.electricQuantity!.tr, - rightTitle: "${itemData.electricQuantity}%", - isHaveLine: true, - isHaveDirection: true, - action: () { - Navigator.pushNamed(context, - Routers.uploadElectricQuantityPage, - arguments: {'keyInfo': keyInfo}); - }), - CommonItem( - leftTitel: TranslationLoader - .lanKeys!.periodValidity!.tr, - rightTitle: getUseDateStr(_lockData), - allHeight: 70.h, - isHaveLine: false), - SizedBox( - height: 10.h, - ), - CommonItem( - leftTitel: - TranslationLoader.lanKeys!.lockName!.tr, - rightTitle: itemData.lockName, - isHaveLine: true, - isHaveDirection: true, - action: () { - Navigator.pushNamed( - context, Routers.editLockNamePage); - }), - CommonItem( - leftTitel: - TranslationLoader.lanKeys!.lockGrouping!.tr, - rightTitle: itemData.groupName == "" - ? _groupName - : itemData.groupName, - isHaveLine: true, - isHaveDirection: true, - action: () async { - Navigator.pushNamed( - context, Routers.lockSeletGroupingPage, - arguments: { - 'LockData': _lockData - }).then((val) { - if (val != null) { - mockNetworkDataRequest(); - setState(() {}); - } - }); - }), - CommonItem( - leftTitel: TranslationLoader - .lanKeys!.adminOpenLockPassword!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Navigator.pushNamed(context, - Routers.adminOpenLockPasswordPage); - }), - CommonItem( - leftTitel: - TranslationLoader.lanKeys!.unlockQRCode!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.unlockQRCodePage); - }), - ], - ), - ), - ], - ); - } - } else { - //请求未结束 显示loading - return Container(); - } - })); + body: ListView( + children: [ + CommonItem( + leftTitel: + TranslationLoader.lanKeys!.lockNumber!.tr, + rightTitle: state.lockBasicInfo.value.lockAlias, + allHeight: 70.h, + isHaveLine: true), + CommonItem( + leftTitel: "MAC/ID", + rightTitle: state.lockBasicInfo.value.lockAlias, + allHeight: 70.h, + isHaveLine: false), + SizedBox( + height: 10.h, + ), + CommonItem( + leftTitel: TranslationLoader + .lanKeys!.electricQuantity!.tr, + rightTitle: "${state.lockBasicInfo.value.electricQuantity}%", + isHaveLine: true, + isHaveDirection: true, + action: () { + Navigator.pushNamed(context, + Routers.uploadElectricQuantityPage, + arguments: {'lockSetInfoData': state.lockSetInfoData.value}); + }), + CommonItem( + leftTitel: TranslationLoader + .lanKeys!.periodValidity!.tr, + rightTitle: getUseDateStr(state.lockBasicInfo.value), + allHeight: 70.h, + isHaveLine: false), + SizedBox( + height: 10.h, + ), + CommonItem( + leftTitel: + TranslationLoader.lanKeys!.lockName!.tr, + rightTitle: state.lockBasicInfo.value.lockAlias, + isHaveLine: true, + isHaveDirection: true, + action: () async { + var data = await Get.toNamed(Routers.editLockNamePage, arguments: {'lockSetInfoData': state.lockSetInfoData.value}); + if(data != null) { + setState(() { + state.lockBasicInfo.value = data["lockBasicInfo"]; + }); + } + }), + CommonItem( + leftTitel: + TranslationLoader.lanKeys!.lockGrouping!.tr, + // rightTitle: state.getKeyInfosData.value.groupName == "" ? _groupName : itemData.groupName, + isHaveLine: true, + isHaveDirection: true, + action: () async { + Navigator.pushNamed( + context, Routers.lockSeletGroupingPage, + arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }).then((val) { + if (val != null) { + // mockNetworkDataRequest(); + setState(() {}); + } + }); + }), + CommonItem( + leftTitel: TranslationLoader.lanKeys!.adminOpenLockPassword!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Navigator.pushNamed(context, + Routers.adminOpenLockPasswordPage); + }), + CommonItem( + leftTitel: + TranslationLoader.lanKeys!.unlockQRCode!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.unlockQRCodePage); + }), + ], + ) + ); } //使用期限 - String getUseDateStr(LockData indexEntity) { + String getUseDateStr(LockBasicInfo indexEntity) { String useDateStr = ''; if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { //限期 @@ -202,16 +174,16 @@ class _BasicInformationPageState extends State { return keyTypeStr; } - //请求电子钥匙列表 - Future mockNetworkDataRequest() async { - KeyDetailEntity entity = - await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString()); - if (entity.errorCode!.codeIsSuccessful) { - // print("电子钥匙列表成功:${entity.data?.itemList}"); - _lockData = entity.data!; - return entity.data!; - } - LockData data = LockData(); - return data; - } + // //请求电子钥匙列表 + // Future mockNetworkDataRequest() async { + // KeyDetailEntity entity = + // await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString()); + // if (entity.errorCode!.codeIsSuccessful) { + // // print("电子钥匙列表成功:${entity.data?.itemList}"); + // _lockData = entity.data!; + // return entity.data!; + // } + // LockData data = LockData(); + // return data; + // } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_state.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_state.dart new file mode 100644 index 00000000..e061ad0d --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_state.dart @@ -0,0 +1,18 @@ + +import 'package:get/get.dart'; + +import '../../../../lockMian/entity/lockListInfo_entity.dart'; +import '../../lockSet/lockSetInfo_entity.dart'; + +class BasicInformationState { + var lockSetInfoData = LockSetInfoData().obs; + var lockBasicInfo = LockBasicInfo().obs; + + var groupName = "未分组".obs; + + BasicInformationState() { + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; + } +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart new file mode 100644 index 00000000..8e1999b3 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_logic.dart @@ -0,0 +1,27 @@ + +import 'package:get/get.dart'; + +import '../../../../../network/api_repository.dart'; +import '../../../../../tools/baseGetXController.dart'; +import '../../../../../tools/toast.dart'; +import '../../../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart'; +import 'editLockName_state.dart'; + +class EditLockNameLogic extends BaseGetXController{ + final EditLockNameState state = EditLockNameState(); + + //修改锁名称请求 + Future modifyKeyNameRequest() async { + KeyOperationRecordEntity entity = await ApiRepository.to.updateLockName( + lockId: state.lockSetInfoData.value.lockId.toString(), + lockName:state.changeLockNameController.text); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "修改成功"); + state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text; + Get.back(result: { + "lockBasicInfo":state.lockBasicInfo.value + }); + } + } + +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_page.dart index 91dd74b7..0bcb21e4 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_page.dart @@ -2,15 +2,12 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart'; -import 'package:star_lock/network/api_repository.dart'; -import 'package:star_lock/tools/baseGetXController.dart'; -import 'package:star_lock/tools/toast.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/tf_loginInput.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; +import 'editLockName_logic.dart'; class EditLockNamePage extends StatefulWidget { const EditLockNamePage({Key? key}) : super(key: key); @@ -20,24 +17,8 @@ class EditLockNamePage extends StatefulWidget { } class _EditLockNamePageState extends State { - final TextEditingController _changeLockNameController = - TextEditingController(); - - @override - void initState() { - super.initState(); - _changeLockNameController.text = "MCBN0c_8f3106"; - } - - //修改锁名称请求 - Future modifyKeyNameRequest() async { - KeyOperationRecordEntity entity = await ApiRepository.to - .modifyKeyName('63', '28', _changeLockNameController.text, '0'); - if (entity.errorCode!.codeIsSuccessful) { - print("修改锁名称成功啦啦啦啦啦"); - Toast.show(msg: "修改成功"); - } - } + final logic = Get.put(EditLockNameLogic()); + final state = Get.find().state; @override Widget build(BuildContext context) { @@ -54,7 +35,7 @@ class _EditLockNamePageState extends State { style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () { - modifyKeyNameRequest(); + logic.modifyKeyNameRequest(); }, ), ], @@ -62,7 +43,7 @@ class _EditLockNamePageState extends State { body: Container( margin: EdgeInsets.only(left: 20.w, right: 20.w), child: LoginInput( - controller: _changeLockNameController, + controller: state.changeLockNameController, leftWidget: const SizedBox(), hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, inputFormatters: [ diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_state.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_state.dart new file mode 100644 index 00000000..c6bbeb80 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/editLockName/editLockName_state.dart @@ -0,0 +1,18 @@ + +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../lockSet/lockSetInfo_entity.dart'; + +class EditLockNameState { + var lockSetInfoData = LockSetInfoData().obs; + var lockBasicInfo = LockBasicInfo().obs; + final TextEditingController changeLockNameController = TextEditingController(); + + EditLockNameState() { + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; + changeLockNameController.text = lockBasicInfo.value.lockAlias!; + } +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockGroupList_entity.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockGroupList_entity.dart new file mode 100644 index 00000000..44ad0b92 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockGroupList_entity.dart @@ -0,0 +1,72 @@ +class LockGroupListEntity { + int? errorCode; + String? description; + String? errorMsg; + LockGroupData? data; + + LockGroupListEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + LockGroupListEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? LockGroupData.fromJson(json['data']) : null; + } + + 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; + } +} + +class LockGroupData { + List? itemList; + + LockGroupData({this.itemList}); + + LockGroupData.fromJson(Map json) { + if (json['list'] != null) { + itemList = []; + json['list'].forEach((v) { + itemList!.add(LockGroupItem.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + if (itemList != null) { + data['list'] = itemList!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LockGroupItem { + int? lockNum; + int? keyGroupId; + String? keyGroupName; + + LockGroupItem({this.lockNum, this.keyGroupId, this.keyGroupName}); + + LockGroupItem.fromJson(Map json) { + lockNum = json['lockNum']; + keyGroupId = json['keyGroupId']; + keyGroupName = json['keyGroupName']; + } + + Map toJson() { + final Map data = {}; + data['lockNum'] = lockNum; + data['keyGroupId'] = keyGroupId; + data['keyGroupName'] = keyGroupName; + return data; + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_logic.dart new file mode 100644 index 00000000..86b8057b --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_logic.dart @@ -0,0 +1,64 @@ + +import 'package:get/get.dart'; + +import '../../../../../network/api_repository.dart'; +import '../../../../../tools/baseGetXController.dart'; +import '../../../../../tools/toast.dart'; +import '../../../electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; +import 'lockSeletGrouping_state.dart'; + +class LockSeletGroupingLogic extends BaseGetXController { + final LockSeletGroupingState state = LockSeletGroupingState(); + + //创建锁分组请求 + Future addLockGroupRequest() async { + MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0'); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "创建成功"); + mockNetworkDataRequest(); + } + } + + //设置锁分组请求 + Future setLockGroupRequest(GroupListItem itemData) async { + MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup( + state.lockSetInfoData.value.lockId.toString(), itemData.keyGroupId.toString()); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: "设置锁分组成功"); + state.lockBasicInfo.value.groupId = itemData.keyGroupId; + mockNetworkDataRequest(); + } + } + + //分组列表请求 + void mockNetworkDataRequest() async { + MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1'); + if (entity.errorCode!.codeIsSuccessful) { + state.groupList.value = entity.data!.groupList!; + } + } + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + print("onReady()"); + + mockNetworkDataRequest(); + } + + @override + void onInit() { + // TODO: implement onInit + super.onInit(); + print("lockDetail_onInit()"); + + } + + + @override + void onClose() { + // TODO: implement onClose + + } +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_page.dart index fba69716..5a8766cd 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_page.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; -import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/showTFView.dart'; @@ -10,9 +9,11 @@ import 'package:star_lock/tools/toast.dart'; import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/commonItem.dart'; +import '../../../../../tools/noData.dart'; import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; +import 'lockSeletGrouping_logic.dart'; class LockSeletGroupingPage extends StatefulWidget { const LockSeletGroupingPage({Key? key}) : super(key: key); @@ -22,15 +23,11 @@ class LockSeletGroupingPage extends StatefulWidget { } class _LockSeletGroupingPageState extends State { - final TextEditingController _changeNameController = TextEditingController(); - late LockData _lockData; + final logic = Get.put(LockSeletGroupingLogic()); + final state = Get.find().state; @override Widget build(BuildContext context) { - dynamic obj = ModalRoute.of(context)?.settings.arguments; - if (obj != null && (obj["LockData"] != null)) { - _lockData = obj["LockData"]; - } return Scaffold( backgroundColor: AppColors.mainBackgroundColor, @@ -38,51 +35,32 @@ class _LockSeletGroupingPageState extends State { barTitle: TranslationLoader.lanKeys!.selectGroup!.tr, haveBack: true, backgroundColor: AppColors.mainColor), - body: FutureBuilder>( - future: mockNetworkDataRequest(), - builder: (BuildContext context, - AsyncSnapshot> snapshot) { - //请求结束 - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasError) { - //请求失败 - return const Text('请求失败'); - } else { - //请求成功 - final List itemData = snapshot.data!; - - return Column( - children: [ - Expanded(child: _buildMainUI(context, itemData)), - SubmitBtn( - btnName: TranslationLoader.lanKeys!.createNewGroup!.tr, - borderRadius: 20.w, - margin: EdgeInsets.only( - left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), - padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - onClick: () { - showCupertinoAlertDialog(context); - // Navigator.pop(context); - }), - SizedBox( - height: 40.h, - ) - ], - ); - } - } else { - //请求未结束 显示loading - return Container(); - } - }), + body: Column( + children: [ + Expanded(child: _buildMainUI()), + SubmitBtn( + btnName: TranslationLoader.lanKeys!.createNewGroup!.tr, + borderRadius: 20.w, + margin: EdgeInsets.only( + left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + onClick: () { + showCupertinoAlertDialog(context); + // Navigator.pop(context); + }), + SizedBox( + height: 40.h, + ) + ], + ), ); } - Widget _buildMainUI(BuildContext context, List itemList) { - return ListView.builder( - itemCount: itemList.length, + Widget _buildMainUI() { + return Obx(() => state.groupList.value.isNotEmpty ? ListView.builder( + itemCount: state.groupList.value.length, itemBuilder: (c, index) { - GroupListItem itemData = itemList[index]; + GroupListItem itemData = state.groupList.value[index]; return CommonItem( leftTitel: itemData.keyGroupName, rightTitle: "", @@ -90,7 +68,7 @@ class _LockSeletGroupingPageState extends State { isHaveLine: true, isHaveDirection: false, isHaveRightWidget: true, - rightWidget: _lockData.groupId == itemData.keyGroupId + rightWidget: state.lockBasicInfo.value.groupId == itemData.keyGroupId ? Image( image: const AssetImage("images/icon_item_checked.png"), width: 30.w, @@ -99,47 +77,9 @@ class _LockSeletGroupingPageState extends State { ) : Container(), action: () { - Navigator.pop(context, true); - setLockGroupRequest(itemData); + logic.setLockGroupRequest(itemData); }); - }); - } - - //创建锁分组请求 - Future addLockGroupRequest() async { - MassSendLockGroupListEntity entity = - await ApiRepository.to.addLockGroup(_changeNameController.text, '0'); - if (entity.errorCode!.codeIsSuccessful) { - Toast.show(msg: "创建成功"); - mockNetworkDataRequest(); - setState(() {}); - } - } - - //设置锁分组请求 - Future setLockGroupRequest(GroupListItem itemData) async { - MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup( - _lockData.lockId.toString(), itemData.keyGroupId.toString()); - if (entity.errorCode!.codeIsSuccessful) { - Toast.show(msg: "设置锁分组成功"); - mockNetworkDataRequest(); - } - } - - //分组列表请求 - Future> mockNetworkDataRequest() async { - MassSendLockGroupListEntity entity = - await ApiRepository.to.lockGroupList('1'); - if (entity.errorCode!.codeIsSuccessful) { - if (entity.data != null) { - return entity.data!.groupList!; - } else { - List dataList = []; - return dataList; - } - } else { - return []; - } + }) : const NoData()); } void showCupertinoAlertDialog(BuildContext context) { @@ -149,11 +89,11 @@ class _LockSeletGroupingPageState extends State { return ShowTFView( title: TranslationLoader.lanKeys!.createNewGroup!.tr, tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr, - controller: _changeNameController, + controller: state.changeNameController, sureClick: () { //发送编辑钥匙名称请求 - if (_changeNameController.text.isNotEmpty) { - addLockGroupRequest(); + if (state.changeNameController.text.isNotEmpty) { + logic.addLockGroupRequest(); Navigator.pop(context); } else { Toast.show(msg: '请输入分组名称'); diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_state.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_state.dart new file mode 100644 index 00000000..479a01cd --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/lockSeletGrouping_state.dart @@ -0,0 +1,21 @@ + + +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../../electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; +import '../../lockSet/lockSetInfo_entity.dart'; + +class LockSeletGroupingState { + var lockSetInfoData = LockSetInfoData().obs; + var lockBasicInfo = LockBasicInfo().obs; + + var groupList = [].obs; + final TextEditingController changeNameController = TextEditingController(); + + LockSeletGroupingState() { + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; + } +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart index ceeb0a5d..5c5eacee 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_page.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/toast.dart'; @@ -11,6 +10,7 @@ import '../../../../../app_settings/app_colors.dart'; import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/titleAppBar.dart'; import '../../../../../translations/trans_lib.dart'; +import '../../lockSet/lockSetInfo_entity.dart'; class UploadElectricQuantityPage extends StatefulWidget { const UploadElectricQuantityPage({Key? key}) : super(key: key); @@ -20,14 +20,13 @@ class UploadElectricQuantityPage extends StatefulWidget { _UploadElectricQuantityPageState(); } -class _UploadElectricQuantityPageState - extends State { - late KeyInfos keyInfo; +class _UploadElectricQuantityPageState extends State { + late LockSetInfoData lockSetInfoData; //电量更新请求 Future uploadElectricQuantityRequest() async { KeyOperationRecordEntity entity = await ApiRepository.to - .uploadElectricQuantity('100', keyInfo.lockId.toString()); + .uploadElectricQuantity('100', lockSetInfoData.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { print("锁电量更新成功啦啦啦啦啦"); Toast.show(msg: "锁电量更新成功"); @@ -37,8 +36,8 @@ class _UploadElectricQuantityPageState @override Widget build(BuildContext context) { dynamic obj = ModalRoute.of(context)?.settings.arguments; - if (obj != null && (obj["keyInfo"] != null)) { - keyInfo = obj["keyInfo"]; + if (obj != null && (obj["lockSetInfoData"] != null)) { + lockSetInfoData = obj["lockSetInfoData"]; } return Scaffold( diff --git a/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_logic.dart index 10512732..6398a687 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_logic.dart @@ -7,7 +7,6 @@ import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.da import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_reply.dart'; -import '../../../../blue/io_tool/io_manager.dart'; import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; @@ -22,18 +21,16 @@ class BurglarAlarmLogic extends BaseGetXController{ // 配置锁的常开模式设置 -> 防撬报警 Future _setLockSetGeneralSetting() async{ - var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.getKeyInfosData.value.lockId.toString(), - changeType:"1", - isOn:state.burglarAlarmEnable.value == 1 ? "2" : "1", // 1-开启、2-关闭; - type:"3", // 3 防撬报警 + var entity = await ApiRepository.to.setBurglarAlarmData( + lockId: state.lockSetInfoData.value.lockId!, + antiPrySwitch:state.burglarAlarmEnable.value == 1 ? 0 : 1, // 1-开启、2-关闭; ); if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); - state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 2 : 1; - state.getKeyInfosData.value.tamperAlert = state.burglarAlarmEnable.value; - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 0 : 1; + state.lockSetInfoData.value.lockSettingInfo!.antiPrySwitch = state.burglarAlarmEnable.value; + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); } } @@ -127,7 +124,7 @@ class BurglarAlarmLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.readSupportFunctionsNoParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 30, token: getTokenList, @@ -153,7 +150,7 @@ class BurglarAlarmLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.setSupportFunctionsNoParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 30, featureEnable: state.burglarAlarmEnable.value == 1 ? 0 : 1, diff --git a/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_state.dart b/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_state.dart index cfa688a7..0dc6bf36 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/burglarAlarm/burglarAlarm_state.dart @@ -1,16 +1,18 @@ import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class BurglarAlarmState{ - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; - var burglarAlarmEnable = 1.obs; + var burglarAlarmEnable = 0.obs; BurglarAlarmState() { - getKeyInfosData.value = Get.arguments as KeyInfos; - burglarAlarmEnable.value = getKeyInfosData.value.tamperAlert!; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + + burglarAlarmEnable.value = lockSetInfoData.value.lockSettingInfo!.antiPrySwitch!; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart index cc70346f..c185f64b 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_logic.dart @@ -13,7 +13,7 @@ class CheckInCreatCompanyLogic extends BaseGetXController{ // 设置考勤创建公司 void setCheckInCreateCompany() async{ var entity = await ApiRepository.to.setCheckInCreateCompanyData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), attendanceType: state.isCustom.value ? "0" :"1", companyName: state.companyNameController.text, workDay: state.weekDays.value, @@ -28,7 +28,7 @@ class CheckInCreatCompanyLogic extends BaseGetXController{ // 设置考勤 void setLockSetGeneralSetting() async{ var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), changeType:"1", isOn:"1", type:"1", @@ -36,8 +36,8 @@ class CheckInCreatCompanyLogic extends BaseGetXController{ if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); - state.getKeyInfosData.value.isAttendance = 1; - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + state.lockSetInfoData.value.lockSettingInfo!.attendance = 1; + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Get.back(); Toast.show(msg: "设置成功"); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart index 74c8dad7..eca3dc70 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_page.dart @@ -46,7 +46,7 @@ class _CheckInCreatCompanyPageState extends State { isHaveDirection: true, action: () async { var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: { - "getKeyInfosData": state.getKeyInfosData.value, + "getKeyInfosData": state.lockSetInfoData.value, "companyId": "1", "pushType": "0", "checkingInSetInfo": CheckingInSetInfo(), @@ -68,8 +68,8 @@ class _CheckInCreatCompanyPageState extends State { isHaveLine: true, isHaveDirection: true, action: () async { - var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: { - "getKeyInfosData": state.getKeyInfosData.value, + var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: { + "getKeyInfosData": state.lockSetInfoData.value, "companyId": "0", "pushType": "0", "checkingInSetInfo": CheckingInSetInfo(), diff --git a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart index 539b205a..9a80bedf 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/checkInCreatCompany/checkInCreatCompany_state.dart @@ -2,10 +2,11 @@ import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class CheckInCreatCompanyState{ - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; TextEditingController companyNameController = TextEditingController(); @@ -19,6 +20,7 @@ class CheckInCreatCompanyState{ var beginTimeTimestamp = "".obs;// 开始时间时间戳 var endTimeTimestamp = "".obs;// 结束时间时间戳 CheckInCreatCompanyState() { - getKeyInfosData.value = Get.arguments as KeyInfos; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/configuringWifi/configuringWifi_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/configuringWifi/configuringWifi_logic.dart index dc7e7f8f..a9464f88 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/configuringWifi/configuringWifi_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/configuringWifi/configuringWifi_logic.dart @@ -108,7 +108,7 @@ class ConfiguringWifiLogic extends BaseGetXController{ List getTokenList = changeStringListToIntList(token!); print("openDoorTokenPubToken:$getTokenList"); - print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}"); + // print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}"); IoSenderManage.senderConfiguringWifiCommand( keyID: "1", userID: await Storage.getUid(), diff --git a/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_logic.dart index 506b4d2a..c55cc136 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_logic.dart @@ -12,7 +12,7 @@ class DiagnoseLogic extends BaseGetXController{ // 诊断 Future setLockDiagnose() async{ var entity = await ApiRepository.to.setLockDiagnoseData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), electricQuantity:"23", firmwareRevision:"1.0", // 1-开启、2-关闭; hardwareRevision:"1.3", // 4 重置键开关 diff --git a/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_state.dart b/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_state.dart index 19cfc7ff..b580a0bf 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/diagnose/diagnose_state.dart @@ -1,12 +1,15 @@ import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class DiagnoseState{ - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; DiagnoseState() { - getKeyInfosData.value = Get.arguments as KeyInfos; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; } + } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_logic.dart index 3f87d923..59101c6e 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_logic.dart @@ -8,14 +8,14 @@ import 'lockEscalation_state.dart'; class LockEscalationLogic extends BaseGetXController{ LockEscalationState state = LockEscalationState(); - // 配置锁的常开模式设置 + // 锁升级 Future setLockSetGeneralSetting() async{ - var entity = await ApiRepository.to.getLockVersionInfoData( - lockId: state.getKeyInfosData.value.lockId.toString(), - ); - if(entity.errorCode!.codeIsSuccessful){ - - } + // var entity = await ApiRepository.to.getLockVersionInfoData( + // lockId: state.getKeyInfosData.value.lockId.toString(), + // ); + // if(entity.errorCode!.codeIsSuccessful){ + // + // } } @override diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_state.dart index 4ce32511..211ba75c 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockEscalation/lockEscalation_state.dart @@ -1,8 +1,6 @@ import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; class LockEscalationState{ - var getKeyInfosData = KeyInfos().obs; } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart new file mode 100644 index 00000000..a691d473 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart @@ -0,0 +1,60 @@ +class CheckingInInfoDataEntity { + int? errorCode; + String? description; + String? errorMsg; + Data? data; + + CheckingInInfoDataEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + CheckingInInfoDataEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? Data.fromJson(json['data']) : null; + } + + 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; + } +} + +class Data { + int? workEndTime; + int? attendanceType; + int? companyId; + int? workStartTime; + List? workDay; + + Data( + {this.workEndTime, + this.attendanceType, + this.companyId, + this.workStartTime, + this.workDay}); + + Data.fromJson(Map json) { + workEndTime = json['workEndTime']; + attendanceType = json['attendanceType']; + companyId = json['companyId']; + workStartTime = json['workStartTime']; + workDay = json['workDay']; + } + + Map toJson() { + final Map data = {}; + data['workEndTime'] = workEndTime; + data['attendanceType'] = attendanceType; + data['companyId'] = companyId; + data['workStartTime'] = workStartTime; + data['workDay'] = workDay; + return data; + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart new file mode 100644 index 00000000..9a9c2c38 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart @@ -0,0 +1,490 @@ +class LockSetInfoEntity { + int? errorCode; + String? description; + String? errorMsg; + LockSetInfoData? data; + + LockSetInfoEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + LockSetInfoEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? LockSetInfoData.fromJson(json['data']) : null; + } + + 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; + } +} + +class LockSetInfoData { + int? lockId; + LockStatus? lockStatus; + LockFeature? lockFeature; + LockBasicInfo? lockBasicInfo; + LockSettingInfo? lockSettingInfo; + + LockSetInfoData({ + this.lockId, + this.lockStatus, + this.lockFeature, + this.lockBasicInfo, + this.lockSettingInfo}); + + LockSetInfoData.fromJson(Map json) { + lockId = json['lockId']; + lockStatus = json['lockStatus'] != null + ? LockStatus.fromJson(json['lockStatus']) + : null; + lockFeature = json['lockFeature'] != null + ? LockFeature.fromJson(json['lockFeature']) + : null; + lockBasicInfo = json['lockBasicInfo'] != null + ? LockBasicInfo.fromJson(json['lockBasicInfo']) + : null; + lockSettingInfo = json['lockSettingInfo'] != null + ? LockSettingInfo.fromJson(json['lockSettingInfo']) + : null; + } + + Map toJson() { + final Map data = {}; + data['lockId'] = lockId; + if (lockStatus != null) { + data['lockStatus'] = lockStatus!.toJson(); + } + if (lockFeature != null) { + data['lockFeature'] = lockFeature!.toJson(); + } + if (lockBasicInfo != null) { + data['lockBasicInfo'] = lockBasicInfo!.toJson(); + } + if (lockSettingInfo != null) { + data['lockSettingInfo'] = lockSettingInfo!.toJson(); + } + return data; + } +} + +class LockStatus { + int? roomStatus; + + LockStatus({this.roomStatus}); + + LockStatus.fromJson(Map json) { + roomStatus = json['roomStatus']; + } + + Map toJson() { + final Map data = {}; + data['roomStatus'] = roomStatus; + return data; + } +} + +class LockFeature { + int? password; + int? icCard; + int? fingerprint; + int? fingerVein; + int? palmVein; + int? d3Face; + int? qrCode; + int? bluetoothRemoteControl; + int? wirelessKey; + int? gatewayUnlock; + int? lockCommand; + int? firmwareUpgrade; + int? passwordIssue; + int? cardIssue; + int? fingerprintIssue; + int? fingerVeinIssue; + int? palmVeinIssue; + int? d3FaceIssue; + int? lockFreeze; + int? readAdminPassword; + int? passwordManagement; + int? passwordWithDelete; + int? remoteUnlock; + int? autoLock; + int? antiPrySwitch; + int? resetSwitch; + int? lockSwitch; + int? lockSound; + int? languageSetting; + int? realTimeClock; + int? wifi; + int? videoIntercom; + int? cyclePassword; + int? cycleFingerprintCard; + int? doubleAuthentication; + int? openDirection; + int? proximitySensing; + int? doorStatus; + int? wiredDoorMagnet; + int? wirelessDoorMagnet; + int? doorNotClosedAlarm; + int? unlockReminder; + int? wirelessKeyboard; + int? lightingTime; + int? passageMode; + int? hotelLockCardSystem; + int? appUnlockOnline; + int? bluetoothBroadcast; + int? attendance; + + LockFeature( + {this.password, + this.icCard, + this.fingerprint, + this.fingerVein, + this.palmVein, + this.d3Face, + this.qrCode, + this.bluetoothRemoteControl, + this.wirelessKey, + this.gatewayUnlock, + this.lockCommand, + this.firmwareUpgrade, + this.passwordIssue, + this.cardIssue, + this.fingerprintIssue, + this.fingerVeinIssue, + this.palmVeinIssue, + this.d3FaceIssue, + this.lockFreeze, + this.readAdminPassword, + this.passwordManagement, + this.passwordWithDelete, + this.remoteUnlock, + this.autoLock, + this.antiPrySwitch, + this.resetSwitch, + this.lockSwitch, + this.lockSound, + this.languageSetting, + this.realTimeClock, + this.wifi, + this.videoIntercom, + this.cyclePassword, + this.cycleFingerprintCard, + this.doubleAuthentication, + this.openDirection, + this.proximitySensing, + this.doorStatus, + this.wiredDoorMagnet, + this.wirelessDoorMagnet, + this.doorNotClosedAlarm, + this.unlockReminder, + this.wirelessKeyboard, + this.lightingTime, + this.passageMode, + this.hotelLockCardSystem, + this.appUnlockOnline, + this.bluetoothBroadcast, + this.attendance}); + + LockFeature.fromJson(Map json) { + password = json['password']; + icCard = json['icCard']; + fingerprint = json['fingerprint']; + fingerVein = json['fingerVein']; + palmVein = json['palmVein']; + d3Face = json['d3Face']; + qrCode = json['qrCode']; + bluetoothRemoteControl = json['bluetoothRemoteControl']; + wirelessKey = json['wirelessKey']; + gatewayUnlock = json['gatewayUnlock']; + lockCommand = json['lockCommand']; + firmwareUpgrade = json['firmwareUpgrade']; + passwordIssue = json['passwordIssue']; + cardIssue = json['cardIssue']; + fingerprintIssue = json['fingerprintIssue']; + fingerVeinIssue = json['fingerVeinIssue']; + palmVeinIssue = json['palmVeinIssue']; + d3FaceIssue = json['d3FaceIssue']; + lockFreeze = json['lockFreeze']; + readAdminPassword = json['readAdminPassword']; + passwordManagement = json['passwordManagement']; + passwordWithDelete = json['passwordWithDelete']; + remoteUnlock = json['remoteUnlock']; + autoLock = json['autoLock']; + antiPrySwitch = json['antiPrySwitch']; + resetSwitch = json['resetSwitch']; + lockSwitch = json['lockSwitch']; + lockSound = json['lockSound']; + languageSetting = json['languageSetting']; + realTimeClock = json['realTimeClock']; + wifi = json['wifi']; + videoIntercom = json['videoIntercom']; + cyclePassword = json['cyclePassword']; + cycleFingerprintCard = json['cycleFingerprintCard']; + doubleAuthentication = json['doubleAuthentication']; + openDirection = json['openDirection']; + proximitySensing = json['proximitySensing']; + doorStatus = json['doorStatus']; + wiredDoorMagnet = json['wiredDoorMagnet']; + wirelessDoorMagnet = json['wirelessDoorMagnet']; + doorNotClosedAlarm = json['doorNotClosedAlarm']; + unlockReminder = json['unlockReminder']; + wirelessKeyboard = json['wirelessKeyboard']; + lightingTime = json['lightingTime']; + passageMode = json['passageMode']; + hotelLockCardSystem = json['hotelLockCardSystem']; + appUnlockOnline = json['appUnlockOnline']; + bluetoothBroadcast = json['bluetoothBroadcast']; + attendance = json['attendance']; + } + + Map toJson() { + final Map data = {}; + data['password'] = password; + data['icCard'] = icCard; + data['fingerprint'] = fingerprint; + data['fingerVein'] = fingerVein; + data['palmVein'] = palmVein; + data['d3Face'] = d3Face; + data['qrCode'] = qrCode; + data['bluetoothRemoteControl'] = bluetoothRemoteControl; + data['wirelessKey'] = wirelessKey; + data['gatewayUnlock'] = gatewayUnlock; + data['lockCommand'] = lockCommand; + data['firmwareUpgrade'] = firmwareUpgrade; + data['passwordIssue'] = passwordIssue; + data['cardIssue'] = cardIssue; + data['fingerprintIssue'] = fingerprintIssue; + data['fingerVeinIssue'] = fingerVeinIssue; + data['palmVeinIssue'] = palmVeinIssue; + data['d3FaceIssue'] = d3FaceIssue; + data['lockFreeze'] = lockFreeze; + data['readAdminPassword'] = readAdminPassword; + data['passwordManagement'] = passwordManagement; + data['passwordWithDelete'] = passwordWithDelete; + data['remoteUnlock'] = remoteUnlock; + data['autoLock'] = autoLock; + data['antiPrySwitch'] = antiPrySwitch; + data['resetSwitch'] = resetSwitch; + data['lockSwitch'] = lockSwitch; + data['lockSound'] = lockSound; + data['languageSetting'] = languageSetting; + data['realTimeClock'] = realTimeClock; + data['wifi'] = wifi; + data['videoIntercom'] = videoIntercom; + data['cyclePassword'] = cyclePassword; + data['cycleFingerprintCard'] = cycleFingerprintCard; + data['doubleAuthentication'] = doubleAuthentication; + data['openDirection'] = openDirection; + data['proximitySensing'] = proximitySensing; + data['doorStatus'] = doorStatus; + data['wiredDoorMagnet'] = wiredDoorMagnet; + data['wirelessDoorMagnet'] = wirelessDoorMagnet; + data['doorNotClosedAlarm'] = doorNotClosedAlarm; + data['unlockReminder'] = unlockReminder; + data['wirelessKeyboard'] = wirelessKeyboard; + data['lightingTime'] = lightingTime; + data['passageMode'] = passageMode; + data['hotelLockCardSystem'] = hotelLockCardSystem; + data['appUnlockOnline'] = appUnlockOnline; + data['bluetoothBroadcast'] = bluetoothBroadcast; + data['attendance'] = attendance; + return data; + } +} + +class LockBasicInfo { + int? keyId; + String? model; + int? electricQuantity; + int? indate; + int? isLockOwner; + String? lockAlias; + int? groupId; + List? groupData; + String? adminPwd; + int? keyType; + int? startDate; + int? endDate; + + LockBasicInfo( + {this.keyId, + this.model, + this.electricQuantity, + this.indate, + this.isLockOwner, + this.lockAlias, + this.groupId, + this.groupData, + this.adminPwd, + this.keyType, + this.startDate, + this.endDate,}); + + LockBasicInfo.fromJson(Map json) { + keyId = json['keyId']; + model = json['model']; + electricQuantity = json['electricQuantity']; + indate = json['indate']; + isLockOwner = json['isLockOwner']; + lockAlias = json['lockAlias']; + groupId = json['groupId']; + if (json['groupData'] != null) { + groupData = []; + json['groupData'].forEach((v) { + groupData!.add(GroupData.fromJson(v)); + }); + } + adminPwd = json['adminPwd']; + keyType = json['keyType']; + startDate = json['startDate']; + endDate = json['endDate']; + } + + Map toJson() { + final Map data = {}; + data['keyId'] = keyId; + data['model'] = model; + data['electricQuantity'] = electricQuantity; + data['indate'] = indate; + data['isLockOwner'] = isLockOwner; + data['lockAlias'] = lockAlias; + data['groupId'] = groupId; + if (groupData != null) { + data['groupData'] = groupData!.map((v) => v.toJson()).toList(); + } + data['adminPwd'] = adminPwd; + data['keyType'] = keyType; + data['startDate'] = startDate; + data['endDate'] = endDate; + return data; + } +} + +class GroupData { + int? id; + String? name; + + GroupData({this.id, this.name}); + + GroupData.fromJson(Map json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['name'] = name; + return data; + } +} + +class LockSettingInfo { + int? remoteUnlock; + int? autoLock; + int? autoLockSecond; + int? antiPrySwitch; + int? resetSwitch; + int? lockSwitch; + int? lockSound; + int? lockSoundVolume; + int? languageSettingLang; + int? openDirectionValue; + int? doorNotClosedAlarm; + int? unlockReminder; + int? lightingTime; + int? lightingSecond; + int? passageMode; + List? passageModeConfig; + int? attendance; + int? appUnlockOnline; + int? bluetoothBroadcast; + String? adminPwd; + int? unlockReminderPush; + String? languageSettingLangText; + + LockSettingInfo( + {this.remoteUnlock, + this.autoLock, + this.autoLockSecond, + this.antiPrySwitch, + this.resetSwitch, + this.lockSwitch, + this.lockSound, + this.lockSoundVolume, + this.languageSettingLang, + this.openDirectionValue, + this.doorNotClosedAlarm, + this.unlockReminder, + this.lightingTime, + this.lightingSecond, + this.passageMode, + this.passageModeConfig, + this.attendance, + this.appUnlockOnline, + this.bluetoothBroadcast, + this.adminPwd, + this.unlockReminderPush, + this.languageSettingLangText}); + + LockSettingInfo.fromJson(Map json) { + remoteUnlock = json['remoteUnlock']; + autoLock = json['autoLock']; + autoLockSecond = json['autoLockSecond']; + antiPrySwitch = json['antiPrySwitch']; + resetSwitch = json['resetSwitch']; + lockSwitch = json['lockSwitch']; + lockSound = json['lockSound']; + lockSoundVolume = json['lockSoundVolume']; + languageSettingLang = json['languageSettingLang']; + openDirectionValue = json['openDirectionValue']; + doorNotClosedAlarm = json['doorNotClosedAlarm']; + unlockReminder = json['unlockReminder']; + lightingTime = json['lightingTime']; + lightingSecond = json['lightingSecond']; + passageMode = json['passageMode']; + passageModeConfig = json['passageModeConfig'].cast(); + attendance = json['attendance']; + appUnlockOnline = json['appUnlockOnline']; + bluetoothBroadcast = json['bluetoothBroadcast']; + adminPwd = json['adminPwd']; + unlockReminderPush = json['unlockReminderPush']; + languageSettingLangText = json['languageSettingLangText']; + } + + Map toJson() { + final Map data = {}; + data['remoteUnlock'] = remoteUnlock; + data['autoLock'] = autoLock; + data['autoLockSecond'] = autoLockSecond; + data['antiPrySwitch'] = antiPrySwitch; + data['resetSwitch'] = resetSwitch; + data['lockSwitch'] = lockSwitch; + data['lockSound'] = lockSound; + data['lockSoundVolume'] = lockSoundVolume; + data['languageSettingLang'] = languageSettingLang; + data['openDirectionValue'] = openDirectionValue; + data['doorNotClosedAlarm'] = doorNotClosedAlarm; + data['unlockReminder'] = unlockReminder; + data['lightingTime'] = lightingTime; + data['lightingSecond'] = lightingSecond; + data['passageMode'] = passageMode; + data['passageModeConfig'] = passageModeConfig; + data['attendance'] = attendance; + data['appUnlockOnline'] = appUnlockOnline; + data['bluetoothBroadcast'] = bluetoothBroadcast; + data['adminPwd'] = adminPwd; + data['unlockReminderPush'] = unlockReminderPush; + data['languageSettingLangText'] = languageSettingLangText; + return data; + } +} + diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart index 808c4f67..02f39c72 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart @@ -17,7 +17,7 @@ import '../../../../tools/baseGetXController.dart'; import '../../../../tools/eventBusEventManage.dart'; import '../../../../tools/storage.dart'; import '../../../../tools/toast.dart'; -import 'CheckingInInfoDataEntity.dart'; +import 'checkingInInfoData_entity.dart'; import 'lockSet_state.dart'; typedef BlockSetStateCallback = void Function(); @@ -71,8 +71,7 @@ class LockSetLogic extends BaseGetXController { List publicKeyDataList = changeStringListToIntList(publicKey!); IoSenderManage.deletUser( - lockID: - state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, + lockID: BlueManage().connectDeviceName, authUserID: await Storage.getUid(), keyID: "1", delUserID: await Storage.getUid(), @@ -171,7 +170,7 @@ class LockSetLogic extends BaseGetXController { List getTokenList = changeStringListToIntList(token!); IoSenderManage.deletUser( - lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, + lockID: BlueManage().connectDeviceName, authUserID: "100001", keyID: "1", delUserID: "100001", @@ -209,10 +208,23 @@ class LockSetLogic extends BaseGetXController { }); } + // 获取锁设置信息 + void getLockSettingInfoData() async { + var entity = await ApiRepository.to.getLockSettingInfoData( + lockId: state.lockId.toString(), + ); + if (entity.errorCode!.codeIsSuccessful) { + state.lockSetInfoData.value = entity.data!; + state.lockSettingInfo.value = state.lockSetInfoData.value.lockSettingInfo!; + state.lockFeature.value = state.lockSetInfoData.value.lockFeature!; + state.lockStatus.value = state.lockSetInfoData.value.lockStatus!; + } + } + // 当是锁拥有者的时候,删除锁 void deletLockInfoData() async { var entity = await ApiRepository.to.deletOwnerLockData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), ); if (entity.errorCode!.codeIsSuccessful) { Get.offAllNamed(Routers.starLockMain); @@ -222,8 +234,8 @@ class LockSetLogic extends BaseGetXController { // 当不是锁拥有者的时候,删除钥匙 void deletKeyData() async { var entity = await ApiRepository.to.deletOwnerKeyData( - lockId: state.getKeyInfosData.value.lockId.toString(), - keyId: state.getKeyInfosData.value.keyId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), + keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), ); if (entity.errorCode!.codeIsSuccessful) { Get.offAllNamed(Routers.starLockMain); @@ -246,7 +258,7 @@ class LockSetLogic extends BaseGetXController { // if(state.currentDeviceUUid.value[31] == "1"){ // 已配对 - if(state.getKeyInfosData.value.isLockOwner == 1){ + if(state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1){ // 调用删除锁协议 factoryDataResetAction(); }else{ @@ -271,7 +283,7 @@ class LockSetLogic extends BaseGetXController { void openCheckingInData( BlockSetCheckInCallback blockSetCheckInCallback) async { var entity = await ApiRepository.to.openCheckingInData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), ); if (entity.errorCode!.codeIsSuccessful) { blockSetCheckInCallback(entity); @@ -281,7 +293,7 @@ class LockSetLogic extends BaseGetXController { // 设置是否打开考勤 void setLockSetGeneralSetting(String isOn) async { var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), changeType: "1", isOn: isOn, type: "1", @@ -289,9 +301,8 @@ class LockSetLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { eventBus.fire(RefreshLockListInfoDataEvent()); - state.getKeyInfosData.value.isAttendance = int.parse(isOn); - eventBus - .fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + // state.lockSetInfoData.value.attendance = int.parse(isOn); + // eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); Toast.show(msg: "设置成功"); } else {} } @@ -299,18 +310,15 @@ class LockSetLogic extends BaseGetXController { // 设置是否打开开锁提醒 void setLockPickingReminder() async { var entity = await ApiRepository.to.setLockPickingReminderData( - lockId: state.getKeyInfosData.value.lockId.toString(), - keyId: state.getKeyInfosData.value.keyId.toString(), - monitorFlag: - state.isLockPickingReminder.value == 1 ? "1" : "2", // 1开启,2关闭 + lockId: state.lockSetInfoData.value.lockId.toString(), + keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), + monitorFlag: state.isLockPickingReminder.value == 1 ? "1" : "2", // 1开启,2关闭 ); if (entity.errorCode!.codeIsSuccessful) { eventBus.fire(RefreshLockListInfoDataEvent()); - state.getKeyInfosData.value.monitorFlag = - state.isLockPickingReminder.value; - eventBus - .fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + // state.lockSetInfoData.value.unlockReminder = state.isLockPickingReminder.value; + // eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); Toast.show(msg: "设置成功"); } else {} } @@ -320,7 +328,7 @@ class LockSetLogic extends BaseGetXController { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus _passCurrentLockInformationEvent = eventBus.on().listen((event) { - state.getKeyInfosData.value = event.keyInfo; + // state.lockSetInfoData.value = event.keyInfo; blockSetStateCallback(); }); } @@ -340,6 +348,8 @@ class LockSetLogic extends BaseGetXController { super.onReady(); print("onReady()"); + getLockSettingInfoData(); + _initReplySubscription(); initLoadDataScanAllDeviceFindCurrentDeviceAction(); } @@ -349,6 +359,7 @@ class LockSetLogic extends BaseGetXController { // TODO: implement onInit super.onInit(); print("onInit()"); + } @override diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart index c41ac5b7..bf6fb042 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -10,8 +9,7 @@ import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/commonItem.dart'; -import '../../../../tools/eventBusEventManage.dart'; -import '../../../../tools/showIosTipView.dart'; + import '../../../../tools/showTFView.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; @@ -29,7 +27,6 @@ class LockSetPage extends StatefulWidget { class _LockSetPageState extends State with RouteAware { final logic = Get.put(LockSetLogic()); final state = Get.find().state; - StreamSubscription? _passCurrentLockInformationEvent; @override void initState() { @@ -56,47 +53,45 @@ class _LockSetPageState extends State with RouteAware { children: [ // 基本信息 CommonItem( - leftTitel: - TranslationLoader.lanKeys!.basicInformation!.tr, + leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr, rightTitle: "", isHaveLine: false, isHaveDirection: true, action: () { Get.toNamed(Routers.basicInformationPage, arguments: { - 'keyInfo': state.getKeyInfosData.value + 'lockSetInfoData': state.lockSetInfoData.value }); }), - SizedBox( - height: 10.h, - ), + SizedBox(height: 10.h), // 门磁 - Visibility( - visible: true, + Obx(() => Visibility( + visible: state.lockFeature.value.doorStatus == 1 ? true : false, child: CommonItem( leftTitel: - TranslationLoader.lanKeys!.doorMagnetic!.tr, + TranslationLoader.lanKeys!.doorMagnetic!.tr, rightTitle: "", isHaveLine: true, isHaveDirection: true, action: () { Get.toNamed(Routers.doorMagneticPage); // Toast.show(msg: "功能暂未开放"); - })), + }))), // 无线键盘 - Visibility( - visible: true, + Obx(() => Visibility( + visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false, child: CommonItem( leftTitel: - TranslationLoader.lanKeys!.wirelessKeyboard!.tr, + TranslationLoader.lanKeys!.wirelessKeyboard!.tr, rightTitle: "", isHaveLine: true, isHaveDirection: true, action: () { Get.toNamed(Routers.wirelessKeyboardPage); // Toast.show(msg: "功能暂未开放"); - })), - Visibility( - visible: true, + }))), + // 照明 + Obx(() => Visibility( + visible: state.lockFeature.value.lightingTime == 1 ? true : false, child: CommonItem( leftTitel: '照明', rightTitle: "", @@ -104,7 +99,8 @@ class _LockSetPageState extends State with RouteAware { isHaveDirection: true, action: () { Toast.show(msg: "功能暂未开放"); - })), + }))), + // 开门器 Visibility( visible: true, child: CommonItem( @@ -118,26 +114,28 @@ class _LockSetPageState extends State with RouteAware { SizedBox(height: 10.h), // 自动闭锁 Obx(() => Visibility( - visible: true, + visible: state.lockFeature.value.autoLock == 1 ? true : false, child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.automaticBlocking!.tr, - rightTitle: state - .getKeyInfosData.value.autoLockTime! > - -1 - ? "${state.getKeyInfosData.value.autoLockTime!.toString()}s" + leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr, + rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0 + ? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s" : TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, + // isHaveRightWidget: true, + // rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0 + // ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s" + // : TranslationLoader.lanKeys!.closed!.tr), action: () { - Get.toNamed(Routers.automaticBlockingPage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.automaticBlockingPage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); }))), // 锁声音 Obx(() { var titleStr = ""; - if (state.getKeyInfosData.value.lockSound == 1) { - switch (state.getKeyInfosData.value.volume) { + if ((state.lockSettingInfo.value.lockSound ?? 0) == 1) { + switch (state.lockSettingInfo.value.lockSoundVolume ?? 0) { case 1: titleStr = TranslationLoader.lanKeys!.low!.tr; break; @@ -158,80 +156,81 @@ class _LockSetPageState extends State with RouteAware { titleStr = TranslationLoader.lanKeys!.closed!.tr; } return Visibility( - visible: true, + visible: state.lockFeature.value.lockSound == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.lockSound!.tr, rightTitle: titleStr, isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.lockSoundSetPage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.lockSoundSetPage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); })); }), // 防撬报警 Obx(() => Visibility( - visible: true, + visible: state.lockFeature.value.antiPrySwitch == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr, rightTitle: - state.getKeyInfosData.value.tamperAlert == 1 + (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.burglarAlarmPage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.burglarAlarmPage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); }))), SizedBox(height: 10.h), // 常开模式 Obx(() => Visibility( - visible: true, + // visible: state.lockFeature.value.passageMode == 1 ? true : false, + visible:true, child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.normallyOpenMode!.tr, - rightTitle: - state.getKeyInfosData.value.passageMode == 1 + leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr, + rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.normallyOpenModePage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.normallyOpenModePage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); }))), // 远程开锁 Obx(() => Visibility( - visible: true, - child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.remoteUnlocking!.tr, - rightTitle: - state.getKeyInfosData.value.remoteEnable == 1 + visible: state.lockFeature.value.remoteUnlock == 1 ? true : false, + child: CommonItem(leftTitel: + TranslationLoader.lanKeys!.remoteUnlocking!.tr, + rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.remoteUnlockingPage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.remoteUnlockingPage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); }))), // 重置键 Obx(() => Visibility( - visible: true, + visible: state.lockFeature.value.resetSwitch == 1 ? true : false, child: CommonItem( leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, - rightTitle: - state.getKeyInfosData.value.resetButton == 1 + rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr, isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.resetButtonPage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.resetButtonPage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); }))), SizedBox(height: 10.h), //---田总新增展示 @@ -318,100 +317,104 @@ class _LockSetPageState extends State with RouteAware { // ), SizedBox(height: 10.h), //-----新增至此 + // 标记房态 Obx(() { var title = ""; - if (state.getKeyInfosData.value.roomStatus == 1) { + if (state.lockSettingInfo.value.passageMode == 1) { title = TranslationLoader.lanKeys!.checkedIn!.tr; - } else if (state.getKeyInfosData.value.roomStatus == 2) { + } else if (state.lockSettingInfo.value.passageMode == 2) { title = TranslationLoader.lanKeys!.leisure!.tr; } return Visibility( - visible: true, + visible: state.lockStatus.value.roomStatus == 1 ? true : false, child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.markedHouseState!.tr, + leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr, rightTitle: title, isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.markedHouseStatePage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.markedHouseStatePage, arguments: state.lockSetInfoData.value); })); }), - // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, - rightTitle: "", - isHaveLine: true, - isHaveRightWidget: true, - rightWidget: SizedBox( - width: 60.w, child: _openCheckInSwitch()))), - // ), - // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.unlockReminder!.tr, - rightTitle: "", - isHaveLine: false, - isHaveRightWidget: true, - rightWidget: SizedBox( - width: 60.w, child: _lockRemindSwitch()))), - // ), + // 考勤 + Obx(() => + Visibility( + visible: state.lockFeature.value.attendance == 1 ? true : false, + child: CommonItem( + leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, + rightTitle: "", + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, child: _openCheckInSwitch()))), + ), + // 开锁提醒 + Obx(() => + Visibility( + visible: state.lockFeature.value.unlockReminder == 1 ? true : false, + child: CommonItem( + leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, + rightTitle: "", + isHaveLine: false, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, child: _lockRemindSwitch()))), + ), SizedBox(height: 10.h), + // wifi配网 + Obx(() => + Visibility( + visible: state.lockFeature.value.wifi == 1 ? true : false, + child: CommonItem(leftTitel: TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.configuringWifiPage); + })), + ), // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: TranslationLoader - .lanKeys!.wifiDistributionNetwork!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.configuringWifiPage); - })), + // 锁时间 + Visibility( + visible: true, + child: CommonItem( + leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.lockTimePage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); + })), // ), // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.lockTimePage, - arguments: state.getKeyInfosData.value); - })), + // 诊断 + Visibility( + visible: true, + child: CommonItem( + leftTitel: TranslationLoader.lanKeys!.diagnose!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.diagnosePage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); + })), // ), // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.diagnose!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.diagnosePage, - arguments: state.getKeyInfosData.value); - })), - // ), - // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: TranslationLoader.lanKeys!.uploadData!.tr, - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.uploadDataPage); - })), + // 上传数据 + Visibility( + visible: true, + child: CommonItem( + leftTitel: TranslationLoader.lanKeys!.uploadData!.tr, + rightTitle: "", + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.uploadDataPage); + })), // ), // Obx(() => // Visibility( @@ -427,17 +430,18 @@ class _LockSetPageState extends State with RouteAware { // })), // ), // Obx(() => - Visibility( - visible: true, - child: CommonItem( - leftTitel: - TranslationLoader.lanKeys!.lockEscalation!.tr, - rightTitle: "", - isHaveLine: false, - isHaveDirection: true, - action: () { - Get.toNamed(Routers.lockEscalationPage); - })), + // 锁升级 + Visibility( + visible: true, + child: CommonItem( + leftTitel: + TranslationLoader.lanKeys!.lockEscalation!.tr, + rightTitle: "", + isHaveLine: false, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.lockEscalationPage); + })), // ), SizedBox(height: 30.h), Container( @@ -461,12 +465,16 @@ class _LockSetPageState extends State with RouteAware { )); } + Widget rightText(String rightTitle){ + return Text(rightTitle ?? "", textAlign: TextAlign.end, style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor)); + } + CupertinoSwitch _openCheckInSwitch() { return CupertinoSwitch( activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, - value: (state.getKeyInfosData.value.isAttendance == 1) ? true : false, + value: ((state.lockSettingInfo.value.attendance ?? 0) == 1) ? true : false, onChanged: (value) { setState(() { int isOnStr; @@ -493,11 +501,10 @@ class _LockSetPageState extends State with RouteAware { activeColor: CupertinoColors.activeBlue, trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, - value: state.isLockPickingReminder.value == 1 ? true : false, + value: (state.lockSettingInfo.value.unlockReminder ?? 0) == 1 ? true : false, onChanged: (value) { setState(() { - state.isLockPickingReminder.value = - state.isLockPickingReminder.value == 1 ? 2 : 1; + state.isLockPickingReminder.value = state.isLockPickingReminder.value == 1 ? 2 : 1; logic.setLockPickingReminder(); }); }, @@ -535,8 +542,9 @@ class _LockSetPageState extends State with RouteAware { child: Text(TranslationLoader.lanKeys!.sure!.tr), onPressed: () { Navigator.pop(context); - Get.toNamed(Routers.checkInCreatCompanyPage, - arguments: state.getKeyInfosData.value); + Get.toNamed(Routers.checkInCreatCompanyPage, arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); }, ), ], diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart index 27386e3d..7304e199 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_state.dart @@ -1,11 +1,15 @@ - import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; +import 'lockSetInfo_entity.dart'; class LockSetState { - final getKeyInfosData = KeyInfos().obs; + final lockSetInfoData = LockSetInfoData().obs; + final lockFeature = LockFeature().obs; + final lockSettingInfo = LockSettingInfo().obs; + final lockStatus = LockStatus().obs; + + final lockId = 0.obs; var isAttendance = 1.obs;// 是否开启考勤 var currentDeviceUUid = "".obs;// 当前设备的uuid @@ -13,8 +17,11 @@ class LockSetState { var passwordTF = TextEditingController(); LockSetState() { - getKeyInfosData.value = Get.arguments as KeyInfos; - isAttendance.value = getKeyInfosData.value.isAttendance!; - isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!; + Map map = Get.arguments; + lockId.value = map["lockId"]; + + // getKeyInfosData.value = Get.arguments as KeyInfos; + // isAttendance.value = getKeyInfosData.value.isAttendance!; + // isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart index 76c8d054..6baebc17 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_logic.dart @@ -22,27 +22,17 @@ class LockSoundSetLogic extends BaseGetXController { // 配置锁的常开模式设置 -> 锁声音设置 void _setLockSetGeneralSetting() async{ - int isOn; - int type; - if(state.isOpenLockSound.value == false){ - // 音量关了的时候 - isOn = 2; type = 6; - }else{ - // 音量开了的时候 - isOn = state.lockSoundLevel.value; type = 8; - } - var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.getKeyInfosData.value.lockId.toString(), - changeType:"1", - isOn:isOn.toString(), // 1-开启、2-关闭; 设置音量:1到5; - type:type.toString(), // 6-锁声音开关 8-音量、 + var entity = await ApiRepository.to.setLockSound( + lockId: state.lockSetInfoData.value.lockId!, + lockSound:state.isOpenLockSound.value == true ? 1 : 0, + lockSoundVolume:state.lockSoundLevel.value ); if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); - state.getKeyInfosData.value.lockSound = state.isOpenLockSound.value == true ? 1 :2; - state.getKeyInfosData.value.volume = state.lockSoundLevel.value; - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :2; + state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value; + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); } } @@ -51,6 +41,7 @@ class LockSoundSetLogic extends BaseGetXController { late StreamSubscription _replySubscription; void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + // 设置支持功能解析(带参数) if(reply is SetSupportFunctionsWithParametersReply) { _replySetSupportFunctionsWithParameters(reply); } @@ -95,7 +86,7 @@ class LockSoundSetLogic extends BaseGetXController { } } - // 设置自动落锁数据解析 + // 设置支持功能解析 Future _replySetSupportFunctionsWithParameters(Reply reply) async { int status = reply.data[2]; switch(status){ @@ -141,7 +132,7 @@ class LockSoundSetLogic extends BaseGetXController { List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.readSupportFunctionsWithParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 33, token: getTokenList, @@ -175,7 +166,7 @@ class LockSoundSetLogic extends BaseGetXController { type = state.lockSoundLevel.value; } IoSenderManage.setSupportFunctionsWithParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 33, featureParaLength: 1, diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart index c3867c83..20ca6ec9 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSoundSet/lockSoundSet_state.dart @@ -1,16 +1,19 @@ import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class LockSoundSetState { - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; var isOpenLockSound = false.obs;// 是否开启声音 var lockSoundLevel = 0.obs;// 音量等级 LockSoundSetState() { - getKeyInfosData.value = Get.arguments as KeyInfos; - isOpenLockSound.value = getKeyInfosData.value.lockSound == 1 ? true : false; - lockSoundLevel.value = getKeyInfosData.value.volume!; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + + isOpenLockSound.value = lockSetInfoData.value.lockSettingInfo!.lockSound == 1 ? true : false; + lockSoundLevel.value = lockSetInfoData.value.lockSettingInfo!.lockSoundVolume!; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart b/star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart new file mode 100644 index 00000000..6bc69cbb --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart @@ -0,0 +1,45 @@ + +class GetServerDatetimeEntity { + int? errorCode; + String? description; + String? errorMsg; + Data? data; + + GetServerDatetimeEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + GetServerDatetimeEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? Data.fromJson(json['data']) : null; + } + + 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; + } +} + +class Data { + String? date; + + Data( + {this.date}); + + Data.fromJson(Map json) { + date = json['date']; + } + + Map toJson() { + final Map data = {}; + data['date'] = date; + return data; + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart index 311e4128..96c22eb0 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_logic.dart @@ -173,7 +173,7 @@ class LockTimeLogic extends BaseGetXController{ // 从网关获取时间 void getLockTimeFromGateway() async{ var entity = await ApiRepository.to.getLockTimeFromGateway( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), ); if(entity.errorCode!.codeIsSuccessful){ @@ -183,7 +183,7 @@ class LockTimeLogic extends BaseGetXController{ // 从服务器获取锁的时间 void getServerDatetime() async{ var entity = await ApiRepository.to.getServerDatetimeData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), ); if(entity.errorCode!.codeIsSuccessful){ String dataEime = DateTool().dateToYMDHNSString("${int.parse(entity.data!.date!)}"); diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_state.dart b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_state.dart index 7a5eebd4..29bfe905 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockTime/lockTime_state.dart @@ -1,15 +1,14 @@ - import 'package:get/get.dart'; - -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class LockTimeState{ + var lockSetInfoData = LockSetInfoData().obs; var dateTime = "".obs; - var getKeyInfosData = KeyInfos().obs; - LockTimeState() { - getKeyInfosData.value = Get.arguments as KeyInfos; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; } + } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart index 510c1fc6..8da99e92 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_logic.dart @@ -10,7 +10,7 @@ import 'markedHouseState_state.dart'; class MarkedHouseStateLogic extends BaseGetXController{ MarkedHouseStateState state = MarkedHouseStateState(); - // 配置锁的常开模式设置 + // 标记房态 Future setLockSetGeneralSetting() async{ var entity = await ApiRepository.to.setLockSetGeneralSettingData( lockId: state.getKeyInfosData.value.lockId.toString(), @@ -22,8 +22,8 @@ class MarkedHouseStateLogic extends BaseGetXController{ eventBus.fire(RefreshLockListInfoDataEvent()); state.roomStatus.value = state.roomStatus.value; - state.getKeyInfosData.value.roomStatus = state.roomStatus.value; - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + // state.getKeyInfosData.value.antiPrySwitch = state.roomStatus.value; + // eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value.lockSetting!)); Toast.show(msg: "操作成功"); }else if(entity.errorCode! == 1){ // 跳转到高级功能界面 需要开通高级功能 diff --git a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart index 8731eb4b..c406e164 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/markedHouseState/markedHouseState_state.dart @@ -1,16 +1,18 @@ - import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class MarkedHouseStateState{ - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; + final getKeyInfosData = LockListInfoItemEntity().obs; var roomStatus = 0.obs; MarkedHouseStateState() { - getKeyInfosData.value = Get.arguments as KeyInfos; - roomStatus.value = getKeyInfosData.value.roomStatus!; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + getKeyInfosData.value = map["keyInfo"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart new file mode 100644 index 00000000..c4790e53 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart @@ -0,0 +1,65 @@ + +class GetPassageModeConfigEntity { + int? errorCode; + String? description; + String? errorMsg; + Data? data; + + GetPassageModeConfigEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + GetPassageModeConfigEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? Data.fromJson(json['data']) : null; + } + + 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; + } +} + +class Data { + int? passageMode; + int? startDate; + int? endDate; + int? isAllDay; + List? weekDays; + int? autoUnlock; + + Data( + {this.passageMode, + this.startDate, + this.endDate, + this.isAllDay, + this.weekDays, + this.autoUnlock}); + + Data.fromJson(Map json) { + passageMode = json['passageMode']; + startDate = json['startDate']; + endDate = json['endDate']; + isAllDay = json['isAllDay']; + weekDays = json['weekDays']; + autoUnlock = json['autoUnlock']; + } + + Map toJson() { + final Map data = {}; + data['passageMode'] = passageMode; + data['startDate'] = startDate; + data['endDate'] = endDate; + data['isAllDay'] = isAllDay; + data['weekDays'] = weekDays; + data['autoUnlock'] = autoUnlock; + return data; + } +} diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart index f0e3f651..4eb7ca89 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_logic.dart @@ -26,7 +26,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ // 获取锁的常开模式设置 void getNormallyOpenModeConfig() async{ var entity = await ApiRepository.to.getPassageModeConfig( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), ); if(entity.errorCode!.codeIsSuccessful){ state.getPassageModeConfigData.value = entity; @@ -51,7 +51,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ print("state.isOpenNormallyOpenMode.value:${state.isOpenNormallyOpenMode.value}"); var entity = await ApiRepository.to.configPassageModeLoadData( - lockId: state.getKeyInfosData.value.lockId.toString(), + lockId: state.lockSetInfoData.value.lockId.toString(), passageMode:state.isOpenNormallyOpenMode.value == true ? "1":"2", autoUnlock:state.isOpenAutomaticUnLock.value == true ? "1":"2", type: "1", @@ -63,8 +63,8 @@ class NormallyOpenModeLogic extends BaseGetXController{ if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); - state.getKeyInfosData.value.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:2; - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:2; + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); } } @@ -163,7 +163,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.readSupportFunctionsWithParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 50, token: getTokenList, @@ -197,7 +197,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ list.add(state.isOpenAutomaticUnLock.value == true ? 1:0); IoSenderManage.setSupportFunctionsWithParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 50, featureParaLength: 8, @@ -216,7 +216,7 @@ class NormallyOpenModeLogic extends BaseGetXController{ super.onReady(); print("onReady()"); - if(state.getKeyInfosData.value.passageMode == 1){ + if(state.lockSetInfoData.value.lockSettingInfo!.passageMode == 1){ getNormallyOpenModeConfig(); } diff --git a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart index 95675e05..348a6b31 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/normallyOpenMode/normallyOpenMode_state.dart @@ -1,12 +1,12 @@ - import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart'; +import 'package:star_lock/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class NormallyOpenModeState{ - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; var getPassageModeConfigData = GetPassageModeConfigEntity().obs; var isOpenNormallyOpenMode = false.obs;// 是否开启常开模式 常开模式:1-开启、2-关闭 @@ -19,6 +19,7 @@ class NormallyOpenModeState{ var endTimeMinute = 0.obs;// 结束时间分钟 NormallyOpenModeState() { - getKeyInfosData.value = Get.arguments as KeyInfos; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_logic.dart index 84867f06..76df2428 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_logic.dart @@ -8,7 +8,6 @@ import '../../../../blue/blue_manage.dart'; import '../../../../blue/io_protocol/io_readSupportFunctionsNoParameters.dart'; import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart'; import '../../../../blue/io_reply.dart'; -import '../../../../blue/io_tool/io_manager.dart'; import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; @@ -22,20 +21,16 @@ class RemoteUnlockingLogic extends BaseGetXController{ void _remoteUnlockingOpenOrClose() async{ var entity = await ApiRepository.to.remoteUnlockingOpenOrClose( - lockId: state.getKeyInfosData.value.lockId.toString(), - // featureValue:state.getKeyInfosData.value.featureValue.toString() - featureValue:"1234" + lockId: state.lockSetInfoData.value.lockId!, + remoteUnlock:state.remoteEnable.value == 1 ? 0 : 1 ); if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); - if(state.remoteEnable.value == 1){ - state.remoteEnable.value = 2; - }else if(state.remoteEnable.value == 2){ - state.remoteEnable.value = 1; - } - state.getKeyInfosData.value.remoteEnable = state.remoteEnable.value; - print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.getKeyInfosData.value.remoteEnable}"); - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + + state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1; + state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value; + print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}"); + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); } } @@ -129,7 +124,7 @@ class RemoteUnlockingLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.readSupportFunctionsNoParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 28, token: getTokenList, @@ -155,7 +150,7 @@ class RemoteUnlockingLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.setSupportFunctionsNoParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 28, featureEnable: state.remoteEnable.value == 1 ? 0 : 1, diff --git a/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_state.dart b/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_state.dart index 146b6ac6..017af500 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/remoteUnlocking/remoteUnlocking_state.dart @@ -1,13 +1,16 @@ import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class RemoteUnlockingState{ - var getKeyInfosData = KeyInfos().obs; + var lockSetInfoData = LockSetInfoData().obs; var remoteEnable = 1.obs; + RemoteUnlockingState() { - getKeyInfosData.value = Get.arguments as KeyInfos; - remoteEnable.value = getKeyInfosData.value.remoteEnable!; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + + remoteEnable.value = lockSetInfoData.value.lockSettingInfo!.remoteUnlock!; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_logic.dart index ee1f26a6..27d8f66b 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_logic.dart @@ -23,18 +23,16 @@ class ResetButtonLogic extends BaseGetXController{ // 配置锁的常开模式设置 -> 重置开关 Future _setLockSetGeneralSetting() async{ - var entity = await ApiRepository.to.setLockSetGeneralSettingData( - lockId: state.getKeyInfosData.value.lockId.toString(), - changeType:"1", - isOn:state.resetButtonEnable.value == 1 ? "2" : "1", // 1-开启、2-关闭; - type:"4", // 4 重置键开关 + var entity = await ApiRepository.to.setResetButtonData( + lockId: state.lockSetInfoData.value.lockId!, + resetSwitch:state.resetButtonEnable.value == 1 ? 0 : 1, ); if(entity.errorCode!.codeIsSuccessful){ eventBus.fire(RefreshLockListInfoDataEvent()); state.resetButtonEnable.value = state.resetButtonEnable.value == 1 ? 2 : 1; - state.getKeyInfosData.value.resetButton = state.resetButtonEnable.value; - eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value)); + state.lockSetInfoData.value.lockSettingInfo!.resetSwitch = state.resetButtonEnable.value; + eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Toast.show(msg: "操作成功"); } } @@ -128,7 +126,7 @@ class ResetButtonLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.readSupportFunctionsNoParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 31, token: getTokenList, @@ -154,7 +152,7 @@ class ResetButtonLogic extends BaseGetXController{ List getPublicKeyList = changeStringListToIntList(publicKey!); IoSenderManage.setSupportFunctionsNoParametersCommand( - keyID: state.getKeyInfosData.value.keyId.toString(), + keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), featureBit: 31, featureEnable: state.resetButtonEnable.value == 1 ? 0 : 1, diff --git a/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_state.dart b/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_state.dart index 7fed643a..b22aee82 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_state.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/resetButton/resetButton_state.dart @@ -1,16 +1,19 @@ import 'package:get/get.dart'; -import '../../../lockMian/entity/lockInfoEntity.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; +import '../lockSet/lockSetInfo_entity.dart'; class ResetButtonState{ + var lockSetInfoData = LockSetInfoData().obs; - var getKeyInfosData = KeyInfos().obs; var resetButtonEnable = 1.obs; ResetButtonState() { - getKeyInfosData.value = Get.arguments as KeyInfos; - resetButtonEnable.value = getKeyInfosData.value.tamperAlert!; + var map = Get.arguments; + lockSetInfoData.value = map["lockSetInfoData"]; + + resetButtonEnable.value = lockSetInfoData.value.lockSettingInfo!.resetSwitch!; } } \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart index d4fb7a1f..2bf1d1e1 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart @@ -1,13 +1,13 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:star_lock/tools/baseGetXController.dart'; import '../../../app_settings/app_colors.dart'; import '../../../network/api_repository.dart'; import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; -import '../../lockMian/entity/lockInfoEntity.dart'; +// import '../../lockMian/entity/lockInfoEntity.dart'; +import '../../lockMian/entity/lockListInfo_entity.dart'; import 'lockDetail_page.dart'; class LockDetailMainPage extends StatefulWidget { @@ -20,17 +20,17 @@ class LockDetailMainPage extends StatefulWidget { class _LockDetailMainPageState extends State { - void getLockInfo() async{ - var entity = await ApiRepository.to.getLockInfo( - lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(), - pageNo:"1", - ); - if(entity.errorCode!.codeIsSuccessful){ - - }else{ - - } - } + // void getLockInfo() async{ + // var entity = await ApiRepository.to.getLockInfo( + // lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(), + // pageNo:"1", + // ); + // if(entity.errorCode!.codeIsSuccessful){ + // + // }else{ + // + // } + // } @override void initState() { @@ -41,14 +41,14 @@ class _LockDetailMainPageState extends State { @override Widget build(BuildContext context) { - final isFrist; - KeyInfos keyInfos = KeyInfos(); - LockMainEntity lockEntity = LockMainEntity(); + final bool isFrist; + LockListInfoItemEntity keyInfos = LockListInfoItemEntity(); + // LockMainEntity lockEntity = LockMainEntity(); dynamic obj = ModalRoute.of(context)?.settings.arguments; - if (obj != null && (obj["lockMainEntity"] != null)) { - lockEntity = obj["lockMainEntity"]; - } + // if (obj != null && (obj["lockMainEntity"] != null)) { + // lockEntity = obj["lockMainEntity"]; + // } if (obj != null && (obj["keyInfo"] != null)) { keyInfos = obj["keyInfo"]; } @@ -58,7 +58,7 @@ class _LockDetailMainPageState extends State { barTitle: TranslationLoader.lanKeys!.starLock!.tr, haveBack: true, backgroundColor: AppColors.mainColor), - body: LockDetailPage(isFrist:true ,lockMainEntity:lockEntity, keyInfo: keyInfos), + body: LockDetailPage(isFrist:true, lockListInfoItemEntity: keyInfos), // body: Container(), ); } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index b9595cd7..05fe7a6e 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1,30 +1,25 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:get/get.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; import '../../../blue/blue_manage.dart'; -import '../../../blue/io_tool/io_manager.dart'; import '../../../blue/io_tool/io_tool.dart'; -import '../../../tools/appRouteObserver.dart'; import '../../../tools/storage.dart'; import '../../../tools/toast.dart'; import '../../../translations/trans_lib.dart'; -import '../../lockMian/entity/lockInfoEntity.dart'; +import '../../lockMian/entity/lockListInfo_entity.dart'; import 'lockDetail_logic.dart'; class LockDetailPage extends StatefulWidget { - final isFrist; - final KeyInfos keyInfo; - final LockMainEntity lockMainEntity; + final bool isFrist; + final LockListInfoItemEntity lockListInfoItemEntity; const LockDetailPage( {Key? key, - required this.lockMainEntity, required this.isFrist, - required this.keyInfo}) + required this.lockListInfoItemEntity}) : super(key: key); @override @@ -40,7 +35,7 @@ class _LockDetailPageState extends State with TickerProviderStat // TODO: implement initState super.initState(); - state.keyInfos.value = widget.keyInfo; + state.keyInfos.value = widget.lockListInfoItemEntity; BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!; // BlueManage().connectDeviceMacAddress = @@ -63,10 +58,6 @@ class _LockDetailPageState extends State with TickerProviderStat var saveSignKeyList = changeIntListToStringList(signKeyData); Storage.setStringList(saveBlueSignKey, saveSignKeyList); - // token - // Storage.setStringList(saveBlueToken, ["0", "0", "0", "0"]); - // print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList"); - // logic.startScanAction(); listeningAnimations(); @@ -79,7 +70,9 @@ class _LockDetailPageState extends State with TickerProviderStat height: 1.sh - ScreenUtil().statusBarHeight * 2, color: Colors.white, child: Column( - children: [topWidget(), Expanded(child: bottomWidget())], + children: [ + topWidget(), + Expanded(child: bottomWidget())], ), ); } @@ -123,7 +116,7 @@ class _LockDetailPageState extends State with TickerProviderStat children: [ Container( width: 1.sw - 120.w*2, - child: Center(child: Text(widget.keyInfo!.lockAlias!, style:TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),)) + child: Center(child: Text(widget.lockListInfoItemEntity!.lockAlias!, style:TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),)) ), Positioned( child: Row( @@ -290,15 +283,13 @@ class _LockDetailPageState extends State with TickerProviderStat return Container( margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h), // color: Colors.blue, - child: SizedBox( - child: GridView.count( - crossAxisCount: 4, - // childAspectRatio: 3, - crossAxisSpacing: 20.w, - mainAxisSpacing: 0.h, - physics: const NeverScrollableScrollPhysics(), - children: getShowWidget()), - ), + child: GridView.count( + crossAxisCount: 4, + // childAspectRatio: 3, + crossAxisSpacing: 20.w, + mainAxisSpacing: 0.h, + physics: const NeverScrollableScrollPhysics(), + children: getShowWidget()), ); } @@ -306,7 +297,7 @@ class _LockDetailPageState extends State with TickerProviderStat var showWidgetArr = []; // 考勤 - if (state.keyInfos.value.isAttendance == 1) { + if (state.keyInfos.value.lockSetting!.attendance == 1) { showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, () { Get.toNamed(Routers.checkingInListPage, @@ -314,81 +305,87 @@ class _LockDetailPageState extends State with TickerProviderStat })); } - var defaultWidgetArr = [ - // 电子钥匙 - bottomItem('images/main/icon_main_electronicKey.png', - TranslationLoader.lanKeys!.electronicKey!.tr, () { - Get.toNamed(Routers.electronicKeyListPage, arguments: { - "lockMainEntity": widget.lockMainEntity, - "keyInfo": widget.keyInfo + // 电子钥匙 + showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, () { + Get.toNamed(Routers.electronicKeyListPage, arguments: { + "keyInfo": widget.lockListInfoItemEntity + }); + })); + + // 密码 + showWidgetArr.add(bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, () { + Get.toNamed(Routers.passwordKeyListPage, arguments: { + "keyInfo": widget.lockListInfoItemEntity + }); + })); + + // ic卡 + if (state.keyInfos.value.lockFeature!.icCard == 1) { + showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () { + Get.toNamed(Routers.otherTypeKeyListPage, arguments: { + "lockId": widget.lockListInfoItemEntity.lockId, + "fromType": 0 }); - }), + })); + } - // 密码 - bottomItem('images/main/icon_main_password.png', - TranslationLoader.lanKeys!.password!.tr, () { - Get.toNamed(Routers.passwordKeyListPage, arguments: { - "lockMainEntity": widget.lockMainEntity, - "keyInfo": widget.keyInfo - }); - }), - - // ic卡 - bottomItem('images/main/icon_main_icCard.png', - TranslationLoader.lanKeys!.card!.tr, () { - Get.toNamed(Routers.otherTypeKeyListPage, - arguments: {"lockId": widget.keyInfo.lockId, "fromType": 0}); - }), - - // 指纹 - bottomItem('images/main/icon_main_fingerprint.png', + // 指纹 + if (state.keyInfos.value.lockFeature!.fingerprint == 1) { + showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, () { - Get.toNamed(Routers.otherTypeKeyListPage, - arguments: {"lockId": widget.keyInfo.lockId, "fromType": 1}); - }), + Get.toNamed(Routers.otherTypeKeyListPage, arguments: { + "lockId": widget.lockListInfoItemEntity.lockId, + "fromType": 1 + }); + })); + } - // 遥控 - bottomItem('images/main/icon_main_remoteControl.png', + // 遥控 + if (state.keyInfos.value.lockFeature!.bluetoothRemoteControl == 1) { + showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, () { - Get.toNamed(Routers.otherTypeKeyListPage, - arguments: {"lockId": widget.keyInfo.lockId, "fromType": 2}); - }), - ]; - showWidgetArr.addAll(defaultWidgetArr); + Get.toNamed(Routers.otherTypeKeyListPage, arguments: { + "lockId": widget.lockListInfoItemEntity.lockId, + "fromType": 2 + }); + })); + } //可视对讲门锁新增->人脸 - showWidgetArr.add( - bottomItem('images/main/icon_face.png', '人脸', () { - // Navigator.pushNamed(context, Routers.otherTypeKeyListPage, - // arguments: 1); - Toast.show(msg: "功能暂未开放"); - }), - ); + if (state.keyInfos.value.lockFeature!.d3Face == 1) { + showWidgetArr.add( + bottomItem('images/main/icon_face.png', '人脸', () { + // Navigator.pushNamed(context, Routers.otherTypeKeyListPage, + // arguments: 1); + Toast.show(msg: "功能暂未开放"); + }), + ); + } //可视对讲门锁新增->监控 - showWidgetArr.add( - bottomItem('images/main/icon_catEyes.png', '监控', () { - // Navigator.pushNamed(context, Routers.otherTypeKeyListPage, - // arguments: 1); - Toast.show(msg: "功能暂未开放"); - }), - ); + if (state.keyInfos.value.lockFeature!.videoIntercom == 1) { + showWidgetArr.add( + bottomItem('images/main/icon_catEyes.png', '监控', () { + // Navigator.pushNamed(context, Routers.otherTypeKeyListPage, + // arguments: 1); + Toast.show(msg: "功能暂未开放"); + }), + ); + } var endWiddget = [ // 授权管理员 bottomItem('images/main/icon_main_authorizedAdmin.png', TranslationLoader.lanKeys!.authorizedAdmin!.tr, () { Get.toNamed(Routers.authorizedAdminListPage, arguments: { - "lockMainEntity": widget.lockMainEntity, - "keyInfo": widget.keyInfo + "keyInfo": widget.lockListInfoItemEntity }); }), // 操作记录 bottomItem('images/main/icon_main_operatingRecord.png', TranslationLoader.lanKeys!.operatingRecord!.tr, () { Get.toNamed(Routers.lockOperatingRecordPage, arguments: { - "lockMainEntity": widget.lockMainEntity, - "keyInfo": widget.keyInfo + "keyInfo": widget.lockListInfoItemEntity }); }), // 设置 @@ -396,7 +393,9 @@ class _LockDetailPageState extends State with TickerProviderStat 'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () { BlueManage().stopScan(); - Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo); + Get.toNamed(Routers.lockSetPage, arguments: { + "lockId": widget.lockListInfoItemEntity.lockId + }); }), ]; showWidgetArr.addAll(endWiddget); diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart index b2fe9519..1f836ecb 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import '../../lockMian/entity/lockInfoEntity.dart'; +import '../../lockMian/entity/lockListInfo_entity.dart'; // enum RKConnectState { // NULL, @@ -15,7 +15,7 @@ import '../../lockMian/entity/lockInfoEntity.dart'; // } class LockDetailState { - Rx keyInfos = KeyInfos().obs; + Rx keyInfos = LockListInfoItemEntity().obs; //过渡动画控制器 late AnimationController animationController; diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart index ac992187..ca96ce6e 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart @@ -1,12 +1,11 @@ import 'package:get/get.dart'; -import '../../../tools/storage.dart'; -import '../../lockMian/entity/lockInfoEntity.dart'; +import '../../lockMian/entity/lockListInfo_entity.dart'; import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart'; class LockOperatingRecordState{ - final keyInfos = KeyInfos().obs; + final keyInfos = LockListInfoItemEntity().obs; final lockOperatingRecordListData = [].obs; LockOperatingRecordState() { keyInfos.value = Get.arguments["keyInfo"]; diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index ede3e2ca..7bbdd9de 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -87,7 +87,6 @@ class _PasswordKeyListPageState extends State { onClick: () { Navigator.pushNamed(context, Routers.passwordKeyManagePage, arguments: { - "lockMainEntity": state.lockMainEntity.value, "keyInfo": state.keyInfo.value }).then((val) { if (val != null) { diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart index de9cc5b5..e1064702 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; + +import '../../../lockMian/entity/lockListInfo_entity.dart'; class PasswordKeyListState { - final keyInfo = KeyInfos().obs; - final lockMainEntity = LockMainEntity().obs; + final keyInfo = LockListInfoItemEntity().obs; var pageNum = 1.obs; //请求页码 final pageSize = 20.obs; //请求每页数据条数 final itemDataList = [].obs; @@ -13,7 +13,6 @@ class PasswordKeyListState { PasswordKeyListState() { Map map = Get.arguments; - lockMainEntity.value = map["lockMainEntity"]; keyInfo.value = map["keyInfo"]; } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart index 29036c38..a4510e09 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; class PasswordKeyManagePage extends StatefulWidget { const PasswordKeyManagePage({Key? key}) : super(key: key); @@ -16,15 +16,11 @@ class PasswordKeyManagePage extends StatefulWidget { class _PasswordKeyManagePageState extends State { var index = 0; - late KeyInfos keyInfo; - late LockMainEntity lockMainEntity; + late LockListInfoItemEntity keyInfo; @override Widget build(BuildContext context) { dynamic obj = ModalRoute.of(context)?.settings.arguments; - if (obj != null && (obj["lockMainEntity"] != null)) { - lockMainEntity = obj["lockMainEntity"]; - } if (obj != null && (obj["keyInfo"] != null)) { keyInfo = obj["keyInfo"]; } @@ -40,7 +36,6 @@ class _PasswordKeyManagePageState extends State { PasswordKeyManageTabbarPage( initialIndex: index, keyInfo: keyInfo, - lockMainEntity: lockMainEntity, ), ], ), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart index 905c0cb5..ff466c5b 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart @@ -1,23 +1,21 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/CustomUnderlineTabIndicator.dart'; import '../../../../translations/trans_lib.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart'; class PasswordKeyManageTabbarPage extends StatefulWidget { var initialIndex = 1; - final KeyInfos keyInfo; - final LockMainEntity lockMainEntity; + final LockListInfoItemEntity keyInfo; PasswordKeyManageTabbarPage( {Key? key, required this.initialIndex, - required this.keyInfo, - required this.lockMainEntity}) + required this.keyInfo}) : super(key: key); @override State createState() => @@ -106,7 +104,6 @@ class _PasswordKeyManageTabbarPageState .map((ItemView item) => PasswordKeyPerpetualPage( type: item.type, getKeyInfo: widget.keyInfo, - lockMainEntity: widget.lockMainEntity, )) .toList(), ), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart index 10561193..ed75ae23 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart @@ -9,7 +9,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/storage.dart'; @@ -19,21 +18,17 @@ import '../../../../appRouters.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../translations/trans_lib.dart'; +import '../../../lockMian/entity/lockListInfo_entity.dart'; class PasswordKeyPerpetualPage extends StatefulWidget { final String type; - final KeyInfos getKeyInfo; - final LockMainEntity lockMainEntity; + final LockListInfoItemEntity getKeyInfo; const PasswordKeyPerpetualPage( - {Key? key, - required this.type, - required this.getKeyInfo, - required this.lockMainEntity}) - : super(key: key); + {Key? key, required this.type, required this.getKeyInfo}) : super(key: key); + @override - State createState() => - _PasswordKeyPerpetualPageState(); + State createState() => _PasswordKeyPerpetualPageState(); } class _PasswordKeyPerpetualPageState extends State { diff --git a/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart b/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart index d8079371..52747a4a 100644 --- a/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart +++ b/star_lock/lib/main/lockMian/demoMode/demoModeLockDetail/demoModeLockDetail_page.dart @@ -7,7 +7,7 @@ import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; -import '../../entity/lockInfoEntity.dart'; +import '../../entity/lockListInfo_entity.dart'; import 'demoModeLockDetail_logic.dart'; class DemoModeLockDetailPage extends StatefulWidget { @@ -228,7 +228,7 @@ class _DemoModeLockDetailPageState extends State { showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png', TranslationLoader.lanKeys!.checkingIn!.tr, () { // gotoLogin(); - Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos()); + Get.toNamed(Routers.checkingInListPage, arguments: LockListInfoItemEntity()); })); // } @@ -239,8 +239,7 @@ class _DemoModeLockDetailPageState extends State { // gotoLogin(); Get.toNamed(Routers.electronicKeyListPage, arguments: { - "lockMainEntity": LockMainEntity(), - "keyInfo": KeyInfos() + "keyInfo": LockListInfoItemEntity() }); }), @@ -250,8 +249,7 @@ class _DemoModeLockDetailPageState extends State { // gotoLogin(); Get.toNamed(Routers.passwordKeyListPage, arguments: { - "lockMainEntity": LockMainEntity(), - "keyInfo": KeyInfos() + "keyInfo": LockListInfoItemEntity() }); }), @@ -315,8 +313,7 @@ class _DemoModeLockDetailPageState extends State { // gotoLogin(); Get.toNamed(Routers.authorizedAdminListPage, arguments: { - "lockMainEntity": LockMainEntity(), - "keyInfo": KeyInfos() + "keyInfo": LockListInfoItemEntity() }); }), // 操作记录 @@ -324,7 +321,7 @@ class _DemoModeLockDetailPageState extends State { TranslationLoader.lanKeys!.operatingRecord!.tr, () { // gotoLogin(); Get.toNamed(Routers.lockOperatingRecordPage, - arguments: {"keyInfo": KeyInfos()}); + arguments: {"keyInfo": LockListInfoItemEntity()}); }), // 设置 bottomItem( diff --git a/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart new file mode 100644 index 00000000..4efdabee --- /dev/null +++ b/star_lock/lib/main/lockMian/entity/lockListInfo_entity.dart @@ -0,0 +1,304 @@ +class LockListInfoEntity { + int? errorCode; + String? description; + String? errorMsg; + LockListInfoGroupEntity? data; + + LockListInfoEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + LockListInfoEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null ? LockListInfoGroupEntity.fromJson(json['data']) : null; + } + + 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; + } +} + +class LockListInfoGroupEntity { + List? groupList; + int? pageNo; + int? pageSize; + int? pages; + int? total; + + LockListInfoGroupEntity({this.groupList, this.pageNo, this.pageSize, this.pages, this.total}); + + LockListInfoGroupEntity.fromJson(Map json) { + if (json['groupList'] != null) { + groupList = []; + json['groupList'].forEach((v) { + groupList!.add(GroupList.fromJson(v)); + }); + } + pageNo = json['pageNo']; + pageSize = json['pageSize']; + pages = json['pages']; + total = json['total']; + } + + Map toJson() { + final Map data = {}; + if (groupList != null) { + data['groupList'] = groupList!.map((v) => v.toJson()).toList(); + } + data['pageNo'] = pageNo; + data['pageSize'] = pageSize; + data['pages'] = pages; + data['total'] = total; + return data; + } +} + +class GroupList { + String? groupName; + int? groupId; + List? lockList; + + bool _isChecked = false; + bool get isChecked => _isChecked ?? false; + set isChecked(bool value) => _isChecked = value; + + GroupList({this.groupName, this.groupId, this.lockList}); + + GroupList.fromJson(Map json) { + groupName = json['groupName']; + groupId = json['groupId']; + if (json['lockList'] != null) { + lockList = []; + json['lockList'].forEach((v) { + lockList!.add(LockListInfoItemEntity.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['groupName'] = groupName; + data['groupId'] = groupId; + if (lockList != null) { + data['lockList'] = lockList!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class LockListInfoItemEntity { + int? keyId; + int? lockId; + String? lockName; + String? lockAlias; + int? electricQuantity; + String? fwVersion; + String? hwVersion; + int? keyType; + int? passageMode; + int? userType; + int? startDate; + int? endDate; + List? weekDays; + int? remoteEnable; + int? faceAuthentication; + int? lastFaceValidateTime; + int? keyRight; + int? keyStatus; + int? isLockOwner; + Bluetooth? bluetooth; + LockFeature? lockFeature; + LockSetting? lockSetting; + + LockListInfoItemEntity( + {this.keyId, + this.lockId, + this.lockName, + this.lockAlias, + this.electricQuantity, + this.fwVersion, + this.hwVersion, + this.keyType, + this.passageMode, + this.userType, + this.startDate, + this.endDate, + this.weekDays, + this.remoteEnable, + this.faceAuthentication, + this.lastFaceValidateTime, + this.keyRight, + this.keyStatus, + this.isLockOwner, + this.bluetooth, + this.lockFeature, + this.lockSetting}); + + LockListInfoItemEntity.fromJson(Map json) { + keyId = json['keyId']; + lockId = json['lockId']; + lockName = json['lockName']; + lockAlias = json['lockAlias']; + electricQuantity = json['electricQuantity']; + fwVersion = json['fwVersion']; + hwVersion = json['hwVersion']; + keyType = json['keyType']; + passageMode = json['passageMode']; + userType = json['userType']; + startDate = json['startDate']; + endDate = json['endDate']; + weekDays = json['weekDays']; + remoteEnable = json['remoteEnable']; + faceAuthentication = json['faceAuthentication']; + lastFaceValidateTime = json['lastFaceValidateTime']; + keyRight = json['keyRight']; + keyStatus = json['keyStatus']; + isLockOwner = json['isLockOwner']; + bluetooth = json['bluetooth'] != null + ? Bluetooth.fromJson(json['bluetooth']) + : null; + lockFeature = json['lockFeature'] != null + ? LockFeature.fromJson(json['lockFeature']) + : null; + lockSetting = json['lockSetting'] != null + ? LockSetting.fromJson(json['lockSetting']) + : null; + } + + Map toJson() { + final Map data = {}; + data['keyId'] = keyId; + data['lockId'] = lockId; + data['lockName'] = lockName; + data['lockAlias'] = lockAlias; + data['electricQuantity'] = electricQuantity; + data['fwVersion'] = fwVersion; + data['hwVersion'] = hwVersion; + data['keyType'] = keyType; + data['passageMode'] = passageMode; + data['userType'] = userType; + data['startDate'] = startDate; + data['endDate'] = endDate; + data['weekDays'] = weekDays; + data['remoteEnable'] = remoteEnable; + data['faceAuthentication'] = faceAuthentication; + data['lastFaceValidateTime'] = lastFaceValidateTime; + data['keyRight'] = keyRight; + data['keyStatus'] = keyStatus; + data['isLockOwner'] = isLockOwner; + if (bluetooth != null) { + data['bluetooth'] = bluetooth!.toJson(); + } + if (lockFeature != null) { + data['lockFeature'] = lockFeature!.toJson(); + } + if (lockSetting != null) { + data['lockSetting'] = lockSetting!.toJson(); + } + return data; + } +} + +class Bluetooth { + String? bluetoothDeviceId; + String? bluetoothDeviceName; + List? publicKey; + List? privateKey; + List? signKey; + + Bluetooth( + {this.bluetoothDeviceId, + this.bluetoothDeviceName, + this.publicKey, + this.privateKey, + this.signKey}); + + Bluetooth.fromJson(Map json) { + bluetoothDeviceId = json['bluetoothDeviceId']; + bluetoothDeviceName = json['bluetoothDeviceName']; + publicKey = json['publicKey'].cast(); + privateKey = json['privateKey'].cast(); + signKey = json['signKey'].cast(); + } + + Map toJson() { + final Map data = {}; + data['bluetoothDeviceId'] = bluetoothDeviceId; + data['bluetoothDeviceName'] = bluetoothDeviceName; + data['publicKey'] = publicKey; + data['privateKey'] = privateKey; + data['signKey'] = signKey; + return data; + } +} + +class LockFeature { + int? password; + int? icCard; + int? fingerprint; + int? fingerVein; + int? palmVein; + int? d3Face; + int? bluetoothRemoteControl; + int? videoIntercom; + LockFeature( + {this.password, + this.icCard, + this.fingerprint, + this.fingerVein, + this.palmVein, + this.d3Face, + this.bluetoothRemoteControl, + this.videoIntercom}); + + LockFeature.fromJson(Map json) { + password = json['password']; + icCard = json['icCard']; + fingerprint = json['fingerprint']; + fingerVein = json['fingerVein']; + palmVein = json['palmVein']; + d3Face = json['d3Face']; + bluetoothRemoteControl = json['bluetoothRemoteControl']; + videoIntercom = json['videoIntercom']; + } + + Map toJson() { + final Map data = {}; + data['password'] = password; + data['icCard'] = icCard; + data['fingerprint'] = fingerprint; + data['fingerVein'] = fingerVein; + data['palmVein'] = palmVein; + data['d3Face'] = d3Face; + data['bluetoothRemoteControl'] = bluetoothRemoteControl; + data['videoIntercom'] = videoIntercom; + return data; + } +} + +class LockSetting { + int? attendance; + int? appUnlockOnline; + + LockSetting({this.attendance, this.appUnlockOnline}); + + LockSetting.fromJson(Map json) { + attendance = json['attendance']; + appUnlockOnline = json['appUnlockOnline']; + } + + Map toJson() { + final Map data = {}; + data['attendance'] = attendance; + data['appUnlockOnline'] = appUnlockOnline; + return data; + } +} diff --git a/star_lock/lib/main/lockMian/lockList/lockListGroup_page.dart b/star_lock/lib/main/lockMian/lockList/lockListGroup_page.dart new file mode 100644 index 00000000..4ae2731d --- /dev/null +++ b/star_lock/lib/main/lockMian/lockList/lockListGroup_page.dart @@ -0,0 +1,90 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../../app_settings/app_colors.dart'; +import '../entity/lockListInfo_entity.dart'; + +class LockListGroupPage extends StatefulWidget { + const LockListGroupPage({Key? key, + this.child, + this.onTap, + required this.groupItem, + required this.typeImgList}) + : super(key: key); + + final Widget? child; + final List typeImgList; + final Function()? onTap; + final GroupList groupItem; + + @override + State createState() => _LockListGroupPageState(); +} + +class _LockListGroupPageState extends State { + bool _isExpanded = true; + final Duration _animationDuration = const Duration(milliseconds: 200); + bool _isCheck = false; + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + color: Colors.white, + height: 80.h, + child: Row( + children: _buildExpandRowList(), + ), + ), + ClipRect( + child: AnimatedAlign( + heightFactor: _isExpanded ? 1.0 : 0.0, + alignment: Alignment.center, + duration: _animationDuration, + child: widget.child), + ), + ], + ); + } + + List _buildExpandRowList() { + List widgetList = []; + widgetList.add(GestureDetector( + child: Container( + width: ScreenUtil().screenWidth, + color: Colors.white, + child: Row( + children: [ + SizedBox(width: 40.w), + Text( + widget.groupItem.groupName ?? '', + style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp), + ), + Expanded( + child: SizedBox( + width: 10.w, + )), + AnimatedRotation( + turns: _isExpanded ? -0.5 : 0, + duration: _animationDuration, + child: const Icon(Icons.keyboard_arrow_down), + ), + SizedBox( + width: 30.w, + ) + ], + ), + ), + onTap: () { + //点击右侧上拉下拉按钮 + setState(() { + _isExpanded = !_isExpanded; + }); + }, + )); + return widgetList; + } +} diff --git a/star_lock/lib/main/lockMian/lockList/lockList_page.dart b/star_lock/lib/main/lockMian/lockList/lockList_page.dart index 7ef1d959..9ca75773 100644 --- a/star_lock/lib/main/lockMian/lockList/lockList_page.dart +++ b/star_lock/lib/main/lockMian/lockList/lockList_page.dart @@ -2,46 +2,114 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/mine/mine/starLockMine_page.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; -import '../entity/lockInfoEntity.dart'; +import '../../../common/XSConstantMacro/XSConstantMacro.dart'; +import '../../../tools/ExpandedListView.dart'; +import '../entity/lockListInfo_entity.dart'; +import 'lockListGroup_page.dart'; class LockListPage extends StatefulWidget { - final LockMainEntity lockMainEntity; + final LockListInfoGroupEntity lockListInfoGroupEntity; - const LockListPage({Key? key, required this.lockMainEntity}) : super(key: key); + const LockListPage({Key? key, required this.lockListInfoGroupEntity}) : super(key: key); @override State createState() => _LockListPageState(); } class _LockListPageState extends State { - var dataList = []; + var groupDataList = []; @override Widget build(BuildContext context) { - if(widget.lockMainEntity.data!.pageNo == 1){ - dataList = []; + if(widget.lockListInfoGroupEntity.pageNo == 1){ + groupDataList = []; } - dataList.addAll(widget.lockMainEntity.data!.keyInfos as Iterable); + groupDataList.addAll(widget.lockListInfoGroupEntity.groupList as Iterable); - return ListView.builder( - itemCount: dataList.length, - itemBuilder: (c, index) { - KeyInfos keyInfo = dataList[index]; - return lockInfoListItem('images/icon_lock.png', keyInfo.lockAlias, () { - Get.toNamed(Routers.lockDetailMainPage, arguments: { - "lockMainEntity": widget.lockMainEntity, - "keyInfo": keyInfo - }); - }); + // return ListView.builder( + // itemCount: dataList.length, + // itemBuilder: (c, index) { + // GroupList keyInfo = dataList[index]; + // return lockInfoListItem('images/icon_lock.png', keyInfo.groupName, () { + // // Get.toNamed(Routers.lockDetailMainPage, arguments: { + // // "lockMainEntity": widget.lockMainEntity, + // // "keyInfo": keyInfo + // // }); + // }); + // }); + + return ListView.separated( + itemCount: groupDataList.length, + itemBuilder: (context, index) { + GroupList itemData = groupDataList[index]; + return _buildLockExpandedList(context, index, itemData); + }, + shrinkWrap: true, + separatorBuilder: (context, index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); }); } - Widget lockInfoListItem( - String lockTypeIcon, String? lockTypeTitle, Function() action) { + // //设备多层级列表 + // Widget _buildListView(BuildContext context, List itemList) { + // return ListView.separated( + // itemCount: itemList.length, + // itemBuilder: (context, index) { + // GroupList itemData = itemList[index]; + // return _buildLockExpandedList(context, index, itemData); + // }, + // shrinkWrap: true, + // separatorBuilder: (context, index) { + // return const Divider( + // height: 1, + // color: AppColors.greyLineColor, + // ); + // }); + // } + + //设备多层级列表 + Widget _buildLockExpandedList(context, index, GroupList itemData) { + List lockItemList = itemData.lockList ?? []; + return LockListGroupPage( + onTap: () { + // selectGroupIdList.add(index); + // clickIndex = index; + //是否选中组 + if (itemData.isChecked) { + + }else{ + + } + setState(() {}); + print('选中了么0'); + }, + typeImgList: const [], + groupItem: itemData, + child: ListView.separated( + itemCount: lockItemList.length, + shrinkWrap: true, + separatorBuilder: (context, index) { + return const Divider(height: 1, color: AppColors.greyLineColor); + }, + itemBuilder: (c, index) { + LockListInfoItemEntity keyInfo = lockItemList[index]; + return lockInfoListItem(keyInfo, () { + Get.toNamed(Routers.lockDetailMainPage, arguments: { + // "lockMainEntity": widget.lockMainEntity, + "keyInfo": keyInfo + }); + }); + }), + ); + } + + Widget lockInfoListItem(LockListInfoItemEntity keyInfo, Function() action) { return GestureDetector( onTap: action, child: Container( @@ -66,7 +134,7 @@ class _LockListPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - lockTypeTitle!, + keyInfo.lockAlias!, style: TextStyle( fontSize: 24.sp, fontWeight: FontWeight.w500), ), @@ -75,7 +143,7 @@ class _LockListPageState extends State { ), SizedBox(width: 20.w), Text( - "100%", + "${keyInfo.electricQuantity!}%", style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), ), @@ -95,7 +163,7 @@ class _LockListPageState extends State { children: [ SizedBox(width: 30.w), Text( - "永久/管理员", + "${getUseDateStr(keyInfo)}/${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}", style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), ), @@ -109,4 +177,33 @@ class _LockListPageState extends State { ), ); } + + String getUseDateStr(LockListInfoItemEntity indexEntity) { + String useDateStr = ''; + if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { + //限期 + DateTime startDateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); + DateTime endDateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)} ${endDateStr.toLocal().toString().substring(0, 16)}'; + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { + //永久 + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久'; + useDateStr = '永久'; + } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { + //单次 + // DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!); + // useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次'; + useDateStr = '单次'; + } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { + //循环 + useDateStr = '循环'; + } + + return useDateStr; + } + } diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_logic.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_logic.dart index e033008c..c18f56dd 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_logic.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_logic.dart @@ -7,6 +7,7 @@ import '../../../blue/io_tool/manager_event_bus.dart'; import '../../../network/api_repository.dart'; import '../../../tools/baseGetXController.dart'; import '../../../tools/eventBusEventManage.dart'; +import '../entity/lockListInfo_entity.dart'; import 'lockMain_state.dart'; class LockMainLogic extends BaseGetXController { @@ -27,10 +28,41 @@ class LockMainLogic extends BaseGetXController { // getLockInfo(); // } - void getLockInfo() async{ - var entity = await ApiRepository.to.getLockInfo( - lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(), - pageNo:page.toString(), + // void getLockInfo() async{ + // var entity = await ApiRepository.to.getLockInfo( + // lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(), + // pageNo:page.toString(), + // ); + // if(entity.errorCode!.codeIsSuccessful){ + // // if (page == 0) { + // // refreshController.refreshCompleted(); + // // } else { + // // if (entity.data!.keyInfos!.isEmpty) { + // // refreshController.loadNoData(); + // // } else { + // // refreshController.loadComplete(); + // // } + // // } + // // page++; + // + // if(entity.data!.keyInfos!.isEmpty){ + // state.dataLength.value = 0; + // }else if(entity.data!.keyInfos!.length == 1){ + // state.dataLength.value = 1; + // }else{ + // state.dataLength.value = 2; + // } + // state.lockMainEntity.value = entity; + // }else{ + // // refreshController.loadFailed(); + // } + // // refreshController.refreshCompleted(); + // } + + void getStarLockInfo() async{ + var entity = await ApiRepository.to.getStarLockListInfo( + pageNo:page, + pageSize:20, ); if(entity.errorCode!.codeIsSuccessful){ // if (page == 0) { @@ -44,14 +76,19 @@ class LockMainLogic extends BaseGetXController { // } // page++; - if(entity.data!.keyInfos!.isEmpty){ + if(entity.data!.groupList!.isEmpty){ state.dataLength.value = 0; - }else if(entity.data!.keyInfos!.length == 1){ - state.dataLength.value = 1; + }else if(entity.data!.groupList!.length == 1){ + GroupList groupList = entity.data!.groupList![0]; + if(groupList.lockList!.length > 1){ + state.dataLength.value = 2; + }else{ + state.dataLength.value = 1; + } }else{ state.dataLength.value = 2; } - state.lockMainEntity.value = entity; + state.lockListInfoEntity.value = entity; }else{ // refreshController.loadFailed(); } @@ -61,7 +98,8 @@ class LockMainLogic extends BaseGetXController { late StreamSubscription _teamEvent; void _initLoadDataAction() { _teamEvent = eventBus.on().listen((event) { - getLockInfo(); + // getLockInfo(); + getStarLockInfo(); print("收到消息"); }); } @@ -82,7 +120,8 @@ class LockMainLogic extends BaseGetXController { super.onInit(); print("onInit()"); - getLockInfo(); + // getLockInfo(); + getStarLockInfo(); } @override diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index 90cc1b32..407fe23e 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/submitBtn.dart'; import '../../../appRouters.dart'; @@ -76,22 +77,21 @@ class _StarLockMainPageState extends State with BaseWidget { Widget returnWidget; switch (type) { case 0: + // 显示无数据模式 returnWidget = unHaveData(); break; case 1: + // 只有一条数据 Storage.setBool(ifIsDemoModeOrNot, false); - returnWidget = LockDetailPage( - lockMainEntity: logic.state.lockMainEntity.value, - isFrist: true, - keyInfo: logic.state.lockMainEntity.value.data!.keyInfos![0]); + returnWidget = LockDetailPage(isFrist: true, lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]); break; case 2: + // 有多条数据 Storage.setBool(ifIsDemoModeOrNot, false); - returnWidget = - LockListPage(lockMainEntity: logic.state.lockMainEntity.value); + returnWidget = LockListPage(lockListInfoGroupEntity: state.lockListInfoEntity.value.data!); break; default: - returnWidget = unHaveData(); + returnWidget = const NoData(); break; } return returnWidget; diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_state.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_state.dart index 1f58d3d6..fb53a05b 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_state.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_state.dart @@ -1,11 +1,10 @@ import 'package:get/get.dart'; - -import '../entity/lockInfoEntity.dart'; +import '../entity/lockListInfo_entity.dart'; class LockMainState { // 0是无数据 1是有一条数据 2是有很多条数据 - var dataLength = 0.obs; - Rx lockMainEntity = LockMainEntity().obs; + var dataLength = 100.obs; + var lockListInfoEntity = LockListInfoEntity().obs; } \ No newline at end of file diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart index b31fc34d..1a418276 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -26,7 +26,6 @@ import 'saveLock_state.dart'; class SaveLockLogic extends BaseGetXController { final SaveLockState state = SaveLockState(); - int userNo = 0; // 获取解析后的数据 late StreamSubscription _replySubscription; @@ -36,11 +35,6 @@ class SaveLockLogic extends BaseGetXController { _replyAddUserKey(reply); } - // 获取锁状态 - if(reply is GetLockStatuReply) { - _replyGetLockStatus(reply); - } - // 获取锁状态信息 if(reply is GetStarLockStatuInfoReply) { _replyGetStarLockStatusInfo(reply); @@ -51,22 +45,23 @@ class SaveLockLogic extends BaseGetXController { Future _replyAddUserKey(Reply reply) async { var lockId = reply.data.sublist(2, 42); - print("lockId:$lockId"); + // print("lockId:$lockId"); var token = reply.data.sublist(42, 46); List strTokenList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, strTokenList); - print("token:$token"); + // print("token:$token"); int status = reply.data[46]; - print("status:$status"); + // print("status:$status reply.data:${reply.data}"); - userNo = reply.data[46]; print("status:$status"); switch(status){ case 0x00: //成功 print("添加用户数据解析成功"); + state.lockUserNo = reply.data[47]; + bindBlueAdmin(); break; case 0x06: @@ -113,167 +108,119 @@ class SaveLockLogic extends BaseGetXController { } } - // 获取锁状态数据解析 - Future _replyGetLockStatus(Reply reply) async { - int status = reply.data[2]; - switch(status){ - case 0x00: - //成功 - print("${reply.commandType}数据解析成功"); - var softVersion = reply.data.sublist(3, 7); - print("softVersion:$softVersion"); - - var power = reply.data[7]; - print("power:$power"); - - // APP 用户数量 - var appUserCount = reply.data.sublist(50, 53); - print("appUserCount:$appUserCount"); - - // 黑名单用户数量 - var blacklistCount = reply.data[53]; - print("blacklistCount:$blacklistCount"); - - // 蓝牙钥匙数量 - var bleKeyCount = reply.data[54]; - print("bleKeyCount:$bleKeyCount"); - - // 剩余可添加用户数量 - var remainCount = reply.data.sublist(54, 56); - print("remainCount:$remainCount"); - - // 未上传开锁记录数量 - var notUploadCount = reply.data.sublist(56, 58); - print("notUploadCount:$notUploadCount"); - - // 已设置开门密码数量 - var pwdCount = reply.data[58]; - print("pwdCount:$pwdCount"); - - // 已设置开门指纹数量 - var fingerprintCount = reply.data[59]; - print("fingerprintCount:$fingerprintCount"); - - // 锁当前时间 - var lockTime = reply.data.sublist(60, 64); - print("lockTime:$lockTime"); - - // 硬件版本信息,为固件升级提供判断依据 - var hardVersion = reply.data.sublist(64, 68); - print("hardVersion:$hardVersion"); - - break; - case 0x06: - //无权限 - print("${reply.commandType}需要鉴权"); - - break; - case 0x07: - //无权限 - print("${reply.commandType}用户无权限"); - - break; - case 0x09: - // 权限校验错误 - print("${reply.commandType}权限校验错误"); - - break; - default: - //失败 - print("${reply.commandType}失败"); - - break; - } - } - Future _replyGetStarLockStatusInfo(Reply reply) async { int status = reply.data[2]; switch(status){ case 0x00: - //成功 + //成功 print("${reply.commandType}数据解析成功"); + // 厂商名称 var vendor = reply.data.sublist(3, 23); var vendorStr = utf8String(vendor); - print("softVersion:$vendor vendorStr:$vendorStr"); + state.lockInfo["vendor"] = vendorStr; + // print("vendor:$vendor vendorStr:$vendorStr vendorStr.length${vendorStr.length}"); // 锁设备类型 var product = reply.data[23]; - print("product:$product"); + state.lockInfo["product"] = product; + // print("product:$product"); // 产品名称 var model = reply.data.sublist(24, 44); var modelStr = utf8String(model); - print("model:$model modelStr:$modelStr"); + state.lockInfo["model"] = modelStr; + // print("model:$model modelStr:$modelStr modelStr:${modelStr.length}"); // 软件版本 var fwVersion = reply.data.sublist(44, 64); var fwVersionStr = utf8String(fwVersion); - print("fwVersion:$fwVersion fwVersionStr:$fwVersionStr"); + state.lockInfo["fwVersion"] = fwVersionStr; + // print("fwVersion:$fwVersion fwVersionStr:$fwVersionStr fwVersionStr:${fwVersionStr.length}"); // 硬件版本 var hwVersion = reply.data.sublist(64, 84); - print("hwVersion:$hwVersion"); + var hwVersionStr = utf8String(hwVersion); + state.lockInfo["hwVersion"] = hwVersionStr; + // print("hwVersion:$hwVersion hwVersionStr:${hwVersionStr.length}"); // 厂商序列号 var serialNum0 = reply.data.sublist(84, 100); - print("serialNum0:$serialNum0"); + var serialNum0Str = utf8String(serialNum0); + state.lockInfo["serialNum0"] = serialNum0Str; + // print("serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}"); // 成品商序列号 var serialNum1 = reply.data.sublist(100, 116); - print("serialNum1:$serialNum1"); + var serialNum1Str = utf8String(serialNum1); + state.lockInfo["serialNum1"] = serialNum1Str; + // print("serialNum1Str:$serialNum1Str serialNum1Str:${serialNum1Str.length}"); // 蓝牙名称 var btDeviceName = reply.data.sublist(116, 132); var btDeviceNameStr = utf8String(btDeviceName); - print("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr"); + state.lockInfo["btDeviceName"] = btDeviceNameStr; + // print("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr btDeviceNameStr:${btDeviceNameStr.length}"); // 电池剩余电量 var battRemCap = reply.data[132]; - print("battRemCap:$battRemCap"); + state.lockInfo["electricQuantity"] = battRemCap; + // print("battRemCap:$battRemCap"); // 重置次数 var restoreCounter = reply.data.sublist(133, 135); - print("restoreCounter:$restoreCounter"); + state.lockInfo["restoreCount"] = restoreCounter[0] * 256 + restoreCounter[1]; + // print("restoreCounter:$restoreCounter"); // 重置时间 var restoreDate = reply.data.sublist(135, 139); int restoreDateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3])); - String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString()); - print("restoreDate:$restoreDate restoreDateStr:$restoreDateStr"); + // String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString()); + state.lockInfo["restoreDate"] = restoreDateValue*1000; + // print("restoreDate:$restoreDate restoreDateValue:$restoreDateValue"); // 主控芯片型号 var icPartNo = reply.data.sublist(139, 149); var icPartNoStr = utf8String(icPartNo); - print("icPartNo:$icPartNo icPartNoStr:$icPartNoStr"); + state.lockInfo["icPartNo"] = icPartNoStr; + // print("icPartNo:$icPartNo icPartNoStr:$icPartNoStr"); // 有效时间 var indate = reply.data.sublist(149, 153); - int indateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3])); - String indateStr = DateTool().dateToYMDHNSString("$indateValue"); - print("indate:$indate indateStr:$indateStr"); + int indateValue = ((0xff & indate[(0)]) << 24 | (0xff & indate[1]) << 16 | (0xff & indate[2]) << 8 | (0xFF & indate[3])); + // String indateStr = DateTool().dateToYMDHNSString("$indateValue"); + state.lockInfo["indate"] = indateValue*1000; + // print("indate:$indate indateValue:$indateValue"); - // var index = 153; - // // 锁特征值字符串长度 - // var featureValueLength = reply.data[153]; - // // 锁特征值说明(本机能支持的功能) - // // 获取到锁给的字符数组 - // var featureValue = reply.data.sublist(index+1, index + featureValueLength+1); + var index = 153; + // 锁特征值字符串长度 + var featureValueLength = reply.data[153]; + // 锁特征值说明(本机能支持的功能) + // 获取到锁给的字符数组 + var featureValue = reply.data.sublist(index+1, index + featureValueLength+1); + String featureValueStr = asciiString(featureValue); + state.featureValue = featureValueStr; // List allFeatureValueTwoList = charListChangeIntList(featureValue); - // // print("featureValueLength:$featureValueLength featureValue:$featureValue \n allFeatureValueTwoList:$allFeatureValueTwoList"); - // index = index + featureValueLength + 1; + // print("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr"); + index = index + featureValueLength + 1; - // // 使能特征值字符串长度 - // var featureEnValLength = reply.data[index]; - // // 使能锁特征值说明(本机启用的功能) - // var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1); + // 使能特征值字符串长度 + var featureEnValLength = reply.data[index]; + // 使能锁特征值说明(本机启用的功能) + var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1); + String featureEnValStr = asciiString(featureValue); + state.featureSettingValue = featureEnValStr; // List allFeatureEnValTwoList = charListChangeIntList(featureEnVal); - // // print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n allFeatureEnValTwoList:$allFeatureEnValTwoList"); - // index = index + featureEnValLength + 1; + // print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr"); + index = index + featureEnValLength + 1; - // // 支持的带参数特征值的总条目数 + // 支持的带参数特征值的总条目数 // var featureParaTotal = reply.data[index]; + var featureParaTotalList = reply.data.sublist(index); + state.featureSettingParams = featureParaTotalList; + // print("featureParaTotalList:$featureParaTotalList"); + break; case 0x06: //无权限 @@ -307,8 +254,10 @@ class SaveLockLogic extends BaseGetXController { for(int i = 0;i _getLockStatus() async { - print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}"); + Future _getStarLockStatus() async { + // print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}"); // 进来之后首先连接 BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected) { @@ -451,6 +381,8 @@ class SaveLockLogic extends BaseGetXController { print("onReady()"); _initReplySubscription(); + + _getStarLockStatus(); } @override @@ -459,7 +391,6 @@ class SaveLockLogic extends BaseGetXController { super.onInit(); print("onInit()"); - _getLockStatus(); } @override diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart index c83b513a..1907d811 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart @@ -11,6 +11,12 @@ class SaveLockState { var addressInfo = {}.obs; TextEditingController aliNameController = TextEditingController(); + var lockUserNo = 0; + var lockInfo = {}; + var featureValue = ''; + var featureSettingValue = ''; + var featureSettingParams = []; + SaveLockState() { aliName.value = BlueManage().connectDeviceName; aliNameController.text = aliName.value; diff --git a/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart b/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart index bc4c0763..9d00a047 100644 --- a/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart +++ b/star_lock/lib/mine/mineSet/addAuthorizedAdministrator/addAuthorizedAdministrator_state.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; + +import '../../../main/lockMian/entity/lockListInfo_entity.dart'; class AddAuthorizedAdministratorState { late TabController? tabController; @@ -28,12 +29,10 @@ class AddAuthorizedAdministratorState { var isSendSuccess = false.obs; final isRemoteUnlock = false.obs; //是否允许远程开锁 final isAuthentication = false.obs; //是否允许实名认证 - final keyInfo = KeyInfos().obs; - final lockMainEntity = LockMainEntity().obs; + final keyInfo = LockListInfoItemEntity().obs; AddAuthorizedAdministratorState() { Map map = Get.arguments; - lockMainEntity.value = map["lockMainEntity"]; keyInfo.value = map["keyInfo"]; } } diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index 27008585..66c20e94 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -1,10 +1,11 @@ abstract class Api { static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //预发布环境 - final String baseUrl = "$baseAddress/api"; + + // final String baseUrl = "$baseAddress/api"; // final String baseUrl = "http://test.lock.star-lock.cn/api"; // 葛工 // final String baseUrl = "https://lock.star-lock.cn/api"; // 测试环境 // final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //曾工 - // final String baseUrl = "http://192.168.56.101:8099/api"; //曾工本地 + final String baseUrl = "http://192.168.56.101:8099/api"; //曾工本地 // final String baseUrl = "http://192.168.1.14:8099/api"; //葛工开发环境地址 // 登录注册 @@ -27,6 +28,7 @@ abstract class Api { final String bindingBlueAdminURL = '/lock/bindAdmin'; //绑定蓝牙管理员 final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称 + final String updateLockNameURL = '/lock/updateLockName'; //修改锁名(新) final String modifyKeyNameForAdminURL = '/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字 final String updateKeyDateURL = '/key/updateKeyDate'; //编辑电子钥匙的有效期、有效时间、有效日 @@ -35,6 +37,8 @@ abstract class Api { final String deleteElectronicKeyURL = '/key/delete'; //删除电子钥匙 final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //删除密码 final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息 + final String getStarLockInfoURL = '/lock/list'; // 获取锁信息列表 + final String getLockSettingURL = '/lock/getLockSettingData'; // 获取所有锁设置信息 final String deletLockURL = '/lock/delete'; // 删除锁 final String checkPasswordURL = '/user/checkPassword'; // 检查账户密码 @@ -51,12 +55,13 @@ abstract class Api { final String keyGroupListURL = '/keyGroup/list'; //分组列表 final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁 final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // 获取Wifi锁服务器 - final String updateSpecialValueUrl = '/room/updateSpecialValue'; // 开启/关闭 远程开锁 + final String updateLockSettingUrl = '/lockSetting/updateLockSetting'; // 开启/关闭 远程开锁 final String setAutoLockTimeUrl = '/room/setAutoLockTime'; // 自动闭锁 - final String getPassageModeConfigUrl = - '/room/getPassageModeConfig'; // 获取锁的常开模式设置 + + final String getPassageModeConfigUrl = '/room/getPassageModeConfig'; // 获取锁的常开模式设置 final String configPassageModeUrl = '/room/configPassageMode'; // 配置锁的常开模式 final String updateSettingUrl = '/room/updateSetting'; // 锁声音/防撬报警/重置键/考勤 + final String roomQueryDateUrl = '/room/queryDate'; // 获取网关时间 final String lockDiagnoseUrl = '/room/uploadLockInfo'; // 锁诊断 final String getServerDatetimeUrl = '/check/getServerDatetime'; // 获取服务器当前时间 diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 10d55aca..99f3c2ee 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -169,10 +169,9 @@ class ApiProvider extends BaseProvider { })); Future modifyKeyName( - String keyId, - String lockId, - String keyName, - String operatorUid, + String keyId, + String lockId, + String keyName, ) => post( modifyKeyNameURL.toUrl, @@ -180,7 +179,6 @@ class ApiProvider extends BaseProvider { 'keyId': keyId, 'lockId': lockId, 'keyName': keyName, - 'operatorUid': operatorUid, })); Future modifyKeyNameForAdmin( @@ -273,29 +271,27 @@ class ApiProvider extends BaseProvider { // 绑定蓝牙管理员 Future bindingBlueAdmin( - String bindingDate, - String hotelMode, String lockAlias, - Map lockData, - String nbInitSuccess, Map position, Map bluetooth, - String deviceNo, + Map lockInfo, String lockUserNo, - String pwdTimestamp) => + String pwdTimestamp, + String featureValue, + String featureSettingValue, + List featureSettingParams) => post( bindingBlueAdminURL.toUrl, jsonEncode({ - 'bindingDate': bindingDate, - 'hotelMode': hotelMode, "lockAlias": lockAlias, - 'lockData': lockData, - "nbInitSuccess": nbInitSuccess, 'position': position, 'bluetooth': bluetooth, - 'deviceNo': deviceNo, + 'lockInfo': lockInfo, 'lockUserNo': lockUserNo, 'pwdTimestamp': pwdTimestamp, + 'featureValue': featureValue, + 'featureSettingValue': featureSettingValue, + 'featureSettingParams': featureSettingParams, })); // 获取锁信息 @@ -306,6 +302,21 @@ class ApiProvider extends BaseProvider { "pageNo": pageNo, })); + // 获取锁信息列表 + Future getStarLockListInfo(int pageNo, int pageSize) => post( + getStarLockInfoURL.toUrl, + jsonEncode({ + "pageNo": pageNo, + 'pageSize': pageSize, + })); + + // 获取所有锁设置信息 + Future getLockSettingInfoData(String lockId) => post( + getLockSettingURL.toUrl, + jsonEncode({ + 'lockId': lockId, + })); + // 删除锁 Future deletLockInfo(String lockId) => post( deletLockURL.toUrl, @@ -496,19 +507,8 @@ class ApiProvider extends BaseProvider { jsonEncode({'type': type, 'keyGroupId': keyGroupId})); /// 锁设置模块 - // 远程开锁 - Future remoteUnlockingOpenOrCloseLoadData( - String lockId, String featureValue) => - post( - updateSpecialValueUrl.toUrl, - jsonEncode({ - 'lockId': lockId, - 'featureValue': featureValue, - })); - // 自动闭锁 - Future setAutoUnlockLoadData( - String lockId, String autoLockTime, String type) => + Future setAutoUnlockLoadData(int lockId, int autoLockTime, int type) => post( setAutoLockTimeUrl.toUrl, jsonEncode({ @@ -517,6 +517,44 @@ class ApiProvider extends BaseProvider { 'type': type, })); + // 锁声音 + Future setLockSoundData(int lockId, int lockSound, int lockSoundVolume) => + post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'lockSound': lockSound, + 'lockSoundVolume': lockSoundVolume, + })); + + // 防撬报警 + Future setBurglarAlarmData( + int lockId, int antiPrySwitch) => + post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'antiPrySwitch': antiPrySwitch, + })); + + // 远程开锁 + Future remoteUnlockingOpenOrCloseLoadData(int lockId, int remoteUnlock) => + post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'remoteUnlock': remoteUnlock, + })); + + // 重置键 + Future setResetButtonData(int lockId, int resetSwitch) => + post( + updateLockSettingUrl.toUrl, + jsonEncode({ + 'lockId': lockId, + 'resetSwitch': resetSwitch, + })); + // 获取锁的常开模式设置 Future getPassageModeConfigLoadData(String lockId) => post( getPassageModeConfigUrl.toUrl, @@ -603,6 +641,17 @@ class ApiProvider extends BaseProvider { 'lockId': lockId, })); + Future updateLockName( + String lockId, + String lockName, + ) => + post( + updateLockNameURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'lockName': lockName, + })); + // 开启考勤获取考勤信息 Future openCheckingInGetData(String lockId) => post( openCheckingInURL.toUrl, diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 2a34d280..ec798b58 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -30,14 +30,15 @@ import '../main/lockDetail/checkingIn/checkingInSet/checkingInSet_entity.dart'; import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaffSeletKey_entity.dart'; import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart'; import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart'; -import '../main/lockDetail/lcokSet/lockSet/CheckingInInfoDataEntity.dart'; -import '../main/lockDetail/lcokSet/lockTime/GetServerDatetimeEntity.dart'; -import '../main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart'; +import '../main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart'; +import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart'; +import '../main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart'; +import '../main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart'; import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart'; import '../main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart'; import '../main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart'; import '../main/lockDetail/otherTypeKey/otherTypeKeyList/fingerprintListData_entity.dart'; -import '../main/lockMian/entity/lockInfoEntity.dart'; +import '../main/lockMian/entity/lockListInfo_entity.dart'; import '../mine/addLock/saveLock/entity/SaveLockEntity.dart'; import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart'; import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart'; @@ -230,27 +231,25 @@ class ApiRepository { // 绑定蓝牙管理员 Future bindingBlueAdmin( - {required String bindingDate, - required String hotelMode, - required String lockAlias, - required Map lockData, - required String nbInitSuccess, - required Map position, - required Map bluetooth, - required String deviceNo, - required String lockUserNo, - required String pwdTimestamp}) async { + { required String lockAlias, + required Map position, + required Map bluetooth, + required Map lockInfo, + required String lockUserNo, + required String pwdTimestamp, + required String featureValue, + required String featureSettingValue, + required List featureSettingParams}) async { final res = await apiProvider.bindingBlueAdmin( - bindingDate, - hotelMode, lockAlias, - lockData, - nbInitSuccess, position, bluetooth, - deviceNo, + lockInfo, lockUserNo, - pwdTimestamp); + pwdTimestamp, + featureValue, + featureSettingValue, + featureSettingParams); return SaveLockEntity.fromJson(res.body); } @@ -264,13 +263,24 @@ class ApiRepository { //锁名称修改 Future modifyKeyName( - String keyId, - String lockId, - String keyName, - String operatorUid, - ) async { + { + required String keyId, + required String lockId, + required String keyName + }) async { final res = - await apiProvider.modifyKeyName(keyId, lockId, keyName, operatorUid); + await apiProvider.modifyKeyName(keyId, lockId, keyName); + return KeyOperationRecordEntity.fromJson(res.body); + } + + //修改锁名(新) + Future updateLockName( + { + required String lockId, + required String lockName + }) async { + final res = + await apiProvider.updateLockName(lockId, lockName); return KeyOperationRecordEntity.fromJson(res.body); } @@ -321,28 +331,41 @@ class ApiRepository { } // 获取锁信息 - Future getLockInfo( - {required String lastUpdateDate, required String pageNo}) async { - final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo); - return LockMainEntity.fromJson(res.body); + // Future getLockInfo( + // {required String lastUpdateDate, required String pageNo}) async { + // final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo); + // return LockMainEntity.fromJson(res.body); + // } + + // 获取锁信息列表 + Future getStarLockListInfo( + {required int pageNo, required int pageSize}) async { + final res = await apiProvider.getStarLockListInfo(pageNo, pageSize); + return LockListInfoEntity.fromJson(res.body); + } + + // 获取所有锁设置信息 + Future getLockSettingInfoData({required String lockId}) async { + final res = await apiProvider.getLockSettingInfoData(lockId); + return LockSetInfoEntity.fromJson(res.body); } // 删除锁 - Future deletOwnerLockData({required String lockId}) async { + Future deletOwnerLockData({required String lockId}) async { final res = await apiProvider.deletLockInfo(lockId); - return LockMainEntity.fromJson(res.body); + return LockListInfoEntity.fromJson(res.body); } // 删除钥匙 - Future deletOwnerKeyData({required String lockId, required String keyId}) async { + Future deletOwnerKeyData({required String lockId, required String keyId}) async { final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId); - return LockMainEntity.fromJson(res.body); + return LockListInfoEntity.fromJson(res.body); } // 检查账户密码 - Future checkLoginPassword({required String password}) async { + Future checkLoginPassword({required String password}) async { final res = await apiProvider.checkLoginPassword(password); - return LockMainEntity.fromJson(res.body); + return LockListInfoEntity.fromJson(res.body); } //获取密码 @@ -508,27 +531,57 @@ class ApiRepository { } /// 锁设置模块 - // 远程开锁开/关 - Future remoteUnlockingOpenOrClose({ - required String lockId, - required String featureValue, - }) async { - final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData( - lockId, featureValue); - return LoginEntity.fromJson(res.body); - } - // 自动闭锁 Future setAutoUnlock({ - required String lockId, - required String autoLockTime, - required String type, + required int lockId, + required int autoLockTime, + required int type, }) async { final res = await apiProvider.setAutoUnlockLoadData(lockId, autoLockTime, type); return LoginEntity.fromJson(res.body); } + // 锁声音 + Future setLockSound({ + required int lockId, + required int lockSound, + required int lockSoundVolume, + }) async { + final res = + await apiProvider.setLockSoundData(lockId, lockSound, lockSoundVolume); + return LoginEntity.fromJson(res.body); + } + + // 防撬报警 + Future setBurglarAlarmData({ + required int lockId, + required int antiPrySwitch, + }) async { + final res = + await apiProvider.setBurglarAlarmData(lockId, antiPrySwitch); + return LoginEntity.fromJson(res.body); + } + + // 远程开锁开/关 + Future remoteUnlockingOpenOrClose({ + required int lockId, + required int remoteUnlock, + }) async { + final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData( + lockId, remoteUnlock); + return LoginEntity.fromJson(res.body); + } + + // 重置键 + Future setResetButtonData({ + required int lockId, + required int resetSwitch, + }) async { + final res = await apiProvider.setResetButtonData(lockId, resetSwitch); + return LoginEntity.fromJson(res.body); + } + // 获取锁的常开模式设置 configPassageMode Future getPassageModeConfig({ required String lockId, diff --git a/star_lock/lib/tools/commonItem.dart b/star_lock/lib/tools/commonItem.dart index f57da1a8..ad1ce621 100644 --- a/star_lock/lib/tools/commonItem.dart +++ b/star_lock/lib/tools/commonItem.dart @@ -36,13 +36,12 @@ class CommonItem extends StatelessWidget { Container( height: allHeight ?? 60.h, color: Colors.white, - padding: EdgeInsets.only( - left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w + padding: EdgeInsets.only(left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w child: Row( children: [ SizedBox(width: 20.w), SizedBox( - width: isHaveRightWidget! ? 100.w : 300.w, + width: isHaveRightWidget! ? 100.w : 300.w, child: Text(leftTitel!, style: TextStyle(fontSize: 22.sp)) ), SizedBox(width: 6.w), @@ -59,26 +58,20 @@ class CommonItem extends StatelessWidget { children: [ isHaveRightWidget! ? rightWidget! - : Text( - rightTitle ?? "", - textAlign: TextAlign.end, - // overflow: TextOverflow.ellipsis, - // maxLines: 1, + : Text(rightTitle ?? "", textAlign: TextAlign.end, + overflow: TextOverflow.ellipsis, + maxLines: 1, style: TextStyle( fontSize: 22.sp, color: AppColors.darkGrayTextColor), ) ], ), - isHaveDirection! ? SizedBox(width: 8.w) : Container(), + isHaveDirection! ? SizedBox(width: 3.w) : Container(), isHaveDirection! - ? Image.asset( - 'images/icon_right_grey.png', - width: 12.w, - height: 21.w, - ) - : SizedBox(width: 20.w), - isHaveDirection! ? SizedBox(width: 20.w) : Container(), + ? Image.asset('images/icon_right_grey.png', width: 12.w, height: 21.w,) + : SizedBox(width: 10.w), + isHaveDirection! ? SizedBox(width: 5.w) : Container(), ], ), ), diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index 5dfb4b3e..c46d8f1e 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -1,6 +1,6 @@ import 'package:event_bus/event_bus.dart'; -import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; -import 'package:uuid/uuid.dart'; + +import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart'; /// 创建EventBus EventBus eventBus = EventBus(); @@ -17,8 +17,8 @@ class RefreshCheckInStaffListDataEvent{ /// 传递当前锁信息 class PassCurrentLockInformationEvent{ - KeyInfos keyInfo; - PassCurrentLockInformationEvent(this.keyInfo); + LockSetInfoData lockSetInfoData; + PassCurrentLockInformationEvent(this.lockSetInfoData); } /// 卡、密码、指纹修改之后刷新列表