Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
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
bp
ShenghuoquanBusiness
Commits
8cbc1a6e
Commit
8cbc1a6e
authored
Jul 08, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拆分选择门店和选择类目服务
parent
67d3e410
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
33 deletions
+79
-33
CommodityApplication.kt
...yidian/shenghuoquan/commodity/app/CommodityApplication.kt
+2
-6
SelectCategoryService.kt
...n/shenghuoquan/commodity/service/SelectCategoryService.kt
+3
-26
NewsContentApplication.kt
...an/shenghuoquan/newscontent/app/NewsContentApplication.kt
+1
-0
MyStaffActivity.kt
.../shenghuoquan/newscontent/personnel/ui/MyStaffActivity.kt
+1
-1
SelectStoreService.kt
...an/shenghuoquan/newscontent/service/SelectStoreService.kt
+68
-0
ChooseStoreActivity.kt
.../shenghuoquan/newscontent/ui/store/ChooseStoreActivity.kt
+4
-0
No files found.
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/app/CommodityApplication.kt
View file @
8cbc1a6e
...
...
@@ -3,12 +3,8 @@ package com.yidian.shenghuoquan.commodity.app
import
android.content.Intent
import
com.yidian.common.XRouterPathConstants
import
com.yidian.common.YdBaseApplication
import
com.yidian.common.services.AppUpgradeService
import
com.yidian.common.services.XEventService
import
com.yidian.common.services.XPageService
import
com.yidian.common.services.http.MBHttpReqService
import
com.yidian.news.util.ProcessUtil
import
com.yidian.shenghuoquan.commodity.service.
PublishCoupon
Service
import
com.yidian.shenghuoquan.commodity.service.
SelectCategory
Service
import
com.yidian.xpage.XPageManager
import
com.yidian.xpage.node.XPageHandler
import
com.yidian.xpage.node.XPageNode
...
...
@@ -45,7 +41,7 @@ class CommodityApplication : YdBaseApplication() {
}
private
fun
initService
()
{
Zap
.
addService
(
PublishCouponService
.
SERVICE_NAME
,
PublishCoupon
Service
())
Zap
.
addService
(
SelectCategoryService
.
serviceName
,
SelectCategory
Service
())
}
}
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/service/
PublishCoupon
Service.kt
→
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/service/
SelectCategory
Service.kt
View file @
8cbc1a6e
...
...
@@ -17,7 +17,7 @@ import org.json.JSONObject
/**
* 发布优惠券相关服务
*/
class
PublishCoupon
Service
:
ZapService
()
{
class
SelectCategory
Service
:
ZapService
()
{
private
lateinit
var
resolver
:
ResultResolver
...
...
@@ -25,27 +25,9 @@ class PublishCouponService : ZapService() {
this
.
resolver
=
resolver
params
as
JSONObject
when
(
action
)
{
"selectCategory"
->
{
// 选择类目
"select
Goods
Category"
->
{
// 选择类目
gotoSelectCategory
(
params
)
}
"selectStore"
->
{
// 选择门店
gotoSelectStore
(
params
)
}
}
}
/**
* 选择门店
*/
private
fun
gotoSelectStore
(
params
:
JSONObject
)
{
val
lastSelectStore
=
params
.
optJSONArray
(
"selectedStore"
)
if
(
lastSelectStore
==
null
)
{
XPageManager
.
push
(
XRouterPathConstants
.
chooseCategoryActivity
,
null
)
}
else
{
val
map
=
HashMap
<
String
,
Any
?>()
map
[
ChooseCategoryActivity
.
lastSelectCategoryKey
]
=
lastSelectCategory
XPageManager
.
push
(
XRouterPathConstants
.
chooseCategoryActivity
,
map
)
}
}
...
...
@@ -71,11 +53,6 @@ class PublishCouponService : ZapService() {
val
params
=
Gson
().
toJson
(
selectedCategory
)
resolver
.
success
(
JSONObject
(
params
))
}
XEventConfig
.
CHOOSE_STORE_SUCCESS
->
{
// 选中的门店回传H5
val
list
=
event
.
body
as
List
<*>
val
params
=
Gson
().
toJson
(
list
)
resolver
.
success
(
JSONArray
(
params
))
}
}
}
...
...
@@ -86,7 +63,7 @@ class PublishCouponService : ZapService() {
}
companion
object
{
const
val
SERVICE_NAME
:
String
=
"S
electCategoryService"
const
val
serviceName
:
String
=
"s
electCategoryService"
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/app/NewsContentApplication.kt
View file @
8cbc1a6e
...
...
@@ -494,5 +494,6 @@ class NewsContentApplication : YdBaseApplication() {
Zap
.
addService
(
UserService
.
serviceName
,
UserService
())
Zap
.
addService
(
CacheService
.
serviceName
,
CacheService
())
Zap
.
addService
(
DeepLinkService
.
serviceName
,
DeepLinkService
())
Zap
.
addService
(
SelectStoreService
.
serviceName
,
SelectStoreService
())
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/personnel/ui/MyStaffActivity.kt
View file @
8cbc1a6e
...
...
@@ -50,7 +50,7 @@ class MyStaffActivity : BaseActivity<ActivityMyStaffBinding>(), IPersonalAccount
private
fun
requestAccountList
()
{
val
lifeAccountId
=
StorageUtil
.
getLifeAccountId
()
if
(
lifeAccountId
.
isN
ot
Blank
())
{
if
(
lifeAccountId
.
isN
ullOr
Blank
())
{
val
paramsMap
=
HashMap
<
String
,
String
?>()
paramsMap
[
"life_account_id"
]
=
lifeAccountId
PersonalRemoteDataSource
.
getAccountList
(
this
,
paramsMap
)
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/service/SelectStoreService.kt
0 → 100644
View file @
8cbc1a6e
package
com.yidian.shenghuoquan.newscontent.service
import
com.google.gson.Gson
import
com.yidian.common.XEventConfig
import
com.yidian.common.XRouterPathConstants
import
com.yidian.shenghuoquan.newscontent.ui.store.ChooseStoreActivity
import
com.yidian.xarc.xevent.XBaseEvent
import
com.yidian.xarc.xrouter.ResultResolver
import
com.yidian.xpage.XPageManager
import
com.yidian.yac.core.zap.ZapService
import
org.greenrobot.eventbus.Subscribe
import
org.greenrobot.eventbus.ThreadMode
import
org.json.JSONArray
import
org.json.JSONObject
/**
* 选择门店服务
*/
class
SelectStoreService
:
ZapService
()
{
private
lateinit
var
resolver
:
ResultResolver
override
fun
onAction
(
path
:
String
,
action
:
String
,
params
:
Any
,
options
:
Any
,
resolver
:
ResultResolver
)
{
this
.
resolver
=
resolver
params
as
JSONObject
when
(
action
)
{
"selectStore"
->
{
// 选择门店
gotoSelectStore
(
params
)
}
}
}
/**
* 选择门店
*/
private
fun
gotoSelectStore
(
params
:
JSONObject
)
{
val
lastSelectStore
=
params
.
optJSONArray
(
"selectedStore"
)
if
(
lastSelectStore
==
null
)
{
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_STORE_ACTIVITY
,
null
)
}
else
{
val
map
=
HashMap
<
String
,
Any
?>()
map
[
ChooseStoreActivity
.
lastSelectStoreKey
]
=
lastSelectStore
XPageManager
.
push
(
XRouterPathConstants
.
CHOOSE_STORE_ACTIVITY
,
map
)
}
}
@Subscribe
(
sticky
=
false
,
threadMode
=
ThreadMode
.
MAIN
)
fun
onEvent
(
event
:
XBaseEvent
?)
{
when
(
event
?.
name
)
{
XEventConfig
.
CHOOSE_STORE_SUCCESS
->
{
// 选中的门店回传H5
val
list
=
event
.
body
as
List
<*>
val
params
=
Gson
().
toJson
(
list
)
resolver
.
success
(
JSONArray
(
params
))
}
}
}
override
fun
onExit
()
{
}
override
fun
onInit
()
{
}
companion
object
{
const
val
serviceName
:
String
=
"selectStoreService"
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/store/ChooseStoreActivity.kt
View file @
8cbc1a6e
...
...
@@ -24,4 +24,8 @@ class ChooseStoreActivity : BaseActivity<ActivityChooseStoreBinding>() {
}
companion
object
{
const
val
lastSelectStoreKey
=
"lastSelectStore"
}
}
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