// // PBNetworkTools.m // IphoneBIMe // // Created by zjf on 2018/7/13. // Copyright © 2018年 ProBIM. All rights reserved. // #import "PBNetworkTools.h" #import "AppDelegate.h" //#define Url @"https://www.probim.cn:8080" #define CodeIP @"https://www.probim.cn:8080" static BOOL isSetCode; static dispatch_once_t onceToken; @implementation PBNetworkTools #pragma mark - 单例模式 + (instancetype)sharedTools{ static PBNetworkTools *tools; dispatch_once(&onceToken, ^{ // AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];//证书验证模式 // securityPolicy.allowInvalidCertificates = YES;//是否允许自建的证书 // securityPolicy.validatesDomainName = YES;//是否验证域名 // NSString *starName; // if (isSetCode) { // starName = @"STAR_probim_cn"; // }else { // starName = STARNAME; // } // NSString *cerPath = [[NSBundle mainBundle] // pathForResource:starName ofType:@"cer"]; // NSData *certData = [NSData dataWithContentsOfFile:cerPath]; // securityPolicy.pinnedCertificates = [NSSet setWithObject:certData]; // tools = [[PBNetworkTools alloc] init]; // [tools setSecurityPolicy:securityPolicy]; // tools.requestSerializer = [AFHTTPRequestSerializer serializer]; // tools.responseSerializer = [AFHTTPResponseSerializer serializer]; // tools.requestSerializer.timeoutInterval = 20.0; // tools.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/json",@"text/html",@"application/json",@"text/plain",nil]; AFSecurityPolicy * securityPolicy = [AFSecurityPolicy defaultPolicy]; securityPolicy.allowInvalidCertificates = YES;//是否允许自建的证书 securityPolicy.validatesDomainName = NO; tools = [[PBNetworkTools alloc] init]; [tools setSecurityPolicy:securityPolicy]; tools.requestSerializer = [AFHTTPRequestSerializer serializer]; tools.responseSerializer = [AFHTTPResponseSerializer serializer]; tools.requestSerializer.timeoutInterval = 20.0; tools.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/json",@"text/html",@"application/json",@"text/plain",nil]; }); return tools; } #pragma mark - 封装请求方法 - (void)RequestWithType: (RequestType)type andCookie:(BOOL)hasCookie andUrl: (NSString *)url andParams: (id)params andCallBack: (void (^) (NSURLSessionDataTask *task, id response, NSError *error))callBack { // AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; // if (appDelegate.reachabilityStates == AFNetworkReachabilityStatusNotReachable) { // [YJProgressHUD showMessage:@"请检查网络" inView:nil]; // return; // } if (hasCookie) { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *cookie = [defaults valueForKey:@"cookie"]; [self.requestSerializer setValue:cookie forHTTPHeaderField:@"Cookie"]; } if (type == GET) { [self GET:url parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); [self tokenExpired:responseObject]; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } else { [self POST:url parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task, responseObject, nil); [self tokenExpired:responseObject]; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil, nil, error); }]; } } - (void)BodyRequestWithType: (RequestType)type andCookie:(BOOL)hasCookie andUrl: (NSString *)url andParams:(id)params andCallBack: (void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { // AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; // if (appDelegate.reachabilityStates == AFNetworkReachabilityStatusNotReachable) { // [YJProgressHUD showMessage:@"请检查网络" inView:nil]; // return; // } if (hasCookie) { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *cookie = [defaults valueForKey:@"cookie"]; [self.requestSerializer setValue:cookie forHTTPHeaderField:@"Cookie"]; } NSString *typeStr = type == POST ? @"POST":@"GET"; NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error]; NSMutableURLRequest *req = [[AFJSONRequestSerializer serializer] requestWithMethod:typeStr URLString:url parameters:nil error:nil]; [req setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [req setHTTPBody:jsonData]; [[self dataTaskWithRequest:req uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { callBack(response,responseObject,error); if (!error) { [self tokenExpired:responseObject]; } }]resume]; } //x-www-form-urlencoded - (void)BodyRequestUrlEncodedWithType: (RequestType)type andCookie:(BOOL)hasCookie andUrl: (NSString *)url andParams:(id)params andCallBack: (void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { // AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; // if (appDelegate.reachabilityStates == AFNetworkReachabilityStatusNotReachable) { // [YJProgressHUD showMessage:@"请检查网络" inView:nil]; // return; // } if (hasCookie) { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *cookie = [defaults valueForKey:@"cookie"]; [self.requestSerializer setValue:cookie forHTTPHeaderField:@"Cookie"]; } NSString *typeStr = type == POST ? @"POST":@"GET"; NSMutableData *postBody=[NSMutableData data]; [postBody appendData:[params dataUsingEncoding:NSUTF8StringEncoding]]; // NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] // cachePolicy:NSURLRequestReloadIgnoringLocalCacheData // timeoutInterval:30]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; [request setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];//请求头 [request setHTTPMethod:typeStr];//POST请求 [request setHTTPBody:postBody];//body 数据 // [[self dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { // callBack(response,responseObject,error); // }]resume]; //1.创建Session NSURLSession *session=[NSURLSession sharedSession]; //2.根据会话创建任务 NSURLSessionDataTask *dataTask= [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { // callBack(response,data,error); if(error==nil){ // id objc=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; NSLog(@"%@",data); } }]; //3.启动任务 [dataTask resume]; } - (void)tokenExpired:(NSData *)responseObject { NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str]; if ([networkModel.Msg isEqualToString:@"Token已过期"]) { [PBNoteCenter postNotificationName: PBNoteCenterDismissTabBarController object:nil]; [PBNoteCenter postNotificationName:@"PBNoteCenterTokenExpired" object:nil]; } } #pragma mark =================================新接口======================================= #pragma mark - 登录 - (void)loginWithUserName:(NSString *)userName andPassword:(NSString *)password andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSString *PW = [NSString stringWithFormat:@"%@%@",password, AES_Key]; NSString *encryptionPW = [JHAES AES128Encrypt:PW key:AES_Key iv:AES_Iv]; NSDictionary *data = @{ @"UserName":userName, @"Password":encryptionPW }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Home/Login",BaseUrl]; onceToken = 0;//重新走 sharedTools 方法,获取STARNAME isSetCode = NO; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } //账号注销 - (void)RemoveTokenAndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Home/RemoveToken",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取项目列表 - (void)getProjectListWithKeyword:(NSString *)keyword andIsPublic:(NSString *)isPublic andSort:(NSString *)sort andSkip:(NSString *)skip andtake:(NSString *)take andOnlyFavorite:(NSString *)onlyFavorite andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"keyword":keyword, @"isPublic":isPublic, @"sort":sort, @"skip":skip, @"take":take, @"OnlyFavorite": onlyFavorite //1 返回已收藏。传其他或不传 返回全部 }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Project/GetProjects_WithEndTime",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 设置添加或移除项目收藏 - (void)editFavoriteWithOrganizeId:(NSString *)organizeId andAddOrRm:(NSString *)addOrRm andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token": Token, @"OrganizeId": organizeId , @"AddOrRm": addOrRm // 1为添加。其他为移除 }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Project/EditFavorite",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 测试token验证 - (void)getOnlyTestTokenAndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Home/OnlyTestToken",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取某人指定项目的权限数据 - (void)GetUserOrgFuncAuthWithOrganizeID:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"OrganizeId":organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Role/GetOrgFuncAuth",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 通过项目ID获取机构ID - (void)getProjectParentIDWithProjectID:(NSString *)projectId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"organizeId":projectId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Project/GetProjectParentId",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取此项目下问题追踪的状态 - (void)getIssueStatusWithCompanyId:(NSString *)companyId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"CompanyId":companyId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/GetIssueStatus_ByCompany",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取此项目下问题追踪的类型 - (void)getIssueTypesWithCompanyId:(NSString *)companyId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"CompanyId":companyId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/GetIssueTypes_ByCompanyId",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取问题列表 - (void)getIssueListWithOrganizeId:(NSString *)organizeId andIssueStatusId:(NSString *)statuId andIssueTypeId:(NSString *)typeId andArchiveId:(NSString *)archiveId andKeyword:(NSString *)keyword andUserType:(NSString *)userType andPageIndex:(NSInteger)pageIndex andPageSize:(NSInteger)pageSize andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack{ NSDictionary *data = @{ @"Token":Token, @"OrganizeId":organizeId, @"IssueStatusId":statuId, //可选参数,如果不传、传空、空字符串、空白字符串则忽略 @"IssueTypeId":typeId, //可选参数,如果不传、传空、空字符串、空白字符串则忽略 @"keyword":keyword,//可选参数,如果不传、传空、空字符串、空白字符串则忽略 @"UserType":userType,//可选参数,如果不传、传空、空字符串、空白字符串则视为全部。// Manager表示负责人,Creator表示创建人,Joiner表示参与人 @"PageIndex":[NSString stringWithFormat:@"%zd",pageIndex],//表示取哪一页的数据,从第一页开始计算 必传参数 @"PageSize":[NSString stringWithFormat:@"%zd",pageSize],//指定每页多少条,必传参数 @"ContainsArchive":archiveId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/GetIssueList",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 文档文件夹权限 - (void)GetDocRolesAuthByNameWithOrgID:(NSString *)orgId andBIMComposerID:(NSString *)bimcomposerId andFolderID:(NSString *)folderId andAuthName:(NSString *)authName andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack{ NSDictionary *data = @{ @"Token":Token, @"OrgId":orgId, @"BIMComposerId":bimcomposerId, @"FolderId":folderId, @"authName":authName, }; NSString *url = [NSString stringWithFormat:@"%@/api/Document/Doc/GetDocRolesAuthByName",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 问题归档 - (void)SetIssueDeleteMarkWithIssueID:(NSString *)issueId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack{ NSDictionary *data = @{ @"Token":Token, @"Id":issueId, @"IntVal":@"2" //1为已删除 0 正常 2归档 }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/SetIssueDeleteMark",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark =================================旧接口======================================= #pragma mark ======================登录/密码 相关接口======================== #pragma mark - 根据企业编码获取服务地址 - (void)RequestGetUrlsByCodeWithCode:(NSString *)code andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Code":code }; onceToken = 0; isSetCode = YES; NSString *url = [NSString stringWithFormat:@"%@/api/UserControllers/Cfg/GetUrlsByCode",CodeIP]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 登陆 - (void)RequestLoginWithUserName:(NSString *)userName andPassword:(NSString *)password andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *data = @{ @"password":password, @"userName":userName }; NSString *url = [NSString stringWithFormat:@"%@/user/logon",BaseUrl]; onceToken = 0;//重新走 sharedTools 方法,获取STARNAME isSetCode = NO; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 修改密码 - (void)RequestSubmitResetPasswordWithOldPassword:(NSString *)oldPassword NewPassword:(NSString *)newPassword andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *data = @{ @"userId":UserID, @"oldPassword":oldPassword, @"newPassword":newPassword, }; NSString *url = [NSString stringWithFormat:@"%@/user/SubmitResetPassword",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark ======================项目/模型 相关接口======================== #pragma mark - 获取项目列表 //- (void)RequestProjectListWithFullName:(NSString *)fullName andSidx:(NSString *)sidx andSord:(NSString *)sord andIsPublic:(NSString *)isPublic andAccountEqual:(NSString *)accountEqual andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { // NSDictionary *data = @{ // @"Account":Account, // @"FullName":fullName, // @"Sidx":sidx,//CreateDate // @"Sord":sord,//DESC // @"IsPublic":isPublic // }; // NSString *url = [NSString stringWithFormat:@"%@/project/list2",BaseUrl]; // [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; //} - (void)RequestProjectListWithFullName:(NSString *)fullName andSidx:(NSString *)sidx andSord:(NSString *)sord andIsPublic:(NSString *)isPublic andAccountEqual:(NSString *)accountEqual andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"UserId":UserID, @"Keyword":fullName, @"Sort":@"CreateDate desc",//CreateDate asc @"IsPublic":isPublic, @"Skip":@"0", @"Take":@"999" }; NSString *url = [NSString stringWithFormat:@"%@/Project/GetProjects",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } //#pragma mark - 获取登陆人在此项目下权限信息(Access) //- (void)RequestGetAccessWithOrganizeId:(NSString *)organizeId andisPublic:(BOOL)isPublic andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { // NSString *userId = UserID; // NSString *result = isPublic ? @"true":@"false"; // NSString *url = [NSString stringWithFormat:@"%@/AuthorizeThird/GetAuthorizeDataJson",WebUrl]; // [[PBNetworkTools sharedTools] POST:url parameters:nil constructingBodyWithBlock:^(id _Nonnull formData) { // [formData appendPartWithFormData:[userId dataUsingEncoding:NSUTF8StringEncoding] name:@"userId"]; // [formData appendPartWithFormData:[organizeId dataUsingEncoding:NSUTF8StringEncoding] name:@"projectId"]; // [formData appendPartWithFormData:[result dataUsingEncoding:NSUTF8StringEncoding] name:@"isPublic"]; // } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { // callBack(task,responseObject, nil); // } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { // callBack(nil,nil,error); // }]; //} #pragma mark - 获取项目的项目阶段 - (void)RequestGetProjectConfigWithProjectID:(NSString *)projectID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID }; NSString *url = [NSString stringWithFormat:@"%@/api/prj/GetProjectConfig",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取项目所有模型 - (void)RequestGetProjectAllModelsWithProjectID:(NSString *)projectID andKeyword:(NSString *)keyword andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"keyword":keyword }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/GetAllModels",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取指定阶段所有模型 - (void)RequestGetProjectStageAllModelsWithProjectID:(NSString *)projectID andPhase:(NSString *)Phase andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"Phase":Phase, @"sign": @"0" }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/GetAllModels",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取模型的所有视图 - (void)RequestGetAllViewsWithProjectID:(NSString *)projectID andModelID:(NSString *)modelID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"ModelID":modelID }; NSString *url = [NSString stringWithFormat:@"%@/api/prj/GetAllViews",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取模型文件 - 二维图纸 - (void)RequestGetFIleWithProjectID:(NSString *)projectID andModelID:(NSString *)modelID andVersionNO:(NSString *)versionNO andFileType:(NSString *)fileType andFileName:(NSString *)fileName andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"ModelID":modelID, @"VersionNO":versionNO, @"FileType":fileType, @"FileName":fileName }; NSString *url = [NSString stringWithFormat:@"%@/api/Model/GetFile",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取模型下所有视点 - (void)RequestGetAllViewpointWithProjectId:(NSString *)ProjectId andModelId:(NSString *)modelId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":ProjectId, @"ModelID":modelId, }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/GetAllViewpoint",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取视点信息(大图) - (void)RequestGetFullViewpointWithProjectID:(NSString *)projectID andViewpointID:(NSString *)viewpointID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"ViewpointID":viewpointID }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/GetFullViewpoint",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 设置模型默认视点 - (void)RequestSetDefaultViewpointWithProjectID:(NSString *)projectID andModelId:(NSString *)modelId andViewpointID:(NSString *)viewpointID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"ModelID":modelId, @"ViewpointID":viewpointID }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/SetDefaultViewpoint",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 设置模型默认视图 - (void)RequestSetDefaultViewsWithProjectID:(NSString *)projectID andModelId:(NSString *)modelId andViewID:(NSString *)ViewID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"ModelID":modelId, @"ViewID":ViewID }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/SetDefaultView",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 删除视点 - (void)RequestDeleteViewpointWithProjectID:(NSString *)projectID andViewpointID:(NSString *)viewpointID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"ViewpointID":viewpointID }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/DeleteViewpoint",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } //#pragma mark - 加载模型获取session //- (void)RequestGetSessionIDWithProjectID:(NSString *)projectID andBIM365ProjectID:(NSString *)BIM365ProjectID andProjectType:(NSString *)projectType andModelID:(NSString *)modelID andProjectName:(NSString *)projectName andVersionNO:(NSString *)versionNO andViewpointID:(NSString *)viewpointID andSnapshot:(NSString *)snapshot andTexture:(NSString *)texture andUserName:(NSString *)userName andUserNameCN:(NSString *)userNameCN andViewID:(NSString *)viewID andAccess:(NSString *)access andWorkflow:(NSString *)workflow andMarkupCategory:(NSString *)markupCategory andViewpointCategory:(NSString *)viewpointCategory andCategory:(NSString *)category andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { // NSDictionary *dict = @{ // @"ProjectID":projectID, // @"BIM365ProjectID":BIM365ProjectID, // @"ProjectType":projectType, // @"ModelID":modelID, // @"ProjectName":projectName, // @"VersionNO":versionNO, // @"ViewpointID":viewpointID, // @"Snapshot":snapshot, // @"Texture":texture, // @"UserName":userName, // @"UserNameCN":userNameCN, // @"ViewID":viewID, // @"Access":access, // @"Workflow":workflow, // @"MarkupCategory":markupCategory, // @"ViewpointCategory":viewpointCategory, // @"category":category // }; // NSError *error; // NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error]; // NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; // NSString *url = [NSString stringWithFormat:@"%@/api/Sys/PostURLParameters",BimUrl]; // PBNetworkTools *tool = [PBNetworkTools sharedTools]; // [tool POST:url parameters:nil constructingBodyWithBlock:^(id _Nonnull formData) { // [formData appendPartWithFormData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] name:@"Params"]; // } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { // callBack(task,responseObject, nil); // } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { // callBack(nil,nil,error); // }]; //} #pragma mark - 根据modelID获取模型信息 - (void)RequestGetModelWithProjectID:(NSString *)projectID andModelID:(NSString *)modelID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"ModelID":modelID }; NSString *url = [NSString stringWithFormat:@"%@/api/Prj/GetModel",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark ======================文档 相关接口======================== #pragma mark - 获取项目角色 - (void)RequestGetserProjectRoleWithOrganizeId:(NSString *)organizeId andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *data = @{ @"UserId":UserID, @"OrganizeId":organizeId }; NSString *url = [NSString stringWithFormat:@"%@/user/projectrole",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取指定项目的所有一级子项 - (void)RequestGetAllFolderAndFileByProjectIDWithProjectID:(NSString *)projectID andLikeName:(NSString *)likeName andNormalOrDrawings:(NSString *)normalOrDrawings andRoleId:(NSString *)roleId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSMutableDictionary *dataM = [[NSMutableDictionary alloc] init]; [dataM setObject:projectID forKey:@"ProjectID"]; [dataM setObject:likeName forKey:@"LikeName"]; [dataM setObject:normalOrDrawings forKey:@"NormalOrDrawings"]; // if (![roleId isEqualToString:@""]) { // [dataM setObject:roleId forKey:@"RoleId"]; // } NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetAllFolderAndFileByProjectID",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dataM.copy andCallBack:callBack]; } #pragma mark - 获取指定文件夹的所有一级子项 - (void)RequestGetAllFolderAndFileByFolderIDWithProjectID:(NSString *)projectID andFolderID:(NSString *)folderID andLikeName:(NSString *)likeName andNormalOrDrawings:(NSString *)normalOrDrawings andRoleId:(NSString *)roleId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSMutableDictionary *dataM = [[NSMutableDictionary alloc] init]; [dataM setObject:projectID forKey:@"ProjectID"]; [dataM setObject:folderID forKey:@"FolderID"]; [dataM setObject:likeName forKey:@"LikeName"]; [dataM setObject:normalOrDrawings forKey:@"NormalOrDrawings"]; // if (![roleId isEqualToString:@""]) { [dataM setObject:roleId forKey:@"RoleId"]; // } NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetAllFolderAndFileByFolderID",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dataM.copy andCallBack:callBack]; } #pragma mark - 获取 文件/ 文件夹 权限 - (void)RequestGetprivilegeListWithProjectID:(NSString *)projectID andFileID:(NSString *)fileId andRoleId:(NSString *)roleId andCategory:(NSString *)category andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSMutableDictionary *dataM = [[NSMutableDictionary alloc] init]; [dataM setObject:projectID forKey:@"ProjectID"]; [dataM setObject:fileId forKey:@"ObjectId"]; [dataM setObject:category forKey:@"Category"]; if (![roleId isEqualToString:@""]) { [dataM setObject:roleId forKey:@"RoleId"]; } NSString *url = [NSString stringWithFormat:@"%@/api/privilege/list",BimUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dataM.copy andCallBack:callBack]; } #pragma mark - 删除文件或文件夹 - (void)RequestDeleteFileOrFolderWithIsFolder:(BOOL)isFolder andProjectID:(NSString *)project andFileID:(NSString *)fileId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { if (![fileId isEqualToString:@""]) { NSString *apiName; NSString *keyName; if (isFolder) { apiName = @"/api/Doc/DeleteFolder_Mult"; keyName = @"FolderIDs"; }else { apiName = @"/api/Doc/DeleteFileByID_Mult"; keyName = @"FileIDs"; } NSDictionary *data = @{ @"ProjectID":project, keyName:fileId }; NSString *url = [NSString stringWithFormat:@"%@%@",BimUrl, apiName]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } } #pragma mark - 文件搜索 - (void)RequestDocSearchWithProjectID:(NSString *)projectID andLikeName:(NSString *)likeName andNormalOrDrawings:(NSString *)normalOrDrawings andRoleId:(NSString *)roleId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSMutableDictionary *dataM = [[NSMutableDictionary alloc] init]; [dataM setObject:projectID forKey:@"ProjectID"]; [dataM setObject:likeName forKey:@"LikeName"]; [dataM setObject:normalOrDrawings forKey:@"NormalOrDrawings"]; if (![roleId isEqualToString:@""]) { [dataM setObject:roleId forKey:@"RoleId"]; } NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetAllFileAndFolderByFolderID",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dataM.copy andCallBack:callBack]; } #pragma mark - 文件下载 - (void)RequestDownLoadDwgFileWithProjectID:(NSString *)projectID andFileID:(NSString *)fileID andExtension:(NSString *)extension andCallBack:(void (^) (NSURLResponse *response, NSURL *filePath, NSError *error))callBack{ NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetFile?ProjectID=%@&FileKind=File&keyValue=%@&FileInfoVersionId=",BimUrl,projectID,fileID]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; //1.创建会话管理者 AFHTTPSessionManager *manager =[PBNetworkTools sharedTools]; NSURLSessionDownloadTask *download = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) { NSLog(@"%f",1.0 *downloadProgress.completedUnitCount / downloadProgress.totalUnitCount); } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) { NSString *fullPath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%@",fileID, extension]]; NSLog(@"fullPath:%@",fullPath); return [NSURL fileURLWithPath:fullPath]; } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) { NSLog(@"%@",filePath); callBack(response, filePath, error); }]; [download resume]; } #pragma mark - 文件查看请求信息 //- (void)RequestGetDocumentVersionWithProjectID:(NSString *)projectID andFileID:(NSString *)fileId andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { // NSDictionary *data = @{ // @"ProjectID":projectID, // @"FileID":fileId // }; // NSString *str = [NSString stringWithFormat:@"FileID=%@&ProjectID=%@", fileId, projectID]; // NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetDocumentVersion",@"https://bimcomposer.probim.cn"]; //// [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; // [[PBNetworkTools sharedTools] BodyRequestUrlEncodedWithType:POST andCookie:NO andUrl:url andParams:str andCallBack:callBack]; // // //} #pragma mark - - (void)RequestGetDocumentVersionWithProjectID:(NSString *)projectID andFileID:(NSString *)fileId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"FileID":fileId }; NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetDocumentVersion",BimUrl]; // [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; AFHTTPSessionManager * manager = [PBNetworkTools sharedTools]; [manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [manager POST:url parameters:data headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task, responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil, nil, error); }]; } #pragma mark ======================问题追踪 相关接口======================== #pragma mark - 文件下载(问题追踪附件dwg) - (void)RequestDownLoadIssueDwgFileWithProjectID:(NSString *)projectID andFileID:(NSString *)fileID andExtension:(NSString *)extension andCallBack:(void (^) (NSURLResponse *response, NSURL *filePath, NSError *error))callBack{ NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetHideFile?ProjectID=%@&FileId=%@&FileType=Issue",BimUrl,projectID,fileID]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; //1.创建会话管理者 AFHTTPSessionManager *manager =[PBNetworkTools sharedTools]; NSURLSessionDownloadTask *download = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) { NSLog(@"%f",1.0 *downloadProgress.completedUnitCount / downloadProgress.totalUnitCount); } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) { NSString *fullPath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%@",fileID, extension]]; NSLog(@"fullPath:%@",fullPath); return [NSURL fileURLWithPath:fullPath]; } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) { NSLog(@"%@",filePath); callBack(response, filePath, error); }]; [download resume]; } #pragma mark - 获取 状态、类型 相关数据 - (void)RequestGetIssueConditionItemsWithProjectID:(NSString *)projectID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"OrganizeId":projectID, }; // NSString *url = [NSString stringWithFormat:@"%@/Issue/GetIssueConditionItems",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Migration/MIssue/GetIssueConditionItems",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取问题追踪列表 - (void)RequestGetIssueListWithProjectID:(NSString *)projectID andIssueTypeId:(NSString *)issueTypeId andIssueStatusId:(NSString *)issueStatusId andKeyword:(NSString *)keyword andUserType:(NSString *)userType andPageIndex:(NSInteger)pageIndex andPageSize:(NSInteger)pageSize andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"OrganizeId":projectID, @"IssueTypeId":issueTypeId,//可选参数,如果不传、传空、空字符串、空白字符串则忽略 @"IssueStatusId":issueStatusId,//可选参数,如果不传、传空、空字符串、空白字符串则忽略 @"keyword":keyword,//可选参数,如果不传、传空、空字符串、空白字符串则忽略 @"UserId":UserID,//当前操作人 必传参数 @"UserType":userType,//可选参数,如果不传、传空、空字符串、空白字符串则视为全部。// Manager表示负责人,Creator表示创建人,Joiner表示参与人 @"PageIndex":[NSString stringWithFormat:@"%zd",pageIndex],//表示取哪一页的数据,从第一页开始计算 必传参数 @"PageSize":[NSString stringWithFormat:@"%zd",pageSize],//指定每页多少条,必传参数 }; // NSString *url = [NSString stringWithFormat:@"%@/Issue/GetIssueList",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Migration/MIssue/GetIssueList",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 删除问题追踪 - (void)RequestDeleteIssueWithIssueID:(NSString *)issueId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":issueId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/RemoveIssue",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取项目内所有人员 //- (void)RequestGetProjectRoleUserWithBIMComposerID:(NSString *)bimComposerID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { // NSDictionary *data = @{ // @"BIMComposerID":bimComposerID, // @"UserLikeName":@"" // }; //// NSString *url = [NSString stringWithFormat:@"%@/Issue/GetProjectRoleUser",BaseUrl]; // NSString *url = [NSString stringWithFormat:@"%@/api/Migration/MIssue/GetProjectRoleUser",BaseUrl]; // [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; //} //返回不返回操作人 - (void)RequestGetToAddIssueJoinersWithProjectID:(NSString *)projectID andEncodedKeyWord:(NSString *)encodedKeyWord andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"RoleId":@"-1", @"ProjectID":projectID, @"encodedKeyWord":encodedKeyWord }; // NSString *url = [NSString stringWithFormat:@"%@/Issue/GetProjectRoleUser",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/User/User/GetToAddIssueJoiners",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } //返回包含操作人 - (void)RequestGetToAddIssueJoiners_WithOperatorWithProjectID:(NSString *)projectID andEncodedKeyWord:(NSString *)encodedKeyWord andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"RoleId":@"-1", @"ProjectID":projectID, @"encodedKeyWord":encodedKeyWord }; // NSString *url = [NSString stringWithFormat:@"%@/Issue/GetProjectRoleUser",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/User/User/GetToAddIssueJoiners_WithOperator",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } //#pragma mark - 上传文档到隐藏文档库 //- (void)UploadFileToHideFolderWithProjectID:(NSString *)projectID andFileType:(NSString*)fileType andFiles:(NSArray *)files andAudioFileName:(NSString *)audioFileName andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { // NSDictionary *dict = @{ // @"ProjectID":projectID, // @"CreateUserID":UserID, // @"CreateUserName":Realname, // @"FileType":fileType // }; // NSString *url = [NSString stringWithFormat:@"%@/api/Doc/UploadFileToHideFolder",BimUrl]; // [[PBNetworkTools sharedTools] POST:url parameters:dict constructingBodyWithBlock:^(id _Nonnull formData) { // NSInteger imgCount = 0; // for (UIImage *image in files) { // NSData *imageData = UIImageJPEGRepresentation(image,1); // NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; // formatter.dateFormat = @"yyyyMMddHHmmssSSS"; // NSString *fileName = [NSString stringWithFormat:@"%@.png",[formatter stringFromDate:[NSDate date]]]; // [formData appendPartWithFileData:imageData name:@"" fileName:fileName mimeType:@"image/png"]; // imgCount++; // } // if (audioFileName != nil){ // //音频信息 // NSURL *fileUrl = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject stringByAppendingPathComponent:audioFileName]]; // NSString *fileName = [NSString stringWithFormat:@"%@$%@",audioFileName,[NSString getUniqueStrByUUID]]; // [formData appendPartWithFileURL:fileUrl name:@"" fileName:fileName mimeType:@"application/octet-stream" error:nil]; // } // } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { // callBack(task,responseObject, nil); // } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { // callBack(nil,nil, error); // }]; //} //#pragma mark - 上传文档到隐藏文档库(质检安检上传) //- (void)Upload1FileToHideFolderWithProjectID:(NSString *)projectID andFileType:(NSString*)fileType andFiles:(NSArray *)files andAudioFileName:(NSString *)audioFileName andExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLSessionDataTask *task,id response,NSMutableArray *fileInfoArr,NSError *error))callBack { // NSDictionary *dict = @{ // @"ProjectID":projectID, // @"CreateUserID":UserID, // @"CreateUserName":Realname, // @"FileType":fileType // }; // NSString *url = [NSString stringWithFormat:@"%@/api/Doc/UploadFileToHideFolder",BimUrl]; // NSMutableArray *arrM = [[NSMutableArray alloc] init]; // NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; // formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"; // NSString *uploadDate = [formatter stringFromDate:[NSDate date]]; // // [[PBNetworkTools sharedTools] POST:url parameters:dict constructingBodyWithBlock:^(id _Nonnull formData) { // NSInteger imgCount = 0; // for (UIImage *image in files) { // NSData *imageData = UIImageJPEGRepresentation(image,0.7); // NSString *date = [uploadDate stringByReplacingOccurrencesOfString:@"-" withString:@""]; // date = [date stringByReplacingOccurrencesOfString:@":" withString:@""]; // date = [date stringByReplacingOccurrencesOfString:@" " withString:@""]; // NSString *fileName = [NSString stringWithFormat:@"%@%ld.png",date, (long)imgCount]; // [formData appendPartWithFileData:imageData name:@"" fileName:fileName mimeType:@"image/png"]; // NSDictionary *dict = @{ // @"ExamineID": examineID, // @"AttachmentType": @".png", // @"AttachmentName": fileName, // @"AttachmentUrl": @"", // @"UploadDate": uploadDate, // @"CheckFlag": @"1", // @"IsDel": @"0" // }; // [arrM addObject:dict]; // imgCount++; // } // if (audioFileName != nil){ // //音频信息 // NSURL *fileUrl = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject stringByAppendingPathComponent:audioFileName]]; // [formData appendPartWithFileURL:fileUrl name:@"" fileName:audioFileName mimeType:@"application/octet-stream" error:nil]; // NSDictionary *dict = @{ // @"ExamineID": examineID, // @"AttachmentType": @".mp3", // @"AttachmentName": audioFileName, // @"AttachmentUrl": @"", // @"UploadDate": uploadDate, // @"CheckFlag": @"1", // @"IsDel": @"0" // }; // [arrM addObject:dict]; // } // } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { // callBack(task, responseObject, arrM, nil); // } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { // callBack(nil, nil, nil, error); // }]; //} #pragma mark - 新建问题需将图片上传 - (void)UploadImagesWithFiles:(NSArray *)files andIssueID:(NSString *)issueId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init]; [dictM setObject:Token forKey:@"Token"]; if (issueId != nil) { [dictM setObject:issueId forKey:@"IssueId"]; } NSString *url = [NSString stringWithFormat:@"%@/api/Tool/File/UploadImages",BaseUrl]; [[PBNetworkTools sharedTools] POST:url parameters:dictM.copy headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { // NSInteger imgCount = 0; // for (UIImage *image in files) { // NSData *imageData = UIImageJPEGRepresentation(image,1); // NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; // formatter.dateFormat = @"yyyyMMddHHmmssSSS"; // NSString *fileName = [NSString stringWithFormat:@"%@.png",[formatter stringFromDate:[NSDate date]]]; // [formData appendPartWithFileData:imageData name:@"" fileName:fileName mimeType:@"image/png"]; // imgCount++; // } for (NSInteger i = 0; i < files.count; i++) { id obj = files[i]; if ([obj isKindOfClass:[PBResultVideo class]]) { PBResultVideo *video = (PBResultVideo *)obj; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.mp4",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:video.data name:[NSString stringWithFormat:@"video%zd",i] fileName:fileName mimeType:@"video/mpeg4"]; // NSData *imageData = UIImageJPEGRepresentation(video.coverImage,1); // NSString *imageFileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; // [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"video%zd_image",i] fileName:imageFileName mimeType:@"image/png"]; }else { UIImage *image = (UIImage *)obj; NSData *imageData = UIImageJPEGRepresentation(image,1); NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"file%zd",i] fileName:fileName mimeType:@"image/png"]; } } } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } #pragma mark - 删除关联图片 - (void)RemoveIssueDocRelWithIssueID:(NSString *)issueId andFileId:(NSString *)FileId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":issueId, @"FileId":FileId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/RemoveIssueDocRel",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 新增问题追踪 - (void)RequestSaveIssueWithData:(NSMutableDictionary *)dataM andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { [dataM setObject:Token forKey:@"Token"]; [dataM setObject:@"" forKey:@"FileIds"]; [dataM setObject:Realname forKey:@"RealName"]; // [dataM setObject:@"" forKey:@"RelationIssueId"]; // [dataM setObject:@"" forKey:@"AtUserIds"]; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/AddIssue",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dataM.copy andCallBack:callBack]; } #pragma mark - 获取问题追踪详情 - (void)RequestGetIssueDetailByIdWithIssueID:(NSString *)issueId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":issueId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/GetIssueDetail",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取问题标签数据 - (void)RequestGetIssueOrganizeTags:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"organizeId":organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/GetIssueOrganizeTags",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 修改问题分类 - (void)ModifyIssueTypeWithIssueID:(NSString *)IssueId andID:(NSString *)typeID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":IssueId, @"Id":typeID }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/ModifyIssueType",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 修改问题状态 - (void)ModifyIssueStatusWithIssueID:(NSString *)IssueId andID:(NSString *)statuID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":IssueId, @"Id":statuID }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/ModifyIssueStatus",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 添加参与人 - (void)AddIssueJoinerWithIssueID:(NSString *)IssueId andID:(NSString *)JoinerID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":IssueId, @"Id":JoinerID }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/AddIssueJoiner",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 移除参与人 - (void)RemoveIssueJoinerWithIssueID:(NSString *)IssueId andID:(NSString *)JoinerID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":IssueId, @"Id":JoinerID }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/RemoveIssueJoiner",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 修改问题截止日期 - (void)ModifyIssueEndDateWithIssueID:(NSString *)IssueId andEndData:(NSString *)endData andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":IssueId, @"EndDate":endData }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/ModifyIssueEndDate",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 设置问题的标签 - (void)OverrideIssueTagWithIssueID:(NSString *)IssueId andRit_tagIds:(NSString *)rit_tagIds andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":IssueId, @"rit_tagIds":rit_tagIds }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/Tag_OverrideIssueTag",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 根据文档关联ID获取文档详情 - (void)RequestGetAllDocInfoByIDsByRelationIDsWithProjectID:(NSString *)projectId andFileIDs:(NSString *)fileIDs andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectId, @"FileIDs":fileIDs }; NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetAllDocInfoByIDs",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 批量新增关联 - (void)RequestSaveRelationMultWithArr:(NSArray *)arr andIssueID:(NSString *)issueId andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *data = @{ @"Relations": arr, @"issueId": issueId, @"userId": UserID }; // NSString *url = [NSString stringWithFormat:@"%@/Relation/SaveRelationMult",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Migration/MRelation/SaveRelationMult",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 删除关联 - (void)RequestDeleteRelationWithRelationID:(NSString *)relationID andIssueID:(NSString *)issueId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"RelationId":relationID, @"issueId": issueId, @"userId" : UserID }; // NSString *url = [NSString stringWithFormat:@"%@/Relation/DeleteRelation",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Migration/MRelation/DeleteRelation",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 修改问题文本数据 - (void)RequestUpdateIssueWithIssueID:(NSString *)issueId andIssueStatusID:(NSString *)IssueStatusID andIssueTypeID:(NSString *)IssueTypeID andRUserIDStr:(NSString *)RUserIDStr andLUserIDStr:(NSString *)LUserIDStr andEndDate:(NSString *)EndDate andViewPoint:(NSDictionary *)viewPointDic andDraw:(NSDictionary *)drawDic andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init]; [dictM setObject:issueId forKey:@"IssueID"]; if (IssueStatusID != nil) { [dictM setObject:IssueStatusID forKey:@"IssueStatusID"]; } if (IssueTypeID != nil) { [dictM setObject:IssueTypeID forKey:@"IssueTypeID"]; } if (RUserIDStr != nil){ [dictM setObject:RUserIDStr forKey:@"RUserIDStr"]; } if (LUserIDStr != nil){ [dictM setObject:LUserIDStr forKey:@"LUserIDStr"]; } if (EndDate != nil){ [dictM setObject:EndDate forKey:@"EndDate"]; } if (viewPointDic != nil) { [dictM setObject:[viewPointDic valueForKey:@"viewPointID"] forKey:@"ViewPointID"]; [dictM setObject:[viewPointDic valueForKey:@"modelID"] forKey:@"ModelID"]; } if (drawDic != nil) { [dictM setObject:[drawDic valueForKey:@"modelID"] forKey:@"Image2D_ModelID"]; [dictM setObject:[drawDic valueForKey:@"imageID"] forKey:@"Image2DID"]; [dictM setObject:[drawDic valueForKey:@"position"] forKey:@"Image2D_Position"]; } [dictM setObject:UserID forKey:@"UserId"]; NSString *url = [NSString stringWithFormat:@"%@/Issue/UpdateIssue",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dictM.copy andCallBack:callBack]; } #pragma mark - 获取评论列表 - (void)RequestGetIssueCommentsByIdWithIssueId:(NSString *)issueId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"IssueId":issueId }; // NSString *url = [NSString stringWithFormat:@"%@/Issue/GetIssueCommentsById",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Migration/MIssue/GetIssueCommentsById",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - issue删除评论 - (void)RequestDeleteMessageWithMessageID:(NSString *)messageID andIssueID:(NSString *)issueId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"IssueId":issueId, @"Issue_TalkId":messageID }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/RemoveComment",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 新增文字评论 - (void)AddCommentWithIssueId:(NSString *)issueId andOrganizeId:(NSString *)organizeId andText:(NSString *)text andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"organizeId":organizeId, @"RelationIssueId":issueId, @"Title":text, @"AtUserIds":@"" }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/AddComment",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 新增图片评论 - (void)AddImageCommentWithIssueId:(NSString *)issueId andFileID:(NSString *)fileId andFielName:(NSString *)name andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"Name":name, @"Id":fileId, @"IssueId":issueId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Issue/AddImageComment",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 评论图片上传 - (void)UploadFileToHideFolder_MulPropWithImage:(UIImage *)image andProjectID:(NSString *)ProjectID andFileType:(NSString *)type andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":ProjectID, @"CreateUserID":@"", @"CreateUserName":@"", @"FileType":type }; NSString *url = [NSString stringWithFormat:@"%@/api/Doc/UploadFileToHideFolder_MulProp",BimUrl]; [[PBNetworkTools sharedTools] POST:url parameters:data headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { NSData *imageData = UIImageJPEGRepresentation(image,1); NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@.png",[formatter stringFromDate:[NSDate date]]]; [formData appendPartWithFileData:imageData name:@"" fileName:fileName mimeType:@"image/png"]; } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } #pragma mark - 获取通知消息列表 - (void)RequestGetNotReadMsgWithPageIndex:(NSInteger)pageIndex andPageSize:(NSInteger)pageSize andIsRead:(NSString *)isRead andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"isRead":isRead,//0为未读,空为全部 @"buttonSign":@"全部", @"fucSign":@"全部" }; NSString *url = [NSString stringWithFormat:@"%@/api/Message/JPush/CurMsg_WithNum",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 将消息设为已读 - (void)RequestSetReadWithMu_guid:(NSString *)guid andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"mu_guids":guid }; NSString *url = [NSString stringWithFormat:@"%@/api/Message/JPush/SetMsgRead",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark -未读消息列表全部标为已读 - (void)RequestSetMsgTypeReadWithMsgType:(NSString *)mesType andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, }; NSString *url = [NSString stringWithFormat:@"%@/api/Message/JPush/SetUpdateReadByTypeAll",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 删除单条消息 - (void)RequestComm_DeleteWithmuguid:(NSString *)muguid andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"mu_guid":muguid }; NSString *url = [NSString stringWithFormat:@"%@/msg_user/Comm_Delete",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 模型分享时获取URL - (void)RequestShareUrlWithProjectId:(NSString *)ProjectId andModelId:(NSString *)modelId andViewID:(NSString *)viewID andViewpointID:(NSString *)ViewpointID andHasRandomPwd:(NSString *)hasRandomPwd andDaycount:(NSString *)daycount andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ProjectId":ProjectId, @"modelId":modelId, @"ViewID":viewID, @"ViewpointID":ViewpointID, @"hasRandomPwd":hasRandomPwd, @"daycount":daycount }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Model/CreateModelShare",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 文档分享时获取URL - (void)RequestShareUrlWithBIMComposerID:(NSString *)BIMComposerID andPrivilegeStr:(NSString *)privilegeStr andDocIds:(NSString *)DocIds andHasRandomPwd:(NSString *)hasRandomPwd andDaycount:(NSString *)daycount andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"BIMComposerID":BIMComposerID, @"DocIds":DocIds, @"PrivilegeStr":privilegeStr, @"EndTime":daycount, @"HasPwd":hasRandomPwd }; NSString *url = [NSString stringWithFormat:@"%@/api/User/Document/CreateDocShare",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 分享文档时DWG Url - (void)RequestIDocViewWithProjectID:(NSString *)ProjectId andFileID:(NSString *)fileId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"DocID":fileId, @"OrganizeId":ProjectId }; NSString *url = [NSString stringWithFormat:@"%@/api/BJYMig/Public/IDocView",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 文档分享时获取文档分享信息 - (void)GetDocumentVersionWithProjectID:(NSString *)projectID andFileID:(NSString *)fileID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"ProjectID":projectID, @"FileID":fileID }; NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetDocumentVersion",BimUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; //https://bimcomposer.probim.cn/api/Doc/GetDocumentVersion } #pragma mark ==================================现场数据 相关接口================================= #pragma mark - 现场数据列表 - (void)RequestExamineListWithBIMComposerId:(NSString *)bimComposerId andSearchValue:(NSString *)searchValue andStateType:(NSString *)stateType andAuthorType:(NSString *)authorType andSeveritylevel:(NSString *)severitylevel andTypes:(NSString *)types andSortField:(NSString *)sortField andSortIsAsc:(NSString *)sortIsAsc andPageIndex:(NSInteger)pageIndex andPageSize:(NSInteger)pageSise andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSInteger skip = pageIndex * pageSise; NSDictionary *data = @{ @"Token":Token, @"keyword":searchValue, @"bimcomposerId":bimComposerId, @"StateType":stateType,//A_ToBeCheck(待检查) B_ToBeRectified(待整改) C_ToBeRecheck(待验收) D_Qualified(已合格) @"AuthorType":authorType,//传空字符串或以下其中之一,可选值:AsChecker(我检查)AsRechecker(我复检)AsRectifier(我整改) , @"Severitylevel":severitylevel,//一般、严重、非常严重 @"Types":types,//Exam_GetExamTypes 接口返回的数据中的 aedt_guid 字段 @"SortField":sortField,//排序依赖的字段,有:创建时间 CreateDate/'', 结束时间 RectificateDate, 状态 State , @"SortIsAsc":sortIsAsc,//传1为正序,其它为倒序 @"Skip":[NSString stringWithFormat:@"%zd",skip],//跳过多少条数据。若转换失败则取全部 , @"Take":[NSString stringWithFormat:@"%zd",pageSise],//取多少条数据 }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/GetMissions",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 移除现场数据 - (void)RequestRemoveItemsWithId:(NSString *)examineId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"Ids":examineId }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/RemoveItems",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 关闭现场数据 - (void)RequestCloseItemsWithId:(NSString *)examineId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"Ids":examineId }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/UpdateItems",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 获取某项目的现场分类数据 - (void)RequestExam_GetExamTypesWithOrganizeId:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"organizeId":organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/Exam_GetExamTypes",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 现场数据详情 - (void)RequestGetItemWithExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineID":examineID }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/GetMission?ExamineID=%@&Token=%@",BaseUrl,examineID,Token]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:nil andCallBack:callBack]; } #pragma mark - 检查人修改整改的信息 - (void)modifyMissionMemberWithExamineID:(NSString *)examineID andOrganizeId:(NSString *)organizeId andData:(NSMutableDictionary *)dictM andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineID":examineID, @"OrganizeId":organizeId }; [dictM addEntriesFromDictionary:data]; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/ModifyMissionMember",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dictM.copy andCallBack:callBack]; } #pragma mark - 检查人修改严重等级信息 - (void)ModifySeveritylevelWithExamineID:(NSString *)examineID andOrganizeId:(NSString *)organizeId andSeveritylevel:(NSString *)severitylevel andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineID":examineID, @"OrganizeId":organizeId, @"aede_severitylevel":severitylevel }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/ModifySeveritylevel",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 检查人检查内容提交接口 - (void)checkMissionWithExamineID:(NSString *)examineID andOrganizeId:(NSString *)organizeId andData:(NSMutableDictionary *)dictM andImageArr:(NSArray *)imageArr andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineID":examineID, @"OrganizeId":organizeId }; [dictM addEntriesFromDictionary:data]; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/CheckMission",BaseUrl]; [[PBNetworkTools sharedTools] POST:url parameters:dictM.copy headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { for (NSInteger i = 0; i < imageArr.count; i++) { id obj = imageArr[i]; if ([obj isKindOfClass:[PBResultVideo class]]) { PBResultVideo *video = (PBResultVideo *)obj; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.mp4",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:video.data name:[NSString stringWithFormat:@"video%zd",i] fileName:fileName mimeType:@"video/mpeg4"]; NSData *imageData = UIImageJPEGRepresentation(video.coverImage,1); NSString *imageFileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"video%zd_image",i] fileName:imageFileName mimeType:@"image/png"]; }else { UIImage *image = (UIImage *)obj; NSData *imageData = UIImageJPEGRepresentation(image,1); NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"file%zd",i] fileName:fileName mimeType:@"image/png"]; } } } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } #pragma mark - 申请验收 - (void)ApplyToAcceptanceWithExamineID:(NSString *)examineID andOrganizeId:(NSString *)organizeId andRectificationRemark:(NSString *)rectificationRemark andImageArr:(NSArray *)imageArr andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineID":examineID, @"OrganizeId":organizeId, @"RectificationRemark":rectificationRemark }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/ApplyToAcceptance",BaseUrl]; [[PBNetworkTools sharedTools] POST:url parameters:data headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { for (NSInteger i = 0; i < imageArr.count; i++) { id obj = imageArr[i]; if ([obj isKindOfClass:[PBResultVideo class]]) { PBResultVideo *video = (PBResultVideo *)obj; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.mp4",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:video.data name:[NSString stringWithFormat:@"video%zd",i] fileName:fileName mimeType:@"video/mpeg4"]; NSData *imageData = UIImageJPEGRepresentation(video.coverImage,1); NSString *imageFileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"video%zd_image",i] fileName:imageFileName mimeType:@"image/png"]; }else { UIImage *image = (UIImage *)obj; NSData *imageData = UIImageJPEGRepresentation(image,1); NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"file%zd",i] fileName:fileName mimeType:@"image/png"]; } } } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } #pragma mark - 验收情况 - (void)tryToAcceptanceWithExamineID:(NSString *)examineID andOrganizeId:(NSString *)organizeId andRectificationRemark:(NSString *)rectificationRemark andIsPassed:(NSString *)isPassed andImageArr:(NSArray *)imageArr andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineID":examineID, @"OrganizeId":organizeId, @"RectificationRemark":rectificationRemark, @"IsPassed":isPassed }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/TryToAcceptance",BaseUrl]; [[PBNetworkTools sharedTools] POST:url parameters:data headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { for (NSInteger i = 0; i < imageArr.count; i++) { id obj = imageArr[i]; if ([obj isKindOfClass:[PBResultVideo class]]) { PBResultVideo *video = (PBResultVideo *)obj; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.mp4",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:video.data name:[NSString stringWithFormat:@"video%zd",i] fileName:fileName mimeType:@"video/mpeg4"]; NSData *imageData = UIImageJPEGRepresentation(video.coverImage,1); NSString *imageFileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"video%zd_image",i] fileName:imageFileName mimeType:@"image/png"]; }else { UIImage *image = (UIImage *)obj; NSData *imageData = UIImageJPEGRepresentation(image,1); NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], i]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"file%zd",i] fileName:fileName mimeType:@"image/png"]; } } } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } #pragma mark - 获取项目人员数据(分组) - (void)GetProjectUserSortByLetterRoleId:(NSString *)roleId andOrganizeID:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId, @"RoleId":roleId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/User/GetProjectUserSortByLetter",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取指定项目的所有有效角色及相关人员 - (void)GetProjectRolesAndUsersOrganizeID:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/User/User/GetProjectRolesAndUsers",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取根基任务 - (void)GetCheckTaskWithOrganizeId:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/Plus/PlusProject/NewComm_GetListByOrganizeId",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取任务内部数据 - (void)GetTaskItemDataWithPlanId:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"planId":planId }; NSString *url = [NSString stringWithFormat:@"%@/api/Plus/PlusProject/GetPlanTaskListByPlanId",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取根基构件 - (void)GetCategoriesWithOrganizeId:(NSString *)organizeId andBaseCode:(NSString *)baseCode andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId, @"baseCode":baseCode, }; NSString *url = [NSString stringWithFormat:@"%@/api/Material/MaterialCategory/GetCategories",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 构件内数据 - (void)GetMaterialListWithOrganizeId:(NSString *)organizeId andBc_guid:(NSString *)guid andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"bc_guid_materialtype": guid, @"bm_materialcode": @"", @"bm_materialname": @"", @"statusIdlistjson": @"", @"ifhasrelation": @"", @"updatetimestart": @"", @"updatetimeend": @"", @"SortField": @"bm_updatetime", @"SortType": @"desc", @"organizeId": organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/Material/Mtr/GetMaterialList_Condition2",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 发起检查任务 - (void)AddMissionWithDictM:(NSMutableDictionary *)dictM andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { [dictM setObject:Token forKey:@"Token"]; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/AddMission",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dictM.copy andCallBack:callBack]; } #pragma mark - 修改检查任务 - (void)ModifyMissionInfoWithDictM:(NSMutableDictionary *)dictM andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { [dictM setObject:Token forKey:@"Token"]; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/ModifyMissionInfo",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dictM.copy andCallBack:callBack]; } #pragma mark - 修改检查人 - (void)ModifyMissionCheckerWithExamineID:(NSString *)examineId andOrganizeId:(NSString *)organizeId andCheckerUserId:(NSString *)checkerUserId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"Token": Token, @"ExamineID": examineId, @"OrganizeId": organizeId, @"CheckerUserId": checkerUserId }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/ModifyMissionChecker",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 根据构件ID获取所有上层分类(按编码排序) - (void)GetCategoryArrayByBmGuidWithGuid:(NSString *)guid andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"bm_guid": guid }; NSString *url = [NSString stringWithFormat:@"%@/api/Material/Mtr/GetCategoryArrayByBmGuid",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 现场数据添加验收记录或整改记录 - (void)RequestExam_AddRecordWithExamineID:(NSString *)examineID andResult:(NSString *)result andRemark:(NSString *)remark andFlag:(NSString *)flag andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineID":examineID, @"RectificationCheckResult":result, @"RectificationRemark":remark, @"RectificationOperateFlag":flag }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/Exam_AddRecord",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 加载某项目下现场数据结构的第一级 - (void)RequestGetQualitySafeCategoriesWithOrganizeId:(NSString *)organizeId andType:(NSString *)type andLikepara:(NSString *)likepara andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"organizeId":organizeId, @"type":type, @"likepara":likepara }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/GetQualitySafeCategories",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 新增现场数据 - (void)RequestAddItemsWithData:(NSMutableDictionary *)dictM andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { [dictM setValue:Token forKey:@"Token"]; [dictM setValue:@"1" forKey:@"LinkType"]; [dictM setValue:@"" forKey:@"FileIds"]; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/AddItem",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dictM.copy andCallBack:callBack]; } #pragma mark - 修改现场数据 - (void)RequestModifyItemWithData:(NSMutableDictionary *)dictM andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { [dictM setValue:Token forKey:@"Token"]; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/ModifyItem",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dictM.copy andCallBack:callBack]; } #pragma mark - 现场数据详情图片删除 - (void)RequestExam_RmAttachmentsWithAttachmentIDs:(NSString *)attachmentIds andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *data = @{ @"Token":Token, @"ExamineAttachmentIDs":attachmentIds }; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/Exam_RmAttachments",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 现场数据详情图片添加 - (void)RequestExam_AddAttachmentsWithData:(NSMutableDictionary *)dictM andIamges:(NSArray *)imageArr andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { [dictM setValue:Token forKey:@"Token"]; NSString *url = [NSString stringWithFormat:@"%@/api/Examine/Exam/Exam_AddAttachments",BaseUrl]; [[PBNetworkTools sharedTools] POST:url parameters:dictM.copy headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { NSInteger imgCount = 0; for (UIImage *image in imageArr) { NSData *imageData = UIImageJPEGRepresentation(image,1); NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddHHmmssSSS"; NSString *fileName = [NSString stringWithFormat:@"%@.png",[formatter stringFromDate:[NSDate date]]]; [formData appendPartWithFileData:imageData name:@"" fileName:fileName mimeType:@"image/png"]; imgCount++; } } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } #pragma mark - 获取质量检查列表 - (void)RequestExamineListWithProjectId:(NSString *)ProjectId andLinkType:(NSString *)linkType TypeValue:(NSString *)typeValue andSearchValue:(NSString *)searchValue andExamineResult:(NSString *)examineResult andPageIndex:(NSInteger)pageIndex andPageSize:(NSInteger)pageSise andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSString *examinerID = @""; NSString *principalID = @""; NSString *relationMemberID = @""; NSString *hasDataAuthorize = @""; //全部 if ([typeValue isEqualToString:@""]) { hasDataAuthorize = @"False"; //我创建 }else if ([typeValue isEqualToString:@"creat"]) { examinerID = UserID; //我负责 }else if ([typeValue isEqualToString:@"responsible"]) { principalID = UserID; //我相关 }else if ([typeValue isEqualToString:@"related"]) { relationMemberID = UserID; } NSDictionary *data = @{ @"ProjectID":ProjectId, @"LinkType":linkType, @"HasDataAuthorize":hasDataAuthorize, @"Account": UserID, @"PrincipalID":principalID, @"RelationMemberID":relationMemberID, @"ExaminerID":examinerID, @"KeyValue":searchValue, @"ExamineResult":examineResult, @"PageIndex":[NSString stringWithFormat:@"%zd",pageIndex], @"PageSize":[NSString stringWithFormat:@"%zd",pageSise] }; // NSString *url = [NSString stringWithFormat:@"%@/Examine/List",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/MExamine/List",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:data andCallBack:callBack]; } #pragma mark - 新增质量检查接口 - (void)Greate_2ExamineWithData:(NSDictionary *)data andDrawPosData:(NSArray *)drawPosData andExamineAttachment:(NSArray *)attachment andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineData":data, @"DrawPosData":drawPosData.count == 0 ? @"" :drawPosData, @"ExamineAttachment":attachment }; // NSString *url = [NSString stringWithFormat:@"%@/Examine/Create_2",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/MExamine/Create_2",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 删除某条质检信息 - (void)RequestDeleteExamineWithExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":examineID }; // NSString *url = [NSString stringWithFormat:@"%@/Examine/Delete",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/MExamine/Delete",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取检查图纸定位信息 - (void)RequestGetdrawposWithExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":examineID }; // NSString *url = [NSString stringWithFormat:@"%@/drawpos/list",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/Mdrawpos/list",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 删除某条检查图纸信息 - (void)RequestDeleteDrawposWithExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":examineID }; // NSString *url = [NSString stringWithFormat:@"%@/drawpos/delete",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/Mdrawpos/delete",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 新增某条检查的图纸信息 - (void)RequestCreateDrawposWithDrawposData:(NSDictionary *)drawposData andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { // NSString *url = [NSString stringWithFormat:@"%@/drawpos/create",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/Mdrawpos/create",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:drawposData andCallBack:callBack]; } #pragma mark - 根据ExamineID获取详情 - (void)RequestGetExamineDetailWithExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":examineID }; // NSString *url = [NSString stringWithFormat:@"%@/Examine/detail",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/MExamine/detail",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取检查附件信息 - (void)RequestGetexamineattachWithExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":examineID }; // NSString *url = [NSString stringWithFormat:@"%@/examineattach/list",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/Mexamineattach/list",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 删除检查附件 - (void)RequestDeleteExamineattachWithExamineID:(NSString *)examineID andExamineAttachmentID:(NSString *)examineAttachmentID andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":examineID, @"ExamineAttachmentIds":examineAttachmentID //为所有要删除的附件的ExamineAttachmentID 拼接 以 ,隔开 }; // NSString *url = [NSString stringWithFormat:@"%@/examineattach/delete",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/Mexamineattach/delete",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 新增检查附件(需先上传到文件库 在关联) - (void)RequestExamineattachCreate_2WithAttachArr:(NSArray *)attachArr andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineAttachment":attachArr }; // NSString *url = [NSString stringWithFormat:@"%@/examineattach/Create_2",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/Mexamineattach/Create_2",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 修改检查文本数据 - (void)RequestModifyExamineWithExamineModifyData:(NSDictionary *)modifydata andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { // NSString *url = [NSString stringWithFormat:@"%@/Examine/Modify2",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/MExamine/Modify2",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:modifydata andCallBack:callBack]; } #pragma mark - 获取整改记录 - (void)RequestGetExaminerectificationListWithExamineID:(NSString *)examineID andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":examineID }; // NSString *url = [NSString stringWithFormat:@"%@/Examinerectification/List_2",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/MExaminerectification/List_2",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 提交申请/复检整改信息接口 - (void)RequestExaminerectificationCreateWithFlag:(NSString *)flag andExamineID:(NSString *)ExamineID andRectificationID:(NSString *)rectificationID andRectificationCheckDate:(NSString *)RectificationCheckDate andRectificationCheckResult:(NSString *)RectificationCheckResult andRectificationRemark:(NSString *)RectificationRemark andCreateDate:(NSString *)createDate andAttachment:(NSArray *)attachment andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"ExamineID":ExamineID, @"RectificationID":rectificationID, @"RectificationOperatorID":UserID, @"RectificationOperator":Realname, @"RectificationOperateFlag":flag,//1检查人,2负责人 @"RectificationCheckDate":RectificationCheckDate, @"RectificationCheckResult":RectificationCheckResult, @"RectificationRemark":RectificationRemark, @"IsDel":@"0", @"CreateDate":createDate }; NSDictionary *dict1 = @{ @"ExamineRectification":dict, @"ExamineAttachment":attachment } ; // NSString *url = [NSString stringWithFormat:@"%@/ExamineRectification/Create_2",BaseUrl]; NSString *url = [NSString stringWithFormat:@"%@/api/Megration/MExamineRectification/Create_2",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict1 andCallBack:callBack]; } #pragma mark ======================进程 相关接口======================== - (void)GetFlowInstances_CondWithOrganizeId:(NSString *)organizeId andAuthorType:(NSString *)authorType andKeyword:(NSString *)keyword andStartTime:(NSString *)startTime andEndTime:(NSString *)endTime andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { /** AuthorType: tobedone StatusType: pageIndex: 1 pageSize: 50 organizeId: 48617e7b-07f2-4748-9199-238af8f2bfc6 wftc_guid: -1000 wft_guid: keyword: starttime: endtime: */ NSDictionary *dict = @{ @"Token":Token, @"organizeId":organizeId, @"wft_guid":@"", @"wftc_guid":@"-1000", @"AuthorType":@"tobedone", @"StatusType":@"", @"pageIndex":@"1", @"pageSize":@"100", @"keyword":keyword, @"starttime":startTime, @"endtime":endTime }; NSString *url = [NSString stringWithFormat:@"%@/api/FlowForm/Flow/GetFlowInstances_Cond",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取任务计划tree - (void)GetSchedualTreeWithOrganizeId:(NSString *)organizeId andUid:(NSString *)uid andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId, @"uid": uid }; NSString *url = [NSString stringWithFormat:@"%@/api/Schedual/Schedual/GetTree",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取任务计划累计 - (void)GetMobileAddWithTreeID:(NSString *)treeId andPlanId:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"Progress_treeID":treeId, @"Progress_ProjectID":planId }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMobileAdd",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 任务计划保存 - (void)AddMobileJSONWithOrganizeId:(NSString *)organizeId andMobile:(NSDictionary *)mobile andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSString *jsonStr = [NSString convertToJson:mobile]; NSDictionary *dict = @{ @"Token":Token, @"organizeId": organizeId, @"MobileJson": jsonStr }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/AddMobileJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取任务计划信息 - (void)GetMobileJSONWithUnittime:(NSString *)unittime andCreateuserId:(NSString *)createuserId andPlanID:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"Progress_ProjectID":planId, @"Progress_createuserid":createuserId, @"Progress_unittime":unittime }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMobileJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 任务进度计划图片上传 - (void)scheduleUploadImagesWithFiles:(NSArray *)files andNames:(NSArray *)names andPlanID:(NSString *)planId andUnittime:(NSString *)unittime andorganizeId:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init]; [dictM setObject:Token forKey:@"Token"]; [dictM setObject:planId forKey:@"Progress_ProjectID"]; [dictM setObject:unittime forKey:@"Progress_unittime"]; [dictM setObject:names forKey:@"Progress_imageName"]; [dictM setObject:organizeId forKey:@"organizeId"]; NSString *url = [NSString stringWithFormat:@"%@/api/Tool/File/UploadImageMobile",BaseUrl]; [[PBNetworkTools sharedTools] POST:url parameters:dictM.copy headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { for (NSInteger M = 0; M < files.count; M++) { UIImage *image = files[M]; NSData *imageData = UIImageJPEGRepresentation(image,0.7); NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyyMMddssss"; NSString *fileName = [NSString stringWithFormat:@"%@%zd.png",[formatter stringFromDate:[NSDate date]], M]; [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"file%zd", M] fileName:fileName mimeType:@"image/png"]; } } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } #pragma mark - 任务删除图片 - (void)DelteImageWithGuid:(NSString *)guid andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"bf_Guid":guid }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/DelteImage",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 督导会保存 - (void)AddMobileSuperviseJSONWithOrganizeId:(NSString *)organizeId andMobile:(NSArray *)mobile andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSString *jsonStr = [NSString arrConvertToJson:mobile]; NSDictionary *dict = @{ @"Token":Token, @"organizeId":organizeId, @"MobileJSON":jsonStr }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/AddMobileSuperviseJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取督导会信息 - (void)GetMobileSuperviseJSONWithUnittime:(NSString *)unittime andCreateuserId:(NSString *)createuserId andPlanID:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"MobileSupervise_ProjectID":planId, @"MobileSupervise_CreateuserId":createuserId, @"MobileSupervise_Unittime":unittime }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMobileSuperviseJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 质量安全保存 - (void)AddMobileSafeJSONWithOrganizeId:(NSString *)organizeId andMobile:(NSArray *)mobile andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSString *jsonStr = [NSString arrConvertToJson:mobile]; NSDictionary *dict = @{ @"Token":Token, @"organizeId":organizeId, @"MobileJSON":jsonStr }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/AddMobileSafeJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取质量安全信息 - (void)GetMobileSafeJSONWithUnittime:(NSString *)unittime andCreateuserId:(NSString *)createuserId andPlanID:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"MobileSafe_ProjectID":planId, @"MobileSafe_CreateuserId":createuserId, @"MobileSafe_Unittime":unittime }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMobileSafeJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取人员清单(organizeId有值为人员列表 其它值不传 则没有累计数据) - (void)GetMobileUserWithOrganizeId:(NSString *)organizeId andMobileUserDetial_ProjectID:(NSString *)planID andMobile_UserType:(NSString *)usertype andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId, @"MobileUserDetial_ProjectID":planID, @"Mobile_UserType":usertype }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMobileUser",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 现场人员保存 - (void)AddMobileUserJSONWithOrganizeId:(NSString *)organizeId andMobile:(NSArray *)mobile andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSString *jsonStr = [NSString arrConvertToJson:mobile]; NSDictionary *dict = @{ @"Token":Token, @"organizeId":organizeId, @"MobileJSON":jsonStr }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/AddMobileUserJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取现场人员信息 - (void)GetMobileUserJSONWithUnittime:(NSString *)unittime andCreateuserId:(NSString *)createuserId andPlanID:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"MobileUserDetial_Unittime":unittime, @"MobileUserDetial_ProjectID":planId, @"MobileUserDetial_createuserid":createuserId }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMobileUserJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取现场人员扫描信息 - (void)GetFillUserInfoWithID:(NSString *)guid andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"id":guid }; NSString *url = [NSString stringWithFormat:@"%@/api/Filling/FillingUser/GetFillUserInfo",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 现场人员填报 - (void)aEntryOrExitWithOrganizeId:(NSString *)organizeId andFillingUserId:(NSString *)fillingUserId andProgressParentId:(NSString *)progressParentId andProgressTreeId:(NSString *)progressTreeId andProgressProjectId:(NSString *)progressProjectId andAddress:(NSString *)address andType:(NSInteger)type andCallBack:(void (^) (NSURLResponse *response, id responseObject, NSError *error))callBack { NSDictionary *dict = @{ @"OrganizeId": organizeId, @"FillingUserId": fillingUserId, @"ProgressParentId": progressParentId, @"ProgressTreeId": progressTreeId, @"ProgressProjectId": progressProjectId, @"Address": address, @"Token": Token, @"Type": [NSNumber numberWithInteger:type] }; NSString *url = [NSString stringWithFormat:@"%@/api/Filling/FillingUserLog/EntryOrExit",BaseUrl]; [[PBNetworkTools sharedTools] BodyRequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取现场人员列表 - (void)GetFillingUserLogPagedWithPageIndex:(NSString *)pageIndex andPageSize:(NSString *)pageSize andOrganizeId:(NSString *)organizeId andProgressProjectId:(NSString *)progressProjectId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"pageIndex": pageIndex, @"pageSize": pageSize, @"organizeId": organizeId, @"progressProjectId": progressProjectId }; NSString *url = [NSString stringWithFormat:@"%@/api/Filling/FillingUserLog/GetFillingUserLogPaged",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取视频列表 - (void)GetVideoWithOrganizeId:(NSString *)organizeId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId": organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/Daxing/Video/GetVideo",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取机械清单(organizeId有值为机械列表 其它值不传 则没有累计数据) - (void)GetMaterialsWithOrganizeId:(NSString *)organizeId andMobileUserDetial_ProjectID:(NSString *)planID andMobile_UserType:(NSString *)usertype andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId, @"MobileUserDetial_ProjectID":planID, @"Mobile_UserType":usertype }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMaterials",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 现场机械保存 - (void)AddMaterialsJSONWithOrganizeId:(NSString *)organizeId andMobile:(NSArray *)mobile andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSString *jsonStr = [NSString arrConvertToJson:mobile]; NSDictionary *dict = @{ @"Token":Token, @"organizeId":organizeId, @"MobileJSON":jsonStr }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/AddMaterialsJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取现场机械信息 - (void)GetMaterialsJSONWithUnittime:(NSString *)unittime andCreateuserId:(NSString *)createuserId andPlanID:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"MaterialsDetial_Unittime":unittime, @"MaterialsDetial_ProjectID":planId, @"MaterialsDetial_createuserid":createuserId }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMaterialsJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取材料清单(organizeId有值为机械列表 其它值不传 则没有累计数据) - (void)GetMachineWithOrganizeId:(NSString *)organizeId andMobileUserDetial_ProjectID:(NSString *)planID andMobile_UserType:(NSString *)usertype andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId":organizeId, @"MaterialsDetial_ProjectID":planID, @"Machine_Name":usertype }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMachine",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 现场材料保存 - (void)AddMachineJSONWithOrganizeId:(NSString *)organizeId andMobile:(NSArray *)mobile andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSString *jsonStr = [NSString arrConvertToJson:mobile]; NSDictionary *dict = @{ @"Token":Token, @"organizeId":organizeId, @"MobileJSON":jsonStr }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/AddMachineJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取现场材料信息 - (void)GetMachineJSONWithUnittime:(NSString *)unittime andCreateuserId:(NSString *)createuserId andPlanID:(NSString *)planId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"MachineDetial_Unittime":unittime, @"MachineDetial_ProjectID":planId, @"MachineDetial_Createuserid":createuserId }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMachineJSON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取总列表 - (void)GetMobilePASONWithOrganizeId:(NSString *)organizeId andMobilePA_ProjectID:(NSString *)planId andMobilePA_state:(NSString *)state AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"MobilePA_ProjectID": planId, @"MobilePA_state": state, @"organizeId": organizeId, @"MobilePA_Createuserid":UserID }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetMobilePASON",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 列表数据删除 - (void)DelMobilePAWithPlanId:(NSString *)planId andCreateuserId:(NSString *)CreateuserId andUnittime:(NSString *)Unittime andOrganizeId:(NSString *)organizeId AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"Token":Token, @"ProjectID":planId, @"CreateuserId":CreateuserId, @"Unittime":Unittime, @"organizeId":organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/DelMobilePA",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取列表 填写状态 - (void)GetSearchstateWithPlanId:(NSString *)planid andUnittime:(NSString *)Unittime andCreateuserid:(NSString *)Createuserid AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"ProjectID": planid, @"Createuserid": Createuserid, @"Unititime": Unittime }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/GetSearchstate",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 预览发布 - (void)UpdateStatesWithPlanId:(NSString *)planid andUnittime:(NSString *)Unittime andCreateUserId:(NSString *)createUserId andStatus:(NSString *)status andOrganizeId:(NSString *)organizeId AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"Token": Token, @"ProjectID": planid, @"organizeId": organizeId, @"Unittime": Unittime, @"State": status, @"CreateUserId": createUserId }; NSString *url = [NSString stringWithFormat:@"%@/api/MobileNew/MobileNew/UpdateStates",BaseUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark ---------------------------------全景图-------------------------------------- #pragma mark - 获取全景图集 - (void)GetListByLabelGroupWithOrganizeId:(NSString *)organizeId andLabelId:(NSString *)labelId andPbName:(NSString *)pbName AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId": organizeId, @"labelId": labelId, @"pbName": pbName }; NSString *url = [NSString stringWithFormat:@"%@/api/Home/File/GetListByLabelGroup",PanoramaUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取全景图label - (void)GetLabelListWithOrganizeId:(NSString *)organizeId AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"OrganizeId": organizeId }; NSString *url = [NSString stringWithFormat:@"%@/api/Home/Label/GetList",PanoramaUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 获取制定全景图集下所有图 - (void)GetScenesByPbGuidWithPb_guid:(NSString *)pb_guid AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"pb_guid": pb_guid }; NSString *url = [NSString stringWithFormat:@"%@/api/Home/File/GetScenesByPbGuid",PanoramaUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } - (void)GetPanoramaSceneListWithPb_guid:(NSString *)pb_guid AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"pbGuid": pb_guid }; NSString *url = [NSString stringWithFormat:@"%@/api/Home/PanoramaScene/GetPanoramaSceneList",PanoramaUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 删除指定全景图集 - (void)RemoveItemWithPbGuid:(NSString *)PbGuid andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"PbGuid":PbGuid }; NSString *url = [NSString stringWithFormat:@"%@/api/Home/File/RemoveItem",PanoramaUrl]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 删除指定全景图item - (void)RemoveSceneWithPbGuid:(NSString *)PbGuid andSceneName:(NSString *)scenename andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { // NSDictionary *dict = @{ // @"pbguid":PbGuid, // @"scenename":scenename // }; NSString *url = [NSString stringWithFormat:@"%@/api/Home/File/RemoveScene?pbguid=%@&scenename=%@",PanoramaUrl, PbGuid, scenename]; [[PBNetworkTools sharedTools] RequestWithType:POST andCookie:NO andUrl:url andParams:nil andCallBack:callBack]; } #pragma mark - 获取标签绑定图片列表 - (void)GetLabelFileWithOrganizeId:(NSString *)organizeId andLabelId:(NSString *)labelId AndCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDictionary *dict = @{ @"organizeId": organizeId, @"labelId": labelId, @"fileName": @"" }; NSString *url = [NSString stringWithFormat:@"%@/api/Home/Label/GetLabelFile",PanoramaUrl]; [[PBNetworkTools sharedTools] RequestWithType:GET andCookie:NO andUrl:url andParams:dict andCallBack:callBack]; } #pragma mark - 上传全景图 - (void)UploadPanoramaImagesWithFile:(NSData *)file andfileName:(NSString *)fileName andTargetPatchGuid:(NSString *)targetPatchGuid andOrganizeId:(NSString *)organizeId andPbname:(NSString *)Pbname andLabelId:(NSString *)labelId andModelId:(NSString *)modelId andViewId:(NSString *)viewId andCallBack:(void (^) (NSURLSessionDataTask *task,id response, NSError *error))callBack { NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSDate *newDate = [NSDate date]; NSString * collectDate = [formatter stringFromDate:newDate]; NSString *guid = [NSString getUniqueStrByUUID]; NSString *url = [NSString stringWithFormat:@"%@/api/Home/File/UploadImages?pbguid=%@&willappend=0",PanoramaUrl, guid]; [[PBNetworkTools sharedTools] POST:url parameters:nil headers:nil constructingBodyWithBlock:^(id _Nonnull formData) { if (targetPatchGuid) { [formData appendPartWithFormData:[targetPatchGuid dataUsingEncoding:NSUTF8StringEncoding] name:@"targetPatchGuid"]; } else { [formData appendPartWithFormData:[organizeId dataUsingEncoding:NSUTF8StringEncoding] name:@"organizeId"]; [formData appendPartWithFormData:[@"" dataUsingEncoding:NSUTF8StringEncoding] name:@"gisinfo"]; [formData appendPartWithFormData:[Pbname dataUsingEncoding:NSUTF8StringEncoding] name:@"pbname"]; [formData appendPartWithFormData:[labelId dataUsingEncoding:NSUTF8StringEncoding] name:@"labelId"]; } [formData appendPartWithFormData:[collectDate dataUsingEncoding:NSUTF8StringEncoding] name:@"collectDate"]; if (modelId != nil && viewId != nil) { [formData appendPartWithFormData:[modelId dataUsingEncoding:NSUTF8StringEncoding] name:@"ModelId"]; [formData appendPartWithFormData:[viewId dataUsingEncoding:NSUTF8StringEncoding] name:@"ViewId"]; } [formData appendPartWithFileData:file name:@"File0" fileName:fileName mimeType:@"image"]; } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { callBack(task,responseObject, nil); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { callBack(nil,nil, error); }]; } @end