SingleProfitAnalyseDetailModel.m 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // SingleProfitAnalyseDetailModel.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2019/4/12.
  6. // Copyright © 2019 elongtian. All rights reserved.
  7. //
  8. #import "SingleProfitAnalyseDetailModel.h"
  9. @implementation SingleProfitAnalyseDetailModel
  10. /*!
  11. * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
  12. * 前:模型的属性 后:字典里的属性
  13. */
  14. + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
  15. return @{
  16. @"invoiceTypeName":@"InvoiceTypeName",
  17. @"invoiceNo":@"InvoiceNo",
  18. @"organizationCode":@"OrganizationCode",
  19. @"organizationName":@"OrganizationName",
  20. @"staffName":@"StaffName",
  21. @"accountDate":@"AccountDate",
  22. @"customerName":@"CustomerName",
  23. @"customerCode":@"CustomerCode",
  24. @"telephone":@"Telephone",
  25. @"customerTypeName":@"CustomerTypeName",
  26. @"customerAddress":@"CustomerAddress",
  27. @"channelName":@"ChannelName",
  28. @"amount":@"Amount",
  29. @"costAmount":@"CostAmount",
  30. @"marginAmount":@"MarginAmount",
  31. @"staffAmount":@"StaffAmount",
  32. @"serviceAmount":@"ServiceAmount",
  33. @"customerAmount":@"CustomerRebateAmount",
  34. @"feeAmount":@"FeeAmount",
  35. @"profitAmount":@"ProfitAmount",
  36. @"rebatesSum":@"RebatesSum",
  37. @"rateOfMargin":@"RateOfMargin",
  38. @"staff":@"Staff",
  39. @"intermediateStaff":@"IntermediateStaff"
  40. };
  41. }
  42. /*!
  43. * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
  44. * NSDate *time dic[@"t"]是double类型的的秒数
  45. */
  46. /// Dic -> model
  47. - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
  48. double amountValue= [[dic objectForKey:@"Amount"]doubleValue];
  49. _amount=[NSString stringWithFormat:@"%.2f",amountValue];
  50. double costAmountValue= [[dic objectForKey:@"CostAmount"]doubleValue];
  51. _costAmount=[NSString stringWithFormat:@"%.2f",costAmountValue];
  52. double marginAmountValue= [[dic objectForKey:@"MarginAmount"]doubleValue];
  53. _marginAmount=[NSString stringWithFormat:@"%.2f",marginAmountValue];
  54. double serviceAmountValue= [[dic objectForKey:@"ServiceAmount"]doubleValue];
  55. _serviceAmount=[NSString stringWithFormat:@"%.2f",serviceAmountValue];
  56. double customerRebateAmountValue= [[dic objectForKey:@"CustomerRebateAmount"]doubleValue];
  57. _customerAmount=[NSString stringWithFormat:@"%.2f",customerRebateAmountValue];
  58. double feeAmountValue= [[dic objectForKey:@"FeeAmount"]doubleValue];
  59. _feeAmount=[NSString stringWithFormat:@"%.2f",feeAmountValue];
  60. double profitAmountValue= [[dic objectForKey:@"ProfitAmount"]doubleValue];
  61. _profitAmount=[NSString stringWithFormat:@"%.2f",profitAmountValue];
  62. double rebatesSumValue= [[dic objectForKey:@"RebatesSum"]doubleValue];
  63. _rebatesSum=[NSString stringWithFormat:@"%.2f",rebatesSumValue];
  64. double rateOfMarginValue= [[dic objectForKey:@"RateOfMargin"]doubleValue];
  65. _rateOfMargin=[NSString stringWithFormat:@"%.2f",rateOfMarginValue];
  66. NSString *accountDateStr= [dic objectForKey:@"AccountDate"];
  67. _accountDate=[DateFormat dateFormatSplit:accountDateStr];
  68. return YES;
  69. }
  70. @end