Files
biz_xfj_cloud/lib/common/models/database/database_models.dart
T
2026-09-22 13:29:10 +08:00

336 lines
8.1 KiB
Dart

import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:pj_supermarket_cloud/common/index.dart';
part 'database_models.g.dart';
@JsonSerializable()
class SysSetting extends Equatable {
/// 设备类型
SysType sysType;
/// mac地址
String? androidId;
/// 服务端ID
String? serviceId;
/// 服务单设备名
String? serviceName;
/// 商户id
String? serviceMerchantId;
/// 当前业务终端绑定的 EY_PRINT 逻辑打印机资产 ID;未绑定时为空。
String? printerHardId;
/// 当前业务终端绑定的 EY_PRINT 逻辑打印机资产名称;未绑定时为空。
String? printerHardName;
/// 当前业务终端代理的 USB 打印机型号,由服务端绑定配置下发。
String? printerModel;
/// 当前绑定打印机的 USB Vendor ID 十进制值;尚未上报时为空。
int? printerUsbVendorId;
/// 当前绑定打印机的 USB Product ID 十进制值;尚未上报时为空。
int? printerUsbProductId;
/// 当前绑定打印机的纸宽,单位毫米;旧配置缺失时默认 80。
int printerPaperWidth;
/// 当前绑定打印机是否在完整写入后发送自动切刀指令。
bool printerAutoCut;
/// 当前绑定打印机的 ESC/POS 图片指令模式,默认使用 GS_V0。
String printerImageMode;
/// 终端打印方式:IMAGE=图片打印(固定,凭证 PNG 渲染位图出纸),CMD=指令打印。
/// 指令打印在真机版式与走纸兼容性不达标后已停用;取值来自服务端 bootstrap 的
/// printerConfig.printMode,设置页展示与自愈上报读取该字段,出纸逻辑不使用。
@JsonKey(defaultValue: 'IMAGE')
String printerOutputMode;
/// 商户部门id
String? merchantDeptId;
/// 硬件分组id
String? hardGroupId;
/// mq地址
String? mqSocketAddress;
/// mq端口
String? mqSocketPort;
/// mq用户名
String? mqUsername;
/// mq密码
String? mqPassword;
/// 当前设备的topic
String? mainTopic;
/// mq连接id
String? mqClientId;
/// mq状态
String? mqStatus;
/// 外部存储地址
String? externalPath;
/// 数据库地址
String? sqlAddress;
/// 日志地址
String? logAddress;
/// 人脸 appId
String? faceAppId;
/// 人脸 sdkKey
String? faceSdkKey;
/// 人脸 activeKey
String? faceActiveKey;
/// 同步时间
DateTime? syncTime;
/// 菜谱分类同步时间
DateTime? canteenClassifySyncTime;
/// 菜谱商品同步时间
DateTime? canteenProductSyncTime;
/// 超市分类同步时间
DateTime? supermarketClassifySyncTime;
/// 超市商品同步时间
DateTime? supermarketProductSyncTime;
/// 离线订单同步时间
DateTime? offlineOrderSyncTime;
/// 长链接重连
DateTime? mqSyncTime;
/// 商品时间段类型
ProductHourType? hourType;
// 全局字体大小
SettingGlobalFontSize? globalFontSize;
/// 按钮、标签及小型操作控件的圆角。
@JsonKey(defaultValue: SettingButtonRadius.standard)
SettingButtonRadius buttonRadius;
/// 页面分组、信息卡片及 Forui 卡片的圆角。
@JsonKey(defaultValue: SettingCardRadius.standard)
SettingCardRadius cardRadius;
/// 按钮和标签的内边距档位,不改变全局字体大小。
@JsonKey(defaultValue: SettingButtonSize.standard)
SettingButtonSize buttonSize;
// 使用支付方式
List<OrderPayDisplayType>? usePayDisplayType;
// 默认支付方式
OrderPayDisplayType? defaultPayDisplayType;
// 租户列表
List<ServiceTenant>? tenantList;
/// 设置为主控后不访问扫码、饭卡和人脸硬件,改由操作员输入硬件结果。
@JsonKey(defaultValue: false)
bool manualHardwareInput;
/// Root 最近一次真实命令检查状态;旧配置缺失时按未检查处理。
@JsonKey(defaultValue: RootAccessStatus.unknown)
RootAccessStatus rootAccessStatus;
/// Root 最近一次检查时间;旧配置或从未检查时为空。
DateTime? rootAccessCheckedAt;
/// Root 检查诊断摘要;可用时说明确认结果,不可用时说明拒绝、超时等原因。
String? rootAccessDiagnostic;
SysSetting({
required this.sysType,
this.androidId,
this.serviceId,
this.mqSocketAddress,
this.mqStatus,
this.sqlAddress,
this.logAddress,
this.hardGroupId,
this.printerPaperWidth = 80,
this.printerAutoCut = true,
this.printerImageMode = 'GS_V0',
this.printerOutputMode = 'IMAGE',
this.tenantList,
this.manualHardwareInput = false,
this.rootAccessStatus = RootAccessStatus.unknown,
this.rootAccessCheckedAt,
this.rootAccessDiagnostic,
this.buttonRadius = SettingButtonRadius.standard,
this.cardRadius = SettingCardRadius.standard,
this.buttonSize = SettingButtonSize.standard,
});
factory SysSetting.fromJson(Map<String, dynamic> json) =>
_$SysSettingFromJson(json);
Map<String, dynamic> toJson() => _$SysSettingToJson(this);
@override
List<Object?> get props => [
sysType,
androidId,
serviceId,
serviceName,
serviceMerchantId,
printerHardId,
printerHardName,
printerModel,
printerUsbVendorId,
printerUsbProductId,
printerPaperWidth,
printerAutoCut,
printerImageMode,
printerOutputMode,
merchantDeptId,
hardGroupId,
mqSocketAddress,
mqSocketPort,
mqUsername,
mqPassword,
mainTopic,
mqClientId,
mqStatus,
externalPath,
sqlAddress,
logAddress,
faceAppId,
faceSdkKey,
faceActiveKey,
syncTime?.millisecondsSinceEpoch,
canteenClassifySyncTime?.millisecondsSinceEpoch,
canteenProductSyncTime?.millisecondsSinceEpoch,
supermarketClassifySyncTime?.millisecondsSinceEpoch,
supermarketProductSyncTime?.millisecondsSinceEpoch,
offlineOrderSyncTime?.millisecondsSinceEpoch,
mqSyncTime?.millisecondsSinceEpoch,
hourType,
globalFontSize,
buttonRadius,
cardRadius,
buttonSize,
usePayDisplayType,
defaultPayDisplayType,
tenantList,
manualHardwareInput,
rootAccessStatus,
rootAccessCheckedAt?.millisecondsSinceEpoch,
rootAccessDiagnostic,
];
}
/// 用户信息
@JsonSerializable()
class UserSetting extends Equatable {
/// 账号
String? username;
/// 密码
String? password;
/// start 服务端信息 start
/// 设备类型
SysType? sysType;
/// 用户编号
int? userId;
/// 访问令牌
String? accessToken;
/// 刷新令牌
String? refreshToken;
/// 过期时间
int? expiresTime;
/// end 服务端信息 end
/// 租户id
String? tenantId;
UserSetting({
this.username,
this.password,
});
factory UserSetting.fromJson(Map<String, dynamic> json) =>
_$UserSettingFromJson(json);
Map<String, dynamic> toJson() => _$UserSettingToJson(this);
@override
List<Object?> get props => [
username,
password,
sysType,
userId,
accessToken,
refreshToken,
expiresTime,
tenantId,
];
}
@JsonSerializable()
class CanteenExtraPriceSetting extends Equatable {
/// 是否开启额外金额
bool payAmountEnable;
/// 每一次上限
int payAmountMealLimit;
/// 超过的倍数
double payAmountMealTimes;
/// 售后的退货理由
String? afterSaleReturnReasons;
// 商户支付规则列表
List<ServiceMchRule>? mchRoleList;
CanteenExtraPriceSetting({
required this.payAmountEnable,
required this.payAmountMealLimit,
required this.payAmountMealTimes,
this.afterSaleReturnReasons,
this.mchRoleList,
});
@override
List<Object?> get props => [
payAmountEnable,
payAmountMealLimit,
payAmountMealTimes,
afterSaleReturnReasons,
mchRoleList,
];
factory CanteenExtraPriceSetting.fromJson(Map<String, dynamic> json) =>
_$CanteenExtraPriceSettingFromJson(json);
Map<String, dynamic> toJson() => _$CanteenExtraPriceSettingToJson(this);
}