| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //
- // SingleProfitAnalyseDetailModel.m
- // IBOSS
- //
- // Created by 关宏厚 on 2019/4/12.
- // Copyright © 2019 elongtian. All rights reserved.
- //
- #import "SingleProfitAnalyseDetailModel.h"
- @implementation SingleProfitAnalyseDetailModel
- /*!
- * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
- * 前:模型的属性 后:字典里的属性
- */
- + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
-
- return @{
- @"invoiceTypeName":@"InvoiceTypeName",
- @"invoiceNo":@"InvoiceNo",
- @"organizationCode":@"OrganizationCode",
- @"organizationName":@"OrganizationName",
- @"staffName":@"StaffName",
- @"accountDate":@"AccountDate",
- @"customerName":@"CustomerName",
- @"customerCode":@"CustomerCode",
- @"telephone":@"Telephone",
- @"customerTypeName":@"CustomerTypeName",
- @"customerAddress":@"CustomerAddress",
- @"channelName":@"ChannelName",
- @"amount":@"Amount",
- @"costAmount":@"CostAmount",
- @"marginAmount":@"MarginAmount",
- @"staffAmount":@"StaffAmount",
- @"serviceAmount":@"ServiceAmount",
- @"customerAmount":@"CustomerRebateAmount",
- @"feeAmount":@"FeeAmount",
- @"profitAmount":@"ProfitAmount",
- @"rebatesSum":@"RebatesSum",
- @"rateOfMargin":@"RateOfMargin",
- @"staff":@"Staff",
- @"intermediateStaff":@"IntermediateStaff"
- };
- }
- /*!
- * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
- * NSDate *time dic[@"t"]是double类型的的秒数
- */
- /// Dic -> model
- - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
- double amountValue= [[dic objectForKey:@"Amount"]doubleValue];
- _amount=[NSString stringWithFormat:@"%.2f",amountValue];
-
- double costAmountValue= [[dic objectForKey:@"CostAmount"]doubleValue];
- _costAmount=[NSString stringWithFormat:@"%.2f",costAmountValue];
-
- double marginAmountValue= [[dic objectForKey:@"MarginAmount"]doubleValue];
- _marginAmount=[NSString stringWithFormat:@"%.2f",marginAmountValue];
-
- double serviceAmountValue= [[dic objectForKey:@"ServiceAmount"]doubleValue];
- _serviceAmount=[NSString stringWithFormat:@"%.2f",serviceAmountValue];
-
- double customerRebateAmountValue= [[dic objectForKey:@"CustomerRebateAmount"]doubleValue];
- _customerAmount=[NSString stringWithFormat:@"%.2f",customerRebateAmountValue];
-
- double feeAmountValue= [[dic objectForKey:@"FeeAmount"]doubleValue];
- _feeAmount=[NSString stringWithFormat:@"%.2f",feeAmountValue];
-
- double profitAmountValue= [[dic objectForKey:@"ProfitAmount"]doubleValue];
- _profitAmount=[NSString stringWithFormat:@"%.2f",profitAmountValue];
-
- double rebatesSumValue= [[dic objectForKey:@"RebatesSum"]doubleValue];
- _rebatesSum=[NSString stringWithFormat:@"%.2f",rebatesSumValue];
-
- double rateOfMarginValue= [[dic objectForKey:@"RateOfMargin"]doubleValue];
- _rateOfMargin=[NSString stringWithFormat:@"%.2f",rateOfMarginValue];
- NSString *accountDateStr= [dic objectForKey:@"AccountDate"];
- _accountDate=[DateFormat dateFormatSplit:accountDateStr];
-
- return YES;
- }
- @end
|