178 lines
4.2 KiB
Dart
178 lines
4.2 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:pj_supermarket_cloud/common/index.dart';
|
|
|
|
part 'mq_models.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class MqBaseMsg {
|
|
// 动作
|
|
MqtActionEnum? action;
|
|
|
|
MqBaseMsg({
|
|
this.action,
|
|
});
|
|
|
|
factory MqBaseMsg.fromJson(Map<String, dynamic> json) =>
|
|
_$MqBaseMsgFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$MqBaseMsgToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class MqttInvoiceMsg {
|
|
// 动作
|
|
MqtActionEnum? action;
|
|
|
|
// 记录id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? historyId;
|
|
|
|
// 用户id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? userId;
|
|
|
|
// 订单id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? orderId;
|
|
|
|
// 安卓订单id
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? androidOrderCode;
|
|
|
|
/// 实际接收消息并代理 USB 打印的来源业务终端 ID。
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? sourceHardId;
|
|
|
|
/// 后台绑定的 EY_PRINT 逻辑打印机资产 ID,用于核对当前任务路由。
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? targetHardId;
|
|
|
|
/// 打印内容类型,兼容发票与兑换券协议编码。
|
|
final String? printType;
|
|
|
|
/// 同订单同打印类型的业务打印序号;传输重试不会增加该值。
|
|
final int? printNo;
|
|
|
|
/// 同一服务端任务的人工重试版本,用于终端幂等去重。
|
|
final int? retryVersion;
|
|
|
|
// 图片地址url
|
|
final String? pic;
|
|
|
|
// 是否设置为全局人脸
|
|
final bool? isGlobalFace;
|
|
|
|
MqttInvoiceMsg({
|
|
this.action,
|
|
this.historyId,
|
|
this.userId,
|
|
this.orderId,
|
|
this.androidOrderCode,
|
|
this.sourceHardId,
|
|
this.targetHardId,
|
|
this.printType,
|
|
this.printNo,
|
|
this.retryVersion,
|
|
this.pic,
|
|
this.isGlobalFace,
|
|
});
|
|
|
|
factory MqttInvoiceMsg.fromJson(Map<String, dynamic> json) =>
|
|
_$MqttInvoiceMsgFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$MqttInvoiceMsgToJson(this);
|
|
}
|
|
|
|
/// FACE 动作专用消息,只携带发生变化的用户标识供终端回查最新状态。
|
|
@JsonSerializable()
|
|
class MqttFaceChangeMsg {
|
|
/// MQTT 动作,协议值固定为 FACE。
|
|
final MqtActionEnum? action;
|
|
|
|
/// 发生人脸 CRUD 或部门调动的用户主键。
|
|
@JsonKey(fromJson: JsonTool.anyToString, toJson: JsonTool.stringToInt)
|
|
final String? userId;
|
|
|
|
/// 兼容既有协议的全局人脸状态;生产部门同步不据此接收外部门人脸。
|
|
final bool? isGlobalFace;
|
|
|
|
/// 创建一条 FACE 变更通知。
|
|
const MqttFaceChangeMsg({
|
|
this.action,
|
|
this.userId,
|
|
this.isGlobalFace,
|
|
});
|
|
|
|
/// 从 MQTT JSON 创建专用消息。
|
|
factory MqttFaceChangeMsg.fromJson(Map<String, dynamic> json) =>
|
|
_$MqttFaceChangeMsgFromJson(json);
|
|
|
|
/// 将专用消息转换为 JSON,主要供协议测试使用。
|
|
Map<String, dynamic> toJson() => _$MqttFaceChangeMsgToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class MqttTakeFoodBroadcastMsg {
|
|
/// 发送硬件的topic
|
|
String topic;
|
|
|
|
/// 用户id
|
|
String userId;
|
|
|
|
/// 用户id
|
|
String username;
|
|
|
|
/// 用户id
|
|
String userMobile;
|
|
|
|
/// 广播id
|
|
String id;
|
|
|
|
/// 订单id
|
|
String orderId;
|
|
|
|
/// 预定标题
|
|
String title;
|
|
|
|
/// 广播内容
|
|
String content;
|
|
|
|
/// 最大广播次数
|
|
int broadcastMaxCount;
|
|
|
|
/// 商品介绍
|
|
String productDesc;
|
|
|
|
/// 支付价格
|
|
int payPrice;
|
|
|
|
/// 时间段类型
|
|
String hourType;
|
|
|
|
/// 是否完成订单
|
|
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
|
|
bool isDone;
|
|
|
|
MqttTakeFoodBroadcastMsg({
|
|
required this.topic,
|
|
required this.userId,
|
|
required this.username,
|
|
required this.userMobile,
|
|
required this.id,
|
|
required this.orderId,
|
|
required this.title,
|
|
required this.content,
|
|
required this.broadcastMaxCount,
|
|
required this.productDesc,
|
|
required this.payPrice,
|
|
required this.hourType,
|
|
required this.isDone,
|
|
});
|
|
|
|
factory MqttTakeFoodBroadcastMsg.fromJson(Map<String, dynamic> json) =>
|
|
_$MqttTakeFoodBroadcastMsgFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$MqttTakeFoodBroadcastMsgToJson(this);
|
|
}
|