Commit f3198698 authored by n22's avatar n22

接口

parent 55b6c85f
......@@ -347,6 +347,7 @@
FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC871B7492C500BBC6FB /* ResultDetailViewController.m */; };
FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */; };
FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; };
FE7155D91B7B328400595B0A /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7155D81B7B328400595B0A /* Product.m */; };
FEAE16E91B79C9F9009D9E01 /* ResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16E81B79C9F9009D9E01 /* ResultView.m */; };
FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EB1B79CAA0009D9E01 /* TPCustomImageVIew.m */; };
FEAE16EF1B79CAE3009D9E01 /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EE1B79CAE3009D9E01 /* SingleScrollView.m */; };
......@@ -737,6 +738,8 @@
FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyResultCell.m; sourceTree = "<group>"; };
FE4F17231B72FAAB00924DED /* ChosePersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChosePersonViewController.h; sourceTree = "<group>"; };
FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; };
FE7155D71B7B328400595B0A /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; };
FE7155D81B7B328400595B0A /* Product.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Product.m; sourceTree = "<group>"; };
FEAE16E71B79C9F9009D9E01 /* ResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultView.h; sourceTree = "<group>"; };
FEAE16E81B79C9F9009D9E01 /* ResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultView.m; sourceTree = "<group>"; };
FEAE16EA1B79CAA0009D9E01 /* TPCustomImageVIew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCustomImageVIew.h; sourceTree = "<group>"; };
......@@ -822,6 +825,8 @@
7217E9CE1B72364300FE5C1D /* SurveyResult.m */,
72F56CB01B76EC200077F0C9 /* SurveyUser.h */,
72F56CB11B76EC200077F0C9 /* SurveyUser.m */,
FE7155D71B7B328400595B0A /* Product.h */,
FE7155D81B7B328400595B0A /* Product.m */,
);
path = models;
sourceTree = "<group>";
......@@ -1932,6 +1937,7 @@
C142D2AC1AC3A155000109A7 /* NSNull+OVNatural.m in Sources */,
300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */,
C12C24D11B0BA3C700E1FEBF /* ICRTaskHandleViewController.m in Sources */,
FE7155D91B7B328400595B0A /* Product.m in Sources */,
C159188A1AC4615D0013B391 /* ICRHTTPController.m in Sources */,
C123A90D1B25CBAD003C0C36 /* ASStarRatingView.m in Sources */,
C15295AF1B24296500DF60D1 /* ICRQSingleSelectViewController.m in Sources */,
......
......@@ -198,6 +198,19 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//下载商品信息
- (void)getProductWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//下载用户信息
- (void)getUserWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end
......@@ -69,7 +69,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//行情
XFFHttp_SurveySave,
XFFHttp_QuerySurvey,
XFFHttp_GetResults
XFFHttp_GetResults,
XFFHttp_GetProduct,
XFFHttp_GetUser
};
static NSString * const ICRHTTPInterface[] = {
......@@ -119,8 +121,9 @@ static NSString * const ICRHTTPInterface[] = {
//行情调研
[XFFHttp_SurveySave] = @"survey/save_survey",
[XFFHttp_QuerySurvey] = @"survey/query_survey",
[XFFHttp_GetResults] = @"survey/get_result"
[XFFHttp_GetResults] = @"survey/get_result",
[XFFHttp_GetProduct] = @"mdata/product/download",
[XFFHttp_GetUser] = @"user/download"
};
......@@ -1316,7 +1319,12 @@ acceptTypeJson:YES
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operator.id=%@&operator.operName=%@&enterprise=%@",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];
[self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
......@@ -1345,7 +1353,12 @@ acceptTypeJson:YES
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_QuerySurvey] stringByAppendingFormat:@"?enterprise=%@&userUuid=%@&billNumberLike=%@&state=%@&titleLike=%@&orderField=%@&orderDirection=%@&page_number=%@&page_size=%@",userUtil.orgId,userUtil.userId,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];
[self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
- (void)getResultsWithSurveyUuid:(NSString *)surveyUuid
......@@ -1373,7 +1386,69 @@ acceptTypeJson:YES
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];
[self POST:encodeUrlStr
parameters:NULL
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
-(void)getProductWithPage_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 );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetProduct] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:NULL
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
- (void)getUserWithPage_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 );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetUser] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:NULL
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
......
......@@ -10,5 +10,5 @@
#import <UIKit/UIKit.h>
@interface IBTObject : NSObject
- (void)setValue:(id)value forUndefinedKey:(NSString *)key;
@end
......@@ -9,5 +9,5 @@
#import "IBTObject.h"
@implementation IBTObject
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{}
@end
......@@ -27,7 +27,7 @@
- (void)bulidLayout
{
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, 100, self.totalHeight))];
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, self.totalWidth - LeftMargin - BtnSize, self.totalHeight))];
self.titleLabel.textAlignment= NSTextAlignmentLeft;
self.titleLabel.textColor = HexColor(@"666666");
self.titleLabel.font = FontSize(TitleSize);
......
......@@ -7,7 +7,8 @@
//
#import "ICRBaseViewController.h"
typedef void(^ChoseProduct)(NSString *name);
#import "Product.h"
typedef void(^ChoseProduct)(Product *product);
@interface ChooseProductViewController : ICRBaseViewController
......
......@@ -17,7 +17,6 @@
NSMutableArray *_dataArr;
NSMutableArray *_indexArr;
NSIndexPath *_currentIndexPath;
}@end
......@@ -31,21 +30,36 @@
- (void)initData{
_dataArr = [NSMutableArray array];
_indexArr = [NSMutableArray array];
[_dataArr addObject:@"商品1"];
[_dataArr addObject:@"商品2"];
[_dataArr addObject:@"商品3"];
[_dataArr addObject:@"商品4"];
[_dataArr addObject:@"商品5"];
[_dataArr addObject:@"商品6"];
[_dataArr addObject:@"商品7"];
[_dataArr addObject:@"商品8"];
[_dataArr addObject:@"商品9"];
[_dataArr addObject:@"商品10"];
[_dataArr addObject:@"商品11"];
[_dataArr addObject:@"商品12"];
[_dataArr addObject:@"商品13"];
[_dataArr addObject:@"商品14"];
[_dataArr addObject:@"商品15"];
//获取商品
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
NSDictionary *dataDict = data[@"data"];
NSArray *records = dataDict[@"records"];
if (records.count > 0) {
for (NSDictionary *recordDict in records) {
Product *product = [[Product alloc]init];
[product setValuesForKeysWithDictionary:recordDict];
[_dataArr addObject:product];
}
//刷新表格
[_tableView reloadData];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:100 success:succ failure:fail];
}
- (void)bulidLayout
{
......@@ -82,7 +96,14 @@
}
- (void)sureClick{
self.choseProduct(_selectTextFiled.text);
if(self.isMoreChose){
}else{
if (_dataArr.count > 0) {
Product *product = _dataArr[_currentIndexPath.row];
self.choseProduct(product);
}
}
[self PopViewControllerAnimated:YES];
}
......@@ -90,6 +111,7 @@
- (void)deletePerson {
_selectTextFiled.text = @"";
[_indexArr removeAllObjects];
_currentIndexPath = nil;
[_tableView reloadData];
}
......@@ -122,9 +144,16 @@
}else{
cell.Commitbtn.hidden = YES;
}
}else{
cell.Commitbtn.hidden = YES;
}
}
[cell setTitleStr:_dataArr[indexPath.row]];
if (_dataArr.count > 0) {
Product *product = _dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
[cell setTitleStr:proStr];
}
return cell;
}
......@@ -139,7 +168,8 @@
NSString *personStr = @"";
for (NSIndexPath *index in _indexArr) {
personStr = [personStr stringByAppendingFormat:@"%@、",_dataArr[index.row]];
Product *product = _dataArr[index.row];
personStr = [personStr stringByAppendingFormat:@"%@、",product.name];
}
_selectTextFiled.text = personStr;
}else{
......@@ -150,8 +180,8 @@
_currentIndexPath = indexPath;
NSString *name = _dataArr[indexPath.row];
_selectTextFiled.text = name;
Product *procuct = _dataArr[indexPath.row];
_selectTextFiled.text = procuct.name;
}
}
......
......@@ -9,6 +9,7 @@
#import "ChosePersonViewController.h"
#import "MaskCell.h"
#import "SurveyUser.h"
#import "SurveyUser.h"
#define TopMargin 50
#define TableHeight 50
@interface ChosePersonViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
......@@ -30,11 +31,42 @@
- (void)initData{
_dataArr = [NSMutableArray array];
_indexArr = [NSMutableArray array];
for (NSInteger i = 0; i < 10; i++) {
SurveyUser *user = [[SurveyUser alloc]init];
user.userName = [NSString stringWithFormat:@"张三%ld",(long)i];
[_dataArr addObject:user];
}
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
NSDictionary *dataDict = data[@"data"];
NSArray *records = dataDict[@"records"];
if (records.count > 0) {
for (NSDictionary *recordDict in records) {
SurveyUser *user = [[SurveyUser alloc]init];
[user setValuesForKeysWithDictionary:recordDict];
[_dataArr addObject:user];
}
//刷新表格
[_tableView reloadData];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getUserWithPage_number:0 page_size:100 success:succ failure:fail];
// for (NSInteger i = 0; i < 10; i++) {
// SurveyUser *user = [[SurveyUser alloc]init];
// user.userName = [NSString stringWithFormat:@"张三%ld",(long)i];
// [_dataArr addObject:user];
// }
}
- (void)bulidLayout
{
......
......@@ -16,6 +16,7 @@
#import "ChooseProductViewController.h"
#import "SurveyUser.h"
#import "Survey.h"
#import "Product.h"
#define LeftMargin 15
#define BtnHeight 44
#define TableHeight 46
......@@ -133,7 +134,15 @@ typedef enum : NSUInteger {
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
NSLog(@"%@",data);
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
......@@ -249,18 +258,17 @@ typedef enum : NSUInteger {
}
_personLabel.text = textStr;
_personLabel.textColor = HexColor(@"444444");
// [self.users addObjectsFromArray:users];
};
cvc.isMoreChose = YES;
[self PushViewController:cvc animated:YES];
}else if(indexPath.row == 1){
ChooseProductViewController *cvc = [ChooseProductViewController new];
cvc.choseProduct = ^(NSString *name){
_productLabel.text = name;
cvc.choseProduct = ^(Product *product){
_productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_productLabel.textColor = HexColor(@"444444");
self.productName = name;
self.productUuid = name;
self.productCode = @"123";
self.productName = product.name;
self.productUuid = product.uuid;
self.productCode = product.code;
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
......
......@@ -52,39 +52,39 @@ typedef enum : NSUInteger {
- (void)initData{
_dataArr = [NSMutableArray array];
// //保存
// 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:@"fdsfds" state:@"initial" titleLike:@"fds" orderFiled:@"fdsafds" orderDirection:@"asc" page_number:1 page_size:10 success:succ failure:fail];
// [[ICRHTTPController sharedController] getResultsWithSurveyUuid:@"111" success:succ failure:fail];
//保存
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:@"fdsfds" state:@"initial" titleLike:@"fds" orderFiled:@"fdsafds" 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";
}
}
// 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
{
......
//
// Product.h
// XFFruit
//
// Created by n22 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface Product : IBTModel
@property (nonatomic,strong)NSString *uuid;//商品uuid
@property (nonatomic,strong)NSString *code;//商品代码
@property (nonatomic,strong)NSString *brandName;//品牌名称
@property (nonatomic,strong)NSString *name;//品牌名称
@end
//
// Product.m
// XFFruit
//
// Created by n22 on 15/8/12.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "Product.h"
@implementation Product
@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