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
2da52ed5
Commit
2da52ed5
authored
Apr 25, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.25 接單已完成
parent
c9784e1c
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
65 additions
and
53 deletions
+65
-53
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
+4
-4
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/HistoryOrderViewModel.kt
+4
-2
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
+15
-11
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/service/GetInfoUpdateService.kt
+20
-14
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/HistoryOrderActivity.kt
+1
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
+9
-2
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
+6
-2
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
+2
-2
print-module/src/main/java/com/joe/print/mvp/ui/adapter/OtherOrderAdapter.java
+4
-2
public-base/src/main/java/com/gingersoft/gsa/cloud/base/utils/CommonConfiguration.java
+0
-5
public-base/src/main/java/com/gingersoft/gsa/cloud/ui/view/SwitchButton.java
+0
-8
No files found.
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
View file @
2da52ed5
...
@@ -8,9 +8,9 @@ import okhttp3.FormBody
...
@@ -8,9 +8,9 @@ import okhttp3.FormBody
class
WeatherRepository
private
constructor
(
private
val
network
:
CoolWeatherNetwork
)
{
class
WeatherRepository
private
constructor
(
private
val
network
:
CoolWeatherNetwork
)
{
suspend
fun
requestOrderList
(
status
:
String
,
type
:
String
,
page
:
String
,
orderNo
:
String
,
phone
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
requestOrderList
(
restaurantId
:
String
,
status
:
String
,
type
:
String
,
page
:
String
,
orderNo
:
String
,
phone
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
val
requestBody
=
FormBody
.
Builder
()
val
requestBody
=
FormBody
.
Builder
()
.
add
(
"restaurantId"
,
"26"
)
.
add
(
"restaurantId"
,
restaurantId
)
.
add
(
"page"
,
page
)
.
add
(
"page"
,
page
)
.
add
(
"status"
,
status
)
.
add
(
"status"
,
status
)
.
add
(
"orderNo"
,
orderNo
)
.
add
(
"orderNo"
,
orderNo
)
...
@@ -21,9 +21,9 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
...
@@ -21,9 +21,9 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
heWeather
heWeather
}
}
suspend
fun
updateRestOpenStatus
(
state
:
Boolean
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
updateRestOpenStatus
(
state
:
Boolean
,
restaurantId
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
val
requestBody
=
FormBody
.
Builder
()
val
requestBody
=
FormBody
.
Builder
()
.
add
(
"restId"
,
"26"
)
.
add
(
"restId"
,
restaurantId
)
.
add
(
"openStatus"
,
if
(
state
)
"1"
else
"2"
)
.
add
(
"openStatus"
,
if
(
state
)
"1"
else
"2"
)
.
build
()
.
build
()
val
data
=
network
.
updateRestOpenStatus
(
requestBody
)
val
data
=
network
.
updateRestOpenStatus
(
requestBody
)
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/HistoryOrderViewModel.kt
View file @
2da52ed5
package
com.gingersoft.gsa.other_order_mode.model.viewModel
package
com.gingersoft.gsa.other_order_mode.model.viewModel
import
android.content.Context
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
import
androidx.lifecycle.viewModelScope
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import
com.gingersoft.gsa.cloud.print.bean.OrderDetails
import
com.gingersoft.gsa.cloud.print.bean.OrderDetails
import
com.gingersoft.gsa.other_order_mode.data.HistoryOrderRepository
import
com.gingersoft.gsa.other_order_mode.data.HistoryOrderRepository
import
com.gingersoft.gsa.other_order_mode.data.model.bean.HistoryOrderBean
import
com.gingersoft.gsa.other_order_mode.data.model.bean.HistoryOrderBean
...
@@ -14,7 +16,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
...
@@ -14,7 +16,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
/**
/**
* 根據訂單id獲取訂單詳細信息
* 根據訂單id獲取訂單詳細信息
*/
*/
fun
getHistoryOrderList
(
pageIndex
:
String
,
orderNum
:
String
=
""
,
listener
:
(
HistoryOrderBean
)
->
Unit
)
{
fun
getHistoryOrderList
(
context
:
Context
,
pageIndex
:
String
,
orderNum
:
String
=
""
,
listener
:
(
HistoryOrderBean
)
->
Unit
)
{
launch
({
launch
({
var
phone
=
""
var
phone
=
""
var
orderNumber
=
""
var
orderNumber
=
""
...
@@ -24,7 +26,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
...
@@ -24,7 +26,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
orderNumber
=
orderNum
orderNumber
=
orderNum
}
}
historyOrderRepository
.
getHistoryOrderList
(
"26"
,
"4"
,
pageIndex
,
"10"
,
orderNumber
,
phone
).
apply
{
historyOrderRepository
.
getHistoryOrderList
(
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
()
,
"4"
,
pageIndex
,
"10"
,
orderNumber
,
phone
).
apply
{
this
.
getData
()
?.
let
{
this
.
getData
()
?.
let
{
if
(
it
.
size
>
0
)
{
if
(
it
.
size
>
0
)
{
it
.
removeAt
(
it
.
size
-
1
)
it
.
removeAt
(
it
.
size
-
1
)
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
View file @
2da52ed5
...
@@ -12,6 +12,7 @@ import androidx.lifecycle.viewModelScope
...
@@ -12,6 +12,7 @@ import androidx.lifecycle.viewModelScope
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
com.billy.cc.core.component.CC
import
com.billy.cc.core.component.CC
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import
com.gingersoft.gsa.cloud.base.widget.DialogUtils
import
com.gingersoft.gsa.cloud.base.widget.DialogUtils
...
@@ -50,9 +51,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -50,9 +51,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
/**
* 獲取訂單信息
* 獲取訂單信息
*/
*/
fun
getOrderList
(
position
:
Int
,
page
:
String
,
isLoadMore
:
Boolean
,
listener
:
(
String
)
->
Unit
)
{
fun
getOrderList
(
context
:
Context
,
position
:
Int
,
page
:
String
,
isLoadMore
:
Boolean
,
listener
:
(
String
)
->
Unit
)
{
launch
({
launch
({
repository
.
requestOrderList
(
fragmentStatus
[
position
],
fragmentType
[
position
],
page
,
orderNo
,
phone
).
apply
{
repository
.
requestOrderList
(
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
(),
fragmentStatus
[
position
],
fragmentType
[
position
],
page
,
orderNo
,
phone
).
apply
{
loadInfo
(
listener
,
isLoadMore
,
position
)
loadInfo
(
listener
,
isLoadMore
,
position
)
}
}
},
{
},
{
...
@@ -76,12 +77,14 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -76,12 +77,14 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
else
{
}
else
{
otherInfo
.
value
=
myData
[
myData
.
size
-
1
]
otherInfo
.
value
=
myData
[
myData
.
size
-
1
]
}
}
//移除掉最後一個對象
myData
.
removeAt
(
myData
.
size
-
1
)
myData
.
removeAt
(
myData
.
size
-
1
)
//如果是加載更多
Log
.
e
(
"eee"
,
"加載更多$isLoadMore"
)
if
(
isLoadMore
)
{
if
(
isLoadMore
)
{
if
(
mOrderList
[
position
].
value
!=
null
)
{
if
(
mOrderList
[
position
].
value
!=
null
)
{
mOrderList
[
position
].
value
!!
.
addAll
(
myData
)
mOrderList
[
position
].
value
!!
.
addAll
(
myData
)
}
else
{
mOrderList
[
position
].
postValue
(
mOrderList
[
position
].
value
)
mOrderList
[
position
].
value
=
myData
}
}
}
else
{
}
else
{
mOrderList
[
position
].
value
=
myData
mOrderList
[
position
].
value
=
myData
...
@@ -103,7 +106,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -103,7 +106,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
launch
({
launch
({
Log
.
e
(
"eee"
,
"點擊狀態$state"
)
Log
.
e
(
"eee"
,
"點擊狀態$state"
)
if
(
state
)
{
if
(
state
)
{
updateRestOpenStatus
(
state
)
updateRestOpenStatus
(
state
,
context
)
}
else
{
}
else
{
//暫停接單,彈窗向用戶確認是否關閉
//暫停接單,彈窗向用戶確認是否關閉
object
:
DialogUtils
(
context
,
R
.
layout
.
other_order_pause_orders
)
{
object
:
DialogUtils
(
context
,
R
.
layout
.
other_order_pause_orders
)
{
...
@@ -111,7 +114,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -111,7 +114,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_confirm
).
setOnClickListener
{
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_confirm
).
setOnClickListener
{
it
.
isClickable
=
false
it
.
isClickable
=
false
launch
({
launch
({
updateRestOpenStatus
(
state
).
let
{
updateRestOpenStatus
(
state
,
context
).
let
{
dialog
.
dismiss
()
dialog
.
dismiss
()
}
}
},
{
},
{
...
@@ -132,8 +135,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -132,8 +135,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
/**
* 修改餐廳營業狀態
* 修改餐廳營業狀態
*/
*/
suspend
fun
updateRestOpenStatus
(
state
:
Boolean
)
{
suspend
fun
updateRestOpenStatus
(
state
:
Boolean
,
context
:
Context
)
{
repository
.
updateRestOpenStatus
(
state
).
apply
{
repository
.
updateRestOpenStatus
(
state
,
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
()
).
apply
{
if
(
isSuccess
())
{
if
(
isSuccess
())
{
restaurantState
.
value
=
state
restaurantState
.
value
=
state
}
}
...
@@ -190,6 +193,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -190,6 +193,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
override
fun
initLayout
(
hepler
:
ViewHepler
,
dialog
:
Dialog
)
{
override
fun
initLayout
(
hepler
:
ViewHepler
,
dialog
:
Dialog
)
{
hepler
.
setText
(
R
.
id
.
tv_warning_title
,
"是否確認結賬?"
)
hepler
.
setText
(
R
.
id
.
tv_warning_title
,
"是否確認結賬?"
)
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_confirm
).
setOnClickListener
{
hepler
.
getView
<
TextView
>(
R
.
id
.
tv_dialog_confirm
).
setOnClickListener
{
dialog
.
dismiss
()
launch
({
launch
({
updateOrderStatus
(
data
.
Id
.
toString
(),
""
,
status
,
""
,
""
,
isPush
,
data
.
order_type
).
apply
{
updateOrderStatus
(
data
.
Id
.
toString
(),
""
,
status
,
""
,
""
,
isPush
,
data
.
order_type
).
apply
{
listener
.
invoke
(
success
)
listener
.
invoke
(
success
)
...
@@ -237,7 +241,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -237,7 +241,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
}
else
{
}
else
{
// 自取的確認訂單
// 自取的確認訂單
repository
.
updateSelfOrderStatus
(
data
.
Id
.
toString
(),
status
.
toString
(),
"26"
).
apply
{
repository
.
updateSelfOrderStatus
(
data
.
Id
.
toString
(),
status
.
toString
(),
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
()
).
apply
{
listener
.
invoke
(
success
)
listener
.
invoke
(
success
)
}
}
}
}
...
@@ -310,9 +314,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -310,9 +314,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
/**
* 獲取配送員信息
* 獲取配送員信息
*/
*/
fun
getDeliveryInfo
()
{
fun
getDeliveryInfo
(
context
:
Context
)
{
launch
({
launch
({
repository
.
getDeliveryInfo
(
"26"
,
"329"
).
apply
{
repository
.
getDeliveryInfo
(
GsaCloudApplication
.
getRestaurantId
(
context
).
toString
(),
GsaCloudApplication
.
getMemberId
(
context
).
toString
()
).
apply
{
deliveryBean
=
this
deliveryBean
=
this
}
}
},
{
},
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/service/GetInfoUpdateService.kt
View file @
2da52ed5
...
@@ -17,14 +17,13 @@ import java.util.concurrent.TimeUnit
...
@@ -17,14 +17,13 @@ import java.util.concurrent.TimeUnit
class
GetInfoUpdateService
:
Service
()
{
class
GetInfoUpdateService
:
Service
()
{
private
val
TAG
=
"eee"
/**
/**
* 心跳检测时间
* 心跳检测时间
*/
*/
private
val
HEART_BEAT_RATE
=
(
15
*
1000
).
toLong
()
//每隔15秒进行一次对长连接的心跳检测
private
val
HEART_BEAT_RATE
=
(
15
*
1000
).
toLong
()
//每隔15秒进行一次对长连接的心跳检测
private
val
WEBSOCKET_HOST_AND_PORT
=
"https://hktest.ricepon.com:64377/ricepon-websocket/js/webSocketServer"
//可替换为自己的主机名和端口号
private
val
WEBSOCKET_HOST_AND_PORT
=
"https://hktest.ricepon.com:64377/ricepon-websocket/js/webSocketServer"
//可替换为自己的主机名和端口号
private
var
mWebSocket
:
WebSocket
?
=
null
private
var
mWebSocket
:
WebSocket
?
=
null
private
val
sendMsg
=
"{\"type\":1,\"token\":\"weixin_26_7xjmv0geea1111111111\"}"
var
postCallBack
:
PostCallBack
?
=
null
var
postCallBack
:
PostCallBack
?
=
null
override
fun
onBind
(
intent
:
Intent
?):
IBinder
?
{
override
fun
onBind
(
intent
:
Intent
?):
IBinder
?
{
...
@@ -32,12 +31,10 @@ class GetInfoUpdateService : Service() {
...
@@ -32,12 +31,10 @@ class GetInfoUpdateService : Service() {
return
MyBind
()
return
MyBind
()
}
}
interface
PostCallBack
{
interface
PostCallBack
{
fun
callBack
(
type
:
Int
)
fun
callBack
(
type
:
Int
)
}
}
inner
class
MyBind
:
Binder
()
{
inner
class
MyBind
:
Binder
()
{
fun
getService
():
GetInfoUpdateService
{
fun
getService
():
GetInfoUpdateService
{
return
this
@GetInfoUpdateService
return
this
@GetInfoUpdateService
...
@@ -72,11 +69,13 @@ class GetInfoUpdateService : Service() {
...
@@ -72,11 +69,13 @@ class GetInfoUpdateService : Service() {
client
.
newWebSocket
(
request
,
object
:
WebSocketListener
()
{
client
.
newWebSocket
(
request
,
object
:
WebSocketListener
()
{
override
fun
onOpen
(
webSocket
:
WebSocket
?,
response
:
Response
?)
{
//开启长连接成功的回调
override
fun
onOpen
(
webSocket
:
WebSocket
?,
response
:
Response
?)
{
//开启长连接成功的回调
super
.
onOpen
(
webSocket
,
response
)
super
.
onOpen
(
webSocket
,
response
)
if
(!
this
@GetInfoUpdateService
.
isDestroy
)
{
mWebSocket
=
webSocket
mWebSocket
=
webSocket
val
token
=
"weixin_"
+
GsaCloudApplication
.
getRestaurantId
(
this
@GetInfoUpdateService
)
+
"_"
+
getRandomString
(
24
)
val
token
=
"weixin_"
+
GsaCloudApplication
.
getRestaurantId
(
this
@GetInfoUpdateService
)
+
"_"
+
getRandomString
(
24
)
Log
.
e
(
"eee"
,
"token:$token"
)
Log
.
e
(
TAG
,
"token:$token"
)
webSocket
!!
.
send
(
Gson
().
toJson
(
MsgBean
(
1
,
token
)))
webSocket
!!
.
send
(
Gson
().
toJson
(
MsgBean
(
1
,
token
)))
}
}
}
override
fun
onMessage
(
webSocket
:
WebSocket
?,
text
:
String
?)
{
//接收消息的回调
override
fun
onMessage
(
webSocket
:
WebSocket
?,
text
:
String
?)
{
//接收消息的回调
super
.
onMessage
(
webSocket
,
text
)
super
.
onMessage
(
webSocket
,
text
)
...
@@ -85,7 +84,7 @@ class GetInfoUpdateService : Service() {
...
@@ -85,7 +84,7 @@ class GetInfoUpdateService : Service() {
postCallBack
!!
.
callBack
(
json
.
optInt
(
"type"
))
postCallBack
!!
.
callBack
(
json
.
optInt
(
"type"
))
}
}
//收到服务器端传过来的消息text
//收到服务器端传过来的消息text
Log
.
e
(
"aaa"
,
"onMessage:"
+
text
!!
)
Log
.
e
(
TAG
,
"onMessage:"
+
text
!!
)
}
}
override
fun
onMessage
(
webSocket
:
WebSocket
?,
bytes
:
ByteString
?)
{
override
fun
onMessage
(
webSocket
:
WebSocket
?,
bytes
:
ByteString
?)
{
...
@@ -94,25 +93,32 @@ class GetInfoUpdateService : Service() {
...
@@ -94,25 +93,32 @@ class GetInfoUpdateService : Service() {
if
(
postCallBack
!=
null
)
{
if
(
postCallBack
!=
null
)
{
postCallBack
!!
.
callBack
(
json
.
optInt
(
"type"
))
postCallBack
!!
.
callBack
(
json
.
optInt
(
"type"
))
}
}
Log
.
e
(
"aaa"
,
"onMessage222:"
+
bytes
!!
)
Log
.
e
(
TAG
,
"onMessage222:"
+
bytes
!!
)
}
}
override
fun
onClosing
(
webSocket
:
WebSocket
?,
code
:
Int
,
reason
:
String
?)
{
override
fun
onClosing
(
webSocket
:
WebSocket
?,
code
:
Int
,
reason
:
String
?)
{
super
.
onClosing
(
webSocket
,
code
,
reason
)
super
.
onClosing
(
webSocket
,
code
,
reason
)
//連接斷開,
//連接斷開,
Log
.
e
(
"aaa"
,
"onClosing"
)
Log
.
e
(
TAG
,
"onClosing"
)
InitSocketThread
().
start
()
//创建一个新的连接
//
InitSocketThread().start()//创建一个新的连接
}
}
override
fun
onClosed
(
webSocket
:
WebSocket
?,
code
:
Int
,
reason
:
String
?)
{
override
fun
onClosed
(
webSocket
:
WebSocket
?,
code
:
Int
,
reason
:
String
?)
{
super
.
onClosed
(
webSocket
,
code
,
reason
)
super
.
onClosed
(
webSocket
,
code
,
reason
)
Log
.
e
(
"aaa"
,
"onClosed"
)
Log
.
e
(
TAG
,
"onClosed"
)
webSocket
?.
cancel
()
}
}
override
fun
onFailure
(
webSocket
:
WebSocket
?,
t
:
Throwable
?,
response
:
Response
?)
{
//长连接连接失败的回调
override
fun
onFailure
(
webSocket
:
WebSocket
?,
t
:
Throwable
?,
response
:
Response
?)
{
//长连接连接失败的回调
super
.
onFailure
(
webSocket
,
t
,
response
)
super
.
onFailure
(
webSocket
,
t
,
response
)
Log
.
e
(
"aaa"
,
"onFailure"
+
t
!!
.
message
)
Log
.
e
(
TAG
,
"onFailure"
+
t
!!
.
message
)
InitSocketThread
().
start
()
//创建一个新的连接
if
(!
this
@GetInfoUpdateService
.
isDestroy
)
{
Log
.
e
(
TAG
,
"沒銷毀"
)
initSocket
()
//创建一个新的连接
}
else
{
webSocket
?.
cancel
()
client
.
dispatcher
().
cancelAll
()
}
}
}
})
})
client
.
dispatcher
().
executorService
().
shutdown
()
client
.
dispatcher
().
executorService
().
shutdown
()
...
@@ -140,7 +146,7 @@ class GetInfoUpdateService : Service() {
...
@@ -140,7 +146,7 @@ class GetInfoUpdateService : Service() {
if
(!
isDestroy
)
{
if
(!
isDestroy
)
{
if
(
System
.
currentTimeMillis
()
-
sendTime
>=
HEART_BEAT_RATE
)
{
if
(
System
.
currentTimeMillis
()
-
sendTime
>=
HEART_BEAT_RATE
)
{
val
isSuccess
=
mWebSocket
?.
send
(
"0"
)
//发送一个空消息给服务器,通过发送消息的成功失败来判断长连接的连接状态
val
isSuccess
=
mWebSocket
?.
send
(
"0"
)
//发送一个空消息给服务器,通过发送消息的成功失败来判断长连接的连接状态
Log
.
e
(
"aaa"
,
"連接狀態:$isSuccess"
)
Log
.
e
(
TAG
,
"連接狀態:$isSuccess"
)
if
(
isSuccess
!=
null
&&
!
isSuccess
)
{
//长连接已断开
if
(
isSuccess
!=
null
&&
!
isSuccess
)
{
//长连接已断开
mHandler
.
removeCallbacks
(
this
)
mHandler
.
removeCallbacks
(
this
)
mWebSocket
?.
cancel
()
//取消掉以前的长连接
mWebSocket
?.
cancel
()
//取消掉以前的长连接
...
@@ -159,7 +165,7 @@ class GetInfoUpdateService : Service() {
...
@@ -159,7 +165,7 @@ class GetInfoUpdateService : Service() {
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
Log
.
e
(
"aaa"
,
"onDestroy"
)
Log
.
e
(
TAG
,
"onDestroy"
)
isDestroy
=
true
isDestroy
=
true
if
(
mWebSocket
!=
null
)
{
if
(
mWebSocket
!=
null
)
{
mWebSocket
!!
.
send
(
"-1"
)
mWebSocket
!!
.
send
(
"-1"
)
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/HistoryOrderActivity.kt
View file @
2da52ed5
...
@@ -31,7 +31,7 @@ class HistoryOrderActivity : BaseActivity() {
...
@@ -31,7 +31,7 @@ class HistoryOrderActivity : BaseActivity() {
private
fun
getHistoryInfo
(
page
:
Int
=
pageIndex
,
orderNum
:
String
=
""
)
{
private
fun
getHistoryInfo
(
page
:
Int
=
pageIndex
,
orderNum
:
String
=
""
)
{
showLoading
()
showLoading
()
mViewModel
.
getHistoryOrderList
(
page
.
toString
(),
orderNum
)
{
mViewModel
.
getHistoryOrderList
(
this
,
page
.
toString
(),
orderNum
)
{
cancelDialogForLoading
()
cancelDialogForLoading
()
refresh_layout
.
setEnableLoadMore
(
it
.
getData
()
!=
null
)
refresh_layout
.
setEnableLoadMore
(
it
.
getData
()
!=
null
)
refresh_layout
.
finishRefresh
()
refresh_layout
.
finishRefresh
()
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
View file @
2da52ed5
...
@@ -19,6 +19,7 @@ import androidx.lifecycle.MutableLiveData
...
@@ -19,6 +19,7 @@ import androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.Observer
import
androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.ViewModelProvider
import
androidx.viewpager.widget.ViewPager
import
androidx.viewpager.widget.ViewPager
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import
com.gingersoft.gsa.cloud.ui.view.SwitchButton
import
com.gingersoft.gsa.cloud.ui.view.SwitchButton
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.R
...
@@ -76,7 +77,7 @@ class OtherOrderActivity : BaseActivity() {
...
@@ -76,7 +77,7 @@ class OtherOrderActivity : BaseActivity() {
layout_today_order_info
.
post
{
layout_today_order_info
.
post
{
layoutHeight
=
layout_today_order_info
.
height
.
toFloat
()
layoutHeight
=
layout_today_order_info
.
height
.
toFloat
()
}
}
pageViewModel
.
getDeliveryInfo
()
pageViewModel
.
getDeliveryInfo
(
this
)
}
}
...
@@ -141,7 +142,7 @@ class OtherOrderActivity : BaseActivity() {
...
@@ -141,7 +142,7 @@ class OtherOrderActivity : BaseActivity() {
//搜索
//搜索
if
(
ed_order_num_search
.
text
!=
null
&&
ed_order_num_search
.
text
.
isNotEmpty
())
{
if
(
ed_order_num_search
.
text
!=
null
&&
ed_order_num_search
.
text
.
isNotEmpty
())
{
pageViewModel
.
phone
=
ed_order_num_search
.
text
.
toString
()
pageViewModel
.
phone
=
ed_order_num_search
.
text
.
toString
()
pageViewModel
.
getOrderList
(
viewPager
.
currentItem
,
"0"
,
false
)
{}
pageViewModel
.
getOrderList
(
this
,
viewPager
.
currentItem
,
"0"
,
false
)
{}
}
else
{
}
else
{
ToastUtils
.
show
(
this
@OtherOrderActivity
,
"請輸入手機號或訂單號"
)
ToastUtils
.
show
(
this
@OtherOrderActivity
,
"請輸入手機號或訂單號"
)
}
}
...
@@ -169,6 +170,12 @@ class OtherOrderActivity : BaseActivity() {
...
@@ -169,6 +170,12 @@ class OtherOrderActivity : BaseActivity() {
//開啟websocket
//開啟websocket
val
intent
=
Intent
(
this
,
GetInfoUpdateService
::
class
.
java
)
val
intent
=
Intent
(
this
,
GetInfoUpdateService
::
class
.
java
)
bindService
(
intent
,
serviceConnection
,
Context
.
BIND_AUTO_CREATE
)
bindService
(
intent
,
serviceConnection
,
Context
.
BIND_AUTO_CREATE
)
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
unbindService
(
serviceConnection
)
}
}
private
var
serviceConnection
=
object
:
ServiceConnection
{
private
var
serviceConnection
=
object
:
ServiceConnection
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/fragment/PlaceholderFragment.kt
View file @
2da52ed5
...
@@ -40,9 +40,11 @@ class PlaceholderFragment : BaseFragment() {
...
@@ -40,9 +40,11 @@ class PlaceholderFragment : BaseFragment() {
//如果當前fragment的狀態中包含需要刷新的狀態,獲取數據
//如果當前fragment的狀態中包含需要刷新的狀態,獲取數據
Log
.
e
(
"eee"
,
"$it,當前fragment的"
+
PageViewModel
.
fragmentStatus
[
arguments
?.
getInt
(
INDEX
)
!!
])
Log
.
e
(
"eee"
,
"$it,當前fragment的"
+
PageViewModel
.
fragmentStatus
[
arguments
?.
getInt
(
INDEX
)
!!
])
// if (PageViewModel.fragmentStatus[arguments?.getInt(INDEX)!!].contains(it.toString())) {
// if (PageViewModel.fragmentStatus[arguments?.getInt(INDEX)!!].contains(it.toString())) {
page
=
1
getOrderList
(
this
,
false
)
getOrderList
(
this
,
false
)
// }
// }
})
})
}
}
// 初始化recyclerview
// 初始化recyclerview
...
@@ -74,6 +76,7 @@ class PlaceholderFragment : BaseFragment() {
...
@@ -74,6 +76,7 @@ class PlaceholderFragment : BaseFragment() {
}
}
// 綁定當前fragment的數據項
// 綁定當前fragment的數據項
pageViewModel
.
mOrderList
[
arguments
?.
getInt
(
INDEX
)
!!
].
observe
(
viewLifecycleOwner
,
Observer
{
pageViewModel
.
mOrderList
[
arguments
?.
getInt
(
INDEX
)
!!
].
observe
(
viewLifecycleOwner
,
Observer
{
Log
.
e
(
"eee"
,
"刷新數據"
)
it
.
let
{
adapter
.
setData
(
it
)
}
it
.
let
{
adapter
.
setData
(
it
)
}
})
})
...
@@ -91,7 +94,7 @@ class PlaceholderFragment : BaseFragment() {
...
@@ -91,7 +94,7 @@ class PlaceholderFragment : BaseFragment() {
}
}
private
fun
refresh
()
{
private
fun
refresh
()
{
page
=
0
page
=
1
pageViewModel
.
orderNo
=
""
pageViewModel
.
orderNo
=
""
pageViewModel
.
phone
=
""
pageViewModel
.
phone
=
""
getOrderList
(
pageViewModel
,
false
)
getOrderList
(
pageViewModel
,
false
)
...
@@ -102,7 +105,8 @@ class PlaceholderFragment : BaseFragment() {
...
@@ -102,7 +105,8 @@ class PlaceholderFragment : BaseFragment() {
}
}
private
fun
getOrderList
(
pageViewModel
:
PageViewModel
,
isLoadMore
:
Boolean
)
{
private
fun
getOrderList
(
pageViewModel
:
PageViewModel
,
isLoadMore
:
Boolean
)
{
pageViewModel
.
getOrderList
(
arguments
?.
getInt
(
INDEX
)
?:
0
,
page
.
toString
(),
isLoadMore
)
{
pageViewModel
.
getOrderList
(
activity
!!
,
arguments
?.
getInt
(
INDEX
)
?:
0
,
page
.
toString
(),
isLoadMore
)
{
refresh_layout
.
finishRefresh
()
refresh_layout
.
finishRefresh
()
refresh_layout
.
finishLoadMore
()
refresh_layout
.
finishLoadMore
()
}
}
...
...
print-module/src/main/java/com/joe/print/mvp/print/PrintOtherOrder.java
View file @
2da52ed5
...
@@ -168,7 +168,7 @@ public class PrintOtherOrder extends PrinterRoot {
...
@@ -168,7 +168,7 @@ public class PrintOtherOrder extends PrinterRoot {
tvOrderNum
.
setText
(
"訂單號:"
+
dataBean
.
getORDER_NO
());
tvOrderNum
.
setText
(
"訂單號:"
+
dataBean
.
getORDER_NO
());
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setAdapter
(
new
OtherOrderAdapter
(
context
,
orderDetail
));
rvFood
.
setAdapter
(
new
OtherOrderAdapter
(
context
,
orderDetail
,
false
));
return
viewToBitmap
(
context
,
view
);
return
viewToBitmap
(
context
,
view
);
}
}
...
@@ -209,7 +209,7 @@ public class PrintOtherOrder extends PrinterRoot {
...
@@ -209,7 +209,7 @@ public class PrintOtherOrder extends PrinterRoot {
if
(
data
.
getPRODUCT_NAME
()
!=
null
)
{
if
(
data
.
getPRODUCT_NAME
()
!=
null
)
{
RecyclerView
rvFoodList
=
view
.
findViewById
(
R
.
id
.
rv_order_print_food
);
RecyclerView
rvFoodList
=
view
.
findViewById
(
R
.
id
.
rv_order_print_food
);
rvFoodList
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFoodList
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFoodList
.
setAdapter
(
new
OtherOrderAdapter
(
context
,
data
.
getPRODUCT_NAME
()));
rvFoodList
.
setAdapter
(
new
OtherOrderAdapter
(
context
,
data
.
getPRODUCT_NAME
()
,
true
));
}
}
return
viewToBitmap
(
context
,
view
);
return
viewToBitmap
(
context
,
view
);
}
}
...
...
print-module/src/main/java/com/joe/print/mvp/ui/adapter/OtherOrderAdapter.java
View file @
2da52ed5
...
@@ -22,11 +22,12 @@ import static com.qmuiteam.qmui.util.QMUIDisplayHelper.dp2px;
...
@@ -22,11 +22,12 @@ import static com.qmuiteam.qmui.util.QMUIDisplayHelper.dp2px;
public
class
OtherOrderAdapter
extends
BaseQuickAdapter
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
,
BaseViewHolder
>
{
public
class
OtherOrderAdapter
extends
BaseQuickAdapter
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
,
BaseViewHolder
>
{
private
Context
context
;
private
Context
context
;
private
int
indentation
;
private
int
indentation
;
private
boolean
isShowPrice
;
public
OtherOrderAdapter
(
Context
context
,
@Nullable
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>
data
)
{
public
OtherOrderAdapter
(
Context
context
,
@Nullable
List
<
OrderDetails
.
DataBean
.
PRODUCTNAMEBean
>
data
,
boolean
isShowPrice
)
{
super
(
R
.
layout
.
print_other_order_food_item
,
data
);
super
(
R
.
layout
.
print_other_order_food_item
,
data
);
this
.
context
=
context
;
this
.
context
=
context
;
this
.
isShowPrice
=
isShowPrice
;
}
}
@Override
@Override
...
@@ -34,6 +35,7 @@ public class OtherOrderAdapter extends BaseQuickAdapter<OrderDetails.DataBean.PR
...
@@ -34,6 +35,7 @@ public class OtherOrderAdapter extends BaseQuickAdapter<OrderDetails.DataBean.PR
helper
.
setText
(
R
.
id
.
tv_food_name
,
item
.
getPRODUCT_NAME
());
helper
.
setText
(
R
.
id
.
tv_food_name
,
item
.
getPRODUCT_NAME
());
helper
.
setText
(
R
.
id
.
tv_food_number
,
item
.
getNum
());
helper
.
setText
(
R
.
id
.
tv_food_number
,
item
.
getNum
());
helper
.
setText
(
R
.
id
.
tv_food_price
,
item
.
getPRICE
());
helper
.
setText
(
R
.
id
.
tv_food_price
,
item
.
getPRICE
());
helper
.
getView
(
R
.
id
.
tv_food_price
).
setVisibility
(
isShowPrice
?
View
.
VISIBLE
:
View
.
GONE
);
if
(
helper
.
getAdapterPosition
()
==
0
)
{
if
(
helper
.
getAdapterPosition
()
==
0
)
{
indentation
=
new
BigDecimal
(((
TextView
)
helper
.
getView
(
R
.
id
.
tv_food_name
)).
getPaint
().
measureText
(
"哈"
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
intValue
();
indentation
=
new
BigDecimal
(((
TextView
)
helper
.
getView
(
R
.
id
.
tv_food_name
)).
getPaint
().
measureText
(
"哈"
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
intValue
();
}
}
...
...
public-base/src/main/java/com/gingersoft/gsa/cloud/base/utils/CommonConfiguration.java
View file @
2da52ed5
package
com
.
gingersoft
.
gsa
.
cloud
.
base
.
utils
;
package
com
.
gingersoft
.
gsa
.
cloud
.
base
.
utils
;
import
android.text.TextUtils
;
import
android.util.SparseArray
;
import
android.util.SparseArray
;
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.database.bean.FoodCombo
;
import
com.gingersoft.gsa.cloud.database.bean.FoodCombo
;
import
com.gingersoft.gsa.cloud.database.bean.Modifier
;
import
com.gingersoft.gsa.cloud.database.bean.Modifier
;
import
com.gingersoft.gsa.cloud.database.utils.FoodComboDaoUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 作者:ELEGANT_BIN
* 作者:ELEGANT_BIN
...
...
public-base/src/main/java/com/gingersoft/gsa/cloud/ui/view/SwitchButton.java
View file @
2da52ed5
...
@@ -303,7 +303,6 @@ public class SwitchButton extends CompoundButton {
...
@@ -303,7 +303,6 @@ public class SwitchButton extends CompoundButton {
@Override
@Override
protected
void
onSizeChanged
(
int
w
,
int
h
,
int
oldw
,
int
oldh
)
{
protected
void
onSizeChanged
(
int
w
,
int
h
,
int
oldw
,
int
oldh
)
{
super
.
onSizeChanged
(
w
,
h
,
oldw
,
oldh
);
super
.
onSizeChanged
(
w
,
h
,
oldw
,
oldh
);
Log
.
e
(
"eee"
,
"onSizeChanged"
);
if
(
w
!=
oldw
||
h
!=
oldh
)
{
if
(
w
!=
oldw
||
h
!=
oldh
)
{
setup
();
setup
();
}
}
...
@@ -447,8 +446,6 @@ public class SwitchButton extends CompoundButton {
...
@@ -447,8 +446,6 @@ public class SwitchButton extends CompoundButton {
@Override
@Override
protected
void
drawableStateChanged
()
{
protected
void
drawableStateChanged
()
{
super
.
drawableStateChanged
();
super
.
drawableStateChanged
();
Log
.
e
(
"eee"
,
"drawableStateChanged"
);
if
(!
mIsThumbUseDrawable
&&
mThumbColor
!=
null
)
{
if
(!
mIsThumbUseDrawable
&&
mThumbColor
!=
null
)
{
mCurrThumbColor
=
mThumbColor
.
getColorForState
(
getDrawableState
(),
mCurrThumbColor
);
mCurrThumbColor
=
mThumbColor
.
getColorForState
(
getDrawableState
(),
mCurrThumbColor
);
}
else
{
}
else
{
...
@@ -482,8 +479,6 @@ public class SwitchButton extends CompoundButton {
...
@@ -482,8 +479,6 @@ public class SwitchButton extends CompoundButton {
//
//
@Override
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
Log
.
e
(
"eee"
,
"onTouchEvent"
);
if
(!
isEnabled
()
||
!
isClickable
())
{
if
(!
isEnabled
()
||
!
isClickable
())
{
return
false
;
return
false
;
}
}
...
@@ -561,7 +556,6 @@ public class SwitchButton extends CompoundButton {
...
@@ -561,7 +556,6 @@ public class SwitchButton extends CompoundButton {
@Override
@Override
public
boolean
performClick
()
{
public
boolean
performClick
()
{
Log
.
e
(
"eee"
,
"performClick"
+
!
getStatusBasedOnPos
());
// return super.performClick();
// return super.performClick();
// animateToState(!getStatusBasedOnPos());
// animateToState(!getStatusBasedOnPos());
if
(
onClickListener
!=
null
)
{
if
(
onClickListener
!=
null
)
{
...
@@ -608,7 +602,6 @@ public class SwitchButton extends CompoundButton {
...
@@ -608,7 +602,6 @@ public class SwitchButton extends CompoundButton {
@Override
@Override
public
void
setChecked
(
final
boolean
checked
)
{
public
void
setChecked
(
final
boolean
checked
)
{
Log
.
e
(
"eee"
,
"setChecked"
);
// animate before super.setChecked() become user may call setChecked again in OnCheckedChangedListener
// animate before super.setChecked() become user may call setChecked again in OnCheckedChangedListener
if
(
isChecked
()
!=
checked
)
{
if
(
isChecked
()
!=
checked
)
{
animateToState
(
checked
);
animateToState
(
checked
);
...
@@ -659,7 +652,6 @@ public class SwitchButton extends CompoundButton {
...
@@ -659,7 +652,6 @@ public class SwitchButton extends CompoundButton {
@Override
@Override
public
void
setOnCheckedChangeListener
(
OnCheckedChangeListener
onCheckedChangeListener
)
{
public
void
setOnCheckedChangeListener
(
OnCheckedChangeListener
onCheckedChangeListener
)
{
super
.
setOnCheckedChangeListener
(
onCheckedChangeListener
);
super
.
setOnCheckedChangeListener
(
onCheckedChangeListener
);
Log
.
e
(
"eee"
,
"setOnCheckedChangeListener"
);
mChildOnCheckedChangeListener
=
onCheckedChangeListener
;
mChildOnCheckedChangeListener
=
onCheckedChangeListener
;
}
}
...
...
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