Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
8d5d9976
Commit
8d5d9976
authored
Jan 19, 2021
by
宁斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、N5重試佈 2、賬單詳情頁代碼結構調整 3、先打印賬單再打印存根單
parent
e9a86dd5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
916 additions
and
591 deletions
+916
-591
component-main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/presenter/NewMainPresenter.java
+8
-11
component-pay/src/main/java/com/gingersoft/gsa/cloud/pay/mvp/ui/activity/PayResultActivity.java
+48
-18
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/action/order/PrintOrderAction.java
+44
-31
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/contract/OrderDetailContract.java
+10
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/bean/response/OrderManagerResponse.java
+83
-15
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/MealStandPresenter.java
+3
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/orderManager/AllOrderPresenter.java
+12
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderPayActivity.java
+9
-1
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderCenterActivity.java
+7
-6
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderDetailActivity.java
+119
-51
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/adapter/OrderCenterAdapter.java
+0
-0
component-table/src/main/res/layout/activity_order_center.xml
+5
-0
component-table/src/main/res/layout/activity_order_detail.xml
+22
-7
component-table/src/main/res/layout/item_order_center.xml
+107
-85
component-table/src/main/res/mipmap-hdpi/meal_order_exception.png
+0
-0
library-common/src/main/res/drawable/shape_rect_radius_transparent_5.xml
+10
-0
library-database/src/main/java/com/gingersoft/gsa/cloud/database/bean/ColorBean.java
+1
-1
library-database/src/main/java/com/gingersoft/gsa/cloud/database/bean/Food.java
+18
-130
library-database/src/main/java/com/gingersoft/gsa/cloud/database/greendao/FoodDao.java
+6
-119
library-database/src/main/java/com/gingersoft/gsa/cloud/database/utils/ComboItemDaoUtils.java
+1
-1
library-database/src/main/java/com/gingersoft/gsa/cloud/database/utils/FoodDaoUtils.java
+2
-5
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/contract/PayExceptionCode.java
+26
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/IPosAction.java
+20
-11
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/fragment/PosActionStatusExceptionFragment.java
+10
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/AdjustTipRespose.java
+2
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/HywebPosResponse.java
+2
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/PrintPaymentStubResponse.java
+3
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RefundRespose.java
+2
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RetrievalRespose.java
+2
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SaleRespose.java
+2
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SettlementRespose.java
+3
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/VoidRespose.java
+2
-0
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/command/CommandImpl.java
+46
-19
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/constant/HywebActionStatusCode.java
+6
-3
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/PrintPaymentStubImpl.java
+5
-12
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RefundActionImpl.java
+31
-13
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RetrievalActionImpl.java
+29
-11
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/SaleActionImpl.java
+32
-23
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/SettlementActionImpl.java
+128
-1
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/TipsActionImpl.java
+24
-7
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/VoidActionImpl.java
+23
-7
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/util/PayMethodUtils.java
+3
-3
No files found.
component-main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/presenter/NewMainPresenter.java
View file @
8d5d9976
...
...
@@ -167,7 +167,7 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
.
build
();
mModel
.
addSettlementOperation
()
.
subscribeOn
(
Schedulers
.
io
())
.
doOnSubscribe
(
disposable
->
mRootView
.
showLoading
(
null
))
.
doOnSubscribe
(
disposable
->
mRootView
.
showLoading
(
"調起POS清機中..."
))
.
subscribeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doAfterTerminate
(()
->
mRootView
.
hideLoading
())
...
...
@@ -181,30 +181,28 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
PosPay
.
settlement
(
IActivity
,
IActivity
,
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
mRootView
.
showMessage
(
"
Success
"
);
mRootView
.
showMessage
(
"
清機成功!
"
);
updateSettlementOperation
(
restaurantId
,
GsonUtils
.
GsonString
(
response
),
1
);
}
@Override
public
void
onPosException
(
Exception
e
)
{
mRootView
.
showMessage
(
"Exception :"
+
e
.
getMessage
());
mRootView
.
showMessage
(
"
清機
Exception :"
+
e
.
getMessage
());
updateSettlementOperation
(
restaurantId
,
e
.
getMessage
(),
0
);
}
@Override
public
void
onPosInvalid
(
String
e
)
{
mRootView
.
showMessage
(
"Exception :"
+
e
);
mRootView
.
showMessage
(
e
);
updateSettlementOperation
(
restaurantId
,
e
,
2
);
}
@Override
public
void
onUpdateStatusSuccess
(
HywebPosResponse
response
)
{
}
@Override
public
void
onUpdateStatusError
(
Throwable
e
)
{
}
});
}
...
...
@@ -216,6 +214,7 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
mRootView
.
showMessage
(
"調起POS清機失敗: "
+
t
.
getMessage
());
}
});
}
...
...
@@ -238,18 +237,16 @@ public class NewMainPresenter extends BasePresenter<NewMainContract.Model, NewMa
@Override
public
void
onNext
(
@NonNull
BaseResult
info
)
{
if
(
info
!=
null
&&
info
.
isSuccess
())
{
if
(
info
.
getData
()
!=
null
)
{
mRootView
.
showMessage
(
"Update Settlement Success"
);
}
mRootView
.
showMessage
(
"更新清機狀態成功"
);
}
else
{
mRootView
.
showMessage
(
"
Update Settlement Failure
"
);
mRootView
.
showMessage
(
"
更新清機狀態無效
"
);
}
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
mRootView
.
showMessage
(
"
Update Settlement error"
);
mRootView
.
showMessage
(
"
更新清機狀態失敗: "
+
t
.
getMessage
()
);
}
});
}
...
...
component-pay/src/main/java/com/gingersoft/gsa/cloud/pay/mvp/ui/activity/PayResultActivity.java
View file @
8d5d9976
...
...
@@ -173,6 +173,7 @@ public class PayResultActivity extends BaseFragmentActivity<PayResultPresenter>
mMealPayResultParam
=
payResultParam
;
mSaleRespose
=
mMealPayResultParam
.
getSaleRespose
();
initMealPayResultParam
();
printPaymentStub
(
payResultParam
.
getTxnId
());
}
}
...
...
@@ -227,6 +228,7 @@ public class PayResultActivity extends BaseFragmentActivity<PayResultPresenter>
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
mSaleRespose
=
mMealPayResultParam
.
getSaleRespose
();
showPaymentStatus
();
printPaymentStub
(
response
.
getTXN_ID
());
}
@Override
...
...
@@ -271,6 +273,34 @@ public class PayResultActivity extends BaseFragmentActivity<PayResultPresenter>
return
sb
.
toString
();
}
/**
* 打印存根单
* @param txnId
*/
private
void
printPaymentStub
(
String
txnId
){
PosPay
.
printStub
(
mContext
,
this
,
txnId
,
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
}
@Override
public
void
onPosException
(
Exception
e
)
{
}
@Override
public
void
onPosInvalid
(
String
e
)
{
}
@Override
public
void
onUpdateStatusSuccess
(
HywebPosResponse
response
)
{
}
@Override
public
void
onUpdateStatusError
(
Throwable
e
)
{
}
});
}
@Override
public
void
initTopBar
()
{
topbar
.
setTitle
(
"支付結果"
);
...
...
@@ -387,15 +417,15 @@ public class PayResultActivity extends BaseFragmentActivity<PayResultPresenter>
@Override
public
void
onPosException
(
Exception
e
)
{
//POS回调异常,去重试查询
if
(
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
mMealPayResultParam
.
getTxnId
());
statusExceptionParam
.
setAmount
(
mSaleRespose
.
getTXN_AMT
());
statusExceptionParam
.
setOrderId
(
mMealPayResultParam
.
getMealOrderPayRequest
().
getOrderId
());
statusExceptionParam
.
setPayMethodName
(
mPayMehodNames
);
statusExceptionParam
.
setPosAction
(
PosAction
.
TIP
);
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
//
if (findFragment(PosActionStatusExceptionFragment.class) == null) {
//
PosActionStatusExceptionParam statusExceptionParam = new PosActionStatusExceptionParam();
//
statusExceptionParam.setTxnId(mMealPayResultParam.getTxnId());
//
statusExceptionParam.setAmount(mSaleRespose.getTXN_AMT());
//
statusExceptionParam.setOrderId(mMealPayResultParam.getMealOrderPayRequest().getOrderId());
//
statusExceptionParam.setPayMethodName(mPayMehodNames);
//
statusExceptionParam.setPosAction(PosAction.TIP);
//
loadRootFragment(R.id.rl_container, PosActionStatusExceptionFragment.newInstance(statusExceptionParam));
//
}
}
@Override
...
...
@@ -410,15 +440,15 @@ public class PayResultActivity extends BaseFragmentActivity<PayResultPresenter>
@Override
public
void
onUpdateStatusError
(
Throwable
e
)
{
if
(
findFragment
(
PosActionStatusExceptionFragment
.
class
)
==
null
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
mMealPayResultParam
.
getTxnId
());
statusExceptionParam
.
setAmount
(
mSaleRespose
.
getTXN_AMT
());
statusExceptionParam
.
setOrderId
(
mMealPayResultParam
.
getMealOrderPayRequest
().
getOrderId
());
statusExceptionParam
.
setPayMethodName
(
mPayMehodNames
);
statusExceptionParam
.
setPosAction
(
PosAction
.
TIP
);
loadRootFragment
(
R
.
id
.
rl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
//
if (findFragment(PosActionStatusExceptionFragment.class) == null) {
//
PosActionStatusExceptionParam statusExceptionParam = new PosActionStatusExceptionParam();
//
statusExceptionParam.setTxnId(mMealPayResultParam.getTxnId());
//
statusExceptionParam.setAmount(mSaleRespose.getTXN_AMT());
//
statusExceptionParam.setOrderId(mMealPayResultParam.getMealOrderPayRequest().getOrderId());
//
statusExceptionParam.setPayMethodName(mPayMehodNames);
//
statusExceptionParam.setPosAction(PosAction.TIP);
//
loadRootFragment(R.id.rl_container, PosActionStatusExceptionFragment.newInstance(statusExceptionParam));
//
}
}
});
}
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/action/order/PrintOrderAction.java
View file @
8d5d9976
...
...
@@ -96,45 +96,48 @@ public class PrintOrderAction implements Strategy<OrderManagerResponse> {
doshokuOrder
.
setBillMoney
(
payMethodList
);
}
if
(
orderDetailItem
.
withHywebPay
())
{
if
(
AppDevices
.
isHywebPos
())
{
PosPay
.
printStub
(
mActivity
,
mRootView
,
orderDetailItem
.
getPayTxnId
(),
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
printBill
(
doshokuOrder
,
dataBean
);
}
@Override
public
void
onPosException
(
Exception
e
)
{
}
@Override
public
void
onPosInvalid
(
String
e
)
{
if
(
orderDetailItem
.
withHywebPay
()
&&
AppDevices
.
isHywebPos
())
{
printPosStub
(
orderDetailItem
,
doshokuOrder
,
dataBean
);
}
else
{
printBill
(
orderDetailItem
,
doshokuOrder
,
dataBean
,
false
);
}
}
}
private
void
printPosStub
(
OrderManagerResponse
orderDetailItem
,
DoshokuOrder
doshokuOrder
,
TableBean
.
DataBean
dataBean
)
{
PosPay
.
printStub
(
mActivity
,
mRootView
,
orderDetailItem
.
getPayTxnId
(),
new
OnPosActionListener
()
{
@Override
public
void
onPosSuccess
(
HywebPosResponse
response
)
{
if
(
printlListener
!=
null
){
printlListener
.
printPosStubResult
(
true
);
}
printBill
(
orderDetailItem
,
doshokuOrder
,
dataBean
,
true
);
}
@Override
public
void
onUpdateStatusSuccess
(
HywebPosResponse
response
)
{
@Override
public
void
onPosException
(
Exception
e
)
{
if
(
printlListener
!=
null
){
printlListener
.
printPosStubResult
(
false
);
}
printBill
(
orderDetailItem
,
doshokuOrder
,
dataBean
,
true
);
}
}
@Override
public
void
onPosInvalid
(
String
e
)
{
printBill
(
orderDetailItem
,
doshokuOrder
,
dataBean
,
true
);
}
@Override
public
void
onUpdateStatusError
(
Throwable
e
)
{
@Override
public
void
onUpdateStatusSuccess
(
HywebPosResponse
response
)
{
}
}
});
}
else
{
printBill
(
doshokuOrder
,
dataBean
);
@Override
public
void
onUpdateStatusError
(
Throwable
e
)
{
}
}
else
{
printBill
(
doshokuOrder
,
dataBean
);
}
});
}
private
void
printBill
(
DoshokuOrder
doshokuOrder
,
TableBean
.
DataBean
dataBean
)
{
private
void
printBill
(
OrderManagerResponse
orderDetailItem
,
DoshokuOrder
doshokuOrder
,
TableBean
.
DataBean
dataBean
,
boolean
printStub
)
{
PrintContent
printContent
=
new
PrintContentAdapter
().
adaptationBillContent
(
doshokuOrder
,
dataBean
);
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_PRINT
)
.
setActionName
(
"printActivity"
)
.
addParam
(
PrintConstans
.
PRINT_TYPE
,
PrintConstans
.
PRINT_BILL
)
...
...
@@ -142,11 +145,13 @@ public class PrintOrderAction implements Strategy<OrderManagerResponse> {
.
build
()
.
callAsyncCallbackOnMainThread
((
cc
,
result
)
->
{
Log
.
e
(
"error"
,
"是否成功打印:"
+
result
.
isSuccess
());
if
(
printStub
)
{
printPosStub
(
orderDetailItem
,
doshokuOrder
,
dataBean
);
}
doshokuOrder
.
initialization
();
});
}
private
ArrayList
<
BillItem
>
getOrderMoneyList
(
OrderManagerResponse
orderDetailItem
,
double
totalMoney
)
{
List
<
SectionTextItem3
>
printOrderMoneyList
=
new
ArrayList
<>();
ArrayList
<
BillItem
>
printBillOrderMoneyList
=
new
ArrayList
<>();
...
...
@@ -267,4 +272,12 @@ public class PrintOrderAction implements Strategy<OrderManagerResponse> {
}
return
payMethodList
;
}
private
PrintOrderAction
.
OnPrintlListener
printlListener
;
public
void
setPrintlListener
(
OnPrintlListener
printlListener
)
{
this
.
printlListener
=
printlListener
;
}
public
interface
OnPrintlListener
{
void
printPosStubResult
(
boolean
success
);
}
}
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/contract/OrderDetailContract.java
View file @
8d5d9976
...
...
@@ -23,6 +23,16 @@ public interface OrderDetailContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface
View
extends
IView
{
void
setWithSettlementLayoutVisible
();
void
setCurrPosDeviceLayoutVisible
();
void
setNotCurrPosDeviceLayoutVisible
();
void
setNomalDeviceLayoutVisible
();
void
setPublicLayoutVisible
();
void
returnOrderDetail
(
OrderManagerResponse
orderDetailItem
);
}
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/bean/response/OrderManagerResponse.java
View file @
8d5d9976
...
...
@@ -6,6 +6,8 @@ import androidx.annotation.Nullable;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.common.oaId.DeviceID
;
import
com.gingersoft.gsa.cloud.common.utils.AppDevices
;
import
com.gingersoft.gsa.cloud.order.bean.response.OrderDiscountResponse
;
import
com.gingersoft.gsa.cloud.order.bean.response.OrderResponse
;
import
com.gingersoft.gsa.cloud.pay.bean.PayMethod
;
...
...
@@ -127,21 +129,28 @@ public class OrderManagerResponse implements Serializable {
*/
private
OrderPayResponse
integralInfo
;
/******************** N5相關**************************/
/**
* N5
相關,以下哪個參數不為Null說明為當前支付狀態
* N5
支付TXN_ID
*/
private
String
payTxnId
;
/**
* N5 支付TXN_ID
* 事項狀態 0:異常未處理,1: 成功
* 以下哪個參數不為Null說明有事项未消费,需要重试上传
*/
private
String
payTxnId
;
private
int
matterStatus
=
MATTER_STATUS_SUCCESS
;
/**
*
N5取消支付TXN_
ID
*
取消事项
ID
*/
private
String
cancelTxnId
;
/**
*
N5退款Refund_Id
*
退款事项ID
*/
private
String
refundTxnId
;
/**
* 补小费事项ID
*/
private
String
tipTxnId
;
/**
* 清機ID,已清機則不為null
...
...
@@ -149,10 +158,6 @@ public class OrderManagerResponse implements Serializable {
private
Integer
restaurantOperationId
;
/**
* 事項狀態 0:異常未處理,1: 成功
*/
private
int
matterStatus
=
1
;
/**
* 設備ID,用來區分每台N5設備支付的訂單
*/
private
String
deviceId
;
...
...
@@ -176,16 +181,15 @@ public class OrderManagerResponse implements Serializable {
public
static
final
byte
ORDER_TYPE_SELFCOLLECTION
=
7
;
/**
* 事項狀態 0:異常未處理,1: 成功
*/
public
static
final
byte
MATTER_STATUS_SUCCESS
=
1
;
public
static
final
byte
MATTER_STATUS_EXCEPTION
=
0
;
/**
* 是否選中
*/
private
boolean
checked
=
false
;
public
boolean
withHywebPay
()
{
if
(!
TextUtils
.
isEmpty
(
payTxnId
)
||
!
TextUtils
.
isEmpty
(
cancelTxnId
)
||
!
TextUtils
.
isEmpty
(
refundTxnId
))
{
return
true
;
}
return
false
;
}
@Data
public
static
final
class
OrderPayBean
implements
Serializable
{
...
...
@@ -222,4 +226,68 @@ public class OrderManagerResponse implements Serializable {
return
""
;
}
}
public
boolean
withHywebPay
()
{
if
(!
TextUtils
.
isEmpty
(
payTxnId
)
||
!
TextUtils
.
isEmpty
(
cancelTxnId
)
||
!
TextUtils
.
isEmpty
(
refundTxnId
))
{
return
true
;
}
return
false
;
}
/**
* 支付方式名稱拼接,已逗號分開
* @return
*/
public
String
getPayNames
(){
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
orderPays
.
size
();
i
++)
{
OrderPayBean
orderPayBean
=
orderPays
.
get
(
i
);
sb
.
append
(
orderPayBean
.
getPayName
());
if
(
orderPays
.
size
()
>
1
&&
i
!=
(
orderPays
.
size
()
-
1
)){
sb
.
append
(
","
);
}
}
return
sb
.
toString
();
}
public
String
getExceptionReloadText
()
{
if
(!
TextUtils
.
isEmpty
(
tipTxnId
)){
return
"貼士狀態異常,輕觸重試"
;
}
if
(!
TextUtils
.
isEmpty
(
cancelTxnId
)){
return
"取消狀態異常,輕觸重試"
;
}
if
(!
TextUtils
.
isEmpty
(
refundTxnId
)){
return
"退款狀態異常,輕觸重試"
;
}
return
""
;
}
public
String
getMatterTxnId
()
{
if
(!
TextUtils
.
isEmpty
(
tipTxnId
)){
return
tipTxnId
;
}
if
(!
TextUtils
.
isEmpty
(
cancelTxnId
)){
return
cancelTxnId
;
}
if
(!
TextUtils
.
isEmpty
(
refundTxnId
)){
return
refundTxnId
;
}
return
""
;
}
/**
* 是不是當前設備的訂單
* @return
*/
public
boolean
isCurrDeviceOrder
(){
if
(!
AppDevices
.
isHywebPos
()
||
!
AppDevices
.
isBBPos
()){
return
true
;
}
if
(
TextUtils
.
isEmpty
(
deviceId
)
&&
deviceId
.
equals
(
DeviceID
.
getDeviceId
())){
return
true
;
}
return
false
;
}
}
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/MealStandPresenter.java
View file @
8d5d9976
...
...
@@ -214,6 +214,9 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if
(
foodGroupList
!=
null
&&
foodGroupList
.
size
()
>
0
)
{
// for (Food foodGroup: foodGroupList) {
// foodGroup.setColorBean(foodGroup.getColorBean());
// }
mFoodGroupList
.
addAll
(
foodGroupList
);
Food
defalutFoodGroup
=
getDefalutFoodGroup
(
mFoodGroupList
);
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/orderManager/AllOrderPresenter.java
View file @
8d5d9976
...
...
@@ -145,6 +145,18 @@ public class AllOrderPresenter extends BasePresenter<AllOrderContract.Model, All
@Override
public
void
onTipsClick
(
OrderManagerResponse
datasBean
,
int
position
)
{
}
@Override
public
void
onReloadExceptionStatus
(
OrderManagerResponse
orderBean
,
String
txnId
)
{
PosActionStatusExceptionParam
statusExceptionParam
=
new
PosActionStatusExceptionParam
();
statusExceptionParam
.
setTxnId
(
txnId
);
statusExceptionParam
.
setAmount
(
orderBean
.
getTotalAmount
());
statusExceptionParam
.
setOrderId
(
orderBean
.
getId
());
statusExceptionParam
.
setOrderNo
(
orderBean
.
getOrderNo
());
statusExceptionParam
.
setPayMethodName
(
orderBean
.
getPayNames
());
statusExceptionParam
.
setPosAction
(
PosAction
.
RETRIEVAL
);
IActivity
.
loadRootFragment
(
R
.
id
.
fl_container
,
PosActionStatusExceptionFragment
.
newInstance
(
statusExceptionParam
));
}
});
}
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderPayActivity.java
View file @
8d5d9976
...
...
@@ -40,6 +40,7 @@ import com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener;
import
com.gingersoft.gsa.cloud.pay.pos.PosPay
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.SaleRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SaleRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.HywebActionStatusCode
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.PayMethodConstant
;
...
...
@@ -50,6 +51,7 @@ import com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter;
import
com.gingersoft.gsa.cloud.table.R
;
import
com.gingersoft.gsa.cloud.table.R2
;
import
com.gingersoft.gsa.cloud.table.di.component.DaggerOrderPayComponent
;
import
com.gingersoft.gsa.cloud.table.mvp.action.order.PrintOrderAction
;
import
com.gingersoft.gsa.cloud.table.mvp.contract.OrderPayContract
;
import
com.gingersoft.gsa.cloud.table.mvp.model.bean.event.InitTableEvent
;
import
com.gingersoft.gsa.cloud.table.mvp.presenter.OrderPayPresenter
;
...
...
@@ -535,9 +537,15 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
if
(
hywebPayMethod
.
getPayType
()
==
PayTypeContract
.
PAY_METHOD_ID_1030
)
{
//卡片支付
saleRequest
.
setPAYMENT_APP_ID
(
PayMethodConstant
.
PAY_TYPE_CC
);
}
else
{
}
else
if
(
hywebPayMethod
.
getPayType
()
==
PayTypeContract
.
PAY_METHOD_ID_1031
)
{
//掃碼支付
saleRequest
.
setPAYMENT_APP_ID
(
PayMethodConstant
.
PAY_TYPE_QRC
);
}
else
if
(
hywebPayMethod
.
getPayType
()
==
PayTypeContract
.
PAY_METHOD_ID_1032
){
//八達通支付
saleRequest
.
setPAYMENT_APP_ID
(
PayMethodConstant
.
PAY_TYPE_OPS
);
}
else
if
(
hywebPayMethod
.
getPayType
()
==
PayTypeContract
.
PAY_METHOD_ID_1033
){
//美国运通
saleRequest
.
setPAYMENT_APP_ID
(
PayMethodConstant
.
PAY_TYPE_AE
);
}
saleRequest
.
setTXN_AMT
(
DoshokuOrder
.
getInstance
().
getShoppingCart
().
getTotalAmount
());
saleRequest
.
setTIPS
(
0
);
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderCenterActivity.java
View file @
8d5d9976
...
...
@@ -15,6 +15,7 @@ import androidx.fragment.app.Fragment;
import
androidx.viewpager.widget.ViewPager
;
import
com.gingersoft.gsa.cloud.order.contract.OrderStatusContract
;
import
com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment
;
import
com.gingersoft.gsa.cloud.table.R
;
import
com.gingersoft.gsa.cloud.table.R2
;
import
com.gingersoft.gsa.cloud.table.di.component.DaggerOrderCenterComponent
;
...
...
@@ -115,16 +116,16 @@ public class OrderCenterActivity extends BaseFragmentActivity<OrderCenterPresent
mPresenter
.
loadOrderList
(
OrderManagerResponse
.
ORDER_TYPE_DOSHOKU
+
""
,
getStatusByFragmentIndex
(),
0
,
10
,
null
,
false
);
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
}
@Subscriber
(
tag
=
"updateOrderListEvent"
)
private
void
updateOrderList
(
boolean
update
)
{
refeshOrderList
(
getStatusByFragmentIndex
());
}
@Subscriber
(
tag
=
PosActionStatusExceptionFragment
.
REFREAFSH_ORDER_EVENT
)
private
void
refreafshOrder
(
boolean
refreafsh
){
refeshOrderList
(
getStatusByFragmentIndex
());
}
public
void
refeshOrderList
(
String
status
)
{
setPageIndex
(
0
);
mPresenter
.
loadOrderList
(
OrderManagerResponse
.
ORDER_TYPE_DOSHOKU
+
""
,
status
,
0
,
10
,
null
,
false
);
...
...
@@ -140,7 +141,7 @@ public class OrderCenterActivity extends BaseFragmentActivity<OrderCenterPresent
@OnClick
({
R2
.
id
.
btn_print_order
,
R2
.
id
.
btn_modify_order
,
R2
.
id
.
btn_tips
,
R2
.
id
.
btn_cancel_order
,
R2
.
id
.
btn_refund
})
public
void
OnClick
(
View
v
){
OrderManagerResponse
orderItem
=
getCurrentOrderFragment
().
getSelectedOrderItem
();
OrderManagerResponse
orderItem
=
getCurrentOrderFragment
().
getSelectedOrderItem
();
if
(
orderItem
!=
null
){
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
btn_print_order
){
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderDetailActivity.java
View file @
8d5d9976
This diff is collapsed.
Click to expand it.
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/adapter/OrderCenterAdapter.java
View file @
8d5d9976
This diff is collapsed.
Click to expand it.
component-table/src/main/res/layout/activity_order_center.xml
View file @
8d5d9976
...
...
@@ -112,4 +112,8 @@
android:visibility=
"gone"
/>
</LinearLayout>
<FrameLayout
android:id=
"@+id/fl_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
component-table/src/main/res/layout/activity_order_detail.xml
View file @
8d5d9976
...
...
@@ -5,6 +5,12 @@
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
>
<com.qmuiteam.qmui.widget.QMUITopBar
android:id=
"@+id/topbar"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/qmui_topbar_height"
android:fitsSystemWindows=
"true"
/>
<LinearLayout
android:id=
"@+id/ll_bottom"
android:layout_width=
"match_parent"
...
...
@@ -267,14 +273,22 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.qmuiteam.qmui.widget.QMUITopBar
android:id=
"@+id/topbar"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/qmui_topbar_height"
android:fitsSystemWindows=
"true"
/>
<FrameLayout
android:id=
"@+id/rl_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_rect_radius_transparent_5"
android:visibility=
"gone"
>
<TextView
android:id=
"@+id/tv_reload_exception_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:drawableTop=
"@mipmap/meal_order_exception"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_16"
android:text=
"取消狀態異常,輕觸重試"
android:visibility=
"gone"
/>
</FrameLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
component-table/src/main/res/layout/item_order_center.xml
View file @
8d5d9976
<?xml version="1.0" encoding="utf-8"?>
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/
l
l_root_container"
android:id=
"@+id/
r
l_root_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_8"
...
...
@@ -12,6 +12,7 @@
android:padding=
"@dimen/dp_8"
>
<LinearLayout
android:id=
"@+id/ll_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/dp_5"
...
...
@@ -48,12 +49,19 @@
android:textSize=
"@dimen/sp_18"
/>
</LinearLayout>
<include
layout=
"@layout/include_horizontal_color_ccc_dividing_line"
/>
<View
android:id=
"@+id/horizontal_dividing_line"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_0_5"
android:background=
"@color/color_ccc"
android:layout_below=
"@+id/ll_content"
/>
<LinearLayout
android:id=
"@+id/ll_content2"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_5"
android:layout_below=
"@+id/horizontal_dividing_line"
android:orientation=
"horizontal"
>
<TextView
...
...
@@ -82,6 +90,7 @@
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_3"
android:layout_marginBottom=
"@dimen/dp_6"
android:layout_below=
"@+id/ll_content2"
android:orientation=
"horizontal"
>
<TextView
...
...
@@ -118,85 +127,98 @@
android:textStyle=
"bold"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_5"
android:gravity=
"right|center_vertical"
android:visibility=
"gone"
android:orientation=
"horizontal"
>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_print_order"
android:layout_width=
"@dimen/dp_65"
android:layout_height=
"@dimen/dp_35"
android:background=
"@color/orange_400"
android:text=
"打印訂單"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_13"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_modify_order"
android:layout_width=
"@dimen/dp_65"
android:layout_height=
"@dimen/dp_35"
android:background=
"@color/blue_300"
android:layout_marginLeft=
"@dimen/dp_10"
android:text=
"修改訂單"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_13"
android:visibility=
"visible"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_order_status"
android:layout_width=
"@dimen/dp_65"
android:layout_height=
"@dimen/dp_35"
android:layout_marginLeft=
"@dimen/dp_10"
android:background=
"@color/gray"
android:clickable=
"false"
android:text=
"已取消"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_13"
android:visibility=
"gone"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_cancel_order"
android:layout_width=
"@dimen/dp_65"
android:layout_height=
"@dimen/dp_35"
android:background=
"@color/red_400"
android:layout_marginLeft=
"@dimen/dp_10"
android:text=
"取消訂單"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_13"
android:visibility=
"visible"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_pos_bottom"
android:layout_width=
"match_parent"
<TextView
android:id=
"@+id/tv_reload_exception_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:gravity=
"right|center_vertical"
android:orientation=
"horizontal"
android:visibility=
"gone"
>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_refund"
android:layout_width=
"@dimen/dp_65"
android:layout_height=
"@dimen/dp_35"
android:background=
"@color/red_500"
android:text=
"退款"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_13"
/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id=
"@+id/btn_tips"
android:layout_width=
"@dimen/dp_65"
android:layout_height=
"@dimen/dp_35"
android:layout_marginLeft=
"@dimen/dp_10"
android:background=
"@color/green_400"
android:text=
"貼士"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_13"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
android:layout_centerInParent=
"true"
android:drawableTop=
"@mipmap/meal_order_exception"
android:textColor=
"@color/theme_white_color"
android:textSize=
"@dimen/sp_16"
android:text=
"取消狀態異常,輕觸重試"
android:visibility=
"gone"
/>
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_bottom"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_5"-->
<!-- android:gravity="right|center_vertical"-->
<!-- android:visibility="gone"-->
<!-- android:orientation="horizontal">-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_print_order"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_35"-->
<!-- android:background="@color/orange_400"-->
<!-- android:text="打印訂單"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_13" />-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_modify_order"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_35"-->
<!-- android:background="@color/blue_300"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:text="修改訂單"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_13"-->
<!-- android:visibility="visible" />-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_order_status"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_35"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:background="@color/gray"-->
<!-- android:clickable="false"-->
<!-- android:text="已取消"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_13"-->
<!-- android:visibility="gone" />-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_cancel_order"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_35"-->
<!-- android:background="@color/red_400"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:text="取消訂單"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_13"-->
<!-- android:visibility="visible" />-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_pos_bottom"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_10"-->
<!-- android:gravity="right|center_vertical"-->
<!-- android:orientation="horizontal"-->
<!-- android:visibility="visible">-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_refund"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_35"-->
<!-- android:background="@color/red_500"-->
<!-- android:text="退款"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_13" />-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_tips"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_35"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:background="@color/green_400"-->
<!-- android:text="貼士"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_13" />-->
<!-- </LinearLayout>-->
</RelativeLayout>
\ No newline at end of file
component-table/src/main/res/mipmap-hdpi/meal_order_exception.png
0 → 100644
View file @
8d5d9976
1.23 KB
library-common/src/main/res/drawable/shape_rect_radius_transparent_5.xml
0 → 100644
View file @
8d5d9976
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/transparent"
/>
<corners
android:radius=
"@dimen/normal_space5"
/>
</shape>
\ No newline at end of file
library-database/src/main/java/com/gingersoft/gsa/cloud/database/bean/ColorBean.java
View file @
8d5d9976
...
...
@@ -22,7 +22,7 @@ public class ColorBean {
* createTime : Dec 12, 2018 6:03:58 PM
* editTime : Dec 12, 2018 6:03:58 PM
*/
@Property
(
nameInDb
=
"_id"
)
//
@Property(nameInDb = "_id")
@Id
(
autoincrement
=
true
)
private
Long
colorId
;
private
String
colorStart
;
...
...
library-database/src/main/java/com/gingersoft/gsa/cloud/database/bean/Food.java
View file @
8d5d9976
...
...
@@ -12,6 +12,7 @@ import org.greenrobot.greendao.DaoException;
import
com.gingersoft.gsa.cloud.database.greendao.DaoSession
;
import
com.gingersoft.gsa.cloud.database.greendao.ColorBeanDao
;
import
com.gingersoft.gsa.cloud.database.greendao.FoodDao
;
import
org.greenrobot.greendao.annotation.NotNull
;
/**
* 作者:ELEGANT_BIN
...
...
@@ -291,10 +292,9 @@ public class Food {
/**
* 顏色ID
*/
private
Long
colorId
;
@ToOne
(
joinProperty
=
"colorId"
)
//这个是注解绑定 hid就是上面一行的colorId
private
ColorBean
colorBean
;
private
long
colorId
;
// @ToOne(joinProperty = "colorId") //这个是注解绑定 hid就是上面一行的colorId
// private ColorBean colorBean;
/**
* 自定義字段
...
...
@@ -309,14 +309,6 @@ public class Food {
/**背景顏色*/
@Transient
private
int
bgColor
=
Color
.
parseColor
(
"#03a9f4"
);
@Transient
private
String
colorStart
;
@Transient
private
String
colorStop
;
@Transient
private
String
androidColor
;
@Transient
private
String
androidFontColor
;
/**字體顏色*/
@Transient
private
int
fontColor
=
Color
.
parseColor
(
"#FFFFFF"
);
...
...
@@ -332,40 +324,20 @@ public class Food {
/**是否组合食品*/
@Transient
private
boolean
isComboFood
=
false
;
/** Used to resolve relations */
@Generated
(
hash
=
2040040024
)
private
transient
DaoSession
daoSession
;
/** Used for active entity operations. */
@Generated
(
hash
=
1296197325
)
private
transient
FoodDao
myDao
;
@Generated
(
hash
=
763243435
)
public
Food
(
Long
id
,
long
parentId
,
long
restaurantId
,
byte
isParent
,
long
seqNo
,
String
foodName
,
String
foodName1
,
String
foodName2
,
String
plu
,
String
posFid
,
String
foodDesc
,
long
limitAmount
,
long
limitType
,
String
foodSummary
,
long
invisible
,
byte
autoMod
,
double
price
,
double
marketPrice
,
double
lunchboxPrice
,
String
imgUrlSmall
,
String
imageurl
,
long
riceponInvisible
,
double
cost
,
long
like
,
long
totalSold
,
long
isSold
,
Date
startDate
,
Date
endDate
,
String
createBy
,
Date
createTime
,
String
updateBy
,
Date
updateTime
,
long
periodId
,
long
ableDiscount
,
long
takeaway
,
long
blueEdit
,
long
cartEdit
,
long
autoMerge
,
String
printSeting
,
long
isPrintQueueCode
,
long
queueHeadId
,
long
approve
,
long
printFont
,
long
advPrice
,
long
printToBill
,
double
pointsAdd
,
long
pointsRatio
,
double
pointsRedeem
,
long
ktPrintMainItem
,
long
ktShowPrice
,
long
printTo
,
long
toPax
,
long
foodType
,
long
majorMainId
,
long
deptId
,
byte
serviceCharge
,
long
conditions
,
long
isRt
,
long
deletes
,
long
isTimingFood
,
long
minLongTime
,
long
unitTime
,
double
unitPrice
,
long
freeLongTime
,
Date
freePeriodBegin
,
long
isStatistic
,
Long
colorId
)
{
@Generated
(
hash
=
60268763
)
public
Food
(
Long
id
,
long
parentId
,
long
restaurantId
,
byte
isParent
,
long
seqNo
,
String
foodName
,
String
foodName1
,
String
foodName2
,
String
plu
,
String
posFid
,
String
foodDesc
,
long
limitAmount
,
long
limitType
,
String
foodSummary
,
long
invisible
,
byte
autoMod
,
double
price
,
double
marketPrice
,
double
lunchboxPrice
,
String
imgUrlSmall
,
String
imageurl
,
long
riceponInvisible
,
double
cost
,
long
like
,
long
totalSold
,
long
isSold
,
Date
startDate
,
Date
endDate
,
String
createBy
,
Date
createTime
,
String
updateBy
,
Date
updateTime
,
long
periodId
,
long
ableDiscount
,
long
takeaway
,
long
blueEdit
,
long
cartEdit
,
long
autoMerge
,
String
printSeting
,
long
isPrintQueueCode
,
long
queueHeadId
,
long
approve
,
long
printFont
,
long
advPrice
,
long
printToBill
,
double
pointsAdd
,
long
pointsRatio
,
double
pointsRedeem
,
long
ktPrintMainItem
,
long
ktShowPrice
,
long
printTo
,
long
toPax
,
long
foodType
,
long
majorMainId
,
long
deptId
,
byte
serviceCharge
,
long
conditions
,
long
isRt
,
long
deletes
,
long
isTimingFood
,
long
minLongTime
,
long
unitTime
,
double
unitPrice
,
long
freeLongTime
,
Date
freePeriodBegin
,
long
isStatistic
,
long
colorId
)
{
this
.
id
=
id
;
this
.
parentId
=
parentId
;
this
.
restaurantId
=
restaurantId
;
...
...
@@ -439,17 +411,6 @@ public class Food {
public
Food
()
{
}
@Generated
(
hash
=
292980300
)
private
transient
Long
colorBean__resolvedKey
;
public
Long
getId
()
{
return
id
;
}
...
...
@@ -1250,77 +1211,4 @@ public class Food {
this
.
isStatistic
=
isStatistic
;
}
/** To-one relationship, resolved on first access. */
@Generated
(
hash
=
247966240
)
public
ColorBean
getColorBean
()
{
Long
__key
=
this
.
colorId
;
if
(
colorBean__resolvedKey
==
null
||
!
colorBean__resolvedKey
.
equals
(
__key
))
{
final
DaoSession
daoSession
=
this
.
daoSession
;
if
(
daoSession
==
null
)
{
throw
new
DaoException
(
"Entity is detached from DAO context"
);
}
ColorBeanDao
targetDao
=
daoSession
.
getColorBeanDao
();
ColorBean
colorBeanNew
=
targetDao
.
load
(
__key
);
synchronized
(
this
)
{
colorBean
=
colorBeanNew
;
colorBean__resolvedKey
=
__key
;
}
}
return
colorBean
;
}
/** called by internal mechanisms, do not call yourself. */
@Generated
(
hash
=
1466636219
)
public
void
setColorBean
(
ColorBean
colorBean
)
{
synchronized
(
this
)
{
this
.
colorBean
=
colorBean
;
colorId
=
colorBean
==
null
?
null
:
colorBean
.
getColorId
();
colorBean__resolvedKey
=
colorId
;
}
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
* Entity must attached to an entity context.
*/
@Generated
(
hash
=
128553479
)
public
void
delete
()
{
if
(
myDao
==
null
)
{
throw
new
DaoException
(
"Entity is detached from DAO context"
);
}
myDao
.
delete
(
this
);
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
* Entity must attached to an entity context.
*/
@Generated
(
hash
=
1942392019
)
public
void
refresh
()
{
if
(
myDao
==
null
)
{
throw
new
DaoException
(
"Entity is detached from DAO context"
);
}
myDao
.
refresh
(
this
);
}
/**
* Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
* Entity must attached to an entity context.
*/
@Generated
(
hash
=
713229351
)
public
void
update
()
{
if
(
myDao
==
null
)
{
throw
new
DaoException
(
"Entity is detached from DAO context"
);
}
myDao
.
update
(
this
);
}
/** called by internal mechanisms, do not call yourself. */
@Generated
(
hash
=
505459956
)
public
void
__setDaoSession
(
DaoSession
daoSession
)
{
this
.
daoSession
=
daoSession
;
myDao
=
daoSession
!=
null
?
daoSession
.
getFoodDao
()
:
null
;
}
}
library-database/src/main/java/com/gingersoft/gsa/cloud/database/greendao/FoodDao.java
View file @
8d5d9976
package
com
.
gingersoft
.
gsa
.
cloud
.
database
.
greendao
;
import
java.util.List
;
import
java.util.ArrayList
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteStatement
;
import
org.greenrobot.greendao.AbstractDao
;
import
org.greenrobot.greendao.Property
;
import
org.greenrobot.greendao.internal.SqlUtils
;
import
org.greenrobot.greendao.internal.DaoConfig
;
import
org.greenrobot.greendao.database.Database
;
import
org.greenrobot.greendao.database.DatabaseStatement
;
import
com.gingersoft.gsa.cloud.database.bean.ColorBean
;
import
com.gingersoft.gsa.cloud.database.bean.Food
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
...
...
@@ -95,11 +90,9 @@ public class FoodDao extends AbstractDao<Food, Long> {
public
final
static
Property
FreeLongTime
=
new
Property
(
63
,
long
.
class
,
"freeLongTime"
,
false
,
"FREE_LONG_TIME"
);
public
final
static
Property
FreePeriodBegin
=
new
Property
(
64
,
java
.
util
.
Date
.
class
,
"freePeriodBegin"
,
false
,
"FREE_PERIOD_BEGIN"
);
public
final
static
Property
IsStatistic
=
new
Property
(
65
,
long
.
class
,
"isStatistic"
,
false
,
"IS_STATISTIC"
);
public
final
static
Property
ColorId
=
new
Property
(
66
,
L
ong
.
class
,
"colorId"
,
false
,
"COLOR_ID"
);
public
final
static
Property
ColorId
=
new
Property
(
66
,
l
ong
.
class
,
"colorId"
,
false
,
"COLOR_ID"
);
}
private
DaoSession
daoSession
;
public
FoodDao
(
DaoConfig
config
)
{
super
(
config
);
...
...
@@ -107,7 +100,6 @@ public class FoodDao extends AbstractDao<Food, Long> {
public
FoodDao
(
DaoConfig
config
,
DaoSession
daoSession
)
{
super
(
config
,
daoSession
);
this
.
daoSession
=
daoSession
;
}
/** Creates the underlying database table. */
...
...
@@ -180,7 +172,7 @@ public class FoodDao extends AbstractDao<Food, Long> {
"\"FREE_LONG_TIME\" INTEGER NOT NULL ,"
+
// 63: freeLongTime
"\"FREE_PERIOD_BEGIN\" INTEGER,"
+
// 64: freePeriodBegin
"\"IS_STATISTIC\" INTEGER NOT NULL ,"
+
// 65: isStatistic
"\"COLOR_ID\" INTEGER);"
);
// 66: colorId
"\"COLOR_ID\" INTEGER
NOT NULL
);"
);
// 66: colorId
}
/** Drops the underlying database table. */
...
...
@@ -330,11 +322,7 @@ public class FoodDao extends AbstractDao<Food, Long> {
stmt
.
bindLong
(
65
,
freePeriodBegin
.
getTime
());
}
stmt
.
bindLong
(
66
,
entity
.
getIsStatistic
());
Long
colorId
=
entity
.
getColorId
();
if
(
colorId
!=
null
)
{
stmt
.
bindLong
(
67
,
colorId
);
}
stmt
.
bindLong
(
67
,
entity
.
getColorId
());
}
@Override
...
...
@@ -478,17 +466,7 @@ public class FoodDao extends AbstractDao<Food, Long> {
stmt
.
bindLong
(
65
,
freePeriodBegin
.
getTime
());
}
stmt
.
bindLong
(
66
,
entity
.
getIsStatistic
());
Long
colorId
=
entity
.
getColorId
();
if
(
colorId
!=
null
)
{
stmt
.
bindLong
(
67
,
colorId
);
}
}
@Override
protected
final
void
attachEntity
(
Food
entity
)
{
super
.
attachEntity
(
entity
);
entity
.
__setDaoSession
(
daoSession
);
stmt
.
bindLong
(
67
,
entity
.
getColorId
());
}
@Override
...
...
@@ -565,7 +543,7 @@ public class FoodDao extends AbstractDao<Food, Long> {
cursor
.
getLong
(
offset
+
63
),
// freeLongTime
cursor
.
isNull
(
offset
+
64
)
?
null
:
new
java
.
util
.
Date
(
cursor
.
getLong
(
offset
+
64
)),
// freePeriodBegin
cursor
.
getLong
(
offset
+
65
),
// isStatistic
cursor
.
isNull
(
offset
+
66
)
?
null
:
cursor
.
getLong
(
offset
+
66
)
// colorId
cursor
.
getLong
(
offset
+
66
)
// colorId
);
return
entity
;
}
...
...
@@ -638,7 +616,7 @@ public class FoodDao extends AbstractDao<Food, Long> {
entity
.
setFreeLongTime
(
cursor
.
getLong
(
offset
+
63
));
entity
.
setFreePeriodBegin
(
cursor
.
isNull
(
offset
+
64
)
?
null
:
new
java
.
util
.
Date
(
cursor
.
getLong
(
offset
+
64
)));
entity
.
setIsStatistic
(
cursor
.
getLong
(
offset
+
65
));
entity
.
setColorId
(
cursor
.
isNull
(
offset
+
66
)
?
null
:
cursor
.
getLong
(
offset
+
66
));
entity
.
setColorId
(
cursor
.
getLong
(
offset
+
66
));
}
@Override
...
...
@@ -666,95 +644,4 @@ public class FoodDao extends AbstractDao<Food, Long> {
return
true
;
}
private
String
selectDeep
;
protected
String
getSelectDeep
()
{
if
(
selectDeep
==
null
)
{
StringBuilder
builder
=
new
StringBuilder
(
"SELECT "
);
SqlUtils
.
appendColumns
(
builder
,
"T"
,
getAllColumns
());
builder
.
append
(
','
);
SqlUtils
.
appendColumns
(
builder
,
"T0"
,
daoSession
.
getColorBeanDao
().
getAllColumns
());
builder
.
append
(
" FROM FOOD T"
);
builder
.
append
(
" LEFT JOIN COLOR_BEAN T0 ON T.\"COLOR_ID\"=T0.\"_id\""
);
builder
.
append
(
' '
);
selectDeep
=
builder
.
toString
();
}
return
selectDeep
;
}
protected
Food
loadCurrentDeep
(
Cursor
cursor
,
boolean
lock
)
{
Food
entity
=
loadCurrent
(
cursor
,
0
,
lock
);
int
offset
=
getAllColumns
().
length
;
ColorBean
colorBean
=
loadCurrentOther
(
daoSession
.
getColorBeanDao
(),
cursor
,
offset
);
entity
.
setColorBean
(
colorBean
);
return
entity
;
}
public
Food
loadDeep
(
Long
key
)
{
assertSinglePk
();
if
(
key
==
null
)
{
return
null
;
}
StringBuilder
builder
=
new
StringBuilder
(
getSelectDeep
());
builder
.
append
(
"WHERE "
);
SqlUtils
.
appendColumnsEqValue
(
builder
,
"T"
,
getPkColumns
());
String
sql
=
builder
.
toString
();
String
[]
keyArray
=
new
String
[]
{
key
.
toString
()
};
Cursor
cursor
=
db
.
rawQuery
(
sql
,
keyArray
);
try
{
boolean
available
=
cursor
.
moveToFirst
();
if
(!
available
)
{
return
null
;
}
else
if
(!
cursor
.
isLast
())
{
throw
new
IllegalStateException
(
"Expected unique result, but count was "
+
cursor
.
getCount
());
}
return
loadCurrentDeep
(
cursor
,
true
);
}
finally
{
cursor
.
close
();
}
}
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
public
List
<
Food
>
loadAllDeepFromCursor
(
Cursor
cursor
)
{
int
count
=
cursor
.
getCount
();
List
<
Food
>
list
=
new
ArrayList
<
Food
>(
count
);
if
(
cursor
.
moveToFirst
())
{
if
(
identityScope
!=
null
)
{
identityScope
.
lock
();
identityScope
.
reserveRoom
(
count
);
}
try
{
do
{
list
.
add
(
loadCurrentDeep
(
cursor
,
false
));
}
while
(
cursor
.
moveToNext
());
}
finally
{
if
(
identityScope
!=
null
)
{
identityScope
.
unlock
();
}
}
}
return
list
;
}
protected
List
<
Food
>
loadDeepAllAndCloseCursor
(
Cursor
cursor
)
{
try
{
return
loadAllDeepFromCursor
(
cursor
);
}
finally
{
cursor
.
close
();
}
}
/** A raw-style query where you can pass any WHERE clause and arguments. */
public
List
<
Food
>
queryDeep
(
String
where
,
String
...
selectionArg
)
{
Cursor
cursor
=
db
.
rawQuery
(
getSelectDeep
()
+
where
,
selectionArg
);
return
loadDeepAllAndCloseCursor
(
cursor
);
}
}
library-database/src/main/java/com/gingersoft/gsa/cloud/database/utils/ComboItemDaoUtils.java
View file @
8d5d9976
...
...
@@ -170,7 +170,7 @@ public class ComboItemDaoUtils {
// }
if
(
fid
>
0
)
{
sql
=
sql
+
" where r.FID='"
+
fid
+
"' order by c.SEQ_NO
de
sc"
;
sql
=
sql
+
" where r.FID='"
+
fid
+
"' order by c.SEQ_NO
a
sc"
;
}
Cursor
c
=
mManager
.
getDaoSession
().
getFoodDao
().
getDatabase
().
rawQuery
(
sql
,
null
);
while
(
c
.
moveToNext
())
{
...
...
library-database/src/main/java/com/gingersoft/gsa/cloud/database/utils/FoodDaoUtils.java
View file @
8d5d9976
...
...
@@ -163,12 +163,10 @@ public class FoodDaoUtils {
public
List
<
Food
>
queryFoodGroupByQueryBuilder
()
{
QueryBuilder
<
Food
>
queryBuilder
=
mManager
.
getDaoSession
().
queryBuilder
(
Food
.
class
);
long
currentTime
=
System
.
currentTimeMillis
();
queryBuilder
.
where
(
queryBuilder
.
and
(
return
queryBuilder
.
where
(
queryBuilder
.
and
(
FoodDao
.
Properties
.
ParentId
.
eq
(
0
),
FoodDao
.
Properties
.
StartDate
.
le
(
currentTime
),
FoodDao
.
Properties
.
EndDate
.
ge
(
currentTime
)))
.
join
(
ColorBean
.
class
,
ColorBeanDao
.
Properties
.
ColorId
);
return
queryBuilder
.
orderAsc
(
FoodDao
.
Properties
.
SeqNo
).
list
();
FoodDao
.
Properties
.
EndDate
.
ge
(
currentTime
))).
orderAsc
(
FoodDao
.
Properties
.
SeqNo
).
list
();
}
/**
...
...
@@ -210,7 +208,6 @@ public class FoodDaoUtils {
long
currentTime
=
System
.
currentTimeMillis
();
return
queryBuilder
.
where
(
queryBuilder
.
and
(
FoodDao
.
Properties
.
ParentId
.
eq
(
parentId
),
// FoodDao.Properties.FoodSummary.like("%"+foodSummary+"%"),
FoodDao
.
Properties
.
Invisible
.
notEq
(
1
),
FoodDao
.
Properties
.
StartDate
.
le
(
currentTime
),
FoodDao
.
Properties
.
EndDate
.
ge
(
currentTime
))).
orderAsc
(
FoodDao
.
Properties
.
SeqNo
).
list
();
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/contract/PayExceptionCode.java
View file @
8d5d9976
...
...
@@ -25,6 +25,8 @@ public interface PayExceptionCode {
*/
String
pos_response_105
=
"[105]"
;
/**
* SaleActionImp getTxnId
*/
...
...
@@ -43,6 +45,12 @@ public interface PayExceptionCode {
String
sale_414
=
"[414]"
;
/**
* RetrievalActionImp onPosException
*/
String
retrieval_513
=
"[513]"
;
String
retrieval_514
=
"[514]"
;
/**
* TipsActionImpl getTxnId
...
...
@@ -80,4 +88,22 @@ public interface PayExceptionCode {
String
void_812
=
"[812]"
;
String
void_813
=
"[813]"
;
String
void_814
=
"[814]"
;
/**
* RefundActionImpl getTxnId
*/
String
refund_901
=
"[901]"
;
String
refund_902
=
"[902]"
;
String
refund_903
=
"[903]"
;
String
refund_904
=
"[904]"
;
/**
* RefundActionImpl onPosException
*/
String
refund_910
=
"[910]"
;
String
refund_911
=
"[911]"
;
String
refund_912
=
"[912]"
;
String
refund_913
=
"[913]"
;
String
refund_914
=
"[914]"
;
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/IPosAction.java
View file @
8d5d9976
...
...
@@ -42,6 +42,10 @@ public abstract class IPosAction <T extends HywebPosResponse>{
}
}
public
PosAction
getPosAction
()
{
return
mPosAction
;
}
/**
* 對POS幾發起操作前的業務處理,如將操作記錄添加到後台日誌表,事項表
*/
...
...
@@ -69,43 +73,48 @@ public abstract class IPosAction <T extends HywebPosResponse>{
/**
* POS回調成功的方法
*
* @param posResponse
* @param context
* @param originalActivity
* @param response
*/
public
void
onPosSuccess
(
Context
context
,
T
posResponse
,
Activity
originalActivity
)
{
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
T
response
)
{
if
(
mStatusLoadingDialog
!=
null
)
{
mStatusLoadingDialog
.
setStatusText
(
mPosAction
.
getActionName
()
+
mLoadingActionComplteText
);
mStatusLoadingDialog
.
loadSuccess
();
mStatusLoadingDialog
.
cancel
();
}
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosSuccess
(
posR
esponse
);
mOnPosActionListener
.
onPosSuccess
(
r
esponse
);
}
}
/**
* POS回調為null或狀態異常
*/
public
void
onPosException
(
Exception
e
)
{
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
T
response
)
{
String
codeRequest
=
HywebActionStatusCode
.
getHywebRequestTextByCode
(
response
.
getSTATUS
());
if
(
mStatusLoadingDialog
!=
null
)
{
mStatusLoadingDialog
.
setStatusText
(
mPosAction
.
getCallbackExceptionText
()
+
e
.
getMessage
()
);
mStatusLoadingDialog
.
setStatusText
(
mPosAction
.
getCallbackExceptionText
()
+
codeRequest
);
mStatusLoadingDialog
.
loadFailure
();
mStatusLoadingDialog
.
cancel
();
}
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosException
(
e
);
mOnPosActionListener
.
onPosException
(
new
Exception
(
codeRequest
)
);
}
}
/**
* POS調起失敗
*/
public
void
onPosInvalid
(
String
e
)
{
public
void
onPosInvalid
(
Context
context
,
Activity
originalActivity
,
T
response
)
{
String
codeRequest
=
HywebActionStatusCode
.
getHywebRequestTextByCode
(
response
.
getSTATUS
());
if
(
mStatusLoadingDialog
!=
null
)
{
mStatusLoadingDialog
.
setStatusText
(
mPosAction
.
getActionName
()
+
e
);
mStatusLoadingDialog
.
setStatusText
(
mPosAction
.
getActionName
()
+
codeRequest
);
mStatusLoadingDialog
.
loadFailure
();
mStatusLoadingDialog
.
cancel
();
}
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosInvalid
(
e
);
mOnPosActionListener
.
onPosInvalid
(
codeRequest
);
}
}
...
...
@@ -139,7 +148,7 @@ public abstract class IPosAction <T extends HywebPosResponse>{
}
}
protected
void
can
C
elLoadingDialog
()
{
protected
void
can
c
elLoadingDialog
()
{
if
(
mStatusLoadingDialog
!=
null
)
{
mStatusLoadingDialog
.
cancel
();
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/fragment/PosActionStatusExceptionFragment.java
View file @
8d5d9976
...
...
@@ -38,6 +38,8 @@ import com.kingja.loadsir.core.LoadSir;
import
com.kingja.loadsir.core.Transport
;
import
com.qmuiteam.qmui.alpha.QMUIAlphaButton
;
import
org.simple.eventbus.EventBus
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
...
...
@@ -71,6 +73,8 @@ public class PosActionStatusExceptionFragment extends BaseFragment implements IV
private
int
retryCount
;
public
static
final
String
REFREAFSH_ORDER_EVENT
=
"refreafsh_order"
;
public
static
PosActionStatusExceptionFragment
newInstance
(
PosActionStatusExceptionParam
posStatusExceptionParam
)
{
Bundle
args
=
new
Bundle
();
PosActionStatusExceptionFragment
fragment
=
new
PosActionStatusExceptionFragment
();
...
...
@@ -260,4 +264,10 @@ public class PosActionStatusExceptionFragment extends BaseFragment implements IV
public
void
killMyself
()
{
_mActivity
.
onBackPressed
();
}
@Override
public
boolean
onBackPressedSupport
()
{
EventBus
.
getDefault
().
post
(
true
,
REFREAFSH_ORDER_EVENT
);
return
super
.
onBackPressedSupport
();
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/AdjustTipRespose.java
View file @
8d5d9976
...
...
@@ -35,6 +35,8 @@ public class AdjustTipRespose extends HywebPosResponse implements Parcelable {
private
String
TXN_TIME
;
private
String
TXN_DATE
;
public
AdjustTipRespose
()
{
}
@Override
public
int
describeContents
()
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/HywebPosResponse.java
View file @
8d5d9976
...
...
@@ -21,6 +21,8 @@ public class HywebPosResponse implements Parcelable {
protected
double
TXN_AMT
=
0.0
;
protected
double
TIPS
=
0.0
;
public
HywebPosResponse
()
{
}
public
static
final
Creator
<
HywebPosResponse
>
CREATOR
=
new
Creator
<
HywebPosResponse
>()
{
@Override
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/PrintPaymentStubResponse.java
View file @
8d5d9976
...
...
@@ -11,6 +11,9 @@ import android.os.Parcelable;
*/
public
class
PrintPaymentStubResponse
extends
HywebPosResponse
implements
Parcelable
{
public
PrintPaymentStubResponse
()
{
}
protected
PrintPaymentStubResponse
(
Parcel
in
)
{
super
(
in
);
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RefundRespose.java
View file @
8d5d9976
...
...
@@ -22,6 +22,8 @@ public class RefundRespose extends HywebPosResponse implements Parcelable {
private
String
TXN_DATE
;
private
String
HOST_REF
;
public
RefundRespose
()
{
}
@Override
public
int
describeContents
()
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/RetrievalRespose.java
View file @
8d5d9976
...
...
@@ -50,6 +50,8 @@ public class RetrievalRespose extends HywebPosResponse implements Parcelable {
private
String
PAN
;
private
String
EXPIRY_DATE
;
public
RetrievalRespose
()
{
}
@Override
public
int
describeContents
()
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SaleRespose.java
View file @
8d5d9976
...
...
@@ -50,6 +50,8 @@ public class SaleRespose extends HywebPosResponse implements Parcelable {
private
String
TID
;
// private double TXN_AMT;
public
SaleRespose
()
{
}
@Override
public
int
describeContents
()
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/SettlementRespose.java
View file @
8d5d9976
...
...
@@ -15,6 +15,9 @@ import lombok.Data;
@Data
public
class
SettlementRespose
extends
HywebPosResponse
implements
Parcelable
{
public
SettlementRespose
()
{
}
/**
* EVENT_NAME : SETTLE_RESP
* STATUS : 09
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/bean/response/pos/VoidRespose.java
View file @
8d5d9976
...
...
@@ -24,6 +24,8 @@ public class VoidRespose extends HywebPosResponse implements Parcelable {
private
String
TXN_DATE
;
private
String
HOST_REF
;
public
VoidRespose
()
{
}
@Override
public
int
describeContents
()
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/command/CommandImpl.java
View file @
8d5d9976
...
...
@@ -16,6 +16,7 @@ import com.gingersoft.gsa.cloud.component.ComponentAction;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode
;
import
com.gingersoft.gsa.cloud.pay.pos.IPosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.AdjustTipRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.PrintPaymentStubResponse
;
...
...
@@ -91,7 +92,7 @@ public class CommandImpl implements ICommand {
Activity
currentActivity
=
appManager
.
getTopActivity
();
if
(
TextUtils
.
isEmpty
(
response
))
{
onPosException
(
new
Exception
(
PayExceptionCode
.
pos_response_null
));
onPosException
(
context
,
currentActivity
,
returnErrorPosActionResponse
(
mPosAction
.
getPosAction
(),
PayExceptionCode
.
pos_response_null
));
return
;
}
...
...
@@ -102,14 +103,14 @@ public class CommandImpl implements ICommand {
if
(
posResponse
!=
null
)
{
if
(
HywebActionStatusCode
.
withInvalid
(
posResponse
.
getSTATUS
()))
{
//調起POS失敗
onPosInvalid
(
HywebActionStatusCode
.
getHywebRequestTextByCode
(
posResponse
.
getSTATUS
())
);
onPosInvalid
(
context
,
currentActivity
,
posResponse
);
}
else
{
//回調成功
onPosSuccess
(
context
,
posResponse
,
currentActivity
);
onPosSuccess
(
context
,
currentActivity
,
posResponse
);
}
}
else
{
//回調異常
onPosException
(
new
Exception
(
PayExceptionCode
.
pos_response_101
));
onPosException
(
context
,
currentActivity
,
returnErrorPosActionResponse
(
mPosAction
.
getPosAction
(),
PayExceptionCode
.
pos_response_101
));
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
...
...
@@ -118,15 +119,15 @@ public class CommandImpl implements ICommand {
String
status
=
msgObj
.
getString
(
"STATUS"
);
if
(
HywebActionStatusCode
.
withInvalid
(
status
))
{
//調起POS失敗
onPosInvalid
(
HywebActionStatusCode
.
getHywebRequestTextByCode
(
status
));
onPosInvalid
(
context
,
currentActivity
,
returnErrorPosActionResponse
(
mPosAction
.
getPosAction
(),
status
));
}
else
{
//回調異常
onPosException
(
new
Exception
(
HywebActionStatusCode
.
getHywebRequestTextByCode
(
status
)
));
onPosException
(
context
,
currentActivity
,
returnErrorPosActionResponse
(
mPosAction
.
getPosAction
(),
status
));
}
}
catch
(
JSONException
ex
)
{
ex
.
printStackTrace
();
//回調異常
onPosException
(
e
);
onPosException
(
context
,
currentActivity
,
returnErrorPosActionResponse
(
mPosAction
.
getPosAction
(),
PayExceptionCode
.
pos_response_102
)
);
}
}
finally
{
returnLastActivity
(
context
,
currentActivity
);
...
...
@@ -169,6 +170,30 @@ public class CommandImpl implements ICommand {
return
null
;
}
private
HywebPosResponse
returnErrorPosActionResponse
(
PosAction
posAction
,
String
errorStatus
){
HywebPosResponse
posResponse
=
null
;
if
(
posAction
==
PosAction
.
SALE
){
posResponse
=
new
SaleRespose
();
}
else
if
(
posAction
==
PosAction
.
VOID
){
posResponse
=
new
VoidRespose
();
}
else
if
(
posAction
==
PosAction
.
REFUND
){
posResponse
=
new
RefundRespose
();
}
else
if
(
posAction
==
PosAction
.
PRINT
){
posResponse
=
new
PrintPaymentStubResponse
();
}
else
if
(
posAction
==
PosAction
.
TIP
){
posResponse
=
new
AdjustTipRespose
();
}
else
if
(
posAction
==
PosAction
.
RETRIEVAL
){
posResponse
=
new
RetrievalRespose
();
}
else
if
(
posAction
==
PosAction
.
SETTLEMENT
){
posResponse
=
new
SettlementRespose
();
}
if
(
posResponse
!=
null
)
{
posResponse
.
setSTATUS
(
errorStatus
);
}
return
posResponse
;
}
@Override
public
void
onGoto
(
Context
context
)
{
LogUtil
.
d
(
TAG
,
"onGoto"
);
...
...
@@ -176,35 +201,37 @@ public class CommandImpl implements ICommand {
/**
* 回調成功轉發到具體的實現類
*
* @param posResponse
* @param context
* @param actionActivity
* @param posResponse
*/
private
void
onPosSuccess
(
Context
context
,
HywebPosResponse
posResponse
,
Activity
actionActivity
)
{
private
void
onPosSuccess
(
Context
context
,
Activity
actionActivity
,
HywebPosResponse
posResponse
)
{
if
(
mPosAction
!=
null
)
{
mPosAction
.
onPosSuccess
(
context
,
posResponse
,
actionActivity
);
mPosAction
.
onPosSuccess
(
context
,
actionActivity
,
posResponse
);
}
}
/**
* 回調失敗轉發到具體的實現類
*
* @param e
* @param context
* @param actionActivity
* @param posResponse
*/
public
void
onPosException
(
Exception
e
)
{
public
void
onPosException
(
Context
context
,
Activity
actionActivity
,
HywebPosResponse
posRespons
e
)
{
if
(
mPosAction
!=
null
)
{
mPosAction
.
onPosException
(
e
);
mPosAction
.
onPosException
(
context
,
actionActivity
,
posRespons
e
);
}
}
/**
* 調起失敗轉發到具體的實現類
*
* @param e
* @param context
* @param actionActivity
* @param posResponse
*/
public
void
onPosInvalid
(
String
e
)
{
public
void
onPosInvalid
(
Context
context
,
Activity
actionActivity
,
HywebPosResponse
posRespons
e
)
{
if
(
mPosAction
!=
null
)
{
mPosAction
.
onPosInvalid
(
e
);
mPosAction
.
onPosInvalid
(
context
,
actionActivity
,
posRespons
e
);
}
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/constant/HywebActionStatusCode.java
View file @
8d5d9976
...
...
@@ -74,16 +74,19 @@ public class HywebActionStatusCode {
/**
* 回調異常
* 三種異常情況:【
異常狀態=03,
未回調(斷電,網絡問題...),回調返回格式問題或為空】
* 三種異常情況:【未回調(斷電,網絡問題...),回調返回格式問題或為空】
*
* @param status
* @return
*/
public
static
boolean
withException
(
String
status
)
{
if
(
withSuccess
(
status
)
||
withInvalid
(
status
))
{
if
(
TextUtils
.
isEmpty
(
status
))
{
return
true
;
}
return
false
;
if
(
withSuccess
(
status
)
||
withInvalid
(
status
))
{
return
false
;
}
return
true
;
}
public
static
String
getHywebRequestTextByCode
(
String
status
)
{
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/PrintPaymentStubImpl.java
View file @
8d5d9976
...
...
@@ -36,20 +36,13 @@ public class PrintPaymentStubImpl extends IPosAction {
}
@Override
public
void
onPosSuccess
(
Context
context
,
HywebPosResponse
posResponse
,
Activity
originalActivity
)
{
super
.
onPosSuccess
(
context
,
posResponse
,
originalActivity
);
canCelLoadingDialog
();
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosSuccess
(
posResponse
);
}
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
HywebPosResponse
response
)
{
super
.
onPosSuccess
(
context
,
originalActivity
,
response
);
}
@Override
public
void
onPosException
(
Exception
e
)
{
super
.
onPosException
(
e
);
canCelLoadingDialog
();
if
(
mOnPosActionListener
!=
null
)
{
mOnPosActionListener
.
onPosException
(
e
);
}
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
HywebPosResponse
response
)
{
super
.
onPosException
(
context
,
originalActivity
,
response
);
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RefundActionImpl.java
View file @
8d5d9976
...
...
@@ -17,6 +17,7 @@ import com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.bg.GetTxnIdRequest
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RefundRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.bg.GetRefundIdResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RefundRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SaleRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.HywebActionStatusCode
;
import
com.jess.arms.mvp.IView
;
import
com.jess.arms.utils.RxLifecycleUtils
;
...
...
@@ -75,16 +76,16 @@ public class RefundActionImpl extends IPosAction<RefundRespose> {
onPosToAction
(
GsonUtils
.
GsonString
(
mRefundRequest
));
// canCelLoadingDialog();
}
else
{
onBeforeActionPosError
(
new
Exception
(
error
+
PayExceptionCode
.
tips_7
01
));
onBeforeActionPosError
(
new
Exception
(
error
+
PayExceptionCode
.
refund_9
01
));
}
}
else
{
onBeforeActionPosError
(
new
Exception
(
error
+
baseResult
.
getErrMsg
()));
}
}
else
{
onBeforeActionPosError
(
new
Exception
(
error
+
PayExceptionCode
.
tips_7
03
));
onBeforeActionPosError
(
new
Exception
(
error
+
PayExceptionCode
.
refund_9
03
));
}
}
else
{
onBeforeActionPosError
(
new
Exception
(
error
+
PayExceptionCode
.
tips_7
04
));
onBeforeActionPosError
(
new
Exception
(
error
+
PayExceptionCode
.
refund_9
04
));
}
}
...
...
@@ -99,19 +100,34 @@ public class RefundActionImpl extends IPosAction<RefundRespose> {
});
}
@Override
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
RefundRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
RefundRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosInvalid
(
Context
context
,
Activity
originalActivity
,
RefundRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
/**
* 退款回調
成功
* 退款回調
* 1、更新上傳退款狀態
* 2、顯示退款結果
*
* @param context
* @param response
* @param originalActivity
* @param status
*/
@Override
public
void
onPosSuccess
(
Context
context
,
RefundRespose
response
,
Activity
originalActivity
)
{
private
void
updateMatter
(
Context
context
,
Activity
originalActivity
,
RefundRespose
response
,
String
status
){
//1、更新上傳退款狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/
ad
d"
,
getPosMatterRequest
(
response
))
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/
updatePosRefun
d"
,
getPosMatterRequest
(
response
))
.
compose
(
RxSchedulerUtils
.
_io_main_o
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mView
))
.
subscribe
(
new
Observer
<
String
>()
{
...
...
@@ -133,10 +149,10 @@ public class RefundActionImpl extends IPosAction<RefundRespose> {
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
"["
+
baseResult
.
getErrMsg
()+
"]"
));
}
}
else
{
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
sale_4
13
));
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
refund_9
13
));
}
}
else
{
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
sale_4
14
));
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
refund_9
14
));
}
}
...
...
@@ -160,10 +176,12 @@ public class RefundActionImpl extends IPosAction<RefundRespose> {
* @param originalActivity
*/
private
void
displayRefundResult
(
Context
context
,
RefundRespose
response
,
Activity
originalActivity
)
{
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
()))
{
super
.
onPosException
(
new
Exception
(
response
.
getSTATUS
()));
}
else
{
super
.
onPosSuccess
(
context
,
response
,
originalActivity
);
if
(
HywebActionStatusCode
.
withSuccess
(
response
.
getSTATUS
()))
{
super
.
onPosSuccess
(
context
,
originalActivity
,
response
);
}
else
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
())){
super
.
onPosException
(
context
,
originalActivity
,
response
);
}
else
{
super
.
onPosInvalid
(
context
,
originalActivity
,
response
);
}
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/RetrievalActionImpl.java
View file @
8d5d9976
...
...
@@ -15,11 +15,13 @@ import com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.bean.PosMatter
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.RetrievalRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RefundRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RetrievalRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SettlementRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.HywebActionStatusCode
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.TransactionStatusCode
;
import
com.jess.arms.mvp.IView
;
import
com.jess.arms.utils.RxLifecycleUtils
;
import
com.xuexiang.rxutil2.rxjava.RxSchedulerUtils
;
import
io.reactivex.Observer
;
...
...
@@ -53,18 +55,32 @@ public class RetrievalActionImpl extends IPosAction<RetrievalRespose> {
onPosToAction
(
GsonUtils
.
GsonString
(
mRetrievalRequest
));
}
@Override
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
RetrievalRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
RetrievalRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosInvalid
(
Context
context
,
Activity
originalActivity
,
RetrievalRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
/**
* 查詢回調成功
* 1、更新上傳狀態
* 2、顯示查询結果
*
* @param context
* @param response
* @param originalActivity
* @param response
* @param status
*/
@Override
public
void
onPosSuccess
(
Context
context
,
RetrievalRespose
response
,
Activity
originalActivity
)
{
private
void
updateMatter
(
Context
context
,
Activity
originalActivity
,
RetrievalRespose
response
,
String
status
){
String
url
=
null
;
RequestBody
requestBody
;
switch
(
response
.
getTXN_TYPE
())
{
...
...
@@ -102,7 +118,7 @@ public class RetrievalActionImpl extends IPosAction<RetrievalRespose> {
//1、更新上傳狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
url
,
requestBody
)
.
compose
(
RxSchedulerUtils
.
_io_main_o
())
//
.compose(RxLifecycleUtils.bindToLifecycle(mView))
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mView
))
.
subscribe
(
new
Observer
<
String
>()
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
...
...
@@ -122,10 +138,10 @@ public class RetrievalActionImpl extends IPosAction<RetrievalRespose> {
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
"["
+
baseResult
.
getErrMsg
()
+
"]"
));
}
}
else
{
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
sale_4
13
));
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
retrieval_5
13
));
}
}
else
{
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
sale_4
14
));
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
retrieval_5
14
));
}
}
...
...
@@ -148,10 +164,12 @@ public class RetrievalActionImpl extends IPosAction<RetrievalRespose> {
* @param originalActivity
*/
private
void
displayRetrievalResult
(
Context
context
,
RetrievalRespose
response
,
Activity
originalActivity
)
{
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
()))
{
super
.
onPosException
(
new
Exception
(
response
.
getSTATUS
()));
}
else
{
super
.
onPosSuccess
(
context
,
response
,
originalActivity
);
if
(
HywebActionStatusCode
.
withSuccess
(
response
.
getSTATUS
()))
{
super
.
onPosSuccess
(
context
,
originalActivity
,
response
);
}
else
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
())){
super
.
onPosException
(
context
,
originalActivity
,
response
);
}
else
{
super
.
onPosInvalid
(
context
,
originalActivity
,
response
);
}
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/SaleActionImpl.java
View file @
8d5d9976
...
...
@@ -139,26 +139,40 @@ public class SaleActionImpl extends IPosAction<SaleRespose> {
});
}
@Override
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
SaleRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
SaleRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosInvalid
(
Context
context
,
Activity
originalActivity
,
SaleRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
/**
* 支付回調
成功
* 支付回調
* 1、更新上傳支付狀態
* 2、顯示支付結果
* 3、跳轉支付詳情頁
*
* @param context
* @param response 支付回調結果
* @param originalActivity 原來跳轉到pos的支付頁
* @param originalActivity
* @param response
* @param status
*/
@Override
public
void
onPosSuccess
(
Context
context
,
SaleRespose
response
,
Activity
originalActivity
)
{
private
void
updateMatter
(
Context
context
,
Activity
originalActivity
,
SaleRespose
response
,
String
status
){
//1、更新上傳支付狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/add"
,
getPosMatterRequest
(
response
))
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"orderPay/add"
,
getPosMatterRequest
(
GsonUtils
.
GsonString
(
response
),
status
,
mTxnIdResponse
.
getTxnId
()
))
.
compose
(
RxSchedulerUtils
.
_io_main_o
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mView
))
.
subscribe
(
new
Observer
<
String
>()
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
printPaymentStub
();
}
@Override
...
...
@@ -196,24 +210,19 @@ public class SaleActionImpl extends IPosAction<SaleRespose> {
}
/**
* 打印Hyweb支付存根
*/
private
void
printPaymentStub
()
{
PosPay
.
printStub
(
mContext
,
mView
,
mTxnIdResponse
.
getTxnId
(),
null
);
}
/**
* 2、顯示支付結果
*
* @param context
* @param response
* @param response
* @param originalActivity
*/
private
void
displayPaymentResult
(
Context
context
,
SaleRespose
response
,
Activity
originalActivity
)
{
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
()))
{
super
.
onPosException
(
new
Exception
(
response
.
getSTATUS
()));
}
else
{
super
.
onPosSuccess
(
context
,
response
,
originalActivity
);
if
(
HywebActionStatusCode
.
withSuccess
(
response
.
getSTATUS
()))
{
super
.
onPosSuccess
(
context
,
originalActivity
,
response
);
}
else
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
())){
super
.
onPosException
(
context
,
originalActivity
,
response
);
}
else
{
super
.
onPosInvalid
(
context
,
originalActivity
,
response
);
}
}
...
...
@@ -250,13 +259,13 @@ public class SaleActionImpl extends IPosAction<SaleRespose> {
});
}
private
RequestBody
getPosMatterRequest
(
S
aleRespose
response
)
{
private
RequestBody
getPosMatterRequest
(
S
tring
response
,
String
status
,
String
txnId
)
{
PosMatter
posMatter
=
new
PosMatter
();
posMatter
.
setOrderId
(
mTxnIdRequest
.
getOrderId
());
posMatter
.
setPayId
(
response
.
getTXN_ID
()
);
posMatter
.
setContent
(
GsonUtils
.
GsonString
(
response
)
);
posMatter
.
setStatus
(
getPosMatterStatus
(
response
.
getSTATUS
()
));
posMatter
.
setPayId
(
txnId
);
posMatter
.
setContent
(
response
);
posMatter
.
setStatus
(
getPosMatterStatus
(
status
));
mMealOrderPayRequest
.
setPosMatter
(
posMatter
);
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
GsonUtils
.
GsonString
(
mMealOrderPayRequest
));
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/SettlementActionImpl.java
View file @
8d5d9976
...
...
@@ -2,13 +2,21 @@ package com.gingersoft.gsa.cloud.pay.pos.hywebpos.imp;
import
android.app.Activity
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.constans.HttpsConstans
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils
;
import
com.gingersoft.gsa.cloud.pay.contract.PayExceptionCode
;
import
com.gingersoft.gsa.cloud.pay.pos.IPosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.OnPosActionListener
;
import
com.gingersoft.gsa.cloud.pay.pos.PosAction
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.request.pos.SettlementRequest
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.bg.GetRefundIdResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.HywebPosResponse
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.RetrievalRespose
;
import
com.gingersoft.gsa.cloud.pay.pos.hywebpos.bean.response.pos.SettlementRespose
;
import
com.jess.arms.mvp.IView
;
import
com.jess.arms.utils.RxLifecycleUtils
;
...
...
@@ -16,10 +24,15 @@ import com.xuexiang.rxutil2.rxjava.RxSchedulerUtils;
import
javax.inject.Inject
;
import
io.reactivex.Observer
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.schedulers.Schedulers
;
import
me.jessyan.rxerrorhandler.core.RxErrorHandler
;
import
me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber
;
import
okhttp3.FormBody
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
/**
* @作者: bin
...
...
@@ -38,11 +51,125 @@ public class SettlementActionImpl extends IPosAction<SettlementRespose> {
@Override
protected
void
onPosActionBefore
()
{
SettlementRequest
request
=
new
SettlementRequest
();
onPosToAction
(
GsonUtils
.
GsonString
(
request
));
// RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(mGetTxnIdRequest));
// String json = GsonUtils.GsonString(mGetTxnIdRequest);
// OkHttp3Utils.post(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL + "posPay/addOperation", null)
// .compose(RxSchedulerUtils._io_main_o())
// .compose(RxLifecycleUtils.bindToLifecycle(mView))
// .subscribe(new Observer<String>() {
// @Override
// public void onSubscribe(Disposable d) {
// }
//
// @Override
// public void onNext(String result) {
// String error = "調起清機款異常";
// if (!TextUtils.isEmpty(result)) {
// BaseResult baseResult = GsonUtils.GsonToBean(result, BaseResult.class);
// if (baseResult != null) {
// if (baseResult.isSuccess() && baseResult.getData() != null) {
// //調起N5清機
//// onPosToAction(GsonUtils.GsonString(mRefundRequest));
// } else {
// onBeforeActionPosError(new Exception(error + baseResult.getErrMsg()));
// }
// } else {
// onBeforeActionPosError(new Exception(error + PayExceptionCode.tips_703));
// }
// } else {
// onBeforeActionPosError(new Exception(error + PayExceptionCode.tips_704));
// }
// }
//
// @Override
// public void onComplete() {
// }
//
// @Override
// public void onError(Throwable t) {
// onBeforeActionPosError(new Exception(t.getMessage()));
// }
// });
}
@Override
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
SettlementRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosSuccess
(
Context
context
,
SettlementRespose
result
,
Activity
actionActivity
)
{
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
SettlementRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosInvalid
(
Context
context
,
Activity
originalActivity
,
SettlementRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
/**
* 1、更新上傳清機結果
*
* @param context
* @param originalActivity
* @param response
* @param status
*/
private
void
updateMatter
(
Context
context
,
Activity
originalActivity
,
SettlementRespose
response
,
String
status
){
//1、更新上傳清機結果
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"posPay/updateOperation"
,
getPosSettlementRequest
(
response
))
.
compose
(
RxSchedulerUtils
.
_io_main_o
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mView
))
.
subscribe
(
new
Observer
<
String
>()
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
}
@Override
public
void
onNext
(
String
result
)
{
// displayTipsResult(context, response, originalActivity);
if
(!
TextUtils
.
isEmpty
(
result
))
{
BaseResult
baseResult
=
GsonUtils
.
GsonToBean
(
result
,
BaseResult
.
class
);
if
(
baseResult
!=
null
)
{
if
(
baseResult
.
isSuccess
())
{
// onUpdateStatusSuccess(response);
}
else
{
// onUpdateStatusError(new Exception(mPosAction.getCallbackExceptionText() + PayExceptionCode.tips_711));
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
"["
+
baseResult
.
getErrMsg
()+
"]"
));
}
}
else
{
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
tips_712
));
}
}
else
{
onUpdateStatusError
(
new
Exception
(
mPosAction
.
getCallbackExceptionText
()
+
PayExceptionCode
.
tips_713
));
}
}
@Override
public
void
onError
(
Throwable
e
)
{
// displayTipsResult(context, response, originalActivity);
}
@Override
public
void
onComplete
()
{
}
});
}
private
RequestBody
getPosSettlementRequest
(
SettlementRespose
result
)
{
RequestBody
requestBody
=
new
FormBody
.
Builder
()
.
add
(
"restaurantId"
,
String
.
valueOf
(
RestaurantInfoManager
.
newInstance
().
getRestaurantId
()))
.
add
(
"content"
,
GsonUtils
.
GsonString
(
result
))
// .add("status",String.valueOf(status))
.
build
();
return
requestBody
;
}
}
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/TipsActionImpl.java
View file @
8d5d9976
...
...
@@ -105,6 +105,21 @@ public class TipsActionImpl extends IPosAction<AdjustTipRespose> {
});
}
@Override
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
AdjustTipRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
AdjustTipRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosInvalid
(
Context
context
,
Activity
originalActivity
,
AdjustTipRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
/**
* 補小費回調成功
* 1、更新上傳小費狀態
...
...
@@ -112,11 +127,11 @@ public class TipsActionImpl extends IPosAction<AdjustTipRespose> {
* 3、刷新當前頁面
*
* @param context
* @param response
* @param originalActivity
* @param response
* @param status
*/
@Override
public
void
onPosSuccess
(
Context
context
,
AdjustTipRespose
response
,
Activity
originalActivity
)
{
private
void
updateMatter
(
Context
context
,
Activity
originalActivity
,
AdjustTipRespose
response
,
String
status
)
{
//1、更新上傳小費狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"posPay/updatePosTip"
,
getPosMatterRequest
(
response
))
.
compose
(
RxSchedulerUtils
.
_io_main_o
())
...
...
@@ -168,10 +183,12 @@ public class TipsActionImpl extends IPosAction<AdjustTipRespose> {
* @param originalActivity
*/
private
void
displayTipsResult
(
Context
context
,
AdjustTipRespose
response
,
Activity
originalActivity
)
{
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
()))
{
super
.
onPosException
(
new
Exception
(
response
.
getSTATUS
()));
}
else
{
super
.
onPosSuccess
(
context
,
response
,
originalActivity
);
if
(
HywebActionStatusCode
.
withSuccess
(
response
.
getSTATUS
()))
{
super
.
onPosSuccess
(
context
,
originalActivity
,
response
);
}
else
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
())){
super
.
onPosException
(
context
,
originalActivity
,
response
);
}
else
{
super
.
onPosInvalid
(
context
,
originalActivity
,
response
);
}
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/pos/hywebpos/imp/VoidActionImpl.java
View file @
8d5d9976
...
...
@@ -99,6 +99,20 @@ public class VoidActionImpl extends IPosAction<VoidRespose> {
});
}
@Override
public
void
onPosSuccess
(
Context
context
,
Activity
originalActivity
,
VoidRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosException
(
Context
context
,
Activity
originalActivity
,
VoidRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
@Override
public
void
onPosInvalid
(
Context
context
,
Activity
originalActivity
,
VoidRespose
response
)
{
updateMatter
(
context
,
originalActivity
,
response
,
response
.
getSTATUS
());
}
/**
* 取消回調成功
...
...
@@ -108,11 +122,11 @@ public class VoidActionImpl extends IPosAction<VoidRespose> {
* 3、刷新當前頁面
*
* @param context
* @param response
* @param originalActivity
* @param response
* @param status
*/
@Override
public
void
onPosSuccess
(
Context
context
,
VoidRespose
response
,
Activity
originalActivity
)
{
private
void
updateMatter
(
Context
context
,
Activity
originalActivity
,
VoidRespose
response
,
String
status
)
{
//1、更新上傳取消狀態
OkHttp3Utils
.
post
(
HttpsConstans
.
ROOT_SERVER_ADDRESS_FORMAL
+
"posPay/updatePosCancel"
,
getPosMatterRequest
(
response
))
.
compose
(
RxSchedulerUtils
.
_io_main_o
())
...
...
@@ -162,10 +176,12 @@ public class VoidActionImpl extends IPosAction<VoidRespose> {
* @param originalActivity
*/
private
void
displayVoidResult
(
Context
context
,
VoidRespose
response
,
Activity
originalActivity
)
{
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
()))
{
super
.
onPosException
(
new
Exception
(
response
.
getSTATUS
()));
}
else
{
super
.
onPosSuccess
(
context
,
response
,
originalActivity
);
if
(
HywebActionStatusCode
.
withSuccess
(
response
.
getSTATUS
()))
{
super
.
onPosSuccess
(
context
,
originalActivity
,
response
);
}
else
if
(
HywebActionStatusCode
.
withException
(
response
.
getSTATUS
())){
super
.
onPosException
(
context
,
originalActivity
,
response
);
}
else
{
super
.
onPosInvalid
(
context
,
originalActivity
,
response
);
}
}
...
...
library-order/src/main/java/com/gingersoft/gsa/cloud/pay/util/PayMethodUtils.java
View file @
8d5d9976
...
...
@@ -48,7 +48,7 @@ public class PayMethodUtils {
*/
public
static
int
hasHywebPayMethod
(
List
<
PayMethod
>
payMethods
)
{
if
(
payMethods
!=
null
&&
payMethods
.
size
()
>
0
)
{
int
[]
payTypes
=
{
PayTypeContract
.
PAY_METHOD_ID_1030
,
PayTypeContract
.
PAY_METHOD_ID_1031
};
int
[]
payTypes
=
{
PayTypeContract
.
PAY_METHOD_ID_1030
,
PayTypeContract
.
PAY_METHOD_ID_1031
,
PayTypeContract
.
PAY_METHOD_ID_1032
,
PayTypeContract
.
PAY_METHOD_ID_1033
};
for
(
int
i
=
0
;
i
<
payMethods
.
size
();
i
++)
{
PayMethod
payMethod
=
payMethods
.
get
(
i
);
if
(
payMethod
.
getPayType
()
==
payTypes
[
0
]
||
payMethod
.
getPayType
()
==
payTypes
[
1
])
{
...
...
@@ -60,7 +60,7 @@ public class PayMethodUtils {
}
public
static
boolean
withHywebPayMethod
(
PayMethod
payMethod
)
{
int
[]
payTypes
=
{
PayTypeContract
.
PAY_METHOD_ID_1030
,
PayTypeContract
.
PAY_METHOD_ID_1031
};
int
[]
payTypes
=
{
PayTypeContract
.
PAY_METHOD_ID_1030
,
PayTypeContract
.
PAY_METHOD_ID_1031
,
PayTypeContract
.
PAY_METHOD_ID_1032
,
PayTypeContract
.
PAY_METHOD_ID_1033
};
if
(
payMethod
.
getPayType
()
==
payTypes
[
0
]
||
payMethod
.
getPayType
()
==
payTypes
[
1
])
{
return
true
;
}
...
...
@@ -74,7 +74,7 @@ public class PayMethodUtils {
*/
public
static
PayMethod
getHywebPayMethod
(
List
<
PayMethod
>
payMethods
)
{
if
(
payMethods
!=
null
&&
payMethods
.
size
()
>
0
)
{
int
[]
payTypes
=
{
PayTypeContract
.
PAY_METHOD_ID_1030
,
PayTypeContract
.
PAY_METHOD_ID_1031
};
int
[]
payTypes
=
{
PayTypeContract
.
PAY_METHOD_ID_1030
,
PayTypeContract
.
PAY_METHOD_ID_1031
,
PayTypeContract
.
PAY_METHOD_ID_1032
,
PayTypeContract
.
PAY_METHOD_ID_1033
};
for
(
int
i
=
0
;
i
<
payMethods
.
size
();
i
++)
{
PayMethod
payMethod
=
payMethods
.
get
(
i
);
if
(
payMethod
.
getPayType
()
==
payTypes
[
0
]
||
payMethod
.
getPayType
()
==
payTypes
[
1
])
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment