Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YPPos
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱世闯
YPPos
Commits
ff0e6497
Commit
ff0e6497
authored
Sep 24, 2021
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加注释
parent
9a475fd4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
40 deletions
+54
-40
build.gradle
app/build.gradle
+5
-18
ApiService.kt
app/src/main/java/com/ypsx/yppos/http/ApiService.kt
+12
-8
HttpRequestManger.kt
...m/ypsx/yppos/http/repository/request/HttpRequestManger.kt
+25
-2
LogService.kt
app/src/main/java/com/ypsx/yppos/jobs/LogService.kt
+3
-0
SyncProductService.kt
app/src/main/java/com/ypsx/yppos/jobs/SyncProductService.kt
+3
-0
build.gradle
base/build.gradle
+6
-12
No files found.
app/build.gradle
View file @
ff0e6497
...
@@ -38,31 +38,18 @@ android {
...
@@ -38,31 +38,18 @@ android {
}
}
buildTypes
{
buildTypes
{
// debug {
// buildConfigField 'String', 'HOST', DEBUG_HOST
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.config
// }
debug
{
debug
{
buildConfigField
'String'
,
'HOST'
,
SIT_HOST
minifyEnabled
false
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
signingConfig
signingConfigs
.
config
signingConfig
signingConfigs
.
config
}
}
// pre {
release
{
// buildConfigField 'String', 'HOST', PRE_HOST
minifyEnabled
false
// minifyEnabled false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig
signingConfigs
.
config
// }
}
// release {
// buildConfigField 'String', 'HOST', RELEASE_HOST
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.config
// }
}
}
compileOptions
{
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
sourceCompatibility
JavaVersion
.
VERSION_1_8
...
...
app/src/main/java/com/ypsx/yppos/http/ApiService.kt
View file @
ff0e6497
...
@@ -39,6 +39,9 @@ interface ApiService {
...
@@ -39,6 +39,9 @@ interface ApiService {
@POST
(
"newretail/api/sys/user/pos/logout"
)
@POST
(
"newretail/api/sys/user/pos/logout"
)
suspend
fun
posLogout
():
ApiResponse
<
String
?
>
suspend
fun
posLogout
():
ApiResponse
<
String
?
>
/**
* 强制退出
*/
@POST
(
"newretail/api/sys/user/kickoff"
)
@POST
(
"newretail/api/sys/user/kickoff"
)
suspend
fun
posKickOff
(
@Body
request
:
KickoffRequest
):
ApiResponse
<
String
?
>
suspend
fun
posKickOff
(
@Body
request
:
KickoffRequest
):
ApiResponse
<
String
?
>
...
@@ -94,12 +97,9 @@ interface ApiService {
...
@@ -94,12 +97,9 @@ interface ApiService {
suspend
fun
saveCommandResult
(
@Body
saveCommandResult
:
SaveCommandResultRequest
):
ApiResponse
<
String
>
suspend
fun
saveCommandResult
(
@Body
saveCommandResult
:
SaveCommandResultRequest
):
ApiResponse
<
String
>
// /**
/**
// * 根据小票号查询订单
* 获取促销信息
// */
*/
// @GET("/api/mall/order/getByOrderNo")
// suspend fun
@POST
(
"newretail/api/mall/promotion/getProductPromotions"
)
@POST
(
"newretail/api/mall/promotion/getProductPromotions"
)
suspend
fun
getProductPromotions
(
@Body
request
:
ProductPromotionRequest
):
ApiResponse
<
ProductPromotionsResponse
>
suspend
fun
getProductPromotions
(
@Body
request
:
ProductPromotionRequest
):
ApiResponse
<
ProductPromotionsResponse
>
...
@@ -121,11 +121,15 @@ interface ApiService {
...
@@ -121,11 +121,15 @@ interface ApiService {
@GET
(
"newretail/api/mall/order/getOrderStatusById"
)
@GET
(
"newretail/api/mall/order/getOrderStatusById"
)
suspend
fun
getOrderStatusById
(
@Query
(
"orderId"
)
orderId
:
String
):
ApiResponse
<
OrderStatusResponse
>
suspend
fun
getOrderStatusById
(
@Query
(
"orderId"
)
orderId
:
String
):
ApiResponse
<
OrderStatusResponse
>
/**
* 根据订单id获取订单详情
*/
@GET
(
"newretail/api/mall/order/getDetailsById"
)
@GET
(
"newretail/api/mall/order/getDetailsById"
)
suspend
fun
getOrderDetailById
(
@Query
(
"orderId"
)
orderId
:
String
):
ApiResponse
<
OrderDetailsResponse
>
suspend
fun
getOrderDetailById
(
@Query
(
"orderId"
)
orderId
:
String
):
ApiResponse
<
OrderDetailsResponse
>
/**
* 获取配置
*/
@GET
(
"newretail/api/sys/options/query"
)
@GET
(
"newretail/api/sys/options/query"
)
suspend
fun
getOptionsByKeys
(
@Query
(
"keys"
)
keys
:
String
=
CacheUtil
.
getAliYunKey
()):
ApiResponse
<
List
<
OptionsResponse
>>
suspend
fun
getOptionsByKeys
(
@Query
(
"keys"
)
keys
:
String
=
CacheUtil
.
getAliYunKey
()):
ApiResponse
<
List
<
OptionsResponse
>>
...
...
app/src/main/java/com/ypsx/yppos/http/repository/request/HttpRequestManger.kt
View file @
ff0e6497
...
@@ -28,6 +28,9 @@ val HttpRequestCoroutine: HttpRequestManger by lazy(mode = LazyThreadSafetyMode.
...
@@ -28,6 +28,9 @@ val HttpRequestCoroutine: HttpRequestManger by lazy(mode = LazyThreadSafetyMode.
class
HttpRequestManger
{
class
HttpRequestManger
{
/**
* 申请注册
*/
suspend
fun
applyPos
(
applyPosMachineRequest
:
ApplyPosMachineRequest
):
ApiResponse
<
PosMachineResponse
>
{
suspend
fun
applyPos
(
applyPosMachineRequest
:
ApplyPosMachineRequest
):
ApiResponse
<
PosMachineResponse
>
{
val
applyPosData
=
apiService
.
applyPos
(
applyPosMachineRequest
)
val
applyPosData
=
apiService
.
applyPos
(
applyPosMachineRequest
)
if
(
applyPosData
.
isSuccess
())
{
if
(
applyPosData
.
isSuccess
())
{
...
@@ -65,6 +68,9 @@ class HttpRequestManger {
...
@@ -65,6 +68,9 @@ class HttpRequestManger {
}
}
/**
* 用户登录并获取配置,获取商品信息
*/
suspend
fun
posLogin
(
suspend
fun
posLogin
(
posId
:
String
,
posId
:
String
,
storeId
:
String
,
storeId
:
String
,
...
@@ -100,6 +106,9 @@ class HttpRequestManger {
...
@@ -100,6 +106,9 @@ class HttpRequestManger {
}
}
/**
* 创建订单
*/
suspend
fun
createOrder
(
suspend
fun
createOrder
(
insertOrderRequest
:
InsertOrderRequest
,
insertOrderRequest
:
InsertOrderRequest
,
authCode
:
String
,
authCode
:
String
,
...
@@ -146,6 +155,9 @@ class HttpRequestManger {
...
@@ -146,6 +155,9 @@ class HttpRequestManger {
}
}
}
}
/**
* 获取订单状态
*/
suspend
fun
getOrderStatusById
(
orderId
:
String
):
ApiResponse
<
OrderStatusResponse
>
{
suspend
fun
getOrderStatusById
(
orderId
:
String
):
ApiResponse
<
OrderStatusResponse
>
{
val
orderStatusData
=
apiService
.
getOrderStatusById
(
orderId
)
val
orderStatusData
=
apiService
.
getOrderStatusById
(
orderId
)
if
(
orderStatusData
.
isSuccess
())
{
if
(
orderStatusData
.
isSuccess
())
{
...
@@ -171,6 +183,9 @@ class HttpRequestManger {
...
@@ -171,6 +183,9 @@ class HttpRequestManger {
}
}
/**
* 根据命令,上传日志或数据库
*/
suspend
fun
uploadLog
(
posCode
:
String
)
{
suspend
fun
uploadLog
(
posCode
:
String
)
{
val
commandByPosCode
=
apiService
.
getCommandByPosCode
(
posCode
)
val
commandByPosCode
=
apiService
.
getCommandByPosCode
(
posCode
)
if
(
commandByPosCode
.
isSuccess
())
{
if
(
commandByPosCode
.
isSuccess
())
{
...
@@ -231,6 +246,9 @@ class HttpRequestManger {
...
@@ -231,6 +246,9 @@ class HttpRequestManger {
}
}
}
}
/**
* 保护命令
*/
private
suspend
fun
saveCommand
(
private
suspend
fun
saveCommand
(
zipUrl
:
String
,
zipUrl
:
String
,
startTime
:
Long
,
startTime
:
Long
,
...
@@ -262,19 +280,24 @@ class HttpRequestManger {
...
@@ -262,19 +280,24 @@ class HttpRequestManger {
}
}
}
}
/**
* 回复命令
*/
private
suspend
fun
replyCommand
(
id
:
Long
)
{
private
suspend
fun
replyCommand
(
id
:
Long
)
{
var
replyCommand
=
var
replyCommand
=
apiService
.
replyCommand
(
ReplyCommandListRequest
(
arrayListOf
<
String
>(
id
.
toString
())))
apiService
.
replyCommand
(
ReplyCommandListRequest
(
arrayListOf
<
String
>(
id
.
toString
())))
}
}
/**
* 同步商品
*/
suspend
fun
syncProduct
(
storeId
:
String
)
{
suspend
fun
syncProduct
(
storeId
:
String
)
{
val
updateTimeBigger
=
CacheUtil
.
getUpdateTimeBigger
()
val
updateTimeBigger
=
CacheUtil
.
getUpdateTimeBigger
()
val
todayDateTime
=
DateUtil
.
getTodayDateTime
()
val
todayDateTime
=
DateUtil
.
getTodayDateTime
()
val
productData
=
apiService
.
getProductList
(
storeId
,
updateTimeBigger
)
val
productData
=
apiService
.
getProductList
(
storeId
,
updateTimeBigger
)
if
(
productData
.
isSuccess
())
{
if
(
productData
.
isSuccess
())
{
va
r
data
=
productData
.
data
va
l
data
=
productData
.
data
PosProductRepository
.
getInstance
().
insertAll
(
data
)
PosProductRepository
.
getInstance
().
insertAll
(
data
)
CacheUtil
.
setUpdateTimeBigger
(
todayDateTime
)
CacheUtil
.
setUpdateTimeBigger
(
todayDateTime
)
delay
(
1000
*
60
*
5
)
delay
(
1000
*
60
*
5
)
...
...
app/src/main/java/com/ypsx/yppos/jobs/LogService.kt
View file @
ff0e6497
...
@@ -17,6 +17,9 @@ import kotlinx.coroutines.GlobalScope
...
@@ -17,6 +17,9 @@ import kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
/**
* 上传日志
*/
class
LogService
:
Service
()
{
class
LogService
:
Service
()
{
var
posConfig
:
PosConfig
?
=
null
var
posConfig
:
PosConfig
?
=
null
...
...
app/src/main/java/com/ypsx/yppos/jobs/SyncProductService.kt
View file @
ff0e6497
...
@@ -17,6 +17,9 @@ import kotlinx.coroutines.GlobalScope
...
@@ -17,6 +17,9 @@ import kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
/**
* 同步商品的任务
*/
class
SyncProductService
:
Service
()
{
class
SyncProductService
:
Service
()
{
var
posConfig
:
PosConfig
?
=
null
var
posConfig
:
PosConfig
?
=
null
var
job
:
Job
?
=
null
var
job
:
Job
?
=
null
...
...
base/build.gradle
View file @
ff0e6497
...
@@ -20,22 +20,16 @@ android {
...
@@ -20,22 +20,16 @@ android {
}
}
buildTypes
{
buildTypes
{
// debug {
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// }
debug
{
debug
{
minifyEnabled
false
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
}
}
// pre {
// minifyEnabled false
release
{
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled
false
// }
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
// release {
}
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// }
}
}
...
...
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