添加lockData逻辑,修改bug

This commit is contained in:
魏少阳 2023-11-01 17:28:59 +08:00
parent 58074e7786
commit 3be4a6b45f
84 changed files with 2445 additions and 1084 deletions

View File

@ -393,7 +393,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = DWNXC92BQ6;
DEVELOPMENT_TEAM = 7D53BZAN75;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@ -401,7 +401,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021";
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -528,7 +528,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = DWNXC92BQ6;
DEVELOPMENT_TEAM = 7D53BZAN75;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@ -536,7 +536,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021";
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -557,7 +557,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = DWNXC92BQ6;
DEVELOPMENT_TEAM = 7D53BZAN75;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@ -565,7 +565,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock20231021";
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.starLock";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@ -23,7 +23,7 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
@ -40,7 +40,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
@ -61,7 +61,7 @@
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
@ -78,7 +78,7 @@
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"

View File

@ -216,9 +216,9 @@ class BlueManage{
//
Future<void> judgeReconnect(String deviceMAC, String deviceName, ConnectStateCallBack? connectStateCallBack, {bool isShowLoading = true}) async {
print("11111111$deviceConnectionState");
// print("11111111$deviceConnectionState");
if(deviceConnectionState == DeviceConnectionState.connected){
print("2222222:$deviceConnectionState");
// print("2222222:$deviceConnectionState");
if(isShowLoading){
EasyLoading.show();
Future.delayed(const Duration(seconds: 10), () { //asynchronous delay

View File

@ -279,7 +279,15 @@ String asciiString(List<int> codeUnits) {
}
String utf8String(List<int> codeUnits) {
return utf8.decode(codeUnits);
codeUnits.reversed;
List<int> uniqueList = [];
for (int i = 0; i < codeUnits.length; i++) {
if (codeUnits[i] != 0) {
uniqueList.add(codeUnits[i]);
}
}
uniqueList.reversed;
return utf8.decode(uniqueList).toString();
}
bool compareTwoList({List<int>? list1, List<int>? list2}) {

View File

@ -3,7 +3,7 @@ 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';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class AuthorizedAdminState {
final TextEditingController emailOrPhoneController = TextEditingController(); ///
@ -13,8 +13,8 @@ class AuthorizedAdminState {
late Contact contact;
var type = ''.obs;
final keyInfo = KeyInfos().obs;
final lockMainEntity = LockMainEntity().obs;
final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs;
final isAuthentication = false.obs; //
DateTime dateTime = DateTime.now();
final effectiveDateTime = DateTime.now().obs;
@ -32,7 +32,7 @@ class AuthorizedAdminState {
var addUserId = ''.obs;
AuthorizedAdminState() {
Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
// lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"];
}
}

View File

@ -65,7 +65,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
onClick: () {
Navigator.pushNamed(context, Routers.authorizedAdminManagePage,
arguments: {
"lockMainEntity": state.lockMainEntity.value,
// "lockMainEntity": state.lockMainEntity.value,
"keyInfo": state.keyInfo.value
}).then((val) {
if (val != null) {
@ -188,12 +188,14 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
useDateStr = "永久";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
useDateStr = "单次";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';

View File

@ -1,10 +1,11 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class AuthorizedAdminListState {
final keyInfo = KeyInfos().obs;
final lockMainEntity = LockMainEntity().obs;
final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs;
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = <ElectronicKeyListItem>[].obs;
@ -12,7 +13,7 @@ class AuthorizedAdminListState {
AuthorizedAdminListState() {
Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
// lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"];
}
}

View File

@ -1,12 +1,11 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInDetail_entity.dart';
class CheckingInDetailState{
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
final staffId = 0.obs;

View File

@ -1,15 +1,14 @@
import 'package:date_format/date_format.dart';
import 'package:get/get.dart';
import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInListDay_entity.dart';
import 'checkingInListMonth_entity.dart';
class CheckingInListState{
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
final listType = "1".obs;// 1 2 3
@ -26,6 +25,6 @@ class CheckingInListState{
var noPunchTimes = "".obs;//
CheckingInListState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
getKeyInfosData.value = Get.arguments as LockListInfoItemEntity;
}
}

View File

@ -2,11 +2,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInSet_entity.dart';
class CheckingInSetState{
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
var isCustom = true.obs;

View File

@ -1,12 +1,11 @@
import 'package:get/get.dart';
import '../../../../tools/dateTool.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSet/checkingInSet_entity.dart';
class CheckingInSetWorkTimeState{
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final checkingInSetInfo = CheckingInSetInfo().obs;
final companyId = "".obs;

View File

@ -1,8 +1,6 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSet/checkingInSet_entity.dart';
class CheckingInSetWorkdaySetState{
@ -10,7 +8,7 @@ class CheckingInSetWorkdaySetState{
var isSingledayWeekend = 2.obs; // 0 1
var weekDays = <int>[].obs;//
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final checkingInSetInfo = CheckingInSetInfo().obs;
final companyId = "".obs;

View File

@ -2,12 +2,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../lockMian/entity/lockInfoEntity.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
import 'checkingInAddStaffSeletKey_entity.dart';
class CheckingInAddStaffState{
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
final staffListItemData = CheckingInAddStaffListItemEntity().obs;

View File

@ -1,11 +1,11 @@
import 'package:get/get.dart';
import '../../../../lockMian/entity/lockInfoEntity.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
import 'checkingInStaffList_entity.dart';
class CheckingInStaffManageState{
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
final staffListData = <CheckingInAddStaffListItemEntity>[].obs;

View File

@ -1,11 +1,11 @@
import 'package:get/get.dart';
import '../../../../lockMian/entity/lockInfoEntity.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
class CheckingInStaffDetailState{
final getKeyInfosData = KeyInfos().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
final companyId = "".obs;
final staffListItemData = CheckingInAddStaffListItemEntity().obs;

View File

@ -86,7 +86,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
onClick: () {
Navigator.pushNamed(
context, Routers.sendElectronicKeyManagePage, arguments: {
"lockMainEntity": state.lockMainEntity.value,
// "lockMainEntity": state.lockMainEntity.value,
"keyInfo": state.keyInfo.value
}).then((val) {
if (val != null) {
@ -277,12 +277,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
useDateStr = "永久";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
useDateStr = "单次";
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';

View File

@ -1,19 +1,20 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class ElectronicKeyListState {
TextEditingController searchController = TextEditingController(); ///
final keyInfo = KeyInfos().obs;
final lockMainEntity = LockMainEntity().obs;
final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs;
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = <ElectronicKeyListItem>[].obs;
ElectronicKeyListState() {
Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
// lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"];
}
}

View File

@ -1,7 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
class SendElectronicKeyState {
TextEditingController emailOrPhoneController =
@ -10,8 +11,8 @@ class SendElectronicKeyState {
final FlutterContactPicker contactPicker = FlutterContactPicker();
late Contact contact;
final keyInfo = KeyInfos().obs;
final lockMainEntity = LockMainEntity().obs;
final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs;
final isRemoteUnlock = false.obs; //
final isAuthentication = false.obs; //
@ -37,7 +38,7 @@ class SendElectronicKeyState {
SendElectronicKeyState() {
Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
// lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"];
}
}

View File

@ -33,15 +33,15 @@ class AutomaticBlockingLogic extends BaseGetXController{
}
var entity = await ApiRepository.to.setAutoUnlock(
lockId: state.getKeyInfosData.value.lockId.toString(),
autoLockTime:autoTime,
type: "1",
lockId: state.lockSetInfoData.value.lockId!,
autoLockTime:int.parse(autoTime),
type: 1,
);
if(entity.errorCode!.codeIsSuccessful){
state.autoLockTime.value = state.isOpen.value == false ? "0" : autoTime;
state.getKeyInfosData.value.autoLockTime = int.parse(autoTime);
state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond = int.parse(autoTime);
eventBus.fire(RefreshLockListInfoDataEvent());
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功");
}
}
@ -140,7 +140,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 29,
token: getTokenList,
@ -177,7 +177,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
}
print("autoTimeautoTimeautoTime:${autoTime}");
IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 29,
featureParaLength: 2,

View File

@ -2,10 +2,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class AutomaticBlockingState {
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
var isOpen = false.obs;//
var autoLockTime = "5".obs;
@ -13,16 +14,18 @@ class AutomaticBlockingState {
final TextEditingController timeController = TextEditingController();
AutomaticBlockingState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
isOpen.value = getKeyInfosData.value.autoLockTime! > -1 ? true : false;
autoLockTime.value = getKeyInfosData.value.autoLockTime!.toString();
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
if((getKeyInfosData.value.autoLockTime! > 0)
&& (getKeyInfosData.value.autoLockTime! != 5)
&& (getKeyInfosData.value.autoLockTime! != 10)
&& (getKeyInfosData.value.autoLockTime! != 15)
&& (getKeyInfosData.value.autoLockTime! != 30)
&& (getKeyInfosData.value.autoLockTime! != 60)){
isOpen.value = lockSetInfoData.value.lockSettingInfo!.autoLock! == 1 ? true : false;
autoLockTime.value = lockSetInfoData.value.lockSettingInfo!.autoLockSecond!.toString();
if((lockSetInfoData.value.lockSettingInfo!.autoLock! > 0)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 5)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 10)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 15)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 30)
&& (lockSetInfoData.value.lockSettingInfo!.autoLockSecond! != 60)){
isCustomLockTime.value = true;
timeController.text = autoLockTime.value;
}

View File

@ -0,0 +1,8 @@
import '../../../../../tools/baseGetXController.dart';
import 'basicInformation_state.dart';
class BasicInformationLogic extends BaseGetXController{
final BasicInformationState state = BasicInformationState();
}

View File

@ -2,16 +2,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import '../../lockSet/lockSetInfo_entity.dart';
import 'basicInformation_logic.dart';
class BasicInformationPage extends StatefulWidget {
const BasicInformationPage({Key? key}) : super(key: key);
@ -21,56 +19,37 @@ class BasicInformationPage extends StatefulWidget {
}
class _BasicInformationPageState extends State<BasicInformationPage> {
late String _groupName = "";
late KeyInfos keyInfo;
late LockMainEntity lockMainEntity;
late LockData _lockData;
final logic = Get.put(BasicInformationLogic());
final state = Get.find<BasicInformationLogic>().state;
@override
void initState() {
super.initState();
_groupName = '未分组';
}
// late String _groupName = "";
// late LockData _lockData;
//
// @override
// void initState() {
// super.initState();
// _groupName = '未分组';
// }
@override
Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["keyInfo"] != null)) {
keyInfo = obj["keyInfo"];
}
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.basicInformation!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: FutureBuilder<LockData>(
future: mockNetworkDataRequest(),
builder: (BuildContext context, AsyncSnapshot<LockData> snapshot) {
//
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
//
return const Text('请求失败');
} else {
//
final LockData itemData = snapshot.data!;
return Column(
children: [
Expanded(
child: ListView(
body: ListView(
children: [
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.lockNumber!.tr,
rightTitle: itemData.lockAlias,
rightTitle: state.lockBasicInfo.value.lockAlias,
allHeight: 70.h,
isHaveLine: true),
CommonItem(
leftTitel: "MAC/ID",
rightTitle: itemData.lockMac,
rightTitle: state.lockBasicInfo.value.lockAlias,
allHeight: 70.h,
isHaveLine: false),
SizedBox(
@ -79,18 +58,18 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
CommonItem(
leftTitel: TranslationLoader
.lanKeys!.electricQuantity!.tr,
rightTitle: "${itemData.electricQuantity}%",
rightTitle: "${state.lockBasicInfo.value.electricQuantity}%",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(context,
Routers.uploadElectricQuantityPage,
arguments: {'keyInfo': keyInfo});
arguments: {'lockSetInfoData': state.lockSetInfoData.value});
}),
CommonItem(
leftTitel: TranslationLoader
.lanKeys!.periodValidity!.tr,
rightTitle: getUseDateStr(_lockData),
rightTitle: getUseDateStr(state.lockBasicInfo.value),
allHeight: 70.h,
isHaveLine: false),
SizedBox(
@ -99,36 +78,37 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.lockName!.tr,
rightTitle: itemData.lockName,
rightTitle: state.lockBasicInfo.value.lockAlias,
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.editLockNamePage);
action: () async {
var data = await Get.toNamed(Routers.editLockNamePage, arguments: {'lockSetInfoData': state.lockSetInfoData.value});
if(data != null) {
setState(() {
state.lockBasicInfo.value = data["lockBasicInfo"];
});
}
}),
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.lockGrouping!.tr,
rightTitle: itemData.groupName == ""
? _groupName
: itemData.groupName,
// rightTitle: state.getKeyInfosData.value.groupName == "" ? _groupName : itemData.groupName,
isHaveLine: true,
isHaveDirection: true,
action: () async {
Navigator.pushNamed(
context, Routers.lockSeletGroupingPage,
arguments: {
'LockData': _lockData
'lockSetInfoData': state.lockSetInfoData.value
}).then((val) {
if (val != null) {
mockNetworkDataRequest();
// mockNetworkDataRequest();
setState(() {});
}
});
}),
CommonItem(
leftTitel: TranslationLoader
.lanKeys!.adminOpenLockPassword!.tr,
leftTitel: TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
@ -146,20 +126,12 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
Get.toNamed(Routers.unlockQRCodePage);
}),
],
),
),
],
)
);
}
} else {
// loading
return Container();
}
}));
}
//使
String getUseDateStr(LockData indexEntity) {
String getUseDateStr(LockBasicInfo indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
@ -202,16 +174,16 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
return keyTypeStr;
}
//
Future<LockData> mockNetworkDataRequest() async {
KeyDetailEntity entity =
await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
// print("电子钥匙列表成功:${entity.data?.itemList}");
_lockData = entity.data!;
return entity.data!;
}
LockData data = LockData();
return data;
}
// //
// Future<LockData> mockNetworkDataRequest() async {
// KeyDetailEntity entity =
// await ApiRepository.to.getKeyDetail(keyInfo.lockId.toString());
// if (entity.errorCode!.codeIsSuccessful) {
// // print("电子钥匙列表成功:${entity.data?.itemList}");
// _lockData = entity.data!;
// return entity.data!;
// }
// LockData data = LockData();
// return data;
// }
}

View File

@ -0,0 +1,18 @@
import 'package:get/get.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class BasicInformationState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var groupName = "未分组".obs;
BasicInformationState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
}
}

View File

@ -0,0 +1,27 @@
import 'package:get/get.dart';
import '../../../../../network/api_repository.dart';
import '../../../../../tools/baseGetXController.dart';
import '../../../../../tools/toast.dart';
import '../../../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'editLockName_state.dart';
class EditLockNameLogic extends BaseGetXController{
final EditLockNameState state = EditLockNameState();
//
Future<void> modifyKeyNameRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to.updateLockName(
lockId: state.lockSetInfoData.value.lockId.toString(),
lockName:state.changeLockNameController.text);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "修改成功");
state.lockBasicInfo.value.lockAlias = state.changeLockNameController.text;
Get.back(result: {
"lockBasicInfo":state.lockBasicInfo.value
});
}
}
}

View File

@ -2,15 +2,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/tf_loginInput.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import 'editLockName_logic.dart';
class EditLockNamePage extends StatefulWidget {
const EditLockNamePage({Key? key}) : super(key: key);
@ -20,24 +17,8 @@ class EditLockNamePage extends StatefulWidget {
}
class _EditLockNamePageState extends State<EditLockNamePage> {
final TextEditingController _changeLockNameController =
TextEditingController();
@override
void initState() {
super.initState();
_changeLockNameController.text = "MCBN0c_8f3106";
}
//
Future<void> modifyKeyNameRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to
.modifyKeyName('63', '28', _changeLockNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) {
print("修改锁名称成功啦啦啦啦啦");
Toast.show(msg: "修改成功");
}
}
final logic = Get.put(EditLockNameLogic());
final state = Get.find<EditLockNameLogic>().state;
@override
Widget build(BuildContext context) {
@ -54,7 +35,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
modifyKeyNameRequest();
logic.modifyKeyNameRequest();
},
),
],
@ -62,7 +43,7 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
body: Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: LoginInput(
controller: _changeLockNameController,
controller: state.changeLockNameController,
leftWidget: const SizedBox(),
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
inputFormatters: [

View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class EditLockNameState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
final TextEditingController changeLockNameController = TextEditingController();
EditLockNameState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
changeLockNameController.text = lockBasicInfo.value.lockAlias!;
}
}

View File

@ -0,0 +1,72 @@
class LockGroupListEntity {
int? errorCode;
String? description;
String? errorMsg;
LockGroupData? data;
LockGroupListEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
LockGroupListEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? LockGroupData.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class LockGroupData {
List<LockGroupItem>? itemList;
LockGroupData({this.itemList});
LockGroupData.fromJson(Map<String, dynamic> json) {
if (json['list'] != null) {
itemList = <LockGroupItem>[];
json['list'].forEach((v) {
itemList!.add(LockGroupItem.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (itemList != null) {
data['list'] = itemList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class LockGroupItem {
int? lockNum;
int? keyGroupId;
String? keyGroupName;
LockGroupItem({this.lockNum, this.keyGroupId, this.keyGroupName});
LockGroupItem.fromJson(Map<String, dynamic> json) {
lockNum = json['lockNum'];
keyGroupId = json['keyGroupId'];
keyGroupName = json['keyGroupName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lockNum'] = lockNum;
data['keyGroupId'] = keyGroupId;
data['keyGroupName'] = keyGroupName;
return data;
}
}

View File

@ -0,0 +1,64 @@
import 'package:get/get.dart';
import '../../../../../network/api_repository.dart';
import '../../../../../tools/baseGetXController.dart';
import '../../../../../tools/toast.dart';
import '../../../electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'lockSeletGrouping_state.dart';
class LockSeletGroupingLogic extends BaseGetXController {
final LockSeletGroupingState state = LockSeletGroupingState();
//
Future<void> addLockGroupRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.addLockGroup(state.changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "创建成功");
mockNetworkDataRequest();
}
}
//
Future<void> setLockGroupRequest(GroupListItem itemData) async {
MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
state.lockSetInfoData.value.lockId.toString(), itemData.keyGroupId.toString());
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "设置锁分组成功");
state.lockBasicInfo.value.groupId = itemData.keyGroupId;
mockNetworkDataRequest();
}
}
//
void mockNetworkDataRequest() async {
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
if (entity.errorCode!.codeIsSuccessful) {
state.groupList.value = entity.data!.groupList!;
}
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
print("onReady()");
mockNetworkDataRequest();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
print("lockDetail_onInit()");
}
@override
void onClose() {
// TODO: implement onClose
}
}

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/showTFView.dart';
@ -10,9 +9,11 @@ import 'package:star_lock/tools/toast.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/commonItem.dart';
import '../../../../../tools/noData.dart';
import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import 'lockSeletGrouping_logic.dart';
class LockSeletGroupingPage extends StatefulWidget {
const LockSeletGroupingPage({Key? key}) : super(key: key);
@ -22,15 +23,11 @@ class LockSeletGroupingPage extends StatefulWidget {
}
class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
final TextEditingController _changeNameController = TextEditingController();
late LockData _lockData;
final logic = Get.put(LockSeletGroupingLogic());
final state = Get.find<LockSeletGroupingLogic>().state;
@override
Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["LockData"] != null)) {
_lockData = obj["LockData"];
}
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
@ -38,22 +35,9 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
barTitle: TranslationLoader.lanKeys!.selectGroup!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: FutureBuilder<List<GroupListItem>>(
future: mockNetworkDataRequest(),
builder: (BuildContext context,
AsyncSnapshot<List<GroupListItem>> snapshot) {
//
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
//
return const Text('请求失败');
} else {
//
final List<GroupListItem> itemData = snapshot.data!;
return Column(
body: Column(
children: [
Expanded(child: _buildMainUI(context, itemData)),
Expanded(child: _buildMainUI()),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.createNewGroup!.tr,
borderRadius: 20.w,
@ -68,21 +52,15 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
height: 40.h,
)
],
);
}
} else {
// loading
return Container();
}
}),
),
);
}
Widget _buildMainUI(BuildContext context, List itemList) {
return ListView.builder(
itemCount: itemList.length,
Widget _buildMainUI() {
return Obx(() => state.groupList.value.isNotEmpty ? ListView.builder(
itemCount: state.groupList.value.length,
itemBuilder: (c, index) {
GroupListItem itemData = itemList[index];
GroupListItem itemData = state.groupList.value[index];
return CommonItem(
leftTitel: itemData.keyGroupName,
rightTitle: "",
@ -90,7 +68,7 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: _lockData.groupId == itemData.keyGroupId
rightWidget: state.lockBasicInfo.value.groupId == itemData.keyGroupId
? Image(
image: const AssetImage("images/icon_item_checked.png"),
width: 30.w,
@ -99,47 +77,9 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
)
: Container(),
action: () {
Navigator.pop(context, true);
setLockGroupRequest(itemData);
logic.setLockGroupRequest(itemData);
});
});
}
//
Future<void> addLockGroupRequest() async {
MassSendLockGroupListEntity entity =
await ApiRepository.to.addLockGroup(_changeNameController.text, '0');
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "创建成功");
mockNetworkDataRequest();
setState(() {});
}
}
//
Future<void> setLockGroupRequest(GroupListItem itemData) async {
MassSendLockGroupListEntity entity = await ApiRepository.to.setLockGroup(
_lockData.lockId.toString(), itemData.keyGroupId.toString());
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: "设置锁分组成功");
mockNetworkDataRequest();
}
}
//
Future<List<GroupListItem>> mockNetworkDataRequest() async {
MassSendLockGroupListEntity entity =
await ApiRepository.to.lockGroupList('1');
if (entity.errorCode!.codeIsSuccessful) {
if (entity.data != null) {
return entity.data!.groupList!;
} else {
List<GroupListItem> dataList = [];
return dataList;
}
} else {
return [];
}
}) : const NoData());
}
void showCupertinoAlertDialog(BuildContext context) {
@ -149,11 +89,11 @@ class _LockSeletGroupingPageState extends State<LockSeletGroupingPage> {
return ShowTFView(
title: TranslationLoader.lanKeys!.createNewGroup!.tr,
tipTitle: TranslationLoader.lanKeys!.pleaseEnter!.tr,
controller: _changeNameController,
controller: state.changeNameController,
sureClick: () {
//
if (_changeNameController.text.isNotEmpty) {
addLockGroupRequest();
if (state.changeNameController.text.isNotEmpty) {
logic.addLockGroupRequest();
Navigator.pop(context);
} else {
Toast.show(msg: '请输入分组名称');

View File

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class LockSeletGroupingState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var groupList = <GroupListItem>[].obs;
final TextEditingController changeNameController = TextEditingController();
LockSeletGroupingState() {
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
}
}

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
@ -11,6 +10,7 @@ import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class UploadElectricQuantityPage extends StatefulWidget {
const UploadElectricQuantityPage({Key? key}) : super(key: key);
@ -20,14 +20,13 @@ class UploadElectricQuantityPage extends StatefulWidget {
_UploadElectricQuantityPageState();
}
class _UploadElectricQuantityPageState
extends State<UploadElectricQuantityPage> {
late KeyInfos keyInfo;
class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage> {
late LockSetInfoData lockSetInfoData;
//
Future<void> uploadElectricQuantityRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to
.uploadElectricQuantity('100', keyInfo.lockId.toString());
.uploadElectricQuantity('100', lockSetInfoData.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
print("锁电量更新成功啦啦啦啦啦");
Toast.show(msg: "锁电量更新成功");
@ -37,8 +36,8 @@ class _UploadElectricQuantityPageState
@override
Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["keyInfo"] != null)) {
keyInfo = obj["keyInfo"];
if (obj != null && (obj["lockSetInfoData"] != null)) {
lockSetInfoData = obj["lockSetInfoData"];
}
return Scaffold(

View File

@ -7,7 +7,6 @@ import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.da
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_reply.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';
@ -22,18 +21,16 @@ class BurglarAlarmLogic extends BaseGetXController{
// ->
Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
changeType:"1",
isOn:state.burglarAlarmEnable.value == 1 ? "2" : "1", // 1-2-;
type:"3", // 3
var entity = await ApiRepository.to.setBurglarAlarmData(
lockId: state.lockSetInfoData.value.lockId!,
antiPrySwitch:state.burglarAlarmEnable.value == 1 ? 0 : 1, // 1-2-;
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 2 : 1;
state.getKeyInfosData.value.tamperAlert = state.burglarAlarmEnable.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
state.burglarAlarmEnable.value = state.burglarAlarmEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.antiPrySwitch = state.burglarAlarmEnable.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功");
}
}
@ -127,7 +124,7 @@ class BurglarAlarmLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 30,
token: getTokenList,
@ -153,7 +150,7 @@ class BurglarAlarmLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 30,
featureEnable: state.burglarAlarmEnable.value == 1 ? 0 : 1,

View File

@ -1,16 +1,18 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class BurglarAlarmState{
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
var burglarAlarmEnable = 1.obs;
var burglarAlarmEnable = 0.obs;
BurglarAlarmState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
burglarAlarmEnable.value = getKeyInfosData.value.tamperAlert!;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
burglarAlarmEnable.value = lockSetInfoData.value.lockSettingInfo!.antiPrySwitch!;
}
}

View File

@ -13,7 +13,7 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
//
void setCheckInCreateCompany() async{
var entity = await ApiRepository.to.setCheckInCreateCompanyData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
attendanceType: state.isCustom.value ? "0" :"1",
companyName: state.companyNameController.text,
workDay: state.weekDays.value,
@ -28,7 +28,7 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
//
void setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
changeType:"1",
isOn:"1",
type:"1",
@ -36,8 +36,8 @@ class CheckInCreatCompanyLogic extends BaseGetXController{
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.isAttendance = 1;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
state.lockSetInfoData.value.lockSettingInfo!.attendance = 1;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Get.back();
Toast.show(msg: "设置成功");
}

View File

@ -46,7 +46,7 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
isHaveDirection: true,
action: () async {
var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
"getKeyInfosData": state.lockSetInfoData.value,
"companyId": "1",
"pushType": "0",
"checkingInSetInfo": CheckingInSetInfo(),
@ -69,7 +69,7 @@ class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
isHaveDirection: true,
action: () async {
var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: {
"getKeyInfosData": state.getKeyInfosData.value,
"getKeyInfosData": state.lockSetInfoData.value,
"companyId": "0",
"pushType": "0",
"checkingInSetInfo": CheckingInSetInfo(),

View File

@ -2,10 +2,11 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class CheckInCreatCompanyState{
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
TextEditingController companyNameController = TextEditingController();
@ -19,6 +20,7 @@ class CheckInCreatCompanyState{
var beginTimeTimestamp = "".obs;//
var endTimeTimestamp = "".obs;//
CheckInCreatCompanyState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
}
}

View File

@ -108,7 +108,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
List<int> getTokenList = changeStringListToIntList(token!);
print("openDoorTokenPubToken:$getTokenList");
print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}");
// print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}");
IoSenderManage.senderConfiguringWifiCommand(
keyID: "1",
userID: await Storage.getUid(),

View File

@ -12,7 +12,7 @@ class DiagnoseLogic extends BaseGetXController{
//
Future<void> setLockDiagnose() async{
var entity = await ApiRepository.to.setLockDiagnoseData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
electricQuantity:"23",
firmwareRevision:"1.0", // 1-2-;
hardwareRevision:"1.3", // 4

View File

@ -1,12 +1,15 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class DiagnoseState{
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
DiagnoseState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
}
}

View File

@ -8,14 +8,14 @@ import 'lockEscalation_state.dart';
class LockEscalationLogic extends BaseGetXController{
LockEscalationState state = LockEscalationState();
//
//
Future<void> setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.getLockVersionInfoData(
lockId: state.getKeyInfosData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
}
// var entity = await ApiRepository.to.getLockVersionInfoData(
// lockId: state.getKeyInfosData.value.lockId.toString(),
// );
// if(entity.errorCode!.codeIsSuccessful){
//
// }
}
@override

View File

@ -1,8 +1,6 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
class LockEscalationState{
var getKeyInfosData = KeyInfos().obs;
}

View File

@ -0,0 +1,60 @@
class CheckingInInfoDataEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
CheckingInInfoDataEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
CheckingInInfoDataEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
int? workEndTime;
int? attendanceType;
int? companyId;
int? workStartTime;
List<int>? workDay;
Data(
{this.workEndTime,
this.attendanceType,
this.companyId,
this.workStartTime,
this.workDay});
Data.fromJson(Map<String, dynamic> json) {
workEndTime = json['workEndTime'];
attendanceType = json['attendanceType'];
companyId = json['companyId'];
workStartTime = json['workStartTime'];
workDay = json['workDay'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['workEndTime'] = workEndTime;
data['attendanceType'] = attendanceType;
data['companyId'] = companyId;
data['workStartTime'] = workStartTime;
data['workDay'] = workDay;
return data;
}
}

View File

@ -0,0 +1,490 @@
class LockSetInfoEntity {
int? errorCode;
String? description;
String? errorMsg;
LockSetInfoData? data;
LockSetInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
LockSetInfoEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? LockSetInfoData.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class LockSetInfoData {
int? lockId;
LockStatus? lockStatus;
LockFeature? lockFeature;
LockBasicInfo? lockBasicInfo;
LockSettingInfo? lockSettingInfo;
LockSetInfoData({
this.lockId,
this.lockStatus,
this.lockFeature,
this.lockBasicInfo,
this.lockSettingInfo});
LockSetInfoData.fromJson(Map<String, dynamic> json) {
lockId = json['lockId'];
lockStatus = json['lockStatus'] != null
? LockStatus.fromJson(json['lockStatus'])
: null;
lockFeature = json['lockFeature'] != null
? LockFeature.fromJson(json['lockFeature'])
: null;
lockBasicInfo = json['lockBasicInfo'] != null
? LockBasicInfo.fromJson(json['lockBasicInfo'])
: null;
lockSettingInfo = json['lockSettingInfo'] != null
? LockSettingInfo.fromJson(json['lockSettingInfo'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lockId'] = lockId;
if (lockStatus != null) {
data['lockStatus'] = lockStatus!.toJson();
}
if (lockFeature != null) {
data['lockFeature'] = lockFeature!.toJson();
}
if (lockBasicInfo != null) {
data['lockBasicInfo'] = lockBasicInfo!.toJson();
}
if (lockSettingInfo != null) {
data['lockSettingInfo'] = lockSettingInfo!.toJson();
}
return data;
}
}
class LockStatus {
int? roomStatus;
LockStatus({this.roomStatus});
LockStatus.fromJson(Map<String, dynamic> json) {
roomStatus = json['roomStatus'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['roomStatus'] = roomStatus;
return data;
}
}
class LockFeature {
int? password;
int? icCard;
int? fingerprint;
int? fingerVein;
int? palmVein;
int? d3Face;
int? qrCode;
int? bluetoothRemoteControl;
int? wirelessKey;
int? gatewayUnlock;
int? lockCommand;
int? firmwareUpgrade;
int? passwordIssue;
int? cardIssue;
int? fingerprintIssue;
int? fingerVeinIssue;
int? palmVeinIssue;
int? d3FaceIssue;
int? lockFreeze;
int? readAdminPassword;
int? passwordManagement;
int? passwordWithDelete;
int? remoteUnlock;
int? autoLock;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? languageSetting;
int? realTimeClock;
int? wifi;
int? videoIntercom;
int? cyclePassword;
int? cycleFingerprintCard;
int? doubleAuthentication;
int? openDirection;
int? proximitySensing;
int? doorStatus;
int? wiredDoorMagnet;
int? wirelessDoorMagnet;
int? doorNotClosedAlarm;
int? unlockReminder;
int? wirelessKeyboard;
int? lightingTime;
int? passageMode;
int? hotelLockCardSystem;
int? appUnlockOnline;
int? bluetoothBroadcast;
int? attendance;
LockFeature(
{this.password,
this.icCard,
this.fingerprint,
this.fingerVein,
this.palmVein,
this.d3Face,
this.qrCode,
this.bluetoothRemoteControl,
this.wirelessKey,
this.gatewayUnlock,
this.lockCommand,
this.firmwareUpgrade,
this.passwordIssue,
this.cardIssue,
this.fingerprintIssue,
this.fingerVeinIssue,
this.palmVeinIssue,
this.d3FaceIssue,
this.lockFreeze,
this.readAdminPassword,
this.passwordManagement,
this.passwordWithDelete,
this.remoteUnlock,
this.autoLock,
this.antiPrySwitch,
this.resetSwitch,
this.lockSwitch,
this.lockSound,
this.languageSetting,
this.realTimeClock,
this.wifi,
this.videoIntercom,
this.cyclePassword,
this.cycleFingerprintCard,
this.doubleAuthentication,
this.openDirection,
this.proximitySensing,
this.doorStatus,
this.wiredDoorMagnet,
this.wirelessDoorMagnet,
this.doorNotClosedAlarm,
this.unlockReminder,
this.wirelessKeyboard,
this.lightingTime,
this.passageMode,
this.hotelLockCardSystem,
this.appUnlockOnline,
this.bluetoothBroadcast,
this.attendance});
LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password'];
icCard = json['icCard'];
fingerprint = json['fingerprint'];
fingerVein = json['fingerVein'];
palmVein = json['palmVein'];
d3Face = json['d3Face'];
qrCode = json['qrCode'];
bluetoothRemoteControl = json['bluetoothRemoteControl'];
wirelessKey = json['wirelessKey'];
gatewayUnlock = json['gatewayUnlock'];
lockCommand = json['lockCommand'];
firmwareUpgrade = json['firmwareUpgrade'];
passwordIssue = json['passwordIssue'];
cardIssue = json['cardIssue'];
fingerprintIssue = json['fingerprintIssue'];
fingerVeinIssue = json['fingerVeinIssue'];
palmVeinIssue = json['palmVeinIssue'];
d3FaceIssue = json['d3FaceIssue'];
lockFreeze = json['lockFreeze'];
readAdminPassword = json['readAdminPassword'];
passwordManagement = json['passwordManagement'];
passwordWithDelete = json['passwordWithDelete'];
remoteUnlock = json['remoteUnlock'];
autoLock = json['autoLock'];
antiPrySwitch = json['antiPrySwitch'];
resetSwitch = json['resetSwitch'];
lockSwitch = json['lockSwitch'];
lockSound = json['lockSound'];
languageSetting = json['languageSetting'];
realTimeClock = json['realTimeClock'];
wifi = json['wifi'];
videoIntercom = json['videoIntercom'];
cyclePassword = json['cyclePassword'];
cycleFingerprintCard = json['cycleFingerprintCard'];
doubleAuthentication = json['doubleAuthentication'];
openDirection = json['openDirection'];
proximitySensing = json['proximitySensing'];
doorStatus = json['doorStatus'];
wiredDoorMagnet = json['wiredDoorMagnet'];
wirelessDoorMagnet = json['wirelessDoorMagnet'];
doorNotClosedAlarm = json['doorNotClosedAlarm'];
unlockReminder = json['unlockReminder'];
wirelessKeyboard = json['wirelessKeyboard'];
lightingTime = json['lightingTime'];
passageMode = json['passageMode'];
hotelLockCardSystem = json['hotelLockCardSystem'];
appUnlockOnline = json['appUnlockOnline'];
bluetoothBroadcast = json['bluetoothBroadcast'];
attendance = json['attendance'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['password'] = password;
data['icCard'] = icCard;
data['fingerprint'] = fingerprint;
data['fingerVein'] = fingerVein;
data['palmVein'] = palmVein;
data['d3Face'] = d3Face;
data['qrCode'] = qrCode;
data['bluetoothRemoteControl'] = bluetoothRemoteControl;
data['wirelessKey'] = wirelessKey;
data['gatewayUnlock'] = gatewayUnlock;
data['lockCommand'] = lockCommand;
data['firmwareUpgrade'] = firmwareUpgrade;
data['passwordIssue'] = passwordIssue;
data['cardIssue'] = cardIssue;
data['fingerprintIssue'] = fingerprintIssue;
data['fingerVeinIssue'] = fingerVeinIssue;
data['palmVeinIssue'] = palmVeinIssue;
data['d3FaceIssue'] = d3FaceIssue;
data['lockFreeze'] = lockFreeze;
data['readAdminPassword'] = readAdminPassword;
data['passwordManagement'] = passwordManagement;
data['passwordWithDelete'] = passwordWithDelete;
data['remoteUnlock'] = remoteUnlock;
data['autoLock'] = autoLock;
data['antiPrySwitch'] = antiPrySwitch;
data['resetSwitch'] = resetSwitch;
data['lockSwitch'] = lockSwitch;
data['lockSound'] = lockSound;
data['languageSetting'] = languageSetting;
data['realTimeClock'] = realTimeClock;
data['wifi'] = wifi;
data['videoIntercom'] = videoIntercom;
data['cyclePassword'] = cyclePassword;
data['cycleFingerprintCard'] = cycleFingerprintCard;
data['doubleAuthentication'] = doubleAuthentication;
data['openDirection'] = openDirection;
data['proximitySensing'] = proximitySensing;
data['doorStatus'] = doorStatus;
data['wiredDoorMagnet'] = wiredDoorMagnet;
data['wirelessDoorMagnet'] = wirelessDoorMagnet;
data['doorNotClosedAlarm'] = doorNotClosedAlarm;
data['unlockReminder'] = unlockReminder;
data['wirelessKeyboard'] = wirelessKeyboard;
data['lightingTime'] = lightingTime;
data['passageMode'] = passageMode;
data['hotelLockCardSystem'] = hotelLockCardSystem;
data['appUnlockOnline'] = appUnlockOnline;
data['bluetoothBroadcast'] = bluetoothBroadcast;
data['attendance'] = attendance;
return data;
}
}
class LockBasicInfo {
int? keyId;
String? model;
int? electricQuantity;
int? indate;
int? isLockOwner;
String? lockAlias;
int? groupId;
List<GroupData>? groupData;
String? adminPwd;
int? keyType;
int? startDate;
int? endDate;
LockBasicInfo(
{this.keyId,
this.model,
this.electricQuantity,
this.indate,
this.isLockOwner,
this.lockAlias,
this.groupId,
this.groupData,
this.adminPwd,
this.keyType,
this.startDate,
this.endDate,});
LockBasicInfo.fromJson(Map<String, dynamic> json) {
keyId = json['keyId'];
model = json['model'];
electricQuantity = json['electricQuantity'];
indate = json['indate'];
isLockOwner = json['isLockOwner'];
lockAlias = json['lockAlias'];
groupId = json['groupId'];
if (json['groupData'] != null) {
groupData = <GroupData>[];
json['groupData'].forEach((v) {
groupData!.add(GroupData.fromJson(v));
});
}
adminPwd = json['adminPwd'];
keyType = json['keyType'];
startDate = json['startDate'];
endDate = json['endDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['keyId'] = keyId;
data['model'] = model;
data['electricQuantity'] = electricQuantity;
data['indate'] = indate;
data['isLockOwner'] = isLockOwner;
data['lockAlias'] = lockAlias;
data['groupId'] = groupId;
if (groupData != null) {
data['groupData'] = groupData!.map((v) => v.toJson()).toList();
}
data['adminPwd'] = adminPwd;
data['keyType'] = keyType;
data['startDate'] = startDate;
data['endDate'] = endDate;
return data;
}
}
class GroupData {
int? id;
String? name;
GroupData({this.id, this.name});
GroupData.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['name'] = name;
return data;
}
}
class LockSettingInfo {
int? remoteUnlock;
int? autoLock;
int? autoLockSecond;
int? antiPrySwitch;
int? resetSwitch;
int? lockSwitch;
int? lockSound;
int? lockSoundVolume;
int? languageSettingLang;
int? openDirectionValue;
int? doorNotClosedAlarm;
int? unlockReminder;
int? lightingTime;
int? lightingSecond;
int? passageMode;
List<int>? passageModeConfig;
int? attendance;
int? appUnlockOnline;
int? bluetoothBroadcast;
String? adminPwd;
int? unlockReminderPush;
String? languageSettingLangText;
LockSettingInfo(
{this.remoteUnlock,
this.autoLock,
this.autoLockSecond,
this.antiPrySwitch,
this.resetSwitch,
this.lockSwitch,
this.lockSound,
this.lockSoundVolume,
this.languageSettingLang,
this.openDirectionValue,
this.doorNotClosedAlarm,
this.unlockReminder,
this.lightingTime,
this.lightingSecond,
this.passageMode,
this.passageModeConfig,
this.attendance,
this.appUnlockOnline,
this.bluetoothBroadcast,
this.adminPwd,
this.unlockReminderPush,
this.languageSettingLangText});
LockSettingInfo.fromJson(Map<String, dynamic> json) {
remoteUnlock = json['remoteUnlock'];
autoLock = json['autoLock'];
autoLockSecond = json['autoLockSecond'];
antiPrySwitch = json['antiPrySwitch'];
resetSwitch = json['resetSwitch'];
lockSwitch = json['lockSwitch'];
lockSound = json['lockSound'];
lockSoundVolume = json['lockSoundVolume'];
languageSettingLang = json['languageSettingLang'];
openDirectionValue = json['openDirectionValue'];
doorNotClosedAlarm = json['doorNotClosedAlarm'];
unlockReminder = json['unlockReminder'];
lightingTime = json['lightingTime'];
lightingSecond = json['lightingSecond'];
passageMode = json['passageMode'];
passageModeConfig = json['passageModeConfig'].cast<int>();
attendance = json['attendance'];
appUnlockOnline = json['appUnlockOnline'];
bluetoothBroadcast = json['bluetoothBroadcast'];
adminPwd = json['adminPwd'];
unlockReminderPush = json['unlockReminderPush'];
languageSettingLangText = json['languageSettingLangText'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['remoteUnlock'] = remoteUnlock;
data['autoLock'] = autoLock;
data['autoLockSecond'] = autoLockSecond;
data['antiPrySwitch'] = antiPrySwitch;
data['resetSwitch'] = resetSwitch;
data['lockSwitch'] = lockSwitch;
data['lockSound'] = lockSound;
data['lockSoundVolume'] = lockSoundVolume;
data['languageSettingLang'] = languageSettingLang;
data['openDirectionValue'] = openDirectionValue;
data['doorNotClosedAlarm'] = doorNotClosedAlarm;
data['unlockReminder'] = unlockReminder;
data['lightingTime'] = lightingTime;
data['lightingSecond'] = lightingSecond;
data['passageMode'] = passageMode;
data['passageModeConfig'] = passageModeConfig;
data['attendance'] = attendance;
data['appUnlockOnline'] = appUnlockOnline;
data['bluetoothBroadcast'] = bluetoothBroadcast;
data['adminPwd'] = adminPwd;
data['unlockReminderPush'] = unlockReminderPush;
data['languageSettingLangText'] = languageSettingLangText;
return data;
}
}

View File

@ -17,7 +17,7 @@ import '../../../../tools/baseGetXController.dart';
import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/storage.dart';
import '../../../../tools/toast.dart';
import 'CheckingInInfoDataEntity.dart';
import 'checkingInInfoData_entity.dart';
import 'lockSet_state.dart';
typedef BlockSetStateCallback = void Function();
@ -71,8 +71,7 @@ class LockSetLogic extends BaseGetXController {
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
IoSenderManage.deletUser(
lockID:
state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
lockID: BlueManage().connectDeviceName,
authUserID: await Storage.getUid(),
keyID: "1",
delUserID: await Storage.getUid(),
@ -171,7 +170,7 @@ class LockSetLogic extends BaseGetXController {
List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.deletUser(
lockID: state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName,
lockID: BlueManage().connectDeviceName,
authUserID: "100001",
keyID: "1",
delUserID: "100001",
@ -209,10 +208,23 @@ class LockSetLogic extends BaseGetXController {
});
}
//
void getLockSettingInfoData() async {
var entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value = entity.data!;
state.lockSettingInfo.value = state.lockSetInfoData.value.lockSettingInfo!;
state.lockFeature.value = state.lockSetInfoData.value.lockFeature!;
state.lockStatus.value = state.lockSetInfoData.value.lockStatus!;
}
}
//
void deletLockInfoData() async {
var entity = await ApiRepository.to.deletOwnerLockData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
Get.offAllNamed(Routers.starLockMain);
@ -222,8 +234,8 @@ class LockSetLogic extends BaseGetXController {
//
void deletKeyData() async {
var entity = await ApiRepository.to.deletOwnerKeyData(
lockId: state.getKeyInfosData.value.lockId.toString(),
keyId: state.getKeyInfosData.value.keyId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
Get.offAllNamed(Routers.starLockMain);
@ -246,7 +258,7 @@ class LockSetLogic extends BaseGetXController {
// if(state.currentDeviceUUid.value[31] == "1"){
//
if(state.getKeyInfosData.value.isLockOwner == 1){
if(state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1){
//
factoryDataResetAction();
}else{
@ -271,7 +283,7 @@ class LockSetLogic extends BaseGetXController {
void openCheckingInData(
BlockSetCheckInCallback blockSetCheckInCallback) async {
var entity = await ApiRepository.to.openCheckingInData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
blockSetCheckInCallback(entity);
@ -281,7 +293,7 @@ class LockSetLogic extends BaseGetXController {
//
void setLockSetGeneralSetting(String isOn) async {
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
changeType: "1",
isOn: isOn,
type: "1",
@ -289,9 +301,8 @@ class LockSetLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.isAttendance = int.parse(isOn);
eventBus
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
// state.lockSetInfoData.value.attendance = int.parse(isOn);
// eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功");
} else {}
}
@ -299,18 +310,15 @@ class LockSetLogic extends BaseGetXController {
//
void setLockPickingReminder() async {
var entity = await ApiRepository.to.setLockPickingReminderData(
lockId: state.getKeyInfosData.value.lockId.toString(),
keyId: state.getKeyInfosData.value.keyId.toString(),
monitorFlag:
state.isLockPickingReminder.value == 1 ? "1" : "2", // 12
lockId: state.lockSetInfoData.value.lockId.toString(),
keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
monitorFlag: state.isLockPickingReminder.value == 1 ? "1" : "2", // 12
);
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.monitorFlag =
state.isLockPickingReminder.value;
eventBus
.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
// state.lockSetInfoData.value.unlockReminder = state.isLockPickingReminder.value;
// eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
Toast.show(msg: "设置成功");
} else {}
}
@ -320,7 +328,7 @@ class LockSetLogic extends BaseGetXController {
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
state.getKeyInfosData.value = event.keyInfo;
// state.lockSetInfoData.value = event.keyInfo;
blockSetStateCallback();
});
}
@ -340,6 +348,8 @@ class LockSetLogic extends BaseGetXController {
super.onReady();
print("onReady()");
getLockSettingInfoData();
_initReplySubscription();
initLoadDataScanAllDeviceFindCurrentDeviceAction();
}
@ -349,6 +359,7 @@ class LockSetLogic extends BaseGetXController {
// TODO: implement onInit
super.onInit();
print("onInit()");
}
@override

View File

@ -1,7 +1,6 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -10,8 +9,7 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/eventBusEventManage.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/showTFView.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
@ -29,7 +27,6 @@ class LockSetPage extends StatefulWidget {
class _LockSetPageState extends State<LockSetPage> with RouteAware {
final logic = Get.put(LockSetLogic());
final state = Get.find<LockSetLogic>().state;
StreamSubscription? _passCurrentLockInformationEvent;
@override
void initState() {
@ -56,22 +53,19 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
children: [
//
CommonItem(
leftTitel:
TranslationLoader.lanKeys!.basicInformation!.tr,
leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr,
rightTitle: "",
isHaveLine: false,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.basicInformationPage, arguments: {
'keyInfo': state.getKeyInfosData.value
'lockSetInfoData': state.lockSetInfoData.value
});
}),
SizedBox(
height: 10.h,
),
SizedBox(height: 10.h),
//
Visibility(
visible: true,
Obx(() => Visibility(
visible: state.lockFeature.value.doorStatus == 1 ? true : false,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.doorMagnetic!.tr,
@ -81,10 +75,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
action: () {
Get.toNamed(Routers.doorMagneticPage);
// Toast.show(msg: "功能暂未开放");
})),
}))),
// 线
Visibility(
visible: true,
Obx(() => Visibility(
visible: state.lockFeature.value.wirelessKeyboard == 1 ? true : false,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.wirelessKeyboard!.tr,
@ -94,9 +88,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
action: () {
Get.toNamed(Routers.wirelessKeyboardPage);
// Toast.show(msg: "功能暂未开放");
})),
Visibility(
visible: true,
}))),
//
Obx(() => Visibility(
visible: state.lockFeature.value.lightingTime == 1 ? true : false,
child: CommonItem(
leftTitel: '照明',
rightTitle: "",
@ -104,7 +99,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveDirection: true,
action: () {
Toast.show(msg: "功能暂未开放");
})),
}))),
//
Visibility(
visible: true,
child: CommonItem(
@ -118,26 +114,28 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: true,
visible: state.lockFeature.value.autoLock == 1 ? true : false,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state
.getKeyInfosData.value.autoLockTime! >
-1
? "${state.getKeyInfosData.value.autoLockTime!.toString()}s"
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s"
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.automaticBlockingPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() {
var titleStr = "";
if (state.getKeyInfosData.value.lockSound == 1) {
switch (state.getKeyInfosData.value.volume) {
if ((state.lockSettingInfo.value.lockSound ?? 0) == 1) {
switch (state.lockSettingInfo.value.lockSoundVolume ?? 0) {
case 1:
titleStr = TranslationLoader.lanKeys!.low!.tr;
break;
@ -158,80 +156,81 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
titleStr = TranslationLoader.lanKeys!.closed!.tr;
}
return Visibility(
visible: true,
visible: state.lockFeature.value.lockSound == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockSound!.tr,
rightTitle: titleStr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockSoundSetPage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.lockSoundSetPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
}));
}),
//
Obx(() => Visibility(
visible: true,
visible: state.lockFeature.value.antiPrySwitch == 1 ? true : false,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle:
state.getKeyInfosData.value.tamperAlert == 1
(state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.burglarAlarmPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//
Obx(() => Visibility(
visible: true,
// visible: state.lockFeature.value.passageMode == 1 ? true : false,
visible:true,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle:
state.getKeyInfosData.value.passageMode == 1
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.normallyOpenModePage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() => Visibility(
visible: true,
child: CommonItem(
leftTitel:
visible: state.lockFeature.value.remoteUnlock == 1 ? true : false,
child: CommonItem(leftTitel:
TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle:
state.getKeyInfosData.value.remoteEnable == 1
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.remoteUnlockingPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() => Visibility(
visible: true,
visible: state.lockFeature.value.resetSwitch == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle:
state.getKeyInfosData.value.resetButton == 1
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.resetButtonPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//---
@ -318,29 +317,29 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// ),
SizedBox(height: 10.h),
//-----
//
Obx(() {
var title = "";
if (state.getKeyInfosData.value.roomStatus == 1) {
if (state.lockSettingInfo.value.passageMode == 1) {
title = TranslationLoader.lanKeys!.checkedIn!.tr;
} else if (state.getKeyInfosData.value.roomStatus == 2) {
} else if (state.lockSettingInfo.value.passageMode == 2) {
title = TranslationLoader.lanKeys!.leisure!.tr;
}
return Visibility(
visible: true,
visible: state.lockStatus.value.roomStatus == 1 ? true : false,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.markedHouseState!.tr,
leftTitel: TranslationLoader.lanKeys!.markedHouseState!.tr,
rightTitle: title,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.markedHouseStatePage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.markedHouseStatePage, arguments: state.lockSetInfoData.value);
}));
}),
// Obx(() =>
//
Obx(() =>
Visibility(
visible: true,
visible: state.lockFeature.value.attendance == 1 ? true : false,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "",
@ -348,34 +347,34 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w, child: _openCheckInSwitch()))),
// ),
// Obx(() =>
),
//
Obx(() =>
Visibility(
visible: true,
visible: state.lockFeature.value.unlockReminder == 1 ? true : false,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.unlockReminder!.tr,
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w, child: _lockRemindSwitch()))),
// ),
),
SizedBox(height: 10.h),
// Obx(() =>
// wifi配网
Obx(() =>
Visibility(
visible: true,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.wifiDistributionNetwork!.tr,
visible: state.lockFeature.value.wifi == 1 ? true : false,
child: CommonItem(leftTitel: TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.configuringWifiPage);
})),
// ),
),
// Obx(() =>
//
Visibility(
visible: true,
child: CommonItem(
@ -384,11 +383,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockTimePage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.lockTimePage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ),
// Obx(() =>
//
Visibility(
visible: true,
child: CommonItem(
@ -397,11 +398,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.diagnosePage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.diagnosePage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ),
// Obx(() =>
//
Visibility(
visible: true,
child: CommonItem(
@ -427,6 +430,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// })),
// ),
// Obx(() =>
//
Visibility(
visible: true,
child: CommonItem(
@ -461,12 +465,16 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
));
}
Widget rightText(String rightTitle){
return Text(rightTitle ?? "", textAlign: TextAlign.end, style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor));
}
CupertinoSwitch _openCheckInSwitch() {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: (state.getKeyInfosData.value.isAttendance == 1) ? true : false,
value: ((state.lockSettingInfo.value.attendance ?? 0) == 1) ? true : false,
onChanged: (value) {
setState(() {
int isOnStr;
@ -493,11 +501,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: state.isLockPickingReminder.value == 1 ? true : false,
value: (state.lockSettingInfo.value.unlockReminder ?? 0) == 1 ? true : false,
onChanged: (value) {
setState(() {
state.isLockPickingReminder.value =
state.isLockPickingReminder.value == 1 ? 2 : 1;
state.isLockPickingReminder.value = state.isLockPickingReminder.value == 1 ? 2 : 1;
logic.setLockPickingReminder();
});
},
@ -535,8 +542,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () {
Navigator.pop(context);
Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: state.getKeyInfosData.value);
Get.toNamed(Routers.checkInCreatCompanyPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
},
),
],

View File

@ -1,11 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'lockSetInfo_entity.dart';
class LockSetState {
final getKeyInfosData = KeyInfos().obs;
final lockSetInfoData = LockSetInfoData().obs;
final lockFeature = LockFeature().obs;
final lockSettingInfo = LockSettingInfo().obs;
final lockStatus = LockStatus().obs;
final lockId = 0.obs;
var isAttendance = 1.obs;//
var currentDeviceUUid = "".obs;// uuid
@ -13,8 +17,11 @@ class LockSetState {
var passwordTF = TextEditingController();
LockSetState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
isAttendance.value = getKeyInfosData.value.isAttendance!;
isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!;
Map map = Get.arguments;
lockId.value = map["lockId"];
// getKeyInfosData.value = Get.arguments as KeyInfos;
// isAttendance.value = getKeyInfosData.value.isAttendance!;
// isLockPickingReminder.value = getKeyInfosData.value.monitorFlag!;
}
}

View File

@ -22,27 +22,17 @@ class LockSoundSetLogic extends BaseGetXController {
// ->
void _setLockSetGeneralSetting() async{
int isOn;
int type;
if(state.isOpenLockSound.value == false){
//
isOn = 2; type = 6;
}else{
//
isOn = state.lockSoundLevel.value; type = 8;
}
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
changeType:"1",
isOn:isOn.toString(), // 1-2-; 15;
type:type.toString(), // 6- 8-
var entity = await ApiRepository.to.setLockSound(
lockId: state.lockSetInfoData.value.lockId!,
lockSound:state.isOpenLockSound.value == true ? 1 : 0,
lockSoundVolume:state.lockSoundLevel.value
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.lockSound = state.isOpenLockSound.value == true ? 1 :2;
state.getKeyInfosData.value.volume = state.lockSoundLevel.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
state.lockSetInfoData.value.lockSettingInfo!.lockSound = state.isOpenLockSound.value == true ? 1 :2;
state.lockSetInfoData.value.lockSettingInfo!.lockSoundVolume = state.lockSoundLevel.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功");
}
}
@ -51,6 +41,7 @@ class LockSoundSetLogic extends BaseGetXController {
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
// ()
if(reply is SetSupportFunctionsWithParametersReply) {
_replySetSupportFunctionsWithParameters(reply);
}
@ -95,7 +86,7 @@ class LockSoundSetLogic extends BaseGetXController {
}
}
//
//
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
int status = reply.data[2];
switch(status){
@ -141,7 +132,7 @@ class LockSoundSetLogic extends BaseGetXController {
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 33,
token: getTokenList,
@ -175,7 +166,7 @@ class LockSoundSetLogic extends BaseGetXController {
type = state.lockSoundLevel.value;
}
IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 33,
featureParaLength: 1,

View File

@ -1,16 +1,19 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class LockSoundSetState {
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
var isOpenLockSound = false.obs;//
var lockSoundLevel = 0.obs;//
LockSoundSetState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
isOpenLockSound.value = getKeyInfosData.value.lockSound == 1 ? true : false;
lockSoundLevel.value = getKeyInfosData.value.volume!;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
isOpenLockSound.value = lockSetInfoData.value.lockSettingInfo!.lockSound == 1 ? true : false;
lockSoundLevel.value = lockSetInfoData.value.lockSettingInfo!.lockSoundVolume!;
}
}

View File

@ -0,0 +1,45 @@
class GetServerDatetimeEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
GetServerDatetimeEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
GetServerDatetimeEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
String? date;
Data(
{this.date});
Data.fromJson(Map<String, dynamic> json) {
date = json['date'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['date'] = date;
return data;
}
}

View File

@ -173,7 +173,7 @@ class LockTimeLogic extends BaseGetXController{
//
void getLockTimeFromGateway() async{
var entity = await ApiRepository.to.getLockTimeFromGateway(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
@ -183,7 +183,7 @@ class LockTimeLogic extends BaseGetXController{
//
void getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
String dataEime = DateTool().dateToYMDHNSString("${int.parse(entity.data!.date!)}");

View File

@ -1,15 +1,14 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class LockTimeState{
var lockSetInfoData = LockSetInfoData().obs;
var dateTime = "".obs;
var getKeyInfosData = KeyInfos().obs;
LockTimeState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
}
}

View File

@ -10,7 +10,7 @@ import 'markedHouseState_state.dart';
class MarkedHouseStateLogic extends BaseGetXController{
MarkedHouseStateState state = MarkedHouseStateState();
//
//
Future<void> setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
@ -22,8 +22,8 @@ class MarkedHouseStateLogic extends BaseGetXController{
eventBus.fire(RefreshLockListInfoDataEvent());
state.roomStatus.value = state.roomStatus.value;
state.getKeyInfosData.value.roomStatus = state.roomStatus.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
// state.getKeyInfosData.value.antiPrySwitch = state.roomStatus.value;
// eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value.lockSetting!));
Toast.show(msg: "操作成功");
}else if(entity.errorCode! == 1){
//

View File

@ -1,16 +1,18 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class MarkedHouseStateState{
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
final getKeyInfosData = LockListInfoItemEntity().obs;
var roomStatus = 0.obs;
MarkedHouseStateState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
roomStatus.value = getKeyInfosData.value.roomStatus!;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
getKeyInfosData.value = map["keyInfo"];
}
}

View File

@ -0,0 +1,65 @@
class GetPassageModeConfigEntity {
int? errorCode;
String? description;
String? errorMsg;
Data? data;
GetPassageModeConfigEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
GetPassageModeConfigEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
int? passageMode;
int? startDate;
int? endDate;
int? isAllDay;
List<dynamic>? weekDays;
int? autoUnlock;
Data(
{this.passageMode,
this.startDate,
this.endDate,
this.isAllDay,
this.weekDays,
this.autoUnlock});
Data.fromJson(Map<String, dynamic> json) {
passageMode = json['passageMode'];
startDate = json['startDate'];
endDate = json['endDate'];
isAllDay = json['isAllDay'];
weekDays = json['weekDays'];
autoUnlock = json['autoUnlock'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['passageMode'] = passageMode;
data['startDate'] = startDate;
data['endDate'] = endDate;
data['isAllDay'] = isAllDay;
data['weekDays'] = weekDays;
data['autoUnlock'] = autoUnlock;
return data;
}
}

View File

@ -26,7 +26,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
//
void getNormallyOpenModeConfig() async{
var entity = await ApiRepository.to.getPassageModeConfig(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
state.getPassageModeConfigData.value = entity;
@ -51,7 +51,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
print("state.isOpenNormallyOpenMode.value:${state.isOpenNormallyOpenMode.value}");
var entity = await ApiRepository.to.configPassageModeLoadData(
lockId: state.getKeyInfosData.value.lockId.toString(),
lockId: state.lockSetInfoData.value.lockId.toString(),
passageMode:state.isOpenNormallyOpenMode.value == true ? "1":"2",
autoUnlock:state.isOpenAutomaticUnLock.value == true ? "1":"2",
type: "1",
@ -63,8 +63,8 @@ class NormallyOpenModeLogic extends BaseGetXController{
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.getKeyInfosData.value.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:2;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
state.lockSetInfoData.value.lockSettingInfo!.passageMode = state.isOpenNormallyOpenMode.value == true ? 1:2;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功");
}
}
@ -163,7 +163,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 50,
token: getTokenList,
@ -197,7 +197,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
list.add(state.isOpenAutomaticUnLock.value == true ? 1:0);
IoSenderManage.setSupportFunctionsWithParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 50,
featureParaLength: 8,
@ -216,7 +216,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
super.onReady();
print("onReady()");
if(state.getKeyInfosData.value.passageMode == 1){
if(state.lockSetInfoData.value.lockSettingInfo!.passageMode == 1){
getNormallyOpenModeConfig();
}

View File

@ -1,12 +1,12 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart';
import 'package:star_lock/main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class NormallyOpenModeState{
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
var getPassageModeConfigData = GetPassageModeConfigEntity().obs;
var isOpenNormallyOpenMode = false.obs;// 1-2-
@ -19,6 +19,7 @@ class NormallyOpenModeState{
var endTimeMinute = 0.obs;//
NormallyOpenModeState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
}
}

View File

@ -8,7 +8,6 @@ import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_readSupportFunctionsNoParameters.dart';
import '../../../../blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
import '../../../../blue/io_reply.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';
@ -22,20 +21,16 @@ class RemoteUnlockingLogic extends BaseGetXController{
void _remoteUnlockingOpenOrClose() async{
var entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
lockId: state.getKeyInfosData.value.lockId.toString(),
// featureValue:state.getKeyInfosData.value.featureValue.toString()
featureValue:"1234"
lockId: state.lockSetInfoData.value.lockId!,
remoteUnlock:state.remoteEnable.value == 1 ? 0 : 1
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
if(state.remoteEnable.value == 1){
state.remoteEnable.value = 2;
}else if(state.remoteEnable.value == 2){
state.remoteEnable.value = 1;
}
state.getKeyInfosData.value.remoteEnable = state.remoteEnable.value;
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.getKeyInfosData.value.remoteEnable}");
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value;
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}");
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功");
}
}
@ -129,7 +124,7 @@ class RemoteUnlockingLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 28,
token: getTokenList,
@ -155,7 +150,7 @@ class RemoteUnlockingLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 28,
featureEnable: state.remoteEnable.value == 1 ? 0 : 1,

View File

@ -1,13 +1,16 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class RemoteUnlockingState{
var getKeyInfosData = KeyInfos().obs;
var lockSetInfoData = LockSetInfoData().obs;
var remoteEnable = 1.obs;
RemoteUnlockingState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
remoteEnable.value = getKeyInfosData.value.remoteEnable!;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
remoteEnable.value = lockSetInfoData.value.lockSettingInfo!.remoteUnlock!;
}
}

View File

@ -23,18 +23,16 @@ class ResetButtonLogic extends BaseGetXController{
// ->
Future<void> _setLockSetGeneralSetting() async{
var entity = await ApiRepository.to.setLockSetGeneralSettingData(
lockId: state.getKeyInfosData.value.lockId.toString(),
changeType:"1",
isOn:state.resetButtonEnable.value == 1 ? "2" : "1", // 1-2-;
type:"4", // 4
var entity = await ApiRepository.to.setResetButtonData(
lockId: state.lockSetInfoData.value.lockId!,
resetSwitch:state.resetButtonEnable.value == 1 ? 0 : 1,
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
state.resetButtonEnable.value = state.resetButtonEnable.value == 1 ? 2 : 1;
state.getKeyInfosData.value.resetButton = state.resetButtonEnable.value;
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
state.lockSetInfoData.value.lockSettingInfo!.resetSwitch = state.resetButtonEnable.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
Toast.show(msg: "操作成功");
}
}
@ -128,7 +126,7 @@ class ResetButtonLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.readSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 31,
token: getTokenList,
@ -154,7 +152,7 @@ class ResetButtonLogic extends BaseGetXController{
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
IoSenderManage.setSupportFunctionsNoParametersCommand(
keyID: state.getKeyInfosData.value.keyId.toString(),
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
userID: await Storage.getUid(),
featureBit: 31,
featureEnable: state.resetButtonEnable.value == 1 ? 0 : 1,

View File

@ -1,16 +1,19 @@
import 'package:get/get.dart';
import '../../../lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../lockSet/lockSetInfo_entity.dart';
class ResetButtonState{
var lockSetInfoData = LockSetInfoData().obs;
var getKeyInfosData = KeyInfos().obs;
var resetButtonEnable = 1.obs;
ResetButtonState() {
getKeyInfosData.value = Get.arguments as KeyInfos;
resetButtonEnable.value = getKeyInfosData.value.tamperAlert!;
var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
resetButtonEnable.value = lockSetInfoData.value.lockSettingInfo!.resetSwitch!;
}
}

View File

@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../app_settings/app_colors.dart';
import '../../../network/api_repository.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
import '../../lockMian/entity/lockInfoEntity.dart';
// import '../../lockMian/entity/lockInfoEntity.dart';
import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_page.dart';
class LockDetailMainPage extends StatefulWidget {
@ -20,17 +20,17 @@ class LockDetailMainPage extends StatefulWidget {
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{
}
}
// void getLockInfo() async{
// var entity = await ApiRepository.to.getLockInfo(
// lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
// pageNo:"1",
// );
// if(entity.errorCode!.codeIsSuccessful){
//
// }else{
//
// }
// }
@override
void initState() {
@ -41,14 +41,14 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
@override
Widget build(BuildContext context) {
final isFrist;
KeyInfos keyInfos = KeyInfos();
LockMainEntity lockEntity = LockMainEntity();
final bool isFrist;
LockListInfoItemEntity keyInfos = LockListInfoItemEntity();
// LockMainEntity lockEntity = LockMainEntity();
dynamic obj = ModalRoute.of(context)?.settings.arguments;
if (obj != null && (obj["lockMainEntity"] != null)) {
lockEntity = obj["lockMainEntity"];
}
// if (obj != null && (obj["lockMainEntity"] != null)) {
// lockEntity = obj["lockMainEntity"];
// }
if (obj != null && (obj["keyInfo"] != null)) {
keyInfos = obj["keyInfo"];
}
@ -58,7 +58,7 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
barTitle: TranslationLoader.lanKeys!.starLock!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: LockDetailPage(isFrist:true ,lockMainEntity:lockEntity, keyInfo: keyInfos),
body: LockDetailPage(isFrist:true, lockListInfoItemEntity: keyInfos),
// body: Container(),
);
}

View File

@ -1,30 +1,25 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/get.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../blue/blue_manage.dart';
import '../../../blue/io_tool/io_manager.dart';
import '../../../blue/io_tool/io_tool.dart';
import '../../../tools/appRouteObserver.dart';
import '../../../tools/storage.dart';
import '../../../tools/toast.dart';
import '../../../translations/trans_lib.dart';
import '../../lockMian/entity/lockInfoEntity.dart';
import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart';
class LockDetailPage extends StatefulWidget {
final isFrist;
final KeyInfos keyInfo;
final LockMainEntity lockMainEntity;
final bool isFrist;
final LockListInfoItemEntity lockListInfoItemEntity;
const LockDetailPage(
{Key? key,
required this.lockMainEntity,
required this.isFrist,
required this.keyInfo})
required this.lockListInfoItemEntity})
: super(key: key);
@override
@ -40,7 +35,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
// TODO: implement initState
super.initState();
state.keyInfos.value = widget.keyInfo;
state.keyInfos.value = widget.lockListInfoItemEntity;
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
// BlueManage().connectDeviceMacAddress =
@ -63,10 +58,6 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
var saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
// token
// Storage.setStringList(saveBlueToken, ["0", "0", "0", "0"]);
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
// logic.startScanAction();
listeningAnimations();
@ -79,7 +70,9 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
height: 1.sh - ScreenUtil().statusBarHeight * 2,
color: Colors.white,
child: Column(
children: [topWidget(), Expanded(child: bottomWidget())],
children: [
topWidget(),
Expanded(child: bottomWidget())],
),
);
}
@ -123,7 +116,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
children: [
Container(
width: 1.sw - 120.w*2,
child: Center(child: Text(widget.keyInfo!.lockAlias!, style:TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),))
child: Center(child: Text(widget.lockListInfoItemEntity!.lockAlias!, style:TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),))
),
Positioned(
child: Row(
@ -290,7 +283,6 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
return Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h),
// color: Colors.blue,
child: SizedBox(
child: GridView.count(
crossAxisCount: 4,
// childAspectRatio: 3,
@ -298,7 +290,6 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
mainAxisSpacing: 0.h,
physics: const NeverScrollableScrollPhysics(),
children: getShowWidget()),
),
);
}
@ -306,7 +297,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
var showWidgetArr = <Widget>[];
//
if (state.keyInfos.value.isAttendance == 1) {
if (state.keyInfos.value.lockSetting!.attendance == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr, () {
Get.toNamed(Routers.checkingInListPage,
@ -314,49 +305,54 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
}));
}
var defaultWidgetArr = [
//
bottomItem('images/main/icon_main_electronicKey.png',
TranslationLoader.lanKeys!.electronicKey!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png', TranslationLoader.lanKeys!.electronicKey!.tr, () {
Get.toNamed(Routers.electronicKeyListPage, arguments: {
"lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo
"keyInfo": widget.lockListInfoItemEntity
});
}),
}));
//
bottomItem('images/main/icon_main_password.png',
TranslationLoader.lanKeys!.password!.tr, () {
showWidgetArr.add(bottomItem('images/main/icon_main_password.png', TranslationLoader.lanKeys!.password!.tr, () {
Get.toNamed(Routers.passwordKeyListPage, arguments: {
"lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo
"keyInfo": widget.lockListInfoItemEntity
});
}),
}));
// ic卡
bottomItem('images/main/icon_main_icCard.png',
TranslationLoader.lanKeys!.card!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage,
arguments: {"lockId": widget.keyInfo.lockId, "fromType": 0});
}),
if (state.keyInfos.value.lockFeature!.icCard == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId,
"fromType": 0
});
}));
}
//
bottomItem('images/main/icon_main_fingerprint.png',
if (state.keyInfos.value.lockFeature!.fingerprint == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png',
TranslationLoader.lanKeys!.fingerprint!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage,
arguments: {"lockId": widget.keyInfo.lockId, "fromType": 1});
}),
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId,
"fromType": 1
});
}));
}
//
bottomItem('images/main/icon_main_remoteControl.png',
if (state.keyInfos.value.lockFeature!.bluetoothRemoteControl == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png',
TranslationLoader.lanKeys!.remoteControl!.tr, () {
Get.toNamed(Routers.otherTypeKeyListPage,
arguments: {"lockId": widget.keyInfo.lockId, "fromType": 2});
}),
];
showWidgetArr.addAll(defaultWidgetArr);
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId,
"fromType": 2
});
}));
}
//->
if (state.keyInfos.value.lockFeature!.d3Face == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_face.png', '人脸', () {
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
@ -364,8 +360,10 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
Toast.show(msg: "功能暂未开放");
}),
);
}
//->
if (state.keyInfos.value.lockFeature!.videoIntercom == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_catEyes.png', '监控', () {
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
@ -373,22 +371,21 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
Toast.show(msg: "功能暂未开放");
}),
);
}
var endWiddget = [
//
bottomItem('images/main/icon_main_authorizedAdmin.png',
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
Get.toNamed(Routers.authorizedAdminListPage, arguments: {
"lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo
"keyInfo": widget.lockListInfoItemEntity
});
}),
//
bottomItem('images/main/icon_main_operatingRecord.png',
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
"lockMainEntity": widget.lockMainEntity,
"keyInfo": widget.keyInfo
"keyInfo": widget.lockListInfoItemEntity
});
}),
//
@ -396,7 +393,9 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
() {
BlueManage().stopScan();
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo);
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId
});
}),
];
showWidgetArr.addAll(endWiddget);

View File

@ -3,7 +3,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../lockMian/entity/lockInfoEntity.dart';
import '../../lockMian/entity/lockListInfo_entity.dart';
// enum RKConnectState {
// NULL,
@ -15,7 +15,7 @@ import '../../lockMian/entity/lockInfoEntity.dart';
// }
class LockDetailState {
Rx<KeyInfos> keyInfos = KeyInfos().obs;
Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
//
late AnimationController animationController;

View File

@ -1,12 +1,11 @@
import 'package:get/get.dart';
import '../../../tools/storage.dart';
import '../../lockMian/entity/lockInfoEntity.dart';
import '../../lockMian/entity/lockListInfo_entity.dart';
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
class LockOperatingRecordState{
final keyInfos = KeyInfos().obs;
final keyInfos = LockListInfoItemEntity().obs;
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
LockOperatingRecordState() {
keyInfos.value = Get.arguments["keyInfo"];

View File

@ -87,7 +87,6 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
onClick: () {
Navigator.pushNamed(context, Routers.passwordKeyManagePage,
arguments: {
"lockMainEntity": state.lockMainEntity.value,
"keyInfo": state.keyInfo.value
}).then((val) {
if (val != null) {

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyListState {
final keyInfo = KeyInfos().obs;
final lockMainEntity = LockMainEntity().obs;
final keyInfo = LockListInfoItemEntity().obs;
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = <PasswordKeyListItem>[].obs;
@ -13,7 +13,6 @@ class PasswordKeyListState {
PasswordKeyListState() {
Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"];
}
}

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyManagePage extends StatefulWidget {
const PasswordKeyManagePage({Key? key}) : super(key: key);
@ -16,15 +16,11 @@ class PasswordKeyManagePage extends StatefulWidget {
class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> {
var index = 0;
late KeyInfos keyInfo;
late LockMainEntity lockMainEntity;
late LockListInfoItemEntity keyInfo;
@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"];
}
@ -40,7 +36,6 @@ class _PasswordKeyManagePageState extends State<PasswordKeyManagePage> {
PasswordKeyManageTabbarPage(
initialIndex: index,
keyInfo: keyInfo,
lockMainEntity: lockMainEntity,
),
],
),

View File

@ -1,23 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
import '../passwordKey_Perpetual/passwordKey_perpetual_page.dart';
class PasswordKeyManageTabbarPage extends StatefulWidget {
var initialIndex = 1;
final KeyInfos keyInfo;
final LockMainEntity lockMainEntity;
final LockListInfoItemEntity keyInfo;
PasswordKeyManageTabbarPage(
{Key? key,
required this.initialIndex,
required this.keyInfo,
required this.lockMainEntity})
required this.keyInfo})
: super(key: key);
@override
State<PasswordKeyManageTabbarPage> createState() =>
@ -106,7 +104,6 @@ class _PasswordKeyManageTabbarPageState
.map((ItemView item) => PasswordKeyPerpetualPage(
type: item.type,
getKeyInfo: widget.keyInfo,
lockMainEntity: widget.lockMainEntity,
))
.toList(),
),

View File

@ -9,7 +9,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/storage.dart';
@ -19,21 +18,17 @@ import '../../../../appRouters.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../translations/trans_lib.dart';
import '../../../lockMian/entity/lockListInfo_entity.dart';
class PasswordKeyPerpetualPage extends StatefulWidget {
final String type;
final KeyInfos getKeyInfo;
final LockMainEntity lockMainEntity;
final LockListInfoItemEntity getKeyInfo;
const PasswordKeyPerpetualPage(
{Key? key,
required this.type,
required this.getKeyInfo,
required this.lockMainEntity})
: super(key: key);
{Key? key, required this.type, required this.getKeyInfo}) : super(key: key);
@override
State<PasswordKeyPerpetualPage> createState() =>
_PasswordKeyPerpetualPageState();
State<PasswordKeyPerpetualPage> createState() => _PasswordKeyPerpetualPageState();
}
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {

View File

@ -7,7 +7,7 @@ import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../../entity/lockInfoEntity.dart';
import '../../entity/lockListInfo_entity.dart';
import 'demoModeLockDetail_logic.dart';
class DemoModeLockDetailPage extends StatefulWidget {
@ -228,7 +228,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
TranslationLoader.lanKeys!.checkingIn!.tr, () {
// gotoLogin();
Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos());
Get.toNamed(Routers.checkingInListPage, arguments: LockListInfoItemEntity());
}));
// }
@ -239,8 +239,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
// gotoLogin();
Get.toNamed(Routers.electronicKeyListPage, arguments: {
"lockMainEntity": LockMainEntity(),
"keyInfo": KeyInfos()
"keyInfo": LockListInfoItemEntity()
});
}),
@ -250,8 +249,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
// gotoLogin();
Get.toNamed(Routers.passwordKeyListPage, arguments: {
"lockMainEntity": LockMainEntity(),
"keyInfo": KeyInfos()
"keyInfo": LockListInfoItemEntity()
});
}),
@ -315,8 +313,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
// gotoLogin();
Get.toNamed(Routers.authorizedAdminListPage, arguments: {
"lockMainEntity": LockMainEntity(),
"keyInfo": KeyInfos()
"keyInfo": LockListInfoItemEntity()
});
}),
//
@ -324,7 +321,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
// gotoLogin();
Get.toNamed(Routers.lockOperatingRecordPage,
arguments: {"keyInfo": KeyInfos()});
arguments: {"keyInfo": LockListInfoItemEntity()});
}),
//
bottomItem(

View File

@ -0,0 +1,304 @@
class LockListInfoEntity {
int? errorCode;
String? description;
String? errorMsg;
LockListInfoGroupEntity? data;
LockListInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
LockListInfoEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? LockListInfoGroupEntity.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class LockListInfoGroupEntity {
List<GroupList>? groupList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
LockListInfoGroupEntity({this.groupList, this.pageNo, this.pageSize, this.pages, this.total});
LockListInfoGroupEntity.fromJson(Map<String, dynamic> json) {
if (json['groupList'] != null) {
groupList = <GroupList>[];
json['groupList'].forEach((v) {
groupList!.add(GroupList.fromJson(v));
});
}
pageNo = json['pageNo'];
pageSize = json['pageSize'];
pages = json['pages'];
total = json['total'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (groupList != null) {
data['groupList'] = groupList!.map((v) => v.toJson()).toList();
}
data['pageNo'] = pageNo;
data['pageSize'] = pageSize;
data['pages'] = pages;
data['total'] = total;
return data;
}
}
class GroupList {
String? groupName;
int? groupId;
List<LockListInfoItemEntity>? lockList;
bool _isChecked = false;
bool get isChecked => _isChecked ?? false;
set isChecked(bool value) => _isChecked = value;
GroupList({this.groupName, this.groupId, this.lockList});
GroupList.fromJson(Map<String, dynamic> json) {
groupName = json['groupName'];
groupId = json['groupId'];
if (json['lockList'] != null) {
lockList = <LockListInfoItemEntity>[];
json['lockList'].forEach((v) {
lockList!.add(LockListInfoItemEntity.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['groupName'] = groupName;
data['groupId'] = groupId;
if (lockList != null) {
data['lockList'] = lockList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class LockListInfoItemEntity {
int? keyId;
int? lockId;
String? lockName;
String? lockAlias;
int? electricQuantity;
String? fwVersion;
String? hwVersion;
int? keyType;
int? passageMode;
int? userType;
int? startDate;
int? endDate;
List? weekDays;
int? remoteEnable;
int? faceAuthentication;
int? lastFaceValidateTime;
int? keyRight;
int? keyStatus;
int? isLockOwner;
Bluetooth? bluetooth;
LockFeature? lockFeature;
LockSetting? lockSetting;
LockListInfoItemEntity(
{this.keyId,
this.lockId,
this.lockName,
this.lockAlias,
this.electricQuantity,
this.fwVersion,
this.hwVersion,
this.keyType,
this.passageMode,
this.userType,
this.startDate,
this.endDate,
this.weekDays,
this.remoteEnable,
this.faceAuthentication,
this.lastFaceValidateTime,
this.keyRight,
this.keyStatus,
this.isLockOwner,
this.bluetooth,
this.lockFeature,
this.lockSetting});
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
keyId = json['keyId'];
lockId = json['lockId'];
lockName = json['lockName'];
lockAlias = json['lockAlias'];
electricQuantity = json['electricQuantity'];
fwVersion = json['fwVersion'];
hwVersion = json['hwVersion'];
keyType = json['keyType'];
passageMode = json['passageMode'];
userType = json['userType'];
startDate = json['startDate'];
endDate = json['endDate'];
weekDays = json['weekDays'];
remoteEnable = json['remoteEnable'];
faceAuthentication = json['faceAuthentication'];
lastFaceValidateTime = json['lastFaceValidateTime'];
keyRight = json['keyRight'];
keyStatus = json['keyStatus'];
isLockOwner = json['isLockOwner'];
bluetooth = json['bluetooth'] != null
? Bluetooth.fromJson(json['bluetooth'])
: null;
lockFeature = json['lockFeature'] != null
? LockFeature.fromJson(json['lockFeature'])
: null;
lockSetting = json['lockSetting'] != null
? LockSetting.fromJson(json['lockSetting'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['keyId'] = keyId;
data['lockId'] = lockId;
data['lockName'] = lockName;
data['lockAlias'] = lockAlias;
data['electricQuantity'] = electricQuantity;
data['fwVersion'] = fwVersion;
data['hwVersion'] = hwVersion;
data['keyType'] = keyType;
data['passageMode'] = passageMode;
data['userType'] = userType;
data['startDate'] = startDate;
data['endDate'] = endDate;
data['weekDays'] = weekDays;
data['remoteEnable'] = remoteEnable;
data['faceAuthentication'] = faceAuthentication;
data['lastFaceValidateTime'] = lastFaceValidateTime;
data['keyRight'] = keyRight;
data['keyStatus'] = keyStatus;
data['isLockOwner'] = isLockOwner;
if (bluetooth != null) {
data['bluetooth'] = bluetooth!.toJson();
}
if (lockFeature != null) {
data['lockFeature'] = lockFeature!.toJson();
}
if (lockSetting != null) {
data['lockSetting'] = lockSetting!.toJson();
}
return data;
}
}
class Bluetooth {
String? bluetoothDeviceId;
String? bluetoothDeviceName;
List<int>? publicKey;
List<int>? privateKey;
List<int>? signKey;
Bluetooth(
{this.bluetoothDeviceId,
this.bluetoothDeviceName,
this.publicKey,
this.privateKey,
this.signKey});
Bluetooth.fromJson(Map<String, dynamic> json) {
bluetoothDeviceId = json['bluetoothDeviceId'];
bluetoothDeviceName = json['bluetoothDeviceName'];
publicKey = json['publicKey'].cast<int>();
privateKey = json['privateKey'].cast<int>();
signKey = json['signKey'].cast<int>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['bluetoothDeviceId'] = bluetoothDeviceId;
data['bluetoothDeviceName'] = bluetoothDeviceName;
data['publicKey'] = publicKey;
data['privateKey'] = privateKey;
data['signKey'] = signKey;
return data;
}
}
class LockFeature {
int? password;
int? icCard;
int? fingerprint;
int? fingerVein;
int? palmVein;
int? d3Face;
int? bluetoothRemoteControl;
int? videoIntercom;
LockFeature(
{this.password,
this.icCard,
this.fingerprint,
this.fingerVein,
this.palmVein,
this.d3Face,
this.bluetoothRemoteControl,
this.videoIntercom});
LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password'];
icCard = json['icCard'];
fingerprint = json['fingerprint'];
fingerVein = json['fingerVein'];
palmVein = json['palmVein'];
d3Face = json['d3Face'];
bluetoothRemoteControl = json['bluetoothRemoteControl'];
videoIntercom = json['videoIntercom'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['password'] = password;
data['icCard'] = icCard;
data['fingerprint'] = fingerprint;
data['fingerVein'] = fingerVein;
data['palmVein'] = palmVein;
data['d3Face'] = d3Face;
data['bluetoothRemoteControl'] = bluetoothRemoteControl;
data['videoIntercom'] = videoIntercom;
return data;
}
}
class LockSetting {
int? attendance;
int? appUnlockOnline;
LockSetting({this.attendance, this.appUnlockOnline});
LockSetting.fromJson(Map<String, dynamic> json) {
attendance = json['attendance'];
appUnlockOnline = json['appUnlockOnline'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['attendance'] = attendance;
data['appUnlockOnline'] = appUnlockOnline;
return data;
}
}

View File

@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../app_settings/app_colors.dart';
import '../entity/lockListInfo_entity.dart';
class LockListGroupPage extends StatefulWidget {
const LockListGroupPage({Key? key,
this.child,
this.onTap,
required this.groupItem,
required this.typeImgList})
: super(key: key);
final Widget? child;
final List typeImgList;
final Function()? onTap;
final GroupList groupItem;
@override
State<LockListGroupPage> createState() => _LockListGroupPageState();
}
class _LockListGroupPageState extends State<LockListGroupPage> {
bool _isExpanded = true;
final Duration _animationDuration = const Duration(milliseconds: 200);
bool _isCheck = false;
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
color: Colors.white,
height: 80.h,
child: Row(
children: _buildExpandRowList(),
),
),
ClipRect(
child: AnimatedAlign(
heightFactor: _isExpanded ? 1.0 : 0.0,
alignment: Alignment.center,
duration: _animationDuration,
child: widget.child),
),
],
);
}
List<Widget> _buildExpandRowList() {
List<Widget> widgetList = [];
widgetList.add(GestureDetector(
child: Container(
width: ScreenUtil().screenWidth,
color: Colors.white,
child: Row(
children: [
SizedBox(width: 40.w),
Text(
widget.groupItem.groupName ?? '',
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
),
Expanded(
child: SizedBox(
width: 10.w,
)),
AnimatedRotation(
turns: _isExpanded ? -0.5 : 0,
duration: _animationDuration,
child: const Icon(Icons.keyboard_arrow_down),
),
SizedBox(
width: 30.w,
)
],
),
),
onTap: () {
//
setState(() {
_isExpanded = !_isExpanded;
});
},
));
return widgetList;
}
}

View File

@ -2,46 +2,114 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/mine/starLockMine_page.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../entity/lockInfoEntity.dart';
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../tools/ExpandedListView.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockListGroup_page.dart';
class LockListPage extends StatefulWidget {
final LockMainEntity lockMainEntity;
final LockListInfoGroupEntity lockListInfoGroupEntity;
const LockListPage({Key? key, required this.lockMainEntity}) : super(key: key);
const LockListPage({Key? key, required this.lockListInfoGroupEntity}) : super(key: key);
@override
State<LockListPage> createState() => _LockListPageState();
}
class _LockListPageState extends State<LockListPage> {
var dataList = <KeyInfos>[];
var groupDataList = <GroupList>[];
@override
Widget build(BuildContext context) {
if(widget.lockMainEntity.data!.pageNo == 1){
dataList = <KeyInfos>[];
if(widget.lockListInfoGroupEntity.pageNo == 1){
groupDataList = <GroupList>[];
}
dataList.addAll(widget.lockMainEntity.data!.keyInfos as Iterable<KeyInfos>);
groupDataList.addAll(widget.lockListInfoGroupEntity.groupList as Iterable<GroupList>);
return ListView.builder(
itemCount: dataList.length,
// return ListView.builder(
// itemCount: dataList.length,
// itemBuilder: (c, index) {
// GroupList keyInfo = dataList[index];
// return lockInfoListItem('images/icon_lock.png', keyInfo.groupName, () {
// // Get.toNamed(Routers.lockDetailMainPage, arguments: {
// // "lockMainEntity": widget.lockMainEntity,
// // "keyInfo": keyInfo
// // });
// });
// });
return ListView.separated(
itemCount: groupDataList.length,
itemBuilder: (context, index) {
GroupList itemData = groupDataList[index];
return _buildLockExpandedList(context, index, itemData);
},
shrinkWrap: true,
separatorBuilder: (context, index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
});
}
// //
// Widget _buildListView(BuildContext context, List itemList) {
// return ListView.separated(
// itemCount: itemList.length,
// itemBuilder: (context, index) {
// GroupList itemData = itemList[index];
// return _buildLockExpandedList(context, index, itemData);
// },
// shrinkWrap: true,
// separatorBuilder: (context, index) {
// return const Divider(
// height: 1,
// color: AppColors.greyLineColor,
// );
// });
// }
//
Widget _buildLockExpandedList(context, index, GroupList itemData) {
List lockItemList = itemData.lockList ?? [];
return LockListGroupPage(
onTap: () {
// selectGroupIdList.add(index);
// clickIndex = index;
//
if (itemData.isChecked) {
}else{
}
setState(() {});
print('选中了么0');
},
typeImgList: const [],
groupItem: itemData,
child: ListView.separated(
itemCount: lockItemList.length,
shrinkWrap: true,
separatorBuilder: (context, index) {
return const Divider(height: 1, color: AppColors.greyLineColor);
},
itemBuilder: (c, index) {
KeyInfos keyInfo = dataList[index];
return lockInfoListItem('images/icon_lock.png', keyInfo.lockAlias, () {
LockListInfoItemEntity keyInfo = lockItemList[index];
return lockInfoListItem(keyInfo, () {
Get.toNamed(Routers.lockDetailMainPage, arguments: {
"lockMainEntity": widget.lockMainEntity,
// "lockMainEntity": widget.lockMainEntity,
"keyInfo": keyInfo
});
});
});
}),
);
}
Widget lockInfoListItem(
String lockTypeIcon, String? lockTypeTitle, Function() action) {
Widget lockInfoListItem(LockListInfoItemEntity keyInfo, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
@ -66,7 +134,7 @@ class _LockListPageState extends State<LockListPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
lockTypeTitle!,
keyInfo.lockAlias!,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w500),
),
@ -75,7 +143,7 @@ class _LockListPageState extends State<LockListPage> {
),
SizedBox(width: 20.w),
Text(
"100%",
"${keyInfo.electricQuantity!}%",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
@ -95,7 +163,7 @@ class _LockListPageState extends State<LockListPage> {
children: [
SizedBox(width: 30.w),
Text(
"永久/管理员",
"${getUseDateStr(keyInfo)}/${keyInfo.isLockOwner == 1 ? '超级管理员' : (keyInfo.keyRight == 1 ? "授权管理员" : "普通用户")}",
style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
),
@ -109,4 +177,33 @@ class _LockListPageState extends State<LockListPage> {
),
);
}
String getUseDateStr(LockListInfoItemEntity indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)} ${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
useDateStr = '永久';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
useDateStr = '单次';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环';
}
return useDateStr;
}
}

View File

@ -7,6 +7,7 @@ import '../../../blue/io_tool/manager_event_bus.dart';
import '../../../network/api_repository.dart';
import '../../../tools/baseGetXController.dart';
import '../../../tools/eventBusEventManage.dart';
import '../entity/lockListInfo_entity.dart';
import 'lockMain_state.dart';
class LockMainLogic extends BaseGetXController {
@ -27,10 +28,41 @@ class LockMainLogic extends BaseGetXController {
// getLockInfo();
// }
void getLockInfo() async{
var entity = await ApiRepository.to.getLockInfo(
lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
pageNo:page.toString(),
// void getLockInfo() async{
// var entity = await ApiRepository.to.getLockInfo(
// lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
// pageNo:page.toString(),
// );
// if(entity.errorCode!.codeIsSuccessful){
// // if (page == 0) {
// // refreshController.refreshCompleted();
// // } else {
// // if (entity.data!.keyInfos!.isEmpty) {
// // refreshController.loadNoData();
// // } else {
// // refreshController.loadComplete();
// // }
// // }
// // page++;
//
// if(entity.data!.keyInfos!.isEmpty){
// state.dataLength.value = 0;
// }else if(entity.data!.keyInfos!.length == 1){
// state.dataLength.value = 1;
// }else{
// state.dataLength.value = 2;
// }
// state.lockMainEntity.value = entity;
// }else{
// // refreshController.loadFailed();
// }
// // refreshController.refreshCompleted();
// }
void getStarLockInfo() async{
var entity = await ApiRepository.to.getStarLockListInfo(
pageNo:page,
pageSize:20,
);
if(entity.errorCode!.codeIsSuccessful){
// if (page == 0) {
@ -44,14 +76,19 @@ class LockMainLogic extends BaseGetXController {
// }
// page++;
if(entity.data!.keyInfos!.isEmpty){
if(entity.data!.groupList!.isEmpty){
state.dataLength.value = 0;
}else if(entity.data!.keyInfos!.length == 1){
}else if(entity.data!.groupList!.length == 1){
GroupList groupList = entity.data!.groupList![0];
if(groupList.lockList!.length > 1){
state.dataLength.value = 2;
}else{
state.dataLength.value = 1;
}
}else{
state.dataLength.value = 2;
}
state.lockMainEntity.value = entity;
state.lockListInfoEntity.value = entity;
}else{
// refreshController.loadFailed();
}
@ -61,7 +98,8 @@ class LockMainLogic extends BaseGetXController {
late StreamSubscription _teamEvent;
void _initLoadDataAction() {
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
getLockInfo();
// getLockInfo();
getStarLockInfo();
print("收到消息");
});
}
@ -82,7 +120,8 @@ class LockMainLogic extends BaseGetXController {
super.onInit();
print("onInit()");
getLockInfo();
// getLockInfo();
getStarLockInfo();
}
@override

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart';
import '../../../appRouters.dart';
@ -76,22 +77,21 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
Widget returnWidget;
switch (type) {
case 0:
//
returnWidget = unHaveData();
break;
case 1:
//
Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = LockDetailPage(
lockMainEntity: logic.state.lockMainEntity.value,
isFrist: true,
keyInfo: logic.state.lockMainEntity.value.data!.keyInfos![0]);
returnWidget = LockDetailPage(isFrist: true, lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
break;
case 2:
//
Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget =
LockListPage(lockMainEntity: logic.state.lockMainEntity.value);
returnWidget = LockListPage(lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
break;
default:
returnWidget = unHaveData();
returnWidget = const NoData();
break;
}
return returnWidget;

View File

@ -1,11 +1,10 @@
import 'package:get/get.dart';
import '../entity/lockInfoEntity.dart';
import '../entity/lockListInfo_entity.dart';
class LockMainState {
// 0 1 2
var dataLength = 0.obs;
Rx<LockMainEntity> lockMainEntity = LockMainEntity().obs;
var dataLength = 100.obs;
var lockListInfoEntity = LockListInfoEntity().obs;
}

View File

@ -26,7 +26,6 @@ import 'saveLock_state.dart';
class SaveLockLogic extends BaseGetXController {
final SaveLockState state = SaveLockState();
int userNo = 0;
//
late StreamSubscription<Reply> _replySubscription;
@ -36,11 +35,6 @@ class SaveLockLogic extends BaseGetXController {
_replyAddUserKey(reply);
}
//
if(reply is GetLockStatuReply) {
_replyGetLockStatus(reply);
}
//
if(reply is GetStarLockStatuInfoReply) {
_replyGetStarLockStatusInfo(reply);
@ -51,22 +45,23 @@ class SaveLockLogic extends BaseGetXController {
Future<void> _replyAddUserKey(Reply reply) async {
var lockId = reply.data.sublist(2, 42);
print("lockId:$lockId");
// print("lockId:$lockId");
var token = reply.data.sublist(42, 46);
List<String> strTokenList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, strTokenList);
print("token:$token");
// print("token:$token");
int status = reply.data[46];
print("status:$status");
// print("status:$status reply.data:${reply.data}");
userNo = reply.data[46];
print("status:$status");
switch(status){
case 0x00:
//
print("添加用户数据解析成功");
state.lockUserNo = reply.data[47];
bindBlueAdmin();
break;
case 0x06:
@ -113,167 +108,119 @@ class SaveLockLogic extends BaseGetXController {
}
}
//
Future<void> _replyGetLockStatus(Reply reply) async {
int status = reply.data[2];
switch(status){
case 0x00:
//
print("${reply.commandType}数据解析成功");
var softVersion = reply.data.sublist(3, 7);
print("softVersion:$softVersion");
var power = reply.data[7];
print("power:$power");
// APP
var appUserCount = reply.data.sublist(50, 53);
print("appUserCount:$appUserCount");
//
var blacklistCount = reply.data[53];
print("blacklistCount:$blacklistCount");
//
var bleKeyCount = reply.data[54];
print("bleKeyCount:$bleKeyCount");
//
var remainCount = reply.data.sublist(54, 56);
print("remainCount:$remainCount");
//
var notUploadCount = reply.data.sublist(56, 58);
print("notUploadCount:$notUploadCount");
//
var pwdCount = reply.data[58];
print("pwdCount:$pwdCount");
//
var fingerprintCount = reply.data[59];
print("fingerprintCount:$fingerprintCount");
//
var lockTime = reply.data.sublist(60, 64);
print("lockTime:$lockTime");
//
var hardVersion = reply.data.sublist(64, 68);
print("hardVersion:$hardVersion");
break;
case 0x06:
//
print("${reply.commandType}需要鉴权");
break;
case 0x07:
//
print("${reply.commandType}用户无权限");
break;
case 0x09:
//
print("${reply.commandType}权限校验错误");
break;
default:
//
print("${reply.commandType}失败");
break;
}
}
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
int status = reply.data[2];
switch(status){
case 0x00:
//
print("${reply.commandType}数据解析成功");
//
var vendor = reply.data.sublist(3, 23);
var vendorStr = utf8String(vendor);
print("softVersion:$vendor vendorStr:$vendorStr");
state.lockInfo["vendor"] = vendorStr;
// print("vendor:$vendor vendorStr:$vendorStr vendorStr.length${vendorStr.length}");
//
var product = reply.data[23];
print("product:$product");
state.lockInfo["product"] = product;
// print("product:$product");
//
var model = reply.data.sublist(24, 44);
var modelStr = utf8String(model);
print("model:$model modelStr:$modelStr");
state.lockInfo["model"] = modelStr;
// print("model:$model modelStr:$modelStr modelStr:${modelStr.length}");
//
var fwVersion = reply.data.sublist(44, 64);
var fwVersionStr = utf8String(fwVersion);
print("fwVersion:$fwVersion fwVersionStr:$fwVersionStr");
state.lockInfo["fwVersion"] = fwVersionStr;
// print("fwVersion:$fwVersion fwVersionStr:$fwVersionStr fwVersionStr:${fwVersionStr.length}");
//
var hwVersion = reply.data.sublist(64, 84);
print("hwVersion:$hwVersion");
var hwVersionStr = utf8String(hwVersion);
state.lockInfo["hwVersion"] = hwVersionStr;
// print("hwVersion:$hwVersion hwVersionStr:${hwVersionStr.length}");
//
var serialNum0 = reply.data.sublist(84, 100);
print("serialNum0:$serialNum0");
var serialNum0Str = utf8String(serialNum0);
state.lockInfo["serialNum0"] = serialNum0Str;
// print("serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}");
//
var serialNum1 = reply.data.sublist(100, 116);
print("serialNum1:$serialNum1");
var serialNum1Str = utf8String(serialNum1);
state.lockInfo["serialNum1"] = serialNum1Str;
// print("serialNum1Str:$serialNum1Str serialNum1Str:${serialNum1Str.length}");
//
var btDeviceName = reply.data.sublist(116, 132);
var btDeviceNameStr = utf8String(btDeviceName);
print("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr");
state.lockInfo["btDeviceName"] = btDeviceNameStr;
// print("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr btDeviceNameStr:${btDeviceNameStr.length}");
//
var battRemCap = reply.data[132];
print("battRemCap:$battRemCap");
state.lockInfo["electricQuantity"] = battRemCap;
// print("battRemCap:$battRemCap");
//
var restoreCounter = reply.data.sublist(133, 135);
print("restoreCounter:$restoreCounter");
state.lockInfo["restoreCount"] = restoreCounter[0] * 256 + restoreCounter[1];
// print("restoreCounter:$restoreCounter");
//
var restoreDate = reply.data.sublist(135, 139);
int restoreDateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3]));
String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
print("restoreDate:$restoreDate restoreDateStr:$restoreDateStr");
// String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
state.lockInfo["restoreDate"] = restoreDateValue*1000;
// print("restoreDate:$restoreDate restoreDateValue:$restoreDateValue");
//
var icPartNo = reply.data.sublist(139, 149);
var icPartNoStr = utf8String(icPartNo);
print("icPartNo:$icPartNo icPartNoStr:$icPartNoStr");
state.lockInfo["icPartNo"] = icPartNoStr;
// print("icPartNo:$icPartNo icPartNoStr:$icPartNoStr");
//
var indate = reply.data.sublist(149, 153);
int indateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3]));
String indateStr = DateTool().dateToYMDHNSString("$indateValue");
print("indate:$indate indateStr:$indateStr");
int indateValue = ((0xff & indate[(0)]) << 24 | (0xff & indate[1]) << 16 | (0xff & indate[2]) << 8 | (0xFF & indate[3]));
// String indateStr = DateTool().dateToYMDHNSString("$indateValue");
state.lockInfo["indate"] = indateValue*1000;
// print("indate:$indate indateValue:$indateValue");
// var index = 153;
// //
// var featureValueLength = reply.data[153];
// // ()
// //
// var featureValue = reply.data.sublist(index+1, index + featureValueLength+1);
var index = 153;
//
var featureValueLength = reply.data[153];
// ()
//
var featureValue = reply.data.sublist(index+1, index + featureValueLength+1);
String featureValueStr = asciiString(featureValue);
state.featureValue = featureValueStr;
// List allFeatureValueTwoList = charListChangeIntList(featureValue);
// // print("featureValueLength:$featureValueLength featureValue:$featureValue \n allFeatureValueTwoList:$allFeatureValueTwoList");
// index = index + featureValueLength + 1;
// print("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr");
index = index + featureValueLength + 1;
// // 使
// var featureEnValLength = reply.data[index];
// // 使()
// var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1);
// 使
var featureEnValLength = reply.data[index];
// 使()
var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1);
String featureEnValStr = asciiString(featureValue);
state.featureSettingValue = featureEnValStr;
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
// // print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n allFeatureEnValTwoList:$allFeatureEnValTwoList");
// index = index + featureEnValLength + 1;
// print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr");
index = index + featureEnValLength + 1;
// //
//
// var featureParaTotal = reply.data[index];
var featureParaTotalList = reply.data.sublist(index);
state.featureSettingParams = featureParaTotalList;
// print("featureParaTotalList:$featureParaTotalList");
break;
case 0x06:
//
@ -307,8 +254,10 @@ class SaveLockLogic extends BaseGetXController {
for(int i = 0;i<featureValueTwoStr.length;i++){
featureValueTwoList.add(int.parse(featureValueTwoStr[i]));
}
//
featureValueTwoList = featureValueTwoList.reversed.toList();
List allFeatureValueTwoList = getFixedLengthList(featureValueTwoList, 60 - featureValueTwoList.length);
// print("featureValueStr:$featureValueStr featureValueTwoStr:$featureValueTwoStr featureValueTwoList:$featureValueTwoList allFeatureValueTwoList:$allFeatureValueTwoList");
return allFeatureValueTwoList;
}
@ -356,10 +305,7 @@ class SaveLockLogic extends BaseGetXController {
}
void bindBlueAdmin() async{
var lockDataMap = {};
lockDataMap['lockName'] = BlueManage().connectDeviceName;
lockDataMap['lockMac'] = getRandomNumber();
// lockDataMap['lockMac'] = BlueManage().connectDeviceMacAddress;
print("state.lockInfo:${state.lockInfo}");
var positionMap = {};
positionMap['longitude'] = state.addressInfo["longitude"];
@ -390,17 +336,15 @@ class SaveLockLogic extends BaseGetXController {
// print("addUser:publicKeyDataList$publicKeyDataList getPrivateKeyList:$getPrivateKeyList signKeyDataList:$signKeyDataList");
var entity = await ApiRepository.to.bindingBlueAdmin(
bindingDate:DateTime.now().millisecondsSinceEpoch.toString(),
hotelMode:"2",
lockAlias:state.aliName.value,
lockData:lockDataMap,
nbInitSuccess:"0",
position:positionMap,
bluetooth:bluetooth,
deviceNo:"123456",
// lockUserNo:userNo.toString(),
lockUserNo:"1234",
pwdTimestamp:state.pwdTimestamp.value.toString()
lockInfo: state.lockInfo,
lockUserNo:state.lockUserNo.toString(),
pwdTimestamp:state.pwdTimestamp.value.toString(),
featureValue:state.featureValue,
featureSettingValue:state.featureSettingValue,
featureSettingParams:state.featureSettingParams,
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(RefreshLockListInfoDataEvent());
@ -408,23 +352,9 @@ class SaveLockLogic extends BaseGetXController {
}
}
String getRandomNumber(){
String str = "";
for(int i = 0; i<6; i++){
var a = Random().nextInt(99);
if(a<10){
a = a*10;
}
str = "$str$a:";
}
String result = str.substring(0, str.length - 1);
print("result:$result");
return result;
}
//
Future<void> _getLockStatus() async {
print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}");
Future<void> _getStarLockStatus() async {
// print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}");
//
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
if (state == DeviceConnectionState.connected) {
@ -451,6 +381,8 @@ class SaveLockLogic extends BaseGetXController {
print("onReady()");
_initReplySubscription();
_getStarLockStatus();
}
@override
@ -459,7 +391,6 @@ class SaveLockLogic extends BaseGetXController {
super.onInit();
print("onInit()");
_getLockStatus();
}
@override

View File

@ -11,6 +11,12 @@ class SaveLockState {
var addressInfo = {}.obs;
TextEditingController aliNameController = TextEditingController();
var lockUserNo = 0;
var lockInfo = {};
var featureValue = '';
var featureSettingValue = '';
var featureSettingParams = [];
SaveLockState() {
aliName.value = BlueManage().connectDeviceName;
aliNameController.text = aliName.value;

View File

@ -1,7 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import '../../../main/lockMian/entity/lockListInfo_entity.dart';
class AddAuthorizedAdministratorState {
late TabController? tabController;
@ -28,12 +29,10 @@ class AddAuthorizedAdministratorState {
var isSendSuccess = false.obs;
final isRemoteUnlock = false.obs; //
final isAuthentication = false.obs; //
final keyInfo = KeyInfos().obs;
final lockMainEntity = LockMainEntity().obs;
final keyInfo = LockListInfoItemEntity().obs;
AddAuthorizedAdministratorState() {
Map map = Get.arguments;
lockMainEntity.value = map["lockMainEntity"];
keyInfo.value = map["keyInfo"];
}
}

View File

@ -1,10 +1,11 @@
abstract class Api {
static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //
final String baseUrl = "$baseAddress/api";
// final String baseUrl = "$baseAddress/api";
// final String baseUrl = "http://test.lock.star-lock.cn/api"; //
// final String baseUrl = "https://lock.star-lock.cn/api"; //
// final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //
// final String baseUrl = "http://192.168.56.101:8099/api"; //
final String baseUrl = "http://192.168.56.101:8099/api"; //
// final String baseUrl = "http://192.168.1.14:8099/api"; //
//
@ -27,6 +28,7 @@ abstract class Api {
final String bindingBlueAdminURL = '/lock/bindAdmin'; //
final String modifyKeyNameURL = '/key/modifyKeyName'; //
final String updateLockNameURL = '/lock/updateLockName'; //()
final String modifyKeyNameForAdminURL =
'/key/modifyKeyNameForAdmin'; //
final String updateKeyDateURL = '/key/updateKeyDate'; //
@ -35,6 +37,8 @@ abstract class Api {
final String deleteElectronicKeyURL = '/key/delete'; //
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //
final String getLockInfoURL = '/lock/syncDataPage'; //
final String getStarLockInfoURL = '/lock/list'; //
final String getLockSettingURL = '/lock/getLockSettingData'; //
final String deletLockURL = '/lock/delete'; //
final String checkPasswordURL = '/user/checkPassword'; //
@ -51,12 +55,13 @@ abstract class Api {
final String keyGroupListURL = '/keyGroup/list'; //
final String lockListByGroupURL = '/room/listByGroup'; //
final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // Wifi锁服务器
final String updateSpecialValueUrl = '/room/updateSpecialValue'; // /
final String updateLockSettingUrl = '/lockSetting/updateLockSetting'; // /
final String setAutoLockTimeUrl = '/room/setAutoLockTime'; //
final String getPassageModeConfigUrl =
'/room/getPassageModeConfig'; //
final String getPassageModeConfigUrl = '/room/getPassageModeConfig'; //
final String configPassageModeUrl = '/room/configPassageMode'; //
final String updateSettingUrl = '/room/updateSetting'; // ///
final String roomQueryDateUrl = '/room/queryDate'; //
final String lockDiagnoseUrl = '/room/uploadLockInfo'; //
final String getServerDatetimeUrl = '/check/getServerDatetime'; //

View File

@ -172,7 +172,6 @@ class ApiProvider extends BaseProvider {
String keyId,
String lockId,
String keyName,
String operatorUid,
) =>
post(
modifyKeyNameURL.toUrl,
@ -180,7 +179,6 @@ class ApiProvider extends BaseProvider {
'keyId': keyId,
'lockId': lockId,
'keyName': keyName,
'operatorUid': operatorUid,
}));
Future<Response> modifyKeyNameForAdmin(
@ -273,29 +271,27 @@ class ApiProvider extends BaseProvider {
//
Future<Response> bindingBlueAdmin(
String bindingDate,
String hotelMode,
String lockAlias,
Map lockData,
String nbInitSuccess,
Map position,
Map bluetooth,
String deviceNo,
Map lockInfo,
String lockUserNo,
String pwdTimestamp) =>
String pwdTimestamp,
String featureValue,
String featureSettingValue,
List featureSettingParams) =>
post(
bindingBlueAdminURL.toUrl,
jsonEncode({
'bindingDate': bindingDate,
'hotelMode': hotelMode,
"lockAlias": lockAlias,
'lockData': lockData,
"nbInitSuccess": nbInitSuccess,
'position': position,
'bluetooth': bluetooth,
'deviceNo': deviceNo,
'lockInfo': lockInfo,
'lockUserNo': lockUserNo,
'pwdTimestamp': pwdTimestamp,
'featureValue': featureValue,
'featureSettingValue': featureSettingValue,
'featureSettingParams': featureSettingParams,
}));
//
@ -306,6 +302,21 @@ class ApiProvider extends BaseProvider {
"pageNo": pageNo,
}));
//
Future<Response> getStarLockListInfo(int pageNo, int pageSize) => post(
getStarLockInfoURL.toUrl,
jsonEncode({
"pageNo": pageNo,
'pageSize': pageSize,
}));
//
Future<Response> getLockSettingInfoData(String lockId) => post(
getLockSettingURL.toUrl,
jsonEncode({
'lockId': lockId,
}));
//
Future<Response> deletLockInfo(String lockId) => post(
deletLockURL.toUrl,
@ -496,19 +507,8 @@ class ApiProvider extends BaseProvider {
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
///
//
Future<Response> remoteUnlockingOpenOrCloseLoadData(
String lockId, String featureValue) =>
post(
updateSpecialValueUrl.toUrl,
jsonEncode({
'lockId': lockId,
'featureValue': featureValue,
}));
//
Future<Response> setAutoUnlockLoadData(
String lockId, String autoLockTime, String type) =>
Future<Response> setAutoUnlockLoadData(int lockId, int autoLockTime, int type) =>
post(
setAutoLockTimeUrl.toUrl,
jsonEncode({
@ -517,6 +517,44 @@ class ApiProvider extends BaseProvider {
'type': type,
}));
//
Future<Response> setLockSoundData(int lockId, int lockSound, int lockSoundVolume) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'lockSound': lockSound,
'lockSoundVolume': lockSoundVolume,
}));
//
Future<Response> setBurglarAlarmData(
int lockId, int antiPrySwitch) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'antiPrySwitch': antiPrySwitch,
}));
//
Future<Response> remoteUnlockingOpenOrCloseLoadData(int lockId, int remoteUnlock) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'remoteUnlock': remoteUnlock,
}));
//
Future<Response> setResetButtonData(int lockId, int resetSwitch) =>
post(
updateLockSettingUrl.toUrl,
jsonEncode({
'lockId': lockId,
'resetSwitch': resetSwitch,
}));
//
Future<Response> getPassageModeConfigLoadData(String lockId) => post(
getPassageModeConfigUrl.toUrl,
@ -603,6 +641,17 @@ class ApiProvider extends BaseProvider {
'lockId': lockId,
}));
Future<Response> updateLockName(
String lockId,
String lockName,
) =>
post(
updateLockNameURL.toUrl,
jsonEncode({
'lockId': lockId,
'lockName': lockName,
}));
//
Future<Response> openCheckingInGetData(String lockId) => post(
openCheckingInURL.toUrl,

View File

@ -30,14 +30,15 @@ import '../main/lockDetail/checkingIn/checkingInSet/checkingInSet_entity.dart';
import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/checkingInAddStaffSeletKey_entity.dart';
import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart';
import '../main/lockDetail/lcokSet/configuringWifi/configuringWifiEntity.dart';
import '../main/lockDetail/lcokSet/lockSet/CheckingInInfoDataEntity.dart';
import '../main/lockDetail/lcokSet/lockTime/GetServerDatetimeEntity.dart';
import '../main/lockDetail/lcokSet/normallyOpenMode/GetPassageModeConfigEntity.dart';
import '../main/lockDetail/lcokSet/lockSet/checkingInInfoData_entity.dart';
import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart';
import '../main/lockDetail/lcokSet/lockTime/getServerDatetime_entity.dart';
import '../main/lockDetail/lcokSet/normallyOpenMode/getPassageModeConfig_entity.dart';
import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
import '../main/lockDetail/otherTypeKey/addFingerprint/addFingerprint/addFingerprint_entity.dart';
import '../main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart';
import '../main/lockDetail/otherTypeKey/otherTypeKeyList/fingerprintListData_entity.dart';
import '../main/lockMian/entity/lockInfoEntity.dart';
import '../main/lockMian/entity/lockListInfo_entity.dart';
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
@ -230,27 +231,25 @@ class ApiRepository {
//
Future<SaveLockEntity> bindingBlueAdmin(
{required String bindingDate,
required String hotelMode,
required String lockAlias,
required Map lockData,
required String nbInitSuccess,
{ required String lockAlias,
required Map position,
required Map bluetooth,
required String deviceNo,
required Map lockInfo,
required String lockUserNo,
required String pwdTimestamp}) async {
required String pwdTimestamp,
required String featureValue,
required String featureSettingValue,
required List featureSettingParams}) async {
final res = await apiProvider.bindingBlueAdmin(
bindingDate,
hotelMode,
lockAlias,
lockData,
nbInitSuccess,
position,
bluetooth,
deviceNo,
lockInfo,
lockUserNo,
pwdTimestamp);
pwdTimestamp,
featureValue,
featureSettingValue,
featureSettingParams);
return SaveLockEntity.fromJson(res.body);
}
@ -264,13 +263,24 @@ class ApiRepository {
//
Future<KeyOperationRecordEntity> modifyKeyName(
String keyId,
String lockId,
String keyName,
String operatorUid,
) async {
{
required String keyId,
required String lockId,
required String keyName
}) async {
final res =
await apiProvider.modifyKeyName(keyId, lockId, keyName, operatorUid);
await apiProvider.modifyKeyName(keyId, lockId, keyName);
return KeyOperationRecordEntity.fromJson(res.body);
}
//()
Future<KeyOperationRecordEntity> updateLockName(
{
required String lockId,
required String lockName
}) async {
final res =
await apiProvider.updateLockName(lockId, lockName);
return KeyOperationRecordEntity.fromJson(res.body);
}
@ -321,28 +331,41 @@ class ApiRepository {
}
//
Future<LockMainEntity> getLockInfo(
{required String lastUpdateDate, required String pageNo}) async {
final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo);
return LockMainEntity.fromJson(res.body);
// Future<LockMainEntity> getLockInfo(
// {required String lastUpdateDate, required String pageNo}) async {
// final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo);
// return LockMainEntity.fromJson(res.body);
// }
//
Future<LockListInfoEntity> getStarLockListInfo(
{required int pageNo, required int pageSize}) async {
final res = await apiProvider.getStarLockListInfo(pageNo, pageSize);
return LockListInfoEntity.fromJson(res.body);
}
//
Future<LockSetInfoEntity> getLockSettingInfoData({required String lockId}) async {
final res = await apiProvider.getLockSettingInfoData(lockId);
return LockSetInfoEntity.fromJson(res.body);
}
//
Future<LockMainEntity> deletOwnerLockData({required String lockId}) async {
Future<LockListInfoEntity> deletOwnerLockData({required String lockId}) async {
final res = await apiProvider.deletLockInfo(lockId);
return LockMainEntity.fromJson(res.body);
return LockListInfoEntity.fromJson(res.body);
}
//
Future<LockMainEntity> deletOwnerKeyData({required String lockId, required String keyId}) async {
Future<LockListInfoEntity> deletOwnerKeyData({required String lockId, required String keyId}) async {
final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId);
return LockMainEntity.fromJson(res.body);
return LockListInfoEntity.fromJson(res.body);
}
//
Future<LockMainEntity> checkLoginPassword({required String password}) async {
Future<LockListInfoEntity> checkLoginPassword({required String password}) async {
final res = await apiProvider.checkLoginPassword(password);
return LockMainEntity.fromJson(res.body);
return LockListInfoEntity.fromJson(res.body);
}
//
@ -508,27 +531,57 @@ class ApiRepository {
}
///
// /
Future<LoginEntity> remoteUnlockingOpenOrClose({
required String lockId,
required String featureValue,
}) async {
final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData(
lockId, featureValue);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setAutoUnlock({
required String lockId,
required String autoLockTime,
required String type,
required int lockId,
required int autoLockTime,
required int type,
}) async {
final res =
await apiProvider.setAutoUnlockLoadData(lockId, autoLockTime, type);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setLockSound({
required int lockId,
required int lockSound,
required int lockSoundVolume,
}) async {
final res =
await apiProvider.setLockSoundData(lockId, lockSound, lockSoundVolume);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setBurglarAlarmData({
required int lockId,
required int antiPrySwitch,
}) async {
final res =
await apiProvider.setBurglarAlarmData(lockId, antiPrySwitch);
return LoginEntity.fromJson(res.body);
}
// /
Future<LoginEntity> remoteUnlockingOpenOrClose({
required int lockId,
required int remoteUnlock,
}) async {
final res = await apiProvider.remoteUnlockingOpenOrCloseLoadData(
lockId, remoteUnlock);
return LoginEntity.fromJson(res.body);
}
//
Future<LoginEntity> setResetButtonData({
required int lockId,
required int resetSwitch,
}) async {
final res = await apiProvider.setResetButtonData(lockId, resetSwitch);
return LoginEntity.fromJson(res.body);
}
// configPassageMode
Future<GetPassageModeConfigEntity> getPassageModeConfig({
required String lockId,

View File

@ -36,8 +36,7 @@ class CommonItem extends StatelessWidget {
Container(
height: allHeight ?? 60.h,
color: Colors.white,
padding: EdgeInsets.only(
left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w
padding: EdgeInsets.only(left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w
child: Row(
children: [
SizedBox(width: 20.w),
@ -59,26 +58,20 @@ class CommonItem extends StatelessWidget {
children: [
isHaveRightWidget!
? rightWidget!
: Text(
rightTitle ?? "",
textAlign: TextAlign.end,
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
: Text(rightTitle ?? "", textAlign: TextAlign.end,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.darkGrayTextColor),
)
],
),
isHaveDirection! ? SizedBox(width: 8.w) : Container(),
isHaveDirection! ? SizedBox(width: 3.w) : Container(),
isHaveDirection!
? Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
: SizedBox(width: 20.w),
isHaveDirection! ? SizedBox(width: 20.w) : Container(),
? Image.asset('images/icon_right_grey.png', width: 12.w, height: 21.w,)
: SizedBox(width: 10.w),
isHaveDirection! ? SizedBox(width: 5.w) : Container(),
],
),
),

View File

@ -1,6 +1,6 @@
import 'package:event_bus/event_bus.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:uuid/uuid.dart';
import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart';
/// EventBus
EventBus eventBus = EventBus();
@ -17,8 +17,8 @@ class RefreshCheckInStaffListDataEvent{
///
class PassCurrentLockInformationEvent{
KeyInfos keyInfo;
PassCurrentLockInformationEvent(this.keyInfo);
LockSetInfoData lockSetInfoData;
PassCurrentLockInformationEvent(this.lockSetInfoData);
}
///