// // SPSBMyPurchaseOrder.m // 我的社保 // // Created by shanp on 2021/4/22. // #import "SPSBMyPurchaseOrder.h" #import @implementation SPSBMyPurchasers @end @implementation SPSBMyPurchasersImage @end @implementation SPSBMyPurchaseOrder - (instancetype)init { self = [super init]; if (!self) return nil; _spsb_payFor = @""; _spsb_pack = false; _spsb_SSCard = 0; _spsb_accountType = 1; _spsb_accumulationFund = 0.0; _spsb_salary = 0; _spsb_isNeedSalary = false; _spsb_isInOffice = false; _spsb_wageBase = 0; _spsb_purchaseFundWay = SPSBPurchaseFundWaySum; _spsb_isNewPurchasers = false; _spsb_NewPurchasersData = [SPSBMyPurchasers getModelWithDictionary:@{}]; _spsb_NewPurchasersImageDict = SPSBMyPurchasersImage.new; _spsb_purchasersData = [SPSBMyPurchasers getModelWithDictionary:@{}]; _spsb_timeInterval = 1; _spsb_isSupplementaryPay = false; _spsb_isFirstBuyShebao = false; _spsb_isFirstBuyFund = false; return self; } - (void)setSpsb_pack:(bool)spsb_pack { _spsb_pack = spsb_pack; if (_spsb_pack) { if (_spsb_purchaseType == SPSBPurchaseSocialInsurance) { _spsb_purchaseType = SPSBPurchaseSocialInsurancePackage; } else if (_spsb_purchaseType == SPSBPurchaseAccumulationFund) { _spsb_purchaseType = SPSBPurchaseAccumulationFundPackage; } } else { if (_spsb_purchaseType == SPSBPurchaseSocialInsurancePackage) { _spsb_purchaseType = SPSBPurchaseSocialInsurance; _spsb_isFirstBuyFund = false; } else if (_spsb_purchaseType == SPSBPurchaseAccumulationFundPackage) { _spsb_purchaseType = SPSBPurchaseAccumulationFund; _spsb_SSCard = 0; _spsb_isFirstBuyShebao = false; } } } - (id)copyWithZone:(NSZone *)zone { Class class = [self class]; id new = class.new; while ([NSStringFromClass(class) hasPrefix:@"SPSB"]) { unsigned int count; objc_property_t *properties = class_copyPropertyList(class, &count); for(int i = 0; i < count; i++) { objc_property_t property = properties[i]; NSString *key = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding]; if ([key hasPrefix:@"spsb"]) { id value = [self valueForKey:key]; if ([value respondsToSelector:@selector(copyWithZone:)]) { value = [value copy]; } [new setValue:value forKey:key]; } } free(properties); class = class_getSuperclass(class); } return new; } - (NSString *)description { NSMutableString *desc = [NSMutableString stringWithString:@""]; unsigned int count; objc_property_t *properties = class_copyPropertyList([self class], &count); for(int i = 0; i < count; i++) { objc_property_t property = properties[i]; NSString *key = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding]; if ([key hasPrefix:@"spsb"]) { [desc appendFormat:@"%@ : %@\n", key, [self valueForKey:key]]; } } return desc; } @end