修改操作记录bug--没有时间显示问题
This commit is contained in:
parent
66a27c00b2
commit
327a78e829
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:get_storage/get_storage.dart';
|
||||||
|
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||||
@ -26,16 +26,17 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) {
|
if (reply is SenderReferEventRecordTimeReply &&
|
||||||
|
state.ifCurrentScreen.value == true) {
|
||||||
_replyReferEventRecordTime(reply);
|
_replyReferEventRecordTime(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据时间查解析数据
|
// 根据时间查解析数据
|
||||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -47,7 +48,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
if (dataLength > 0) {
|
if (dataLength > 0) {
|
||||||
reply.data.removeRange(0, 7);
|
reply.data.removeRange(0, 7);
|
||||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||||
if(reply.data.length < 17){
|
if (reply.data.length < 17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var getList = splitList(reply.data, 17);
|
var getList = splitList(reply.data, 17);
|
||||||
@ -59,27 +60,27 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
var indexMap = {};
|
var indexMap = {};
|
||||||
indexMap["type"] = indexList[0].toString();
|
indexMap["type"] = indexList[0].toString();
|
||||||
|
|
||||||
if(indexList[0] == 2){
|
if (indexList[0] == 2) {
|
||||||
var passwordData = indexList.sublist(7, 17);
|
var passwordData = indexList.sublist(7, 17);
|
||||||
var password = utf8String(passwordData);
|
var password = utf8String(passwordData);
|
||||||
indexMap["user"] = password.toString();
|
indexMap["user"] = password.toString();
|
||||||
}else{
|
} else {
|
||||||
int userNo = (indexList[1]*255) + indexList[2];
|
int userNo = (indexList[1] * 255) + indexList[2];
|
||||||
indexMap["user"] = userNo.toString();
|
indexMap["user"] = userNo.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
indexMap["success"] = "1";
|
indexMap["success"] = "1";
|
||||||
|
|
||||||
int time = ((0xff & indexList[(3)]) << 24 |
|
int time = ((0xff & indexList[(3)]) << 24 |
|
||||||
(0xff & indexList[4]) << 16 |
|
(0xff & indexList[4]) << 16 |
|
||||||
(0xff & indexList[5]) << 8 |
|
(0xff & indexList[5]) << 8 |
|
||||||
(0xFF & indexList[6]));
|
(0xFF & indexList[6]));
|
||||||
indexMap["date"] = "${time * 1000}";
|
indexMap["date"] = "${time * 1000}";
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
}
|
}
|
||||||
lockRecordUploadData(uploadList);
|
lockRecordUploadData(uploadList);
|
||||||
|
|
||||||
if(dataLength == state.logCountPage){
|
if (dataLength == state.logCountPage) {
|
||||||
state.ifHaveNext = true;
|
state.ifHaveNext = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,10 +98,11 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
// 查询事件记录(时间查询)
|
// 查询事件记录(时间查询)
|
||||||
Future<void> senderReferEventRecordTime() async {
|
Future<void> senderReferEventRecordTime() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState connectionStateState) async {
|
||||||
if (connectionStateState == BluetoothConnectionState.connected) {
|
if (connectionStateState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -122,10 +124,11 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
publicKey: getPublicKeyList,
|
publicKey: getPublicKeyList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (connectionStateState == BluetoothConnectionState.disconnected) {
|
} else if (connectionStateState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,9 +144,16 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
pageSize: int.parse(pageSize),
|
pageSize: int.parse(pageSize),
|
||||||
startDate: state.startDate.value,
|
startDate: state.startDate.value,
|
||||||
endDate: state.endDate.value);
|
endDate: state.endDate.value);
|
||||||
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.lockLogItemList.value = entity.data!.itemList!;
|
if (pageNo == 1) {
|
||||||
|
state.lockLogItemList.value = entity.data!.itemList!;
|
||||||
|
pageNo++;
|
||||||
|
} else {
|
||||||
|
if (entity.data!.itemList!.isNotEmpty) {
|
||||||
|
state.lockLogItemList.addAll(entity.data!.itemList!);
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,15 +162,18 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
void _getDoorLockLogListRefreshUIAction() {
|
void _getDoorLockLogListRefreshUIAction() {
|
||||||
_getDoorLockLogListRefreshUIEvent =
|
_getDoorLockLogListRefreshUIEvent =
|
||||||
eventBus.on<DoorLockLogListRefreshUI>().listen((event) {
|
eventBus.on<DoorLockLogListRefreshUI>().listen((event) {
|
||||||
|
state.currentSelectDate.value = event.getDoorLockLogTime;
|
||||||
// 设置startDate为当天的0点
|
// 设置startDate为当天的0点
|
||||||
state.startDate.value = DateTime(event.getDoorLockLogTime.year,
|
state.startDate.value = DateTime(
|
||||||
event.getDoorLockLogTime.month, event.getDoorLockLogTime.day)
|
state.currentSelectDate.value.year,
|
||||||
|
state.currentSelectDate.value.month,
|
||||||
|
state.currentSelectDate.value.day)
|
||||||
.millisecondsSinceEpoch;
|
.millisecondsSinceEpoch;
|
||||||
// 设置endDate为下一天的0点,然后减去1毫秒
|
// 设置endDate为下一天的0点,然后减去1毫秒
|
||||||
state.endDate.value = (DateTime(
|
state.endDate.value = (DateTime(
|
||||||
event.getDoorLockLogTime.year,
|
state.currentSelectDate.value.year,
|
||||||
event.getDoorLockLogTime.month,
|
state.currentSelectDate.value.month,
|
||||||
event.getDoorLockLogTime.day + 1)
|
state.currentSelectDate.value.day + 1)
|
||||||
.subtract(const Duration(milliseconds: 1)))
|
.subtract(const Duration(milliseconds: 1)))
|
||||||
.millisecondsSinceEpoch;
|
.millisecondsSinceEpoch;
|
||||||
|
|
||||||
@ -186,9 +199,9 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
.lockRecordUploadData(
|
.lockRecordUploadData(
|
||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if(state.ifHaveNext == true){
|
if (state.ifHaveNext == true) {
|
||||||
getLockRecordLastUploadDataTime();
|
getLockRecordLastUploadDataTime();
|
||||||
}else{
|
} else {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
||||||
|
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||||
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
||||||
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
@ -52,7 +53,17 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
endIndent: 30.w,
|
endIndent: 30.w,
|
||||||
),
|
),
|
||||||
eventDropDownWidget(),
|
eventDropDownWidget(),
|
||||||
Expanded(child: Obx(() => timeLineView(state.lockLogItemList)))
|
Expanded(
|
||||||
|
child: EasyRefreshTool(
|
||||||
|
onRefresh: () {
|
||||||
|
logic.pageNo = 1;
|
||||||
|
logic.mockNetworkDataRequest();
|
||||||
|
},
|
||||||
|
onLoad: () {
|
||||||
|
logic.mockNetworkDataRequest();
|
||||||
|
},
|
||||||
|
child: Obx(() => timeLineView(state.lockLogItemList)),
|
||||||
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -81,19 +92,34 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
highlightColor: Colors.yellow,
|
highlightColor: Colors.yellow,
|
||||||
disabledColor: Colors.grey,
|
disabledColor: Colors.grey,
|
||||||
),
|
),
|
||||||
child: AdvancedCalendar(
|
child: Stack(
|
||||||
controller: state.calendarControllerCustom,
|
children: [
|
||||||
events: state.events,
|
AdvancedCalendar(
|
||||||
weekLineHeight: 48.0,
|
controller: state.calendarControllerCustom,
|
||||||
startWeekDay: 1,
|
events: state.events,
|
||||||
innerDot: true,
|
weekLineHeight: 48.0,
|
||||||
keepLineSize: true,
|
startWeekDay: 1,
|
||||||
calendarTextStyle: const TextStyle(
|
innerDot: true,
|
||||||
fontSize: 18,
|
keepLineSize: true,
|
||||||
fontWeight: FontWeight.w400,
|
calendarTextStyle: const TextStyle(
|
||||||
height: 1.3125,
|
fontSize: 18,
|
||||||
letterSpacing: 0,
|
fontWeight: FontWeight.w400,
|
||||||
),
|
height: 1.3125,
|
||||||
|
letterSpacing: 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 8.0,
|
||||||
|
right: 8.0,
|
||||||
|
child: Obx(() => Text(
|
||||||
|
'${state.currentSelectDate.value.year}年${state.currentSelectDate.value.month}月',
|
||||||
|
style: theme.textTheme.titleMedium!.copyWith(
|
||||||
|
fontSize: 16,
|
||||||
|
color: theme.colorScheme.secondary,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,8 +17,15 @@ class DoorLockLogState {
|
|||||||
DateTime(2024, 10, 10),
|
DateTime(2024, 10, 10),
|
||||||
];
|
];
|
||||||
|
|
||||||
final startDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day).millisecondsSinceEpoch.obs;
|
final startDate =
|
||||||
final endDate = (DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1).subtract(const Duration(milliseconds: 1))).millisecondsSinceEpoch.obs;
|
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
|
||||||
|
.millisecondsSinceEpoch
|
||||||
|
.obs;
|
||||||
|
final endDate = (DateTime(
|
||||||
|
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
|
||||||
|
.subtract(const Duration(milliseconds: 1)))
|
||||||
|
.millisecondsSinceEpoch
|
||||||
|
.obs;
|
||||||
|
|
||||||
var dropdownTitle = '全部事件'.obs;
|
var dropdownTitle = '全部事件'.obs;
|
||||||
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
||||||
@ -50,6 +57,7 @@ class DoorLockLogState {
|
|||||||
var operateDate = 0; // 按日期查询消息记录的时间戳
|
var operateDate = 0; // 按日期查询消息记录的时间戳
|
||||||
var ifHaveNext = false; // 页码
|
var ifHaveNext = false; // 页码
|
||||||
var logCountPage = 10; // 蓝牙记录一页多少个
|
var logCountPage = 10; // 蓝牙记录一页多少个
|
||||||
|
var currentSelectDate = DateTime.now().obs; // 当前选择的日期
|
||||||
|
|
||||||
DoorLockLogState() {
|
DoorLockLogState() {
|
||||||
keyInfos.value = Get.arguments["keyInfo"];
|
keyInfos.value = Get.arguments["keyInfo"];
|
||||||
|
|||||||
@ -15,8 +15,7 @@ class Header extends StatelessWidget {
|
|||||||
this.todayStyle,
|
this.todayStyle,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
static final _dateFormatter = DateFormat().add_yMMMM();
|
static final _dateFormatter = DateFormat.yM('zh_CN');
|
||||||
// static final _dateFormatter = DateFormat('MM月dd日', 'zh_CN');
|
|
||||||
final DateTime monthDate;
|
final DateTime monthDate;
|
||||||
final EdgeInsetsGeometry margin;
|
final EdgeInsetsGeometry margin;
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:intl/date_symbol_data_local.dart';
|
import 'package:intl/date_symbol_data_local.dart';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user