Commit b4a7b4da authored by Achilles's avatar Achilles

提交确认和拒绝接口调用

parent 5310677b
......@@ -650,6 +650,10 @@
C1DED3381BCEC4B40049BB2D /* user_checked@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1DED32A1BCEC4B40049BB2D /* user_checked@2x.png */; };
C1DED3391BCEC4B40049BB2D /* user.png in Resources */ = {isa = PBXBuildFile; fileRef = C1DED32B1BCEC4B40049BB2D /* user.png */; };
C1DED33A1BCEC4B40049BB2D /* user@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C1DED32C1BCEC4B40049BB2D /* user@2x.png */; };
C1F790A51C075A09001AEBBB /* VankeSettlementConfirmAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = C1F790A41C075A09001AEBBB /* VankeSettlementConfirmAPI.m */; };
C1F790A81C075A1A001AEBBB /* VankeSettlementRejectAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = C1F790A71C075A1A001AEBBB /* VankeSettlementRejectAPI.m */; };
C1F790AB1C07600E001AEBBB /* VankeStatementConfirmModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C1F790AA1C07600E001AEBBB /* VankeStatementConfirmModel.m */; };
C1F790AE1C076191001AEBBB /* VankeStatementRejectModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C1F790AD1C076191001AEBBB /* VankeStatementRejectModel.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -1790,6 +1794,14 @@
C1DED32A1BCEC4B40049BB2D /* user_checked@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "user_checked@2x.png"; path = "img/user_checked@2x.png"; sourceTree = "<group>"; };
C1DED32B1BCEC4B40049BB2D /* user.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = user.png; path = img/user.png; sourceTree = "<group>"; };
C1DED32C1BCEC4B40049BB2D /* user@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "user@2x.png"; path = "img/user@2x.png"; sourceTree = "<group>"; };
C1F790A31C075A09001AEBBB /* VankeSettlementConfirmAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VankeSettlementConfirmAPI.h; sourceTree = "<group>"; };
C1F790A41C075A09001AEBBB /* VankeSettlementConfirmAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VankeSettlementConfirmAPI.m; sourceTree = "<group>"; };
C1F790A61C075A1A001AEBBB /* VankeSettlementRejectAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VankeSettlementRejectAPI.h; sourceTree = "<group>"; };
C1F790A71C075A1A001AEBBB /* VankeSettlementRejectAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VankeSettlementRejectAPI.m; sourceTree = "<group>"; };
C1F790A91C07600E001AEBBB /* VankeStatementConfirmModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VankeStatementConfirmModel.h; sourceTree = "<group>"; };
C1F790AA1C07600E001AEBBB /* VankeStatementConfirmModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VankeStatementConfirmModel.m; sourceTree = "<group>"; };
C1F790AC1C076191001AEBBB /* VankeStatementRejectModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VankeStatementRejectModel.h; sourceTree = "<group>"; };
C1F790AD1C076191001AEBBB /* VankeStatementRejectModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VankeStatementRejectModel.m; sourceTree = "<group>"; };
C5987243B74E897E93DEC7D3 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
F0AF65C76AE6E38D28DC2D1B /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -2487,8 +2499,12 @@
C19ADE421BC81ACB00206213 /* VankeSaleVolumeModel.m */,
C12805101BC6AEB4001ECBAA /* VankeServerModel.h */,
C12805111BC6AEB5001ECBAA /* VankeServerModel.m */,
C1F790A91C07600E001AEBBB /* VankeStatementConfirmModel.h */,
C1F790AA1C07600E001AEBBB /* VankeStatementConfirmModel.m */,
C10F18711BF8F1830065F18C /* VankeStatementListModel.h */,
C10F18721BF8F1830065F18C /* VankeStatementListModel.m */,
C1F790AC1C076191001AEBBB /* VankeStatementRejectModel.h */,
C1F790AD1C076191001AEBBB /* VankeStatementRejectModel.m */,
C12804DE1BC2D0BD001ECBAA /* VankeUserModel.h */,
C12804DF1BC2D0BD001ECBAA /* VankeUserModel.m */,
C12804D51BC124A3001ECBAA /* VankeWeatherModel.h */,
......@@ -2522,6 +2538,10 @@
C1CF9F5B1BF4D6EB0033C35E /* VankeVersionAPI.m */,
C12804D81BC12A67001ECBAA /* VankeWeatherController.h */,
C12804D91BC12A67001ECBAA /* VankeWeatherController.m */,
C1F790A31C075A09001AEBBB /* VankeSettlementConfirmAPI.h */,
C1F790A41C075A09001AEBBB /* VankeSettlementConfirmAPI.m */,
C1F790A61C075A1A001AEBBB /* VankeSettlementRejectAPI.h */,
C1F790A71C075A1A001AEBBB /* VankeSettlementRejectAPI.m */,
);
path = controller;
sourceTree = "<group>";
......@@ -4273,6 +4293,7 @@
C10F183E1BF7ACA80065F18C /* IBTSegmentContainer.m in Sources */,
C10F181C1BF7ACA80065F18C /* UIScrollView+Content.m in Sources */,
C10F181B1BF7ACA80065F18C /* UIResponder+FirstResponder.m in Sources */,
C1F790A51C075A09001AEBBB /* VankeSettlementConfirmAPI.m in Sources */,
C19BBC1B1BBE865400831290 /* VankeFloorListBoardCell_iPhone.m in Sources */,
C18A95381C01E8E100429BF7 /* ICRAnnocementContentView.m in Sources */,
C1D598621BB44B2000D297FE /* BeeUIBoard+Popover.m in Sources */,
......@@ -4334,6 +4355,7 @@
C1D598861BB44B2000D297FE /* Bee_UIAnimation.m in Sources */,
C1D599081BB44B2000D297FE /* Bee_PublishViewModel.mm in Sources */,
C1D598D21BB44B2000D297FE /* UIView+BeeUICell.m in Sources */,
C1F790A81C075A1A001AEBBB /* VankeSettlementRejectAPI.m in Sources */,
C1D598411BB44B2000D297FE /* Bee_Package.mm in Sources */,
C1D598BF1BB44B2000D297FE /* UIView+PinchGesture.m in Sources */,
C1D599891BB44B2100D297FE /* CXMLNamespaceNode.m in Sources */,
......@@ -4477,6 +4499,7 @@
C1D598551BB44B2000D297FE /* Bee_UIMetrics.m in Sources */,
C1D598E31BB44B2000D297FE /* UIScrollView+BeeUILayout.m in Sources */,
C1D5987D1BB44B2000D297FE /* UIView+BeeUIStyle.m in Sources */,
C1F790AB1C07600E001AEBBB /* VankeStatementConfirmModel.m in Sources */,
C1D5988A1BB44B2000D297FE /* Bee_UIAnimationStyling.m in Sources */,
C1D599571BB44B2100D297FE /* Bee_HTTPConfig.m in Sources */,
C1D599501BB44B2100D297FE /* Bee_Language.m in Sources */,
......@@ -4554,6 +4577,7 @@
C1D598B01BB44B2000D297FE /* Bee_UISwitch.m in Sources */,
C1D599591BB44B2100D297FE /* Bee_HTTPRequestQueue.m in Sources */,
C1D598961BB44B2000D297FE /* UINavigationBar+BeeExtension.m in Sources */,
C1F790AE1C076191001AEBBB /* VankeStatementRejectModel.m in Sources */,
C10F182F1BF7ACA80065F18C /* ICRLoginContentView.m in Sources */,
C1D5991C1BB44B2100D297FE /* Bee_System.mm in Sources */,
C10F18441BF7ACA80065F18C /* IBTUIControl.m in Sources */,
......
......@@ -30,7 +30,7 @@
-(BeeHTTPRequest*) http_post: (NSString*) url {
NSString *absUrl = [NSString stringWithFormat:@"%@%@", VANKE_SERVER_BASE_URL, url];
BeeHTTPRequest *req = self.HTTP_POST(absUrl);
[self addHeaders:req];;
[self addHeaders:req];
return req;
}
......
//
// VankeSettlementConfirmAPI.h
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeBaseAPI.h"
/**
* 确认对账单
*/
@interface VankeSettlementConfirmAPI : VankeBaseAPI
@property (nonatomic, strong) NSString *contract;
@property (nonatomic, strong) NSString *settle;
@end
//
// VankeSettlementConfirmAPI.m
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeSettlementConfirmAPI.h"
#import "VankeUtil.h"
#import "VankeCommonModel.h"
@implementation VankeSettlementConfirmAPI
@synthesize contract = _contract;
@synthesize settle = _settle;
-(void) route:(BeeMessage *)msg {
if (self.sending) {
if (![self checkToQuery]) {
return;
}
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *operTime = [dateFormatter stringFromDate:[NSDate date]];
User *curUser = [[VankeCommonModel sharedInstance] currentUser];
NSString *url = [NSString stringWithFormat:@"/statement/confirm"];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
self.contract, @"contract",
self.settle, @"settle",
@"confirmed", @"state",
operTime, @"time",
curUser.uuid, @"operId",
curUser.name, @"operName",
nil];
NSString *postData = [VankeUtil dictToJsonString: dict];
[self http_post: url].BODY(postData).TIMEOUT(10);
}
else if (self.succeed) {
NSLog(@"response: %@", self.responseString);
self.serverResp = [VankeResponse objectFromDictionary: self.responseJSONDictionary];
if ( nil == self.serverResp )
{
self.failed = YES;
return;
}
}
}
-(BOOL) checkToQuery {
if ([VankeUtil isBlankString:self.contract]) {
[self setClientError: @"合同编号不能为空"];
return NO;
}
if ([VankeUtil isBlankString:self.settle]) {
[self setClientError: @"账单日期不能为空"];
return NO;
}
return YES;
}
@end
//
// VankeSettlementRejectAPI.h
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeBaseAPI.h"
/**
* 拒绝对账单
*/
@interface VankeSettlementRejectAPI : VankeBaseAPI
@property (nonatomic, strong) NSString *contract;
@property (nonatomic, strong) NSString *settle;
@property (nonatomic, strong) NSString *message;
@end
//
// VankeSettlementRejectAPI.m
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeSettlementRejectAPI.h"
#import "VankeUtil.h"
#import "VankeCommonModel.h"
@implementation VankeSettlementRejectAPI
@synthesize contract = _contract;
@synthesize settle = _settle;
@synthesize message = _message;
-(void) route:(BeeMessage *)msg {
if (self.sending) {
if (![self checkToQuery]) {
return;
}
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *operTime = [dateFormatter stringFromDate:[NSDate date]];
User *curUser = [[VankeCommonModel sharedInstance] currentUser];
NSString *url = [NSString stringWithFormat:@"/statement/confirm"];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
self.contract, @"contract",
self.settle, @"settle",
@"rejected", @"state",
_message, @"message",
operTime, @"time",
curUser.uuid, @"operId",
curUser.name, @"operName",
nil];
NSString *postData = [VankeUtil dictToJsonString: dict];
[self http_post: url].BODY(postData).TIMEOUT(10);
}
else if (self.succeed) {
NSLog(@"response: %@", self.responseString);
self.serverResp = [VankeResponse objectFromDictionary: self.responseJSONDictionary];
if ( nil == self.serverResp )
{
self.failed = YES;
return;
}
}
}
-(BOOL) checkToQuery {
if ([VankeUtil isBlankString:self.contract]) {
[self setClientError: @"合同编号不能为空"];
return NO;
}
if ([VankeUtil isBlankString:self.settle]) {
[self setClientError: @"账单日期不能为空"];
return NO;
}
return YES;
}
@end
//
// VankeStatementConfirmModel.h
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeServerModel.h"
// 对账单确认接口
@interface VankeStatementConfirmModel : VankeServerModel
/**
* 确认单据
*
* @param contract 合同编号
* @param settle 账单日期
*/
-(void) confirm: (NSString*) contract settle: (NSString*) settle;
@end
//
// VankeStatementBillModel.m
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeStatementConfirmModel.h"
#import "VankeSettlementConfirmAPI.h"
@implementation VankeStatementConfirmModel
-(void) confirm: (NSString*) contract settle: (NSString*) settle {
[VankeSettlementConfirmAPI cancel];
VankeSettlementConfirmAPI *api = [VankeSettlementConfirmAPI api];
@weakify(api);
@weakify(self);
api.contract = contract;
api.settle = settle;
// 清空结果
self.serverResp = nil;
api.whenSending = ^{
[self sendUISignal:self.RELOADING];
};
api.whenSucceed = ^{
@normalize(api);
@normalize(self);
if (api.succeed) {
if (nil == api.serverResp) {
api.failed = YES;
} else {
self.serverResp = api.serverResp;
}
}
[self sendUISignal:self.RELOADED];
};
api.whenFailed = ^{
@normalize(api);
@normalize(self);
self.serverResp = [VankeResponse initWith:NO message:nil == api.errorDesc? @"网络异常": api.errorDesc];
[self sendUISignal:self.RELOADED];
};
[api send];
}
@end
//
// VankeStatementRejectModel.h
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeServerModel.h"
// 对账单拒绝操作接口
@interface VankeStatementRejectModel : VankeServerModel
/**
* 拒绝单据
*
* @param contract 合同编号
* @param settle 账单日期
*/
-(void) reject: (NSString*) contract settle: (NSString*) settle message: (NSString*) message;
@end
//
// VankeStatementRejectModel.m
// vanke
//
// Created by xiaomi on 15/11/26.
// Copyright © 2015年 gomore. All rights reserved.
//
#import "VankeStatementRejectModel.h"
#import "VankeSettlementRejectAPI.h"
@implementation VankeStatementRejectModel
-(void) reject: (NSString*) contract settle: (NSString*) settle message: (NSString*) message {
[VankeSettlementRejectAPI cancel];
VankeSettlementRejectAPI *api = [VankeSettlementRejectAPI api];
@weakify(api);
@weakify(self);
api.contract = contract;
api.settle = settle;
api.message = message;
// 清空结果
self.serverResp = nil;
api.whenSending = ^{
[self sendUISignal:self.RELOADING];
};
api.whenSucceed = ^{
@normalize(api);
@normalize(self);
if (api.succeed) {
if (nil == api.serverResp) {
api.failed = YES;
} else {
self.serverResp = api.serverResp;
}
}
[self sendUISignal:self.RELOADED];
};
api.whenFailed = ^{
@normalize(api);
@normalize(self);
self.serverResp = [VankeResponse initWith:NO message:nil == api.errorDesc ? @"网络异常" : api.errorDesc];
[self sendUISignal:self.RELOADED];
};
[api send];
}
@end
......@@ -21,6 +21,8 @@
#import "VankeUtil.h"
#import "GEToast.h"
#import "NoDataCell_iPhoneCell.h"
#import "VankeStatementRejectModel.h"
#import "VankeStatementConfirmModel.h"
#import "VankeStatementDetailListCell_iPhone.h"
#import "VankeStatementDetailMonthCell_iPhone.h"
......@@ -29,6 +31,8 @@
@interface VankeStatementDetailListBoard_iPhone ()
{
//<#@private var#>
VankeStatementConfirmModel *confirmModel;
VankeStatementRejectModel *rejectModel;
}
@end
......@@ -49,11 +53,15 @@ DEF_OUTLET( BeeUIImageView, imgState)
- (void)load
{
self.model = [VankeStatementListModel modelWithObserver:self];
confirmModel = [VankeStatementConfirmModel modelWithObserver:self];
rejectModel = [VankeStatementRejectModel modelWithObserver:self];
}
- (void)unload
{
self.model = nil;
confirmModel = nil;
rejectModel = nil;
}
#pragma mark - Signal
......@@ -66,10 +74,7 @@ ON_CREATE_VIEWS( signal )
self.allowedSwipeToBack = YES;
self.title = [_data codeName];
[self showOperButtons: [_data unconfirmed]];
[self initListAndModel];
}
ON_DELETE_VIEWS( signal )
......@@ -78,7 +83,6 @@ ON_DELETE_VIEWS( signal )
ON_LAYOUT_VIEWS( signal )
{
}
ON_WILL_APPEAR( signal )
......@@ -135,12 +139,35 @@ ON_SIGNAL3( VankeStatementListModel, RELOADED, signal )
[self showOperButtons: [_data unconfirmed]];
}
#pragma UISearchBarDelegate
ON_SIGNAL3( VankeStatementConfirmModel, RELOADING, signal ) {
[GEToast showProgress:self.view];
}
-(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar {
// NSString *nameLike = [VankeUtil trim:_searchBar.text];
// self.model.nameLike = nameLike;
[self.model firstPage];
ON_SIGNAL3( VankeStatementConfirmModel, RELOADED, signal ) {
[GEToast hideProgress];
if (![confirmModel isOk]) {
NSString *msg = [NSString stringWithFormat:@"确认失败: %@", confirmModel.serverResp.message];
[GEToast showWithText:msg bottomOffset:50.0f duration:2.0f];
} else {
[GEToast showWithText:@"确认成功!" bottomOffset:50.0f duration:2.0f];
[self.model firstPage];
}
}
ON_SIGNAL3( VankeStatementRejectModel, RELOADING, signal ) {
[GEToast showProgress:self.view];
}
ON_SIGNAL3( VankeStatementRejectModel, RELOADED, signal ) {
[GEToast hideProgress];
if (![confirmModel isOk]) {
NSString *msg = [NSString stringWithFormat:@"拒绝失败: %@", confirmModel.serverResp.message];
[GEToast showWithText:msg bottomOffset:50.0f duration:2.0f];
} else {
[GEToast showWithText:@"拒绝成功!" bottomOffset:50.0f duration:2.0f];
[self.model firstPage];
}
}
#pragma VankeStatementDetailMonthCell_iPhone
......@@ -187,6 +214,11 @@ ON_SIGNAL3(VankeStatementDetailListBoard_iPhone, btnConfirm, signal) {
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *archiveAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
INFO(@"正在确认账单。。。");
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyyMM"];
NSString *settleStr = [dateFormatter stringFromDate:_settleEquals];
[confirmModel confirm: _data.contract settle:settleStr];
}];
[alertController addAction:cancelAction];
[alertController addAction:archiveAction];
......@@ -196,10 +228,15 @@ ON_SIGNAL3(VankeStatementDetailListBoard_iPhone, btnConfirm, signal) {
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == ALERT_REJECT_TAG) {
if (buttonIndex == 0) {
INFO(@"取消拒绝");
} else if (buttonIndex == 1) {
if (buttonIndex == 1) {
INFO(@"准备拒绝单据");
UITextField * msgField = [alertView textFieldAtIndex:0];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyyMM"];
NSString *settleStr = [dateFormatter stringFromDate:_settleEquals];
[rejectModel reject:_data.contract settle:settleStr message:msgField.text];
}
}
}
......
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