添加操作记录上传
This commit is contained in:
parent
93fd62678e
commit
a8fc401da4
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -100,6 +100,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
||||
//无权限
|
||||
break;
|
||||
default:
|
||||
state.sureBtnState.value = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user