fix:参考金值,研听,研值工程通用通用工程公共能力,重点对比网络请求、登录认证、状态管理、本地存储、WebView、推送、版本更新、一键登录、主题/UI 等模块,确定后续统一整改方案
This commit is contained in:
1 parent
6997a65c96
commit
d364c6d908
46 files changed
+2060
-395
No files matched your search
@@ -51,6 +51,45 @@ class GoldAssetHolding {
|
||||
final HoldingStatus status;
|
||||
|
||||
double materialValue(double spotPrice) => weightGram * purity * spotPrice;
|
||||
|
||||
Map<String, Object?> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'metal': metal.name,
|
||||
'category': category.name,
|
||||
'purity': purity,
|
||||
'purityLabel': purityLabel,
|
||||
'weightGram': weightGram,
|
||||
'costAmount': costAmount,
|
||||
'purchaseDate': purchaseDate?.toIso8601String(),
|
||||
'channel': channel,
|
||||
'note': note,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'updatedAt': updatedAt.toIso8601String(),
|
||||
'status': status.name,
|
||||
};
|
||||
|
||||
factory GoldAssetHolding.fromJson(Map<String, Object?> json) {
|
||||
return GoldAssetHolding(
|
||||
id: json['id']! as String,
|
||||
name: json['name']! as String,
|
||||
metal: MetalType.values.byName(json['metal']! as String),
|
||||
category: AssetCategory.values.byName(json['category']! as String),
|
||||
purity: (json['purity']! as num).toDouble(),
|
||||
purityLabel: json['purityLabel']! as String,
|
||||
weightGram: (json['weightGram']! as num).toDouble(),
|
||||
costAmount: (json['costAmount'] as num?)?.toDouble(),
|
||||
purchaseDate: switch (json['purchaseDate']) {
|
||||
final String value when value.isNotEmpty => DateTime.parse(value),
|
||||
_ => null,
|
||||
},
|
||||
channel: json['channel'] as String?,
|
||||
note: json['note'] as String?,
|
||||
createdAt: DateTime.parse(json['createdAt']! as String),
|
||||
updatedAt: DateTime.parse(json['updatedAt']! as String),
|
||||
status: HoldingStatus.values.byName(json['status']! as String),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HoldingValuation {
|
||||
|
||||
Reference in new issue
Block a user