Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
73ffd5a221
@ -77,10 +77,10 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
||||||
startDate: state.fingerprintItemData.value.startDate!~/1000,
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
endDate: state.fingerprintItemData.value.endDate!~/1000,
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()),
|
startTime:"0",
|
||||||
endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()),
|
endTime:"0",
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -124,10 +124,10 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
||||||
startDate: state.fingerprintItemData.value.startDate!~/1000,
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
endDate: state.fingerprintItemData.value.endDate!~/1000,
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()),
|
startTime:"0",
|
||||||
endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()),
|
endTime:"0",
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -178,10 +178,10 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
||||||
startDate: state.fingerprintItemData.value.startDate!~/1000,
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
endDate: state.fingerprintItemData.value.endDate!~/1000,
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()),
|
startTime:"0",
|
||||||
endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()),
|
endTime:"0",
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -228,10 +228,10 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
||||||
startDate: state.fingerprintItemData.value.startDate!~/1000,
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
endDate: state.fingerprintItemData.value.endDate!~/1000,
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()),
|
startTime:"0",
|
||||||
endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()),
|
endTime:"0",
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -279,10 +279,10 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
||||||
startDate: state.fingerprintItemData.value.startDate!~/1000,
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
endDate: state.fingerprintItemData.value.endDate!~/1000,
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()),
|
startTime:"0",
|
||||||
endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()),
|
endTime:"0",
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -331,10 +331,10 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
isRound:0, // 是否是循环
|
isRound:0, // 是否是循环
|
||||||
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.fingerprintItemData.value.weekDay!), // 周循环
|
||||||
startDate: state.fingerprintItemData.value.startDate!~/1000,
|
startDate: state.beginTimeTimestamp.value~/1000,
|
||||||
endDate: state.fingerprintItemData.value.endDate!~/1000,
|
endDate: state.endTimeTimestamp.value~/1000,
|
||||||
startTime:DateTool().dateToHNString(state.fingerprintItemData.value.startDate!.toString()),
|
startTime:"0",
|
||||||
endTime:DateTool().dateToHNString(state.fingerprintItemData.value.endDate!.toString()),
|
endTime:"0",
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:signKeyDataList,
|
signKey:signKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -357,9 +357,9 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.fingerprintItemData.value.weekDay!,
|
weekDay: state.fingerprintItemData.value.weekDay!,
|
||||||
startDate: DateTool().dateToTimestamp(state.beginTime.value, 1).toString(),
|
startDate: state.beginTimeTimestamp.value.toString(),
|
||||||
endDate: DateTool().dateToTimestamp(state.endTime.value, 1).toString(),
|
endDate: state.endTimeTimestamp.value.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced.toString(),
|
||||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
startTime: 0,
|
startTime: 0,
|
||||||
@ -370,8 +370,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
showToast("修改成功".tr, something: (){
|
showToast("修改成功".tr, something: (){
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"beginTimeTimestamp":DateTool().dateToTimestamp(state.beginTime.value, 1).toString(),
|
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||||
"endTimeTimestamp":DateTool().dateToTimestamp(state.endTime.value, 1).toString(),
|
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -383,9 +383,9 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.fingerprintItemData.value.weekDay!,
|
weekDay: state.fingerprintItemData.value.weekDay!,
|
||||||
startDate: DateTool().dateToTimestamp(state.beginTime.value, 1).toString(),
|
startDate: state.beginTimeTimestamp.value.toString(),
|
||||||
endDate: DateTool().dateToTimestamp(state.endTime.value, 1).toString(),
|
endDate: state.endTimeTimestamp.value.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced.toString(),
|
||||||
cardName: state.fingerprintItemData.value.cardName!,
|
cardName: state.fingerprintItemData.value.cardName!,
|
||||||
changeType: '1',
|
changeType: '1',
|
||||||
startTime: 0,
|
startTime: 0,
|
||||||
@ -395,8 +395,8 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功".tr, something: (){
|
showToast("修改成功".tr, something: (){
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"beginTimeTimestamp":DateTool().dateToTimestamp(state.beginTime.value, 1).toString(),
|
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||||
"endTimeTimestamp":DateTool().dateToTimestamp(state.endTime.value, 1).toString(),
|
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||||
});
|
});
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
@ -408,22 +408,27 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
var entity = await ApiRepository.to.updateFaceValidity(
|
var entity = await ApiRepository.to.updateFaceValidity(
|
||||||
lockId: state.fingerprintItemData.value.lockId!,
|
lockId: state.fingerprintItemData.value.lockId!,
|
||||||
faceId: state.fingerprintItemData.value.faceId!,
|
faceId: state.fingerprintItemData.value.faceId!,
|
||||||
startDate: DateTool().dateToTimestamp(state.beginTime.value, 1),
|
startDate: state.beginTimeTimestamp.value,
|
||||||
endDate: DateTool().dateToTimestamp(state.endTime.value, 1),
|
endDate: state.endTimeTimestamp.value,
|
||||||
startTime: 0,
|
startTime: 0,
|
||||||
endTime: 0,
|
endTime: 0,
|
||||||
faceType: 2,
|
faceType: 2,
|
||||||
weekDay: state.fingerprintItemData.value.weekDay!,
|
weekDay: state.fingerprintItemData.value.weekDay!,
|
||||||
faceName: state.fingerprintItemData.value.faceName!,
|
faceName: state.fingerprintItemData.value.faceName!,
|
||||||
addType: "1",
|
addType: "1",
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? 2 : 1,
|
isCoerced: state.fingerprintItemData.value.isCoerced!,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("修改成功", something: () {
|
showToast("修改成功", something: () {
|
||||||
Get.back(result: "addScuess");
|
Get.back(result: {
|
||||||
|
"beginTimeTimestamp":state.beginTimeTimestamp.value.toString(),
|
||||||
|
"endTimeTimestamp":state.endTimeTimestamp.value.toString(),
|
||||||
|
});
|
||||||
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -42,14 +44,14 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
state.beginTimeTimestamp.value = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
if (state.beginTimeTimestamp.value > state.endTimeTimestamp.value || state.beginTimeTimestamp.value == state.endTimeTimestamp.value) {
|
||||||
logic.showToast("失效时间需大于生效时间".tr);
|
logic.showToast("失效时间需大于生效时间".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
if (state.endTimeTimestamp.value < DateTime.now().millisecondsSinceEpoch) {
|
||||||
logic.showToast("生效时间需大于当前时间".tr);
|
logic.showToast("生效时间需大于当前时间".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -63,6 +65,10 @@ class _OtherTypeKeyChangeDatePageState extends State<OtherTypeKeyChangeDatePage>
|
|||||||
logic.senderAddFingerprint();
|
logic.senderAddFingerprint();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
// 遥控
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
// 人脸
|
// 人脸
|
||||||
logic.senderAddFace();
|
logic.senderAddFace();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -8,6 +8,8 @@ class OtherTypeKeyChangeDateState{
|
|||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
var beginTime = "".obs;// 开始时间
|
||||||
var endTime = "".obs;// 结束时间
|
var endTime = "".obs;// 结束时间
|
||||||
|
var beginTimeTimestamp = 0.obs;// 开始时间
|
||||||
|
var endTimeTimestamp = 0.obs;// 结束时间
|
||||||
|
|
||||||
var pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸
|
var pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
@ -26,9 +28,13 @@ class OtherTypeKeyChangeDateState{
|
|||||||
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
if(fingerprintItemData.value.startDate == 0 && fingerprintItemData.value.endDate == 0){
|
||||||
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
beginTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||||
endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
endTime.value = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString());
|
||||||
|
beginTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
endTimeTimestamp.value = DateTime.now().millisecondsSinceEpoch;
|
||||||
}else{
|
}else{
|
||||||
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
beginTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.startDate.toString());
|
||||||
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
endTime.value = DateTool().dateToYMDHNString(fingerprintItemData.value.endDate.toString());
|
||||||
|
beginTimeTimestamp.value = fingerprintItemData.value.startDate!;
|
||||||
|
endTimeTimestamp.value = fingerprintItemData.value.endDate!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,52 +1,381 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/blue/io_type.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addFace.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_addICCardWithTimeCycleCoercion.dart';
|
||||||
|
import '../../../../blue/io_reply.dart';
|
||||||
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
|
import '../../../../blue/sender_manage.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import 'otherTypeKeyChangeValidityDate_state.dart';
|
import 'otherTypeKeyChangeValidityDate_state.dart';
|
||||||
|
|
||||||
class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
||||||
OtherTypeKeyChangeValidityDateState state = OtherTypeKeyChangeValidityDateState();
|
OtherTypeKeyChangeValidityDateState state = OtherTypeKeyChangeValidityDateState();
|
||||||
|
|
||||||
|
// 监听设备返回的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
|
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddICCardBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加指纹开始(此处用作修改或者删除指纹)
|
||||||
|
if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddFingerprintBegin(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加人脸开始(此处用作修改人脸)
|
||||||
|
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
|
_replyAddFaceBegin(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加人脸开始
|
||||||
|
Future<void> _replyAddFaceBegin(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
print("status:$status");
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
Get.log("${reply.commandType!.typeValue} 删除人脸数据解析成功");
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editFaceData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
var token = reply.data.sublist(5, 9);
|
||||||
|
var saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
||||||
|
useCountLimit:0xff,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除/修改人脸信息
|
||||||
|
Future<void> senderAddFace() async {
|
||||||
|
if (state.sureBtnState.value == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFaceCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
faceNo:int.parse(state.fingerprintItemData.value.faceNumber!),
|
||||||
|
useCountLimit:0xff,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if (state.ifCurrentScreen.value == true) {
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片开始(此处用作删除卡片)
|
||||||
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editICCardData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
var token = reply.data.sublist(5, 9);
|
||||||
|
var saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
||||||
|
useCountLimit:0xff ,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
Get.log("${reply.commandType!.typeValue} 失败");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加指纹开始
|
||||||
|
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||||
|
int status = reply.data[2];
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
editFingerprintsData();
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
var token = reply.data.sublist(5, 9);
|
||||||
|
var saveStrList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!),
|
||||||
|
useCountLimit:0xff,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
Get.log("${reply.commandType!.typeValue} 失败");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除指纹
|
||||||
|
Future<void> senderAddFingerprint() async {
|
||||||
|
if(state.sureBtnState.value == 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: (){
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
fingerNo:int.parse(state.fingerprintItemData.value.fingerprintNumber!),
|
||||||
|
useCountLimit:0xff,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加卡片
|
||||||
|
Future<void> senderAddICCard() async {
|
||||||
|
if(state.sureBtnState.value == 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: (){
|
||||||
|
dismissEasyLoading();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
});
|
||||||
|
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
|
keyID:state.fingerprintItemData.value.cardId!.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
cardNo:int.parse(state.fingerprintItemData.value.cardNumber!),
|
||||||
|
useCountLimit:0xff ,
|
||||||
|
isForce:state.fingerprintItemData.value.isCoerced, // 是否是胁迫
|
||||||
|
isRound:1, // 是否是循环
|
||||||
|
weekRound:DateTool().accordingTheCycleIntoTheCorrespondingNumber(state.weekDay.value), // 周循环
|
||||||
|
startDate: state.starDateTimestamp.value~/1000,
|
||||||
|
endDate: state.endDateTimestamp.value~/1000,
|
||||||
|
startTime:DateTool().dateToHNString(state.starTimeTimestamp.value.toString()),
|
||||||
|
endTime:DateTool().dateToHNString(state.endTimeTimestamp.value.toString()),
|
||||||
|
needAuthor:1,
|
||||||
|
signKey:signKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
state.sureBtnState.value = 0;
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 修改指纹信息
|
// 修改指纹信息
|
||||||
void editFingerprintsData() async{
|
void editFingerprintsData() async{
|
||||||
var starDateTimestamp = DateTool().dateToTimestamp(state.starDate.value, 1);
|
|
||||||
var endDateTimestamp = DateTool().dateToTimestamp(state.endDate.value, 1);
|
|
||||||
var starTimeTimestamp = DateTool().dateToTimestamp(state.starTime.value, 0);
|
|
||||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
|
||||||
|
|
||||||
if (starDateTimestamp >= endDateTimestamp) {
|
|
||||||
showToast("失效日期要大于生效日期".tr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (starTimeTimestamp >= endTimeTimestamp) {
|
|
||||||
showToast("失效时间要大于生效时间".tr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var entity = await ApiRepository.to.editFingerprintsData(
|
var entity = await ApiRepository.to.editFingerprintsData(
|
||||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: starDateTimestamp.toString(),
|
startDate: state.starDateTimestamp.value.toString(),
|
||||||
endDate: endDateTimestamp.toString(),
|
endDate: state.endDateTimestamp.value.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced.toString(),
|
||||||
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
fingerprintName: state.fingerprintItemData.value.fingerprintName!,
|
||||||
changeType: "1",
|
changeType: "1",
|
||||||
startTime: starTimeTimestamp,
|
startTime: state.starTimeTimestamp.value,
|
||||||
endTime: endTimeTimestamp,
|
endTime: state.endTimeTimestamp.value,
|
||||||
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
fingerprintType: state.fingerprintItemData.value.fingerprintType!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功".tr, something: (){
|
showToast("修改成功".tr, something: (){
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"starDate":starDateTimestamp.toString(),
|
"starDate":state.starDateTimestamp.value.toString(),
|
||||||
"endDate":endDateTimestamp.toString(),
|
"endDate":state.endDateTimestamp.value.toString(),
|
||||||
"starTime":starTimeTimestamp.toString(),
|
"starTime":state.starTimeTimestamp.value.toString(),
|
||||||
"endTime":endTimeTimestamp.toString(),
|
"endTime":state.endTimeTimestamp.value.toString(),
|
||||||
"validityValue":state.weekDay.value,
|
"validityValue":state.weekDay.value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -55,45 +384,82 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 编辑iC卡
|
// 编辑iC卡
|
||||||
void editICCardData() async{
|
void editICCardData() async{
|
||||||
var starDateTimestamp = DateTool().dateToTimestamp(state.starDate.value, 1);
|
|
||||||
var endDateTimestamp = DateTool().dateToTimestamp(state.endDate.value, 1);
|
|
||||||
var starTimeTimestamp = DateTool().dateToTimestamp(state.starTime.value, 0);
|
|
||||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
|
||||||
|
|
||||||
if (starDateTimestamp >= endDateTimestamp) {
|
|
||||||
showToast("失效日期要大于生效日期".tr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (starTimeTimestamp >= endTimeTimestamp) {
|
|
||||||
showToast("失效时间要大于生效时间".tr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var entity = await ApiRepository.to.editICCardData(
|
var entity = await ApiRepository.to.editICCardData(
|
||||||
cardId: state.fingerprintItemData.value.cardId.toString(),
|
cardId: state.fingerprintItemData.value.cardId.toString(),
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
weekDay: state.weekDay.value,
|
weekDay: state.weekDay.value,
|
||||||
startDate: starDateTimestamp.toString(),
|
startDate: state.starDateTimestamp.value.toString(),
|
||||||
endDate: endDateTimestamp.toString(),
|
endDate: state.endDateTimestamp.value.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced!.toString(),
|
||||||
cardName: state.fingerprintItemData.value.cardName!,
|
cardName: state.fingerprintItemData.value.cardName!,
|
||||||
changeType: '1',
|
changeType: '1',
|
||||||
startTime: starTimeTimestamp,
|
startTime: state.starTimeTimestamp.value,
|
||||||
endTime: endTimeTimestamp,
|
endTime: state.endTimeTimestamp.value,
|
||||||
cardType: state.fingerprintItemData.value.cardType!,
|
cardType: state.fingerprintItemData.value.cardType!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功".tr, something: (){
|
showToast("修改成功".tr, something: (){
|
||||||
eventBus.fire(OtherTypeRefreshListEvent());
|
eventBus.fire(OtherTypeRefreshListEvent());
|
||||||
Get.back(result: {
|
Get.back(result: {
|
||||||
"starDate":starDateTimestamp.toString(),
|
"starDate":state.starDateTimestamp.value.toString(),
|
||||||
"endDate":endDateTimestamp.toString(),
|
"endDate":state.endDateTimestamp.value.toString(),
|
||||||
"starTime":starTimeTimestamp.toString(),
|
"starTime":state.starTimeTimestamp.value.toString(),
|
||||||
"endTime":endTimeTimestamp.toString(),
|
"endTime":state.endTimeTimestamp.value.toString(),
|
||||||
"validityValue":state.weekDay.value,
|
"validityValue":state.weekDay.value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改人脸有效期
|
||||||
|
void editFaceData() async {
|
||||||
|
var entity = await ApiRepository.to.updateFaceValidity(
|
||||||
|
lockId: state.fingerprintItemData.value.lockId!,
|
||||||
|
faceId: state.fingerprintItemData.value.faceId!,
|
||||||
|
startDate: state.starDateTimestamp.value,
|
||||||
|
endDate: state.endDateTimestamp.value,
|
||||||
|
startTime: state.starTimeTimestamp.value,
|
||||||
|
endTime: state.endTimeTimestamp.value,
|
||||||
|
faceType: 2,
|
||||||
|
weekDay: state.weekDay.value,
|
||||||
|
faceName: state.fingerprintItemData.value.faceName!,
|
||||||
|
addType: "1",
|
||||||
|
isCoerced: state.fingerprintItemData.value.isCoerced!,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast("修改成功", something: () {
|
||||||
|
Get.back(result: {
|
||||||
|
"starDate":state.starDateTimestamp.value.toString(),
|
||||||
|
"endDate":state.endDateTimestamp.value.toString(),
|
||||||
|
"starTime":state.starTimeTimestamp.value.toString(),
|
||||||
|
"endTime":state.endTimeTimestamp.value.toString(),
|
||||||
|
"validityValue":state.weekDay.value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// TODO: implement onInit
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -44,10 +44,40 @@ class _OtherTypeKeyChangeValidityDatePageState extends State<OtherTypeKeyChangeV
|
|||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (state.pushType.value == 0) {
|
state.starDateTimestamp.value = DateTool().dateToTimestamp(state.starDate.value, 1);
|
||||||
logic.editICCardData();
|
state.endDateTimestamp.value = DateTool().dateToTimestamp(state.endDate.value, 1);
|
||||||
} else if (state.pushType.value == 1) {
|
state.starTimeTimestamp.value = DateTool().dateToTimestamp(state.starTime.value, 0);
|
||||||
logic.editFingerprintsData();
|
state.endTimeTimestamp.value = DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||||
|
|
||||||
|
if (state.starDateTimestamp.value >= state.endDateTimestamp.value) {
|
||||||
|
logic.showToast("失效日期要大于生效日期".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.starTimeTimestamp.value >= state.endTimeTimestamp.value) {
|
||||||
|
logic.showToast("失效时间要大于生效时间".tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (state.pushType.value) {
|
||||||
|
case 0:
|
||||||
|
// 卡
|
||||||
|
logic.senderAddICCard();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// 指纹
|
||||||
|
logic.senderAddFingerprint();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 遥控
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 人脸
|
||||||
|
logic.senderAddFace();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -12,8 +12,15 @@ class OtherTypeKeyChangeValidityDateState{
|
|||||||
var starTime = "".obs;// 生效时间
|
var starTime = "".obs;// 生效时间
|
||||||
var endTime = "".obs;// 失效时间
|
var endTime = "".obs;// 失效时间
|
||||||
|
|
||||||
var pushType = 0.obs;// 0卡 1指纹 2遥控
|
var starDateTimestamp = 0.obs;// 开始时间
|
||||||
|
var endDateTimestamp = 0.obs;// 结束时间
|
||||||
|
var starTimeTimestamp = 0.obs;// 生效时间
|
||||||
|
var endTimeTimestamp = 0.obs;// 失效时间
|
||||||
|
|
||||||
|
var pushType = 0.obs;// 0卡 1指纹 2遥控 3人脸
|
||||||
var weekDay = [].obs;
|
var weekDay = [].obs;
|
||||||
|
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
|
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||||
|
|
||||||
OtherTypeKeyChangeValidityDateState() {
|
OtherTypeKeyChangeValidityDateState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
|
|||||||
@ -7,14 +7,10 @@ import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_logic.dart'
|
|||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
|
||||||
import '../../../../tools/appRouteObserver.dart';
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
|
||||||
import '../../../../tools/showTFView.dart';
|
|
||||||
import '../../../../tools/showTipView.dart';
|
import '../../../../tools/showTipView.dart';
|
||||||
import '../../../../tools/storage.dart';
|
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
@ -100,7 +96,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
|||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(
|
||||||
Routers.otherTypeKeyChangeValidityDatePage,
|
Routers.otherTypeKeyChangeValidityDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"pushType": 0,
|
"pushType": 3,
|
||||||
"fingerprintItemData": state.faceItemData.value,
|
"fingerprintItemData": state.faceItemData.value,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
|
|||||||
@ -160,6 +160,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
|||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||||
rightTitle: state.adder.value,
|
rightTitle: state.adder.value,
|
||||||
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
|
|
||||||
})),
|
})),
|
||||||
|
|||||||
@ -360,21 +360,6 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
});
|
});
|
||||||
|
|
||||||
// var listData = AddUserCommand(
|
|
||||||
// lockID: BlueManage().connectDeviceName,
|
|
||||||
// authUserID: state.senderUserId.toString(),
|
|
||||||
// keyID: state.keyInfos.value.keyId.toString(),
|
|
||||||
// userID: await Storage.getUid(),
|
|
||||||
// openMode: 1,
|
|
||||||
// keyType: 0,
|
|
||||||
// startDate: state.keyInfos.value.startDate!~/10000,
|
|
||||||
// expireDate: state.keyInfos.value.endDate!~/10000,
|
|
||||||
// role: state.keyInfos.value.keyRight == 1 ? 1 : 0,
|
|
||||||
// password: "123456",
|
|
||||||
// needAuthor: 1,
|
|
||||||
// publicKey: publicKeyDataList,
|
|
||||||
// privateKey: getPrivateKeyList,
|
|
||||||
// token: getTokenList).packageData();
|
|
||||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// 私钥
|
// 私钥
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import '../../../blue/blue_manage.dart';
|
|||||||
import '../../../blue/io_tool/io_tool.dart';
|
import '../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
|
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import '../../../tools/appRouteObserver.dart';
|
import '../../../tools/appRouteObserver.dart';
|
||||||
|
import '../../../tools/commonDataManage.dart';
|
||||||
import '../../../tools/dateTool.dart';
|
import '../../../tools/dateTool.dart';
|
||||||
import '../../../tools/eventBusEventManage.dart';
|
import '../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
@ -85,6 +86,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
void loadData() {
|
void loadData() {
|
||||||
state.keyInfos.value = widget.lockListInfoItemEntity;
|
state.keyInfos.value = widget.lockListInfoItemEntity;
|
||||||
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
||||||
|
CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!;;
|
||||||
|
|
||||||
if (state.lockUserNo == 0) {
|
if (state.lockUserNo == 0) {
|
||||||
state.bottomBtnisEable.value = false;
|
state.bottomBtnisEable.value = false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user