PerformanceRankListModel.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // PerformanceRankListModel.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2018/6/4.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "PerformanceRankListModel.h"
  9. @implementation PerformanceRankListModel
  10. + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
  11. return @{
  12. @"staffName":@"StaffName",
  13. @"salesAmount":@"StaffComplete",
  14. @"currentMonthTaskAmount":@"StaffTask",
  15. @"completePercent":@"StaffTax",
  16. @"staffId":@"StaffID"
  17. };
  18. }
  19. /*!
  20. * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
  21. * NSDate *time dic[@"t"]是double类型的的秒数
  22. * Dic -> model
  23. */
  24. - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
  25. double salesAmountValue= [[dic objectForKey:@"StaffComplete"]doubleValue];
  26. _salesAmount= [NSString stringWithFormat:@"%.2f",salesAmountValue];
  27. double staffTaskValue= [[dic objectForKey:@"StaffTask"]doubleValue];
  28. _currentMonthTaskAmount=[NSString stringWithFormat:@"%.2f",staffTaskValue];
  29. double completePercent= [[dic objectForKey:@"StaffTax"]doubleValue];
  30. _completePercent=[NSString stringWithFormat:@"%.2f",completePercent];
  31. return YES;
  32. }
  33. @end