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
0001530b
Commit
0001530b
authored
Jul 13, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 接入TowerPro通用配置模块同步修改商户管理中心逻辑
parent
c43fdfa1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
212 additions
and
211 deletions
+212
-211
CommonDataSource.kt
.../src/main/java/com/yidian/common/http/CommonDataSource.kt
+3
-3
CommonService.kt
...mon/src/main/java/com/yidian/common/http/CommonService.kt
+1
-1
GetCommonConfigBean.kt
...n/java/com/yidian/common/http/bean/GetCommonConfigBean.kt
+70
-67
IGetCommonConfigCallback.kt
...m/yidian/common/http/callback/IGetCommonConfigCallback.kt
+1
-1
MerchantServiceFunctionAdapter.kt
...uan/newscontent/adapter/MerchantServiceFunctionAdapter.kt
+10
-10
MerchantServiceGroupAdapter.kt
...uoquan/newscontent/adapter/MerchantServiceGroupAdapter.kt
+5
-5
MerchantCenterActivity.kt
...nghuoquan/newscontent/ui/center/MerchantCenterActivity.kt
+121
-123
config.gradle
config/config.gradle
+1
-1
No files found.
CommonLib/Common/src/main/java/com/yidian/common/http/CommonDataSource.kt
View file @
0001530b
...
...
@@ -76,12 +76,12 @@ object CommonDataSource {
towerApi
.
getCommonConfig
(
requestParams
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultObserver
<
GetCommonConfigBean
>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
GetCommonConfigBean
>?)
{
.
subscribe
(
object
:
HttpResultObserver
<
GetCommonConfigBean
.
GetCommonConfigResponse
>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
GetCommonConfigBean
.
GetCommonConfigResponse
>?)
{
apiCallback
.
getCommonConfigSuccess
(
result
?.
result
)
}
override
fun
onFailure
(
result
:
HttpResult
<
GetCommonConfigBean
>?)
{
override
fun
onFailure
(
result
:
HttpResult
<
GetCommonConfigBean
.
GetCommonConfigResponse
>?)
{
apiCallback
.
getCommonConfigFailure
(
result
?.
status
)
}
})
...
...
CommonLib/Common/src/main/java/com/yidian/common/http/CommonService.kt
View file @
0001530b
...
...
@@ -32,5 +32,5 @@ interface CommonService {
):
Observable
<
HttpResult
<
Any
?
>>
@GET
(
getCommonConfig
)
fun
getCommonConfig
(
@QueryMap
requestParams
:
Map
<
String
,
String
>):
Observable
<
HttpResult
<
GetCommonConfigBean
>>
fun
getCommonConfig
(
@QueryMap
requestParams
:
Map
<
String
,
String
>):
Observable
<
HttpResult
<
GetCommonConfigBean
.
GetCommonConfigResponse
>>
}
CommonLib/Common/src/main/java/com/yidian/common/http/bean/GetCommonConfigBean.kt
View file @
0001530b
...
...
@@ -2,79 +2,82 @@ package com.yidian.common.http.bean
import
com.google.gson.annotations.SerializedName
/**
* author: yinjiacheng
* date: 7/12/21 10:10 PM
* description: open-tower-api.go2yd.com/api/resource
*/
data class
GetCommonConfigBean
(
@SerializedName
(
"appid"
)
val
appid
:
String
,
@SerializedName
(
"created_at"
)
val
createdAt
:
String
,
@SerializedName
(
"creator"
)
val
creator
:
String
,
@SerializedName
(
"data"
)
val
`data`
:
Data
,
@SerializedName
(
"env"
)
val
env
:
Int
,
@SerializedName
(
"_id"
)
val
id
:
String
,
@SerializedName
(
"keyTag"
)
val
keyTag
:
String
,
@SerializedName
(
"note"
)
val
note
:
String
,
@SerializedName
(
"os"
)
val
os
:
Int
,
@SerializedName
(
"status"
)
val
status
:
String
,
@SerializedName
(
"uniqueKey"
)
val
uniqueKey
:
String
,
@SerializedName
(
"updated_at"
)
val
updatedAt
:
String
,
@SerializedName
(
"version"
)
val
version
:
String
)
class
GetCommonConfigBean
{
data class
GetCommonConfigResponse
(
@SerializedName
(
"appid"
)
val
appid
:
String
,
@SerializedName
(
"created_at"
)
val
createdAt
:
String
,
@SerializedName
(
"creator"
)
val
creator
:
String
,
@SerializedName
(
"data"
)
val
`data`
:
Data
,
@SerializedName
(
"env"
)
val
env
:
Int
,
@SerializedName
(
"_id"
)
val
id
:
String
,
@SerializedName
(
"keyTag"
)
val
keyTag
:
String
,
@SerializedName
(
"note"
)
val
note
:
String
,
@SerializedName
(
"os"
)
val
os
:
Int
,
@SerializedName
(
"status"
)
val
status
:
String
,
@SerializedName
(
"uniqueKey"
)
val
uniqueKey
:
String
,
@SerializedName
(
"updated_at"
)
val
updatedAt
:
String
,
@SerializedName
(
"version"
)
val
version
:
String
)
data class
Data
(
@SerializedName
(
"is_show_app_upgrade"
)
val
isShowAppUpgrade
:
Int
,
@SerializedName
(
"merchant_manager_center"
)
val
merchantManagerCenter
:
MerchantManagerCenter
)
data class
Data
(
@SerializedName
(
"is_show_app_upgrade"
)
val
isShowAppUpgrade
:
Int
,
@SerializedName
(
"merchant_manager_center"
)
val
merchantManagerCenter
:
MerchantManagerCenter
)
data class
MerchantManagerCenter
(
@SerializedName
(
"disable_text"
)
val
disableText
:
String
,
@SerializedName
(
"disable_url"
)
val
disableUrl
:
Any
,
@SerializedName
(
"items"
)
val
items
:
List
<
Item
>,
@SerializedName
(
"show"
)
val
show
:
Int
)
data class
MerchantManagerCenter
(
@SerializedName
(
"disable_text
"
)
val
disableText
:
String
,
@SerializedName
(
"disable_url
"
)
val
disableUrl
:
Any
,
@SerializedName
(
"items
"
)
val
items
:
List
<
Item
>
,
@SerializedName
(
"show"
)
val
show
:
Int
)
data class
Item
(
@SerializedName
(
"functions
"
)
val
functions
:
List
<
Function
>
,
@SerializedName
(
"group_id
"
)
val
groupId
:
Int
,
@SerializedName
(
"group_name
"
)
val
groupName
:
String
,
@SerializedName
(
"show"
)
val
show
:
Int
)
data class
Item
(
@SerializedName
(
"functions"
)
val
functions
:
List
<
Function
>,
@SerializedName
(
"group_id"
)
val
groupId
:
Int
,
@SerializedName
(
"group_name"
)
val
groupName
:
String
,
@SerializedName
(
"show"
)
val
show
:
Int
)
data class
Function
(
@SerializedName
(
"function_id"
)
val
functionId
:
Int
,
@SerializedName
(
"function_name"
)
val
functionName
:
String
,
@SerializedName
(
"icon_url"
)
val
iconUrl
:
String
,
@SerializedName
(
"link_url"
)
val
linkUrl
:
Any
,
@SerializedName
(
"show"
)
val
show
:
Int
)
data class
Function
(
@SerializedName
(
"function_id"
)
val
functionId
:
Int
,
@SerializedName
(
"function_name"
)
val
functionName
:
String
,
@SerializedName
(
"icon_url"
)
val
iconUrl
:
String
,
@SerializedName
(
"link_url"
)
val
linkUrl
:
Any
,
@SerializedName
(
"show"
)
val
show
:
Int
)
}
CommonLib/Common/src/main/java/com/yidian/common/http/callback/IGetCommonConfigCallback.kt
View file @
0001530b
...
...
@@ -8,6 +8,6 @@ import com.yidian.common.http.bean.GetCommonConfigBean
* description: open-tower-api.go2yd.com/api/resource
*/
interface
IGetCommonConfigCallback
{
fun
getCommonConfigSuccess
(
result
:
GetCommonConfigBean
?)
fun
getCommonConfigSuccess
(
result
:
GetCommonConfigBean
.
GetCommonConfigResponse
?)
fun
getCommonConfigFailure
(
message
:
String
?)
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/MerchantServiceFunctionAdapter.kt
View file @
0001530b
...
...
@@ -6,8 +6,8 @@ import android.view.View
import
android.view.ViewGroup
import
androidx.recyclerview.widget.RecyclerView
import
com.bumptech.glide.Glide
import
com.yidian.common.http.bean.GetCommonConfigBean
import
com.yidian.shenghuoquan.newscontent.databinding.ItemMerchantServiceFunctionBinding
import
com.yidian.shenghuoquan.newscontent.http.httpbean.GetConfigListBean
/**
* author: yinjiacheng
...
...
@@ -16,7 +16,7 @@ import com.yidian.shenghuoquan.newscontent.http.httpbean.GetConfigListBean
*/
class
MerchantServiceFunctionAdapter
@JvmOverloads
constructor
(
val
context
:
Context
,
data
:
List
<
GetCo
nfigList
Bean
.
Function
>?
=
null
,
data
:
List
<
GetCo
mmonConfig
Bean
.
Function
>?
=
null
,
val
listener
:
OnItemClickListener
?
=
null
)
:
RecyclerView
.
Adapter
<
MerchantServiceFunctionAdapter
.
MerchantServiceViewHolder
>()
{
...
...
@@ -29,14 +29,14 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
/**
* 数据源
*/
private
val
serviceData
by
lazy
{
ArrayList
<
GetCo
nfigList
Bean
.
Function
>()
}
private
val
serviceData
by
lazy
{
ArrayList
<
GetCo
mmonConfig
Bean
.
Function
>()
}
private
lateinit
var
viewBinding
:
ItemMerchantServiceFunctionBinding
init
{
// 将不显示的数据去除
data
?.
let
{
(
it
as
ArrayList
<
GetCo
nfigList
Bean
.
Function
>).
iterator
().
apply
{
(
it
as
ArrayList
<
GetCo
mmonConfig
Bean
.
Function
>).
iterator
().
apply
{
while
(
hasNext
())
{
if
(
next
().
show
!=
FUNCTION_SHOW
)
remove
()
}
...
...
@@ -48,10 +48,10 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
/**
* 更新数据 将不显示的数据去除
*/
fun
updateData
(
data
:
List
<
GetCo
nfigList
Bean
.
Function
>?)
{
fun
updateData
(
data
:
List
<
GetCo
mmonConfig
Bean
.
Function
>?)
{
data
?.
let
{
serviceData
.
clear
()
(
it
as
ArrayList
<
GetCo
nfigList
Bean
.
Function
>).
iterator
().
apply
{
(
it
as
ArrayList
<
GetCo
mmonConfig
Bean
.
Function
>).
iterator
().
apply
{
while
(
hasNext
())
{
if
(
next
().
show
!=
FUNCTION_SHOW
)
remove
()
}
...
...
@@ -72,12 +72,12 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
override
fun
onBindViewHolder
(
holder
:
MerchantServiceViewHolder
,
position
:
Int
)
{
val
data
=
serviceData
[
position
]
if
(
data
.
icon
_u
rl
.
isNotEmpty
())
{
Glide
.
with
(
context
).
load
(
data
.
icon
_u
rl
).
into
(
viewBinding
.
ivService
)
if
(
data
.
icon
U
rl
.
isNotEmpty
())
{
Glide
.
with
(
context
).
load
(
data
.
icon
U
rl
).
into
(
viewBinding
.
ivService
)
}
else
{
// TODO: 6/11/21 显示本地icon
}
holder
.
viewBinding
.
tvService
.
text
=
data
.
function
_n
ame
holder
.
viewBinding
.
tvService
.
text
=
data
.
function
N
ame
holder
.
viewBinding
.
root
.
setOnClickListener
{
listener
?.
onItemClick
(
it
,
position
,
data
)
}
}
...
...
@@ -92,7 +92,7 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
RecyclerView
.
ViewHolder
(
itemView
)
interface
OnItemClickListener
{
fun
onItemClick
(
view
:
View
,
position
:
Int
,
data
:
GetCo
nfigList
Bean
.
Function
)
fun
onItemClick
(
view
:
View
,
position
:
Int
,
data
:
GetCo
mmonConfig
Bean
.
Function
)
}
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/adapter/MerchantServiceGroupAdapter.kt
View file @
0001530b
...
...
@@ -7,8 +7,8 @@ import android.view.View
import
android.view.ViewGroup
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.yidian.common.http.bean.GetCommonConfigBean
import
com.yidian.shenghuoquan.newscontent.databinding.ItemMerchantServiceGroupBinding
import
com.yidian.shenghuoquan.newscontent.http.httpbean.GetConfigListBean
import
com.yidian.utils.DensityUtil
/**
...
...
@@ -18,7 +18,7 @@ import com.yidian.utils.DensityUtil
*/
class
MerchantServiceGroupAdapter
@JvmOverloads
constructor
(
val
context
:
Context
,
data
:
List
<
GetCo
nfigList
Bean
.
Item
>?
=
null
,
data
:
List
<
GetCo
mmonConfig
Bean
.
Item
>?
=
null
,
val
listener
:
MerchantServiceFunctionAdapter
.
OnItemClickListener
?
=
null
)
:
RecyclerView
.
Adapter
<
MerchantServiceGroupAdapter
.
MerchantServiceGroupViewHolder
>()
{
...
...
@@ -34,7 +34,7 @@ class MerchantServiceGroupAdapter @JvmOverloads constructor(
* 数据源
*/
private
val
groupData
by
lazy
{
ArrayList
<
GetCo
nfigList
Bean
.
Item
>()
ArrayList
<
GetCo
mmonConfig
Bean
.
Item
>()
}
init
{
...
...
@@ -51,7 +51,7 @@ class MerchantServiceGroupAdapter @JvmOverloads constructor(
/**
* 刷新数据
*/
fun
updateData
(
data
:
List
<
GetCo
nfigList
Bean
.
Item
>?)
{
fun
updateData
(
data
:
List
<
GetCo
mmonConfig
Bean
.
Item
>?)
{
groupData
.
clear
()
data
?.
let
{
it
.
forEach
{
item
->
...
...
@@ -81,7 +81,7 @@ class MerchantServiceGroupAdapter @JvmOverloads constructor(
override
fun
onBindViewHolder
(
holder
:
MerchantServiceGroupViewHolder
,
position
:
Int
)
{
val
data
=
groupData
[
position
]
holder
.
viewBinding
.
tvTitle
.
text
=
data
.
group
_n
ame
holder
.
viewBinding
.
tvTitle
.
text
=
data
.
group
N
ame
viewBinding
.
rvService
.
layoutManager
=
GridLayoutManager
(
context
,
4
)
viewBinding
.
rvService
.
adapter
=
MerchantServiceFunctionAdapter
(
context
,
data
.
functions
,
listener
)
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/center/MerchantCenterActivity.kt
View file @
0001530b
...
...
@@ -7,9 +7,13 @@ import androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.scwang.smart.refresh.layout.api.RefreshLayout
import
com.scwang.smart.refresh.layout.listener.OnRefreshListener
import
com.yidian.common.AppConfig
import
com.yidian.common.XEventConfig
import
com.yidian.common.XRouterPathConstants
import
com.yidian.common.base.BaseActivity
import
com.yidian.common.http.CommonDataSource
import
com.yidian.common.http.bean.GetCommonConfigBean
import
com.yidian.common.http.callback.IGetCommonConfigCallback
import
com.yidian.shenghuoquan.newscontent.R
import
com.yidian.shenghuoquan.newscontent.adapter.MerchantServiceFunctionAdapter
import
com.yidian.shenghuoquan.newscontent.adapter.MerchantServiceGroupAdapter
...
...
@@ -19,7 +23,6 @@ import com.yidian.shenghuoquan.newscontent.databinding.ActivityMerchantCenterBin
import
com.yidian.shenghuoquan.newscontent.http.ApiService
import
com.yidian.shenghuoquan.newscontent.http.callback.*
import
com.yidian.shenghuoquan.newscontent.http.httpbean.AuthMerchantCheckBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.GetConfigListBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.GetLifeAccountInfoByIdBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.LifeAccountItemBean
import
com.yidian.shenghuoquan.newscontent.ui.auth.LifeAccountAuthActivity
...
...
@@ -42,12 +45,11 @@ import org.greenrobot.eventbus.ThreadMode
* date: 6/8/21 8:11 PM
* description: 商户管理中心
*/
class
MerchantCenterActivity
:
BaseActivity
<
ActivityMerchantCenterBinding
>(),
IGetConfigListCallback
,
MerchantSwitchDialog
.
OnMerchantSwitchCallback
,
class
MerchantCenterActivity
:
BaseActivity
<
ActivityMerchantCenterBinding
>(),
MerchantSwitchDialog
.
OnMerchantSwitchCallback
,
LifeAccountLabelView
.
OnLifeAccountLabelCallback
,
IGetLifeAccountInfoByIdCallback
,
MerchantCenterBottomHintDialog
.
OnMerchantCenterBottomHintCallback
,
IAuthMerchantCheckCallback
,
MerchantServiceFunctionAdapter
.
OnItemClickListener
,
CommonTopBarView
.
OnCommonTopBarActionCallback
,
OnRefreshListener
,
IUserLogoutCallBack
,
DialogInterface
.
OnShowListener
,
DialogInterface
.
OnDismissListener
{
MerchantServiceFunctionAdapter
.
OnItemClickListener
,
CommonTopBarView
.
OnCommonTopBarActionCallback
,
OnRefreshListener
,
IUserLogoutCallBack
,
DialogInterface
.
OnShowListener
,
DialogInterface
.
OnDismissListener
,
IGetCommonConfigCallback
{
companion
object
{
// 传递的生活号信息
...
...
@@ -64,11 +66,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
*/
private
lateinit
var
curLifeAccount
:
LifeAccountItemBean
.
Response
/**
* 当前配置数据
*/
private
val
curConfigData
by
lazy
{
ArrayList
<
GetConfigListBean
.
Item
>()
}
/**
* 功能-页面表
*/
...
...
@@ -135,26 +132,23 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
// 切换主体入口是否展示判断
viewBind
.
bvTopBar
.
setActionVisibility
(
params
?.
get
(
EXTRA_IS_MULTI
)
?.
let
{
it
as
Boolean
}
?:
false
)
curLifeAccount
=
params
?.
get
(
EXTRA_LIFE_ACCOUNT_INFO
)
?.
let
{
it
as
LifeAccountItemBean
.
Response
}
?:
return
// 设置标签
viewBind
.
lvLifeAccountLabel
.
setLifeAccountData
(
curLifeAccount
)
// 展示底部浮窗
showMerchantCenterBottomHint
(
curLifeAccount
)
// 请求功能入口配置清单
ApiService
.
getConfigList
(
this
)
viewBind
.
rlRefresh
.
autoRefresh
()
}
/**
* 刷新商户管理中心相关数据
*/
private
fun
refreshMerchantCenterData
(
data
:
LifeAccountItemBean
.
Response
)
{
private
fun
refreshMerchantCenterData
(
lifeAccountData
:
LifeAccountItemBean
.
Response
,
configData
:
List
<
GetCommonConfigBean
.
Item
>
)
{
// 设置标签
viewBind
.
lvLifeAccountLabel
.
setLifeAccountData
(
d
ata
)
viewBind
.
lvLifeAccountLabel
.
setLifeAccountData
(
lifeAccountD
ata
)
// 展示底部浮窗
showMerchantCenterBottomHint
(
data
)
// 生活号状态变更 生成当前生活号状态下的功能集
generateFunctionPermissionMap
(
curConfigData
)
// 生活号状态变更 过滤商户服务数据
filterMerchantServiceData
(
curConfigData
)
showMerchantCenterBottomHint
(
lifeAccountData
)
// 生成FunctionId和XPage页面节点映射
generateFunctionPageMap
(
configData
)
// 生成当前生活号状态下的功能集
generateFunctionPermissionMap
(
configData
)
// 过滤商户服务数据
filterMerchantServiceData
(
configData
)
}
/**
...
...
@@ -183,97 +177,98 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
* 生成FunctionId和XPage页面节点映射
* todo Activity传参
*/
private
fun
generateFunctionPageMap
(
data
:
List
<
GetConfigListBean
.
Item
>)
{
private
fun
generateFunctionPageMap
(
data
:
List
<
GetCommonConfigBean
.
Item
>)
{
if
(
data
.
isEmpty
())
return
functionPageMap
.
clear
()
// 我要发布-优惠券
functionPageMap
[
data
[
0
].
functions
[
0
].
function
_i
d
]
=
XRouterPathConstants
.
PUBLISH_COUPONS_ACTIVITY
functionPageMap
[
data
[
0
].
functions
[
0
].
function
I
d
]
=
XRouterPathConstants
.
PUBLISH_COUPONS_ACTIVITY
// 我要发布-招聘
functionPageMap
[
data
[
0
].
functions
[
1
].
function
_i
d
]
=
null
functionPageMap
[
data
[
0
].
functions
[
1
].
function
I
d
]
=
null
// 管理服务-权限管理
functionPageMap
[
data
[
1
].
functions
[
0
].
function
_i
d
]
=
null
functionPageMap
[
data
[
1
].
functions
[
0
].
function
I
d
]
=
null
// 管理服务-人员管理
functionPageMap
[
data
[
1
].
functions
[
1
].
function
_i
d
]
=
XRouterPathConstants
.
PERSONAL_MY_STAFF
functionPageMap
[
data
[
1
].
functions
[
1
].
function
I
d
]
=
XRouterPathConstants
.
PERSONAL_MY_STAFF
// 其他服务-优惠券管理
functionPageMap
[
data
[
2
].
functions
[
0
].
function
_i
d
]
=
XRouterPathConstants
.
COMMODITY_MANAGEMENT
functionPageMap
[
data
[
2
].
functions
[
0
].
function
I
d
]
=
XRouterPathConstants
.
COMMODITY_MANAGEMENT
// 其他服务-职位管理
functionPageMap
[
data
[
2
].
functions
[
1
].
function
_i
d
]
=
null
functionPageMap
[
data
[
2
].
functions
[
1
].
function
I
d
]
=
null
// 其他服务-门店管理
functionPageMap
[
data
[
2
].
functions
[
2
].
function
_i
d
]
=
XRouterPathConstants
.
STORE_MANAGEMENT
functionPageMap
[
data
[
2
].
functions
[
2
].
function
I
d
]
=
XRouterPathConstants
.
STORE_MANAGEMENT
// 其他服务-系统设置
functionPageMap
[
data
[
2
].
functions
[
3
].
function
_i
d
]
=
XRouterPathConstants
.
SYSTEM_SETTING
functionPageMap
[
data
[
2
].
functions
[
3
].
function
I
d
]
=
XRouterPathConstants
.
SYSTEM_SETTING
}
/**
* 对应生活号权限下的功能集
* todo 优化逻辑
*/
private
fun
generateFunctionPermissionMap
(
data
:
List
<
GetCo
nfigList
Bean
.
Item
>)
{
private
fun
generateFunctionPermissionMap
(
data
:
List
<
GetCo
mmonConfig
Bean
.
Item
>)
{
if
(
data
.
isEmpty
())
return
functionPermissionList
.
clear
()
when
(
getCurLifeAccountLabel
())
{
Constant
.
LIFE_ACCOUNT_TAG_ENTERPRISE_AUTH
->
{
// 企业认证
// 所有服务都可用
functionPermissionList
.
add
(
data
[
0
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
I
d
)
}
Constant
.
LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH
->
{
// 普通企业认证
// 所有服务都可用
functionPermissionList
.
add
(
data
[
0
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
I
d
)
}
Constant
.
LIFE_ACCOUNT_TAG_INDIVIDUAL_BUSINESS_AUTH
->
{
// 个体工商户认证
// 所有服务都可用
functionPermissionList
.
add
(
data
[
0
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
0
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
1
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
0
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
I
d
)
}
Constant
.
LIFE_ACCOUNT_TAG_PERSONAL_AUTH
->
{
// 个人认证
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
I
d
)
}
Constant
.
LIFE_ACCOUNT_TAG_NOT_AUTH
->
{
// 未认证
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
I
d
)
}
Constant
.
LIFE_ACCOUNT_TAG_AUDIT_UNDER
->
{
// 审核中
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
2
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
I
d
)
}
Constant
.
LIFE_ACCOUNT_TAG_AUTH_REJECT
->
{
// 认证驳回
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
_i
d
)
functionPermissionList
.
add
(
data
[
0
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
1
].
function
I
d
)
functionPermissionList
.
add
(
data
[
2
].
functions
[
3
].
function
I
d
)
}
}
}
...
...
@@ -282,13 +277,13 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
* 过滤商户服务数据
* 目前处理个人认证状态下和企业员工角色下不展示管理服务
*/
private
fun
filterMerchantServiceData
(
data
:
List
<
GetCo
nfigList
Bean
.
Item
>)
{
val
result
=
ArrayList
<
GetCo
nfigList
Bean
.
Item
>(
data
.
size
)
private
fun
filterMerchantServiceData
(
data
:
List
<
GetCo
mmonConfig
Bean
.
Item
>)
{
val
result
=
ArrayList
<
GetCo
mmonConfig
Bean
.
Item
>(
data
.
size
)
data
.
let
{
(
it
as
ArrayList
<
GetCo
nfigList
Bean
.
Item
>).
iterator
().
apply
{
(
it
as
ArrayList
<
GetCo
mmonConfig
Bean
.
Item
>).
iterator
().
apply
{
while
(
hasNext
())
{
val
group
=
next
()
if
(
group
.
group
_i
d
==
Constant
.
MERCHANT_SERVICE_GROUP_MANAGEMENT
)
{
if
(
group
.
group
I
d
==
Constant
.
MERCHANT_SERVICE_GROUP_MANAGEMENT
)
{
// 个人认证或企业员工不展示管理服务
if
(
getCurLifeAccountLabel
()
==
Constant
.
LIFE_ACCOUNT_TAG_PERSONAL_AUTH
||
curLifeAccount
.
role_type
==
Constant
.
TYPE_ROLE_ORDINARY
)
{
continue
...
...
@@ -321,20 +316,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
return
Constant
.
LIFE_ACCOUNT_TAG_NOT_AUTH
// 个人未认证
}
override
fun
getConfigListSuccess
(
result
:
GetConfigListBean
.
Response
?)
{
result
?.
let
{
// 备份配置数据
curConfigData
.
addAll
(
it
.
merchant_manager_center
.
items
)
generateFunctionPageMap
(
it
.
merchant_manager_center
.
items
)
generateFunctionPermissionMap
(
it
.
merchant_manager_center
.
items
)
filterMerchantServiceData
(
it
.
merchant_manager_center
.
items
)
}
}
override
fun
getConfigListFailure
(
message
:
String
?)
{
}
override
fun
onLifeAccountSelect
(
data
:
LifeAccountItemBean
.
Response
)
{
// 用户切换主体 更新当前生活号信息
curLifeAccount
=
data
...
...
@@ -401,11 +382,11 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
}
override
fun
onItemClick
(
view
:
View
,
position
:
Int
,
data
:
GetCo
nfigList
Bean
.
Function
)
{
override
fun
onItemClick
(
view
:
View
,
position
:
Int
,
data
:
GetCo
mmonConfig
Bean
.
Function
)
{
// 选择某一个功能
// 若在当前权限功能集中则跳转指定页
if
(
functionPermissionList
.
contains
(
data
.
function
_i
d
))
{
functionPageMap
[
data
.
function
_i
d
]
?.
let
{
XPageManager
.
push
(
it
,
null
)
}
?:
ToastUtil
.
showToast
(
this
,
"正在建设中..."
)
if
(
functionPermissionList
.
contains
(
data
.
function
I
d
))
{
functionPageMap
[
data
.
function
I
d
]
?.
let
{
XPageManager
.
push
(
it
,
null
)
}
?:
ToastUtil
.
showToast
(
this
,
"正在建设中..."
)
}
else
{
// 若当前功能无权限 根据生活号类型做弹窗提示
if
(
curLifeAccount
.
enterprise_audit_status
==
Constant
.
STATUS_AUDIT_UNDER
)
{
...
...
@@ -517,60 +498,77 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
// 刷新数据
// 请求TowerPro通用配置
CommonDataSource
.
getCommonConfig
(
this
,
hashMapOf
(
"appid"
to
AppConfig
.
appid
,
"env"
to
AppConfig
.
TowerApiEnv
,
"version"
to
AppConfig
.
TowerApiVersion
,
"os"
to
AppConfig
.
TowerApiOS
,
"keytag"
to
AppConfig
.
TowerApiKeyTag
)
)
}
override
fun
userLogoutSuccess
()
{
XPageManager
.
push
(
XRouterPathConstants
.
LOGIN_LIFE_CIRCLE
,
null
)
}
override
fun
onShow
(
dialog
:
DialogInterface
?)
{
// 切换主体弹窗显示
// 更改页面标题背景色
viewBind
.
bvTopBar
.
setBackgroundColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
white
))
}
override
fun
onDismiss
(
dialog
:
DialogInterface
?)
{
// 切换主体弹窗消失
// 更改页面标题背景色
viewBind
.
bvTopBar
.
setBackgroundColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
transparent
))
}
override
fun
getCommonConfigSuccess
(
@Suppress
(
"PARAMETER_NAME_CHANGED_ON_OVERRIDE"
)
configResult
:
GetCommonConfigBean
.
GetCommonConfigResponse
?)
{
// 请求生活号列表
ApiService
.
getLifeAccountList
(
object
:
IGetLifeAccountListCallback
{
override
fun
getLifeAccountListSuccess
(
result
:
ArrayList
<
LifeAccountItemBean
.
Response
>?)
{
// 刷新成功
refreshLayout
.
finishRefresh
(
true
)
if
(
result
?.
size
==
0
)
{
override
fun
getLifeAccountListSuccess
(
@Suppress
(
"PARAMETER_NAME_CHANGED_ON_OVERRIDE"
)
lifeAccountResult
:
ArrayList
<
LifeAccountItemBean
.
Response
>?)
{
viewBind
.
rlRefresh
.
finishRefresh
(
true
)
if
(
lifeAccountResult
?.
size
==
0
)
{
// 如果当前无生活号则退出登录
ToastUtil
.
showToast
(
this
@MerchantCenterActivity
,
resources
.
getString
(
R
.
string
.
no_life_account
))
ApiService
.
userLogout
(
this
@MerchantCenterActivity
)
return
}
if
(
r
esult
?.
contains
(
curLifeAccount
)
==
false
)
{
if
(
lifeAccountR
esult
?.
contains
(
curLifeAccount
)
==
false
)
{
// 当前选择的生活号已不存在则切换第一个生活号 目前为企业员工被解除关系会触发
curLifeAccount
=
r
esult
[
0
]
curLifeAccount
=
lifeAccountR
esult
[
0
]
// 更新本地存储的生活号id
StorageUtil
.
putLifeAccountId
(
r
esult
[
0
].
life_account_id
)
StorageUtil
.
putLifeAccountId
(
lifeAccountR
esult
[
0
].
life_account_id
)
// 刷新数据
refreshMerchantCenterData
(
result
[
0
])
configResult
?.
data
?.
merchantManagerCenter
?.
items
?.
let
{
refreshMerchantCenterData
(
lifeAccountResult
[
0
],
it
)
}
// 切换主体入口是否展示判断
viewBind
.
bvTopBar
.
setActionVisibility
(
r
esult
.
size
>
1
)
viewBind
.
bvTopBar
.
setActionVisibility
(
lifeAccountR
esult
.
size
>
1
)
return
}
result
?.
forEach
{
lifeAccountResult
?.
let
{
// 切换主体入口是否展示判断
viewBind
.
bvTopBar
.
setActionVisibility
(
it
.
size
>
1
)
}
lifeAccountResult
?.
forEach
{
if
(
curLifeAccount
.
life_account_id
==
it
.
life_account_id
)
{
curLifeAccount
=
it
// 刷新数据
refreshMerchantCenterData
(
it
)
configResult
?.
data
?.
merchantManagerCenter
?.
items
?.
let
{
configData
->
refreshMerchantCenterData
(
it
,
configData
)
}
}
}
result
?.
let
{
// 切换主体入口是否展示判断
viewBind
.
bvTopBar
.
setActionVisibility
(
it
.
size
>
1
)
}
}
override
fun
getLifeAccountListFailure
(
message
:
String
?)
{
// 刷新失败
refreshLayout
.
finishRefresh
(
false
)
viewBind
.
rlRefresh
.
finishRefresh
(
false
)
}
})
}
override
fun
userLogoutSuccess
()
{
XPageManager
.
push
(
XRouterPathConstants
.
LOGIN_LIFE_CIRCLE
,
null
)
}
override
fun
onShow
(
dialog
:
DialogInterface
?)
{
// 切换主体弹窗显示
// 更改页面标题背景色
viewBind
.
bvTopBar
.
setBackgroundColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
white
))
}
override
fun
onDismiss
(
dialog
:
DialogInterface
?)
{
// 切换主体弹窗消失
// 更改页面标题背景色
viewBind
.
bvTopBar
.
setBackgroundColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
transparent
))
override
fun
getCommonConfigFailure
(
message
:
String
?)
{
viewBind
.
rlRefresh
.
finishRefresh
(
false
)
}
}
config/config.gradle
View file @
0001530b
...
...
@@ -10,7 +10,7 @@ ext {
isUmengRelease
:
'false'
,
// 上线时改成true,使用上线版本的友盟配置
isApplication
:
false
,
isAppUpgradeOnline:
'true'
,
// 上线前需要开启版本升级线上环境 true
towerApiEnv
:
'"
2
"'
// Tower Api环境 0:测试环境 1:内网-正式环境 2:外网-正式环境 3:内网外网-正式环境
towerApiEnv
:
'"
0
"'
// Tower Api环境 0:测试环境 1:内网-正式环境 2:外网-正式环境 3:内网外网-正式环境
]
// 高德地图的key
amap
=
[
...
...
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