Merge branch 'release' into International-language+20240725
This commit is contained in:
commit
7b7e04669b
@ -15,6 +15,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
String? userID;
|
||||
int? logsCount;
|
||||
int? time;
|
||||
int? currentDate;
|
||||
List<int>? token;
|
||||
int? needAuthor;
|
||||
List<int>? publicKey;
|
||||
@ -25,6 +26,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
this.userID,
|
||||
this.logsCount,
|
||||
this.time,
|
||||
this.currentDate,
|
||||
this.token,
|
||||
this.needAuthor,
|
||||
this.publicKey,
|
||||
@ -34,7 +36,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
@override
|
||||
String toString() {
|
||||
return 'SenderReferEventRecordTimeCommand{keyID: $keyID, '
|
||||
'userID: $userID, logsCount: $logsCount, time:$time timeStr: ${DateTool().dateIntToYMDHNString(time)}, '
|
||||
'userID: $userID, logsCount: $logsCount, time:$time timeStr: ${DateTool().dateIntToYMDHNString(time)}, currentDate: ${DateTool().dateIntToYMDHNString(time)}'
|
||||
'token: $token, needAuthor: $needAuthor, publicKey: $publicKey, '
|
||||
'privateKey: $privateKey}';
|
||||
}
|
||||
@ -74,7 +76,13 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
subData.add((time! & 0xff000000) >> 24);
|
||||
subData.add((time! & 0xff0000) >> 16);
|
||||
subData.add((time! & 0xff00) >> 8);
|
||||
subData.add((time! & 0xff));
|
||||
subData.add(time! & 0xff);
|
||||
|
||||
// currentDate
|
||||
subData.add((currentDate! & 0xff000000) >> 24);
|
||||
subData.add((currentDate! & 0xff0000) >> 16);
|
||||
subData.add((currentDate! & 0xff00) >> 8);
|
||||
subData.add(currentDate! & 0xff);
|
||||
|
||||
// token
|
||||
// subData.addAll(token!);
|
||||
@ -107,7 +115,7 @@ class SenderReferEventRecordTimeCommand extends SenderProtocol {
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
int add = 16 - data.length % 16;
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
|
||||
@ -816,6 +816,7 @@ class IoSenderManage {
|
||||
required String? userID,
|
||||
required int? logsCount,
|
||||
required int? time,
|
||||
required int? currentDate,
|
||||
required List<int>? token,
|
||||
required int? needAuthor,
|
||||
required List<int>? publicKey,
|
||||
|
||||
@ -59,19 +59,15 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
// AppLog.log("indexList:$indexList");
|
||||
final Map indexMap = {};
|
||||
indexMap['type'] = indexList[0].toString();
|
||||
const int operateDate = 0;
|
||||
// if (indexList[0] == 2) {
|
||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
indexMap['user'] = userNo.toString();
|
||||
AppLog.log('userNouserNouserNouserNo:$userNo');
|
||||
final List<int> passwordData = indexList.sublist(7, 17);
|
||||
final String password = utf8String(passwordData);
|
||||
indexMap['password'] = password.toString();
|
||||
AppLog.log('passwordpasswordpassword:$password');
|
||||
// } else {
|
||||
// final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
// indexMap['user'] = userNo.toString();
|
||||
// }
|
||||
|
||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
indexMap['user'] = userNo.toString();
|
||||
// AppLog.log('userNouserNouserNouserNo:$userNo');
|
||||
|
||||
final List<int> passwordData = indexList.sublist(7, 17);
|
||||
final String password = utf8String(passwordData);
|
||||
indexMap['password'] = password.toString();
|
||||
// AppLog.log('passwordpasswordpassword:$password');
|
||||
|
||||
indexMap['success'] = '1';
|
||||
|
||||
@ -81,17 +77,13 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
(0xFF & indexList[6]);
|
||||
indexMap['date'] = '${time * 1000}';
|
||||
uploadList.add(indexMap);
|
||||
|
||||
if (i == getList.length - 1) {
|
||||
//设置最后的时间戳
|
||||
state.operateDate = operateDate;
|
||||
}
|
||||
}
|
||||
lockRecordUploadData(uploadList);
|
||||
|
||||
if (dataLength == state.logCountPage) {
|
||||
state.ifHaveNext = true;
|
||||
} else {
|
||||
state.ifHaveNext = false;
|
||||
}
|
||||
lockRecordUploadData(uploadList);
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
@ -110,8 +102,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionStateState) async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
|
||||
if (connectionStateState == BluetoothConnectionState.connected) {
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
@ -130,6 +121,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
logsCount: state.logCountPage,
|
||||
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||||
time: state.operateDate,
|
||||
currentDate: state.currentDate,
|
||||
token: getTokenList,
|
||||
needAuthor: 1,
|
||||
publicKey: getPublicKeyList,
|
||||
@ -202,6 +194,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
lockId: state.keyInfos.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||
state.currentDate = entity.data!.currentDate! ~/ 1000;
|
||||
senderReferEventRecordTime();
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ class DoorLockLogState {
|
||||
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
int operateDate = 0; // 按日期查询消息记录的时间戳
|
||||
int currentDate = 0; // 当前服务器UTC毫秒时间戳
|
||||
bool ifHaveNext = false; // 页码
|
||||
int logCountPage = 10; // 蓝牙记录一页多少个
|
||||
Rx<DateTime> currentSelectDate = DateTime.now().obs;
|
||||
|
||||
@ -51,10 +51,10 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 开完锁之后上传记录
|
||||
if (reply is SenderReferEventRecordTimeReply &&
|
||||
state.ifCurrentScreen.value == true) {
|
||||
_replyReferEventRecordTime(reply);
|
||||
}
|
||||
// if (reply is SenderReferEventRecordTimeReply &&
|
||||
// state.ifCurrentScreen.value == true) {
|
||||
// _replyReferEventRecordTime(reply);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
@ -255,71 +255,71 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 根据时间查解析数据
|
||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
final int dataLength = (reply.data[5] << 8) + reply.data[6];
|
||||
AppLog.log('dataLength:$dataLength');
|
||||
if (dataLength > 0) {
|
||||
reply.data.removeRange(0, 7);
|
||||
// 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面
|
||||
if (reply.data.length < 17) {
|
||||
return;
|
||||
}
|
||||
final List<List<int>> getList = splitList(reply.data, 17);
|
||||
AppLog.log('getList:$getList');
|
||||
final List uploadList = [];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
final List<int> indexList = getList[i];
|
||||
AppLog.log('indexList:$indexList');
|
||||
final Map indexMap = {};
|
||||
indexMap['type'] = indexList[0].toString();
|
||||
int operateDate = 0;
|
||||
// if (indexList[0] == 2) {
|
||||
final List<int> passwordData = indexList.sublist(7, 17);
|
||||
final String password = utf8String(passwordData);
|
||||
AppLog.log('passwordData:$passwordData password:$password');
|
||||
indexMap['user'] = password.toString();
|
||||
// } else {
|
||||
// final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
// indexMap['user'] = userNo.toString();
|
||||
// }
|
||||
|
||||
indexMap['success'] = '1';
|
||||
|
||||
final int time = (0xff & indexList[3]) << 24 |
|
||||
(0xff & indexList[4]) << 16 |
|
||||
(0xff & indexList[5]) << 8 |
|
||||
(0xFF & indexList[6]);
|
||||
operateDate = time * 1000;
|
||||
indexMap['date'] = '$operateDate';
|
||||
uploadList.add(indexMap);
|
||||
|
||||
if (i == getList.length - 1) {
|
||||
//设置最后的时间戳
|
||||
state.operateDate = operateDate;
|
||||
}
|
||||
}
|
||||
lockRecordUploadData(uploadList);
|
||||
|
||||
if (dataLength == state.logCountPage) {
|
||||
senderReferEventRecordTime();
|
||||
} else {
|
||||
await blueManageDisconnect();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
blueManageDisconnect();
|
||||
break;
|
||||
default:
|
||||
blueManageDisconnect();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||
// final int status = reply.data[2];
|
||||
// switch (status) {
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// final int dataLength = (reply.data[5] << 8) + reply.data[6];
|
||||
// AppLog.log('dataLength:$dataLength');
|
||||
// if (dataLength > 0) {
|
||||
// reply.data.removeRange(0, 7);
|
||||
// // 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面
|
||||
// if (reply.data.length < 17) {
|
||||
// return;
|
||||
// }
|
||||
// final List<List<int>> getList = splitList(reply.data, 17);
|
||||
// AppLog.log('getList:$getList');
|
||||
// final List uploadList = [];
|
||||
// for (int i = 0; i < getList.length; i++) {
|
||||
// final List<int> indexList = getList[i];
|
||||
// AppLog.log('indexList:$indexList');
|
||||
// final Map indexMap = {};
|
||||
// indexMap['type'] = indexList[0].toString();
|
||||
// int operateDate = 0;
|
||||
// // if (indexList[0] == 2) {
|
||||
// final List<int> passwordData = indexList.sublist(7, 17);
|
||||
// final String password = utf8String(passwordData);
|
||||
// AppLog.log('passwordData:$passwordData password:$password');
|
||||
// indexMap['user'] = password.toString();
|
||||
// // } else {
|
||||
// // final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
// // indexMap['user'] = userNo.toString();
|
||||
// // }
|
||||
//
|
||||
// indexMap['success'] = '1';
|
||||
//
|
||||
// final int time = (0xff & indexList[3]) << 24 |
|
||||
// (0xff & indexList[4]) << 16 |
|
||||
// (0xff & indexList[5]) << 8 |
|
||||
// (0xFF & indexList[6]);
|
||||
// operateDate = time * 1000;
|
||||
// indexMap['date'] = '$operateDate';
|
||||
// uploadList.add(indexMap);
|
||||
//
|
||||
// if (i == getList.length - 1) {
|
||||
// //设置最后的时间戳
|
||||
// state.operateDate = operateDate;
|
||||
// }
|
||||
// }
|
||||
// lockRecordUploadData(uploadList);
|
||||
//
|
||||
// if (dataLength == state.logCountPage) {
|
||||
// senderReferEventRecordTime();
|
||||
// } else {
|
||||
// await blueManageDisconnect();
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //无权限
|
||||
// blueManageDisconnect();
|
||||
// break;
|
||||
// default:
|
||||
// blueManageDisconnect();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 点击开门事件
|
||||
Future<void> openDoorAction() async {
|
||||
@ -375,42 +375,42 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 查询事件记录(时间查询)
|
||||
void senderReferEventRecordTime() {
|
||||
showBlueConnetctToastTimer(
|
||||
isShowBlueConnetctToast: false,
|
||||
action: () {
|
||||
blueManageDisconnect();
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
final List<String>? publicKey =
|
||||
await Storage.getStringList(saveBluePublicKey);
|
||||
final List<int> getPublicKeyList =
|
||||
changeStringListToIntList(publicKey!);
|
||||
|
||||
IoSenderManage.senderReferEventRecordTimeCommand(
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
logsCount: state.logCountPage,
|
||||
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||||
time: state.operateDate,
|
||||
token: getTokenList,
|
||||
needAuthor: 1,
|
||||
publicKey: getPublicKeyList,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
// void senderReferEventRecordTime() {
|
||||
// showBlueConnetctToastTimer(
|
||||
// isShowBlueConnetctToast: false,
|
||||
// action: () {
|
||||
// blueManageDisconnect();
|
||||
// });
|
||||
// BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
// (BluetoothConnectionState connectionState) async {
|
||||
// if (connectionState == BluetoothConnectionState.connected) {
|
||||
// final List<String>? privateKey =
|
||||
// await Storage.getStringList(saveBluePrivateKey);
|
||||
// final List<int> getPrivateKeyList =
|
||||
// changeStringListToIntList(privateKey!);
|
||||
//
|
||||
// final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
// final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
//
|
||||
// final List<String>? publicKey =
|
||||
// await Storage.getStringList(saveBluePublicKey);
|
||||
// final List<int> getPublicKeyList =
|
||||
// changeStringListToIntList(publicKey!);
|
||||
//
|
||||
// IoSenderManage.senderReferEventRecordTimeCommand(
|
||||
// keyID: BlueManage().connectDeviceName,
|
||||
// userID: await Storage.getUid(),
|
||||
// logsCount: state.logCountPage,
|
||||
// // time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||||
// time: state.operateDate,
|
||||
// token: getTokenList,
|
||||
// needAuthor: 1,
|
||||
// publicKey: getPublicKeyList,
|
||||
// privateKey: getPrivateKeyList,
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// 从服务器获取锁的时间 开锁时传入
|
||||
Future<void> getServerDatetime() async {
|
||||
@ -468,15 +468,15 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 查询锁记录最后时间
|
||||
Future<void> getLockRecordLastUploadDataTime() async {
|
||||
final LockOperatingRecordGetLastRecordTimeEntity entity =
|
||||
await ApiRepository.to.getLockRecordLastUploadDataTime(
|
||||
lockId: state.keyInfos.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||
senderReferEventRecordTime();
|
||||
}
|
||||
}
|
||||
// Future<void> getLockRecordLastUploadDataTime() async {
|
||||
// final LockOperatingRecordGetLastRecordTimeEntity entity =
|
||||
// await ApiRepository.to.getLockRecordLastUploadDataTime(
|
||||
// lockId: state.keyInfos.value.lockId.toString());
|
||||
// if (entity.errorCode!.codeIsSuccessful) {
|
||||
// state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||
// senderReferEventRecordTime();
|
||||
// }
|
||||
// }
|
||||
|
||||
// 操作记录上传
|
||||
Future<void> lockRecordUploadData(List list) async {
|
||||
|
||||
@ -1,8 +1,4 @@
|
||||
class LockOperatingRecordGetLastRecordTimeEntity {
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
LockOperatingRecordGetLastRecordTimeEntity(
|
||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||
@ -13,6 +9,10 @@ class LockOperatingRecordGetLastRecordTimeEntity {
|
||||
errorMsg = json['errorMsg'];
|
||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||
}
|
||||
int? errorCode;
|
||||
String? description;
|
||||
String? errorMsg;
|
||||
Data? data;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
@ -27,20 +27,22 @@ class LockOperatingRecordGetLastRecordTimeEntity {
|
||||
}
|
||||
|
||||
class Data {
|
||||
String? lockId;
|
||||
int? operateDate;
|
||||
|
||||
Data({this.lockId, this.operateDate});
|
||||
Data({this.lockId, this.operateDate, this.currentDate});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
lockId = json['lockId'];
|
||||
operateDate = json['operateDate'];
|
||||
currentDate = json['currentDate'];
|
||||
}
|
||||
String? lockId;
|
||||
int? operateDate;
|
||||
int? currentDate;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['lockId'] = lockId;
|
||||
data['operateDate'] = operateDate;
|
||||
data['currentDate'] = currentDate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -43,30 +43,28 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
if (dataLength > 0) {
|
||||
reply.data.removeRange(0, 7);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
if(reply.data.length < 17){
|
||||
if (reply.data.length < 17) {
|
||||
return;
|
||||
}
|
||||
final List<List<int>> getList = splitList(reply.data, 17);
|
||||
AppLog.log('getList:$getList');
|
||||
// AppLog.log("getList:$getList");
|
||||
final List uploadList = [];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
final List<int> indexList = getList[i];
|
||||
AppLog.log('indexList:$indexList');
|
||||
// AppLog.log("indexList:$indexList");
|
||||
final Map indexMap = {};
|
||||
|
||||
indexMap['type'] = indexList[0].toString();
|
||||
|
||||
// if(indexList[0] == 2){
|
||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
indexMap['user'] = userNo.toString();
|
||||
AppLog.log('userNouserNouserNouserNo:$userNo');
|
||||
final List<int> passwordData = indexList.sublist(7, 17);
|
||||
final String password = utf8String(passwordData);
|
||||
indexMap['password'] = password.toString();
|
||||
AppLog.log('passwordpasswordpassword:$password');
|
||||
// }else{
|
||||
// final int userNo = (indexList[1]*256) + indexList[2];
|
||||
// indexMap['user'] = userNo.toString();
|
||||
// }
|
||||
|
||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||
indexMap['user'] = userNo.toString();
|
||||
AppLog.log('userNouserNouserNouserNo:$userNo');
|
||||
|
||||
final List<int> passwordData = indexList.sublist(7, 17);
|
||||
final String password = utf8String(passwordData);
|
||||
indexMap['password'] = password.toString();
|
||||
AppLog.log('passwordpasswordpassword:$password');
|
||||
|
||||
indexMap['success'] = '1';
|
||||
|
||||
@ -77,11 +75,12 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
indexMap['date'] = '${time * 1000}';
|
||||
uploadList.add(indexMap);
|
||||
}
|
||||
lockRecordUploadData(uploadList);
|
||||
|
||||
if(dataLength == state.logCountPage){
|
||||
if (dataLength == state.logCountPage) {
|
||||
state.ifHaveNext = true;
|
||||
} else {
|
||||
state.ifHaveNext = false;
|
||||
}
|
||||
lockRecordUploadData(uploadList);
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
@ -117,6 +116,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
logsCount: state.logCountPage,
|
||||
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||||
time: state.operateDate,
|
||||
currentDate: state.currentDate,
|
||||
token: getTokenList,
|
||||
needAuthor: 1,
|
||||
publicKey: getPublicKeyList,
|
||||
@ -164,18 +164,19 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 查询锁记录最后时间
|
||||
void getLockRecordLastUploadDataTime() async {
|
||||
Future<void> getLockRecordLastUploadDataTime() async {
|
||||
final LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
||||
.getLockRecordLastUploadDataTime(
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||
state.currentDate = entity.data!.currentDate! ~/ 1000;
|
||||
senderReferEventRecordTime();
|
||||
}
|
||||
}
|
||||
|
||||
// 操作记录上传
|
||||
void lockRecordUploadData(List list) async {
|
||||
Future<void> lockRecordUploadData(List list) async {
|
||||
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
.lockRecordUploadData(lockId: CommonDataManage().currentKeyInfo.lockId.toString(), records: list);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -189,7 +190,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//清空操作记录
|
||||
void clearOperationRecordRequest() async {
|
||||
Future<void> clearOperationRecordRequest() async {
|
||||
final KeyOperationRecordEntity entity = await ApiRepository.to.clearOperationRecord(CommonDataManage().currentKeyInfo.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('清除数据成功', something: (){
|
||||
@ -201,7 +202,6 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
|
||||
@override
|
||||
Future<void> onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
@ -230,7 +230,6 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
||||
|
||||
@override
|
||||
Future<void> onClose() async {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
|
||||
//获取是否是演示模式 演示模式不获取接口
|
||||
|
||||
@ -26,6 +26,7 @@ class LockOperatingRecordState { // 记录名称
|
||||
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
int operateDate = 0; // 按日期查询消息记录的时间戳
|
||||
int currentDate = 0; // 当前服务器UTC毫秒时间戳
|
||||
bool ifHaveNext = false; // 页码
|
||||
int logCountPage = 10; // 蓝牙记录一页多少个
|
||||
String idStr = ''; //
|
||||
|
||||
@ -11,6 +11,7 @@ import '../../../../../tools/dateTool.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import '../../lockSet/lockSetInfo_entity.dart';
|
||||
import 'uploadElectricQuantity_logic.dart';
|
||||
|
||||
class UploadElectricQuantityPage extends StatefulWidget {
|
||||
@ -61,7 +62,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
||||
],
|
||||
)),
|
||||
Visibility(
|
||||
visible: state.lockSetInfoData.value.lockFeature!.isSupportBackupBattery == 1,
|
||||
visible: (state.lockSetInfoData.value.lockFeature ?? LockFeature()).isSupportBackupBattery == 1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
|
||||
@ -513,7 +513,6 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 下级界面修改成功后传递数据
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent = eventBus
|
||||
@ -527,22 +526,21 @@ class LockSetLogic extends BaseGetXController {
|
||||
final String content = showContent!.isEmpty
|
||||
? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}"
|
||||
: showContent;
|
||||
ShowTipView().showSureAlertDialog(content);
|
||||
state.showTipView.showSureAlertDialog(content);
|
||||
}
|
||||
|
||||
/// 以下为删除逻辑
|
||||
void deleyLockLogicOfRoles() {
|
||||
if (state.lockBasicInfo.value.isLockOwner == 1) {
|
||||
// 超级管理员必须通过连接蓝牙删除
|
||||
ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr,
|
||||
() {
|
||||
state.showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () {
|
||||
// 删除锁
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
||||
state.showTipView.resetGetController();
|
||||
state.showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
||||
});
|
||||
} else if (state.lockBasicInfo.value.keyRight == 1) {
|
||||
// 授权管理员弹框提示
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||
state.showTipView.showDeleteAdministratorIsHaveAllDataDialog(
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
|
||||
// 授权管理员删除
|
||||
state.deleteAdministratorIsHaveAllData.value = a;
|
||||
@ -550,7 +548,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
});
|
||||
} else {
|
||||
// 普通用户直接删除
|
||||
ShowTipView().showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData);
|
||||
state.showTipView.showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -27,8 +27,7 @@ class LockSetPage extends StatefulWidget {
|
||||
State<LockSetPage> createState() => _LockSetPageState();
|
||||
}
|
||||
|
||||
class _LockSetPageState extends State<LockSetPage>
|
||||
with WidgetsBindingObserver, RouteAware {
|
||||
class _LockSetPageState extends State<LockSetPage> with WidgetsBindingObserver, RouteAware {
|
||||
final LockSetLogic logic = Get.put(LockSetLogic());
|
||||
final LockSetState state = Get.find<LockSetLogic>().state;
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import 'lockSetInfo_entity.dart';
|
||||
|
||||
class LockSetState {
|
||||
@ -29,6 +30,7 @@ class LockSetState {
|
||||
RxBool deleteAdministratorIsHaveAllData = false.obs; // 删除管理员是否有所有数据
|
||||
RxInt sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
|
||||
final ShowTipView showTipView = ShowTipView();
|
||||
LockSetState() {
|
||||
Map map = Get.arguments;
|
||||
lockId.value = map['lockId'];
|
||||
|
||||
@ -162,7 +162,7 @@ class RemoteControlListLogic extends BaseGetXController{
|
||||
return entity;
|
||||
}
|
||||
|
||||
// 删除所有IC卡
|
||||
// 删除所有遥控
|
||||
Future<void> resetRemoteControlData() async {
|
||||
final LoginEntity entity = await ApiRepository.to.resetRemoteControlData(
|
||||
lockId: state.lockId.value
|
||||
@ -181,7 +181,7 @@ class RemoteControlListLogic extends BaseGetXController{
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('删除成功'.tr, something: () {
|
||||
Get.back(result: 'addScuess');
|
||||
getRemoteControlListData(isRefresh: true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ class LockListLogic extends BaseGetXController {
|
||||
LockListState state = LockListState();
|
||||
List<GroupList> _groupDataList = <GroupList>[];
|
||||
LockListInfoGroupEntity? entity;
|
||||
final ShowTipView showTipView = ShowTipView();
|
||||
|
||||
List<GroupList> get groupDataList {
|
||||
|
||||
@ -180,23 +181,22 @@ class LockListLogic extends BaseGetXController {
|
||||
void deleyLockLogicOfRoles() {
|
||||
if (state.lockListInfoItemEntity.isLockOwner == 1) {
|
||||
// 超级管理员必须通过连接蓝牙删除
|
||||
ShowTipView().showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr,
|
||||
() {
|
||||
showTipView.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () {
|
||||
// 删除锁
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
||||
AppLog.log('调用了删除锁');
|
||||
showTipView.resetGetController();
|
||||
showTipView.showTFViewAlertDialog(state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
|
||||
});
|
||||
} else if (state.lockListInfoItemEntity.keyRight == 1) {
|
||||
// 授权管理员弹框提示
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
|
||||
showTipView.showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
|
||||
// 授权管理员删除
|
||||
state.deleteAdministratorIsHaveAllData.value = a;
|
||||
deletKeyData();
|
||||
});
|
||||
} else {
|
||||
// 普通用户直接删除
|
||||
ShowTipView().showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData);
|
||||
showTipView.showIosTipWithContentDialog('是否删除钥匙?'.tr, deletKeyData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -179,8 +179,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.resetPasswords!.tr,
|
||||
leftTitel: '重置密码'.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
|
||||
@ -94,10 +94,12 @@ class ShowTipView {
|
||||
);
|
||||
}
|
||||
|
||||
TextEditingController getController = TextEditingController();
|
||||
void showTFViewAlertDialog(TextEditingController controller, String title,
|
||||
String tipTitle, Function sureClick,
|
||||
{List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
|
||||
// 点击删除 开始扫描
|
||||
getController = controller;
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
@ -108,7 +110,6 @@ class ShowTipView {
|
||||
controller: controller,
|
||||
isShowSuffixIcon: isShowSuffixIcon ?? false,
|
||||
sureClick: () {
|
||||
//发送删除锁请求
|
||||
if (controller.text.isEmpty) {
|
||||
EasyLoading.showToast(tipTitle, duration: 2000.milliseconds);
|
||||
return;
|
||||
@ -124,6 +125,10 @@ class ShowTipView {
|
||||
);
|
||||
}
|
||||
|
||||
void resetGetController(){
|
||||
getController.text = '';
|
||||
}
|
||||
|
||||
// 只有一个确定按钮
|
||||
void showSureBtnTipsAlert(
|
||||
{required String tipsText, required String sureText}) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user