123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // SPSBShebaoData.m
- // 我的社保
- //
- // Created by shanp on 2021/4/22.
- //
- #import "SPSBShebaoData.h"
- #import <UIKit/UIKit.h>
- #import "SPSBBusinessManager.h"
- @implementation SPSBFlowModel @end
- @implementation SPSBFundsItemModel
- - (bool)handleAdditionalProperty {
- [super handleAdditionalProperty];
- if ([_spsb_min floatValue] != [_spsb_min integerValue]) {
- _spsb_min = [NSString stringWithFormat:@"%ld", (long)[_spsb_min integerValue] + 1];
- }
- if ([_spsb_max floatValue] != [_spsb_max integerValue]) {
- _spsb_max = [NSString stringWithFormat:@"%ld", (long)[_spsb_max integerValue]];
- }
- return true;
- }
- @end
- @implementation SPSBShebaos @end
- @implementation SPSBShebaosModel
- - (id)GETspsb_dataWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
- return [SPSBShebaos getModelListWithArray:dic[key]];
- }
- @end
- @implementation SPSBShebaoData
- - (id)GETspsb_fundsWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
- return [SPSBFundsItemModel getModelListWithArray:dic[key]];
- }
- - (id)GETspsb_shebaosWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
- return [SPSBShebaosModel getModelListWithArray:dic[key]];
- }
- - (id)GETspsb_monthWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
- return spsb_changeTime([self getStringDataWithDictionary:dic variable:key]);
- }
- - (bool)handleAdditionalProperty {
- [super handleAdditionalProperty];
- NSMutableDictionary *dic = NSMutableDictionary.new;
- for (SPSBShebaosModel *model in _spsb_shebaos) {
- CGFloat total = 0.f;
- NSMutableArray *arr = NSMutableArray.new;
- for (SPSBShebaos *shabaos in model.spsb_data) {
- total += shabaos.spsb_p.floatValue;
- [arr addObject:shabaos];
- }
- [self sort:arr];
- SPSBShebaos *s = SPSBShebaos.new;
- s.spsb_n = @"合计";
- s.spsb_p = [NSString stringWithFormat:@"%0.2f", total];
- [arr addObject:s];
- dic[model.spsb_hukou_type] = arr;
- }
- _spsba_shebao = dic;
- return true;
- }
- - (void)sort:(NSMutableArray<SPSBShebaos *> *)array {
- for (NSInteger i = 1; i < array.count; i ++) {
- NSInteger j = i - 1;
- SPSBShebaos *velues = array[i];
- while (j >= 0 && array[j].spsb_i.integerValue > velues.spsb_i.integerValue) {
- array[j + 1] = array[j];
- j --;
- }
- array[j + 1] = velues;
- }
- }
- @end
- @implementation SPSBShebaoBaseData
- - (id)GETspsb_flowWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
- return [SPSBFlowModel getModelWithDictionary:dic[key]];
- }
- - (id)GETspsb_wxyjWithDictionary:(nullable NSDictionary *)dic key:(NSString *)key {
- return [SPSBShebaoData getModelListWithArray:dic[key]];
- }
- + (NSArray<SPSBShebaoData *> *)getShebaoDataListWithDictionary:(id)dict {
- SPSBShebaoBaseData *baseData = [self getModelWithDictionary:dict];
- for (SPSBShebaoData *data in baseData.spsb_wxyj) {
- data.spsba_flow = baseData.spsb_flow;
- data.spsba_sb_vol = baseData.spsb_sb_vol;
- data.spsba_fund_vol = baseData.spsb_fund_vol;
- }
- return baseData.spsb_wxyj;
- }
- @end
|