完善电子钥匙、卡、指纹bug
This commit is contained in:
parent
fc36496830
commit
45f7851ca2
@ -102,12 +102,12 @@ class SenderAddStressFingerprintCommand extends SenderProtocol {
|
|||||||
} else {
|
} else {
|
||||||
List<int> authCodeData = [];
|
List<int> authCodeData = [];
|
||||||
|
|
||||||
//authUserID
|
|
||||||
authCodeData.addAll(utf8.encode(userID!));
|
|
||||||
|
|
||||||
//KeyID
|
//KeyID
|
||||||
authCodeData.addAll(utf8.encode(keyID!));
|
authCodeData.addAll(utf8.encode(keyID!));
|
||||||
|
|
||||||
|
//authUserID
|
||||||
|
authCodeData.addAll(utf8.encode(userID!));
|
||||||
|
|
||||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||||
authCodeData.addAll(token!);
|
authCodeData.addAll(token!);
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ class SenderAddStressICCardCommand extends SenderProtocol {
|
|||||||
int? needAuthor;
|
int? needAuthor;
|
||||||
List<int>? publicKey;
|
List<int>? publicKey;
|
||||||
List<int>? privateKey;
|
List<int>? privateKey;
|
||||||
|
List<int>? signKey;
|
||||||
|
|
||||||
SenderAddStressICCardCommand({
|
SenderAddStressICCardCommand({
|
||||||
this.keyID,
|
this.keyID,
|
||||||
@ -39,6 +40,7 @@ class SenderAddStressICCardCommand extends SenderProtocol {
|
|||||||
this.needAuthor,
|
this.needAuthor,
|
||||||
this.publicKey,
|
this.publicKey,
|
||||||
this.privateKey,
|
this.privateKey,
|
||||||
|
this.signKey
|
||||||
}) : super(CommandType.generalExtendedCommond);
|
}) : super(CommandType.generalExtendedCommond);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -100,16 +102,16 @@ class SenderAddStressICCardCommand extends SenderProtocol {
|
|||||||
} else {
|
} else {
|
||||||
List<int> authCodeData = [];
|
List<int> authCodeData = [];
|
||||||
|
|
||||||
//authUserID
|
|
||||||
authCodeData.addAll(utf8.encode(userID!));
|
|
||||||
|
|
||||||
//KeyID
|
//KeyID
|
||||||
authCodeData.addAll(utf8.encode(keyID!));
|
authCodeData.addAll(utf8.encode(keyID!));
|
||||||
|
|
||||||
|
//authUserID
|
||||||
|
authCodeData.addAll(utf8.encode(userID!));
|
||||||
|
|
||||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||||
authCodeData.addAll(token!);
|
authCodeData.addAll(token!);
|
||||||
|
|
||||||
authCodeData.addAll(publicKey!);
|
authCodeData.addAll(signKey!);
|
||||||
|
|
||||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||||
|
|
||||||
|
|||||||
@ -584,6 +584,7 @@ class IoSenderManage {
|
|||||||
required int? needAuthor,
|
required int? needAuthor,
|
||||||
required List<int>? publicKey,
|
required List<int>? publicKey,
|
||||||
required List<int>? privateKey,
|
required List<int>? privateKey,
|
||||||
|
required List<int>? signKey,
|
||||||
CommandSendCallBack? callBack}) {
|
CommandSendCallBack? callBack}) {
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: SenderAddStressICCardCommand(
|
command: SenderAddStressICCardCommand(
|
||||||
@ -598,6 +599,7 @@ class IoSenderManage {
|
|||||||
needAuthor: needAuthor,
|
needAuthor: needAuthor,
|
||||||
publicKey: publicKey,
|
publicKey: publicKey,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
|
signKey: signKey
|
||||||
), callBack:callBack);
|
), callBack:callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,8 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
var endDate = "";
|
var endDate = "";
|
||||||
if (state.seletType.value == "0") {
|
if (state.seletType.value == "0") {
|
||||||
fingerprintType = 1;
|
fingerprintType = 1;
|
||||||
|
startDate = "0";
|
||||||
|
endDate = "0";
|
||||||
} else if (state.seletType.value == "1") {
|
} else if (state.seletType.value == "1") {
|
||||||
fingerprintType = 2;
|
fingerprintType = 2;
|
||||||
if (state.beginTimeTimestamp.value.isEmpty) {
|
if (state.beginTimeTimestamp.value.isEmpty) {
|
||||||
@ -78,7 +80,7 @@ class AddCardTypeLogic extends BaseGetXController{
|
|||||||
"endDate": endDate,
|
"endDate": endDate,
|
||||||
"addType": "1",
|
"addType": "1",
|
||||||
"cardName": state.nameController.text,
|
"cardName": state.nameController.text,
|
||||||
"cardNumber": (Random().nextInt(100000000) + 10000000).floor().toString(),
|
"cardNumber": "123456",
|
||||||
"cardType": fingerprintType.toString(),
|
"cardType": fingerprintType.toString(),
|
||||||
"isCoerced": isCoerced,
|
"isCoerced": isCoerced,
|
||||||
"startDate": startDate,
|
"startDate": startDate,
|
||||||
|
|||||||
@ -45,11 +45,6 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||||
var token = reply.data.sublist(5, 9);
|
|
||||||
var saveStrList = changeIntListToStringList(token);
|
|
||||||
print("_replyAddFingerprintReplyToken:$token");
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
print("_replyAddFingerprintStatus:$status");
|
print("_replyAddFingerprintStatus:$status");
|
||||||
|
|
||||||
@ -69,15 +64,20 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = reply.data.sublist(5, 9);
|
||||||
|
var saveStrList = changeIntListToStringList(token);
|
||||||
|
print("_replyAddFingerprintReplyToken:$token");
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderAddFingerprintCommand(
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
fingerNo:1,
|
fingerNo:1,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
startTime:0x11223344,
|
// startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
// endTime:0x11223344,
|
||||||
// startTime:int.parse(state.startDate.value)~/1000,
|
startTime:int.parse(state.startDate.value)~/1000,
|
||||||
// endTime:int.parse(state.endDate.value)~/1000,
|
endTime:int.parse(state.endDate.value)~/1000,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -103,11 +103,6 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||||
var token = reply.data.sublist(2, 6);
|
|
||||||
// var saveStrList = changeIntListToStringList(token);
|
|
||||||
// print("_replyAddICCardConfirmationReplyToken:$token");
|
|
||||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
print("_replyAddFingerprintstatus:$status");
|
print("_replyAddFingerprintstatus:$status");
|
||||||
|
|
||||||
@ -117,11 +112,11 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
// print("添加指纹确认成功,调用添加指纹接口");
|
// print("添加指纹确认成功,调用添加指纹接口");
|
||||||
if(state.isCoerced.value == "1"){
|
if(state.isCoerced.value == "1"){
|
||||||
// 非胁迫指纹
|
// 非胁迫
|
||||||
int addResultStatus = reply.data[5];
|
int addResultStatus = reply.data[5];
|
||||||
if(addResultStatus == 0){
|
if(addResultStatus == 0){
|
||||||
// 成功更新序列号
|
// 成功更新序列号
|
||||||
state.cardNumber.value = (reply.data[6]+1).toString();
|
state.cardNumber.value = (reply.data[6]).toString();
|
||||||
addICCardData();
|
addICCardData();
|
||||||
}else if(addResultStatus == 255){
|
}else if(addResultStatus == 255){
|
||||||
// 255 自动退出
|
// 255 自动退出
|
||||||
@ -155,10 +150,6 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _replyAddICStressCard(Reply reply) async {
|
Future<void> _replyAddICStressCard(Reply reply) async {
|
||||||
var token = reply.data.sublist(2, 6);
|
|
||||||
var saveStrList = changeIntListToStringList(token);
|
|
||||||
print("_replyAddICCardConfirmationReplyToken:$token");
|
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
|
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
print("_replyAddFingerprintstatus:$status");
|
print("_replyAddFingerprintstatus:$status");
|
||||||
@ -178,18 +169,29 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> getSignKeyList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
|
var token = reply.data.sublist(5, 9);
|
||||||
|
var saveStrList = changeIntListToStringList(token);
|
||||||
|
print("_replyAddICCardConfirmationReplyToken:$token");
|
||||||
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderAddStressICCardCommand(
|
IoSenderManage.senderAddStressICCardCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
icCardNo:1,
|
icCardNo:1,
|
||||||
cardType:1,
|
cardType:1,
|
||||||
useCountLimit:1,
|
useCountLimit:1,
|
||||||
startTime:0x11223344,
|
// startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
// endTime:0x11223344,
|
||||||
|
startTime:int.parse(state.startDate.value)~/1000,
|
||||||
|
endTime:int.parse(state.endDate.value)~/1000,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: token,
|
token: token,
|
||||||
|
signKey: getSignKeyList,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
@ -210,7 +212,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加卡片开始
|
// 添加卡片
|
||||||
Future<void> senderAddICCard() async {
|
Future<void> senderAddICCard() async {
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == DeviceConnectionState.connected){
|
if (deviceConnectionState == DeviceConnectionState.connected){
|
||||||
@ -229,8 +231,10 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
cardNo:1,
|
cardNo:1,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
startTime:0x11223344,
|
// startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
// endTime:0x11223344,
|
||||||
|
startTime:int.parse(state.startDate.value)~/1000,
|
||||||
|
endTime:int.parse(state.endDate.value)~/1000,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -250,6 +254,9 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
List<int> getSignKeyList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
print("openDoorTokenPubToken:$getTokenList");
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
@ -268,6 +275,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
|
signKey: getSignKeyList,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -54,13 +54,14 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
var token = await Storage.getStringList(saveBlueToken);
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
String? userID = await Storage.getUid();
|
||||||
IoSenderManage.senderAddICCardCommand(
|
IoSenderManage.senderAddICCardCommand(
|
||||||
keyID:"1",
|
keyID:state.keyId.value.toString(),
|
||||||
userID:"DeleteAll!@#",
|
userID:userID,
|
||||||
cardNo:255,
|
cardNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:0x11223344,
|
startTime:state.effectiveDateTime.value,
|
||||||
endTime:0x11223344,
|
endTime:state.failureDateTime.value,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -86,9 +87,9 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除卡片
|
// 删除卡片
|
||||||
Future<void> senderAddICCard(String keyId, String userID, int cardNo) async {
|
Future<void> senderAddICCard() async {
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||||
if (state == DeviceConnectionState.connected){
|
if (deviceConnectionState == DeviceConnectionState.connected){
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
@ -99,16 +100,14 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
print("openDoorTokenPubToken:$getTokenList");
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
|
String? userID = await Storage.getUid();
|
||||||
IoSenderManage.senderAddICCardCommand(
|
IoSenderManage.senderAddICCardCommand(
|
||||||
// keyID:"1",
|
keyID:state.keyId.value.toString(),
|
||||||
// userID:"DeleteAll!@#",
|
|
||||||
// cardNo:255,
|
|
||||||
keyID:keyId,
|
|
||||||
userID:userID,
|
userID:userID,
|
||||||
cardNo:cardNo,
|
cardNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:0x11223344,
|
startTime:state.effectiveDateTime.value,
|
||||||
endTime:0x11223344,
|
endTime:state.failureDateTime.value,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -128,6 +127,7 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
endDate: state.failureDateTime.value.toString(),
|
endDate: state.failureDateTime.value.toString(),
|
||||||
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
isCoerced: state.isStressFingerprint.value ? "2" : "1",
|
||||||
cardName: state.changeNameController.text,
|
cardName: state.changeNameController.text,
|
||||||
|
changeType: "1",
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Toast.show(msg: "修改成功");
|
Toast.show(msg: "修改成功");
|
||||||
|
|||||||
@ -349,7 +349,7 @@ class _CardDetailPageState extends State<CardDetailPage> {
|
|||||||
sureClick: () async {
|
sureClick: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
String? idStr = await Storage.getUid();
|
String? idStr = await Storage.getUid();
|
||||||
logic.senderAddICCard(state.fingerprintItemData.value.cardId.toString(), idStr ?? "", 0);
|
logic.senderAddICCard();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class CardDetailState{
|
|||||||
var weekDay = [].obs;// 有效日
|
var weekDay = [].obs;// 有效日
|
||||||
var adder = "".obs;// 添加者
|
var adder = "".obs;// 添加者
|
||||||
var addTime = 0.obs;// 添加时间
|
var addTime = 0.obs;// 添加时间
|
||||||
var keyId = 0.obs;// 添加时间
|
var keyId = 0.obs;// 卡id
|
||||||
|
|
||||||
final isStressFingerprint = false.obs;
|
final isStressFingerprint = false.obs;
|
||||||
CardDetailState() {
|
CardDetailState() {
|
||||||
@ -34,7 +34,7 @@ class CardDetailState{
|
|||||||
keyType.value = fingerprintItemData.value.cardType!;
|
keyType.value = fingerprintItemData.value.cardType!;
|
||||||
adder.value = fingerprintItemData.value.senderUsername!;
|
adder.value = fingerprintItemData.value.senderUsername!;
|
||||||
addTime.value = fingerprintItemData.value.createDate!;
|
addTime.value = fingerprintItemData.value.createDate!;
|
||||||
isStressFingerprint.value = fingerprintItemData.value.isCoerced! == 1 ? true : false;
|
isStressFingerprint.value = fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ class CardListLogic extends BaseGetXController {
|
|||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
|
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if((reply is SenderAddICCardReply) && (state.isDeletICCardData == true)) {
|
if((reply is SenderAddICCardReply) && (state.isDeletCardData == true)) {
|
||||||
_replyAddICCardBegin(reply);
|
_replyAddICCardBegin(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ class CardListLogic extends BaseGetXController {
|
|||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
state.isDeletICCardData = false;
|
state.isDeletCardData = false;
|
||||||
deletICCardData();
|
deletICCardData();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
@ -66,9 +66,9 @@ class CardListLogic extends BaseGetXController {
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddICCardCommand(
|
IoSenderManage.senderAddICCardCommand(
|
||||||
keyID:"1",
|
keyID:state.deletKeyID,
|
||||||
userID:"DeleteAll!@#",
|
userID:state.deletUserID,
|
||||||
cardNo:255,
|
cardNo:state.deletCardNo,
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
@ -259,9 +259,9 @@ class CardListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除卡片
|
// 删除卡片
|
||||||
Future<void> senderAddICCard(String keyId, String userID, int cardNo) async {
|
Future<void> senderAddICCard() async {
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||||
if (state == DeviceConnectionState.connected){
|
if (deviceConnectionState == DeviceConnectionState.connected){
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
@ -273,12 +273,9 @@ class CardListLogic extends BaseGetXController {
|
|||||||
print("openDoorTokenPubToken:$getTokenList");
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
IoSenderManage.senderAddICCardCommand(
|
IoSenderManage.senderAddICCardCommand(
|
||||||
// keyID:"1",
|
keyID:state.deletKeyID,
|
||||||
// userID:"DeleteAll!@#",
|
userID:state.deletUserID,
|
||||||
// cardNo:255,
|
cardNo:state.deletCardNo,
|
||||||
keyID:keyId,
|
|
||||||
userID:userID,
|
|
||||||
cardNo:cardNo,
|
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
@ -306,14 +303,27 @@ class CardListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 删除所有IC卡
|
// 删除所有IC卡
|
||||||
void deletICCardData() async{
|
void deletICCardData() async{
|
||||||
|
var cardId = "";
|
||||||
|
var type = "1";
|
||||||
|
if(state.isDeletAll == false){
|
||||||
|
cardId = state.deletKeyID;
|
||||||
|
type = "0";
|
||||||
|
}
|
||||||
|
print("delet fingerprintId $cardId");
|
||||||
var entity = await ApiRepository.to.deletIcCardData(
|
var entity = await ApiRepository.to.deletIcCardData(
|
||||||
cardId: "",
|
cardId: cardId,
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
type: "1",
|
type: type,
|
||||||
deleteType:"1"
|
deleteType:"1"
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Toast.show(msg: "重置成功");
|
if(state.isDeletAll == false){
|
||||||
|
Toast.show(msg: "删除成功");
|
||||||
|
}else{
|
||||||
|
Toast.show(msg: "重置成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
state.isDeletCardData = false;
|
||||||
getICCardListData();
|
getICCardListData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,27 +82,6 @@ class _CardListPageState extends State<CardListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getAppBarTitle(int type) {
|
|
||||||
String title = "";
|
|
||||||
switch (type) {
|
|
||||||
case 0:
|
|
||||||
title = TranslationLoader.lanKeys!.card!.tr;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
title = TranslationLoader.lanKeys!.fingerprint!.tr;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
title = TranslationLoader.lanKeys!.remoteControl!.tr;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
title = TranslationLoader.lanKeys!.face!.tr;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _searchWidget() {
|
Widget _searchWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
@ -157,7 +136,7 @@ class _CardListPageState extends State<CardListPage> {
|
|||||||
key: Key(fingerprintItemData.cardName!),
|
key: Key(fingerprintItemData.cardName!),
|
||||||
actionsWidth: 60,
|
actionsWidth: 60,
|
||||||
actions: [
|
actions: [
|
||||||
_buildDeleteBtn(fingerprintItemData.cardId.toString()),
|
_buildDeleteBtn(fingerprintItemData),
|
||||||
],
|
],
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||||
@ -190,11 +169,13 @@ class _CardListPageState extends State<CardListPage> {
|
|||||||
) : const NoData());
|
) : const NoData());
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDeleteBtn(String idStr) {
|
Widget _buildDeleteBtn(FingerprintItemData fingerprintItemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// 省略: 弹出是否删除的确认对话框。
|
// 省略: 弹出是否删除的确认对话框。
|
||||||
showIosTipViewDialog(context, idStr);
|
state.deletKeyID = fingerprintItemData.cardId.toString();
|
||||||
|
state.deletCardNo = int.parse(fingerprintItemData.cardNumber!);
|
||||||
|
showIosTipViewDialog(context);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 60,
|
width: 60,
|
||||||
@ -213,7 +194,7 @@ class _CardListPageState extends State<CardListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showIosTipViewDialog(BuildContext context, String keyId) {
|
void showIosTipViewDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -222,9 +203,10 @@ class _CardListPageState extends State<CardListPage> {
|
|||||||
tipTitle: "确定要删除吗?",
|
tipTitle: "确定要删除吗?",
|
||||||
sureClick: () async {
|
sureClick: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
String? idStr = await Storage.getUid();
|
state.isDeletCardData = true;
|
||||||
state.isDeletICCardData = true;
|
state.isDeletAll = false;
|
||||||
logic.senderAddICCard(keyId, idStr ?? "", 0);
|
state.deletUserID = (await Storage.getUid())!;
|
||||||
|
logic.senderAddICCard();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -306,8 +288,12 @@ class _CardListPageState extends State<CardListPage> {
|
|||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
state.isDeletICCardData = true;
|
state.isDeletCardData = true;
|
||||||
logic.senderAddICCard("1", "DeleteAll!@#", 255);
|
state.isDeletAll = true;
|
||||||
|
state.deletKeyID = "1";
|
||||||
|
state.deletUserID = "DeleteAll!@#";
|
||||||
|
state.deletCardNo = 255;
|
||||||
|
logic.senderAddICCard();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -6,8 +6,12 @@ import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
|||||||
class CardListState {
|
class CardListState {
|
||||||
final lockId = 0.obs;
|
final lockId = 0.obs;
|
||||||
|
|
||||||
var isDeletFingerprintData = false;
|
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
||||||
var isDeletICCardData = false;
|
var isDeletCardData = false;
|
||||||
|
var isDeletAll = false;
|
||||||
|
var deletKeyID = "";
|
||||||
|
var deletUserID = "DeleteAll!@#";
|
||||||
|
var deletCardNo = 0;
|
||||||
|
|
||||||
final fingerprintItemListData = <FingerprintItemData>[].obs;
|
final fingerprintItemListData = <FingerprintItemData>[].obs;
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
endDate: state.endTimeTimestamp.value.toString(),
|
endDate: state.endTimeTimestamp.value.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||||
cardName: state.fingerprintItemData.value.cardName!,
|
cardName: state.fingerprintItemData.value.cardName!,
|
||||||
|
changeType: '1',
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Toast.show(msg: "修改成功");
|
Toast.show(msg: "修改成功");
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
endDate: state.endTimeTimestamp.value.toString(),
|
endDate: state.endTimeTimestamp.value.toString(),
|
||||||
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
isCoerced: state.fingerprintItemData.value.isCoerced == 1 ? "2" : "1",
|
||||||
cardName: state.fingerprintItemData.value.cardName!,
|
cardName: state.fingerprintItemData.value.cardName!,
|
||||||
|
changeType: '1',
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Toast.show(msg: "修改成功");
|
Toast.show(msg: "修改成功");
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
//成功
|
//成功
|
||||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
state.ifConnectScuess.value = true;
|
state.ifConnectScuess.value = true;
|
||||||
state.fingerprintNumber.value = reply.data.last.toString();
|
// state.fingerprintNumber.value = reply.data.last.toString();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
@ -128,31 +128,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//需要权限
|
//需要权限
|
||||||
// var token = reply.data.sublist(5, 9);
|
|
||||||
// var saveStrList = changeIntListToStringList(token);
|
|
||||||
// print("_replyAddFingerprintReplyToken:$token");
|
|
||||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
//
|
|
||||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
//
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
//
|
|
||||||
// IoSenderManage.senderAddStressFingerprintCommand(
|
|
||||||
// keyID:"1",
|
|
||||||
// userID:await Storage.getUid(),
|
|
||||||
// fingerNo:1,
|
|
||||||
// useCountLimit:1,
|
|
||||||
// // startTime:0x11223344,
|
|
||||||
// // endTime:0x11223344,
|
|
||||||
// startTime:int.parse(state.startDate.value)~/1000,
|
|
||||||
// endTime:int.parse(state.endDate.value)~/1000,
|
|
||||||
// needAuthor:1,
|
|
||||||
// publicKey:publicKeyDataList,
|
|
||||||
// privateKey:getPrivateKeyList,
|
|
||||||
// token: token,
|
|
||||||
// );
|
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
|
|||||||
@ -8,7 +8,7 @@ class AddFingerprintState{
|
|||||||
final endDate = "".obs;
|
final endDate = "".obs;
|
||||||
final addType = "".obs;
|
final addType = "".obs;
|
||||||
final fingerprintName = "".obs;
|
final fingerprintName = "".obs;
|
||||||
final fingerprintNumber = "".obs;
|
// final fingerprintNumber = "".obs;
|
||||||
final fingerprintType = "".obs;
|
final fingerprintType = "".obs;
|
||||||
final isCoerced = "".obs;
|
final isCoerced = "".obs;
|
||||||
final startDate = "".obs;
|
final startDate = "".obs;
|
||||||
@ -21,7 +21,7 @@ class AddFingerprintState{
|
|||||||
endDate.value = map["endDate"];
|
endDate.value = map["endDate"];
|
||||||
addType.value = map["addType"];
|
addType.value = map["addType"];
|
||||||
fingerprintName.value = map["fingerprintName"];
|
fingerprintName.value = map["fingerprintName"];
|
||||||
fingerprintNumber.value = map["fingerprintNumber"];
|
// fingerprintNumber.value = map["fingerprintNumber"];
|
||||||
fingerprintType.value = map["fingerprintType"];
|
fingerprintType.value = map["fingerprintType"];
|
||||||
isCoerced.value = map["isCoerced"];
|
isCoerced.value = map["isCoerced"];
|
||||||
print("isCoerced.valueisCoerced.value:${isCoerced.value}");
|
print("isCoerced.valueisCoerced.value:${isCoerced.value}");
|
||||||
|
|||||||
@ -55,13 +55,14 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
var token = await Storage.getStringList(saveBlueToken);
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
|
String? userID = await Storage.getUid();
|
||||||
IoSenderManage.senderAddFingerprintCommand(
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
keyID:"1",
|
keyID:state.keyId.value.toString(),
|
||||||
userID:"DeleteAll!@#",
|
userID:userID,
|
||||||
fingerNo:255,
|
fingerNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:0x11223344,
|
startTime:state.effectiveDateTime.value,
|
||||||
endTime:0x11223344,
|
endTime:state.failureDateTime.value,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
@ -104,7 +105,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
IoSenderManage.senderAddFingerprintCommand(
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
keyID:state.keyId.value.toString(),
|
keyID:state.keyId.value.toString(),
|
||||||
userID:userID,
|
userID:userID,
|
||||||
fingerNo:1,
|
fingerNo:int.parse(state.typeNumber.value),
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:state.effectiveDateTime.value,
|
startTime:state.effectiveDateTime.value,
|
||||||
endTime:state.failureDateTime.value,
|
endTime:state.failureDateTime.value,
|
||||||
@ -117,6 +118,20 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除指纹
|
||||||
|
void deletFingerprintsData() async{
|
||||||
|
var entity = await ApiRepository.to.deletFingerprintsData(
|
||||||
|
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
||||||
|
lockId: state.fingerprintItemData.value.lockId.toString(),
|
||||||
|
type: "0",
|
||||||
|
deleteType:"1"
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
Toast.show(msg: "删除成功");
|
||||||
|
Get.back(result: "addScuess");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑指纹
|
// 编辑指纹
|
||||||
void editFingerprintsData() async{
|
void editFingerprintsData() async{
|
||||||
var entity = await ApiRepository.to.editFingerprintsData(
|
var entity = await ApiRepository.to.editFingerprintsData(
|
||||||
@ -135,20 +150,6 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除指纹
|
|
||||||
void deletFingerprintsData() async{
|
|
||||||
var entity = await ApiRepository.to.deletFingerprintsData(
|
|
||||||
fingerprintId: state.fingerprintItemData.value.fingerprintId.toString(),
|
|
||||||
lockId: state.fingerprintItemData.value.lockId.toString(),
|
|
||||||
type: "0",
|
|
||||||
deleteType:"1"
|
|
||||||
);
|
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
|
||||||
Toast.show(msg: "删除成功");
|
|
||||||
Get.back(result: "addScuess");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class FingerprintDetailState{
|
|||||||
var weekDay = [].obs;// 有效日
|
var weekDay = [].obs;// 有效日
|
||||||
var adder = "".obs;// 添加者
|
var adder = "".obs;// 添加者
|
||||||
var addTime = 0.obs;// 添加时间
|
var addTime = 0.obs;// 添加时间
|
||||||
var keyId = 0.obs;// 添加时间
|
var keyId = 0.obs;
|
||||||
|
|
||||||
final isStressFingerprint = false.obs;
|
final isStressFingerprint = false.obs;
|
||||||
FingerprintDetailState() {
|
FingerprintDetailState() {
|
||||||
|
|||||||
@ -67,9 +67,9 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddFingerprintCommand(
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
keyID:"1",
|
keyID:state.deletKeyID,
|
||||||
userID:"DeleteAll!@#",
|
userID:state.deletUserID,
|
||||||
fingerNo:255,
|
fingerNo:state.deletFingerNo,
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
@ -292,7 +292,7 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除指纹
|
// 删除指纹
|
||||||
Future<void> senderAddFingerprint(String keyId, String userID, int cardNo) async {
|
Future<void> senderAddFingerprint() async {
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == DeviceConnectionState.connected){
|
if (deviceConnectionState == DeviceConnectionState.connected){
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
@ -305,12 +305,9 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderAddFingerprintCommand(
|
IoSenderManage.senderAddFingerprintCommand(
|
||||||
// keyID:"1",
|
keyID:state.deletKeyID,
|
||||||
// userID:"DeleteAll!@#",
|
userID:state.deletUserID,
|
||||||
// fingerNo:255,
|
fingerNo:state.deletFingerNo,
|
||||||
keyID:keyId,
|
|
||||||
userID:userID,
|
|
||||||
fingerNo:cardNo,
|
|
||||||
useCountLimit:0,
|
useCountLimit:0,
|
||||||
startTime:0x11223344,
|
startTime:0x11223344,
|
||||||
endTime:0x11223344,
|
endTime:0x11223344,
|
||||||
@ -339,17 +336,25 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
// 重置所有的指纹
|
// 重置所有的指纹
|
||||||
void deletAllFingerprintsData() async{
|
void deletAllFingerprintsData() async{
|
||||||
var fingerprintId = "";
|
var fingerprintId = "";
|
||||||
|
var type = "1";
|
||||||
if(state.isDeletAll == false){
|
if(state.isDeletAll == false){
|
||||||
// fingerprintId =
|
fingerprintId = state.deletKeyID;
|
||||||
|
type = "0";
|
||||||
}
|
}
|
||||||
|
print("delet fingerprintId $fingerprintId");
|
||||||
var entity = await ApiRepository.to.deletFingerprintsData(
|
var entity = await ApiRepository.to.deletFingerprintsData(
|
||||||
fingerprintId: fingerprintId,
|
fingerprintId: fingerprintId,
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
type: "1",
|
type: type,
|
||||||
deleteType:"1"
|
deleteType:"1"
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
Toast.show(msg: "重置成功");
|
if(state.isDeletAll == false){
|
||||||
|
Toast.show(msg: "删除成功");
|
||||||
|
}else{
|
||||||
|
Toast.show(msg: "重置成功");
|
||||||
|
}
|
||||||
|
|
||||||
state.isDeletFingerprintData = false;
|
state.isDeletFingerprintData = false;
|
||||||
getFingerprintsListData();
|
getFingerprintsListData();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,7 +125,6 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
|
|
||||||
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
return Obx(() => state.fingerprintItemListData.value.isNotEmpty
|
||||||
? ListView.separated(
|
? ListView.separated(
|
||||||
itemCount: state.fingerprintItemListData.value.length,
|
itemCount: state.fingerprintItemListData.value.length,
|
||||||
@ -137,7 +136,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
|
|||||||
key: Key(fingerprintItemData.fingerprintName!),
|
key: Key(fingerprintItemData.fingerprintName!),
|
||||||
actionsWidth: 60,
|
actionsWidth: 60,
|
||||||
actions: [
|
actions: [
|
||||||
_buildDeleteBtn(fingerprintItemData.fingerprintId.toString()),
|
_buildDeleteBtn(fingerprintItemData),
|
||||||
],
|
],
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||||
@ -172,12 +171,13 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
|
|||||||
: const NoData());
|
: const NoData());
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDeleteBtn(String idStr) {
|
Widget _buildDeleteBtn(FingerprintItemData fingerprintItemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// 省略: 弹出是否删除的确认对话框。
|
// 省略: 弹出是否删除的确认对话框。
|
||||||
state.deletFingerprintId = idStr;
|
state.deletKeyID = fingerprintItemData.fingerprintId.toString();
|
||||||
showIosTipViewDialog(context, idStr);
|
state.deletFingerNo = int.parse(fingerprintItemData.fingerprintNumber!);
|
||||||
|
showIosTipViewDialog(context);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 60,
|
width: 60,
|
||||||
@ -196,7 +196,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showIosTipViewDialog(BuildContext context, String keyId) {
|
void showIosTipViewDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -205,10 +205,10 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
|
|||||||
tipTitle: "确定要删除吗?",
|
tipTitle: "确定要删除吗?",
|
||||||
sureClick: () async {
|
sureClick: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
String? idStr = await Storage.getUid();
|
|
||||||
state.isDeletFingerprintData = true;
|
state.isDeletFingerprintData = true;
|
||||||
state.isDeletAll = false;
|
state.isDeletAll = false;
|
||||||
logic.senderAddFingerprint(keyId, idStr ?? "", 0);
|
state.deletUserID = (await Storage.getUid())!;
|
||||||
|
logic.senderAddFingerprint();
|
||||||
},
|
},
|
||||||
cancelClick: () {
|
cancelClick: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
@ -290,7 +290,10 @@ class _FingerprintListPageState extends State<FingerprintListPage> {
|
|||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
state.isDeletFingerprintData = true;
|
state.isDeletFingerprintData = true;
|
||||||
state.isDeletAll = true;
|
state.isDeletAll = true;
|
||||||
logic.senderAddFingerprint("1", "DeleteAll!@#", 255);
|
state.deletKeyID = "1";
|
||||||
|
state.deletUserID = "DeleteAll!@#";
|
||||||
|
state.deletFingerNo = 255;
|
||||||
|
logic.senderAddFingerprint();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -10,7 +10,9 @@ class FingerprintListState{
|
|||||||
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
// 因为删除跟添加指纹用的同一个协议 所以这里用做判断
|
||||||
var isDeletFingerprintData = false;
|
var isDeletFingerprintData = false;
|
||||||
var isDeletAll = false;
|
var isDeletAll = false;
|
||||||
var deletFingerprintId = "0";
|
var deletKeyID = "";
|
||||||
|
var deletUserID = "DeleteAll!@#";
|
||||||
|
var deletFingerNo = 0;
|
||||||
|
|
||||||
final fingerprintItemListData = <FingerprintItemData>[].obs;
|
final fingerprintItemListData = <FingerprintItemData>[].obs;
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|||||||
@ -31,16 +31,18 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> {
|
|||||||
barTitle: TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
barTitle: TranslationLoader.lanKeys!.automaticBlocking!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
actionsList: [
|
actionsList: [
|
||||||
TextButton(
|
Obx(() => TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.save!.tr,
|
state.isJustForShow.value == true ? "" : TranslationLoader.lanKeys!.save!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// logic.sendAutoLock();
|
if(state.isJustForShow.value == true){
|
||||||
|
return;
|
||||||
|
}
|
||||||
logic.sendAutoLock();
|
logic.sendAutoLock();
|
||||||
},
|
},
|
||||||
),
|
)),
|
||||||
],
|
],
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
@ -60,6 +62,9 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> {
|
|||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
|
if(state.isJustForShow.value == true){
|
||||||
|
return;
|
||||||
|
}
|
||||||
var list = [
|
var list = [
|
||||||
"5",
|
"5",
|
||||||
"10",
|
"10",
|
||||||
@ -110,11 +115,12 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
TextField(
|
Obx(() => TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
controller: state.timeController,
|
controller: state.timeController,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
readOnly: state.isJustForShow.value == true ? false : true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding:
|
contentPadding:
|
||||||
@ -125,7 +131,7 @@ class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> {
|
|||||||
//不需要输入框下划线
|
//不需要输入框下划线
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
Container(
|
Container(
|
||||||
height: 0.5.h,
|
height: 0.5.h,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import '../lockSet/lockSetInfo_entity.dart';
|
|||||||
|
|
||||||
class AutomaticBlockingState {
|
class AutomaticBlockingState {
|
||||||
var lockSetInfoData = LockSetInfoData().obs;
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
final lockBasicInfo = LockBasicInfo().obs;
|
||||||
|
|
||||||
|
var isJustForShow = false.obs;// 是否只是作为展示作用,因为普通用户只是展示,不可修改
|
||||||
|
|
||||||
var isOpen = false.obs;// 是否开启自动落锁
|
var isOpen = false.obs;// 是否开启自动落锁
|
||||||
var autoLockTime = "5".obs;
|
var autoLockTime = "5".obs;
|
||||||
@ -16,10 +19,17 @@ class AutomaticBlockingState {
|
|||||||
AutomaticBlockingState() {
|
AutomaticBlockingState() {
|
||||||
var map = Get.arguments;
|
var map = Get.arguments;
|
||||||
lockSetInfoData.value = map["lockSetInfoData"];
|
lockSetInfoData.value = map["lockSetInfoData"];
|
||||||
|
lockBasicInfo.value = map["lockBasicInfo"];
|
||||||
|
|
||||||
isOpen.value = lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false;
|
isOpen.value = lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false;
|
||||||
autoLockTime.value = lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString();
|
autoLockTime.value = lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString();
|
||||||
|
|
||||||
|
if(lockBasicInfo.value.isLockOwner == 1 || lockBasicInfo.value.keyRight == 1){
|
||||||
|
isJustForShow.value = false;
|
||||||
|
}else{
|
||||||
|
isJustForShow.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
if((lockSetInfoData.value.lockSettingInfo!.autoLock! > 0)
|
if((lockSetInfoData.value.lockSettingInfo!.autoLock! > 0)
|
||||||
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 5)
|
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 5)
|
||||||
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 10)
|
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 10)
|
||||||
|
|||||||
@ -107,15 +107,17 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
Visibility(
|
||||||
leftTitel: TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
visible: (state.lockBasicInfo.value.isLockOwner == 1 || state.lockBasicInfo.value.keyRight == 1) ? true : false,
|
||||||
rightTitle: "",
|
child: CommonItem(
|
||||||
isHaveLine: true,
|
leftTitel: TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
||||||
isHaveDirection: true,
|
rightTitle: "",
|
||||||
action: () {
|
isHaveLine: true,
|
||||||
Navigator.pushNamed(context,
|
isHaveDirection: true,
|
||||||
Routers.adminOpenLockPasswordPage);
|
action: () {
|
||||||
}),
|
Navigator.pushNamed(context, Routers.adminOpenLockPasswordPage);
|
||||||
|
}),
|
||||||
|
),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
TranslationLoader.lanKeys!.unlockQRCode!.tr,
|
TranslationLoader.lanKeys!.unlockQRCode!.tr,
|
||||||
|
|||||||
@ -314,6 +314,8 @@ class LockBasicInfo {
|
|||||||
int? startDate;
|
int? startDate;
|
||||||
int? endDate;
|
int? endDate;
|
||||||
String? mac;
|
String? mac;
|
||||||
|
int? keyRight;
|
||||||
|
int? senderUserId;
|
||||||
|
|
||||||
LockBasicInfo(
|
LockBasicInfo(
|
||||||
{this.keyId,
|
{this.keyId,
|
||||||
@ -328,7 +330,9 @@ class LockBasicInfo {
|
|||||||
this.keyType,
|
this.keyType,
|
||||||
this.startDate,
|
this.startDate,
|
||||||
this.endDate,
|
this.endDate,
|
||||||
this.mac});
|
this.mac,
|
||||||
|
this.keyRight,
|
||||||
|
this.senderUserId});
|
||||||
|
|
||||||
LockBasicInfo.fromJson(Map<String, dynamic> json) {
|
LockBasicInfo.fromJson(Map<String, dynamic> json) {
|
||||||
keyId = json['keyId'];
|
keyId = json['keyId'];
|
||||||
@ -349,6 +353,9 @@ class LockBasicInfo {
|
|||||||
startDate = json['startDate'];
|
startDate = json['startDate'];
|
||||||
endDate = json['endDate'];
|
endDate = json['endDate'];
|
||||||
mac = json['mac'];
|
mac = json['mac'];
|
||||||
|
keyRight = json['keyRight'];
|
||||||
|
senderUserId = json['senderUserId'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -368,6 +375,8 @@ class LockBasicInfo {
|
|||||||
data['startDate'] = startDate;
|
data['startDate'] = startDate;
|
||||||
data['endDate'] = endDate;
|
data['endDate'] = endDate;
|
||||||
data['mac'] = mac;
|
data['mac'] = mac;
|
||||||
|
data['keyRight'] = keyRight;
|
||||||
|
data['senderUserId'] = senderUserId;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||||
@ -19,6 +20,7 @@ import '../../../../tools/baseGetXController.dart';
|
|||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/toast.dart';
|
import '../../../../tools/toast.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
import 'checkingInInfoData_entity.dart';
|
import 'checkingInInfoData_entity.dart';
|
||||||
import 'lockSet_state.dart';
|
import 'lockSet_state.dart';
|
||||||
|
|
||||||
@ -248,9 +250,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 删除用户
|
// 删除用户
|
||||||
Future<void> deletUserAction() async {
|
Future<void> deletUserAction() async {
|
||||||
BlueManage().judgeReconnect(
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||||
BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
|
|
||||||
(DeviceConnectionState connectionState) async {
|
|
||||||
if (connectionState == DeviceConnectionState.connected) {
|
if (connectionState == DeviceConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -263,13 +263,18 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
|
|
||||||
IoSenderManage.deletUser(
|
IoSenderManage.deletUser(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
authUserID: "100001",
|
authUserID:state.lockBasicInfo.value.senderUserId.toString(),
|
||||||
keyID: "1",
|
keyID:state.lockBasicInfo.value.keyId.toString(),
|
||||||
delUserID: "100001",
|
delUserID:await Storage.getUid(),
|
||||||
|
// authUserID: "100001",
|
||||||
|
// keyID: "1",
|
||||||
|
// delUserID: "100001",
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
|
}else{
|
||||||
|
showDeletAlertTipDialog(Get.context!);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -296,6 +301,8 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: getTokenList
|
token: getTokenList
|
||||||
);
|
);
|
||||||
|
}else{
|
||||||
|
showDeletAlertTipDialog(Get.context!);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -378,6 +385,8 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
state.lockSettingInfo.value = state.lockSetInfoData.value.lockSettingInfo!;
|
state.lockSettingInfo.value = state.lockSetInfoData.value.lockSettingInfo!;
|
||||||
state.lockFeature.value = state.lockSetInfoData.value.lockFeature!;
|
state.lockFeature.value = state.lockSetInfoData.value.lockFeature!;
|
||||||
state.lockStatus.value = state.lockSetInfoData.value.lockStatus!;
|
state.lockStatus.value = state.lockSetInfoData.value.lockStatus!;
|
||||||
|
state.lockBasicInfo.value = state.lockSetInfoData.value.lockBasicInfo!;
|
||||||
|
|
||||||
state.isAttendance.value = state.lockSettingInfo.value.attendance!;
|
state.isAttendance.value = state.lockSettingInfo.value.attendance!;
|
||||||
state.isOpenLockNeedOnline.value = state.lockSettingInfo.value.appUnlockOnline!;
|
state.isOpenLockNeedOnline.value = state.lockSettingInfo.value.appUnlockOnline!;
|
||||||
|
|
||||||
@ -395,6 +404,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
BlueManage().connectDeviceMacAddress = "";
|
||||||
Get.offAllNamed(Routers.starLockMain);
|
Get.offAllNamed(Routers.starLockMain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,6 +416,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
|
keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
BlueManage().connectDeviceMacAddress = "";
|
||||||
Get.offAllNamed(Routers.starLockMain);
|
Get.offAllNamed(Routers.starLockMain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,7 +427,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
password: state.passwordTF.text,
|
password: state.passwordTF.text,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
deletLockInfoData();
|
// deletLockInfoData();
|
||||||
|
|
||||||
blockDeletNumberCheckPasswordCallback();
|
blockDeletNumberCheckPasswordCallback();
|
||||||
// if(state.currentDeviceUUid.value.isEmpty){
|
// if(state.currentDeviceUUid.value.isEmpty){
|
||||||
@ -425,13 +436,23 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
// }
|
// }
|
||||||
// if(state.currentDeviceUUid.value[31] == "1"){
|
// if(state.currentDeviceUUid.value[31] == "1"){
|
||||||
|
|
||||||
// 已配对
|
// 判断是否是锁的拥有者
|
||||||
if(state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1){
|
if(state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1){
|
||||||
// 调用删除锁协议
|
// 判断是否扫描到当前设备
|
||||||
factoryDataResetAction();
|
if(BlueManage().connectDeviceMacAddress.isNotEmpty){
|
||||||
|
// 调用删除锁协议
|
||||||
|
factoryDataResetAction();
|
||||||
|
}else{
|
||||||
|
showDeletAlertTipDialog(Get.context!);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
// 调用删除钥匙协议
|
// 判断是否扫描到当前设备
|
||||||
deletUserAction();
|
if(BlueManage().connectDeviceMacAddress.isNotEmpty){
|
||||||
|
// 调用删除钥匙协议
|
||||||
|
deletUserAction();
|
||||||
|
}else{
|
||||||
|
showDeletAlertTipDialog(Get.context!);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// }else if(state.currentDeviceUUid.value[31] == "0"){
|
// }else if(state.currentDeviceUUid.value[31] == "0"){
|
||||||
@ -528,6 +549,39 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showDeletAlertTipDialog(BuildContext context) {
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: const Text("提示"),
|
||||||
|
content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
if(state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1){
|
||||||
|
// 直接调用删除锁接口
|
||||||
|
deletLockInfoData();
|
||||||
|
}else{
|
||||||
|
// 直接调用删除要是接口
|
||||||
|
deletKeyData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
// TODO: implement onReady
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@ class LockSetState {
|
|||||||
final lockFeature = LockFeature().obs;
|
final lockFeature = LockFeature().obs;
|
||||||
final lockSettingInfo = LockSettingInfo().obs;
|
final lockSettingInfo = LockSettingInfo().obs;
|
||||||
final lockStatus = LockStatus().obs;
|
final lockStatus = LockStatus().obs;
|
||||||
|
final lockBasicInfo = LockBasicInfo().obs;
|
||||||
|
|
||||||
final lockId = 0.obs;
|
final lockId = 0.obs;
|
||||||
|
|
||||||
|
|||||||
@ -109,14 +109,14 @@ class _NormallyOpenModePageState extends State<NormallyOpenModePage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
Container(
|
Obx(() => Container(
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 30.h),
|
||||||
child: SubmitBtn(
|
child: state.isJustForShow.value == true ? Container() :SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
logic.sendAutoLock();
|
logic.sendAutoLock();
|
||||||
}),
|
}),
|
||||||
),
|
)),
|
||||||
],
|
],
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import '../lockSet/lockSetInfo_entity.dart';
|
|||||||
|
|
||||||
class NormallyOpenModeState{
|
class NormallyOpenModeState{
|
||||||
var lockSetInfoData = LockSetInfoData().obs;
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
final lockBasicInfo = LockBasicInfo().obs;
|
||||||
|
var isJustForShow = false.obs;// 是否只是作为展示作用,因为普通用户只是展示,不可修改
|
||||||
|
|
||||||
// var getPassageModeConfigData = GetPassageModeConfigEntity().obs;
|
// var getPassageModeConfigData = GetPassageModeConfigEntity().obs;
|
||||||
var isOpenNormallyOpenMode = false.obs;// 是否开启常开模式 常开模式:1-开启、2-关闭
|
var isOpenNormallyOpenMode = false.obs;// 是否开启常开模式 常开模式:1-开启、2-关闭
|
||||||
@ -20,6 +22,12 @@ class NormallyOpenModeState{
|
|||||||
lockSetInfoData.value = map["lockSetInfoData"];
|
lockSetInfoData.value = map["lockSetInfoData"];
|
||||||
isOpenNormallyOpenMode.value = lockSetInfoData.value.lockSettingInfo!.passageMode! == 1 ? true : false;
|
isOpenNormallyOpenMode.value = lockSetInfoData.value.lockSettingInfo!.passageMode! == 1 ? true : false;
|
||||||
|
|
||||||
|
if(lockBasicInfo.value.isLockOwner == 1 || lockBasicInfo.value.keyRight == 1){
|
||||||
|
isJustForShow.value = false;
|
||||||
|
}else{
|
||||||
|
isJustForShow.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
if((isOpenNormallyOpenMode.value == true) && (lockSetInfoData.value.lockSettingInfo!.passageModeConfig!.isNotEmpty)){
|
if((isOpenNormallyOpenMode.value == true) && (lockSetInfoData.value.lockSettingInfo!.passageModeConfig!.isNotEmpty)){
|
||||||
isAllDay.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].isAllDay!;
|
isAllDay.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].isAllDay!;
|
||||||
weekDays.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].weekDays!;
|
weekDays.value = lockSetInfoData.value.lockSettingInfo!.passageModeConfig![0].weekDays!;
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import 'package:star_lock/blue/io_type.dart';
|
|||||||
import 'package:star_lock/tools/toast.dart';
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
|
import '../../../blue/io_protocol/io_addUser.dart';
|
||||||
import '../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
|
import '../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
|
||||||
import '../../../blue/io_protocol/io_openLock.dart';
|
import '../../../blue/io_protocol/io_openLock.dart';
|
||||||
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
||||||
@ -53,6 +54,11 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
if(reply is SenderReferEventRecordTimeReply) {
|
if(reply is SenderReferEventRecordTimeReply) {
|
||||||
_replyReferEventRecordTime(reply);
|
_replyReferEventRecordTime(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加用户
|
||||||
|
if(reply is AddUserReply) {
|
||||||
|
_replyAddUserKey(reply);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +66,7 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
Future<void> _replyOpenLock(Reply reply) async {
|
Future<void> _replyOpenLock(Reply reply) async {
|
||||||
var tokenData = reply.data.sublist(2, 6);
|
var tokenData = reply.data.sublist(2, 6);
|
||||||
var saveStrList = changeIntListToStringList(tokenData);
|
var saveStrList = changeIntListToStringList(tokenData);
|
||||||
// print("openDoorToken:$tokenData");
|
print("openDoorToken:$tokenData");
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
int status = reply.data[6];
|
int status = reply.data[6];
|
||||||
@ -122,66 +128,6 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑用户数据解析
|
|
||||||
// Future<void> _replyEditUserKey(Reply reply) async {
|
|
||||||
// var token = reply.data.sublist(2, 6);
|
|
||||||
// var saveStrList = changeIntListToStringList(token);
|
|
||||||
// print("_replyEditUserKeyToken:$token");
|
|
||||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
|
||||||
//
|
|
||||||
// int status = reply.data[6];
|
|
||||||
// print("status:$status");
|
|
||||||
//
|
|
||||||
// switch(status){
|
|
||||||
// case 0x00:
|
|
||||||
// //成功
|
|
||||||
// print("${reply.commandType!.typeValue} 数据解析成功");
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
// case 0x06:
|
|
||||||
// //无权限
|
|
||||||
// print("${reply.commandType!.typeValue} 需要鉴权");
|
|
||||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
|
||||||
//
|
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
|
||||||
//
|
|
||||||
// IoSenderManage.senderEditUser(
|
|
||||||
// lockID:BlueManage().connectDeviceName,
|
|
||||||
// authUserID:await Storage.getUid(),
|
|
||||||
// keyID:"1",
|
|
||||||
// userID:await Storage.getUid(),
|
|
||||||
// openMode:1,
|
|
||||||
// keyType:1,
|
|
||||||
// startDate:0x11223344,
|
|
||||||
// expireDate:0x11223344,
|
|
||||||
// role:255,
|
|
||||||
// password:"123456",
|
|
||||||
// needAuthor:1,
|
|
||||||
// publicKey:publicKeyDataList,
|
|
||||||
// privateKey:getPrivateKeyList,
|
|
||||||
// token: token
|
|
||||||
// );
|
|
||||||
// break;
|
|
||||||
// case 0x07:
|
|
||||||
// //无权限
|
|
||||||
// print("${reply.commandType!.typeValue} 用户无权限");
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
// case 0x09:
|
|
||||||
// // 权限校验错误
|
|
||||||
// print("${reply.commandType!.typeValue} 权限校验错误");
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// //失败
|
|
||||||
// print("${reply.commandType!.typeValue} 失败");
|
|
||||||
//
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取锁状态数据解析
|
// 获取锁状态数据解析
|
||||||
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
|
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
@ -325,6 +271,78 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加用户
|
||||||
|
Future<void> _replyAddUserKey(Reply reply) async {
|
||||||
|
var lockId = reply.data.sublist(2, 42);
|
||||||
|
// print("lockId:$lockId");
|
||||||
|
|
||||||
|
var token = reply.data.sublist(42, 46);
|
||||||
|
List<String> strTokenList = changeIntListToStringList(token);
|
||||||
|
Storage.setStringList(saveBlueToken, strTokenList);
|
||||||
|
// print("token:$token");
|
||||||
|
|
||||||
|
int status = reply.data[46];
|
||||||
|
// print("status:$status reply.data:${reply.data}");
|
||||||
|
|
||||||
|
print("status:$status");
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
print("添加用户数据解析成功");
|
||||||
|
state.lockUserNo = reply.data[47] + 1;
|
||||||
|
// updateLockUserNo();
|
||||||
|
|
||||||
|
if(state.isOpenLockNeedOnline.value == 0){
|
||||||
|
openDoorAction();
|
||||||
|
}else{
|
||||||
|
getLockNetToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
print("需要鉴权");
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
IoSenderManage.senderAddUser(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
authUserID:state.senderUserId.toString(),
|
||||||
|
keyID:state.keyInfos.value.keyId.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
openMode:1,
|
||||||
|
keyType:0,
|
||||||
|
startDate:DateTime.now().millisecondsSinceEpoch,
|
||||||
|
expireDate:0x11223344,
|
||||||
|
role:0,
|
||||||
|
password:"123456",
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: token
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 0x07:
|
||||||
|
//无权限
|
||||||
|
print("用户无权限");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
// 权限校验错误
|
||||||
|
print("添加用户权限校验错误");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
print("领锁失败");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 点击开门事件
|
// 点击开门事件
|
||||||
Future<void> openDoorAction() async {
|
Future<void> openDoorAction() async {
|
||||||
// if(BlueManage().connectDeviceMacAddress.isEmpty){
|
// if(BlueManage().connectDeviceMacAddress.isEmpty){
|
||||||
@ -366,39 +384,39 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 编辑用户事件
|
// 编辑用户事件
|
||||||
Future<void> editLockUserAction() async {
|
// Future<void> editLockUserAction() async {
|
||||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
// BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||||
if (state == DeviceConnectionState.connected){
|
// if (state == DeviceConnectionState.connected){
|
||||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
//
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
//
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
// var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
print("openDoorTokenPubToken:$getTokenList");
|
// print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
//
|
||||||
print("publicKey:$publicKey publicKeyDataList:$publicKeyDataList privateKey:$privateKey getPrivateKeyList:$getPrivateKeyList token:$token getTokenList:$getTokenList");
|
// print("publicKey:$publicKey publicKeyDataList:$publicKeyDataList privateKey:$privateKey getPrivateKeyList:$getPrivateKeyList token:$token getTokenList:$getTokenList");
|
||||||
IoSenderManage.senderEditUser(
|
// IoSenderManage.senderEditUser(
|
||||||
lockID:BlueManage().connectDeviceName,
|
// lockID:BlueManage().connectDeviceName,
|
||||||
authUserID:await Storage.getUid(),
|
// authUserID:await Storage.getUid(),
|
||||||
keyID:"1",
|
// keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
// userID:await Storage.getUid(),
|
||||||
openMode:1,
|
// openMode:1,
|
||||||
keyType:1,
|
// keyType:1,
|
||||||
startDate:0x11223344,
|
// startDate:0x11223344,
|
||||||
expireDate:0x11223344,
|
// expireDate:0x11223344,
|
||||||
role:255,
|
// role:255,
|
||||||
password:"123456",
|
// password:"123456",
|
||||||
needAuthor:1,
|
// needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
// publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
// privateKey:getPrivateKeyList,
|
||||||
token: getTokenList
|
// token: getTokenList
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// 备用逻辑,进入管理钥匙界面获取锁状态
|
// 备用逻辑,进入管理钥匙界面获取锁状态
|
||||||
@ -453,6 +471,44 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
}, isShowLoading: false);
|
}, isShowLoading: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加用户(普通用户接收电子钥匙)
|
||||||
|
Future<void> addUserConnectBlue() async {
|
||||||
|
// 进来之后首先连接
|
||||||
|
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == DeviceConnectionState.connected){
|
||||||
|
// 私钥
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
|
List<int> getTokenList = [0,0,0,0];
|
||||||
|
if(token != null){
|
||||||
|
getTokenList = changeStringListToIntList(token);
|
||||||
|
}
|
||||||
|
print("BlueManage().connectDeviceName:${BlueManage().connectDeviceName} authUserID:${state.senderUserId.toString()} keyID:${state.keyInfos.value.keyId.toString()} userID:${await Storage.getUid()}");
|
||||||
|
IoSenderManage.senderAddUser(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
authUserID:state.senderUserId.toString(),
|
||||||
|
keyID:state.keyInfos.value.keyId.toString(),
|
||||||
|
userID:await Storage.getUid(),
|
||||||
|
openMode:1,
|
||||||
|
keyType:0,
|
||||||
|
startDate:DateTime.now().millisecondsSinceEpoch,
|
||||||
|
expireDate:0x11223344,
|
||||||
|
role:0,
|
||||||
|
password:"123456",
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: getTokenList
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void startScanAction(){
|
void startScanAction(){
|
||||||
BlueManage().startScan(true, (v){
|
BlueManage().startScan(true, (v){
|
||||||
// print("startScanAllDevice:${v}");
|
// print("startScanAllDevice:${v}");
|
||||||
@ -472,10 +528,14 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
state.lockState.value = 1;
|
state.lockState.value = 1;
|
||||||
state.animationController.forward();
|
state.animationController.forward();
|
||||||
|
|
||||||
if(state.isOpenLockNeedOnline.value == 0){
|
if(state.lockUserNo == 0){
|
||||||
openDoorAction();
|
addUserConnectBlue();
|
||||||
}else{
|
}else{
|
||||||
getLockNetToken();
|
if(state.isOpenLockNeedOnline.value == 0){
|
||||||
|
openDoorAction();
|
||||||
|
}else{
|
||||||
|
getLockNetToken();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future.delayed(const Duration(seconds: 10), () {
|
Future.delayed(const Duration(seconds: 10), () {
|
||||||
@ -504,10 +564,21 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 普通用户接收电子钥匙之后 更新锁用户NO
|
||||||
|
void updateLockUserNo() async {
|
||||||
|
LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(keyId: state.keyInfos.value.keyId.toString(), lockUserNo: state.lockUserNo.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if(state.isOpenLockNeedOnline.value == 0){
|
||||||
|
openDoorAction();
|
||||||
|
}else{
|
||||||
|
getLockNetToken();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
void getLockRecordLastUploadDataTime() async {
|
void getLockRecordLastUploadDataTime() async {
|
||||||
LockOperatingRecordGetLastRecordTimeEntity entity =
|
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to.getLockRecordLastUploadDataTime(lockId: state.keyInfos.value.lockId.toString());
|
||||||
await ApiRepository.to.getLockRecordLastUploadDataTime(lockId: state.keyInfos.value.lockId.toString());
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
senderReferEventRecordTime(entity.data!.operateDate!~/1000);
|
senderReferEventRecordTime(entity.data!.operateDate!~/1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,15 +3,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../network/api_repository.dart';
|
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
// import '../../lockMian/entity/lockInfoEntity.dart';
|
|
||||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
import 'lockDetail_page.dart';
|
import 'lockDetail_page.dart';
|
||||||
|
|
||||||
class LockDetailMainPage extends StatefulWidget {
|
class LockDetailMainPage extends StatefulWidget {
|
||||||
|
|
||||||
const LockDetailMainPage({Key? key}) : super(key: key);
|
const LockDetailMainPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -19,19 +16,6 @@ class LockDetailMainPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
||||||
|
|
||||||
// void getLockInfo() async{
|
|
||||||
// var entity = await ApiRepository.to.getLockInfo(
|
|
||||||
// lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
|
|
||||||
// pageNo:"1",
|
|
||||||
// );
|
|
||||||
// if(entity.errorCode!.codeIsSuccessful){
|
|
||||||
//
|
|
||||||
// }else{
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
|
|||||||
@ -37,6 +37,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
state.keyInfos.value = widget.lockListInfoItemEntity;
|
state.keyInfos.value = widget.lockListInfoItemEntity;
|
||||||
|
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
||||||
|
state.senderUserId = state.keyInfos.value.senderUserId!;
|
||||||
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
|
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
|
||||||
state.isOpenLockNeedOnline.value = state.keyInfos.value.lockSetting!.appUnlockOnline!;
|
state.isOpenLockNeedOnline.value = state.keyInfos.value.lockSetting!.appUnlockOnline!;
|
||||||
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
||||||
@ -94,10 +96,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 1.sw - 120.w * 2,
|
width: 1.sw - 120.w * 2,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child:
|
||||||
widget.lockListInfoItemEntity!.lockAlias!,
|
Text(widget.lockListInfoItemEntity.lockAlias!, style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
|
||||||
style:
|
|
||||||
TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
|
|
||||||
))),
|
))),
|
||||||
Positioned(
|
Positioned(
|
||||||
child: Obx(() => Row(
|
child: Obx(() => Row(
|
||||||
@ -124,14 +124,11 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
child: Obx(() => Stack(
|
child: Obx(() => Stack(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
state.lockState.value == 4
|
state.lockState.value == 4 ? 'images/main/icon_main_openLockBtn_grey.png' : 'images/main/icon_main_openLockBtn_center.png',
|
||||||
? 'images/main/icon_main_openLockBtn_grey.png'
|
|
||||||
: 'images/main/icon_main_openLockBtn_center.png',
|
|
||||||
width: 330.w,
|
width: 330.w,
|
||||||
height: 330.w,
|
height: 330.w,
|
||||||
),
|
),
|
||||||
(state.lockState.value == 1 ||
|
(state.lockState.value == 1 || state.lockState.value == 3)
|
||||||
state.lockState.value == 3)
|
|
||||||
? buildRotationTransition()
|
? buildRotationTransition()
|
||||||
: Positioned(
|
: Positioned(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -267,11 +264,42 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
crossAxisSpacing: 20.w,
|
crossAxisSpacing: 20.w,
|
||||||
mainAxisSpacing: 0.h,
|
mainAxisSpacing: 0.h,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
children: getShowWidget()),
|
children: getBottomWidget()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getShowWidget() {
|
// 根据权限显示不同的底部按钮
|
||||||
|
List<Widget> getBottomWidget(){
|
||||||
|
if(state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1){
|
||||||
|
// 超级管理员、授权管理员
|
||||||
|
return getAllWidget();
|
||||||
|
}else{
|
||||||
|
return getNormalWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 普通用户
|
||||||
|
List<Widget> getNormalWidget() {
|
||||||
|
var showWidgetArr = [
|
||||||
|
// 操作记录
|
||||||
|
bottomItem('images/main/icon_main_operatingRecord.png',
|
||||||
|
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
||||||
|
Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
|
arguments: {"keyInfo": widget.lockListInfoItemEntity});
|
||||||
|
}),
|
||||||
|
|
||||||
|
// 设置
|
||||||
|
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
|
||||||
|
BlueManage().stopScan();
|
||||||
|
Get.toNamed(Routers.lockSetPage,
|
||||||
|
arguments: {"lockId": widget.lockListInfoItemEntity.lockId});
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
return showWidgetArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 授权管理员、超级管理员字段
|
||||||
|
List<Widget> getAllWidget() {
|
||||||
var showWidgetArr = <Widget>[];
|
var showWidgetArr = <Widget>[];
|
||||||
// 考勤
|
// 考勤
|
||||||
if (state.isAttendance.value == 1) {
|
if (state.isAttendance.value == 1) {
|
||||||
|
|||||||
@ -17,6 +17,8 @@ class LockDetailState {
|
|||||||
Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
|
Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
|
||||||
|
|
||||||
String lockNetToken = "";
|
String lockNetToken = "";
|
||||||
|
var lockUserNo = 0;
|
||||||
|
var senderUserId = 0;
|
||||||
|
|
||||||
var isAttendance = 0.obs;// 是否开启考勤
|
var isAttendance = 0.obs;// 是否开启考勤
|
||||||
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||||
|
|||||||
@ -115,6 +115,8 @@ class LockListInfoItemEntity {
|
|||||||
int? keyStatus;
|
int? keyStatus;
|
||||||
int? isLockOwner;
|
int? isLockOwner;
|
||||||
int? sendDate;
|
int? sendDate;
|
||||||
|
int? lockUserNo;
|
||||||
|
int? senderUserId;
|
||||||
Bluetooth? bluetooth;
|
Bluetooth? bluetooth;
|
||||||
LockFeature? lockFeature;
|
LockFeature? lockFeature;
|
||||||
LockSetting? lockSetting;
|
LockSetting? lockSetting;
|
||||||
@ -142,7 +144,9 @@ class LockListInfoItemEntity {
|
|||||||
this.bluetooth,
|
this.bluetooth,
|
||||||
this.lockFeature,
|
this.lockFeature,
|
||||||
this.lockSetting,
|
this.lockSetting,
|
||||||
this.sendDate});
|
this.sendDate,
|
||||||
|
this.lockUserNo,
|
||||||
|
this.senderUserId});
|
||||||
|
|
||||||
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
|
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
|
||||||
keyId = json['keyId'];
|
keyId = json['keyId'];
|
||||||
@ -165,6 +169,8 @@ class LockListInfoItemEntity {
|
|||||||
keyStatus = json['keyStatus'];
|
keyStatus = json['keyStatus'];
|
||||||
isLockOwner = json['isLockOwner'];
|
isLockOwner = json['isLockOwner'];
|
||||||
sendDate = json['sendDate'];
|
sendDate = json['sendDate'];
|
||||||
|
lockUserNo = json['lockUserNo'];
|
||||||
|
senderUserId = json['senderUserId'];
|
||||||
bluetooth = json['bluetooth'] != null
|
bluetooth = json['bluetooth'] != null
|
||||||
? Bluetooth.fromJson(json['bluetooth'])
|
? Bluetooth.fromJson(json['bluetooth'])
|
||||||
: null;
|
: null;
|
||||||
@ -198,6 +204,8 @@ class LockListInfoItemEntity {
|
|||||||
data['keyStatus'] = keyStatus;
|
data['keyStatus'] = keyStatus;
|
||||||
data['isLockOwner'] = isLockOwner;
|
data['isLockOwner'] = isLockOwner;
|
||||||
data['sendDate'] = sendDate;
|
data['sendDate'] = sendDate;
|
||||||
|
data['lockUserNo'] = lockUserNo;
|
||||||
|
data['senderUserId'] = senderUserId;
|
||||||
if (bluetooth != null) {
|
if (bluetooth != null) {
|
||||||
data['bluetooth'] = bluetooth!.toJson();
|
data['bluetooth'] = bluetooth!.toJson();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("添加用户数据解析成功");
|
print("添加用户数据解析成功");
|
||||||
state.lockUserNo = reply.data[47];
|
state.lockUserNo = reply.data[47] + 1;
|
||||||
|
|
||||||
bindBlueAdmin();
|
bindBlueAdmin();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
|||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/baseGetXController.dart';
|
import '../../../../tools/baseGetXController.dart';
|
||||||
|
import '../../../blue/blue_manage.dart';
|
||||||
import '../../../tools/eventBusEventManage.dart';
|
import '../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../tools/toast.dart';
|
import '../../../tools/toast.dart';
|
||||||
|
|
||||||
@ -52,13 +53,16 @@ class MineSetLogic extends BaseGetXController {
|
|||||||
LoginEntity entity = await ApiRepository.to.userLogout();
|
LoginEntity entity = await ApiRepository.to.userLogout();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
logOut();
|
logOut();
|
||||||
|
BlueManage().stopScan();
|
||||||
|
BlueManage().disconnect(BlueManage().connectDeviceMacAddress);
|
||||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///退出登录
|
///退出登录
|
||||||
void logOut() async {
|
void logOut() async {
|
||||||
await Storage.setString('userLoginData', '');
|
Storage.clearAll();
|
||||||
|
// await Storage.setString('userLoginData', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新触摸开锁
|
//更新触摸开锁
|
||||||
|
|||||||
@ -27,6 +27,7 @@ abstract class Api {
|
|||||||
final String getLockRecordLastUploadDataTimeURL = '/lockRecords/getLastRecordTime'; //查询锁记录最后时间
|
final String getLockRecordLastUploadDataTimeURL = '/lockRecords/getLastRecordTime'; //查询锁记录最后时间
|
||||||
|
|
||||||
final String getLockNetTokenURL = '/lock/getLockNetToken'; //获取手机联网token
|
final String getLockNetTokenURL = '/lock/getLockNetToken'; //获取手机联网token
|
||||||
|
final String updateLockUserNoURL = '/key/updateLockUserNo'; //更新锁用户NO
|
||||||
|
|
||||||
final String bindingBlueAdminURL = '/lock/bindAdmin'; //绑定蓝牙管理员
|
final String bindingBlueAdminURL = '/lock/bindAdmin'; //绑定蓝牙管理员
|
||||||
final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称
|
final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称
|
||||||
|
|||||||
@ -279,6 +279,15 @@ class ApiProvider extends BaseProvider {
|
|||||||
}),
|
}),
|
||||||
isUnShowLoading: true);
|
isUnShowLoading: true);
|
||||||
|
|
||||||
|
// 更新锁用户NO
|
||||||
|
Future<Response> updateLockUserNo(String keyId, String lockUserNo) => post(
|
||||||
|
updateLockUserNoURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
'lockUserNo': lockUserNo,
|
||||||
|
}),
|
||||||
|
isUnShowLoading: true);
|
||||||
|
|
||||||
// 绑定蓝牙管理员
|
// 绑定蓝牙管理员
|
||||||
Future<Response> bindingBlueAdmin(
|
Future<Response> bindingBlueAdmin(
|
||||||
String lockAlias,
|
String lockAlias,
|
||||||
@ -1036,7 +1045,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
// 编辑ICCard
|
// 编辑ICCard
|
||||||
Future<Response> editICCardData(String lockId, String cardId, String cardName,
|
Future<Response> editICCardData(String lockId, String cardId, String cardName,
|
||||||
String startDate, String endDate, String isCoerced, List weekDay) =>
|
String startDate, String endDate, String isCoerced, List weekDay, String changeType) =>
|
||||||
post(
|
post(
|
||||||
editICCardURL.toUrl,
|
editICCardURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -1046,7 +1055,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
'isCoerced': isCoerced,
|
'isCoerced': isCoerced,
|
||||||
'weekDay': weekDay
|
'weekDay': weekDay,
|
||||||
|
'changeType': changeType
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 删除卡
|
// 删除卡
|
||||||
|
|||||||
@ -217,8 +217,7 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//操作记录上传
|
//操作记录上传
|
||||||
Future<KeyOperationRecordEntity> lockRecordUploadData(
|
Future<KeyOperationRecordEntity> lockRecordUploadData({required String lockId, required List records}) async {
|
||||||
{required String lockId, required List records}) async {
|
|
||||||
final res = await apiProvider.lockRecordUploadData(lockId, records);
|
final res = await apiProvider.lockRecordUploadData(lockId, records);
|
||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
@ -236,6 +235,12 @@ class ApiRepository {
|
|||||||
return LockNetTokenEntity.fromJson(res.body);
|
return LockNetTokenEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新锁用户NO
|
||||||
|
Future<LockNetTokenEntity> updateLockUserNo({required String keyId, required String lockUserNo}) async {
|
||||||
|
final res = await apiProvider.updateLockUserNo(keyId, lockUserNo);
|
||||||
|
return LockNetTokenEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
// 绑定蓝牙管理员
|
// 绑定蓝牙管理员
|
||||||
Future<SaveLockEntity> bindingBlueAdmin(
|
Future<SaveLockEntity> bindingBlueAdmin(
|
||||||
{ required String lockAlias,
|
{ required String lockAlias,
|
||||||
@ -1180,9 +1185,10 @@ class ApiRepository {
|
|||||||
required String startDate,
|
required String startDate,
|
||||||
required String endDate,
|
required String endDate,
|
||||||
required String isCoerced,
|
required String isCoerced,
|
||||||
required List weekDay}) async {
|
required List weekDay,
|
||||||
|
required String changeType}) async {
|
||||||
final res = await apiProvider.editICCardData(
|
final res = await apiProvider.editICCardData(
|
||||||
lockId, cardId, cardName, startDate, endDate, isCoerced, weekDay);
|
lockId, cardId, cardName, startDate, endDate, isCoerced, weekDay, changeType);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -139,7 +139,7 @@ class Storage {
|
|||||||
String? userId = '';
|
String? userId = '';
|
||||||
final data = await Storage.getString('userLoginData');
|
final data = await Storage.getString('userLoginData');
|
||||||
if (data != null && data.isNotEmpty) {
|
if (data != null && data.isNotEmpty) {
|
||||||
userId = LoginData.fromJson(jsonDecode(data)).userid.toString();
|
userId = LoginData.fromJson(jsonDecode(data)).uid.toString();
|
||||||
}
|
}
|
||||||
print("pubUserId:$userId");
|
print("pubUserId:$userId");
|
||||||
return userId;
|
return userId;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user