添加操作记录上传
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/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
|
|
||||||
|
import '../../../app_settings/app_settings.dart';
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
||||||
import '../../../blue/io_reply.dart';
|
import '../../../blue/io_reply.dart';
|
||||||
@ -66,33 +67,40 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
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) {
|
if (dataLength > 0) {
|
||||||
reply.data.removeRange(0, 6);
|
reply.data.removeRange(0, 7);
|
||||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||||
if(reply.data.length < 8){
|
if(reply.data.length < 17){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var getList = splitList(reply.data, 8);
|
var getList = splitList(reply.data, 17);
|
||||||
// AppLog.log("getList:$getList");
|
// AppLog.log("getList:$getList");
|
||||||
var uploadList = [];
|
var uploadList = [];
|
||||||
for (int i = 0; i < getList.length; i++) {
|
for (int i = 0; i < getList.length; i++) {
|
||||||
var indexList = getList[i];
|
var indexList = getList[i];
|
||||||
// AppLog.log("indexList:$indexList");
|
// AppLog.log("indexList:$indexList");
|
||||||
var indexMap = {};
|
var indexMap = {};
|
||||||
indexMap["seq"] = indexList[0].toString();
|
indexMap["type"] = indexList[0].toString();
|
||||||
indexMap["user"] = indexList[3].toString();
|
|
||||||
indexMap["pwd"] = indexList[2].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["success"] = "1";
|
||||||
indexMap["type"] = indexList[1].toString();
|
|
||||||
|
|
||||||
int value = ((0xff & indexList[(4)]) << 24 |
|
int time = ((0xff & indexList[(3)]) << 24 |
|
||||||
(0xff & indexList[5]) << 16 |
|
(0xff & indexList[4]) << 16 |
|
||||||
(0xff & indexList[6]) << 8 |
|
(0xff & indexList[5]) << 8 |
|
||||||
(0xFF & indexList[7]));
|
(0xFF & indexList[6]));
|
||||||
// indexMap["date"] = DateTool().dateToYMDHNSString("$value");
|
indexMap["date"] = "${time * 1000}";
|
||||||
|
|
||||||
indexMap["date"] = "${value * 1000}";
|
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
}
|
}
|
||||||
lockRecordUploadData(uploadList);
|
lockRecordUploadData(uploadList);
|
||||||
|
|||||||
@ -160,33 +160,39 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
var dataLength = reply.data[5];
|
int dataLength = (reply.data[5] << 8) + reply.data[6];
|
||||||
|
AppLog.log("dataLength:$dataLength");
|
||||||
if (dataLength > 0) {
|
if (dataLength > 0) {
|
||||||
reply.data.removeRange(0, 6);
|
reply.data.removeRange(0, 7);
|
||||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||||
var getList = splitList(reply.data, 8);
|
if(reply.data.length < 17){
|
||||||
if(reply.data.length < 8){
|
|
||||||
await BlueManage().disconnect();
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var getList = splitList(reply.data, 17);
|
||||||
|
// AppLog.log("getList:$getList");
|
||||||
var uploadList = [];
|
var uploadList = [];
|
||||||
for (int i = 0; i < getList.length; i++) {
|
for (int i = 0; i < getList.length; i++) {
|
||||||
var indexList = getList[i];
|
var indexList = getList[i];
|
||||||
|
// AppLog.log("indexList:$indexList");
|
||||||
var indexMap = {};
|
var indexMap = {};
|
||||||
indexMap["seq"] = indexList[0].toString();
|
indexMap["type"] = indexList[0].toString();
|
||||||
indexMap["user"] = indexList[3].toString();
|
|
||||||
indexMap["pwd"] = indexList[2].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["success"] = "1";
|
||||||
indexMap["type"] = indexList[1].toString();
|
|
||||||
|
|
||||||
int value = ((0xff & indexList[(4)]) << 24 |
|
int time = ((0xff & indexList[(3)]) << 24 |
|
||||||
(0xff & indexList[5]) << 16 |
|
(0xff & indexList[4]) << 16 |
|
||||||
(0xff & indexList[6]) << 8 |
|
(0xff & indexList[5]) << 8 |
|
||||||
(0xFF & indexList[7]));
|
(0xFF & indexList[6]));
|
||||||
// indexMap["date"] = DateTool().dateToYMDHNSString("$value");
|
indexMap["date"] = "${time * 1000}";
|
||||||
|
|
||||||
indexMap["date"] = "${value * 1000}";
|
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
}
|
}
|
||||||
lockRecordUploadData(uploadList);
|
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(
|
endWiddget.add(bottomItem(
|
||||||
'images/main/icon_lockDetail_videoLog.png',
|
'images/main/icon_lockDetail_videoLog.png',
|
||||||
|
|||||||
@ -100,6 +100,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
|||||||
//无权限
|
//无权限
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -289,6 +289,7 @@ class LockFeature {
|
|||||||
int? d3Face;
|
int? d3Face;
|
||||||
int? bluetoothRemoteControl;
|
int? bluetoothRemoteControl;
|
||||||
int? videoIntercom;
|
int? videoIntercom;
|
||||||
|
int? isSupportCatEye;
|
||||||
LockFeature(
|
LockFeature(
|
||||||
{this.password,
|
{this.password,
|
||||||
this.icCard,
|
this.icCard,
|
||||||
@ -298,7 +299,8 @@ class LockFeature {
|
|||||||
this.isSupportIris,
|
this.isSupportIris,
|
||||||
this.d3Face,
|
this.d3Face,
|
||||||
this.bluetoothRemoteControl,
|
this.bluetoothRemoteControl,
|
||||||
this.videoIntercom});
|
this.videoIntercom,
|
||||||
|
this.isSupportCatEye});
|
||||||
|
|
||||||
LockFeature.fromJson(Map<String, dynamic> json) {
|
LockFeature.fromJson(Map<String, dynamic> json) {
|
||||||
password = json['password'];
|
password = json['password'];
|
||||||
@ -310,6 +312,7 @@ class LockFeature {
|
|||||||
d3Face = json['d3Face'];
|
d3Face = json['d3Face'];
|
||||||
bluetoothRemoteControl = json['bluetoothRemoteControl'];
|
bluetoothRemoteControl = json['bluetoothRemoteControl'];
|
||||||
videoIntercom = json['videoIntercom'];
|
videoIntercom = json['videoIntercom'];
|
||||||
|
isSupportCatEye = json['isSupportCatEye'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -323,6 +326,7 @@ class LockFeature {
|
|||||||
data['d3Face'] = d3Face;
|
data['d3Face'] = d3Face;
|
||||||
data['bluetoothRemoteControl'] = bluetoothRemoteControl;
|
data['bluetoothRemoteControl'] = bluetoothRemoteControl;
|
||||||
data['videoIntercom'] = videoIntercom;
|
data['videoIntercom'] = videoIntercom;
|
||||||
|
data['isSupportCatEye'] = isSupportCatEye;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,16 +86,9 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
token: token,
|
token: token,
|
||||||
isBeforeAddUser: true);
|
isBeforeAddUser: true);
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
|
||||||
//无权限
|
|
||||||
dismissEasyLoading();
|
|
||||||
break;
|
|
||||||
case 0x09:
|
|
||||||
// 权限校验错误
|
|
||||||
dismissEasyLoading();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -112,7 +105,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
dismissEasyLoading();
|
state.sureBtnState.value = 0;
|
||||||
addLockAdminPassword(true);
|
addLockAdminPassword(true);
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
@ -138,6 +131,8 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
token: token);
|
token: token);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
dismissEasyLoading();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,10 +181,15 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
// 添加用户
|
// 添加用户
|
||||||
Future<void> addUserConnectBlue() async {
|
Future<void> addUserConnectBlue() async {
|
||||||
// 进来之后首先连接
|
// 进来之后首先连接
|
||||||
showEasyLoading();
|
if(state.sureBtnState.value == 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showTitleEasyLoading("添加锁进行中 1/2");
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.saveBtnIsUsable.value = true;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
@ -226,7 +226,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.saveBtnIsUsable.value = true;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
if(state.ifCurrentScreen.value == true){
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
@ -240,6 +240,8 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
var number = rng.nextInt(900000) + 100000; // 生成 100000 到 999999 之间的随机整数
|
var number = rng.nextInt(900000) + 100000; // 生成 100000 到 999999 之间的随机整数
|
||||||
state.adminPassword = number.toString();
|
state.adminPassword = number.toString();
|
||||||
state.adminPasswordTF.text = number.toString();
|
state.adminPasswordTF.text = number.toString();
|
||||||
|
|
||||||
|
showTitleEasyLoading("添加锁进行中 2/2");
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
@ -264,6 +266,12 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, isAddEquipment: true);
|
}, isAddEquipment: true);
|
||||||
}
|
}
|
||||||
@ -350,12 +358,14 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockId = entity.data!.lockId!;
|
state.lockId = entity.data!.lockId!;
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
// eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
senderCustomPasswords();
|
await senderCustomPasswords();
|
||||||
|
|
||||||
// BlueManage().disconnect(BlueManage().connectDeviceMacAddress);
|
// BlueManage().disconnect(BlueManage().connectDeviceMacAddress);
|
||||||
// eventBus.fire(RefreshLockListInfoDataEvent());
|
// eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
// Get.close(state.isFromMap == 1 ? 5 : 6);
|
// Get.close(state.isFromMap == 1 ? 5 : 6);
|
||||||
|
}else{
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +379,8 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
// if(isAddLockAdminPassword == true){
|
// if(isAddLockAdminPassword == true){
|
||||||
// showDeletPasswordAlertDialog();
|
// showDeletPasswordAlertDialog();
|
||||||
// }else{
|
// }else{
|
||||||
backAction();
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
|
backAction();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,9 +109,6 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
|||||||
bottom: 25.w
|
bottom: 25.w
|
||||||
),
|
),
|
||||||
onClick: (){
|
onClick: (){
|
||||||
if(state.saveBtnIsUsable.value == false){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
logic.addUserConnectBlue();
|
logic.addUserConnectBlue();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -153,8 +150,10 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
|||||||
super.didPop();
|
super.didPop();
|
||||||
|
|
||||||
BlueManage().stopScan();
|
BlueManage().stopScan();
|
||||||
|
logic.dismissEasyLoading();
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 从下级返回 当前界面即将出现
|
/// 从下级返回 当前界面即将出现
|
||||||
@ -170,6 +169,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
|||||||
void didPushNext() {
|
void didPushNext() {
|
||||||
super.didPushNext();
|
super.didPushNext();
|
||||||
|
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ class SaveLockState {
|
|||||||
var isFromMap = 0; // 0:不是从地图界面进入 1:从地图界面进入
|
var isFromMap = 0; // 0:不是从地图界面进入 1:从地图界面进入
|
||||||
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
var saveBtnIsUsable = true.obs; // 保存按钮是否可用
|
var sureBtnState = 0.obs;// 0可点击 1 不可点击
|
||||||
|
|
||||||
// 管理员密码
|
// 管理员密码
|
||||||
var adminPasswordTF = TextEditingController();
|
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';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
|
|
||||||
FutureOr<Request> requestLogInterceptor(Request request) async {
|
FutureOr<Request> requestLogInterceptor(Request request) async {
|
||||||
AppLog.log('GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
|
// AppLog.log('GET HTTP REQUEST \n${request.url} \n${request.headers} ${request.toString()} ');
|
||||||
AppLog.log(request.headers.toString());
|
// AppLog.log(request.headers.toString());
|
||||||
return request;
|
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';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
|
|
||||||
FutureOr<dynamic> responseLogInterceptor(Request request, Response response) {
|
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);
|
EasyLoading.dismiss(animation: true);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user