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
ef2056da
Commit
ef2056da
authored
Feb 03, 2021
by
宁斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、添加餐檯模式埋點記錄 2、餐檯模式選擇取消彈窗閃退問題處理 3、skyorder餐檯刪除數量提示調整為後台返回
parent
2194c6e3
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
362 additions
and
616 deletions
+362
-616
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/contract/DownloadContract.java
+5
-5
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/model/DownloadModel.java
+5
-5
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/model/service/DownloadService.java
+5
-5
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/presenter/DownloadPresenter.java
+199
-537
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/ui/activity/DownloadActivity.java
+0
-1
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/BaseOrderPresenter.java
+21
-5
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/MealStandPresenter.java
+14
-4
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/OrderContentPresenter.java
+5
-1
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/OrderPayPresenter.java
+6
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/MealStandActivity.java
+9
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderPayActivity.java
+7
-4
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/TableActivity.java
+3
-4
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderCenterActivity.java
+6
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderDetailActivity.java
+4
-0
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/widget/CancelFoodDialog.java
+9
-4
component-table/src/main/res/layout/table_dialog_cancel_food.xml
+2
-7
component-table/src/main/res/values/styles.xml
+4
-4
library-common/src/main/java/com/gingersoft/gsa/cloud/common/logan/LoganManager.java
+38
-17
library-common/src/main/res/values-v21/styles.xml
+7
-0
library-common/src/main/res/values-v21/styles.xml~
+0
-0
library-common/src/main/res/values/styles.xml
+6
-12
library-ui/src/main/java/com/gingersoft/gsa/cloud/ui/view/OrderPayView.java
+7
-1
No files found.
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/contract/DownloadContract.java
View file @
ef2056da
...
...
@@ -39,17 +39,17 @@ public interface DownloadContract {
interface
Model
extends
IModel
{
Observable
<
FunctionRespone
>
downFunctionList
(
long
userId
);
Observable
<
BaseResult
>
downFunctionList
(
long
userId
);
Observable
<
BaseResult
>
downFoodList
(
int
restaurantId
);
Observable
<
ModifierRespone
>
downModifier
(
int
restaurantId
);
Observable
<
BaseResult
>
downModifier
(
int
restaurantId
);
Observable
<
FoodComboRespone
>
downFoodCombo
(
int
restaurantId
);
Observable
<
BaseResult
>
downFoodCombo
(
int
restaurantId
);
Observable
<
ComboItemRespone
>
downComboItem
(
int
restaurantId
);
Observable
<
BaseResult
>
downComboItem
(
int
restaurantId
);
Observable
<
FoodModifierRespone
>
downFoodModifier
(
int
restaurantId
);
Observable
<
BaseResult
>
downFoodModifier
(
int
restaurantId
);
Observable
<
BaseResult
>
downDiscount
(
int
restaurantId
);
...
...
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/model/DownloadModel.java
View file @
ef2056da
...
...
@@ -53,7 +53,7 @@ public class DownloadModel extends BaseModel implements DownloadContract.Model {
}
@Override
public
Observable
<
FunctionRespone
>
downFunctionList
(
long
userId
)
{
public
Observable
<
BaseResult
>
downFunctionList
(
long
userId
)
{
return
mRepositoryManager
.
obtainRetrofitService
(
DownloadService
.
class
)
.
downFunctionList
(
userId
);
}
...
...
@@ -65,25 +65,25 @@ public class DownloadModel extends BaseModel implements DownloadContract.Model {
}
@Override
public
Observable
<
ModifierRespone
>
downModifier
(
int
restaurantId
)
{
public
Observable
<
BaseResult
>
downModifier
(
int
restaurantId
)
{
return
mRepositoryManager
.
obtainRetrofitService
(
DownloadService
.
class
)
.
downModifier
(
restaurantId
);
}
@Override
public
Observable
<
FoodComboRespone
>
downFoodCombo
(
int
restaurantId
)
{
public
Observable
<
BaseResult
>
downFoodCombo
(
int
restaurantId
)
{
return
mRepositoryManager
.
obtainRetrofitService
(
DownloadService
.
class
)
.
downFoodCombo
(
restaurantId
);
}
@Override
public
Observable
<
ComboItemRespone
>
downComboItem
(
int
restaurantId
)
{
public
Observable
<
BaseResult
>
downComboItem
(
int
restaurantId
)
{
return
mRepositoryManager
.
obtainRetrofitService
(
DownloadService
.
class
)
.
downComboItem
(
restaurantId
);
}
@Override
public
Observable
<
FoodModifierRespone
>
downFoodModifier
(
int
restaurantId
)
{
public
Observable
<
BaseResult
>
downFoodModifier
(
int
restaurantId
)
{
return
mRepositoryManager
.
obtainRetrofitService
(
DownloadService
.
class
)
.
downFoodModifier
(
restaurantId
);
}
...
...
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/model/service/DownloadService.java
View file @
ef2056da
...
...
@@ -18,22 +18,22 @@ import retrofit2.http.Query;
public
interface
DownloadService
{
@GET
(
"user/resource/list"
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
FunctionRespone
>
downFunctionList
(
@Query
(
"userId"
)
long
userId
);
Observable
<
BaseResult
>
downFunctionList
(
@Query
(
"userId"
)
long
userId
);
@GET
(
Api
.
food_list
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
BaseResult
>
downFoodList
(
@Query
(
"restaurantId"
)
int
restaurantId
);
@GET
(
Api
.
modifier
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
ModifierRespone
>
downModifier
(
@Query
(
"restaurantId"
)
int
restaurantId
);
Observable
<
BaseResult
>
downModifier
(
@Query
(
"restaurantId"
)
int
restaurantId
);
@GET
(
Api
.
food_package_relation
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
FoodComboRespone
>
downFoodCombo
(
@Query
(
"restaurantId"
)
int
restaurantId
);
Observable
<
BaseResult
>
downFoodCombo
(
@Query
(
"restaurantId"
)
int
restaurantId
);
@GET
(
Api
.
food_comboItem
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
ComboItemRespone
>
downComboItem
(
@Query
(
"restaurantId"
)
int
restaurantId
);
Observable
<
BaseResult
>
downComboItem
(
@Query
(
"restaurantId"
)
int
restaurantId
);
@GET
(
Api
.
food_modifiere_relation
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
FoodModifierRespone
>
downFoodModifier
(
@Query
(
"restaurantId"
)
int
restaurantId
);
Observable
<
BaseResult
>
downFoodModifier
(
@Query
(
"restaurantId"
)
int
restaurantId
);
@GET
(
Api
.
restaurant_discount
+
RetrofitUrlManager
.
IDENTIFICATION_PATH_SIZE
+
2
)
Observable
<
BaseResult
>
downDiscount
(
@Query
(
"restaurantId"
)
int
restaurantId
);
...
...
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/presenter/DownloadPresenter.java
View file @
ef2056da
package
com
.
gingersoft
.
gsa
.
cloud
.
download
.
mvp
.
presenter
;
import
android.app.Application
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.gsa.cloud.common.core.user.UserContext
;
import
com.gingersoft.gsa.cloud.common.Api
;
import
com.gingersoft.gsa.cloud.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.CommonConfiguration
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
;
...
...
@@ -13,9 +15,15 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
import
com.gingersoft.gsa.cloud.common.constans.HttpsConstans
;
import
com.gingersoft.gsa.cloud.database.bean.ColorBean
;
import
com.gingersoft.gsa.cloud.database.bean.ComboItem
;
import
com.gingersoft.gsa.cloud.database.bean.Discount
;
import
com.gingersoft.gsa.cloud.database.bean.ExpandInfo
;
import
com.gingersoft.gsa.cloud.database.bean.Food
;
import
com.gingersoft.gsa.cloud.database.bean.FoodCombo
;
import
com.gingersoft.gsa.cloud.database.bean.FoodModifier
;
import
com.gingersoft.gsa.cloud.database.bean.Function
;
import
com.gingersoft.gsa.cloud.database.bean.Modifier
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterListBean
;
import
com.gingersoft.gsa.cloud.database.utils.ColorDaoUtils
;
import
com.gingersoft.gsa.cloud.database.utils.ComboItemDaoUtils
;
...
...
@@ -111,6 +119,7 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
//當前下載進度
private
float
currentProgress
=
0
;
private
List
<
Observable
>
mRequestObservables
=
new
ArrayList
<>();
private
List
<
Disposable
>
mDownDisposable
=
new
ArrayList
<>();
@Inject
...
...
@@ -126,6 +135,10 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
this
.
mAppManager
=
null
;
this
.
mImageLoader
=
null
;
this
.
mApplication
=
null
;
mRequestObservables
.
clear
();
mRequestObservables
=
null
;
stopDownDisposable
();
}
public
void
initAdapter
()
{
...
...
@@ -147,124 +160,39 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
IActivity
.
setTvProgress
(
0
);
stopDownDisposable
();
initDownState
();
setDownAverageRatio
();
addDownRequests
();
excuteDownRequests
();
}
private
void
addDownRequests
()
{
long
userId
=
UserContext
.
newInstance
().
getMemberId
();
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
List
<
DownloadRequest
>
requests
=
getDownloadRequests
(
getDownloadUrls
(
restaurantId
),
restaurantId
);
DownloadManager
.
getInstance
().
takeRequestExecute
(
requests
,
new
DownloadManager
.
OnRunnableListener
()
{
@Override
public
void
run
(
Object
o
)
{
DownloadRequest
request
=
(
DownloadRequest
)
o
;
switch
(
request
.
getDownTag
())
{
case
0
:
downFun
(
request
.
getDownTag
());
break
;
case
1
:
downFoodList
(
request
.
getDownTag
());
break
;
case
2
:
downModifier
(
request
.
getDownTag
());
break
;
case
3
:
downFoodCombo
(
request
.
getDownTag
());
break
;
case
4
:
downComboItem
(
request
.
getDownTag
());
break
;
case
5
:
downFoodModifier
(
request
.
getDownTag
());
break
;
case
6
:
downDiscount
(
request
.
getDownTag
());
break
;
case
7
:
downExpandInfo
(
request
.
getDownTag
());
break
;
case
8
:
downPrinterList
(
request
.
getDownTag
());
break
;
case
9
:
downColorList
(
request
.
getDownTag
());
break
;
}
}
});
mRequestObservables
.
add
(
mModel
.
downFunctionList
(
userId
));
mRequestObservables
.
add
(
mModel
.
downFoodList
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downModifier
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downFoodCombo
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downComboItem
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downFoodModifier
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downDiscount
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downExpandInfo
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downPrinterList
(
restaurantId
));
mRequestObservables
.
add
(
mModel
.
downColorList
());
}
p
ublic
void
stopDownDisposable
()
{
for
(
int
i
=
0
;
i
<
mDownDisposable
.
size
();
i
++
)
{
if
(
mDownDisposable
.
get
(
i
)
!=
null
&&
!
mDownDisposable
.
get
(
i
).
isDisposed
()
)
{
mDownDisposable
.
get
(
i
).
dispose
(
);
p
rivate
void
excuteDownRequests
()
{
if
(
mRequestObservables
!=
null
&&
mRequestObservables
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
mRequestObservables
.
size
();
i
++
)
{
downDataRequest
(
mRequestObservables
.
get
(
i
),
i
);
}
}
mDownDisposable
.
clear
();
}
public
void
downFun
(
int
downTag
)
{
long
userId
=
UserContext
.
newInstance
().
getMemberId
();
mModel
.
downFunctionList
(
userId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
FunctionRespone
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
}
@Override
public
void
onNext
(
@NonNull
FunctionRespone
functionBean
)
{
if
(
functionBean
.
isSuccess
())
{
if
(
functionBean
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FunctionDaoUtils
functionDao
=
new
FunctionDaoUtils
(
IActivity
);
functionDao
.
deleteAll
();
functionDao
.
insertMultFunction
(
functionBean
.
getData
());
}
});
XFunctionManager
.
newInstance
().
updateFunctions
(
functionBean
.
getData
());
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
}
});
}
public
void
downFoodList
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downFoodList
(
restaurantId
)
private
void
downDataRequest
(
Observable
observable
,
int
downIndex
)
{
observable
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
BaseResult
>(
mErrorHandler
)
{
...
...
@@ -278,233 +206,12 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
@Override
public
void
onNext
(
@NonNull
BaseResult
result
)
{
if
(
result
.
isSuccess
())
{
List
<
Food
>
foodList
=
GsonUtils
.
jsonToList
(
result
.
getData
(),
Food
.
class
);
if
(
foodList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FoodDaoUtils
foodDao
=
new
FoodDaoUtils
(
IActivity
);
foodDao
.
deleteAll
();
foodDao
.
insertMultFood
(
foodList
);
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
}
});
}
public
void
downModifier
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downModifier
(
restaurantId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
ModifierRespone
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
}
@Override
public
void
onNext
(
@NonNull
ModifierRespone
modifier
)
{
if
(
modifier
.
isSuccess
())
{
if
(
modifier
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ModifierDaoUtils
modifierDao
=
new
ModifierDaoUtils
(
IActivity
);
modifierDao
.
deleteAll
();
modifierDao
.
insertMultModifier
(
modifier
.
getData
());
CommonConfiguration
.
getInstance
().
saveModifierTopIdConfiguration
(
modifier
.
getData
());
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
}
});
}
public
void
downFoodCombo
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downFoodCombo
(
restaurantId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
FoodComboRespone
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
}
@Override
public
void
onNext
(
@NonNull
FoodComboRespone
combo
)
{
if
(
combo
.
isSuccess
())
{
if
(
combo
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FoodComboDaoUtils
comboDao
=
new
FoodComboDaoUtils
(
IActivity
);
comboDao
.
deleteAll
();
comboDao
.
insertMultCombo
(
combo
.
getData
());
CommonConfiguration
.
getInstance
().
saveComboIdConfiguration
(
combo
.
getData
());
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
}
});
}
public
void
downComboItem
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downComboItem
(
restaurantId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
ComboItemRespone
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
}
@Override
public
void
onNext
(
@NonNull
ComboItemRespone
combo
)
{
if
(
combo
.
isSuccess
())
{
if
(
combo
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ComboItemDaoUtils
comboDao
=
new
ComboItemDaoUtils
(
IActivity
);
comboDao
.
deleteAll
();
comboDao
.
insertMultCombo
(
combo
.
getData
());
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
}
});
}
public
void
downFoodModifier
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downFoodModifier
(
restaurantId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
FoodModifierRespone
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
}
saveToDatabase
(
result
.
getData
(),
downIndex
);
@Override
public
void
onNext
(
@NonNull
FoodModifierRespone
foodModifier
)
{
if
(
foodModifier
.
isSuccess
())
{
if
(
foodModifier
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FoodModifierDaoUtils
foodModifierDao
=
new
FoodModifierDaoUtils
(
IActivity
);
foodModifierDao
.
deleteAll
();
foodModifierDao
.
insertMultFoodModifier
(
foodModifier
.
getData
());
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
DataDownLoadState
loadState
=
mList
.
get
(
downIndex
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
down
Tag
);
mAapter
.
notifyItemChanged
(
down
Index
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
...
...
@@ -518,231 +225,178 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
down
Tag
);
DataDownLoadState
loadState
=
mList
.
get
(
down
Index
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
}
});
}
public
void
downDiscount
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downDiscount
(
restaurantId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
BaseResult
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
}
@Override
public
void
onNext
(
@NonNull
BaseResult
result
)
{
if
(
result
.
isSuccess
())
{
if
(
result
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
DiscountDaoUtils
discountDaoUtils
=
new
DiscountDaoUtils
(
IActivity
);
discountDaoUtils
.
deleteAll
();
List
<
Discount
>
discountList
=
JsonUtils
.
parseArray
(
result
.
getData
(),
Discount
.
class
);
if
(
discountList
!=
null
)
{
discountDaoUtils
.
insertMultDiscount
(
discountList
);
}
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
private
void
saveToDatabase
(
Object
data
,
int
downIndex
)
{
try
{
switch
(
downIndex
)
{
case
0
:
List
<
Function
>
functionList
=
GsonUtils
.
jsonToList
(
data
,
Function
.
class
);
if
(
functionList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FunctionDaoUtils
functionDao
=
new
FunctionDaoUtils
(
IActivity
);
functionDao
.
deleteAll
();
functionDao
.
insertMultFunction
(
functionList
);
}
});
XFunctionManager
.
newInstance
().
updateFunctions
(
functionList
);
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
break
;
case
1
:
List
<
Food
>
foodList
=
GsonUtils
.
jsonToList
(
data
,
Food
.
class
);
if
(
foodList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FoodDaoUtils
foodDao
=
new
FoodDaoUtils
(
IActivity
);
foodDao
.
deleteAll
();
foodDao
.
insertMultFood
(
foodList
);
}
});
}
});
}
public
void
downExpandInfo
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downExpandInfo
(
restaurantId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
BaseResult
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
break
;
case
2
:
List
<
Modifier
>
modifierList
=
GsonUtils
.
jsonToList
(
data
,
Modifier
.
class
);
if
(
modifierList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ModifierDaoUtils
modifierDao
=
new
ModifierDaoUtils
(
IActivity
);
modifierDao
.
deleteAll
();
modifierDao
.
insertMultModifier
(
modifierList
);
CommonConfiguration
.
getInstance
().
saveModifierTopIdConfiguration
(
modifierList
);
}
});
}
@Override
public
void
onNext
(
@NonNull
BaseResult
result
)
{
if
(
result
.
isSuccess
())
{
if
(
result
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ExpandInfoDaoUtils
expandInfoDaoUtils
=
new
ExpandInfoDaoUtils
(
IActivity
);
expandInfoDaoUtils
.
deleteAll
();
List
<
ExpandInfo
>
expandInfoList
=
JsonUtils
.
parseArray
(
result
.
getData
(),
ExpandInfo
.
class
);
if
(
expandInfoList
!=
null
)
{
expandInfoDaoUtils
.
insertMultExpandInfo
(
expandInfoList
);
RestaurantExpandInfoUtils
.
setCommonExpandInfo
(
expandInfoList
);
}
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
break
;
case
3
:
List
<
FoodCombo
>
foodComboList
=
GsonUtils
.
jsonToList
(
data
,
FoodCombo
.
class
);
if
(
foodComboList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FoodComboDaoUtils
comboDao
=
new
FoodComboDaoUtils
(
IActivity
);
comboDao
.
deleteAll
();
comboDao
.
insertMultCombo
(
foodComboList
);
CommonConfiguration
.
getInstance
().
saveComboIdConfiguration
(
foodComboList
);
}
});
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
break
;
case
4
:
List
<
ComboItem
>
comboItemList
=
GsonUtils
.
jsonToList
(
data
,
ComboItem
.
class
);
if
(
comboItemList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ComboItemDaoUtils
comboDao
=
new
ComboItemDaoUtils
(
IActivity
);
comboDao
.
deleteAll
();
comboDao
.
insertMultCombo
(
comboItemList
);
}
});
}
})
;
}
public
void
downPrinterList
(
int
downTag
)
{
int
restaurantId
=
RestaurantInfoManager
.
newInstance
().
getRestaurantId
();
mModel
.
downPrinterList
(
restaurantId
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
BaseResult
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
break
;
case
5
:
List
<
FoodModifier
>
foodModifierList
=
GsonUtils
.
jsonToList
(
data
,
FoodModifier
.
class
);
if
(
foodModifierList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
()
)
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
FoodModifierDaoUtils
foodModifierDao
=
new
FoodModifierDaoUtils
(
IActivity
);
foodModifierDao
.
deleteAll
();
foodModifierDao
.
insertMultFoodModifier
(
foodModifierList
);
}
}
);
}
@Override
public
void
onNext
(
@NonNull
BaseResult
result
)
{
if
(
result
.
isSuccess
())
{
if
(
result
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
IActivity
);
printerDeviceDaoUtils
.
deleteAll
();
PrinterListBean
printerListBean
=
JsonUtils
.
parseObject
(
result
.
getData
(),
PrinterListBean
.
class
);
if
(
printerListBean
!=
null
&&
printerListBean
.
getList
()
!=
null
)
{
printerDeviceDaoUtils
.
insertMultPrinterDeviceBean
(
printerListBean
.
getList
());
}
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
break
;
case
6
:
List
<
Discount
>
discountList
=
GsonUtils
.
jsonToList
(
data
,
Discount
.
class
);
if
(
discountList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
DiscountDaoUtils
discountDaoUtils
=
new
DiscountDaoUtils
(
IActivity
);
discountDaoUtils
.
deleteAll
();
discountDaoUtils
.
insertMultDiscount
(
discountList
);
}
});
}
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
break
;
case
7
:
List
<
ExpandInfo
>
expandInfoList
=
GsonUtils
.
jsonToList
(
data
,
ExpandInfo
.
class
);
if
(
expandInfoList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ExpandInfoDaoUtils
expandInfoDaoUtils
=
new
ExpandInfoDaoUtils
(
IActivity
);
expandInfoDaoUtils
.
deleteAll
();
expandInfoDaoUtils
.
insertMultExpandInfo
(
expandInfoList
);
RestaurantExpandInfoUtils
.
setCommonExpandInfo
(
expandInfoList
);
}
});
}
})
;
}
public
void
downColorList
(
int
downTag
)
{
mModel
.
downColorList
(
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mRootView
))
.
subscribe
(
new
ErrorHandleSubscriber
<
BaseResult
>(
mErrorHandler
)
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
super
.
onSubscribe
(
d
);
mDownDisposable
.
add
(
d
);
break
;
case
8
:
PrinterListBean
printerListBean
=
JsonUtils
.
parseObject
(
data
,
PrinterListBean
.
class
);
if
(
printerListBean
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
()
)
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
PrinterDeviceDaoUtils
printerDeviceDaoUtils
=
new
PrinterDeviceDaoUtils
(
IActivity
);
printerDeviceDaoUtils
.
deleteAll
();
printerDeviceDaoUtils
.
insertMultPrinterDeviceBean
(
printerListBean
.
getList
());
}
}
);
}
@Override
public
void
onNext
(
@NonNull
BaseResult
result
)
{
if
(
result
.
isSuccess
())
{
if
(
result
.
getData
()
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ColorDaoUtils
colorDaoUtils
=
new
ColorDaoUtils
(
IActivity
);
colorDaoUtils
.
deleteAll
();
List
<
ColorBean
>
colorBeanList
=
JsonUtils
.
parseArray
(
result
.
getData
(),
ColorBean
.
class
);
if
(
colorBeanList
!=
null
)
{
colorDaoUtils
.
insertMultColorBean
(
colorBeanList
);
}
}
});
}
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
2
);
mAapter
.
notifyItemChanged
(
downTag
);
currentProgress
+=
loadState
.
getRatio
();
IActivity
.
setTvProgress
(
currentProgress
);
responseSuccessCount
++;
if
(
responseSuccessCount
==
requestCount
)
{
endDownReturn
();
}
}
break
;
case
9
:
List
<
ColorBean
>
colorBeanList
=
GsonUtils
.
jsonToList
(
data
,
ColorBean
.
class
);
if
(
colorBeanList
!=
null
)
{
Observable
.
just
(
0
)
.
observeOn
(
Schedulers
.
io
())
.
subscribe
(
new
Consumer
<
Integer
>()
{
@Override
public
void
accept
(
@NonNull
Integer
integer
)
throws
Exception
{
ColorDaoUtils
colorDaoUtils
=
new
ColorDaoUtils
(
IActivity
);
colorDaoUtils
.
deleteAll
();
colorDaoUtils
.
insertMultColorBean
(
colorBeanList
);
}
});
}
break
;
}
}
catch
(
Exception
e
)
{
LoganManager
.
w_code
(
TAG
,
"下載異常="
+
e
.
getMessage
());
}
finally
{
@Override
public
void
onError
(
Throwable
t
)
{
super
.
onError
(
t
);
DataDownLoadState
loadState
=
mList
.
get
(
downTag
);
loadState
.
setState
(
0
);
mRootView
.
showMessage
(
"部分下載失敗,點擊刷新按鈕重新下載"
);
}
});
}
}
private
void
initDownState
()
{
for
(
int
i
=
0
;
i
<
mList
.
size
();
i
++)
{
//初始化下载状态
...
...
@@ -809,4 +463,12 @@ public class DownloadPresenter extends BasePresenter<DownloadContract.Model, Dow
}
}
public
void
stopDownDisposable
()
{
for
(
int
i
=
0
;
i
<
mDownDisposable
.
size
();
i
++)
{
if
(
mDownDisposable
.
get
(
i
)
!=
null
&&
!
mDownDisposable
.
get
(
i
).
isDisposed
())
{
mDownDisposable
.
get
(
i
).
dispose
();
}
}
mDownDisposable
.
clear
();
}
}
component-download/src/main/java/com/gingersoft/gsa/cloud/download/mvp/ui/activity/DownloadActivity.java
View file @
ef2056da
...
...
@@ -199,7 +199,6 @@ public class DownloadActivity extends BaseActivity<DownloadPresenter> implements
@Override
public
void
killMyself
()
{
mPresenter
.
stopDownDisposable
();
onBackPressed
();
}
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/BaseOrderPresenter.java
View file @
ef2056da
...
...
@@ -12,6 +12,7 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import
com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.common.core.user.UserContext
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.LanguageUtils
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
;
...
...
@@ -273,6 +274,8 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
double
wholeAmount
=
getFoodTotal
();
mShoppingCart
.
setWholeAmount
(
wholeAmount
);
LoganManager
.
w_tableMode
(
TAG
,
"合計金額="
+
wholeAmount
);
disposable
=
Observable
.
just
(
wholeAmount
)
.
subscribeOn
(
Schedulers
.
computation
())
/**
...
...
@@ -285,13 +288,14 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
int
serviceCharge
=
mDoshokuOrder
.
getOpenTableInfo
().
getServiceCharge
();
if
(
serviceCharge
>
0
)
{
ServiceChargeItem
item
=
new
ServiceChargeItem
(
serviceChargeStr
);
double
serviceChargeMoney
=
getServiceableAmout
();
totalAmount
=
item
.
updateBillItem
(
serviceChargeMoney
,
serviceCharge
);
if
(
Double
.
doubleToLongBits
(
item
.
getMoney
())
!=
0.0
)
{
mBillItemList
.
add
(
item
);
mShoppingCart
.
setServiceCharge
(
item
.
getMoney
());
}
LoganManager
.
w_tableMode
(
TAG
,
"服務費="
+
serviceChargeMoney
);
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CALCULATE
,
"服務費後總金額="
+
totalAmount
);
}
}
return
totalAmount
;
...
...
@@ -312,6 +316,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
if
(
orderDiscounts
!=
null
)
{
for
(
OrderDiscountResponse
orderDiscount
:
orderDiscounts
)
{
if
(
orderDiscount
.
getType
()
==
OrderDiscountRequest
.
ORDER_DISCOUNT
)
{
LoganManager
.
w_tableMode
(
TAG
,
"已下單整單折扣金額="
+
orderDiscount
.
getDiscountAmount
());
//整單折扣
Discount
discount
=
new
Discount
();
discount
.
setId
(
orderDiscount
.
getDiscountId
());
...
...
@@ -326,7 +331,9 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
if
(
memberInfo
!=
null
)
{
mShoppingCart
.
addMultyDiscount
(
mShoppingCart
.
createMemberDiscount
(
memberInfo
,
BillItem
.
BILL_ITEM_ORDER_SENT_STATUS
));
}
LoganManager
.
w_tableMode
(
TAG
,
"已下單會員折扣比例="
+
memberInfo
.
getMemberPoint
());
}
else
if
(
orderDiscount
.
getType
()
==
OrderDiscountRequest
.
COUPON_DISCOUNT
)
{
LoganManager
.
w_tableMode
(
TAG
,
"已下單優惠券折扣金額="
+
orderDiscount
.
getDiscountAmount
());
//優惠券折扣
CouponDiscountBean
couponDiscount
=
new
CouponDiscountBean
();
couponDiscount
.
setCouponTypeName1
(
orderDiscount
.
getRemark
());
...
...
@@ -345,9 +352,11 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
setOrderMealPasteDSMark
();
//計算折扣金額
double
discountableMoney
=
getDiscountableAmount
();
LoganManager
.
w_tableMode
(
TAG
,
"可折扣金額="
+
discountableMoney
);
if
(
mShoppingCart
.
getMultyDiscountList
().
size
()
>
0
)
{
//調用折扣鏈進行計算
totalAmount
=
MoneyUtil
.
sub
(
totalAmount
,
mShoppingCart
.
calculateLinkedDiscounts
(
discountableMoney
));
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CALCULATE
,
"賬單後總金額="
+
totalAmount
);
}
return
totalAmount
;
}
...
...
@@ -360,6 +369,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
public
Double
apply
(
Double
totalAmount
)
throws
Exception
{
double
roundingTotalAmount
=
getTotalAmountFilterByType
(
BillItem
.
ROUNDING_TYPE
);
if
(
roundingTotalAmount
>
0
)
{
LoganManager
.
w_tableMode
(
TAG
,
"賬單小數="
+
roundingTotalAmount
);
RoundingItem
item
=
new
RoundingItem
(
roundingStr
);
totalAmount
=
item
.
updateBillItem
(
roundingTotalAmount
);
if
(
Double
.
doubleToLongBits
(
item
.
getMoney
())
!=
0.0
)
{
...
...
@@ -382,6 +392,8 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
//刷新美食Item數據
mSelectMealAdapter
.
notifyDataSetChanged
();
LoganManager
.
w_tableMode
(
TAG
,
"總金額="
+
totalAmount
);
if
(
mOrderContentActivity
!=
null
)
{
mOrderContentActivity
.
initOrderBill
(
wholeAmount
,
totalAmount
);
}
...
...
@@ -454,13 +466,13 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
public
void
onRequestPermissionSuccess
()
{
String
title
=
null
;
if
(
IActivity
instanceof
MealStandActivity
)
{
title
=
"掃描會員碼"
;
title
=
"掃描會員碼"
;
}
else
if
(
IActivity
instanceof
OrderContentActivity
)
{
title
=
"掃描優惠券碼"
;
title
=
"掃描優惠券碼"
;
}
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_SCAN
)
.
setActionName
(
"openScanActivity"
)
.
addParam
(
"title"
,
title
)
.
addParam
(
"title"
,
title
)
.
build
()
.
callAsyncCallbackOnMainThread
((
cc
,
result
)
->
{
...
...
@@ -488,6 +500,9 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
}
OrderDetail
orderFood
=
mOrderMealList
.
get
(
mSelectMealAdapter
.
getSelect_full_start_position
());
OrderDetail
orderMainFood
=
mOrderMealList
.
get
(
mSelectMealAdapter
.
getMainStartPos
());
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_MODIFY
,
orderFood
.
getProductName
()
+
" 數量="
+
number
);
mShoppingCart
.
changeNumber
(
number
,
orderFood
,
orderMainFood
,
mSelectMealAdapter
.
getSelect_full_start_position
(),
mSelectMealAdapter
.
getSelect_full_end_position
(),
...
...
@@ -495,6 +510,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
@Override
public
void
achieveMaximum
(
String
name
)
{
String
msg
=
"["
+
name
+
"]"
+
"已售罄"
;
LoganManager
.
w_tableMode
(
TAG
,
msg
);
CommonTipDialog
.
showSurpisedDialog
(
IActivity
,
msg
,
null
,
null
,
null
,
null
,
null
);
}
});
...
...
@@ -948,7 +964,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
}
protected
CreateOrderRequest
getCreateOrderRequest
(
List
<
OrderDetail
>
foodList
)
{
List
<
OrderDetail
>
newFoodList
=
OrderDetail
.
transNewOrderDetails
(
foodList
);
List
<
OrderDetail
>
newFoodList
=
OrderDetail
.
transNewOrderDetails
(
foodList
);
if
(
RestaurantExpandInfoUtils
.
getValue
(
ExpandConstant
.
MergeSendFood
,
true
))
{
//合并未送单主食品
mergeMainFoodNumber
(
newFoodList
);
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/MealStandPresenter.java
View file @
ef2056da
...
...
@@ -14,6 +14,7 @@ import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.LanguageUtils
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
...
...
@@ -199,7 +200,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
this
.
mAppManager
=
null
;
this
.
mImageLoader
=
null
;
this
.
mApplication
=
null
;
if
(
mMealDiscountAction
!=
null
)
{
if
(
mMealDiscountAction
!=
null
)
{
mMealDiscountAction
.
destroy
();
}
}
...
...
@@ -317,6 +318,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if
(!
foodConditionFilter
(
datasBean
))
{
return
;
}
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_ADD
+
"食品【"
+
datasBean
.
getFoodName
()
+
"】"
);
RvMealClicked
=
false
;
if
(
datasBean
.
getIsParent
()
==
0
)
{
changedMealByParentId
(
datasBean
.
getId
());
...
...
@@ -343,6 +345,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
//已送單數量已等於最大數,不能繼續添加
return
;
}
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_ADD
+
"子食品【"
+
datasBean
.
getName
()
+
"】"
);
//设置当前操作的套餐细项
long
id
=
mCurrentOrderDetailBean
.
isNew
()
?
mCurrentOrderDetailBean
.
getProductId
()
:
mCurrentOrderDetailBean
.
getId
();
mCurrentOrderDetailBean
=
OrderDetail
.
comboTransOrderDetail
(
datasBean
,
id
,
mCurrentOrderDetailBean
.
getProductId
(),
1
,
OrderDetail
.
COMBO_PROP
,
RvMealClicked
);
...
...
@@ -375,6 +378,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
//已送單數量已等於最大數,不能繼續添加
return
;
}
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_ADD
+
"細項【"
+
datasBean
.
getName
()
+
"】"
);
// if (datasBean.isModKeyboard()) {
// addModalKeyBoardModfier(datasBean.getModifier());
// displayModalKeyBoardDialog();
...
...
@@ -401,6 +405,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if
(!
discountConditionFilter
(
discountBean
))
{
return
;
}
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_ADD
+
"折扣【"
+
discountBean
.
getRemark
()
+
"】"
);
// if (cutOutDiscount() == -100) {
// return;
// }
...
...
@@ -890,13 +895,13 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
mergeMainFoodNumber
(
mOrderMealList
);
}
PrintContent
printContent
=
new
PrintContentAdapter
().
adaptationServingPaperContent
(
DoshokuOrder
.
getInstance
(),
mTableInfo
);
PrintContent
printContent
=
new
PrintContentAdapter
().
adaptationServingPaperContent
(
DoshokuOrder
.
getInstance
(),
mTableInfo
);
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_PRINT
)
.
setActionName
(
"printActivity"
)
.
addParam
(
PrintConstans
.
PRINT_TYPE
,
PrintConstans
.
PRINT_SERVE
)
.
addParam
(
PrintConstans
.
PRINT_CONTENT
,
printContent
)
.
addParam
(
PrintConstans
.
PRINT_ORDER_NO
,
DoshokuOrder
.
getInstance
().
getOrderNo
())
.
addParam
(
PrintConstans
.
PRINT_CONTENT
,
printContent
)
.
addParam
(
PrintConstans
.
PRINT_ORDER_NO
,
DoshokuOrder
.
getInstance
().
getOrderNo
())
.
build
()
.
callAsyncCallbackOnMainThread
((
cc
,
result
)
->
{
if
(
result
.
isSuccess
())
{
...
...
@@ -1062,6 +1067,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
mCancelFoodDialog
.
build
().
dismiss
();
mCancelFoodDialog
=
null
;
}
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
+
"確刪除"
);
markDeleteFood
(
maxNumber
,
deleteNumber
,
reasonId
,
reason
);
});
dialogBuilder
.
addAction
(
"取消"
,
(
dialog
,
index
)
->
dialog
.
dismiss
());
...
...
@@ -1074,6 +1080,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
mCancelFoodDialog
.
setOnClickListener
(
new
CancelFoodDialog
.
OnClickListener
()
{
@Override
public
void
onItemClick
(
FoodReason
item
,
int
position
,
int
deleteNumber
)
{
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
+
"刪除原因="
+
item
.
getContent
());
showDeleteFoodDialog
(
deleteFood
.
getNumber
(),
deleteNumber
,
item
.
getId
(),
item
.
getContent
());
}
});
...
...
@@ -1113,12 +1120,15 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if
(!
deleteFood
.
isNew
())
{
//TODO 刪除已下單食品
if
(!
deleteFood
.
isModify
())
{
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
+
"刪除已下單食品【"
+
deleteFood
.
getRemark
()
+
"】"
);
deleteWithOrderedFood
(
deleteFood
);
}
}
else
{
if
(
deleteStyle
==
2
)
{
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_LONG_CLICK
+
"刪除【"
+
deleteFood
.
getRemark
()
+
"】"
);
mSelectMealAdapter
.
removeAllNewFoodItem
();
}
else
{
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
+
"刪除【"
+
deleteFood
.
getRemark
()
+
"】"
);
int
deletePosition
=
mSelectMealAdapter
.
removeFoodItem
();
mRootView
.
setMealRvScrollToPosition
(
deletePosition
);
//更新最大可選數
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/OrderContentPresenter.java
View file @
ef2056da
...
...
@@ -17,6 +17,7 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import
com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.common.core.table.TableExtBean
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
import
com.gingersoft.gsa.cloud.component.ComponentName
;
...
...
@@ -174,6 +175,8 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
@Override
public
void
onItemClick
(
View
v
,
Function
function
)
{
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
,
function
.
getResName
());
mRootView
.
recordOperat
(
true
);
switch
(
function
.
getResName
())
{
...
...
@@ -234,6 +237,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
@Override
public
boolean
onItemLongClick
(
View
v
,
Function
datasBean
)
{
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_LONG_CLICK
,
datasBean
.
getResName
());
if
(
datasBean
.
getResName
().
equals
(
"印單"
)
||
datasBean
.
getResName
().
equals
(
"送單"
))
{
PrinterUtils
.
switchPrintMethod
(
IActivity
,
datasBean
,
mOrderTopFunctionAdapter
);
}
...
...
@@ -683,7 +687,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
updateBillInfo
();
IActivity
.
backPressed
();
}
else
{
mRootView
.
showMessage
(
"獲取訂單數據失敗"
);
mRootView
.
showMessage
(
info
.
getErrMsg
()
);
}
}
});
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/OrderPayPresenter.java
View file @
ef2056da
...
...
@@ -8,6 +8,7 @@ import com.gingersoft.gsa.cloud.common.constans.FoodSummaryConstans;
import
com.gingersoft.gsa.cloud.common.constans.HttpsConstans
;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.JsonUtils
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
;
...
...
@@ -180,10 +181,12 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
}
}
}
LoganManager
.
w_pay
(
TAG
,
"支付成功"
);
mRootView
.
showMessage
(
"支付成功"
);
//結賬成功
mRootView
.
paySuccess
();
}
else
{
LoganManager
.
w_pay
(
TAG
,
"支付失敗="
+
baseResult
.
getErrMsg
());
mRootView
.
showMessage
(
baseResult
.
getErrMsg
());
}
}
...
...
@@ -267,8 +270,11 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
@Override
public
void
onNext
(
BaseResult
baseResult
)
{
if
(
baseResult
.
isSuccess
())
{
LoganManager
.
w_pay
(
TAG
,
"修改訂單支付成功"
);
//結賬成功
mRootView
.
paySuccess
();
}
else
{
LoganManager
.
w_pay
(
TAG
,
"修改訂單支付失敗="
+
baseResult
.
getErrMsg
());
}
}
});
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/MealStandActivity.java
View file @
ef2056da
...
...
@@ -41,6 +41,7 @@ import com.gingersoft.gsa.cloud.common.constans.MealConstant;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
;
import
com.gingersoft.gsa.cloud.common.core.table.TableBean
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.scan.ScanHelper
;
import
com.gingersoft.gsa.cloud.common.utils.LanguageUtils
;
import
com.gingersoft.gsa.cloud.common.utils.VibratorUtils
;
...
...
@@ -593,6 +594,7 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
showMessage
(
"此食品不能參與折扣!"
);
return
;
}
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
+
"食品折扣"
);
//更新折扣数据
mPresenter
.
loadDiscountData
();
...
...
@@ -604,6 +606,7 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
if
(
BaseOrder
.
isCurrentOrderType
(
FoodSummaryConstans
.
TAKEAWAY_TYPE
))
{
return
;
}
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
+
"餐檯名稱"
);
//type取值:1:qrCdoetype,2:手機號,3:memberId
if
(
mUseMemberDialog
==
null
)
{
mUseMemberDialog
=
new
UseMemberDialog
(
this
)
...
...
@@ -703,11 +706,13 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
@OnClick
(
R2
.
id
.
btn_select_all
)
void
onClickSelectAll
()
{
LoganManager
.
w_tableMode
(
TAG
,
"全選食品"
);
mPresenter
.
setSelectAll
();
}
@OnClick
(
R2
.
id
.
btn_anti_selection
)
void
onClickAntiSelection
()
{
LoganManager
.
w_tableMode
(
TAG
,
"反選食品"
);
mPresenter
.
setAntiSelect
();
}
...
...
@@ -716,6 +721,10 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
R2
.
id
.
btn_taste
,
R2
.
id
.
btn_msg
,
R2
.
id
.
btn_delete
,
R2
.
id
.
btn_end
,
R2
.
id
.
iv_fine_back
})
public
void
onClick
(
View
v
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
,
v
.
getTransitionName
());
}
recordOperat
(
true
);
//防抖處理
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/OrderPayActivity.java
View file @
ef2056da
...
...
@@ -181,6 +181,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
gsaPayView
.
setOnSelectPayClickLisenter
(
new
OrderPayView
.
OnSelectPayClickLisenter
()
{
@Override
public
void
addClick
(
PayMethod
method
)
{
LoganManager
.
w_pay
(
TAG
,
LoganManager
.
EVENT_ADD
,
"支付方式="
+
method
.
getPayName
());
if
(
method
.
getPayType
()
==
PayMethod
.
PAY_TYPE_INTEGRAL
)
{
updateMemberInfo
();
}
...
...
@@ -188,6 +189,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
@Override
public
void
delClick
(
PayMethod
method
)
{
LoganManager
.
w_pay
(
TAG
,
LoganManager
.
EVENT_DELETE
,
"支付方式="
+
method
.
getPayName
());
if
(
method
.
getPayType
()
==
PayMethod
.
PAY_TYPE_INTEGRAL
)
{
updateMemberInfo
();
}
...
...
@@ -201,6 +203,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
gsaPayView
.
setOnFreeServiceStatusChangeLisenter
(
new
OrderPayView
.
OnFreeServiceStatusChangeLisenter
()
{
@Override
public
void
onFreeServiceStautsChange
(
boolean
isUseFreeServicePayMethod
)
{
LoganManager
.
w_pay
(
TAG
,
"是否選中免服務費支付方式="
+
isUseFreeServicePayMethod
);
mPresenter
.
setFreeServiceStauts
(
isUseFreeServicePayMethod
);
}
});
...
...
@@ -234,6 +237,8 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
double
wholeAmount
=
mPresenter
.
getFoodTotal
();
tv_whole
.
setText
(
"合計 $"
+
wholeAmount
);
LoganManager
.
w_pay
(
TAG
,
"合計金額="
+
wholeAmount
);
DoshokuOrder
.
getInstance
().
getShoppingCart
().
setWholeAmount
(
wholeAmount
);
}
...
...
@@ -397,7 +402,6 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
public
void
onClick
(
QMUIDialog
dialog
,
int
index
)
{
dialog
.
dismiss
();
recordOperat
(
true
);
}
});
}
...
...
@@ -410,7 +414,6 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
public
void
onClick
(
QMUIDialog
dialog
,
int
index
)
{
dialog
.
dismiss
();
recordOperat
(
true
);
}
});
dialogBuilder
.
create
(
R
.
style
.
QMUI_Dialog
).
show
();
...
...
@@ -466,7 +469,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
.
callAsyncCallbackOnMainThread
(
new
IComponentCallback
()
{
@Override
public
void
onResult
(
CC
cc
,
CCResult
result
)
{
LoganManager
.
w_
tableMode
(
TAG
,
"printOpenInstructionAndBill "
+
"是否成功
:"
+
result
.
isSuccess
());
LoganManager
.
w_
pay
(
TAG
,
"開錢箱結果
:"
+
result
.
isSuccess
());
mAppManager
.
killActivity
(
"PrintActivity"
);
}
});
...
...
@@ -495,7 +498,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
.
callAsyncCallbackOnMainThread
(
new
IComponentCallback
()
{
@Override
public
void
onResult
(
CC
cc
,
CCResult
result
)
{
LoganManager
.
w_
tableMode
(
TAG
,
"printBill "
+
"是否成功打印
:"
+
result
.
isSuccess
());
LoganManager
.
w_
pay
(
TAG
,
"結賬單打印結果
:"
+
result
.
isSuccess
());
printEndBack
();
}
});
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/TableActivity.java
View file @
ef2056da
...
...
@@ -224,7 +224,6 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
rightButton2
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
LoganManager
.
w_tableMode
(
TAG
,
"跳轉數據下載頁"
);
CC
.
obtainBuilder
(
ComponentName
.
COMPONENT_DOWNLOAD
)
.
setActionName
(
"showDownloadActivity"
)
.
addParam
(
"fromPage"
,
2
)
...
...
@@ -321,11 +320,11 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
public
void
longClickSkyorder
()
{
boolean
state
=
mPresenter
.
setSkyorderMode
();
if
(
state
)
{
LoganManager
.
w_tableMode
(
TAG
,
"長按
鎖定Skyorder模式"
);
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_LONG_CLICK
,
"
鎖定Skyorder模式"
);
mTopBar
.
setTitle
(
"打印skyorder"
);
mPresenter
.
openSkyorderMode
();
}
else
{
LoganManager
.
w_tableMode
(
TAG
,
"長按
解鎖Skyorder模式"
);
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_LONG_CLICK
,
"
解鎖Skyorder模式"
);
canceTableAction
();
}
setLockVisibility
(
state
);
...
...
@@ -334,7 +333,7 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
@OnClick
(
R2
.
id
.
rl_skyorder
)
public
void
clickSkyorder
()
{
LoganManager
.
w_tableMode
(
TAG
,
"點擊Skyorder按鈕
"
);
LoganManager
.
w_tableMode
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"Skyorder
"
);
TableAction
tableAction
=
mPresenter
.
getTableActionByClass
(
PrintSkyorderAction
.
class
);
if
(
tableAction
!=
null
)
{
mPresenter
.
setTableAction
(
tableAction
);
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/activity/orderManager/OrderCenterActivity.java
View file @
ef2056da
package
com
.
gingersoft
.
gsa
.
cloud
.
table
.
mvp
.
ui
.
activity
.
orderManager
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Message
;
import
android.view.View
;
...
...
@@ -15,6 +16,7 @@ import androidx.core.content.ContextCompat;
import
androidx.fragment.app.Fragment
;
import
androidx.viewpager.widget.ViewPager
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.order.contract.OrderStatusContract
;
import
com.gingersoft.gsa.cloud.pay.pos.fragment.PosActionStatusExceptionFragment
;
import
com.gingersoft.gsa.cloud.table.R
;
...
...
@@ -144,6 +146,10 @@ 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
().
getCheckedOrderBean
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
LoganManager
.
w_order
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"按鈕:"
+
v
.
getTransitionName
());
}
LoganManager
.
w_order
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"操作訂單:"
+
orderItem
.
getOrderNo
());
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 @
ef2056da
package
com
.
gingersoft
.
gsa
.
cloud
.
table
.
mvp
.
ui
.
activity
.
orderManager
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.Log
;
...
...
@@ -217,6 +218,9 @@ public class OrderDetailActivity extends BaseFragmentActivity<OrderDetailPresent
@OnClick
({
R2
.
id
.
btn_print_order
,
R2
.
id
.
btn_cancel_order
,
R2
.
id
.
btn_modify_order
,
R2
.
id
.
btn_tips
,
R2
.
id
.
btn_refund
})
public
void
onClick
(
View
v
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
LoganManager
.
w_order
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"按鈕:"
+
v
.
getTransitionName
());
}
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
btn_print_order
)
{
mPresenter
.
printOrder
(
this
,
mOrderDetailItem
);
...
...
component-table/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/widget/CancelFoodDialog.java
View file @
ef2056da
...
...
@@ -21,6 +21,7 @@ import com.google.android.flexbox.FlexWrap;
import
com.google.android.flexbox.FlexboxLayoutManager
;
import
com.google.android.flexbox.JustifyContent
;
import
com.google.android.material.slider.Slider
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.qmuiteam.qmui.layout.QMUILinearLayout
;
import
com.qmuiteam.qmui.util.QMUIDisplayHelper
;
import
com.qmuiteam.qmui.widget.QMUIEmptyView
;
...
...
@@ -148,6 +149,7 @@ public class CancelFoodDialog extends BaseRetryDialog implements Slider.OnSlider
btn_all_number
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
mCurrCancelNumber
=
mMaxCancelNumber
;
slider_food_count
.
setValue
(
mMaxCancelNumber
);
}
});
...
...
@@ -161,7 +163,7 @@ public class CancelFoodDialog extends BaseRetryDialog implements Slider.OnSlider
public
void
initParmas
()
{
mCurrCancelNumber
=
1
;
tv_number_value
.
setText
(
String
.
valueOf
(
mCurrCancelNumber
));
slider_food_count
.
setValueFrom
(
mCurrCancelNumber
);
slider_food_count
.
setValueFrom
(
0
);
slider_food_count
.
setValueTo
(
mMaxCancelNumber
);
slider_food_count
.
setValue
(
mCurrCancelNumber
);
}
...
...
@@ -176,6 +178,10 @@ public class CancelFoodDialog extends BaseRetryDialog implements Slider.OnSlider
mAdapter
=
new
FoodReasonAdapter
(
mItems
);
}
mAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
if
(
mCurrCancelNumber
==
0
)
{
ArmsUtils
.
makeText
(
mContext
,
"請選擇取消數量"
);
return
;
}
if
(
onClickListener
!=
null
)
{
onClickListener
.
onItemClick
(
mItems
.
get
(
position
),
position
,
getInputNumber
());
}
...
...
@@ -225,13 +231,12 @@ public class CancelFoodDialog extends BaseRetryDialog implements Slider.OnSlider
@Override
public
void
onStartTrackingTouch
(
@NonNull
Slider
slider
)
{
mCurrCancelNumber
=
1
;
tv_number_value
.
setText
(
String
.
valueOf
(
slider
.
getValue
()));
}
@Override
public
void
onStopTrackingTouch
(
@NonNull
Slider
slider
)
{
mCurrCancelNumber
=
(
int
)
slider
.
getValue
();
tv_number_value
.
setText
(
String
.
valueOf
(
mCurrCancelNumber
));
}
public
interface
OnClickListener
{
...
...
component-table/src/main/res/layout/table_dialog_cancel_food.xml
View file @
ef2056da
...
...
@@ -69,19 +69,14 @@
android:layout_margin=
"@dimen/dp_8"
android:orientation=
"vertical"
>
<!-- <com.google.android.material.slider.Slider-->
<!-- android:id="@+id/slider_food_count"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:qmui_slider_bar_progress_color="@color/theme_color" />-->
<com.google.android.material.slider.Slider
android:id=
"@+id/slider_food_count"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:theme=
"@style/
ThemeOverlay.PrimaryPalette.Red
"
android:theme=
"@style/
SliderStyle
"
android:valueFrom=
"0"
android:valueTo=
"11"
android:value=
"1"
android:stepSize=
"1"
/>
<TextView
...
...
component-table/src/main/res/values/styles.xml
View file @
ef2056da
...
...
@@ -8,8 +8,8 @@
<item
name=
"colorAccent"
>
@color/table_colorAccent
</item>
</style>
<style
name=
"ThemeOverlay.PrimaryPalette.Red"
parent=
""
>
<item
name=
"colorPrimary"
>
#e53935
</item
>
<item
name=
"colorPrimaryDark"
>
#ab000d
</item
>
</style
>
<!-- <style name="ThemeOverlay.PrimaryPalette.Red" parent="">--
>
<!-- <item name="colorPrimary">#e53935</item>--
>
<!-- <item name="colorPrimaryDark">#ab000d</item>--
>
<!-- </style>--
>
</resources>
library-common/src/main/java/com/gingersoft/gsa/cloud/common/logan/LoganManager.java
View file @
ef2056da
...
...
@@ -68,31 +68,52 @@ public class LoganManager {
private
static
final
String
ORDER_BUSINESS_TAG
=
"order-> "
;
private
static
final
String
PAY_BUSINESS_TAG
=
"pay-> "
;
public
static
void
w_database
(
String
TAG
,
String
log
)
{
Logan
.
w
(
DATABASE_BUSINESS_TAG
+
log
,
LoganConfig
.
CODE_LEVLE
);
if
(
BuildConfig
.
DEBUG
)
{
printLog
(
TAG
,
log
);
}
/*******************************交互事件類型**************************************/
public
static
final
String
EVENT_CLICK
=
"點擊->"
;
public
static
final
String
EVENT_LONG_CLICK
=
"長按->"
;
public
static
final
String
EVENT_TOUCH
=
"觸摸->"
;
public
static
final
String
EVENT_SCOLL
=
"滑動->"
;
public
static
final
String
EVENT_RETRY
=
"重試加載->"
;
public
static
final
String
EVENT_PULL_DOWN
=
"下拉刷新->"
;
public
static
final
String
EVENT_PULL_UP
=
"上拉加載->"
;
/*******************************業務事件類型**************************************/
public
static
final
String
EVENT_CALCULATE
=
"計算->"
;
public
static
final
String
EVENT_ADD
=
"添加->"
;
public
static
final
String
EVENT_DELETE
=
"刪除->"
;
public
static
final
String
EVENT_MODIFY
=
"修改->"
;
public
static
final
String
EVENT_QUERY
=
"查詢->"
;
public
static
void
w_database
(
String
TAG
,
String
...
eventAndLog
)
{
w_business
(
DATABASE_BUSINESS_TAG
,
TAG
,
eventAndLog
);
}
public
static
void
w_printer
(
String
TAG
,
String
log
)
{
Logan
.
w
(
PRINTER_BUSINESS_TAG
+
log
,
LoganConfig
.
CODE_LEVLE
);
printLog
(
TAG
,
log
);
public
static
void
w_printer
(
String
TAG
,
String
...
eventAndLog
)
{
w_business
(
PRINTER_BUSINESS_TAG
,
TAG
,
eventAndLog
);
}
public
static
void
w_tableMode
(
String
TAG
,
String
log
)
{
Logan
.
w
(
TABLEMODE_BUSINESS_TAG
+
log
,
LoganConfig
.
CODE_LEVLE
);
printLog
(
TAG
,
log
);
public
static
void
w_tableMode
(
String
TAG
,
String
...
eventAndLog
)
{
w_business
(
TABLEMODE_BUSINESS_TAG
,
TAG
,
eventAndLog
);
}
public
static
void
w_order
(
String
TAG
,
String
log
)
{
Logan
.
w
(
ORDER_BUSINESS_TAG
+
log
,
LoganConfig
.
CODE_LEVLE
);
printLog
(
TAG
,
log
);
public
static
void
w_order
(
String
TAG
,
String
...
eventAndLog
)
{
w_business
(
ORDER_BUSINESS_TAG
,
TAG
,
eventAndLog
);
}
public
static
void
w_pay
(
String
TAG
,
String
log
)
{
Logan
.
w
(
PAY_BUSINESS_TAG
+
log
,
LoganConfig
.
CODE_LEVLE
);
printLog
(
TAG
,
log
);
public
static
void
w_pay
(
String
TAG
,
String
...
eventAndLog
)
{
w_business
(
PAY_BUSINESS_TAG
,
TAG
,
eventAndLog
);
}
private
static
void
w_business
(
String
BUSINESS_TAG
,
String
TAG
,
String
...
eventAndLog
)
{
if
(
eventAndLog
!=
null
)
{
if
(
eventAndLog
.
length
>
1
)
{
Logan
.
w
(
BUSINESS_TAG
+
eventAndLog
[
0
]
+
eventAndLog
[
1
],
LoganConfig
.
CODE_LEVLE
);
printLog
(
TAG
,
eventAndLog
[
0
]
+
eventAndLog
[
1
]);
}
else
{
Logan
.
w
(
BUSINESS_TAG
+
eventAndLog
[
0
],
LoganConfig
.
CODE_LEVLE
);
printLog
(
TAG
,
eventAndLog
[
0
]);
}
}
}
private
static
void
printLog
(
String
TAG
,
String
log
)
{
...
...
library-common/src/main/res/values-v21/styles.xml
View file @
ef2056da
...
...
@@ -12,4 +12,10 @@
<item
name=
"android:colorControlNormal"
>
@color/theme_color
</item>
<item
name=
"android:colorControlActivated"
>
@color/color_c9
</item>
</style>
<style
name=
"SliderStyle"
parent=
"Theme.MaterialComponents.NoActionBar"
>
<item
name=
"colorPrimary"
>
@color/colorPrimary
</item>
<item
name=
"colorPrimaryDark"
>
@color/colorPrimaryDark
</item>
</style>
</resources>
\ No newline at end of file
library-common/src/main/res/values-v21/styles.xml~
deleted
100644 → 0
View file @
2194c6e3
File deleted
library-common/src/main/res/values/styles.xml
View file @
ef2056da
...
...
@@ -14,11 +14,6 @@
<item
name=
"android:backgroundDimEnabled"
>
true
</item>
<!--背景遮罩效果-->
</style>
<!-- <style name="AppTheme" parent="PublicTheme">-->
<!-- <item name="QMUITopBarStyle">@style/QDTopBar</item>-->
<!-- <item name="QMUITabSegmentStyle">@style/QMUITabSegmentStyle</item>-->
<!-- </style>-->
<style
name=
"PublicTheme"
parent=
"QMUI.Compat.NoActionBar"
>
...
...
@@ -151,17 +146,16 @@
<style
name=
"QMUITabSegmentStyle"
parent=
"QMUI.TabSegment"
>
<item
name=
"qmui_skin_support_tab_bg"
>
@color/qmui_config_color_white
</item>
<item
name=
"qmui_skin_support_tab_separator_color"
>
?attr/qmui_skin_support_color_separator
</item>
<item
name=
"qmui_skin_support_tab_separator_color"
>
?attr/qmui_skin_support_color_separator
</item>
<item
name=
"qmui_skin_support_tab_normal_color"
>
@color/normal_color
</item>
<item
name=
"qmui_skin_support_tab_selected_color"
>
@color/theme_color
</item>
<item
name=
"qmui_skin_support_tab_sign_count_view_text_color"
>
@color/qmui_config_color_white
</item>
<item
name=
"qmui_skin_support_tab_sign_count_view_bg_color"
>
?attr/qmui_config_color_red
</item>
<item
name=
"qmui_skin_support_tab_sign_count_view_text_color"
>
@color/qmui_config_color_white
</item>
<item
name=
"qmui_skin_support_tab_sign_count_view_bg_color"
>
?attr/qmui_config_color_red
</item>
</style>
<attr
name=
"MaterialComponentsStyle"
format=
"reference"
/>
<style
name=
"MaterialComponentsStyle"
parent=
"Widget.MaterialComponents.Slider"
/>
<style
name=
"QDRoundButtonStyle"
parent=
"@style/Button.Compat"
>
<item
name=
"android:layout_height"
>
40dp
</item>
<item
name=
"android:layout_width"
>
wrap_content
</item>
...
...
library-ui/src/main/java/com/gingersoft/gsa/cloud/ui/view/OrderPayView.java
View file @
ef2056da
...
...
@@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
import
com.gingersoft.gsa.cloud.app.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.common.core.member.MemberInfo
;
import
com.gingersoft.gsa.cloud.common.logan.LoganManager
;
import
com.gingersoft.gsa.cloud.common.utils.LanguageUtils
;
import
com.gingersoft.gsa.cloud.common.utils.MoneyUtil
;
import
com.gingersoft.gsa.cloud.common.utils.VibratorUtils
;
...
...
@@ -31,6 +32,7 @@ import java.util.List;
public
class
OrderPayView
extends
LinearLayout
{
private
final
String
TAG
=
this
.
getClass
().
getSimpleName
();
private
Context
mContext
;
/**
...
...
@@ -217,6 +219,7 @@ public class OrderPayView extends LinearLayout {
@Override
public
void
onItemClick
(
PayMethod
datasBean
,
int
position
)
{
LoganManager
.
w_pay
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"支付方式="
+
datasBean
.
getPayName
());
recordOperat
(
context
);
mBillMoneyAdapter
.
setSelect_position
(
position
);
mBillMoneyAdapter
.
notifyDataSetChanged
();
...
...
@@ -246,6 +249,7 @@ public class OrderPayView extends LinearLayout {
//Exact
view
.
findViewById
(
R
.
id
.
btn_exact
).
setOnClickListener
(
v
->
{
LoganManager
.
w_pay
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"Exact"
);
PayMethod
selectPayMethod
=
getSelectBillMoney
();
if
(
selectPayMethod
==
null
)
{
ToastUtils
.
show
(
context
,
"請選擇支付方式"
);
...
...
@@ -260,6 +264,7 @@ public class OrderPayView extends LinearLayout {
//sure
view
.
findViewById
(
R
.
id
.
btn_sure_pay
).
setOnClickListener
(
v
->
{
LoganManager
.
w_pay
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"確認支付"
);
if
(
mBillMoneyList
.
size
()
==
0
)
{
ToastUtils
.
show
(
context
,
"請選擇支付方式"
);
return
;
...
...
@@ -275,6 +280,7 @@ public class OrderPayView extends LinearLayout {
//Keypad
view
.
findViewById
(
R
.
id
.
layout_keypad
).
setOnClickListener
(
v
->
{
LoganManager
.
w_pay
(
TAG
,
LoganManager
.
EVENT_CLICK
,
"Keypad"
);
PayMethod
payMethod
=
getSelectBillMoney
();
if
(
payMethod
==
null
)
{
ToastUtils
.
show
(
context
,
"請選擇支付方式"
);
...
...
@@ -625,7 +631,7 @@ public class OrderPayView extends LinearLayout {
public
void
makeUpDifference
()
{
//補齊差價
double
difference
=
getDifferenceMoney
();
if
(
difference
>
0
)
{
if
(
difference
>
0
)
{
method
.
setPayMoney
(
difference
);
mBillMoneyAdapter
.
notifyDataSetChanged
();
setDifferenceText
(
context
);
...
...
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