SPSBMyPurchaseOrder.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //
  2. // SPSBMyPurchaseOrder.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/22.
  6. //
  7. #import "SPSBMyPurchaseOrder.h"
  8. #import <objc/runtime.h>
  9. @implementation SPSBMyPurchasers
  10. @end
  11. @implementation SPSBMyPurchasersImage
  12. @end
  13. @implementation SPSBMyPurchaseOrder
  14. - (instancetype)init {
  15. self = [super init];
  16. if (!self) return nil;
  17. _spsb_payFor = @"";
  18. _spsb_pack = false;
  19. _spsb_SSCard = 0;
  20. _spsb_accountType = 1;
  21. _spsb_accumulationFund = 0.0;
  22. _spsb_salary = 0;
  23. _spsb_isNeedSalary = false;
  24. _spsb_isInOffice = false;
  25. _spsb_wageBase = 0;
  26. _spsb_purchaseFundWay = SPSBPurchaseFundWaySum;
  27. _spsb_isNewPurchasers = false;
  28. _spsb_NewPurchasersData = [SPSBMyPurchasers getModelWithDictionary:@{}];
  29. _spsb_NewPurchasersImageDict = SPSBMyPurchasersImage.new;
  30. _spsb_purchasersData = [SPSBMyPurchasers getModelWithDictionary:@{}];
  31. _spsb_timeInterval = 1;
  32. _spsb_isSupplementaryPay = false;
  33. _spsb_isFirstBuyShebao = false;
  34. _spsb_isFirstBuyFund = false;
  35. return self;
  36. }
  37. - (void)setSpsb_pack:(bool)spsb_pack {
  38. _spsb_pack = spsb_pack;
  39. if (_spsb_pack) {
  40. if (_spsb_purchaseType == SPSBPurchaseSocialInsurance) {
  41. _spsb_purchaseType = SPSBPurchaseSocialInsurancePackage;
  42. } else if (_spsb_purchaseType == SPSBPurchaseAccumulationFund) {
  43. _spsb_purchaseType = SPSBPurchaseAccumulationFundPackage;
  44. }
  45. } else {
  46. if (_spsb_purchaseType == SPSBPurchaseSocialInsurancePackage) {
  47. _spsb_purchaseType = SPSBPurchaseSocialInsurance;
  48. _spsb_isFirstBuyFund = false;
  49. } else if (_spsb_purchaseType == SPSBPurchaseAccumulationFundPackage) {
  50. _spsb_purchaseType = SPSBPurchaseAccumulationFund;
  51. _spsb_SSCard = 0;
  52. _spsb_isFirstBuyShebao = false;
  53. }
  54. }
  55. }
  56. - (id)copyWithZone:(NSZone *)zone {
  57. Class class = [self class];
  58. id new = class.new;
  59. while ([NSStringFromClass(class) hasPrefix:@"SPSB"]) {
  60. unsigned int count;
  61. objc_property_t *properties = class_copyPropertyList(class, &count);
  62. for(int i = 0; i < count; i++) {
  63. objc_property_t property = properties[i];
  64. NSString *key = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding];
  65. if ([key hasPrefix:@"spsb"]) {
  66. id value = [self valueForKey:key];
  67. if ([value respondsToSelector:@selector(copyWithZone:)]) {
  68. value = [value copy];
  69. }
  70. [new setValue:value forKey:key];
  71. }
  72. }
  73. free(properties);
  74. class = class_getSuperclass(class);
  75. }
  76. return new;
  77. }
  78. - (NSString *)description {
  79. NSMutableString *desc = [NSMutableString stringWithString:@""];
  80. unsigned int count;
  81. objc_property_t *properties = class_copyPropertyList([self class], &count);
  82. for(int i = 0; i < count; i++) {
  83. objc_property_t property = properties[i];
  84. NSString *key = [[NSString alloc] initWithCString:property_getName(property) encoding:NSUTF8StringEncoding];
  85. if ([key hasPrefix:@"spsb"]) {
  86. [desc appendFormat:@"%@ : %@\n", key, [self valueForKey:key]];
  87. }
  88. }
  89. return desc;
  90. }
  91. @end