SingleProfitAnalyseListModel.m 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // SingleProfitAnalyseListModel.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2019/4/11.
  6. // Copyright © 2019 elongtian. All rights reserved.
  7. //
  8. #import "SingleProfitAnalyseListModel.h"
  9. @implementation SingleProfitAnalyseListModel
  10. + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
  11. return @{
  12. @"invoiceTypeName":@"InvoiceTypeName",
  13. @"organizationName":@"OrganizationName",
  14. @"organizationCode":@"OrganizationCode",
  15. @"amount":@"Amount",
  16. @"costAmount":@"CostAmount",
  17. @"marginAmount":@"MarginAmount",
  18. @"staffAmount":@"StaffAmount",
  19. @"serviceAmount":@"ServiceAmount",
  20. @"customerAmount":@"CustomerRebateAmount",
  21. @"feeAmount":@"FeeAmount",
  22. @"profitAmount":@"ProfitAmount",
  23. @"rebatesSum":@"RebatesSum",
  24. @"rateOfMargin":@"RateOfMargin"
  25. };
  26. }
  27. /*!
  28. * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
  29. * NSDate *time dic[@"t"]是double类型的的秒数
  30. */
  31. /// Dic -> model
  32. - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
  33. double amountValue= [[dic objectForKey:@"Amount"]doubleValue];
  34. _amount=[NSString stringWithFormat:@"%.2f",amountValue];
  35. double costAmountValue=[[dic objectForKey:@"CostAmount"]doubleValue];
  36. _costAmount=[NSString stringWithFormat:@"%.2f",costAmountValue];
  37. double marginAmountValue=[[dic objectForKey:@"MarginAmount"]doubleValue];
  38. _marginAmount=[NSString stringWithFormat:@"%.2f",marginAmountValue];
  39. double staffAmountValue=[[dic objectForKey:@"StaffAmount"]doubleValue];
  40. _staffAmount=[NSString stringWithFormat:@"%.2f",staffAmountValue];
  41. double serviceAmountValue=[[dic objectForKey:@"ServiceAmount"]doubleValue];
  42. _serviceAmount=[NSString stringWithFormat:@"%.2f",serviceAmountValue];
  43. double customerAmountValue=[[dic objectForKey:@"CustomerAmount"]doubleValue];
  44. _customerAmount=[NSString stringWithFormat:@"%.2f",customerAmountValue];
  45. double feeAmountValue=[[dic objectForKey:@"FeeAmount"]doubleValue];
  46. _feeAmount=[NSString stringWithFormat:@"%.2f",feeAmountValue];
  47. double profitAmountValue=[[dic objectForKey:@"ProfitAmount"]doubleValue];
  48. _profitAmount=[NSString stringWithFormat:@"%.2f",profitAmountValue];
  49. double rebatesSumValue=[[dic objectForKey:@"RebatesSum"]doubleValue];
  50. _rebatesSum=[NSString stringWithFormat:@"%.2f",rebatesSumValue];
  51. double rateOfMarginValue=[[dic objectForKey:@"RateOfMargin"]doubleValue];
  52. _rateOfMargin=[NSString stringWithFormat:@"%.2f",rateOfMarginValue];
  53. return YES;
  54. }
  55. @end