From ed9cc12e360f2314c6d8c5044564f6feb8837bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Tue, 14 May 2024 09:32:06 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E9=94=81=E6=B5=81=E7=A8=8B=E3=80=822=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8D=A1=E3=80=81=E6=8C=87=E7=BA=B9=E3=80=81=E4=BA=BA?= =?UTF-8?q?=E8=84=B8=E5=AF=86=E7=A0=81=E5=BC=80=E9=94=81=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=E3=80=823?= =?UTF-8?q?=E3=80=81=E4=BC=98=E5=8C=96=E5=85=B6=E4=BB=96=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/ios/Podfile.lock | 22 +- star_lock/lib/appRouters.dart | 6 - .../io_protocol/io_referEventRecordTime.dart | 15 +- star_lock/lib/blue/io_reply.dart | 2 +- .../lib/blue/sender_beforeDataManage.dart | 3 +- star_lock/lib/debug/controller.dart | 2 +- .../volumeAuthorizationLock_logic.dart | 10 + .../volumeAuthorizationLock_page.dart | 13 +- .../volumeAuthorizationLock_state.dart | 5 + .../card/cardDetail/cardDetail_page.dart | 6 +- .../otherTypeKeyChangeDate_logic.dart | 17 +- .../doorLockLog/doorLockLog_logic.dart | 83 +----- .../doorLockLog/doorLockLog_page.dart | 2 +- .../electronicKeyDetail_logic.dart | 18 +- .../electronicKeyDetail_page.dart | 30 ++- .../electronicKeyDetailChangeDate_logic.dart | 2 +- .../electronicKeyPeriodValidity_logic.dart | 2 +- .../face/faceDetail/faceDetail_page.dart | 8 +- .../fingerprintDetail_page.dart | 6 +- .../iris/irisDetail/irisDetail_page.dart | 8 +- .../lockDetail/lockDetail_logic.dart | 22 +- .../lockDetail/lockDetail_page.dart | 4 +- .../keyOperationRecord_entity.dart | 121 +++++++++ .../lockOperatingRecord_logic.dart | 198 +++++++------- .../lockOperatingRecord_page.dart | 181 ++++++++----- .../lockOperatingRecord_state.dart | 21 +- .../editLockName/editLockName_logic.dart | 2 +- .../uploadElectricQuantity_logic.dart | 5 +- .../lockSet/lockTime/lockTime_logic.dart | 2 +- .../lockSet/lockTime/lockTime_page.dart | 2 +- .../palm/palmDetail/palmDetail_page.dart | 8 +- .../passwordKeyDetail_logic.dart | 7 +- .../passwordKeyDetail_page.dart | 14 +- .../passwordKeyList_logic.dart | 15 +- .../passwordKeyList/passwordKeyList_page.dart | 1 + .../passwordKeyList_state.dart | 1 + .../passwordKey_perpetual_logic.dart | 20 +- .../mine/addLock/saveLock/saveLock_logic.dart | 241 ++++++++++-------- .../mine/addLock/saveLock/saveLock_state.dart | 11 +- star_lock/lib/network/api_provider.dart | 45 ++-- star_lock/lib/network/api_provider_base.dart | 5 +- star_lock/lib/network/api_repository.dart | 67 +++-- star_lock/lib/tools/baseGetXController.dart | 4 +- star_lock/lib/tools/noData.dart | 2 + 44 files changed, 737 insertions(+), 522 deletions(-) create mode 100644 star_lock/lib/main/lockDetail/lockOperatingRecord/keyOperationRecord_entity.dart diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock index f7ddce61..485df03f 100644 --- a/star_lock/ios/Podfile.lock +++ b/star_lock/ios/Podfile.lock @@ -43,14 +43,14 @@ PODS: - ReachabilitySwift - device_info_plus (0.0.1): - Flutter - - DKImagePickerController/Core (4.3.4): + - DKImagePickerController/Core (4.3.7): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.3.4) - - DKImagePickerController/PhotoGallery (4.3.4): + - DKImagePickerController/ImageDataManager (4.3.7) + - DKImagePickerController/PhotoGallery (4.3.7): - DKImagePickerController/Core - DKPhotoGallery - - DKImagePickerController/Resource (4.3.4) + - DKImagePickerController/Resource (4.3.7) - DKPhotoGallery (0.0.17): - DKPhotoGallery/Core (= 0.0.17) - DKPhotoGallery/Model (= 0.0.17) @@ -130,7 +130,7 @@ PODS: - FlutterMacOS - permission_handler_apple (9.3.0): - Flutter - - ReachabilitySwift (5.2.1) + - ReachabilitySwift (5.2.2) - SDWebImage (5.19.1): - SDWebImage/Core (= 5.19.1) - SDWebImage/Core (5.19.1) @@ -143,7 +143,7 @@ PODS: - SwiftyGif (5.4.5) - system_settings (0.0.1): - Flutter - - Toast (4.1.0) + - Toast (4.1.1) - url_launcher_ios (0.0.1): - Flutter - video_player_avfoundation (0.0.1): @@ -312,7 +312,7 @@ SPEC CHECKSUMS: camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68 connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed - DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac + DKImagePickerController: 0a24ebfe7b48beeb74c27531540aaa2cc1dac6cf DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475 file_picker: ce3938a0df3cc1ef404671531facef740d03f920 @@ -322,7 +322,7 @@ SPEC CHECKSUMS: flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82 - fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265 + fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db fluwx: daa284756ce53442b3d0417ceeda66e981906811 google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 @@ -337,13 +337,13 @@ SPEC CHECKSUMS: package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 - ReachabilitySwift: 5ae15e16814b5f9ef568963fb2c87aeb49158c66 + ReachabilitySwift: 2128f3a8c9107e1ad33574c6e58e8285d460b149 SDWebImage: 40b0b4053e36c660a764958bff99eed16610acbb shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 system_settings: 8f5cdbfa72c677fc8d665b863bcc20d393d87e9d - Toast: ec33c32b8688982cecc6348adeae667c1b9938da + Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579 webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4 @@ -351,4 +351,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart index 8aad7340..10428878 100644 --- a/star_lock/lib/appRouters.dart +++ b/star_lock/lib/appRouters.dart @@ -7,7 +7,6 @@ import 'package:star_lock/login/register/starLock_register_binding.dart'; import 'package:star_lock/login/register/starLock_register_xhj_page.dart'; import 'package:star_lock/main/lockDetail/accessoriesList/accessoriesList_page.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_page.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_page.dart'; @@ -371,8 +370,6 @@ abstract class Routers { static const selectCountryRegionPage = '/SelectCountryRegionPage'; // 选择国家和地区 static const safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证 - static const keyOperationRecordPage = '/keyOperationRecordPage'; //钥匙详情-操作记录 - static const getDeviceListPage = '/getDeviceListPage'; //设备列表 static const getNameListPage = '/getNameListPage'; //姓名列表 static const authorityManagementPage = '/authorityManagementPage'; //批量授权 @@ -898,9 +895,6 @@ abstract class AppRouters { ), GetPage( name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()), - GetPage( - name: Routers.keyOperationRecordPage, - page: () => const KeyOperationRecordPage()), GetPage( name: Routers.getDeviceListPage, page: () => const GetDeviceListPage()), GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage()), diff --git a/star_lock/lib/blue/io_protocol/io_referEventRecordTime.dart b/star_lock/lib/blue/io_protocol/io_referEventRecordTime.dart index a8775e7a..2ffe80a5 100644 --- a/star_lock/lib/blue/io_protocol/io_referEventRecordTime.dart +++ b/star_lock/lib/blue/io_protocol/io_referEventRecordTime.dart @@ -46,12 +46,13 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol { List ebcData = []; // 指令类型 - int type = commandType!.typeValue; - double typeDouble = type / 256; - int type1 = typeDouble.toInt(); - int type2 = type % 256; - data.add(type1); - data.add(type2); + // int type = commandType!.typeValue; + // double typeDouble = type / 256; + // int type1 = typeDouble.toInt(); + // int type2 = type % 256; + // data.add(type1); + // data.add(type2); + data.addAll(intChangList(commandType!.typeValue)); // 子命令类型 data.add(41); @@ -67,7 +68,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol { subData = getFixedLengthList(subData, 20 - userIDLength); // logsCount - subData.add(logsCount!); + subData.addAll(intChangList(logsCount!)); // time subData.add((time! & 0xff000000) >> 24); diff --git a/star_lock/lib/blue/io_reply.dart b/star_lock/lib/blue/io_reply.dart index c8625aeb..135acd51 100644 --- a/star_lock/lib/blue/io_reply.dart +++ b/star_lock/lib/blue/io_reply.dart @@ -120,7 +120,7 @@ abstract class Reply{ case 0x16: // 正在开锁中... AppLog.log("$logTag ${commandType!.typeName}正在开锁中..."); - // showErrorMessage("正在开锁中..."); + showErrorMessage("正在开锁中..."); break; case 0xff: // 异常,未知错误 diff --git a/star_lock/lib/blue/sender_beforeDataManage.dart b/star_lock/lib/blue/sender_beforeDataManage.dart index 55c78e30..a3239d22 100644 --- a/star_lock/lib/blue/sender_beforeDataManage.dart +++ b/star_lock/lib/blue/sender_beforeDataManage.dart @@ -46,8 +46,7 @@ class SenderBeforeDataManage { // 启动订阅 void _initReplySubscription() { - _replySubscription ??= - EventBusManager().eventBus!.on().listen((reply) async { + _replySubscription ??= EventBusManager().eventBus!.on().listen((reply) async { // 添加用户 if (reply is AddUserReply) { _replyAddUserKey(reply); diff --git a/star_lock/lib/debug/controller.dart b/star_lock/lib/debug/controller.dart index 27cbdb43..5e6ac502 100644 --- a/star_lock/lib/debug/controller.dart +++ b/star_lock/lib/debug/controller.dart @@ -148,7 +148,7 @@ class DebugConsoleController { endHour: endTime.hour, endMin: endTime.minute, role: CommonDataManage().currentKeyInfo.keyRight == 1 ? 1 : 0, - password: "123456", + password: "0", needAuthor: 1, publicKey: publicKeyDataList, privateKey: getPrivateKeyList, diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart index e69de29b..dffadaf6 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_logic.dart @@ -0,0 +1,10 @@ + + +import 'package:star_lock/tools/baseGetXController.dart'; + +import 'volumeAuthorizationLock_state.dart'; + +class VolumeAuthorizationLockLogic extends BaseGetXController { + final state = VolumeAuthorizationLockState(); + +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart index 1766a13d..5bb5dfb1 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_page.dart @@ -19,6 +19,7 @@ import '../../../../appRouters.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../translations/trans_lib.dart'; +import 'volumeAuthorizationLock_logic.dart'; class VolumeAuthorizationLockPage extends StatefulWidget { final String type; @@ -32,8 +33,10 @@ class VolumeAuthorizationLockPage extends StatefulWidget { } //批量授权锁页面 -class _VolumeAuthorizationLockPageState - extends State { +class _VolumeAuthorizationLockPageState extends State { + final logic = Get.put(VolumeAuthorizationLockLogic()); + final state = Get.find().state; + final FlutterContactPicker _contactPicker = FlutterContactPicker(); final TextEditingController _emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框 @@ -115,7 +118,6 @@ class _VolumeAuthorizationLockPageState Widget keyInfoWidget() { return Column( children: [ - Container(height: 10.h), CommonItem( leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr, rightTitle: "", @@ -334,6 +336,11 @@ class _VolumeAuthorizationLockPageState getEffectiveDateTime = _effectiveDateTime.millisecondsSinceEpoch.toString(); } + + if (_lockIdList.isEmpty) { + logic.showToast("请选择锁".tr); + return; + } var entity = await ApiRepository.to.addAuthorizedAdmin( createUser: _isCreateUser ? "1" : "0", endDate: getFailureDateTime, diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_state.dart index e69de29b..7c289fb6 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_state.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/volumeAuthorizationLock/volumeAuthorizationLock_state.dart @@ -0,0 +1,5 @@ + + +class VolumeAuthorizationLockState{ + +} \ No newline at end of file diff --git a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart index ab4977af..ce430d48 100644 --- a/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart +++ b/star_lock/lib/main/lockDetail/card/cardDetail/cardDetail_page.dart @@ -175,9 +175,9 @@ class _CardDetailPageState extends State with RouteAware { rightTitle: "", isHaveDirection: true, action: () { - Get.toNamed(Routers.keyOperationRecordPage, arguments: { - 'lockId': state.fingerprintItemData.value.lockId.toString(), - 'cardId': state.fingerprintItemData.value.cardId.toString() + Get.toNamed(Routers.lockOperatingRecordPage, arguments: { + 'type': 2, + 'id': state.fingerprintItemData.value.cardId.toString() }); }), // SizedBox(height: 40.h), diff --git a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart index 20ecde08..55a98228 100644 --- a/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/card/otherTypeKeyChangeDate/otherTypeKeyChangeDate_logic.dart @@ -117,7 +117,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ List signKeyDataList = changeStringListToIntList(signKey!); IoSenderManage.senderAddFaceCommand( - keyID:state.fingerprintItemData.value.cardId!.toString(), + keyID:state.fingerprintItemData.value.faceId!.toString(), userID:await Storage.getUid(), faceNo:int.parse(state.fingerprintItemData.value.faceNumber!), useCountLimit:0xffff, @@ -411,6 +411,21 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{ // 修改人脸有效期 void editFaceData() async { + // var entity = await ApiRepository.to.updateFaceValidity( + // lockId: state.faceItemData.value.lockId!, + // faceId: state.faceItemData.value.faceId!, + // startDate: int.parse(state.startDate.value), + // endDate: int.parse(state.endDate.value), + // startTime: int.parse(state.startTime.value), + // endTime: int.parse(state.endTime.value), + // faceType: state.keyType.value, + // weekDay: state.weekDay.value, + // faceName: state.changeNameController.text, + // addType: "1", + // isCoerced: state.isStressFace.value ? 2 : 1, + // faceRight: state.isAdministrator.value ? 1 : 0, + // ); + var entity = await ApiRepository.to.updateFaceValidity( lockId: state.fingerprintItemData.value.lockId!, faceId: state.fingerprintItemData.value.faceId!, diff --git a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart index 2c97d8c5..d70d0b97 100644 --- a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart +++ b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_logic.dart @@ -5,7 +5,6 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import 'package:star_lock/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; @@ -19,6 +18,7 @@ import '../../../blue/sender_manage.dart'; import '../../../network/api_repository.dart'; import '../../../tools/baseGetXController.dart'; import '../../../tools/storage.dart'; +import '../lockOperatingRecord/keyOperationRecord_entity.dart'; class DoorLockLogLogic extends BaseGetXController { DoorLockLogState state = DoorLockLogState(); @@ -26,40 +26,14 @@ class DoorLockLogLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { - _replySubscription = - EventBusManager().eventBus!.on().listen((reply) { - // if(reply is SenderReferEventRecordNumberReply) { - // _replyReferEventRecordNumber(reply); - // } + _replySubscription = EventBusManager().eventBus!.on().listen((reply) { - if (reply is SenderReferEventRecordTimeReply) { + if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) { _replyReferEventRecordTime(reply); } }); } - // 根据数量查解析数据 - // Future _replyReferEventRecordNumber(Reply reply) async { - // int status = reply.data[2]; - // switch(status){ - // case 0x00: - // //成功 - // // _getLockStatus(); - // break; - // case 0x06: - // //无权限 - // - // break; - // case 0x07: - // //无权限 - // - // break; - // default: - // //失败 - // break; - // } - // } - // 根据时间查解析数据 Future _replyReferEventRecordTime(Reply reply) async { cancelBlueConnetctToastTimer(); @@ -86,7 +60,7 @@ class DoorLockLogLogic extends BaseGetXController { indexMap["type"] = indexList[0].toString(); if(indexList[0] == 2){ - var passwordData = reply.data.sublist(7, 17); + var passwordData = indexList.sublist(7, 17); var password = utf8String(passwordData); indexMap["user"] = password.toString(); }else{ @@ -112,26 +86,7 @@ class DoorLockLogLogic extends BaseGetXController { break; case 0x06: //无权限 需要鉴权 - // var privateKey = await Storage.getStringList(saveBluePrivateKey); - // List getPrivateKeyList = changeStringListToIntList(privateKey!); - // - // var token = await Storage.getStringList(saveBlueToken); - // List getTokenList = changeStringListToIntList(token!); - // - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List getPublicKeyList = changeStringListToIntList(publicKey!); - // - // IoSenderManage.senderReferEventRecordTimeCommand( - // keyID: BlueManage().connectDeviceName, - // userID: await Storage.getUid(), - // logsCount: int.parse(pageSize), - // // time:DateTime.now().millisecondsSinceEpoch~/1000, - // time: state.operateDate, - // token: getTokenList, - // needAuthor: 1, - // publicKey: getPublicKeyList, - // privateKey: getPrivateKeyList, - // ); + break; default: //失败 @@ -139,36 +94,8 @@ class DoorLockLogLogic extends BaseGetXController { } } - // 查询事件记录(页数查询) - // Future senderReferEventRecordNumber() async { - // BlueManage().bludSendData(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { - // if (state == DeviceConnectionState.connected) { - // var privateKey = await Storage.getStringList(saveBluePrivateKey); - // List getPrivateKeyList = changeStringListToIntList(privateKey!); - // - // var token = await Storage.getStringList(saveBlueToken); - // List getTokenList = changeStringListToIntList(token!); - // - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List getPublicKeyList = changeStringListToIntList(publicKey!); - // - // IoSenderManage.senderReferEventRecordNumberCommand( - // keyID:BlueManage().connectDeviceName, - // userID:await Storage.getUid(), - // logsCount:20, - // logsNo:1, - // token:getTokenList, - // needAuthor:1, - // publicKey:getPublicKeyList, - // privateKey:getPrivateKeyList, - // ); - // } - // }); - // } - // 查询事件记录(时间查询) Future senderReferEventRecordTime() async { - showEasyLoading(); showBlueConnetctToastTimer(action: (){ dismissEasyLoading(); diff --git a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart index 0957a13d..d373e4a6 100644 --- a/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart +++ b/star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart @@ -22,7 +22,7 @@ class DoorLockLogPage extends StatefulWidget { State createState() => _DoorLockLogPageState(); } -class _DoorLockLogPageState extends State with RouteAware { +class _DoorLockLogPageState extends State with RouteAware{ final logic = Get.put(DoorLockLogLogic()); final state = Get.find().state; diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart index 261cab3f..bd3be8c9 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; @@ -13,6 +13,7 @@ import '../../../../../tools/custom_bottom_sheet.dart'; import '../../../../../tools/dateTool.dart'; import '../../../../../tools/eventBusEventManage.dart'; import '../../../../../tools/showTipView.dart'; +import '../../../lockOperatingRecord/keyOperationRecord_entity.dart'; typedef BlockIsHaveAllDataCallback = void Function(bool isAllData); @@ -235,17 +236,17 @@ class ElectronicKeyDetailLogic extends BaseGetXController { var textList = []; if(CommonDataManage().currentKeyInfo.keyRight == 1){ textList = [ - state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr + state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr ]; }else if(CommonDataManage().currentKeyInfo.isLockOwner == 1){ if (state.keyType.value == 1 || state.keyType.value == 2) { textList = [ - state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr, + state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr, state.itemData.value.keyRight == 1 ? '取消授权'.tr : '授权'.tr ]; } else if (state.keyType.value == 4) { textList = [ - state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr + state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr ]; } } @@ -260,7 +261,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController { chooseCallback: (value) { int index = value; if (index == 0) { - if (state.itemData.value.keyStatus == 110405) { + if (state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen) { // 取消冻结 if (state.itemData.value.keyRight == 1) { // 管理员 @@ -340,6 +341,13 @@ class ElectronicKeyDetailLogic extends BaseGetXController { return currentController; } + noModificationAllowedDuringFreeze(){ + if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ + showToast("冻结状态下不允许修改钥匙权限".tr); + return; + } + } + @override void onReady() { // TODO: implement onReady diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart index e8e836bc..68884069 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart @@ -102,8 +102,12 @@ class _ElectronicKeyDetailPageState extends State { XSConstantMacro.keyStatusExpired ? null : () async { - if (state.keyType.value == 2 || - state.keyType.value == 1) { + if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ + logic.showToast("冻结状态下不允许修改钥匙权限".tr); + return; + } + + if (state.keyType.value == 2 || state.keyType.value == 1) { // 限时/永久 var data = await Get.toNamed( Routers.electronicKeyDetailChangeDate, @@ -113,10 +117,8 @@ class _ElectronicKeyDetailPageState extends State { }); if (data != null) { setState(() { - state.starDate.value = - data["beginTimeTimestamp"].toString(); - state.endDate.value = - data["endTimeTimestamp"].toString(); + state.starDate.value = data["beginTimeTimestamp"].toString(); + state.endDate.value = data["endTimeTimestamp"].toString(); state.keyType.value = 2; }); } @@ -147,6 +149,11 @@ class _ElectronicKeyDetailPageState extends State { isHaveDirection: true, isHaveLine: true, action: () async { + if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ + logic.showToast("冻结状态下不允许修改钥匙权限".tr); + return; + } + var data = await Get.toNamed( Routers.electronicKeyPeriodValidityPage, arguments: { @@ -171,6 +178,11 @@ class _ElectronicKeyDetailPageState extends State { "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", isHaveDirection: true, action: () async { + if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ + logic.showToast("冻结状态下不允许修改钥匙权限".tr); + return; + } + var data = await Get.toNamed( Routers.electronicKeyPeriodValidityPage, arguments: { @@ -242,9 +254,9 @@ class _ElectronicKeyDetailPageState extends State { rightTitle: "", isHaveDirection: true, action: () { - Get.toNamed(Routers.keyOperationRecordPage, arguments: { - 'lockId': state.itemData.value.lockId.toString(), - 'keyId': state.itemData.value.keyId.toString() + Get.toNamed(Routers.lockOperatingRecordPage, arguments: { + 'type': 5, + 'id': state.itemData.value.keyId.toString() }); }), Container(height: 40.h), diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart index 77a8f5e0..bb13f8f7 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_logic.dart @@ -1,11 +1,11 @@ import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetailChangeDate/electronicKeyDetailChangeDate_state.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../tools/dateTool.dart'; import '../../../../../tools/eventBusEventManage.dart'; +import '../../../lockOperatingRecord/keyOperationRecord_entity.dart'; class ElectronicKeyDetailChangeDateLogic extends BaseGetXController { final ElectronicKeyDetailChangeDateState state = diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_logic.dart index 765a1b91..ec6d0330 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_logic.dart @@ -4,7 +4,7 @@ import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../network/api_repository.dart'; import '../../../../../tools/dateTool.dart'; import '../../../../../tools/eventBusEventManage.dart'; -import '../keyOperationRecord/keyOperationRecord_entity.dart'; +import '../../../lockOperatingRecord/keyOperationRecord_entity.dart'; import 'electronicKeyPeriodValidity_state.dart'; class ElectronicKeyPeriodValidityLogic extends BaseGetXController { diff --git a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart index 6ba9211b..0616b16e 100644 --- a/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart +++ b/star_lock/lib/main/lockDetail/face/faceDetail/faceDetail_page.dart @@ -81,7 +81,7 @@ class _FaceDetailPageState extends State with RouteAware { var data = await Get.toNamed( Routers.otherTypeKeyChangeDatePage, arguments: { - "pushType": 2, + "pushType": 3, "fingerprintItemData": state.faceItemData.value, }); if (data != null) { @@ -189,9 +189,9 @@ class _FaceDetailPageState extends State with RouteAware { rightTitle: "", isHaveDirection: true, action: () { - Get.toNamed(Routers.keyOperationRecordPage, arguments: { - 'lockId': state.faceItemData.value.lockId.toString(), - 'faceId': state.faceItemData.value.faceId.toString() + Get.toNamed(Routers.lockOperatingRecordPage, arguments: { + 'type': 4, + 'id': state.faceItemData.value.faceId.toString() }); }), // SizedBox(height: 40.h), diff --git a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart index 61c4bea5..a903c368 100644 --- a/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart +++ b/star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart @@ -183,9 +183,9 @@ class _FingerprintDetailPageState extends State with Rout isHaveDirection: true, action: () { // 指纹 - Get.toNamed(Routers.keyOperationRecordPage, arguments: { - 'lockId': state.fingerprintItemData.value.lockId.toString(), - 'fingerprintId': state.fingerprintItemData.value.fingerprintId.toString() + Get.toNamed(Routers.lockOperatingRecordPage, arguments: { + 'type': 3, + 'id': state.fingerprintItemData.value.fingerprintId.toString() }); }), // SizedBox(height: 40.h), diff --git a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart index 35d714af..efe540ba 100644 --- a/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart +++ b/star_lock/lib/main/lockDetail/iris/irisDetail/irisDetail_page.dart @@ -178,10 +178,10 @@ class _CardDetailPageState extends State with RouteAware { rightTitle: "", isHaveDirection: true, action: () { - Get.toNamed(Routers.keyOperationRecordPage, arguments: { - 'lockId': state.fingerprintItemData.value.lockId.toString(), - 'cardId': state.fingerprintItemData.value.cardId.toString() - }); + // Get.toNamed(Routers.keyOperationRecordPage, arguments: { + // 'lockId': state.fingerprintItemData.value.lockId.toString(), + // 'cardId': state.fingerprintItemData.value.cardId.toString() + // }); }), // SizedBox(height: 40.h), // addControlsBtn(type), diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index fcbf96af..4193133d 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -6,7 +6,6 @@ import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import '../../../app_settings/app_settings.dart'; import '../../../blue/blue_manage.dart'; @@ -23,6 +22,7 @@ import '../../../tools/commonDataManage.dart'; import '../../../tools/eventBusEventManage.dart'; import '../../../tools/storage.dart'; import '../../../translations/trans_lib.dart'; +import '../lockOperatingRecord/keyOperationRecord_entity.dart'; import '../lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart'; import 'lockDetail_state.dart'; import 'lockNetToken_entity.dart'; @@ -260,7 +260,7 @@ class LockDetailLogic extends BaseGetXController { // startDate: state.keyInfos.value.startDate!~/10000, // expireDate: state.keyInfos.value.endDate!~/10000, // role: state.keyInfos.value.keyRight == 1 ? 1 : 0, - // password: "123456", + // password: "0", // needAuthor: 1, // publicKey: publicKeyDataList, // privateKey: getPrivateKeyList, @@ -318,7 +318,7 @@ class LockDetailLogic extends BaseGetXController { // startDate: state.keyInfos.value.startDate!~/10000, // expireDate: state.keyInfos.value.endDate!~/10000, // role: state.keyInfos.value.keyRight == 1 ? 1 : 0, - // password: "123456", + // password: "0", // needAuthor: 1, // publicKey: publicKeyDataList, // privateKey: getPrivateKeyList, @@ -445,7 +445,8 @@ class LockDetailLogic extends BaseGetXController { KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity( electricQuantity:state.electricQuantity.value.toString(), electricQuantityStandby: state.electricQuantityStandby.value.toString(), - lockId: state.keyInfos.value.lockId.toString() + lockId: state.keyInfos.value.lockId.toString(), + isUnShowLoading: true ); if (entity.errorCode!.codeIsSuccessful) { SchedulerBinding.instance.addPostFrameCallback((_) { @@ -475,9 +476,9 @@ class LockDetailLogic extends BaseGetXController { // 查询锁记录最后时间 void getLockRecordLastUploadDataTime() async { - LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to - .getLockRecordLastUploadDataTime( - lockId: state.keyInfos.value.lockId.toString()); + LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to.getLockRecordLastUploadDataTime( + lockId: state.keyInfos.value.lockId.toString() + ); if (entity.errorCode!.codeIsSuccessful) { state.operateDate = entity.data!.operateDate! ~/ 1000; senderReferEventRecordTime(); @@ -486,9 +487,10 @@ class LockDetailLogic extends BaseGetXController { // 操作记录上传 void lockRecordUploadData(List list) async { - KeyOperationRecordEntity entity = await ApiRepository.to - .lockRecordUploadData( - lockId: state.keyInfos.value.lockId.toString(), records: list); + KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordUploadData( + lockId: state.keyInfos.value.lockId.toString(), + records: list + ); if (entity.errorCode!.codeIsSuccessful) { // mockNetworkDataRequest(); AppLog.log("state.keyInfos.value.keyType:${state.keyInfos.value.keyType}"); diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 1cc8128a..b633c0f7 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1266,9 +1266,7 @@ class _LockDetailPageState extends State //如果需要实名认证,需认证完成,方可开锁 isNeedRealNameAuthThenOpenLock() { state.nextAuthTime.value = state.keyInfos.value.nextFaceValidateTime ?? 0; - if (state.keyInfos.value.faceAuthentication == 1 && - state.nextAuthTime.value > 0 && - DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) { + if (state.keyInfos.value.faceAuthentication == 1 && state.nextAuthTime.value > 0 && DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) { AliyunRealNameAuthProvider( getLockInfo: state.keyInfos.value, onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) { diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/keyOperationRecord_entity.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/keyOperationRecord_entity.dart new file mode 100644 index 00000000..62e56549 --- /dev/null +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/keyOperationRecord_entity.dart @@ -0,0 +1,121 @@ + +class KeyOperationRecordEntity { + int? errorCode; + String? description; + String? errorMsg; + KeyOperationRecordData? data; + + KeyOperationRecordEntity( + {this.errorCode, this.description, this.errorMsg, this.data}); + + KeyOperationRecordEntity.fromJson(Map json) { + errorCode = json['errorCode']; + description = json['description']; + errorMsg = json['errorMsg']; + data = json['data'] != null + ? KeyOperationRecordData.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 KeyOperationRecordData { + List? itemList; + int? pageNo; + int? pageSize; + int? pages; + int? total; + + KeyOperationRecordData( + {this.itemList, this.pageNo, this.pageSize, this.pages, this.total}); + + KeyOperationRecordData.fromJson(Map json) { + if (json['list'] != null) { + itemList = []; + json['list'].forEach((v) { + itemList!.add(KeyRecordDataItem.fromJson(v)); + }); + } + pageNo = json['pageNo']; + pageSize = json['pageSize']; + pages = json['pages']; + total = json['total']; + } + + Map toJson() { + final Map data = {}; + if (itemList != null) { + data['list'] = itemList!.map((v) => v.toJson()).toList(); + } + data['pageNo'] = pageNo; + data['pageSize'] = pageSize; + data['pages'] = pages; + data['total'] = total; + return data; + } +} + +class KeyRecordDataItem { + int? recordId; + int? lockId; + int? recordType; + String? recordTypeName; + int? success; + String? username; + int? lockDate; + int? operateDate; + String? keyboardPwd; + + KeyRecordDataItem( + {this.recordId, + this.lockId, + this.recordType, + this.recordTypeName, + this.success, + this.username, + this.lockDate, + this.operateDate, + this.keyboardPwd}); + + KeyRecordDataItem.fromJson(Map json) { + recordId = json['recordId']; + lockId = json['lockId']; + recordType = json['recordType']; + json['recordTypeName'] != null + ? recordTypeName = json['recordTypeName'] + : ""; + success = json['success']; + json['username'] != null ? username = json['username'] : ""; + json['lockDate'] != null ? lockDate = json['lockDate'] : ""; + operateDate = json['operateDate']; + json['keyboardPwd'] != null ? keyboardPwd = json['keyboardPwd'] : ""; + } + + Map toJson() { + final Map data = {}; + data['recordId'] = recordId; + data['lockId'] = lockId; + data['recordType'] = recordType; + data['recordTypeName'] = recordTypeName; + data['success'] = success; + if (data['username'] != null) { + data['username'] = username; + } + if (data['lockDate'] != null) { + data['lockDate'] = lockDate; + } + data['operateDate'] = operateDate; + data['keyboardPwd'] = keyboardPwd; + return data; + } +} diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart index f8100e11..ffe61bb0 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_logic.dart @@ -1,9 +1,8 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; +import '../../../app_settings/app_settings.dart'; import '../../../blue/blue_manage.dart'; import '../../../blue/io_protocol/io_referEventRecordTime.dart'; import '../../../blue/io_reply.dart'; @@ -12,7 +11,9 @@ import '../../../blue/io_tool/manager_event_bus.dart'; import '../../../blue/sender_manage.dart'; import '../../../network/api_repository.dart'; import '../../../tools/baseGetXController.dart'; +import '../../../tools/commonDataManage.dart'; import '../../../tools/storage.dart'; +import 'keyOperationRecord_entity.dart'; import 'lockOperatingRecordGetLastRecordTime_entity.dart'; import 'lockOperatingRecord_state.dart'; @@ -22,111 +23,82 @@ class LockOperatingRecordLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { - _replySubscription = - EventBusManager().eventBus!.on().listen((reply) { - // if(reply is SenderReferEventRecordNumberReply) { - // _replyReferEventRecordNumber(reply); - // } - + _replySubscription = EventBusManager().eventBus!.on().listen((reply) { if (reply is SenderReferEventRecordTimeReply) { _replyReferEventRecordTime(reply); } }); } - // 根据数量查解析数据 - // Future _replyReferEventRecordNumber(Reply reply) async { - // int status = reply.data[2]; - // switch(status){ - // case 0x00: - // //成功 - // // _getLockStatus(); - // break; - // case 0x06: - // //无权限 - // - // break; - // default: - // //失败 - // - // break; - // } - // } - // 根据时间查解析数据 - Future _replyReferEventRecordTime(Reply reply) async { + Future _replyReferEventRecordTime(Reply reply) async { + cancelBlueConnetctToastTimer(); int status = reply.data[2]; switch (status) { case 0x00: - //成功 - if (reply.data[5] > 0) { - reply.data.removeRange(0, 6); + //成功 + int dataLength = (reply.data[5] << 8) + reply.data[6]; + // AppLog.log("dataLength:$dataLength"); + // var dataLength = reply.data[5]; + if (dataLength > 0) { + reply.data.removeRange(0, 7); // 把得到的数据按8位分割成数组 然后塞进一个新的数组里面 - var getList = splitList(reply.data, 8); + if(reply.data.length < 17){ + return; + } + var getList = splitList(reply.data, 17); + AppLog.log("getList:$getList"); var uploadList = []; for (int i = 0; i < getList.length; i++) { var indexList = getList[i]; + AppLog.log("indexList:$indexList"); var indexMap = {}; - indexMap["seq"] = indexList[0].toString(); - indexMap["user"] = indexList[3].toString(); - indexMap["pwd"] = indexList[2].toString(); + indexMap["type"] = indexList[0].toString(); + + if(indexList[0] == 2){ + var passwordData = indexList.sublist(7, 17); + var password = utf8String(passwordData); + AppLog.log("password:$password passwordData:$passwordData"); + indexMap["user"] = password; + }else{ + int userNo = (indexList[1]*255) + indexList[2]; + indexMap["user"] = userNo.toString(); + } + indexMap["success"] = "1"; - indexMap["type"] = indexList[1].toString(); - int value = ((0xff & indexList[(4)]) << 24 | - (0xff & indexList[5]) << 16 | - (0xff & indexList[6]) << 8 | - (0xFF & indexList[7])); - // indexMap["date"] = DateTool().dateToYMDHNSString("$value"); - - indexMap["date"] = "${value * 1000}"; + int time = ((0xff & indexList[(3)]) << 24 | + (0xff & indexList[4]) << 16 | + (0xff & indexList[5]) << 8 | + (0xFF & indexList[6])); + indexMap["date"] = "${time * 1000}"; uploadList.add(indexMap); } lockRecordUploadData(uploadList); + + if(dataLength == state.logCountPage){ + state.ifHaveNext = true; + } } break; case 0x06: - //无权限 + //无权限 需要鉴权 break; default: - //失败 + //失败 break; } } - // 查询事件记录(页数查询) - // Future senderReferEventRecordNumber() async { - // BlueManage().bludSendData(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { - // if (state == DeviceConnectionState.connected) { - // var privateKey = await Storage.getStringList(saveBluePrivateKey); - // List getPrivateKeyList = changeStringListToIntList(privateKey!); - // - // var token = await Storage.getStringList(saveBlueToken); - // List getTokenList = changeStringListToIntList(token!); - // - // var publicKey = await Storage.getStringList(saveBluePublicKey); - // List getPublicKeyList = changeStringListToIntList(publicKey!); - // - // IoSenderManage.senderReferEventRecordNumberCommand( - // keyID:BlueManage().connectDeviceName, - // userID:await Storage.getUid(), - // logsCount:20, - // logsNo:1, - // token:getTokenList, - // needAuthor:1, - // publicKey:getPublicKeyList, - // privateKey:getPrivateKeyList, - // ); - // } - // }); - // } - // 查询事件记录(时间查询) - Future senderReferEventRecordTime(int time) async { - BlueManage().bludSendData(BlueManage().connectDeviceName, - (BluetoothConnectionState state) async { - if (state == BluetoothConnectionState.connected) { + Future senderReferEventRecordTime() async { + showEasyLoading(); + showBlueConnetctToastTimer(action: (){ + dismissEasyLoading(); + }); + BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async { + if (connectionStateState == BluetoothConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -136,61 +108,79 @@ class LockOperatingRecordLogic extends BaseGetXController { var publicKey = await Storage.getStringList(saveBluePublicKey); List getPublicKeyList = changeStringListToIntList(publicKey!); - EasyLoading.show(); IoSenderManage.senderReferEventRecordTimeCommand( keyID: BlueManage().connectDeviceName, userID: await Storage.getUid(), - logsCount: 20, + logsCount: state.logCountPage, // time:DateTime.now().millisecondsSinceEpoch~/1000, - time: time, + time: state.operateDate, token: getTokenList, needAuthor: 1, publicKey: getPublicKeyList, privateKey: getPrivateKeyList, ); + } else if (connectionStateState == BluetoothConnectionState.disconnected) { + dismissEasyLoading(); + cancelBlueConnetctToastTimer(); + if(state.ifCurrentScreen.value == true){ + showBlueConnetctToast(); + } } }); } //请求操作记录列表 - void mockNetworkDataRequest() async { + Future mockNetworkDataRequest() async { KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList( - endDate:'', - keyId:"", - keyStatus:'0', - lockId:state.keyInfos.value.lockId.toString(), - operatorUid:'1', - pageNo:'1', - pageSize:'20', - startDate:'', + lockId:CommonDataManage().currentKeyInfo.lockId.toString(), + pageNo:pageNo.toString(), recordType:'', searchStr:'', - timezoneRawOffSet:'', - keyboardPwdId:'', - cardId:'', - fingerprintId:''); + startDate:'', + endDate:'', + keyboardPwdId: state.type == 1 ? state.idStr : '', + cardId: state.type == 2 ? state.idStr : '', + fingerprintId: state.type == 3 ? state.idStr : '', + keyId: state.type == 5 ? state.idStr : '', + faceId: state.type == 4 ? state.idStr : '', + pageSize:pageSize, + ); if (entity.errorCode!.codeIsSuccessful) { - state.lockOperatingRecordListData.value = entity.data!.itemList!; - } else {} + if (pageNo == 1) { + state.lockOperatingRecordListData.value = entity.data!.itemList!; + pageNo++; + } else { + if (entity.data!.itemList!.isNotEmpty) { + state.lockOperatingRecordListData.value.addAll(entity.data!.itemList!); + pageNo++; + } + } + } + return entity; } // 查询锁记录最后时间 void getLockRecordLastUploadDataTime() async { LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to .getLockRecordLastUploadDataTime( - lockId: state.keyInfos.value.lockId.toString()); + lockId: CommonDataManage().currentKeyInfo.lockId.toString()); if (entity.errorCode!.codeIsSuccessful) { - senderReferEventRecordTime(entity.data!.operateDate! ~/ 1000); + state.operateDate = entity.data!.operateDate! ~/ 1000; + senderReferEventRecordTime(); } } // 操作记录上传 void lockRecordUploadData(List list) async { KeyOperationRecordEntity entity = await ApiRepository.to - .lockRecordUploadData( - lockId: state.keyInfos.value.lockId.toString(), records: list); + .lockRecordUploadData(lockId: CommonDataManage().currentKeyInfo.lockId.toString(), records: list); if (entity.errorCode!.codeIsSuccessful) { - mockNetworkDataRequest(); + if(state.ifHaveNext == true){ + getLockRecordLastUploadDataTime(); + }else{ + pageNo = 1; + mockNetworkDataRequest(); + } } } @@ -211,15 +201,15 @@ class LockOperatingRecordLogic extends BaseGetXController { // 获取是否是演示模式 演示模式不获取接口 var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - _initReplySubscription(); + // _initReplySubscription(); - mockNetworkDataRequest(); + // mockNetworkDataRequest(); + // _getDoorLockLogListRefreshUIAction(); } } @override Future onInit() async { - // TODO: implement onInit super.onInit(); // 获取是否是演示模式 演示模式不获取接口 @@ -228,6 +218,7 @@ class LockOperatingRecordLogic extends BaseGetXController { getLockRecordLastUploadDataTime(); // senderReferEventRecordTime(); // senderReferEventRecordNumber(); + _initReplySubscription(); } } @@ -236,10 +227,11 @@ class LockOperatingRecordLogic extends BaseGetXController { // TODO: implement onClose super.onClose(); - // 获取是否是演示模式 演示模式不获取接口 + //获取是否是演示模式 演示模式不获取接口 var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { _replySubscription.cancel(); + // _getDoorLockLogListRefreshUIEvent?.cancel(); } } } diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart index 6e00872c..15095b70 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_page.dart @@ -1,14 +1,19 @@ import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import '../../../app_settings/app_colors.dart'; +import '../../../tools/EasyRefreshTool.dart'; +import '../../../tools/appRouteObserver.dart'; +import '../../../tools/commonDataManage.dart'; import '../../../tools/custom_bottom_sheet.dart'; +import '../../../tools/keySearchWidget.dart'; import '../../../tools/noData.dart'; import '../../../tools/storage.dart'; import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; +import 'keyOperationRecord_entity.dart'; import 'lockOperatingRecord_logic.dart'; class LockOperatingRecordPage extends StatefulWidget { @@ -19,10 +24,28 @@ class LockOperatingRecordPage extends StatefulWidget { _LockOperatingRecordPageState(); } -class _LockOperatingRecordPageState extends State { +class _LockOperatingRecordPageState extends State with RouteAware{ final logic = Get.put(LockOperatingRecordLogic()); final state = Get.find().state; + Future getHttpData() async { + var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); + if (isDemoMode == false) { + logic.mockNetworkDataRequest().then((KeyOperationRecordEntity value){ + if (mounted) { + setState(() {}); + } + }); + } + } + + @override + void initState() { + super.initState(); + + getHttpData(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -32,8 +55,8 @@ class _LockOperatingRecordPageState extends State { haveBack: true, backgroundColor: AppColors.mainColor, actionsList: [ - (state.keyInfos.value.isLockOwner == 1 || - state.keyInfos.value.keyRight == 1) + (CommonDataManage().currentKeyInfo.isLockOwner == 1 || + CommonDataManage().currentKeyInfo.keyRight == 1) ? IconButton( icon: Image.asset( 'images/icon_bar_more.png', @@ -53,61 +76,41 @@ class _LockOperatingRecordPageState extends State { : Container(), ], ), - body: Column( - children: [ - (state.keyInfos.value.isLockOwner == 1 || - state.keyInfos.value.keyRight == 1) - ? Column( - children: [ - Container( - padding: EdgeInsets.all(20.h), - child: Text( - TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, - textAlign: TextAlign.start, - style: TextStyle(fontSize: 20.sp), + body: EasyRefreshTool( + onRefresh: (){ + logic.pageNo = 1; + getHttpData(); + }, + onLoad: (){ + getHttpData(); + }, + child: Column( + children: [ + (CommonDataManage().currentKeyInfo.isLockOwner == 1 || + CommonDataManage().currentKeyInfo.keyRight == 1) + ? Column( + children: [ + Container( + padding: EdgeInsets.only(left:20.h, right: 20.h, top: 20.h), + child: Text( + TranslationLoader.lanKeys!.lockOperatingRecordTip!.tr, + textAlign: TextAlign.start, + style: TextStyle(fontSize: 20.sp), + ), ), - ), - _searchWidget(), - ], - ) - : Container(), - SizedBox(height: 10.h), - Expanded(child: _buildMainUI()), - ], - ), - ); - } - - Widget _searchWidget() { - return Container( - height: 60.h, - margin: EdgeInsets.only(left: 20.w, right: 10.w), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: TextField( - //输入框一行 - maxLines: 1, - // controller: _controller, - autofocus: false, - - decoration: InputDecoration( - //输入里面输入文字内边距设置 - contentPadding: const EdgeInsets.only( - top: 12.0, left: -19.0, right: -15.0, bottom: 8.0), - hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, - hintStyle: TextStyle(fontSize: 22.sp, height: 3.0), - //不需要输入框下划线 - border: InputBorder.none, - //左边图标设置 - icon: Padding( - padding: EdgeInsets.only( - top: 20.h, bottom: 20.h, right: 20.w, left: 10.w), - child: Image.asset( - 'images/main/icon_main_search.png', - width: 40.w, - height: 40.w, - ), - ), + KeySearchWidget( + editingController: state.searchController, + onSubmittedAction: () { + logic.pageNo = 1; + getHttpData(); + }, + ), + ], + ) + : Container(), + SizedBox(height: 10.h), + Expanded(child: _buildMainUI()), + ], ), ), ); @@ -135,7 +138,7 @@ class _LockOperatingRecordPageState extends State { ); }, ) - : NoData()); + : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight)); } String getTypeIcon(int type) { @@ -228,16 +231,70 @@ class _LockOperatingRecordPageState extends State { builder: (BuildContext context) { return AlertBottomWidget( topTitle: '', - items: const ['读取记录', '清空记录', '导出记录'], + // items: const ['读取记录', '清空记录', '导出记录'], + items: const ['清空记录'], chooseCallback: (value) { int getSelectIndex = value; + // if (getSelectIndex == 0) { + // logic.mockNetworkDataRequest(); + // } else if (getSelectIndex == 1) { + // logic.clearOperationRecordRequest(); + // } if (getSelectIndex == 0) { - logic.mockNetworkDataRequest(); - } else if (getSelectIndex == 1) { logic.clearOperationRecordRequest(); } }, ); }); } + + @override + void didChangeDependencies() { + // TODO: implement didChangeDependencies + super.didChangeDependencies(); + + /// 路由订阅 + AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); + } + + @override + void dispose() { + // TODO: implement dispose + /// 取消路由订阅 + AppRouteObserver().routeObserver.unsubscribe(this); + super.dispose(); + } + + /// 从上级界面进入 当前界面即将出现 + @override + void didPush() { + super.didPush(); + state.ifCurrentScreen.value = true; + } + + /// 返回上一个界面 当前界面即将消失 + @override + void didPop() { + super.didPop(); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + state.ifCurrentScreen.value = false; + } + + /// 从下级返回 当前界面即将出现 + @override + void didPopNext() { + super.didPopNext(); + state.ifCurrentScreen.value = true; + } + + /// 进入下级界面 当前界面即将消失 + @override + void didPushNext() { + super.didPushNext(); + logic.cancelBlueConnetctToastTimer(); + if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); + state.ifCurrentScreen.value = false; + } + } diff --git a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart index 43ef9b49..86851a31 100644 --- a/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart +++ b/star_lock/lib/main/lockDetail/lockOperatingRecord/lockOperatingRecord_state.dart @@ -1,15 +1,30 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import '../../lockMian/entity/lockListInfo_entity.dart'; +import 'keyOperationRecord_entity.dart'; class LockOperatingRecordState { - final keyInfos = LockListInfoItemEntity().obs; final lockOperatingRecordListData = [].obs; final TextEditingController searchController = TextEditingController(); + var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + var operateDate = 0; // 按日期查询消息记录的时间戳 + var ifHaveNext = false; // 页码 + var logCountPage = 10; // 蓝牙记录一页多少个 + var idStr = ""; // + var type = 0; // 1:密码 2:卡 3:指纹 4:人脸 5:钥匙 + LockOperatingRecordState() { - keyInfos.value = Get.arguments["keyInfo"]; + Map map = Get.arguments; + if(map["id"] != null){ + idStr = Get.arguments["id"]; + } + if(map["idStr"] != null){ + idStr = Get.arguments["idStr"]; + } + if(map["type"] != null){ + type = Get.arguments["type"]; + } } } diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart index 27a28831..49f94eb1 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/editLockName/editLockName_logic.dart @@ -1,9 +1,9 @@ import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import '../../../../../network/api_repository.dart'; import '../../../../../tools/baseGetXController.dart'; import '../../../../../tools/eventBusEventManage.dart'; +import '../../../lockOperatingRecord/keyOperationRecord_entity.dart'; import 'editLockName_state.dart'; class EditLockNameLogic extends BaseGetXController { diff --git a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart index 2a236a45..819af46a 100644 --- a/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_logic.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import '../../../../../blue/blue_manage.dart'; import '../../../../../blue/io_protocol/io_getStarLockStatusInfo.dart'; @@ -14,6 +13,7 @@ import '../../../../../network/api_repository.dart'; import '../../../../../tools/baseGetXController.dart'; import '../../../../../tools/eventBusEventManage.dart'; import '../../../../../tools/storage.dart'; +import '../../../lockOperatingRecord/keyOperationRecord_entity.dart'; import 'uploadElectricQuantity_state.dart'; class UploadElectricQuantityLogic extends BaseGetXController { @@ -24,7 +24,8 @@ class UploadElectricQuantityLogic extends BaseGetXController { KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity( electricQuantity:electricQuantity, electricQuantityStandby: electricQuantityStandby, - lockId: state.lockSetInfoData.value.lockId.toString() + lockId: state.lockSetInfoData.value.lockId.toString(), + isUnShowLoading: false ); if (entity.errorCode!.codeIsSuccessful) { showToast("锁电量更新成功".tr, something: () { diff --git a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart index 3b918d4e..9bccc128 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_logic.dart @@ -195,7 +195,7 @@ class LockTimeLogic extends BaseGetXController{ // getStarLockStatus(); // getLockTimeFromGateway(); - // getServerDatetime(false); + getServerDatetime(); } @override diff --git a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart index 0c1f8be3..06883e72 100644 --- a/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart +++ b/star_lock/lib/main/lockDetail/lockSet/lockTime/lockTime_page.dart @@ -57,7 +57,7 @@ class _LockTimePageState extends State with RouteAware{ onClick: () { // logic.sendTiming(); // logic.getServerDatetime(); - logic.getServerDatetime(); + logic.sendTiming(); }), SizedBox( height: 40.h, diff --git a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart index c31c0a3d..2bcc2ac0 100644 --- a/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart +++ b/star_lock/lib/main/lockDetail/palm/palmDetail/palmDetail_page.dart @@ -169,10 +169,10 @@ class _PalmDetailPageState extends State with RouteAware { rightTitle: "", isHaveDirection: true, action: () { - Get.toNamed(Routers.keyOperationRecordPage, arguments: { - 'lockId': state.fingerprintItemData.value.lockId.toString(), - 'cardId': state.fingerprintItemData.value.cardId.toString() - }); + // Get.toNamed(Routers.keyOperationRecordPage, arguments: { + // 'lockId': state.fingerprintItemData.value.lockId.toString(), + // 'cardId': state.fingerprintItemData.value.cardId.toString() + // }); }), // SizedBox(height: 40.h), // addControlsBtn(type), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart index fe82ada8..88031689 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; -import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart'; import 'package:star_lock/network/api_repository.dart'; @@ -84,7 +83,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { deleteType:1); if (entity.errorCode!.codeIsSuccessful) { showToast("删除成功".tr, something: (){ - eventBus.fire(GetPasswordListRefreshUI()); + // eventBus.fire(GetPasswordListRefreshUI()); Get.back(result: "deletScuess"); }); } @@ -219,7 +218,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { break; case 6: //每日循环 6 每天开始和结束时间指定时间段内有效 - useDateStr = '周日 $starHour:00-$endHour:00'; + useDateStr = '每日 $starHour:00-$endHour:00'; state.isCirculation.value = true; break; case 7: @@ -302,7 +301,7 @@ class PasswordKeyDetailLogic extends BaseGetXController { break; case 6: //每日循环 6 每天开始和结束时间指定时间段内有效 - useDateStr = '类型:循环\n周日 $starHour:00-$endHour:00'; + useDateStr = '类型:循环\n每日 $starHour:00-$endHour:00'; break; case 7: //工作日循环 7 工作日开始和结束时间指定的时间段内有效 diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 698948c2..d7561109 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -53,6 +53,14 @@ class _PasswordKeyDetailPageState extends State with Rout body: SingleChildScrollView( child: Column( children: [ + Obx(() => Visibility( + visible: state.itemData.value.isCustom! == 1, + child: CommonItem( + leftTitel: "${"密码".tr}${TranslationLoader.lanKeys!.number!.tr}", + rightTitle: state.itemData.value.pwdUserNo.toString(), + isHaveDirection: false, + isHaveLine: true), + )), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.password!.tr, rightTitle: state.keyboardPwd.value, @@ -133,10 +141,10 @@ class _PasswordKeyDetailPageState extends State with Rout rightTitle: "", isHaveDirection: true, action: () { - Navigator.pushNamed(context, Routers.keyOperationRecordPage, + Navigator.pushNamed(context, Routers.lockOperatingRecordPage, arguments: { - 'lockId': state.itemData.value.lockId.toString(), - 'keyId': state.itemData.value.keyboardPwdId.toString() + 'type': 1, + 'id': state.itemData.value.keyboardPwdId.toString() }); }), Container(height: 40.h), diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index a0c4e72b..326a0b63 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -31,7 +31,7 @@ class PasswordKeyListLogic extends BaseGetXController { _replyAddPassword(reply); } - if(reply is SenderResetPasswordsReply){ + if((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)){ _replyResetPassword(reply); } }); @@ -62,9 +62,9 @@ class PasswordKeyListLogic extends BaseGetXController { IoSenderManage.senderCustomPasswordsCommand( keyID:"0", userID:(await Storage.getUid())!, - pwdNo:state.pwdNo, - pwd:"0",//state.deletPWD, - operate: 2, + pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0, + pwd:state.pwd,//state.deletPWD, + operate: state.itemData.isCustom == 1 ? 2 : 3, isAdmin: 0, useCountLimit: 0xffff, startTime:0x11223344, @@ -142,9 +142,9 @@ class PasswordKeyListLogic extends BaseGetXController { IoSenderManage.senderCustomPasswordsCommand( keyID:"0", userID:(await Storage.getUid())!, - pwdNo:state.pwdNo, - pwd:"0",//state.deletPWD, - operate: 2, + pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0, + pwd:state.pwd,//state.deletPWD, + operate: state.itemData.isCustom == 1 ? 2 : 3, isAdmin: 0, useCountLimit: 0xffff, startTime:0x11223344, @@ -217,6 +217,7 @@ class PasswordKeyListLogic extends BaseGetXController { state.searchController.text); if (entity.errorCode!.codeIsSuccessful) { if (pageNo == 1) { + state.itemDataList.value.clear(); state.itemDataList.value = entity.data!.itemList!; pageNo++; } else { 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 a5eb481a..e4b55287 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -141,6 +141,7 @@ class _PasswordKeyListPageState extends State with RouteAwa ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async { state.itemData = passwordKeyListItem; state.pwdNo = passwordKeyListItem.pwdUserNo!; + state.pwd = passwordKeyListItem.keyboardPwd!; logic.senderCustomPasswords(); }); }, 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 7e0ce6f9..0ba3e1c1 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart @@ -14,6 +14,7 @@ class PasswordKeyListState { var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) var pwdNo = 0; + var pwd = "0"; var encrpyKey = []; PasswordKeyListState() { Map map = Get.arguments; diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index a02ca713..649cf795 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -130,9 +130,10 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { state.getPwdStr.value = entity.data!.keyboardPwd!; } eventBus.fire(GetPasswordListRefreshUI()); - } else { - showToast('${entity.errorMsg}'); } + // else { + // showToast('${entity.errorMsg}'); + // } } //自定义密码请求 @@ -266,6 +267,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); + var startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1); + var endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1); + //非永久 须有时限 + if (state.isPermanent.value == true) { + startDate = 0; + endDate = 0; + } IoSenderManage.senderCustomPasswordsCommand( keyID: "1", userID: await Storage.getUid(), @@ -274,8 +282,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { operate: 0, isAdmin: state.isAdministrator.value == true ? 1 : 0, useCountLimit: 0xffff, - startTime: DateTool().dateToTimestamp(state.customBeginTime.value, 1)~/1000, - endTime: DateTool().dateToTimestamp(state.customEndTime.value, 1)~/1000, + startTime: startDate ~/1000, + endTime: endDate ~/1000, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, @@ -357,8 +365,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { operate: 0, isAdmin: state.isAdministrator.value == true ? 1 : 0, useCountLimit: 0xffff, - startTime: DateTool().dateToTimestamp(state.customBeginTime.value, 1)~/1000, - endTime: DateTool().dateToTimestamp(state.customEndTime.value, 1)~/1000, + startTime: startDate ~/1000, + endTime: endDate ~/1000, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart index 71c37b9d..e7814662 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -12,6 +12,7 @@ import 'package:star_lock/blue/io_type.dart'; import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; import 'package:star_lock/tools/commonDataManage.dart'; +import '../../../app_settings/app_settings.dart'; import '../../../blue/blue_manage.dart'; import '../../../blue/io_protocol/io_addUser.dart'; import '../../../blue/io_reply.dart'; @@ -36,9 +37,9 @@ class SaveLockLogic extends BaseGetXController { _replyAddUserKey(reply); } - if (reply is SenderCustomPasswordsReply) { - _replySenderCustomPasswords(reply); - } + // if (reply is SenderCustomPasswordsReply) { + // _replySenderCustomPasswords(reply); + // } // if (reply is ChangeAdministratorPasswordReply) { // _replyChangeAdministratorPassword(reply); @@ -48,8 +49,6 @@ class SaveLockLogic extends BaseGetXController { // 添加用户 Future _replyAddUserKey(Reply reply) async { - // var lockId = reply.data.sublist(2, 42); - var token = reply.data.sublist(42, 46); List strTokenList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, strTokenList); @@ -57,9 +56,10 @@ class SaveLockLogic extends BaseGetXController { int status = reply.data[46]; switch (status) { case 0x00: - //成功 + //成功 如果成功保存用户编号 state.lockUserNo = listChangInt(reply.data.sublist(47, 49)); + // 关闭超时 cancelBlueConnetctToastTimer(); bindBlueAdmin(); break; @@ -88,7 +88,7 @@ class SaveLockLogic extends BaseGetXController { endHour: 0, endMin: 0, role: 255, - password: "123456", + password: state.adminPassword, needAuthor: 1, publicKey: publicKeyDataList, privateKey: getPrivateKeyList, @@ -96,7 +96,7 @@ class SaveLockLogic extends BaseGetXController { isBeforeAddUser: true); break; default: - //失败 + //失败 关闭loading state.sureBtnState.value = 0; dismissEasyLoading(); break; @@ -104,49 +104,52 @@ class SaveLockLogic extends BaseGetXController { } // 添加管理员密码 - Future _replySenderCustomPasswords(Reply reply) async { - int status = reply.data[2]; - - switch (status) { - case 0x00: - //成功 - state.sureBtnState.value = 0; - addLockAdminPassword(true); - break; - case 0x06: - //无权限 - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var signKey = await Storage.getStringList(saveBlueSignKey); - List signKeyDataList = changeStringListToIntList(signKey!); - - var token = reply.data.sublist(5, 9); - var saveStrList = changeIntListToStringList(token); - Storage.setStringList(saveBlueToken, saveStrList); - - IoSenderManage.senderCustomPasswordsCommand( - keyID: "1", - userID: await Storage.getUid(), - pwdNo: 0, - pwd: state.adminPasswordTF.text, - operate: 0, - isAdmin: 1, - useCountLimit: 0xffff, - startTime: 0x11223344, - endTime: 0x11223344, - needAuthor: 1, - isBeforeAddUser: true, - signKey: signKeyDataList, - privateKey: getPrivateKeyList, - token: token); - break; - default: - state.sureBtnState.value = 0; - dismissEasyLoading(); - break; - } - } + // Future _replySenderCustomPasswords(Reply reply) async { + // int status = reply.data[2]; + // + // switch (status) { + // case 0x00: + // //成功 + // state.sureBtnState.value = 0; + // dismissEasyLoading(); + // addLockAdminPassword(true); + // break; + // case 0x06: + // //无权限 + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var signKey = await Storage.getStringList(saveBlueSignKey); + // List signKeyDataList = changeStringListToIntList(signKey!); + // + // var token = reply.data.sublist(5, 9); + // var saveStrList = changeIntListToStringList(token); + // Storage.setStringList(saveBlueToken, saveStrList); + // + // IoSenderManage.senderCustomPasswordsCommand( + // keyID: "1", + // userID: await Storage.getUid(), + // pwdNo: 0, + // pwd: state.adminPassword, + // operate: 0, + // isAdmin: 1, + // useCountLimit: 0xffff, + // startTime: 0x11223344, + // endTime: 0x11223344, + // needAuthor: 1, + // isBeforeAddUser: true, + // signKey: signKeyDataList, + // privateKey: getPrivateKeyList, + // token: token); + // break; + // default: + // state.sureBtnState.value = 0; + // dismissEasyLoading(); + // backAction(); + // // AppLog.log("添加管理员密码失败 消失"); + // break; + // } + // } // 修改管理员密码 // Future _replyChangeAdministratorPassword(Reply reply) async { @@ -197,10 +200,15 @@ class SaveLockLogic extends BaseGetXController { } state.sureBtnState.value = 1; - showTitleEasyLoading("添加锁进行中 1/2"); + // showTitleEasyLoading("添加锁进行中 1/2"); + showEasyLoading(); + // 判断超时 showBlueConnetctToastTimer(action: (){ dismissEasyLoading(); state.sureBtnState.value = 0; + if(state.ifCurrentScreen.value == true){ + showBlueConnetctToast(); + } }); BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected){ @@ -233,7 +241,7 @@ class SaveLockLogic extends BaseGetXController { endHour: 0, endMin: 0, role:255, - password:"123456", + password:state.adminPassword, needAuthor:1, publicKey:publicKeyDataList, privateKey:getPrivateKeyList, @@ -252,48 +260,56 @@ class SaveLockLogic extends BaseGetXController { } // 设置管理员密码(同添加自定义开锁密码,指纹/密码/卡片前5个是管理员) - Future senderCustomPasswords() async { - var rng = Random(); - var number = rng.nextInt(900000) + 100000; // 生成 100000 到 999999 之间的随机整数 - state.adminPassword = number.toString(); - state.adminPasswordTF.text = number.toString(); - - showTitleEasyLoading("添加锁进行中 2/2"); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { - if (deviceConnectionState == BluetoothConnectionState.connected) { - var signKey = await Storage.getStringList(saveBlueSignKey); - List signKeyDataList = changeStringListToIntList(signKey!); - - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); - - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); - - IoSenderManage.senderCustomPasswordsCommand( - keyID: "1", - userID: await Storage.getUid(), - pwdNo: 0, - pwd: state.adminPasswordTF.text, - operate: 0, - isAdmin: 1, - useCountLimit: 0xffff, - startTime: 0x11223344, - endTime: 0x11223344, - needAuthor: 1, - isBeforeAddUser: true, - signKey: signKeyDataList, - privateKey: getPrivateKeyList, - token: getTokenList); - } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { - dismissEasyLoading(); - state.sureBtnState.value = 0; - if(state.ifCurrentScreen.value == true){ - showBlueConnetctToast(); - } - } - }, isAddEquipment: true); - } + // Future senderCustomPasswords() async { + // + // showTitleEasyLoading("添加锁进行中 2/2"); + // // showEasyLoading(); + // showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){ + // // AppLog.log("添加管理员密码超时"); + // dismissEasyLoading(); + // state.sureBtnState.value = 0; + // if(state.ifCurrentScreen.value == true){ + // showBlueConnetctToast(); + // } + // // backAction(); + // }); + // BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + // if (deviceConnectionState == BluetoothConnectionState.connected) { + // var signKey = await Storage.getStringList(saveBlueSignKey); + // List signKeyDataList = changeStringListToIntList(signKey!); + // + // var privateKey = await Storage.getStringList(saveBluePrivateKey); + // List getPrivateKeyList = changeStringListToIntList(privateKey!); + // + // var token = await Storage.getStringList(saveBlueToken); + // List getTokenList = changeStringListToIntList(token!); + // + // IoSenderManage.senderCustomPasswordsCommand( + // keyID: "1", + // // userID: await Storage.getUid(), + // userID: "0", + // pwdNo: 0, + // pwd: state.adminPassword, + // operate: 0, + // isAdmin: 1, + // useCountLimit: 0xffff, + // startTime: 0x11223344, + // endTime: 0x11223344, + // needAuthor: 1, + // isBeforeAddUser: true, + // signKey: signKeyDataList, + // privateKey: getPrivateKeyList, + // token: getTokenList); + // } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + // dismissEasyLoading(); + // state.sureBtnState.value = 0; + // if(state.ifCurrentScreen.value == true){ + // showBlueConnetctToast(); + // } + // // backAction(); + // } + // }, isAddEquipment: true); + // } // 修改管理员密码(同添加自定义开锁密码,指纹/密码/卡片前5个是管理员) // Future changeAdministratorPasswordCommand() async { @@ -337,6 +353,7 @@ class SaveLockLogic extends BaseGetXController { // } void bindBlueAdmin() async{ + state.lockInfo["adminPwd"] = state.adminPassword; var positionMap = {}; positionMap['longitude'] = state.addressInfo["longitude"]; @@ -377,8 +394,10 @@ class SaveLockLogic extends BaseGetXController { ); if (entity.errorCode!.codeIsSuccessful) { state.lockId = entity.data!.lockId!; - // eventBus.fire(RefreshLockListInfoDataEvent()); - await senderCustomPasswords(); + + backAction(); + + // await senderCustomPasswords(); // BlueManage().disconnect(BlueManage().connectDeviceMacAddress); // eventBus.fire(RefreshLockListInfoDataEvent()); @@ -389,20 +408,19 @@ class SaveLockLogic extends BaseGetXController { } // 更新管理员密码 - void addLockAdminPassword(bool isAddLockAdminPassword) async { - var entity = await ApiRepository.to.setAdminPasswordData( - lockId: state.lockId, - adminPwd: state.adminPasswordTF.text, - ); - if (entity.errorCode!.codeIsSuccessful) { - // if(isAddLockAdminPassword == true){ - // showDeletPasswordAlertDialog(); - // }else{ - eventBus.fire(RefreshLockListInfoDataEvent()); - backAction(); - // } - } - } + // void addLockAdminPassword(bool isAddLockAdminPassword) async { + // var entity = await ApiRepository.to.setAdminPasswordData( + // lockId: state.lockId, + // adminPwd: state.adminPassword, + // ); + // // if (entity.errorCode!.codeIsSuccessful) { + // // if(isAddLockAdminPassword == true){ + // // showDeletPasswordAlertDialog(); + // // }else{ + // backAction(); + // // } + // // } + // } // void showDeletPasswordAlertDialog() { // showDialog( @@ -440,6 +458,7 @@ class SaveLockLogic extends BaseGetXController { // } void backAction(){ + eventBus.fire(RefreshLockListInfoDataEvent()); BlueManage().disconnect(); Get.close(state.isFromMap == 1 ? 5 : 6); } diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart index affd16e0..a15d6438 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_state.dart @@ -1,4 +1,6 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -23,13 +25,14 @@ class SaveLockState { var sureBtnState = 0.obs;// 0可点击 1 不可点击 // 管理员密码 - var adminPasswordTF = TextEditingController(); + // var adminPasswordTF = TextEditingController(); var adminPassword = ''; var lockId = 0; SaveLockState() { aliName.value = BlueManage().connectDeviceName; aliNameController.text = aliName.value; + adminPassword = getAdminPassword(); Map map = Get.arguments; pwdTimestamp.value = map["pwdTimestamp"]; @@ -44,4 +47,10 @@ class SaveLockState { void onClose() { aliNameController.dispose(); } + + String getAdminPassword(){ + var rng = Random(); + var number = rng.nextInt(900000) + 100000; // 生成 100000 到 999999 之间的随机整数 + return number.toString(); + } } \ No newline at end of file diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index a04080b8..9a9e93a0 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -175,6 +175,7 @@ class ApiProvider extends BaseProvider { String electricQuantity, String electricQuantityStandby, String lockId, + bool isUnShowLoading, ) => post( uploadElectricQuantityURL.toUrl, @@ -182,7 +183,9 @@ class ApiProvider extends BaseProvider { 'electricQuantity': electricQuantity, 'electricQuantityStandby': electricQuantityStandby, 'lockId': lockId, - })); + }), + isUnShowLoading: isUnShowLoading + ); Future modifyKeyName( String keyId, @@ -261,37 +264,33 @@ class ApiProvider extends BaseProvider { jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); Future lockRecordList( - {required String endDate, - required String keyId, - required String keyStatus, - required String lockId, - required String operatorUid, - required String pageNo, - required String pageSize, - required String startDate, - required String recordType, - required String searchStr, - required String timezoneRawOffSet, - required String keyboardPwdId, - required String cardId, - required String fingerprintId}) => + {required String lockId, + required String pageNo, + required String recordType, + required String searchStr, + required String startDate, + required String endDate, + required String keyboardPwdId, + required String cardId, + required String fingerprintId, + required String keyId, + required String faceId, + required String pageSize}) => post( keyOperationRecordURL.toUrl, jsonEncode({ - 'endDate': endDate, - 'keyId': keyId, - "keyStatus": keyStatus, 'lockId': lockId, - "operatorUid": operatorUid, 'pageNo': pageNo, - 'pageSize': pageSize, - 'startDate': startDate, 'recordType': recordType, 'searchStr': searchStr, - 'timezoneRawOffSet': timezoneRawOffSet, + 'startDate': startDate, + 'endDate': endDate, 'keyboardPwdId': keyboardPwdId, 'cardId': cardId, - 'fingerprintId': fingerprintId + 'fingerprintId': fingerprintId, + 'keyId': keyId, + 'faceId': faceId, + 'pageSize': pageSize })); // 门锁事件日志 diff --git a/star_lock/lib/network/api_provider_base.dart b/star_lock/lib/network/api_provider_base.dart index 1ef6539e..de87b124 100644 --- a/star_lock/lib/network/api_provider_base.dart +++ b/star_lock/lib/network/api_provider_base.dart @@ -36,7 +36,10 @@ class BaseProvider extends GetConnect with Api { bool? isUserBaseUrl = true, // 文件上传不使用baseUrl }) async { AppLog.log("post: url:$url body:$body contentType:$contentType"); - if (isUnShowLoading == false) EasyLoading.show(); + if (isUnShowLoading == false){ + AppLog.log("post: url:$url show loading"); + EasyLoading.show(); + } if (isUserBaseUrl == false) { httpClient.baseUrl = ''; } else { diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 291e317d..6ad25392 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -2,7 +2,6 @@ import 'package:get/get.dart'; import 'package:star_lock/blue/entity/lock_user_no_list_entity.dart'; import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart'; -import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; @@ -50,6 +49,7 @@ import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/chec import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart'; import '../main/lockDetail/fingerprint/addFingerprint/addFingerprint_entity.dart'; import '../main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart'; +import '../main/lockDetail/lockOperatingRecord/keyOperationRecord_entity.dart'; import '../main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifiEntity.dart'; import '../main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart'; import '../main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart'; @@ -218,36 +218,34 @@ class ApiRepository { } //钥匙详情-操作记录 - Future lockRecordList( - {required String endDate, - required String keyId, - required String keyStatus, - required String lockId, - required String operatorUid, - required String pageNo, - required String pageSize, - required String startDate, - required String recordType, - required String searchStr, - required String timezoneRawOffSet, - required String keyboardPwdId, - required String cardId, - required String fingerprintId}) async { + Future lockRecordList({ + required String lockId, + required String pageNo, + required String recordType, + required String searchStr, + required String startDate, + required String endDate, + required String keyboardPwdId, + required String cardId, + required String fingerprintId, + required String keyId, + required String faceId, + required String pageSize, + }) async { final res = await apiProvider.lockRecordList( - endDate: endDate, - keyId: keyId, - keyStatus: keyStatus, - lockId: lockId, - operatorUid: operatorUid, - pageNo: pageNo, - pageSize: pageSize, - startDate: startDate, - recordType: recordType, - searchStr: searchStr, - timezoneRawOffSet: timezoneRawOffSet, - keyboardPwdId: keyboardPwdId, - cardId: cardId, - fingerprintId: fingerprintId); + lockId: lockId, + pageNo: pageNo, + recordType: recordType, + searchStr: searchStr, + startDate: startDate, + endDate: endDate, + keyboardPwdId: keyboardPwdId, + cardId: cardId, + fingerprintId: fingerprintId, + keyId: keyId, + faceId: faceId, + pageSize: pageSize, + ); return KeyOperationRecordEntity.fromJson(res.body); } @@ -324,11 +322,12 @@ class ApiRepository { //锁电量更新 Future uploadElectricQuantity( - {String? electricQuantity, - String? electricQuantityStandby, - String? lockId}) async { + {required String? electricQuantity, + required String? electricQuantityStandby, + required String? lockId, + required bool? isUnShowLoading}) async { final res = await apiProvider.uploadElectricQuantity( - electricQuantity!, electricQuantityStandby!, lockId!); + electricQuantity!, electricQuantityStandby!, lockId!, isUnShowLoading!); return KeyOperationRecordEntity.fromJson(res.body); } diff --git a/star_lock/lib/tools/baseGetXController.dart b/star_lock/lib/tools/baseGetXController.dart index 872672cc..29de5361 100644 --- a/star_lock/lib/tools/baseGetXController.dart +++ b/star_lock/lib/tools/baseGetXController.dart @@ -55,7 +55,9 @@ class BaseGetXController extends GetxController { void showEasyLoading() => EasyLoading.show(); - void dismissEasyLoading() => EasyLoading.dismiss(); + void dismissEasyLoading() { + if(EasyLoading.isShow) EasyLoading.dismiss(); + } void showTitleEasyLoading(String showContent) => EasyLoading.show(status: showContent); diff --git a/star_lock/lib/tools/noData.dart b/star_lock/lib/tools/noData.dart index da342934..4251d19a 100644 --- a/star_lock/lib/tools/noData.dart +++ b/star_lock/lib/tools/noData.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; +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'; @@ -17,6 +18,7 @@ class NoData extends StatelessWidget { width: 1.sw, height: noDataHeight ?? 1.sh - ScreenUtil().statusBarHeight, // height: 1.sw, + // color: Colors.red, child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center,