diff --git a/star_lock/android/app/build.gradle b/star_lock/android/app/build.gradle
index afe6fa92..4cd73a75 100644
--- a/star_lock/android/app/build.gradle
+++ b/star_lock/android/app/build.gradle
@@ -55,12 +55,26 @@ android {
versionName flutterVersionName
}
+// signingConfigs {
+// release {
+// storeFile file("key/keystore.jks")
+// storePassword '123456'
+// keyAlias = 'key0'
+// keyPassword '123456'
+// }
+// }
+
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
+// debug {
+// // TODO: Add your own signing config for the release build.
+// // Signing with the debug keys for now, so `flutter run --release` works.
+// signingConfig signingConfigs.release
+// }
}
}
diff --git a/star_lock/android/app/src/main/AndroidManifest.xml b/star_lock/android/app/src/main/AndroidManifest.xml
index 66743f72..5b60fd8f 100644
--- a/star_lock/android/app/src/main/AndroidManifest.xml
+++ b/star_lock/android/app/src/main/AndroidManifest.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/star_lock/android/build.gradle b/star_lock/android/build.gradle
index 0425fc73..d8f74fdf 100644
--- a/star_lock/android/build.gradle
+++ b/star_lock/android/build.gradle
@@ -1,5 +1,5 @@
buildscript {
- ext.kotlin_version = '1.9.0'
+ ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json
index 4ca15633..ca230699 100644
--- a/star_lock/images/lan/lan_en.json
+++ b/star_lock/images/lan/lan_en.json
@@ -405,5 +405,15 @@
"pleaseEnterWifiPwd":"Please Enter WiFi Password",
"edit":"Edit",
"stressFingerprint":"Stress Fingerprint",
- "effectiveDay":"Effective Day"
+ "effectiveDay":"Effective Day",
+
+ "whetherTheEmployeeHasPassword":"If The Employee Has A Password",
+ "whetherTheEmployeeHasCard":"If The Employee Has A Card",
+ "whetherTheEmployeeHasFingerprint":"If The Employee Has A Fingerprint",
+ "seletPassword":"Selet Password",
+ "seletCard":"Selet Card",
+ "seletFingerprint":"Selet Fingerprint",
+ "getKey":"Get Key",
+ "getCard":"Get Card",
+ "getFingerprint":"Get Fingerprint"
}
diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json
index e48b4baa..2e1e6224 100644
--- a/star_lock/images/lan/lan_keys.json
+++ b/star_lock/images/lan/lan_keys.json
@@ -405,5 +405,15 @@
"pleaseEnterWifiPwd":"pleaseEnterWifiPwd",
"edit":"edit",
"stressFingerprint":"stressFingerprint",
- "effectiveDay":"effectiveDay"
+ "effectiveDay":"effectiveDay",
+
+ "whetherTheEmployeeHasPassword":"whetherTheEmployeeHasPassword",
+ "whetherTheEmployeeHasCard":"whetherTheEmployeeHasCard",
+ "whetherTheEmployeeHasFingerprint":"whetherTheEmployeeHasFingerprint",
+ "seletPassword":"seletPassword",
+ "seletCard":"seletCard",
+ "seletFingerprint":"seletFingerprint",
+ "getKey":"getKey",
+ "getCard":"getCard",
+ "getFingerprint":"getFingerprint"
}
\ No newline at end of file
diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json
index 0a09c1c9..06b3ace3 100644
--- a/star_lock/images/lan/lan_zh.json
+++ b/star_lock/images/lan/lan_zh.json
@@ -408,5 +408,15 @@
"pleaseEnterWifiPwd":"请输入WiFi密码",
"edit":"编辑",
"stressFingerprint":"胁迫指纹",
- "effectiveDay":"有效日"
+ "effectiveDay":"有效日",
+
+ "whetherTheEmployeeHasPassword":"员工是否有密码",
+ "whetherTheEmployeeHasCard":"员工是否有卡",
+ "whetherTheEmployeeHasFingerprint":"员工是否有指纹",
+ "seletPassword":"选择密码",
+ "seletCard":"选择卡",
+ "seletFingerprint":"选择指纹",
+ "getKey":"获取钥匙",
+ "getCard":"获取卡",
+ "getFingerprint":"获取指纹"
}
\ No newline at end of file
diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock
index 14a8c1c0..0c27c598 100644
--- a/star_lock/ios/Podfile.lock
+++ b/star_lock/ios/Podfile.lock
@@ -23,8 +23,6 @@ PODS:
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- - geocoding_ios (1.0.5):
- - Flutter
- google_maps_flutter_ios (0.0.1):
- Flutter
- GoogleMaps (< 8.0)
@@ -68,7 +66,6 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- - geocoding_ios (from `.symlinks/plugins/geocoding_ios/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
@@ -106,8 +103,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_native_contact_picker/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
- geocoding_ios:
- :path: ".symlinks/plugins/geocoding_ios/ios"
google_maps_flutter_ios:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
image_picker_ios:
@@ -141,7 +136,6 @@ SPEC CHECKSUMS:
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
- geocoding_ios: a389ea40f6f548de6e63006a2e31bf66ff80769a
google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd
GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
diff --git a/star_lock/ios/Runner.xcodeproj/project.pbxproj b/star_lock/ios/Runner.xcodeproj/project.pbxproj
index 5ea99da8..9f133cf6 100644
--- a/star_lock/ios/Runner.xcodeproj/project.pbxproj
+++ b/star_lock/ios/Runner.xcodeproj/project.pbxproj
@@ -375,14 +375,14 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = 7NLFRKNVY3;
+ DEVELOPMENT_TEAM = ZJ29NYHTV5;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock123";
+ PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
@@ -506,14 +506,14 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = 7NLFRKNVY3;
+ DEVELOPMENT_TEAM = ZJ29NYHTV5;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock123";
+ PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
@@ -530,14 +530,14 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = 7NLFRKNVY3;
+ DEVELOPMENT_TEAM = ZJ29NYHTV5;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock123";
+ PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
diff --git a/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index c87d15a3..f3d88ace 100644
--- a/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/star_lock/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -40,7 +40,7 @@
= -100)) {
final knownDeviceIndex = _scanDevices.indexWhere((d) => d.id == device.id);
diff --git a/star_lock/lib/blue/io_type.dart b/star_lock/lib/blue/io_type.dart
index 76697485..5fdf5d82 100644
--- a/star_lock/lib/blue/io_type.dart
+++ b/star_lock/lib/blue/io_type.dart
@@ -1,17 +1,16 @@
-//TODO:发送指令类型
-import 'package:get/get.dart';
+//TODO:发送指令类型
enum CommandType {
addUser, //增加用户 = 0x3001
- deletUser , //删除用户 = 0x3002
- editUser , //修改用户 = 0x3003
- factoryDataReset , //恢复出厂设置 = 0x3004
- openLock , //开门 = 0x3005
+ deletUser, //删除用户 = 0x3002
+ editUser, //修改用户 = 0x3003
+ factoryDataReset, //恢复出厂设置 = 0x3004
+ openLock, //开门 = 0x3005
readLockStatusInfo, //读取锁状态信息 = 0x300A
transferPermissions, //转移权限 = 0x300B
reportDoorOpenRecord, //开门记录上报 = 0x3020
- generalExtendedCommond , // 通用扩展指令 = 0x3030
- getLockPublicKey , // 获取锁公钥 = 0x3090
+ generalExtendedCommond, // 通用扩展指令 = 0x3030
+ getLockPublicKey, // 获取锁公钥 = 0x3090
getLockPrivateKey, // 获取锁私钥 = 0x3091
calibrationTime, // 校时 = 0x30f0
synchronizingLocationInformation, // 同步位置信息 = 0x30f1
diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart
new file mode 100644
index 00000000..76798e79
--- /dev/null
+++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart
@@ -0,0 +1,188 @@
+class AuthorizedAdminSendEntity {
+ int? errorCode;
+ String? description;
+ String? errorMsg;
+ Data? data;
+
+ AuthorizedAdminSendEntity(
+ {this.errorCode, this.description, this.errorMsg, this.data});
+
+ AuthorizedAdminSendEntity.fromJson(Map json) {
+ errorCode = json['errorCode'];
+ description = json['description'];
+ errorMsg = json['errorMsg'];
+ data = json['data'] != null ? Data.fromJson(json['data']) : null;
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['errorCode'] = errorCode;
+ data['description'] = description;
+ data['errorMsg'] = errorMsg;
+ if (this.data != null) {
+ data['data'] = this.data!.toJson();
+ }
+ return data;
+ }
+}
+
+class Data {
+ int? receiverUid;
+ ReceiverUser? receiverUser;
+ int? keyId;
+
+ Data({this.receiverUid, this.receiverUser, this.keyId});
+
+ Data.fromJson(Map json) {
+ receiverUid = json['receiverUid'];
+ receiverUser = json['receiverUser'] != null
+ ? ReceiverUser.fromJson(json['receiverUser'])
+ : null;
+ keyId = json['keyId'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['receiverUid'] = receiverUid;
+ if (receiverUser != null) {
+ data['receiverUser'] = receiverUser!.toJson();
+ }
+ data['keyId'] = keyId;
+ return data;
+ }
+}
+
+class ReceiverUser {
+ String? email;
+ String? name;
+ String? updatedAt;
+ String? createdAt;
+ int? id;
+ String? profilePhotoUrl;
+ Phone? phone;
+ Cloud? cloud;
+
+ ReceiverUser(
+ {this.email,
+ this.name,
+ this.updatedAt,
+ this.createdAt,
+ this.id,
+ this.profilePhotoUrl,
+ this.phone,
+ this.cloud});
+
+ ReceiverUser.fromJson(Map json) {
+ email = json['email'];
+ name = json['name'];
+ updatedAt = json['updated_at'];
+ createdAt = json['created_at'];
+ id = json['id'];
+ profilePhotoUrl = json['profile_photo_url'];
+ phone = json['phone'] != null ? Phone.fromJson(json['phone']) : null;
+ cloud = json['cloud'] != null ? Cloud.fromJson(json['cloud']) : null;
+ }
+
+ Map toJson() {
+ final Map data = Map();
+ data['email'] = email;
+ data['name'] = name;
+ data['updated_at'] = updatedAt;
+ data['created_at'] = createdAt;
+ data['id'] = id;
+ data['profile_photo_url'] = profilePhotoUrl;
+ if (phone != null) {
+ data['phone'] = phone!.toJson();
+ }
+ if (cloud != null) {
+ data['cloud'] = cloud!.toJson();
+ }
+ return data;
+ }
+}
+
+class Phone {
+ int? userId;
+ String? phoneNumberHash;
+ String? phoneNumberEncrypt;
+ String? countryCode;
+ String? phoneNumberVerifiedAt;
+ String? updatedAt;
+ String? createdAt;
+ int? id;
+
+ Phone(
+ {this.userId,
+ this.phoneNumberHash,
+ this.phoneNumberEncrypt,
+ this.countryCode,
+ this.phoneNumberVerifiedAt,
+ this.updatedAt,
+ this.createdAt,
+ this.id});
+
+ Phone.fromJson(Map json) {
+ userId = json['user_id'];
+ phoneNumberHash = json['phone_number_hash'];
+ phoneNumberEncrypt = json['phone_number_encrypt'];
+ countryCode = json['country_code'];
+ phoneNumberVerifiedAt = json['phone_number_verified_at'];
+ updatedAt = json['updated_at'];
+ createdAt = json['created_at'];
+ id = json['id'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['user_id'] = userId;
+ data['phone_number_hash'] = phoneNumberHash;
+ data['phone_number_encrypt'] = phoneNumberEncrypt;
+ data['country_code'] = countryCode;
+ data['phone_number_verified_at'] = phoneNumberVerifiedAt;
+ data['updated_at'] = updatedAt;
+ data['created_at'] = createdAt;
+ data['id'] = id;
+ return data;
+ }
+}
+
+class Cloud {
+ String? username;
+ String? password;
+ int? cloudUid;
+ int? userId;
+ String? updatedAt;
+ String? createdAt;
+ int? id;
+
+ Cloud(
+ {this.username,
+ this.password,
+ this.cloudUid,
+ this.userId,
+ this.updatedAt,
+ this.createdAt,
+ this.id});
+
+ Cloud.fromJson(Map json) {
+ username = json['username'];
+ password = json['password'];
+ cloudUid = json['cloud_uid'];
+ userId = json['user_id'];
+ updatedAt = json['updated_at'];
+ createdAt = json['created_at'];
+ id = json['id'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['username'] = username;
+ data['password'] = password;
+ data['cloud_uid'] = cloudUid;
+ data['user_id'] = userId;
+ data['updated_at'] = updatedAt;
+ data['created_at'] = createdAt;
+ data['id'] = id;
+ return data;
+ }
+}
diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart
index 01d2e090..510f92a0 100644
--- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart
+++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart
@@ -4,14 +4,17 @@ import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:star_lock/blue/io_type.dart';
import '../../../../blue/blue_manage.dart';
+import '../../../../blue/io_protocol/io_addUser.dart';
import '../../../../blue/io_reply.dart';
import '../../../../blue/io_protocol/io_transferPermissions.dart';
import '../../../../blue/io_tool/io_manager.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 '../../../../tools/baseGetXController.dart';
import '../../../../tools/storage.dart';
+import '../../../../tools/toast.dart';
import 'authorizedAdmin_state.dart';
class AuthorizedAdminLogic extends BaseGetXController {
@@ -20,9 +23,8 @@ class AuthorizedAdminLogic extends BaseGetXController {
// 监听设备返回的数据
late StreamSubscription _replySubscription;
void _initReplySubscription() {
- _replySubscription =
- EventBusManager().eventBus!.on().listen((reply) async {
- // 开门
+ _replySubscription = EventBusManager().eventBus!.on().listen((reply) async {
+ // 转移权限
if (reply is TransferPermissionsReply) {
var token = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(token);
@@ -77,9 +79,79 @@ class AuthorizedAdminLogic extends BaseGetXController {
break;
}
}
+
+ if(reply is AddUserReply) {
+ _replyAddUserKey(reply);
+ }
});
}
+ Future _replyAddUserKey(Reply reply) async {
+ var lockId = reply.data.sublist(2, 42);
+ print("lockId:$lockId");
+
+ var token = reply.data.sublist(42, 46);
+ List strTokenList = changeIntListToStringList(token);
+ Storage.setStringList(saveBlueToken, strTokenList);
+ print("token:$token");
+
+ int status = reply.data[46];
+ print("status:$status");
+
+ // userNo = reply.data[46];
+ print("status:$status");
+ switch(status){
+ case 0x00:
+ //成功
+ print("添加用户数据解析成功");
+ state.isSendSuccess.value = true;
+ Toast.show(msg: "添加成功");
+ // bindBlueAdmin();
+ break;
+ case 0x06:
+ //无权限
+ print("需要鉴权");
+ var privateKey = await Storage.getStringList(saveBluePrivateKey);
+ List getPrivateKeyList = changeStringListToIntList(privateKey!);
+
+ var publicKey = await Storage.getStringList(saveBluePublicKey);
+ List publicKeyDataList = changeStringListToIntList(publicKey!);
+
+ IoSenderManage.senderAddUser(
+ 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("用户无权限");
+
+ break;
+ case 0x09:
+ // 权限校验错误
+ print("添加用户权限校验错误");
+
+ break;
+ default:
+ //失败
+ print("领锁失败");
+
+ break;
+ }
+ }
+
// 转移权限
Future transferPermissionsAction() async {
BlueManage().judgeReconnect(
@@ -110,6 +182,87 @@ class AuthorizedAdminLogic extends BaseGetXController {
});
}
+ // 添加用户
+ Future addUserConnectBlue(String receiveId) async {
+ // 进来之后首先连接
+ BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connecteState) async {
+ if (connecteState == DeviceConnectionState.connected){
+ // 私钥
+ var privateKey = await Storage.getStringList(saveBluePrivateKey);
+ List getPrivateKeyList = changeStringListToIntList(privateKey!);
+
+ var publicKey = await Storage.getStringList(saveBluePublicKey);
+ List publicKeyDataList = changeStringListToIntList(publicKey!);
+
+ var token = await Storage.getStringList(saveBlueToken);
+ List getTokenList = [0,0,0,0];
+ if(token != null){
+ getTokenList = changeStringListToIntList(token);
+ }
+
+ IoSenderManage.senderAddUser(
+ lockID: BlueManage().connectDeviceName,
+ authUserID:await Storage.getUid(),
+ keyID:"1",
+ userID:receiveId,
+ openMode:1,
+ keyType:(state.type.value == "1") ? 0 : 1,
+ startDate:state.effectiveDateTime.value.millisecondsSinceEpoch,
+ expireDate:state.failureDateTime.value.millisecondsSinceEpoch,
+ role:0,
+ password:"123456",
+ needAuthor:1,
+ publicKey:publicKeyDataList,
+ privateKey:getPrivateKeyList,
+ token: getTokenList
+ );
+ }
+ });
+ }
+
+ //发送授权管理员列表请求
+ Future sendElectronicKeyRequest() async {
+ String getFailureDateTime = '0';
+ String getEffectiveDateTime = '0';
+ String lockID = state.keyInfo.value.lockId.toString();
+ String getKeyType = (int.parse(state.type.value) + 1).toString();
+ if (state.type.value == '0') {
+ getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString();
+ getEffectiveDateTime =
+ state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
+ }
+ var entity = await ApiRepository.to.sendElectronicKey(
+ state.isCreateUser.value ? "1" : "0",
+ state.countryCode.value,
+ '1',
+ getFailureDateTime,
+ state.isAuthentication.value == true ? '1' : '2',
+ '2',
+ '2',
+ state.keyNameController.text,
+ '1',
+ getKeyType,
+ lockID,
+ '',
+ state.emailOrPhoneController.text,
+ '',
+ getEffectiveDateTime,
+ state.weekdaysList);
+ if (entity.errorCode!.codeIsSuccessful) {
+ print('发送电子钥匙成功');
+ state.isSendSuccess.value = true;
+ Toast.show(msg: "添加成功");
+ // addUserConnectBlue(entity.data!.receiverUser!.id.toString());
+ } else {
+ // Toast.show(msg: '${entity.errorMsg}');
+ if (entity.errorCode == 425) {
+ //用户未注册
+ state.isCreateUser.value = true;
+ sendElectronicKeyRequest();
+ }
+ }
+ }
+
@override
void onReady() {
// TODO: implement onReady
diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart
index b364dfe4..3005c297 100644
--- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart
+++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_page.dart
@@ -30,56 +30,57 @@ class _AuthorizedAdminPageState extends State {
final logic = Get.put(AuthorizedAdminLogic());
final state = Get.find().state;
- final FlutterContactPicker _contactPicker = FlutterContactPicker();
- late Contact _contact;
- late KeyInfos keyInfo;
- late LockMainEntity lockMainEntity;
- bool _isAuthentication = false; //是否可以实名认证
- var _selectEffectiveDate = ''; //生效时间
- var _selectFailureDate = ''; //失效时间
- late DateTime _effectiveDateTime;
- late DateTime _failureDateTime;
- final TextEditingController _emailOrPhoneController =
- TextEditingController(); //邮箱/手机号输入框
- final TextEditingController _keyNameController =
- TextEditingController(); //钥匙名输入框
- late bool _isSendSuccess;
- String countryName = '中国';
- String countryCode = '86';
- List weekdaysList = [];
- bool _isCreateUser = false; //用户未注册时传1 已注册传0
+ // final FlutterContactPicker _contactPicker = FlutterContactPicker();
+ // late Contact _contact;
+ // late KeyInfos keyInfo;
+ // late LockMainEntity lockMainEntity;
+ // bool _isAuthentication = false; //是否可以实名认证
+ // var _selectEffectiveDate = ''; //生效时间
+ // var _selectFailureDate = ''; //失效时间
+ // late DateTime _effectiveDateTime;
+ // late DateTime _failureDateTime;
+ // final TextEditingController _emailOrPhoneController =
+ // TextEditingController(); //邮箱/手机号输入框
+ // final TextEditingController _keyNameController =
+ // TextEditingController(); //钥匙名输入框
+ // late bool _isSendSuccess;
+ // String countryName = '中国';
+ // String countryCode = '86';
+ // List weekdaysList = [];
@override
void initState() {
super.initState();
- DateTime dateTime = DateTime.now();
- _effectiveDateTime = dateTime;
- _failureDateTime = dateTime;
- _selectEffectiveDate =
- '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
- _selectFailureDate =
- '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
- _isSendSuccess = false;
+ // DateTime dateTime = DateTime.now();
+ // _effectiveDateTime = dateTime;
+ // _failureDateTime = dateTime;
+ // _selectEffectiveDate =
+ // '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
+ // _selectFailureDate =
+ // '${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
+ // _isSendSuccess = false;
}
@override
Widget build(BuildContext context) {
- dynamic obj = ModalRoute.of(context)?.settings.arguments;
- if (obj != null && (obj["lockMainEntity"] != null)) {
- lockMainEntity = obj["lockMainEntity"];
- }
- if (obj != null && (obj["keyInfo"] != null)) {
- keyInfo = obj["keyInfo"];
- }
+ // dynamic obj = ModalRoute.of(context)?.settings.arguments;
+ // if (obj != null && (obj["lockMainEntity"] != null)) {
+ // lockMainEntity = obj["lockMainEntity"];
+ // }
+ // if (obj != null && (obj["keyInfo"] != null)) {
+ // keyInfo = obj["keyInfo"];
+ // }
+
+ state.type.value = widget.type;
return SingleChildScrollView(
- child: indexChangeWidget(),
+ child: Obx(() => indexChangeWidget()),
);
}
Widget indexChangeWidget() {
- if (_isSendSuccess) {
+ if (state.isSendSuccess.value) {
return sendElectronicKeySucceed();
} else {
switch (int.parse(widget.type)) {
@@ -128,7 +129,7 @@ class _AuthorizedAdminPageState extends State {
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
- '$countryName +$countryCode',
+ '${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
@@ -137,8 +138,8 @@ class _AuthorizedAdminPageState extends State {
var result = await Navigator.pushNamed(
context, Routers.seletCountryRegionPage);
result as Map;
- countryCode = result['code'];
- countryName = result['countryName'];
+ state.countryCode.value = result['code'];
+ state.countryName.value = result['countryName'];
setState(() {});
},
),
@@ -159,30 +160,30 @@ class _AuthorizedAdminPageState extends State {
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
- rightTitle: _selectEffectiveDate,
+ rightTitle: state.selectEffectiveDate.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
- _selectEffectiveDate =
+ state.selectEffectiveDate.value =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
- _effectiveDateTime = DateTime.parse(_selectEffectiveDate);
+ state.effectiveDateTime.value = DateTime.parse(state.selectEffectiveDate.value);
});
});
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
- rightTitle: _selectFailureDate,
+ rightTitle: state.selectFailureDate.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
onConfirm: (p) {
setState(() {
- _selectFailureDate =
+ state.selectFailureDate.value =
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}';
- _failureDateTime = DateTime.parse(_selectFailureDate);
+ state.failureDateTime.value = DateTime.parse(state.selectFailureDate.value);
});
});
}),
@@ -231,9 +232,9 @@ class _AuthorizedAdminPageState extends State {
btnName: TranslationLoader.lanKeys!.send!.tr,
onClick: () {
//发送钥匙请求
- if (_emailOrPhoneController.text.isNotEmpty &&
- _keyNameController.text.isNotEmpty) {
- sendElectronicKeyRequest();
+ if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.value.text.isNotEmpty) {
+ // logic.addUserConnectBlue();
+ logic.sendElectronicKeyRequest();
}
}),
Container(
@@ -301,7 +302,7 @@ class _AuthorizedAdminPageState extends State {
SubmitBtn(
btnName: '完成',
onClick: () {
- _isSendSuccess = false;
+ state.isSendSuccess.value = false;
Navigator.pop(context, true);
}),
SizedBox(
@@ -336,7 +337,7 @@ class _AuthorizedAdminPageState extends State {
//标记房间为已入住 isOn:已入住: 1 空闲:2
Future updateRoomCheckIn() async {
var entity = await ApiRepository.to
- .updateSetting(keyInfo.lockId.toString(), '1', '13');
+ .updateSetting(state.keyInfo.value.lockId.toString(), '1', '13');
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
Toast.show(msg: "标记成功");
@@ -358,7 +359,7 @@ class _AuthorizedAdminPageState extends State {
//输入框一行
maxLines: 1,
controller:
- lineIndex == 1 ? _emailOrPhoneController : _keyNameController,
+ lineIndex == 1 ? state.emailOrPhoneController : state.keyNameController,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
@@ -388,9 +389,9 @@ class _AuthorizedAdminPageState extends State {
alignment: Alignment.center,
child: InkWell(
onTap: () async {
- Contact? contact = await _contactPicker.selectContact();
+ Contact? contact = await state.contactPicker.selectContact();
setState(() {
- _contact = contact!;
+ state.contact = contact!;
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}");
});
},
@@ -403,46 +404,46 @@ class _AuthorizedAdminPageState extends State {
}
//发送授权管理员列表请求
- Future sendElectronicKeyRequest() async {
- String getFailureDateTime = '0';
- String getEffectiveDateTime = '0';
- String lockID = keyInfo.lockId.toString();
- String getKeyType = (int.parse(widget.type) + 1).toString();
- if (widget.type == '0') {
- getFailureDateTime = _failureDateTime.millisecondsSinceEpoch.toString();
- getEffectiveDateTime =
- _effectiveDateTime.millisecondsSinceEpoch.toString();
- }
- var entity = await ApiRepository.to.sendElectronicKey(
- _isCreateUser ? "1" : "0",
- countryCode,
- '1',
- getFailureDateTime,
- _isAuthentication == true ? '1' : '2',
- '2',
- '2',
- _keyNameController.text,
- '1',
- getKeyType,
- lockID,
- '',
- _emailOrPhoneController.text,
- '',
- getEffectiveDateTime,
- weekdaysList);
- if (entity.errorCode!.codeIsSuccessful) {
- print('发送电子钥匙成功');
- _isSendSuccess = true;
- setState(() {});
- } else {
- Toast.show(msg: '${entity.errorMsg}');
- if (entity.errorCode == 425) {
- //用户未注册
- _isCreateUser = true;
- sendElectronicKeyRequest();
- }
- }
- }
+ // Future sendElectronicKeyRequest() async {
+ // String getFailureDateTime = '0';
+ // String getEffectiveDateTime = '0';
+ // String lockID = state.keyInfo.value.lockId.toString();
+ // String getKeyType = (int.parse(widget.type) + 1).toString();
+ // if (widget.type == '0') {
+ // getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString();
+ // getEffectiveDateTime =
+ // state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
+ // }
+ // var entity = await ApiRepository.to.sendElectronicKey(
+ // state.isCreateUser.value ? "1" : "0",
+ // state.countryCode.value,
+ // '1',
+ // getFailureDateTime,
+ // state.isAuthentication.value == true ? '1' : '2',
+ // '2',
+ // '2',
+ // state.keyNameController.text,
+ // '1',
+ // getKeyType,
+ // lockID,
+ // '',
+ // state.emailOrPhoneController.text,
+ // '',
+ // getEffectiveDateTime,
+ // state.weekdaysList);
+ // if (entity.errorCode!.codeIsSuccessful) {
+ // print('发送电子钥匙成功');
+ // state.isSendSuccess.value = true;
+ // setState(() {});
+ // } else {
+ // Toast.show(msg: '${entity.errorMsg}');
+ // if (entity.errorCode == 425) {
+ // //用户未注册
+ // state.isCreateUser.value = true;
+ // sendElectronicKeyRequest();
+ // }
+ // }
+ // }
//实名认证
CupertinoSwitch _switch() {
@@ -450,10 +451,10 @@ class _AuthorizedAdminPageState extends State {
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
- value: _isAuthentication,
+ value: state.isAuthentication.value,
onChanged: (value) {
setState(() {
- _isAuthentication = !_isAuthentication;
+ state.isAuthentication.value = !state.isAuthentication.value;
});
},
);
diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart
index 6ab1b40d..335f7510 100644
--- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart
+++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_state.dart
@@ -1,4 +1,38 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
+import 'package:get/get.dart';
+
+import '../../../lockMian/entity/lockInfoEntity.dart';
+
class AuthorizedAdminState {
+ final TextEditingController emailOrPhoneController = TextEditingController(); //邮箱/手机号输入框
+ final TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
+ final FlutterContactPicker contactPicker = FlutterContactPicker();
+ late Contact contact;
+
+ var type = ''.obs;
+ final keyInfo = KeyInfos().obs;
+ final lockMainEntity = LockMainEntity().obs;
+ final isAuthentication = false.obs; //是否可以实名认证
+ DateTime dateTime = DateTime.now();
+ final effectiveDateTime = DateTime.now().obs;
+ final failureDateTime = DateTime.now().obs;
+
+ var selectEffectiveDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
+ var selectFailureDate = '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
+
+ var isSendSuccess = false.obs;
+ var countryName = '中国'.obs;
+ var countryCode = '86'.obs;
+ var weekdaysList = [].obs;
+ var isCreateUser = false.obs; //用户未注册时传1 已注册传0
+
+
+ AuthorizedAdminState() {
+ Map map = Get.arguments;
+ lockMainEntity.value = map["lockMainEntity"];
+ keyInfo.value = map["keyInfo"];
+ }
}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart
index 74dd5dde..6a9355ab 100644
--- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart
+++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_logic.dart
@@ -1,4 +1,6 @@
+import 'dart:async';
+
import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
@@ -11,6 +13,16 @@ typedef KeyClickCallback = void Function(List selet
class CheckingInAddStaffLogic extends BaseGetXController{
CheckingInAddStaffState state = CheckingInAddStaffState();
+ // 下级界面修改成功后传递数据
+ StreamSubscription? _getNumberEvent;
+ void _initLoadDataAction() {
+ // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
+ _getNumberEvent =
+ eventBus.on().listen((event) {
+ state.getDataPassword.value = event.number;
+ });
+ }
+
// 添加员工
void addStaffLoadData() async{
var attendanceWay = "";
@@ -51,11 +63,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
break;
}
- if(state.staffNameController.text.isEmpty){
- Toast.show(msg: "请输入姓名");
- return;
- }
-
var entity = await ApiRepository.to.addStaffData(
attendanceType: state.seletPrintingMethodType.value,
attendanceWay: attendanceWay,
@@ -72,11 +79,11 @@ class CheckingInAddStaffLogic extends BaseGetXController{
}
}
- // 考勤设置添加员工-选择钥匙
+ // 考勤设置添加员工-选择钥匙 1为APP,2为密码,3为卡,4为指纹,返回数据中,attendanceWay分别为用户名、密码、卡号、指纹号
void addStaffSeletKey(KeyClickCallback kyClickCallback) async{
var entity = await ApiRepository.to.addStaffSeletKeyData(
companyId: state.companyId.value,
- type:"1",
+ type:state.seletPrintingMethodType.value,
);
if(entity.errorCode!.codeIsSuccessful){
state.keyEntity.value = entity.data!;
@@ -124,11 +131,6 @@ class CheckingInAddStaffLogic extends BaseGetXController{
break;
}
- if(state.staffNameController.text.isEmpty){
- Toast.show(msg: "请输入姓名");
- return;
- }
-
var entity = await ApiRepository.to.editStaffData(
attendanceType: state.seletPrintingMethodType.value,
attendanceWay: attendanceWay,
@@ -146,12 +148,38 @@ class CheckingInAddStaffLogic extends BaseGetXController{
}
}
+ //获取密码请求
+ void getKeyboardPwdRequest() async {
+ if(state.staffNameController.text.isEmpty){
+ Toast.show(msg: "请输入姓名");
+ return;
+ }
+ var entity = await ApiRepository.to.getPasswordKey(
+ "0",
+ '0',
+ state.staffNameController.text,
+ 2.toString(),
+ '0',
+ state.getKeyInfosData.value.lockId.toString(),
+ '0',
+ "0",
+ '0');
+ if (entity.errorCode!.codeIsSuccessful) {
+ print('获取密码成功');
+ if (entity.data != null) {
+ state.getDataPassword.value = entity.data!.keyboardPwd!;
+ }
+ } else {
+ Toast.show(msg: '${entity.errorMsg}');
+ }
+ }
+
@override
void onReady() {
// TODO: implement onReady
super.onReady();
print("onReady()");
-
+ _initLoadDataAction();
}
@override
@@ -159,13 +187,14 @@ class CheckingInAddStaffLogic extends BaseGetXController{
// TODO: implement onInit
super.onInit();
print("onInit()");
-
}
@override
void onClose() {
// TODO: implement onClose
+ super.onClose();
+ _getNumberEvent!.cancel();
}
}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart
index 0ee9a749..aa261d99 100644
--- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart
+++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_page.dart
@@ -8,6 +8,7 @@ import '../../../../../tools/commonItem.dart';
import '../../../../../tools/showBottomSheetTool.dart';
import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart';
+import '../../../../../tools/toast.dart';
import '../../../../../translations/trans_lib.dart';
import 'checkingInAddStaff_logic.dart';
@@ -49,12 +50,10 @@ class _CheckingInAddStaffPageState extends State {
var list = ["APP", "密码", "卡", "指纹"];
_showSeletClockInType(list, "1");
})),
- SizedBox(
- height: 10.h,
- ),
- CommonItem(
- leftTitel:
- TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr,
+ SizedBox(height: 10.h,),
+ //员工是否有App、卡、钥匙、指纹必须显示
+ Obx(() => CommonItem(
+ leftTitel:addStaffGetIfHaveKey(),
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
@@ -72,9 +71,10 @@ class _CheckingInAddStaffPageState extends State {
});
}),
],
- )),
+ ))),
+ // 当选择App时显示 其他隐藏
Obx(() => Visibility(
- visible: state.appUnHaveAccount.value,
+ visible: (state.appUnHaveAccount.value && state.seletPrintingMethodType.value == "1") ? true : false,
child: Column(
children: [
CommonItem(
@@ -108,10 +108,77 @@ class _CheckingInAddStaffPageState extends State {
],
),
)),
+ // 当选择密码、卡、指纹时显示
+ Obx(() => Visibility(
+ visible: (state.seletPrintingMethodType.value != "1" && state.appUnHaveAccount.value) ? true : false,
+ child: CommonItem(
+ leftTitel: addStaffGetKeyType(),
+ isHaveLine: false,
+ isHaveRightWidget: true,
+ rightWidget: Row(
+ children: [
+ Obx(() => Text(state.getDataPassword.value, style: TextStyle(fontSize: 24.sp))),
+ SizedBox(width: 30.w,),
+ SizedBox(
+ width: 130.w,
+ height: 40.h,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(backgroundColor: AppColors.mainColor,),
+ child: Text(addStaffSeletKeyType(), style: TextStyle(color: Colors.white, fontSize: 22.sp)),
+ onPressed: () async {
+ switch(int.parse(state.seletPrintingMethodType.value)){
+ case 2:
+ // 获取密码
+ logic.getKeyboardPwdRequest();
+ break;
+ case 3:
+ // 卡
+ if(state.staffNameController.text.isEmpty){
+ Toast.show(msg: "请输入姓名");
+ return;
+ }
+
+ var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: {
+ "lockId": state.getKeyInfosData.value.lockId,
+ "keyType": 0,
+ "fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
+ "fromTypeTwoStaffName" :state.staffNameController.text
+ });
+ if(data != null) {
+
+ }
+ break;
+ case 4:
+ // 指纹
+ if(state.staffNameController.text.isEmpty){
+ Toast.show(msg: "请输入姓名");
+ return;
+ }
+
+ var data = await Get.toNamed(Routers.otherTypeKeyManagePage, arguments: {
+ "lockId": state.getKeyInfosData.value.lockId,
+ "keyType": 1,
+ "fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
+ "fromTypeTwoStaffName" :state.staffNameController.text
+ });
+ if(data != null) {
+
+ }
+ break;
+ break;
+ }
+
+ }
+ ),
+ ),
+ ],
+ )),
+ )),
+ // 当选择钥匙类型为有时 必显示
Obx(() => Visibility(
visible: !state.appUnHaveAccount.value,
child: CommonItem(
- leftTitel: TranslationLoader.lanKeys!.selectKey!.tr,
+ leftTitel: addStaffGetKeyType(),
rightTitle: state.seletKey.value,
isHaveLine: false,
isHaveDirection: true,
@@ -126,15 +193,18 @@ class _CheckingInAddStaffPageState extends State {
}),
)),
- SizedBox(
- height: 50.w,
- ),
+ SizedBox(height: 50.w),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
+ if(state.staffNameController.text.isEmpty){
+ Toast.show(msg: "请输入姓名");
+ return;
+ }
+
if(state.isAdd.value == "2"){
logic.editStaffLoadData();
}else{
@@ -191,13 +261,16 @@ class _CheckingInAddStaffPageState extends State {
data: list,
//选择事件的回调
clickCallBack: (int index, var str) {
- print("object:$index str:$str");
- if(type == "1"){
- state.seletPrintingMethodType.value = (index+1).toString();
- state.seletPrintingMethodStr.value = str.toString();
- }else{
- state.seletKey.value = str.toString();
- }
+ setState(() {
+ if(type == "1"){
+ state.seletPrintingMethodType.value = (index+1).toString();
+ state.seletPrintingMethodStr.value = str.toString();
+ state.getDataPassword.value = "";
+ }else{
+ state.seletKey.value = str.toString();
+ }
+ print("object:$index str:$str type:$type state.seletPrintingMethodType.value:${state.seletPrintingMethodType.value}");
+ });
});
}
@@ -224,4 +297,62 @@ class _CheckingInAddStaffPageState extends State {
),
);
}
+
+ String addStaffGetIfHaveKey(){
+ String title = "";
+ switch(int.parse(state.seletPrintingMethodType.value)){
+ case 1:
+ title = TranslationLoader.lanKeys!.whetherTheEmployeeHasAKey!.tr;
+ break;
+ case 2:
+ title = TranslationLoader.lanKeys!.whetherTheEmployeeHasPassword!.tr;
+ break;
+ case 3:
+ title = TranslationLoader.lanKeys!.whetherTheEmployeeHasCard!.tr;
+ break;
+ case 4:
+ title = TranslationLoader.lanKeys!.whetherTheEmployeeHasFingerprint!.tr;
+ break;
+ }
+ return title;
+ }
+
+ String addStaffGetKeyType(){
+ String title = "";
+ switch(int.parse(state.seletPrintingMethodType.value)){
+ case 1:
+ title = TranslationLoader.lanKeys!.accountNumber!.tr;
+ break;
+ case 2:
+ title = TranslationLoader.lanKeys!.password!.tr;
+ break;
+ case 3:
+ title = TranslationLoader.lanKeys!.card!.tr;
+ break;
+ case 4:
+ title = TranslationLoader.lanKeys!.fingerprint!.tr;
+ break;
+ }
+ return title;
+ }
+
+ String addStaffSeletKeyType(){
+ String title = "";
+ switch(int.parse(state.seletPrintingMethodType.value)){
+ case 1:
+ title = TranslationLoader.lanKeys!.getKey!.tr;
+ break;
+ case 2:
+ title = TranslationLoader.lanKeys!.getPassword!.tr;
+ break;
+ case 3:
+ title = TranslationLoader.lanKeys!.getCard!.tr;
+ break;
+ case 4:
+ title = TranslationLoader.lanKeys!.getFingerprint!.tr;
+ break;
+ }
+ return title;
+ }
+
}
diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart
index 9d54e524..171c1ba5 100644
--- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart
+++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaff_state.dart
@@ -25,6 +25,7 @@ class CheckingInAddStaffState{
final seletKey = "".obs;
final isAdd = "1".obs; // 1添加 2编辑
+ final getDataPassword = "".obs;
CheckingInAddStaffState() {
Map map = Get.arguments;
diff --git a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart
index 83642832..f4822c95 100644
--- a/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart
+++ b/star_lock/lib/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_page.dart
@@ -86,8 +86,8 @@ class _CheckingInStaffListPageState extends State {
child: Row(
children: [
SizedBox(width: 30.w,),
- CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
- // Image.asset('images/controls_user.png', width: 40.w, height: 40.w),
+ // CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
+ Image.asset('images/controls_user.png', width: 40.w, height: 40.w),
SizedBox(width: 30.w,),
Text(staffListItem.staffName!, style: TextStyle(fontSize: 24.sp)),
],
diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart
index 867d7287..cf2e3c45 100644
--- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart
+++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart
@@ -82,7 +82,7 @@ class LockDetailLogic extends BaseGetXController{
String? userId = '';
final data = await Storage.getString('userLoginData');
if (data != null && data.isNotEmpty) {
- userId = LoginEntity.fromJson(jsonDecode(data)).data!.userid.toString();
+ userId = LoginData.fromJson(jsonDecode(data)).userid.toString();
}
IoSenderManage.senderOpenLock(
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart
new file mode 100644
index 00000000..82a120f4
--- /dev/null
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart
@@ -0,0 +1,43 @@
+class AddFingerprintEntity {
+ int? errorCode;
+ String? description;
+ String? errorMsg;
+ Data? data;
+
+ AddFingerprintEntity(
+ {this.errorCode, this.description, this.errorMsg, this.data});
+
+ AddFingerprintEntity.fromJson(Map json) {
+ errorCode = json['errorCode'];
+ description = json['description'];
+ errorMsg = json['errorMsg'];
+ data = json['data'] != null ? Data.fromJson(json['data']) : null;
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['errorCode'] = errorCode;
+ data['description'] = description;
+ data['errorMsg'] = errorMsg;
+ if (this.data != null) {
+ data['data'] = this.data!.toJson();
+ }
+ return data;
+ }
+}
+
+class Data {
+ int? fingerprintId;
+
+ Data({this.fingerprintId});
+
+ Data.fromJson(Map json) {
+ fingerprintId = json['fingerprintId'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['fingerprintId'] = fingerprintId;
+ return data;
+ }
+}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart
index 1757ee52..064d628c 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_logic.dart
@@ -14,6 +14,7 @@ import '../../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../../blue/sender_manage.dart';
import '../../../../../network/api_repository.dart';
import '../../../../../tools/baseGetXController.dart';
+import '../../../../../tools/eventBusEventManage.dart';
import '../../../../../tools/storage.dart';
import '../../../../../tools/toast.dart';
import 'addFingerprint_state.dart';
@@ -56,6 +57,7 @@ class AddFingerprintLogic extends BaseGetXController {
//成功
print("${reply.commandType!.typeValue} 数据解析成功");
state.ifConnectScuess.value = true;
+ state.fingerprintNumber.value = reply.data.last.toString();
break;
case 0x06:
//无权限
@@ -218,7 +220,7 @@ class AddFingerprintLogic extends BaseGetXController {
);
if(entity.errorCode!.codeIsSuccessful){
Toast.show(msg: "添加成功");
- updateFingerprintUserNoLoadData("");
+ updateFingerprintUserNoLoadData(entity.data!.fingerprintId.toString());
}
}
@@ -231,6 +233,12 @@ class AddFingerprintLogic extends BaseGetXController {
);
if(entity.errorCode!.codeIsSuccessful){
Toast.show(msg: "添加成功");
+ if(state.fromType.value == 2){
+ // 回调指纹号
+ eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(fingerprintId));
+ }else if(state.fromType.value == 1){
+ eventBus.fire(OtherTypeRefreshListEvent());
+ }
Get.close(3);
}
}
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart
index 19896e12..b64e3e69 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_state.dart
@@ -13,6 +13,7 @@ class AddFingerprintState{
final isCoerced = "".obs;
final startDate = "".obs;
final weekDay = [].obs;
+ final fromType = 1.obs;
AddFingerprintState() {
Map map = Get.arguments;
@@ -26,5 +27,6 @@ class AddFingerprintState{
startDate.value = map["startDate"];
lockId.value = map["lockId"];
weekDay.value = map["weekDay"];
+ fromType.value = map["fromType"];
}
}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_page.dart
index 7644eedb..4aa66dc4 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_page.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_page.dart
@@ -80,6 +80,7 @@ class _AddFingerprintTipPageState extends State {
"isCoerced": state.isCoerced.value,
"startDate": state.startDate.value,
"weekDay": state.weekDay.value,
+ "fromType": state.fromType.value,
});
}),
),
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart
index 325fba5d..db79140c 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addFingerprint/addFingerprintTip/addFingerprintTip_state.dart
@@ -11,6 +11,7 @@ class AddFingerprintTipState{
final isCoerced = "".obs;
final startDate = "".obs;
final weekDay = [].obs;
+ final fromType = 1.obs;
AddFingerprintTipState() {
Map map = Get.arguments;
@@ -24,5 +25,6 @@ class AddFingerprintTipState{
startDate.value = map["startDate"];
lockId.value = map["lockId"];
weekDay.value = map["weekDay"];
+ fromType.value = map["fromType"];
}
}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart
new file mode 100644
index 00000000..c0794ecc
--- /dev/null
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart
@@ -0,0 +1,43 @@
+class AddICCardEntity {
+ int? errorCode;
+ String? description;
+ String? errorMsg;
+ Data? data;
+
+ AddICCardEntity(
+ {this.errorCode, this.description, this.errorMsg, this.data});
+
+ AddICCardEntity.fromJson(Map json) {
+ errorCode = json['errorCode'];
+ description = json['description'];
+ errorMsg = json['errorMsg'];
+ data = json['data'] != null ? Data.fromJson(json['data']) : null;
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['errorCode'] = errorCode;
+ data['description'] = description;
+ data['errorMsg'] = errorMsg;
+ if (this.data != null) {
+ data['data'] = this.data!.toJson();
+ }
+ return data;
+ }
+}
+
+class Data {
+ int? cardId;
+
+ Data({this.cardId});
+
+ Data.fromJson(Map json) {
+ cardId = json['cardId'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['cardId'] = cardId;
+ return data;
+ }
+}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart
index df44fec8..47844298 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_logic.dart
@@ -14,6 +14,7 @@ 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 '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/storage.dart';
import '../../../../tools/toast.dart';
import 'addICCard_state.dart';
@@ -44,12 +45,13 @@ class AddICCardLogic extends BaseGetXController{
Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[2];
- print("status:$status");
+ print("_replyAddFingerprintStatus:$status");
switch(status){
case 0x00:
//成功
print("${reply.commandType!.typeValue} 数据解析成功");
+ state.cardNumber.value = reply.data.last.toString();
state.ifConnectScuess.value = true;
break;
case 0x06:
@@ -95,11 +97,11 @@ class AddICCardLogic extends BaseGetXController{
Future _replyAddICCardConfirmation(Reply reply) async {
var token = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(token);
- print("_replyAddFingerprintReplyToken:$token");
+ print("_replyAddICCardConfirmationReplyToken:$token");
Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[2];
- print("status:$status");
+ print("_replyAddFingerprintstatus:$status");
switch(status){
case 0x00:
@@ -174,7 +176,7 @@ class AddICCardLogic extends BaseGetXController{
);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "添加成功");
- updateIdCardUserNoLoadData("0");
+ updateIdCardUserNoLoadData(entity.data!.cardId.toString());
}
}
@@ -186,7 +188,13 @@ class AddICCardLogic extends BaseGetXController{
);
if(entity.errorCode!.codeIsSuccessful){
Toast.show(msg: "添加成功");
- Get.close(3);
+ if(state.fromType.value == 2){
+ // 回调指纹号
+ eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(cardId));
+ }else if(state.fromType.value == 1){
+ eventBus.fire(OtherTypeRefreshListEvent());
+ }
+ Get.close(2);
}
}
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_page.dart
index 255494ba..1c65025e 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_page.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_page.dart
@@ -45,7 +45,9 @@ class _AddICCardPageState extends State {
color: AppColors.blackColor,
borderRadius: BorderRadius.circular(10.w),
),
- child: Center(child: Text("尝试连接设备...", style:TextStyle(color: Colors.white, fontSize: 24.sp))),
+ child: Center(
+ child: Obx(() => Text(state.ifConnectScuess.value ? "已连接到锁,请将卡靠近锁的读卡区" : "尝试连接设备...", style:TextStyle(color: Colors.white, fontSize: 24.sp)))
+ ),
),
],
),
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart
index fa8543db..5a2395de 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/addICCard/addICCard_state.dart
@@ -13,6 +13,7 @@ class AddICCardState{
final isCoerced = "".obs;
final startDate = "".obs;
final weekDay = [].obs;
+ final fromType = 0.obs;
AddICCardState() {
Map map = Get.arguments;
@@ -26,5 +27,6 @@ class AddICCardState{
startDate.value = map["startDate"];
lockId.value = map["lockId"];
weekDay.value = map["weekDay"];
+ fromType.value = map["fromType"];
}
}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart
index f246899d..1f46a29d 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_logic.dart
@@ -73,7 +73,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController {
}
- switch (state.fromType.value) {
+ switch (state.lockType.value) {
case 0:
// 卡
Get.toNamed(Routers.addICCardPage, arguments: {
@@ -86,6 +86,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController {
"isCoerced": state.isStressFingerprint.value ? "1" : "2",
"startDate": startDate,
"weekDay": state.weekdaysList.value,
+ "fromType": state.fromType.value,
});
// var entity = await ApiRepository.to.addICCardData(
@@ -117,6 +118,7 @@ class OtherTypeAddKeyLogic extends BaseGetXController {
"isCoerced": state.isStressFingerprint.value ? "1" : "2",
"startDate": startDate,
"weekDay": state.weekdaysList.value,
+ "fromType": state.fromType.value,
});
// var entity = await ApiRepository.to.addFingerprintsData(
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart
index 9e8a525e..aa6a42c7 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_page.dart
@@ -18,8 +18,10 @@ class OtherTypeAddKeyPage extends StatefulWidget {
final String seletType;
final int lockType; // 0卡 1指纹 2钥匙
final int lockId;
+ final int fromType;// // 1从添加钥匙列表进入 2从考勤添加员工入口进入
+ final String fromTypeTwoStaffName;// 从添加员工进入 传入员工名字
const OtherTypeAddKeyPage(
- {Key? key, required this.seletType, required this.lockType, required this.lockId}) : super(key: key);
+ {Key? key, required this.seletType, required this.lockType, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName}) : super(key: key);
@override
State createState() => _OtherTypeAddKeyPageState();
@@ -32,8 +34,9 @@ class _OtherTypeAddKeyPageState extends State {
@override
Widget build(BuildContext context) {
state.seletType.value = widget.seletType;
- state.fromType.value = widget.lockType;
+ state.lockType.value = widget.lockType;
state.lockId.value = widget.lockId;
+ state.nameController.text = widget.fromTypeTwoStaffName;
return indexChangeWidget();
}
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart
index 35d707df..c0e25752 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeAddKey/otherTypeAddKey_state.dart
@@ -6,7 +6,8 @@ import 'package:get/get.dart';
class OtherTypeAddKeyState{
final lockId = 0.obs;
final seletType = "0".obs;// 0永久 1显示 2循环
- final fromType = 0.obs;// 0卡 1指纹 2钥匙
+ final lockType = 0.obs;// 0卡 1指纹 2钥匙
+ final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
final isStressFingerprint = false.obs;
var beginTime = "".obs;// 开始时间
@@ -20,8 +21,8 @@ class OtherTypeAddKeyState{
final TextEditingController nameController = TextEditingController();
OtherTypeAddKeyState() {
- Map map = Get.arguments;
- lockId.value = map["lockId"];
- fromType.value = map["fromType"];
+ // Map map = Get.arguments;
+ // lockId.value = map["lockId"];
+ // fromType.value = map["fromType"];
}
}
\ No newline at end of file
diff --git a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart
index 26be1af0..38b89b6b 100644
--- a/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart
+++ b/star_lock/lib/main/lockDetail/otherTypeKey/otherTypeKeyDetail/otherTypeKeyDetail_page.dart
@@ -251,95 +251,95 @@ class _OtherTypeKeyDetailPageState extends State {
);
}
- Widget addControlsBtn(int type) {
- List widgetList = [];
- List