添加操作记录上传

This commit is contained in:
魏少阳 2024-04-30 14:46:06 +08:00
parent 93fd62678e
commit a8fc401da4
10 changed files with 86 additions and 56 deletions

View File

@ -9,6 +9,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyO
import 'package:star_lock/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import '../../../app_settings/app_settings.dart';
import '../../../blue/blue_manage.dart';
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
import '../../../blue/io_reply.dart';
@ -66,33 +67,40 @@ class DoorLockLogLogic extends BaseGetXController {
switch (status) {
case 0x00:
//
var dataLength = reply.data[5];
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, 6);
reply.data.removeRange(0, 7);
// 8
if(reply.data.length < 8){
if(reply.data.length < 17){
return;
}
var getList = splitList(reply.data, 8);
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 = reply.data.sublist(7, 17);
var password = utf8String(passwordData);
indexMap["user"] = password.toString();
}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);

View File

@ -160,33 +160,39 @@ class LockDetailLogic extends BaseGetXController {
switch (status) {
case 0x00:
//
var dataLength = reply.data[5];
int dataLength = (reply.data[5] << 8) + reply.data[6];
AppLog.log("dataLength:$dataLength");
if (dataLength > 0) {
reply.data.removeRange(0, 6);
reply.data.removeRange(0, 7);
// 8
var getList = splitList(reply.data, 8);
if(reply.data.length < 8){
await BlueManage().disconnect();
cancelBlueConnetctToastTimer();
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 = reply.data.sublist(7, 17);
var password = utf8String(passwordData);
indexMap["user"] = password.toString();
}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);

View File

@ -1035,7 +1035,7 @@ class _LockDetailPageState extends State<LockDetailPage>
}),
);
if (state.keyInfos.value.lockFeature!.d3Face == 1) {
if (state.keyInfos.value.lockFeature!.isSupportCatEye == 1) {
//
endWiddget.add(bottomItem(
'images/main/icon_lockDetail_videoLog.png',

View File

@ -100,6 +100,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
//
break;
default:
state.sureBtnState.value = 0;
break;
}
}

View File

@ -289,6 +289,7 @@ class LockFeature {
int? d3Face;
int? bluetoothRemoteControl;
int? videoIntercom;
int? isSupportCatEye;
LockFeature(
{this.password,
this.icCard,
@ -298,7 +299,8 @@ class LockFeature {
this.isSupportIris,
this.d3Face,
this.bluetoothRemoteControl,
this.videoIntercom});
this.videoIntercom,
this.isSupportCatEye});
LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password'];
@ -310,6 +312,7 @@ class LockFeature {
d3Face = json['d3Face'];
bluetoothRemoteControl = json['bluetoothRemoteControl'];
videoIntercom = json['videoIntercom'];
isSupportCatEye = json['isSupportCatEye'];
}
Map<String, dynamic> toJson() {
@ -323,6 +326,7 @@ class LockFeature {
data['d3Face'] = d3Face;
data['bluetoothRemoteControl'] = bluetoothRemoteControl;
data['videoIntercom'] = videoIntercom;
data['isSupportCatEye'] = isSupportCatEye;
return data;
}
}

View File

@ -86,16 +86,9 @@ class SaveLockLogic extends BaseGetXController {
token: token,
isBeforeAddUser: true);
break;
case 0x07:
//
dismissEasyLoading();
break;
case 0x09:
//
dismissEasyLoading();
break;
default:
//
state.sureBtnState.value = 0;
dismissEasyLoading();
break;
}
@ -112,7 +105,7 @@ class SaveLockLogic extends BaseGetXController {
switch (status) {
case 0x00:
//
dismissEasyLoading();
state.sureBtnState.value = 0;
addLockAdminPassword(true);
break;
case 0x06:
@ -138,6 +131,8 @@ class SaveLockLogic extends BaseGetXController {
token: token);
break;
default:
state.sureBtnState.value = 0;
dismissEasyLoading();
break;
}
}
@ -186,10 +181,15 @@ class SaveLockLogic extends BaseGetXController {
//
Future<void> addUserConnectBlue() async {
//
showEasyLoading();
if(state.sureBtnState.value == 1){
return;
}
state.sureBtnState.value = 1;
showTitleEasyLoading("添加锁进行中 1/2");
showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
state.saveBtnIsUsable.value = true;
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
@ -226,7 +226,7 @@ class SaveLockLogic extends BaseGetXController {
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
state.saveBtnIsUsable.value = true;
state.sureBtnState.value = 0;
if(state.ifCurrentScreen.value == true){
showBlueConnetctToast();
}
@ -240,6 +240,8 @@ class SaveLockLogic extends BaseGetXController {
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);
@ -264,6 +266,12 @@ class SaveLockLogic extends BaseGetXController {
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
token: getTokenList);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
state.sureBtnState.value = 0;
if(state.ifCurrentScreen.value == true){
showBlueConnetctToast();
}
}
}, isAddEquipment: true);
}
@ -350,12 +358,14 @@ class SaveLockLogic extends BaseGetXController {
);
if (entity.errorCode!.codeIsSuccessful) {
state.lockId = entity.data!.lockId!;
eventBus.fire(RefreshLockListInfoDataEvent());
senderCustomPasswords();
// eventBus.fire(RefreshLockListInfoDataEvent());
await senderCustomPasswords();
// BlueManage().disconnect(BlueManage().connectDeviceMacAddress);
// eventBus.fire(RefreshLockListInfoDataEvent());
// Get.close(state.isFromMap == 1 ? 5 : 6);
}else{
state.sureBtnState.value = 0;
}
}
@ -369,7 +379,8 @@ class SaveLockLogic extends BaseGetXController {
// if(isAddLockAdminPassword == true){
// showDeletPasswordAlertDialog();
// }else{
backAction();
eventBus.fire(RefreshLockListInfoDataEvent());
backAction();
// }
}
}

View File

@ -109,9 +109,6 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
bottom: 25.w
),
onClick: (){
if(state.saveBtnIsUsable.value == false){
return;
}
logic.addUserConnectBlue();
}
),
@ -153,8 +150,10 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
super.didPop();
BlueManage().stopScan();
logic.dismissEasyLoading();
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0;
}
///
@ -170,6 +169,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
void didPushNext() {
super.didPushNext();
state.sureBtnState.value = 0;
state.ifCurrentScreen.value = false;
logic.cancelBlueConnetctToastTimer();
}

View File

@ -20,7 +20,7 @@ class SaveLockState {
var isFromMap = 0; // 0: 1:
var ifCurrentScreen = true.obs; // ,
var saveBtnIsUsable = true.obs; //
var sureBtnState = 0.obs;// 0 1
//
var adminPasswordTF = TextEditingController();

View File

@ -4,7 +4,7 @@ import 'package:get/get_connect/http/src/request/request.dart';
import 'package:star_lock/app_settings/app_settings.dart';
FutureOr<Request> requestLogInterceptor(Request request) async {
AppLog.log('GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
AppLog.log(request.headers.toString());
// AppLog.log('GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
// AppLog.log(request.headers.toString());
return request;
}

View File

@ -5,7 +5,7 @@ import 'package:get/get_connect/http/src/request/request.dart';
import 'package:star_lock/app_settings/app_settings.dart';
FutureOr<dynamic> responseLogInterceptor(Request request, Response response) {
print('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString} ${response.headers}');
AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers}
EasyLoading.dismiss(animation: true);
return response;
}