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; /// 商户部门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? usePayDisplayType; // 默认支付方式 OrderPayDisplayType? defaultPayDisplayType; // 租户列表 List? 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.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 json) => _$SysSettingFromJson(json); Map toJson() => _$SysSettingToJson(this); @override List get props => [ sysType, androidId, serviceId, serviceName, serviceMerchantId, 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 json) => _$UserSettingFromJson(json); Map toJson() => _$UserSettingToJson(this); @override List get props => [ username, password, sysType, userId, accessToken, refreshToken, expiresTime, tenantId, ]; } @JsonSerializable() class CanteenExtraPriceSetting extends Equatable { /// 是否开启额外金额 bool payAmountEnable; /// 每一次上限 int payAmountMealLimit; /// 超过的倍数 double payAmountMealTimes; /// 售后的退货理由 String? afterSaleReturnReasons; // 商户支付规则列表 List? mchRoleList; CanteenExtraPriceSetting({ required this.payAmountEnable, required this.payAmountMealLimit, required this.payAmountMealTimes, this.afterSaleReturnReasons, this.mchRoleList, }); @override List get props => [ payAmountEnable, payAmountMealLimit, payAmountMealTimes, afterSaleReturnReasons, mchRoleList, ]; factory CanteenExtraPriceSetting.fromJson(Map json) => _$CanteenExtraPriceSettingFromJson(json); Map toJson() => _$CanteenExtraPriceSettingToJson(this); }