269 lines
6.1 KiB
Dart
269 lines
6.1 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:pj_supermarket_cloud/common/index.dart';
|
|
|
|
part 'user_api_models.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class ServiceUser {
|
|
/// 用户ID
|
|
String? userId;
|
|
|
|
/// 用户昵称
|
|
String? username;
|
|
|
|
/// 部门ID
|
|
String? deptId;
|
|
|
|
/// 手机号码
|
|
String? userMobile;
|
|
|
|
/// 用户头像
|
|
String? userAvatar;
|
|
|
|
/// 钱包id
|
|
String? walletId;
|
|
|
|
/// 钱包类型id
|
|
String? walletTypeId;
|
|
|
|
/// 钱包余额
|
|
int? walletBalance;
|
|
|
|
/// 是否冻结饭卡
|
|
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
|
|
bool? walletIsFreeze;
|
|
|
|
/// 卡号
|
|
String? walletCardNumber;
|
|
|
|
/// 查询用户食堂信息
|
|
String? canteenId;
|
|
|
|
/// 构造函数
|
|
ServiceUser({
|
|
this.userId,
|
|
this.username,
|
|
this.deptId,
|
|
this.userMobile,
|
|
this.userAvatar,
|
|
this.walletId,
|
|
this.walletTypeId,
|
|
this.walletBalance,
|
|
this.walletIsFreeze,
|
|
this.walletCardNumber,
|
|
this.canteenId,
|
|
});
|
|
|
|
factory ServiceUser.fromJson(Map<String, dynamic> json) =>
|
|
_$ServiceUserFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$ServiceUserToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class ServiceAuth {
|
|
/// 用户编号
|
|
final int? userId;
|
|
|
|
/// 访问令牌
|
|
final String? accessToken;
|
|
|
|
/// 刷新令牌
|
|
final String? refreshToken;
|
|
|
|
/// 过期时间
|
|
final int? expiresTime;
|
|
|
|
ServiceAuth({
|
|
required this.userId,
|
|
required this.accessToken,
|
|
required this.refreshToken,
|
|
required this.expiresTime,
|
|
});
|
|
|
|
factory ServiceAuth.fromJson(Map<String, dynamic> json) =>
|
|
_$ServiceAuthFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$ServiceAuthToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class ServiceAsyncFace {
|
|
/// 编号
|
|
final String? id;
|
|
|
|
/// 人脸编号
|
|
final String? autoCode;
|
|
|
|
/// 人脸图片
|
|
final String? faceImg;
|
|
|
|
/// 用户id
|
|
final String? userId;
|
|
|
|
/// 用户名
|
|
final String? username;
|
|
|
|
/// 用户头像
|
|
final String? userAvatar;
|
|
|
|
/// 部门id
|
|
final String? deptId;
|
|
|
|
/// 部门名
|
|
final String? deptName;
|
|
|
|
/// 删除标志
|
|
@JsonKey(fromJson: JsonTool.stringToBoolean, toJson: JsonTool.booleanToString)
|
|
final bool? delFlag;
|
|
|
|
ServiceAsyncFace({
|
|
this.id,
|
|
this.autoCode,
|
|
this.faceImg,
|
|
this.userId,
|
|
this.username,
|
|
this.userAvatar,
|
|
this.deptId,
|
|
this.deptName,
|
|
this.delFlag,
|
|
});
|
|
|
|
factory ServiceAsyncFace.fromJson(Map<String, dynamic> json) =>
|
|
_$ServiceAsyncFaceFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$ServiceAsyncFaceToJson(this);
|
|
}
|
|
|
|
/// V3 部门人脸快照中的单条服务端权威记录。
|
|
@JsonSerializable()
|
|
class ServiceFaceSyncRecord {
|
|
/// 人脸记录数据库主键,作为分页顺序和快照范围的稳定标识。
|
|
@JsonKey(
|
|
fromJson: JsonTool.anyToRequiredString,
|
|
toJson: JsonTool.stringToInt,
|
|
)
|
|
final String id;
|
|
|
|
/// 虹软 32 位搜索标识,来源于服务端 autoCode。
|
|
@JsonKey(
|
|
fromJson: JsonTool.anyToRequiredString,
|
|
toJson: JsonTool.stringToInt,
|
|
)
|
|
final String sampleId;
|
|
|
|
/// 人脸所属用户主键,MQ 增量按该字段回查同一用户的全部人脸。
|
|
@JsonKey(
|
|
fromJson: JsonTool.anyToRequiredString,
|
|
toJson: JsonTool.stringToInt,
|
|
)
|
|
final String userId;
|
|
|
|
/// 用户姓名,用于本地识别结果和设置页展示。
|
|
final String? username;
|
|
|
|
/// 用户当前部门主键,保证终端只维护绑定部门及其子部门人脸。
|
|
@JsonKey(
|
|
fromJson: JsonTool.anyToRequiredString,
|
|
toJson: JsonTool.stringToInt,
|
|
)
|
|
final String deptId;
|
|
|
|
/// 用户当前部门名称,用于本地展示。
|
|
final String? deptName;
|
|
|
|
/// 服务端人脸图片地址,地址变化会触发重新下载与特征提取。
|
|
final String? faceImg;
|
|
|
|
/// 服务端人脸记录修改时间,和图片地址共同构成图片版本。
|
|
final DateTime? sourceUpdatedAt;
|
|
|
|
/// 创建一条 V3 人脸快照记录。
|
|
const ServiceFaceSyncRecord({
|
|
required this.id,
|
|
required this.sampleId,
|
|
required this.userId,
|
|
this.username,
|
|
required this.deptId,
|
|
this.deptName,
|
|
this.faceImg,
|
|
this.sourceUpdatedAt,
|
|
});
|
|
|
|
/// 从统一网络层返回的 JSON 创建快照记录。
|
|
factory ServiceFaceSyncRecord.fromJson(Map<String, dynamic> json) =>
|
|
_$ServiceFaceSyncRecordFromJson(json);
|
|
|
|
/// 将快照记录转换为 JSON,主要供模型测试和诊断使用。
|
|
Map<String, dynamic> toJson() => _$ServiceFaceSyncRecordToJson(this);
|
|
}
|
|
|
|
/// V3 部门人脸同步的固定上界游标页面。
|
|
@JsonSerializable()
|
|
class ServiceFaceSyncSnapshot {
|
|
/// 当前页面记录,服务端保证按数据库主键严格升序返回。
|
|
final List<ServiceFaceSyncRecord> records;
|
|
|
|
/// 下一页排他游标;末页仅用于终端完成连续性校验。
|
|
@JsonKey(
|
|
fromJson: JsonTool.anyToRequiredString,
|
|
toJson: JsonTool.stringToInt,
|
|
)
|
|
final String nextAfterId;
|
|
|
|
/// 是否还有位于固定快照上界内的下一页。
|
|
final bool hasMore;
|
|
|
|
/// 首次请求固定的人脸数据库主键上界,后续请求必须原样携带。
|
|
@JsonKey(
|
|
fromJson: JsonTool.anyToRequiredString,
|
|
toJson: JsonTool.stringToInt,
|
|
)
|
|
final String snapshotMaxId;
|
|
|
|
/// 创建一个固定上界游标页面。
|
|
const ServiceFaceSyncSnapshot({
|
|
required this.records,
|
|
required this.nextAfterId,
|
|
required this.hasMore,
|
|
required this.snapshotMaxId,
|
|
});
|
|
|
|
/// 从统一网络层返回的 JSON 创建快照页面。
|
|
factory ServiceFaceSyncSnapshot.fromJson(Map<String, dynamic> json) =>
|
|
_$ServiceFaceSyncSnapshotFromJson(json);
|
|
|
|
/// 将快照页面转换为 JSON,主要供模型测试使用。
|
|
Map<String, dynamic> toJson() => _$ServiceFaceSyncSnapshotToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class ServiceTenant {
|
|
/// id
|
|
final String? id;
|
|
|
|
/// 编号
|
|
final String? code;
|
|
|
|
/// 编号
|
|
final String? name;
|
|
|
|
final String? menuId;
|
|
|
|
final String? miniQr;
|
|
|
|
ServiceTenant({
|
|
this.id,
|
|
this.code,
|
|
this.name,
|
|
this.menuId,
|
|
this.miniQr,
|
|
});
|
|
|
|
factory ServiceTenant.fromJson(Map<String, dynamic> json) =>
|
|
_$ServiceTenantFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$ServiceTenantToJson(this);
|
|
}
|