SPSBShebaoData.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // SPSBShebaoData.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/22.
  6. //
  7. #import "SPSBShebaoData.h"
  8. #import <UIKit/UIKit.h>
  9. #import "SPSBBusinessManager.h"
  10. @implementation SPSBFlowModel @end
  11. @implementation SPSBFundsItemModel
  12. - (bool)handleAdditionalProperty {
  13. [super handleAdditionalProperty];
  14. if ([_spsb_min floatValue] != [_spsb_min integerValue]) {
  15. _spsb_min = [NSString stringWithFormat:@"%ld", (long)[_spsb_min integerValue] + 1];
  16. }
  17. if ([_spsb_max floatValue] != [_spsb_max integerValue]) {
  18. _spsb_max = [NSString stringWithFormat:@"%ld", (long)[_spsb_max integerValue]];
  19. }
  20. return true;
  21. }
  22. @end
  23. @implementation SPSBShebaos @end
  24. @implementation SPSBShebaosModel
  25. - (id)GETspsb_dataWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
  26. return [SPSBShebaos getModelListWithArray:dic[key]];
  27. }
  28. @end
  29. @implementation SPSBShebaoData
  30. - (id)GETspsb_fundsWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
  31. return [SPSBFundsItemModel getModelListWithArray:dic[key]];
  32. }
  33. - (id)GETspsb_shebaosWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
  34. return [SPSBShebaosModel getModelListWithArray:dic[key]];
  35. }
  36. - (id)GETspsb_monthWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
  37. return spsb_changeTime([self getStringDataWithDictionary:dic variable:key]);
  38. }
  39. - (bool)handleAdditionalProperty {
  40. [super handleAdditionalProperty];
  41. NSMutableDictionary *dic = NSMutableDictionary.new;
  42. for (SPSBShebaosModel *model in _spsb_shebaos) {
  43. CGFloat total = 0.f;
  44. NSMutableArray *arr = NSMutableArray.new;
  45. for (SPSBShebaos *shabaos in model.spsb_data) {
  46. total += shabaos.spsb_p.floatValue;
  47. [arr addObject:shabaos];
  48. }
  49. [self sort:arr];
  50. SPSBShebaos *s = SPSBShebaos.new;
  51. s.spsb_n = @"合计";
  52. s.spsb_p = [NSString stringWithFormat:@"%0.2f", total];
  53. [arr addObject:s];
  54. dic[model.spsb_hukou_type] = arr;
  55. }
  56. _spsba_shebao = dic;
  57. return true;
  58. }
  59. - (void)sort:(NSMutableArray<SPSBShebaos *> *)array {
  60. for (NSInteger i = 1; i < array.count; i ++) {
  61. NSInteger j = i - 1;
  62. SPSBShebaos *velues = array[i];
  63. while (j >= 0 && array[j].spsb_i.integerValue > velues.spsb_i.integerValue) {
  64. array[j + 1] = array[j];
  65. j --;
  66. }
  67. array[j + 1] = velues;
  68. }
  69. }
  70. @end
  71. @implementation SPSBShebaoBaseData
  72. - (id)GETspsb_flowWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
  73. return [SPSBFlowModel getModelWithDictionary:dic[key]];
  74. }
  75. - (id)GETspsb_wxyjWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
  76. return [SPSBShebaoData getModelListWithArray:dic[key]];
  77. }
  78. + (NSArray<SPSBShebaoData *> *)getShebaoDataListWithDictionary:(id)dict {
  79. SPSBShebaoBaseData *baseData = [self getModelWithDictionary:dict];
  80. for (SPSBShebaoData *data in baseData.spsb_wxyj) {
  81. data.spsba_flow = baseData.spsb_flow;
  82. data.spsba_sb_vol = baseData.spsb_sb_vol;
  83. data.spsba_fund_vol = baseData.spsb_fund_vol;
  84. }
  85. return baseData.spsb_wxyj;
  86. }
  87. @end