Commit db0bcdf7 authored by 陈俊俊's avatar 陈俊俊

接口修改

parent ae3ccba1
......@@ -65,7 +65,7 @@
7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E11B72364300FE5C1D /* SurveyCell.m */; };
7217E9F41B72364300FE5C1D /* SurveyListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E31B72364300FE5C1D /* SurveyListCell.m */; };
7217E9F61B724A7600FE5C1D /* mask.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9F51B724A7600FE5C1D /* mask.png */; };
72F56CB21B76EC200077F0C9 /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F56CB11B76EC200077F0C9 /* User.m */; };
72F56CB21B76EC200077F0C9 /* SurveyUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F56CB11B76EC200077F0C9 /* SurveyUser.m */; };
871F9F047CDDAC523E4358DC /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 86D33EC280C440156ED1B976 /* libPods.a */; };
C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; };
C10214CE1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; };
......@@ -435,8 +435,8 @@
7217E9E21B72364300FE5C1D /* SurveyListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurveyListCell.h; sourceTree = "<group>"; };
7217E9E31B72364300FE5C1D /* SurveyListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyListCell.m; sourceTree = "<group>"; };
7217E9F51B724A7600FE5C1D /* mask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mask.png; sourceTree = "<group>"; };
72F56CB01B76EC200077F0C9 /* User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = User.h; sourceTree = "<group>"; };
72F56CB11B76EC200077F0C9 /* User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = User.m; sourceTree = "<group>"; };
72F56CB01B76EC200077F0C9 /* SurveyUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurveyUser.h; sourceTree = "<group>"; };
72F56CB11B76EC200077F0C9 /* SurveyUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyUser.m; sourceTree = "<group>"; };
7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
86D33EC280C440156ED1B976 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
C10214CB1AD8FE200024637E /* ICRStoreDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRStoreDetailViewController.h; sourceTree = "<group>"; };
......@@ -811,8 +811,8 @@
7217E9CC1B72364300FE5C1D /* Survey.m */,
7217E9CD1B72364300FE5C1D /* SurveyResult.h */,
7217E9CE1B72364300FE5C1D /* SurveyResult.m */,
72F56CB01B76EC200077F0C9 /* User.h */,
72F56CB11B76EC200077F0C9 /* User.m */,
72F56CB01B76EC200077F0C9 /* SurveyUser.h */,
72F56CB11B76EC200077F0C9 /* SurveyUser.m */,
);
path = models;
sourceTree = "<group>";
......@@ -1952,7 +1952,7 @@
C17DE85A1AD81D1600581AA6 /* NSMutableArray+SafeInsert.m in Sources */,
35C3C0B91AE9567B0035AC8A /* ICRNavigationViewController.mm in Sources */,
C123A8FB1B2561E1003C0C36 /* JTPopOverWindow.m in Sources */,
72F56CB21B76EC200077F0C9 /* User.m in Sources */,
72F56CB21B76EC200077F0C9 /* SurveyUser.m in Sources */,
C142D2B41AC3A155000109A7 /* UIImage+Helper.m in Sources */,
C18AEA9E1AD2F48200A1DB7B /* ICRStore.m in Sources */,
C15295BB1B244C8E00DF60D1 /* ICRQScoreViewController.m in Sources */,
......
......@@ -183,8 +183,20 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//获取行情调研单列表
- (void)querySurveyWithBillNUmberLinke:(NSString *)billNumberLinke
state:(NSString *)state
titleLike:(NSString *)titleLike
orderFiled:(NSString *)orderFiled
orderDirection:(NSString *)orderDirection
page_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//获取行情调研单反馈列表
- (void)getResultsWithSurveyUuid:(NSString *)surveyUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end
......
......@@ -66,8 +66,10 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//Person
kICRHTTP_PersonQuery,
XFFHttp_SurveySave
//行情
XFFHttp_SurveySave,
XFFHttp_QuerySurvey,
XFFHttp_GetResults
};
static NSString * const ICRHTTPInterface[] = {
......@@ -115,7 +117,11 @@ static NSString * const ICRHTTPInterface[] = {
//Person
[kICRHTTP_PersonQuery] = @"user/download",
//行情调研
[XFFHttp_SurveySave] = @"survey/save_survey"
[XFFHttp_SurveySave] = @"survey/save_survey",
[XFFHttp_QuerySurvey] = @"survey/query_survey",
[XFFHttp_GetResults] = @"survey/get_result"
};
static NSString * const ICRAttachmentTypeValue[] = {
......@@ -222,7 +228,9 @@ static NSString * const ICRAttachmentTypeValue[] = {
[requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
}
}
[requestSerializer setValue:@"application/json;charset=utf-8" forHTTPHeaderField: @"Content-Type"];
//请求头添加enterprise参数
if(user.orgId != NULL)
{
......@@ -284,6 +292,9 @@ acceptTypeJson:(BOOL)bAcceptJson
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = requestSerializer;
manager.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",@"text/plain", nil];
[manager POST:urlStr
parameters:parameters
success:success
......@@ -1301,10 +1312,69 @@ acceptTypeJson:YES
}
};
NSDictionary *dict = data;
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operator.id=%@&operator.operName=%@&enterprise=%@",[[NSDate date] httpParameterString],@"admin",@"thoradmin",@"211534962"];
NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"/%@?time=%@&operator.id=%@&operator.operName=%@&enterprise=%@",userUtil.userId,currentTime,userUtil.userCode,userUtil.displayName,userUtil.orgId];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr parameters:dict needToken:NO acceptTypeJson:YES success:success failure:failure];
}
- (void)querySurveyWithBillNUmberLinke:(NSString *)billNumberLinke
state:(NSString *)state
titleLike:(NSString *)titleLike
orderFiled:(NSString *)orderFiled
orderDirection:(NSString *)orderDirection
page_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail
{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_QuerySurvey] stringByAppendingFormat:@"/%@?enterprise=%@&billNumberLike=%@&state=%@&titleLike=%@&orderField=%@&orderDirection=%@&page_number=%@&page_size=%@",userUtil.userId,userUtil.orgId,billNumberLinke,state,titleLike,orderFiled,orderDirection,@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr parameters:nil needToken:NO acceptTypeJson:YES success:success failure:failure];
}
- (void)getResultsWithSurveyUuid:(NSString *)surveyUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!surveyUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetResults] stringByAppendingFormat:@"/%@",surveyUuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr parameters:NULL needToken:NO acceptTypeJson:YES success:success failure:failure];
}
@end
......@@ -34,6 +34,7 @@
+ (NSDate *)convertToDateFrom:(NSString *)dateString;
+ (NSString *)stringFromDate:(NSDate*)aDate;
+ (NSString*)dictionaryToJson:(id)dic;
@end
......@@ -181,6 +181,17 @@
NSString *dateString = [formatter stringFromDate:aDate];
return dateString;
}
+ (NSString*)dictionaryToJson:(id)dic
{
NSError *parseError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
......
......@@ -94,9 +94,15 @@
// self.m_containerView.m_cCodeTextF.text = @"A93jie957lK";
// self.m_containerView.m_userNameTextF.text = @"kevin";
// self.m_containerView.m_passwordTextF.text = @"aaa";
// self.m_containerView.m_cCodeTextF.text = @"211534962";
// self.m_containerView.m_userNameTextF.text = @"alexander";
// self.m_containerView.m_passwordTextF.text = @"1";
self.m_containerView.m_cCodeTextF.text = @"211534962";
self.m_containerView.m_userNameTextF.text = @"alexander";
self.m_containerView.m_passwordTextF.text = @"1";
self.m_containerView.m_userNameTextF.text = @"admin";
self.m_containerView.m_passwordTextF.text = @"thoradmin";
[self.m_containerView checkLoginEnable];
#else
......@@ -113,12 +119,12 @@
- (void)onLoginTapped:(__unused id)sender {
//
// NSString *nsRegisterCode = self.m_containerView.m_cCodeTextF.text;
// NSString *nsUserName = self.m_containerView.m_userNameTextF.text;
// NSString *nsPassword = [self.m_containerView.m_passwordTextF.text uppercaseMD5String];
NSString *nsRegisterCode = @"211534962";
NSString *nsUserName = @"admin";
NSString *nsPassword = @"thoradmin";
NSString *nsRegisterCode = self.m_containerView.m_cCodeTextF.text;
NSString *nsUserName = self.m_containerView.m_userNameTextF.text;
NSString *nsPassword = [self.m_containerView.m_passwordTextF.text uppercaseMD5String];
// NSString *nsRegisterCode = @"211534962";
// NSString *nsUserName = @"admin";
// NSString *nsPassword = @"thoradmin";
void(^succ)(id) = ^(id data) {
......
......@@ -8,7 +8,7 @@
#import "ChosePersonViewController.h"
#import "MaskCell.h"
#import "User.h"
#import "SurveyUser.h"
#define TopMargin 50
#define TableHeight 50
@interface ChosePersonViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
......@@ -31,7 +31,7 @@
_dataArr = [NSMutableArray array];
_indexArr = [NSMutableArray array];
for (NSInteger i = 0; i < 10; i++) {
User *user = [[User alloc]init];
SurveyUser *user = [[SurveyUser alloc]init];
user.userName = [NSString stringWithFormat:@"张三%ld",(long)i];
[_dataArr addObject:user];
}
......@@ -73,7 +73,7 @@
- (void)sureClick{
NSMutableArray *arr = [[NSMutableArray alloc]init];
for (NSIndexPath *index in _indexArr) {
User *user = _dataArr[index.row];
SurveyUser *user = _dataArr[index.row];
[arr addObject:user];
}
self.chosePerson(arr);
......@@ -109,7 +109,7 @@
cell.Commitbtn.hidden = YES;
}
if (_dataArr.count > 0) {
User *user = _dataArr[indexPath.row];
SurveyUser *user = _dataArr[indexPath.row];
[cell setTitleStr:user.userName];
}
......@@ -127,7 +127,7 @@
NSString *personStr = @"";
for (NSIndexPath *index in _indexArr) {
User *user = _dataArr[index.row];
SurveyUser *user = _dataArr[index.row];
personStr = [personStr stringByAppendingFormat:@"%@、",user.userName];
}
_selectTextFiled.text = personStr;
......
......@@ -14,7 +14,7 @@
#import "StartTimeView.h"
#import "ChosePersonViewController.h"
#import "ChooseProductViewController.h"
#import "User.h"
#import "SurveyUser.h"
#import "Survey.h"
#define LeftMargin 15
#define BtnHeight 44
......@@ -45,6 +45,7 @@ typedef enum : NSUInteger {
StartTimeView *_startTimeView;
}
@property (nonatomic,strong)NSString *surveyTitle;
@property (nonatomic,strong)NSString *productCode;
@property (nonatomic,strong)NSString *productUuid;
@property (nonatomic,strong)NSString *productName;
@property (nonatomic,strong)NSString *beginDate;
......@@ -138,12 +139,9 @@ typedef enum : NSUInteger {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
NSString *beginDate = [[NSDate date] httpParameterString];
NSString *endDate = [[NSDate date] httpParameterString];
NSDictionary *dict = @{@"uuid":@"sssffff",@"billnumber":@"1111",@"title":@"gdgfd",@"productUuid":@"gdgfdgd",@"productCode":@"11111",@"productName":@"gfdgfds",@"beginDate":beginDate,@"endDate":endDate,@"remark":@"范德萨范德萨",@"users":self.users};
NSDictionary *dict = @{@"uuid":@"",@"billnumber":@"",@"title":self.surveyTitle,@"productUuid":self.productUuid,@"productCode":self.productCode,@"productName":self.productName,@"beginDate":self.beginDate,@"endDate":self.endDate,@"remark":self.remark,@"users":@""};
[IBTLoadingView showProgressLabel:@"正在保存..."];
[[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail];
}
......@@ -245,12 +243,13 @@ typedef enum : NSUInteger {
if (self.users.count <=0) {
[self.users removeAllObjects];
}
for (User *user in users) {
for (SurveyUser *user in users) {
textStr = [textStr stringByAppendingFormat:@"%@、",user.userName];
[self.users addObject:[user dictForCommit]];
}
_personLabel.text = textStr;
_personLabel.textColor = HexColor(@"444444");
// [self.users addObjectsFromArray:users];
};
cvc.isMoreChose = YES;
[self PushViewController:cvc animated:YES];
......@@ -261,6 +260,7 @@ typedef enum : NSUInteger {
_productLabel.textColor = HexColor(@"444444");
self.productName = name;
self.productUuid = name;
self.productCode = @"123";
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
......@@ -293,11 +293,11 @@ typedef enum : NSUInteger {
if (_isClickStart) {
_startDateLabel.textColor = HexColor(@"444444");
_startDateLabel.text = [df stringFromDate:time];
self.beginDate = [df stringFromDate:time];
self.beginDate = [time httpParameterString];
}else{
_endDateLabel.textColor = HexColor(@"444444");
_endDateLabel.text = [df stringFromDate:time];
self.endDate = [df stringFromDate:time];
self.endDate = [time httpParameterString];
}
// 关闭选择器
[self clearDatePickView];
......
......@@ -51,26 +51,40 @@ typedef enum : NSUInteger {
- (void)initData{
_dataArr = [NSMutableArray array];
for (NSInteger i = 0; i < 4; i++) {
Survey *survey = [[Survey alloc]init];
survey.title = @"南汇8424西瓜调研情况";
survey.billnumber = @"150605000001";
survey.productname = @"南汇842[100213]";
survey.productcode = @"22222222222";
survey.remark = @"费卡接口浪格可放大文化大fdsaf缴费卡接口浪费缴费卡上就付款放假快乐撒即可书法家开发商";
survey.begindate = [IBTCommon convertToDateFrom:@"2015.05.25"];
survey.enddate = [IBTCommon convertToDateFrom:@"2015.08.06"];
[_dataArr addObject:survey];
if (i == 0) {
survey.state = @"saved";
}else if (i == 1) {
survey.state = @"submitted";
}else if (i == 2) {
survey.state = @"insurvey";
}else if (i == 3) {
survey.state = @"finished";
}
}
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
NSLog(@"%@",data);
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在保存..."];
// [[ICRHTTPController sharedController] querySurveyWithBillNUmberLinke:@"" state:@"initial" titleLike:@"fds" orderFiled:@"" orderDirection:@"asc" page_number:1 page_size:10 success:succ failure:fail];
[[ICRHTTPController sharedController] getResultsWithSurveyUuid:@"111" success:succ failure:fail];
// for (NSInteger i = 0; i < 4; i++) {
// Survey *survey = [[Survey alloc]init];
// survey.title = @"南汇8424西瓜调研情况";
// survey.billnumber = @"150605000001";
// survey.productname = @"南汇842[100213]";
// survey.productcode = @"22222222222";
// survey.remark = @"费卡接口浪格可放大文化大fdsaf缴费卡接口浪费缴费卡上就付款放假快乐撒即可书法家开发商";
// survey.begindate = [IBTCommon convertToDateFrom:@"2015.05.25"];
// survey.enddate = [IBTCommon convertToDateFrom:@"2015.08.06"];
// [_dataArr addObject:survey];
// if (i == 0) {
// survey.state = @"saved";
// }else if (i == 1) {
// survey.state = @"submitted";
// }else if (i == 2) {
// survey.state = @"insurvey";
// }else if (i == 3) {
// survey.state = @"finished";
// }
// }
}
- (void)createTableView
{
......
......@@ -8,7 +8,7 @@
#import "IBTModel.h"
@interface User : IBTModel
@interface SurveyUser : IBTModel
@property (nonatomic,strong)NSString *userUuid;//用户UUid
@property (nonatomic,strong)NSString *userCode;//用户编码
@property (nonatomic,strong)NSString *userName;//用户名称
......
......@@ -6,8 +6,8 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "User.h"
#import "SurveyUser.h"
@implementation User
@implementation SurveyUser
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment