| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // InstallReceiptDetailModel.m
- // IBOSS
- //
- // Created by guan hong hou on 2017/8/1.
- // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
- //
- // 功能描述:安装回执明细模型
- #import "InstallReceiptDetailModel.h"
- @implementation InstallReceiptDetailModel
- /*!
- * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
- * 前:模型的属性 后:字典里的属性
- */
- + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
-
- return @{@"saleNo":@"SalesNo",
- @"receiptRemark":@"ReceiptRemarks",
- @"receiptType":@"ReceiptType",
- @"code":@"Code",
- @"onlyCode":@"OnlyCode",
- @"kindName":@"KindName",
- @"brandName":@"BrandName",
- @"varietyName":@"VarietyName",
- @"seriesName":@"SeriesName",
- @"unitName":@"UnitName",
- @"package":@"Package",
- @"weight":@"Weight",
- @"acreage":@"Acreage",
- @"box":@"Box",
- @"piece":@"Piece",
- @"m2":@"M2",
- @"otherContact":@"OtherContact",
- @"expandAttribute":@"ExpandAttribute",
- @"expandAttributeTwo":@"ExpandAttribute2"
-
- };
-
- }
- /*!
- * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
- * NSDate *time dic[@"t"]是double类型的的秒数
- * Dic -> model
- */
- - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
- int decimalPlaces = [[dic objectForKey:@"DecimalPlaces"] intValue];
- NSString *str = [NSString stringWithFormat:@"%@%d%@",@"%.",decimalPlaces,@"f"];
- self.installQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"InstallationQuantity"]doubleValue]];
- self.receiptQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"ReceiptQuantity"]doubleValue]];
- _receiptType = [NSString stringWithFormat:@"%ld",(long)[[dic objectForKey:@"ReceiptType"] integerValue]];
- return YES;
- }
- @end
|