// // SPSBBusinessManager.m // 我的社保 // // Created by shanp on 2021/4/19. // #import "SPSBBusinessManager.h" #import "SPSBNetworkManager.h" #import "SPSBShebaoData.h" #import "SPSBMyPurchaseOrder.h" #import "SPSBRedDotModel.h" #import "SPSBFastLoginManager.h" #import "SPSBGeneralManager.h" #import "SPSBNotificationDelegateManager.h" #import #import "JXHPhotoManager.h" #import "SPSBHomeViewButtonsModel.h" #pragma mark - 数据 static NSArray *_householdRegisterArray; NSArray *spsb_householdRegisterArray() { if (!_householdRegisterArray) { static dispatch_once_t once; dispatch_once(&once, ^{ _householdRegisterArray = @[@"本地城镇户口", @"本地农村户口", @"外地城镇户口", @"外地农村户口"]; }); } return _householdRegisterArray; } static NSArray *_bankArray; NSArray *spsb_bankArray() { if (!_bankArray) { static dispatch_once_t once; dispatch_once(&once, ^{ _bankArray = @[@"中国银行", @"中国工商银行", @"中国建设银行", @"招商银行", @"中国农业银行", @"交通银行", @"广发银行", @"中信银行", @"平安银行", @"中国邮政储蓄银行", @"中国民生银行", @"兴业银行", @"中国光大银行", @"浦发银行", @"华夏银行"]; }); } return _bankArray; } static NSDictionary *_bankIconDictionary; NSDictionary *spsb_bankIconDictionary() { if (!_bankIconDictionary) { static dispatch_once_t once; dispatch_once(&once, ^{ _bankIconDictionary = @{@"中国银行": @"zhonghang", @"中国工商银行": @"gonghang", @"中国建设银行": @"jianhang", @"招商银行": @"zhaohang", @"中国农业银行": @"nonghang", @"交通银行": @"jiaohang", @"广发银行": @"guangfa", @"中信银行": @"zhongxing", @"平安银行": @"pingan", @"中国邮政储蓄银行": @"youzheng", @"中国民生银行": @"minsheng", @"兴业银行": @"xingye", @"中国光大银行": @"guangda", @"浦发银行": @"pufa", @"华夏银行": @"huaxia"}; }); } return _bankIconDictionary; } static NSDictionary *_alipayBankDictionary; NSDictionary *spsb_alipayBankDictionary() { if (!_alipayBankDictionary) { static dispatch_once_t once; dispatch_once(&once, ^{ _alipayBankDictionary = @{ @"SRCB": @"深圳农村商业银行", @"BGB": @"广西北部湾银行", @"SHRCB": @"上海农村商业银行", @"BJBANK": @"北京银行", @"WHCCB": @"威海市商业银行", @"BOZK": @"周口银行", @"KORLABANK": @"库尔勒市商业银行", @"SPABANK": @"平安银行", @"SDEB": @"顺德农商银行", @"HURCB": @"湖北省农村信用社", @"WRCB": @"无锡农村商业银行", @"BOCY": @"朝阳银行", @"CZBANK": @"浙商银行", @"HDBANK": @"邯郸银行", @"BOC": @"中国银行", @"BOD": @"东莞银行", @"CCB": @"中国建设银行", @"ZYCBANK": @"遵义市商业银行", @"SXCB": @"绍兴银行", @"GZRCU": @"贵州省农村信用社", @"ZJKCCB": @"张家口市商业银行", @"BOJZ": @"锦州银行", @"BOP": @"平顶山银行", @"HKB": @"汉口银行", @"SPDB": @"上海浦东发展银行", @"NXRCU": @"宁夏黄河农村商业银行", @"NYNB": @"广东南粤银行", @"GRCB": @"广州农商银行", @"BOSZ": @"苏州银行", @"HZCB": @"杭州银行", @"HSBK": @"衡水银行", @"HBC": @"湖北银行", @"JXBANK": @"嘉兴银行", @"HRXJB": @"华融湘江银行", @"BODD": @"丹东银行", @"AYCB": @"安阳银行", @"EGBANK": @"恒丰银行", @"CDB": @"国家开发银行", @"TCRCB": @"江苏太仓农村商业银行", @"NJCB": @"南京银行", @"ZZBANK": @"郑州银行", @"DYCB": @"德阳商业银行", @"YBCCB": @"宜宾市商业银行", @"SCRCU": @"四川省农村信用", @"KLB": @"昆仑银行", @"LSBANK": @"莱商银行", @"YDRCB": @"尧都农商行", @"CCQTGB": @"重庆三峡银行", @"FDB": @"富滇银行", @"JSRCU": @"江苏省农村信用联合社", @"JNBANK": @"济宁银行", @"CMB": @"招商银行", @"JINCHB": @"晋城银行JCBANK", @"FXCB": @"阜新银行", @"WHRCB": @"武汉农村商业银行", @"HBYCBANK": @"湖北银行宜昌分行", @"TZCB": @"台州银行", @"TACCB": @"泰安市商业银行", @"XCYH": @"许昌银行", @"CEB": @"中国光大银行", @"NXBANK": @"宁夏银行", @"HSBANK": @"徽商银行", @"JJBANK": @"九江银行", @"NHQS": @"农信银清算中心", @"MTBANK": @"浙江民泰商业银行", @"LANGFB": @"廊坊银行", @"ASCB": @"鞍山银行", @"KSRB": @"昆山农村商业银行", @"YXCCB": @"玉溪市商业银行", @"DLB": @"大连银行", @"DRCBCL": @"东莞农村商业银行", @"GCB": @"广州银行", @"NBBANK": @"宁波银行", @"BOYK": @"营口银行", @"SXRCCU": @"陕西信合", @"GLBANK": @"桂林银行", @"BOQH": @"青海银行", @"CDRCB": @"成都农商银行", @"QDCCB": @"青岛银行", @"HKBEA": @"东亚银行", @"HBHSBANK": @"湖北银行黄石分行", @"WZCB": @"温州银行", @"TRCB": @"天津农商银行", @"QLBANK": @"齐鲁银行", @"GDRCC": @"广东省农村信用社联合社", @"ZJTLCB": @"浙江泰隆商业银行", @"GZB": @"赣州银行", @"GYCB": @"贵阳市商业银行", @"CQBANK": @"重庆银行", @"DAQINGB": @"龙江银行", @"CGNB": @"南充市商业银行", @"SCCB": @"三门峡银行", @"CSRCB": @"常熟农村商业银行", @"SHBANK": @"上海银行", @"JLBANK": @"吉林银行", @"CZRCB": @"常州农村信用联社", @"BANKWF": @"潍坊银行", @"ZRCBANK": @"张家港农村商业银行", @"FJHXBC": @"福建海峡银行", @"ZJNX": @"浙江省农村信用社联合社", @"LZYH": @"兰州银行", @"JSB": @"晋商银行", @"BOHAIB": @"渤海银行", @"CZCB": @"浙江稠州商业银行", @"YQCCB": @"阳泉银行", @"SJBANK": @"盛京银行", @"XABANK": @"西安银行", @"BSB": @"包商银行", @"JSBANK": @"江苏银行", @"FSCB": @"抚顺银行", @"HNRCU": @"河南省农村信用", @"COMM": @"交通银行", @"XTB": @"邢台银行", @"CITIC": @"中信银行", @"HXBANK": @"华夏银行", @"HNRCC": @"湖南省农村信用社", @"DYCCB": @"东营市商业银行", @"ORBANK": @"鄂尔多斯银行", @"BJRCB": @"北京农村商业银行", @"XYBANK": @"信阳银行", @"ZGCCB": @"自贡市商业银行", @"CDCB": @"成都银行", @"HANABANK": @"韩亚银行", @"CMBC": @"中国民生银行", @"LYBANK": @"洛阳银行", @"GDB": @"广东发展银行", @"ZBCB": @"齐商银行", @"CBKF": @"开封市商业银行", @"H3CB": @"内蒙古银行", @"CIB": @"兴业银行", @"CRCBANK": @"重庆农村商业银行", @"SZSBK": @"石嘴山银行", @"DZBANK": @"德州银行", @"SRBANK": @"上饶银行", @"LSCCB": @"乐山市商业银行", @"JXRCU": @"江西省农村信用", @"ICBC": @"中国工商银行", @"JZBANK": @"晋中市商业银行", @"HZCCB": @"湖州市商业银行", @"NHB": @"南海农村信用联社", @"XXBANK": @"新乡银行", @"JRCB": @"江苏江阴农村商业银行", @"YNRCC": @"云南省农村信用社", @"ABC": @"中国农业银行", @"GXRCU": @"广西省农村信用", @"PSBC": @"中国邮政储蓄银行", @"BZMD": @"驻马店银行", @"ARCU": @"安徽省农村信用社", @"GSRCU": @"甘肃省农村信用", @"LYCB": @"辽阳市商业银行", @"JLRCU": @"吉林农信", @"URMQCCB": @"乌鲁木齐市商业银行", @"XLBANK": @"中山小榄村镇银行", @"CSCB": @"长沙银行", @"JHBANK": @"金华银行", @"BHB": @"河北银行", @"NBYZ": @"鄞州银行", @"LSBC": @"临商银行", @"BOCD": @"承德银行", @"SDRCU": @"山东农信", @"NCB": @"南昌银行", @"TCCB": @"天津银行", @"WJRCB": @"吴江农商银行", @"CBBQS": @"城市商业银行资金清算中心", @"HBRCU": @"河北省农村信用社" }; }); } return _alipayBankDictionary; } NSString *spsb_defaultSupplementaryPayNote() { return @"请确保补缴月与当前正常参保月连续,并于当前参保月截止时间前支付补缴订单。"; } NSArray *spsb_getIsPurchaseSSCardArray() { return @[@"不办卡", @"新办卡(不支持补办)"]; } #pragma mark - App相关 static bool _spsb_appActive = false; bool spsb_isAppActive() { return _spsb_appActive; } void spsb_setAppActive(bool active) { _spsb_appActive = active; } static SPSBHomeViewButtonsModel *_spsb_homeViewButtons = nil; SPSBHomeViewButtonsModel * _Nullable spsb_homeViewButtons(void) { return _spsb_homeViewButtons; } void spsb_setHomeViewButtons(SPSBHomeViewButtonsModel *model) { _spsb_homeViewButtons = model; } static NSArray *_spsb_adsArray = nil; NSArray *spsb_adsArray() { if (nil == _spsb_adsArray) return @[]; return _spsb_adsArray; } void spsb_setAdsArray(NSArray *array) { _spsb_adsArray = array; } static NSArray *_spsb_policyArray = nil; NSArray *spsb_policyArray() { if (nil == _spsb_policyArray) return @[]; return _spsb_policyArray; } void spsb_setPolicyArray(NSArray *array) { _spsb_policyArray = array; } static NSString *_spsb_lastCheckPublicDataCity = @""; NSString *spsb_lastCheckPublicDataCity() { return _spsb_lastCheckPublicDataCity; } void spsb_setLastCheckPublicDataCity(NSString *lastCheckPublicDataCity) { _spsb_lastCheckPublicDataCity = lastCheckPublicDataCity; } static NSString *_spsb_locationCheckPublicDataCity = @""; NSString *spsb_locationCheckPublicDataCity() { return _spsb_locationCheckPublicDataCity; } void spsb_setLocationCheckPublicDataCity(NSString *locationCheckPublicDataCity) { _spsb_locationCheckPublicDataCity = locationCheckPublicDataCity; } static CLLocationCoordinate2D _spsb_coordinate; CLLocationCoordinate2D spsb_coordinate() { return _spsb_coordinate; } void spsb_setCoordinate(CLLocationCoordinate2D coordinate) { _spsb_coordinate = coordinate; } static SPSBRedDotModel *_spsb_redDotModel = nil; SPSBRedDotModel *spsb_redDotModel() { if (nil == _spsb_redDotModel) return SPSBRedDotModel.new; return _spsb_redDotModel; } void spsb_setRedDotModel(SPSBRedDotModel *redDot) { _spsb_redDotModel = redDot; } NSInteger _spsb_wxpayLimit = 3000; NSInteger spsb_wxpayLimit() { return _spsb_wxpayLimit; } void spsb_setWxpayLimit(NSInteger wxpayLimit) { _spsb_wxpayLimit = wxpayLimit; } static bool _spsb_isOpenAlbum = false; void spsb_setIsOpenAlbum(bool isOpenAlbum) { _spsb_isOpenAlbum = isOpenAlbum; } bool spsb_isOpenAlbum() { return _spsb_isOpenAlbum; } #pragma mark - 账号相关 static bool _spsb_isLogin = false; bool spsb_isLogin() { return _spsb_isLogin; } void spsb_setLogin(bool login) { _spsb_isLogin = login; } static NSString *_spsb_loginToken = @""; NSString *spsb_loginToken() { return _spsb_loginToken; } void spsb_setLoginToken(NSString *loginToken) { _spsb_loginToken = loginToken; } #pragma mark - 购买社保公积金相关 static SPSBShebaoData *_spsb_shebaoData = nil; SPSBShebaoData *spsb_shebaoData() { if (nil == _spsb_shebaoData) return [SPSBShebaoData getModelWithDictionary:@{}]; return _spsb_shebaoData; } void spsb_setShebaoData(SPSBShebaoData *_Nullable data) { _spsb_shebaoData = data; } static NSArray *_spsb_shebaoDataArray = nil; NSArray *spsb_shebaoDataArray() { if (nil == _spsb_shebaoDataArray) return @[]; return _spsb_shebaoDataArray; } void spsb_setShebaoDataArray(NSArray * _Nullable array) { _spsb_shebaoDataArray = array; } static SPSBMyPurchaseOrder *_spsb_myPurchaseOrder = nil; SPSBMyPurchaseOrder * _Nullable spsb_myPurchaseOrder() { return _spsb_myPurchaseOrder; } void spsb_setMyPurchaseOrder(SPSBMyPurchaseOrder * _Nullable data) { _spsb_myPurchaseOrder = data; } static NSArray *_spsb_selectedCityArray = nil; NSArray *spsb_selectedCityArray() { if (nil == _spsb_selectedCityArray) return @[]; return _spsb_selectedCityArray; } void spsb_setSelectedCityArray(NSArray *array) { _spsb_selectedCityArray = array; } static NSInteger _spsb_firstYear = 2015; NSInteger spsb_firstYear() { return _spsb_firstYear; } void spsb_setFirstYear(NSInteger year) { if (year > 0) { _spsb_firstYear = year; } } NSString *spsb_changeTimeToNumber(NSString *time) { NSArray *arr = [time componentsSeparatedByString:@"年"]; NSInteger month = [arr[1] integerValue]; return [NSString stringWithFormat:@"%@%.2ld", arr[0], (long)month]; } NSString *spsb_changeTime(NSString *time) { if (time.length > 4) { NSString *year = [time substringToIndex:4]; NSString *month = [time substringFromIndex:4]; return [NSString stringWithFormat:@"%@年%@月", year, month]; } return time; } #pragma mark - 用户相关 static NSArray *_spsb_purchasersArray = nil; NSArray *spsb_purchasersArray() { if (nil == _spsb_purchasersArray) return @[]; return _spsb_purchasersArray; } void spsb_setPurchasersArray(NSArray *array) { _spsb_purchasersArray = array; } static NSString *_spsb_avatar = @""; NSString *spsb_userAvatar() { return _spsb_avatar; } void spsb_setUserAvatar(NSString *avatar) { _spsb_avatar = avatar; } #pragma mark - 相册相关 static bool _publishCanChooseVideo = true; bool spsb_publishCanChooseVideo() { return _publishCanChooseVideo; } void spsb_setPublishCanChooseVideo(bool can) { _publishCanChooseVideo = can; } static NSUInteger _publishMaxCount = 0; NSUInteger spsb_publishMaxCount() { return _publishMaxCount; } void spsb_setPublishMaxCount(NSUInteger max) { _publishMaxCount = max; } static NSUInteger _alreadyChosePublishPhoto = 0; NSUInteger spsb_alreadyChosePublishPhoto() { return _alreadyChosePublishPhoto; } static NSArray *_currentChosePublishPhotos = nil; NSArray *spsb_currentChosePublishPhotos() { if (!_currentChosePublishPhotos) { return spsb_cleanCurrentChosePublishPhotos(0); } return _currentChosePublishPhotos; } NSArray *spsb_cleanCurrentChosePublishPhotos(NSUInteger alreadyChose) { _currentChosePublishPhotos = @[]; _alreadyChosePublishPhoto = alreadyChose; return _currentChosePublishPhotos; } void spsb_changeCurrentChosePublishPhotos(JXHPhotoManager *item, NSUInteger index) { if (!_currentChosePublishPhotos) { spsb_cleanCurrentChosePublishPhotos(0); } if ([_currentChosePublishPhotos containsObject:item]) { NSMutableArray *temp = [_currentChosePublishPhotos mutableCopy]; [temp removeObject:item]; item.jxh_index = 0; _currentChosePublishPhotos = [temp copy]; spsb_postNotification(SPSBChoosePublishPhotosNotificationKey, @selector(spsb_currenChosePublishPhotosChanged:chose:), spsb_currenChosePublishPhotosChanged:_currentChosePublishPhotos chose:item); } else { if (_currentChosePublishPhotos.count == spsb_publishMaxCount() - spsb_alreadyChosePublishPhoto()) { UIAlertController *alert = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:@"你最多只能选择%ld张照片", (long)spsb_publishMaxCount()] message:@"" preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { }]]; [jxh_findPresentedViewControllerStartingFrom(spsb_keyWindow().rootViewController) presentViewController:alert animated:true completion:nil]; return; } NSMutableArray *temp = [_currentChosePublishPhotos mutableCopy]; [temp addObject:item]; item.jxh_index = index; _currentChosePublishPhotos = [temp copy]; spsb_postNotification(SPSBChoosePublishPhotosNotificationKey, @selector(spsb_currenChosePublishPhotosChanged:chose:), spsb_currenChosePublishPhotosChanged:_currentChosePublishPhotos chose:item); } } static SPSBNetworkManager *_globalNetworkManager = nil; SPSBNetworkManager *spsb_globalNetworkManager() { if (!_globalNetworkManager) { static dispatch_once_t once; dispatch_once(&once, ^{ _globalNetworkManager = SPSBNetworkManager.new; }); } return _globalNetworkManager; } #pragma mark - 展示相关 NSString *spsb_changeDisplayBankCode(NSString *code) { if (code.length < 4) { return @""; } return [NSString stringWithFormat:@"**** **** **** %@", [code substringFromIndex:code.length - 4]]; } #pragma mark - Action void spsb_needLogin(SPSBFinishLoginBlock finish) { if (_spsb_isLogin) { finish(); return; } [SPSBFastLoginManager login]; }