Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-platform-auth
Commits
fbb0ba16
Commit
fbb0ba16
authored
Apr 14, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资源组调整:区分自有商户的店铺和共享店铺,分开存放,避免重复授权(共享店铺不能二次共享授权)
parent
9a7e00b4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
40 deletions
+149
-40
ResourceGroupDTO.java
...-api/src/main/java/com/gic/auth/dto/ResourceGroupDTO.java
+31
-1
TabSysResourceGroup.java
...rc/main/java/com/gic/auth/entity/TabSysResourceGroup.java
+30
-1
ResourceGroupApiServiceImpl.java
.../auth/service/outer/impl/ResourceGroupApiServiceImpl.java
+61
-35
dubbo-gic-platform-auth-service.xml
...ce/src/main/resources/dubbo-gic-platform-auth-service.xml
+1
-0
TabSysResourceGroupMapper.xml
...e/src/main/resources/mapper/TabSysResourceGroupMapper.xml
+26
-3
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/dto/ResourceGroupDTO.java
View file @
fbb0ba16
...
...
@@ -65,11 +65,21 @@ public class ResourceGroupDTO implements Serializable{
private
Integer
weimobOrderArea
;
/**
* 微盟店铺多选,weimob_order_area选择1时选择店铺,英文逗号隔开
* 微盟店铺多选
(前端使用)
,weimob_order_area选择1时选择店铺,英文逗号隔开
*/
private
String
weimobStoreId
;
/**
* 微盟店铺多选(业务使用:只存本商户自有的店铺数据),weimob_order_area选择1时选择店铺,英文逗号隔开。为了避免重复授权,新增一个特有字段
*/
private
String
weimobStoreIdOwn
;
/**
* 微盟店铺多选(业务使用:只存共享的店铺数据),weimob_order_area选择1时选择店铺,英文逗号隔开。为了避免重复授权,新增一个特有字段
*/
private
String
weimobStoreIdShare
;
/**
* 短信签名多选,英文逗号隔开
*/
private
String
smsId
;
...
...
@@ -267,6 +277,24 @@ public class ResourceGroupDTO implements Serializable{
return
this
;
}
public
String
getWeimobStoreIdOwn
()
{
return
weimobStoreIdOwn
;
}
public
ResourceGroupDTO
setWeimobStoreIdOwn
(
String
weimobStoreIdOwn
)
{
this
.
weimobStoreIdOwn
=
weimobStoreIdOwn
;
return
this
;
}
public
String
getWeimobStoreIdShare
()
{
return
weimobStoreIdShare
;
}
public
ResourceGroupDTO
setWeimobStoreIdShare
(
String
weimobStoreIdShare
)
{
this
.
weimobStoreIdShare
=
weimobStoreIdShare
;
return
this
;
}
@Override
public
String
toString
()
{
return
"ResourceGroupDTO{"
+
...
...
@@ -281,6 +309,8 @@ public class ResourceGroupDTO implements Serializable{
", storeOrderArea="
+
storeOrderArea
+
", weimobOrderArea="
+
weimobOrderArea
+
", weimobStoreId='"
+
weimobStoreId
+
'\''
+
", weimobStoreIdOwn='"
+
weimobStoreIdOwn
+
'\''
+
", weimobStoreIdShare='"
+
weimobStoreIdShare
+
'\''
+
", smsId='"
+
smsId
+
'\''
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabSysResourceGroup.java
View file @
fbb0ba16
...
...
@@ -56,11 +56,21 @@ public class TabSysResourceGroup {
private
Integer
weimobOrderArea
;
/**
* 微盟店铺多选,weimob_order_area选择1时选择店铺,英文逗号隔开
*
前端使用:
微盟店铺多选,weimob_order_area选择1时选择店铺,英文逗号隔开
*/
private
String
weimobStoreId
;
/**
* 微盟店铺多选(业务使用:只存本商户自有的店铺数据),weimob_order_area选择1时选择店铺,英文逗号隔开。为了避免重复授权,新增一个特有字段
*/
private
String
weimobStoreIdOwn
;
/**
* 微盟店铺多选(业务使用:只存共享的店铺数据),weimob_order_area选择1时选择店铺,英文逗号隔开。为了避免重复授权,新增一个特有字段
*/
private
String
weimobStoreIdShare
;
/**
* 短信签名多选,英文逗号隔开
*/
private
String
smsId
;
...
...
@@ -205,4 +215,22 @@ public class TabSysResourceGroup {
this
.
deleteFlag
=
deleteFlag
;
return
this
;
}
public
String
getWeimobStoreIdOwn
()
{
return
weimobStoreIdOwn
;
}
public
TabSysResourceGroup
setWeimobStoreIdOwn
(
String
weimobStoreIdOwn
)
{
this
.
weimobStoreIdOwn
=
weimobStoreIdOwn
;
return
this
;
}
public
String
getWeimobStoreIdShare
()
{
return
weimobStoreIdShare
;
}
public
TabSysResourceGroup
setWeimobStoreIdShare
(
String
weimobStoreIdShare
)
{
this
.
weimobStoreIdShare
=
weimobStoreIdShare
;
return
this
;
}
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/ResourceGroupApiServiceImpl.java
View file @
fbb0ba16
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.gic.platform.member.constant.enums.CuTypeEnum
;
import
com.gic.store.service.UnionStoreChangeApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -19,20 +14,24 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.application.center.api.service.AuthorizeService
;
import
com.gic.auth.dto.*
;
import
com.gic.auth.entity.TabSysResourceGroup
;
import
com.gic.auth.service.*
;
import
com.gic.auth.service.ResourceGroupApiService
;
import
com.gic.auth.service.ResourceGroupService
;
import
com.gic.auth.service.UserResourceService
;
import
com.gic.auth.utils.resourcegroup.ResourceGroupUtils
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.dto.WmStoreDTO
;
import
com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.exception.CommonException
;
import
com.gic.enterprise.service.UnionEnterpriseAuthApiService
;
import
com.gic.enterprise.service.WmStoreApiService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.store.service.StoreWidgetApiService
;
import
com.gic.platform.member.constant.enums.CuTypeEnum
;
import
com.gic.store.service.UnionStoreChangeApiService
;
/**
* 资源组
...
...
@@ -47,37 +46,24 @@ public class ResourceGroupApiServiceImpl implements ResourceGroupApiService{
@Autowired
private
ResourceGroupService
resourceGroupService
;
@Autowired
private
AuthorizeService
authorizeService
;
@Autowired
private
UserResourceService
userResourceService
;
@Autowired
private
UserService
userService
;
@Autowired
private
StoreWidgetApiService
storeWidgetApiService
;
@Autowired
private
UnionEnterpriseAuthApiService
unionEnterpriseAuthApiService
;
@Autowired
private
AuthCodeApiService
authCodeApiService
;
@Autowired
private
UnionStoreChangeApiService
unionStoreChangeApiService
;
@Autowired
private
WmStoreApiService
wmStoreApiService
;
@Override
public
ServiceResponse
<
Integer
>
saveResourceGroup
(
ResourceGroupDTO
resourceGroup
)
{
String
validParamResponse
=
validParam
(
resourceGroup
);
if
(
validParamResponse
!=
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
validParamResponse
);
}
validParam
(
resourceGroup
);
Integer
resourceGroupId
=
resourceGroupService
.
saveResourceGroup
(
resourceGroup
);
return
ServiceResponse
.
success
(
resourceGroupId
);
}
@Override
public
ServiceResponse
<
String
>
editResourceGroup
(
ResourceGroupDTO
resourceGroup
)
{
String
validParamResponse
=
validParam
(
resourceGroup
);
if
(
validParamResponse
!=
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
validParamResponse
);
}
validParam
(
resourceGroup
);
//是否联合授权,如果是
UnionEnterpriseAuthDTO
unionEnterpriseAuthDTO
=
unionEnterpriseAuthApiService
.
getUnionEnterpriseAuthByResourceGroupId
(
resourceGroup
.
getResourceGroupId
()).
getResult
();
...
...
@@ -249,45 +235,85 @@ public class ResourceGroupApiServiceImpl implements ResourceGroupApiService{
* @param resourceGroup
* @return null:验证OK
*/
private
String
validParam
(
ResourceGroupDTO
resourceGroup
)
{
private
void
validParam
(
ResourceGroupDTO
resourceGroup
)
{
Integer
resourceGroupId
=
resourceGroup
.
getResourceGroupId
();
if
(
resourceGroupId
!=
null
)
{
TabSysResourceGroup
record
=
resourceGroupService
.
getResourceGroup
(
resourceGroupId
);
if
(
record
==
null
)
{
return
"资源组不存在"
;
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"资源组不存在"
)
;
}
}
//param valid
if
(
StringUtils
.
isBlank
(
resourceGroup
.
getResourceGroupName
()))
{
return
"资源组名称不能为空"
;
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"资源组名称不能为空"
)
;
}
Integer
enterpriseId
=
resourceGroup
.
getEnterpriseId
();
if
(
enterpriseId
==
null
)
{
return
"商户ID不能为空"
;
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"商户ID不能为空"
)
;
}
if
(
resourceGroupService
.
isRepeatResourceGroupName
(
resourceGroupId
,
resourceGroup
.
getResourceGroupName
(),
enterpriseId
))
{
return
"资源组名称重复"
;
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"资源组名称重复"
)
;
}
Integer
customUser
=
resourceGroup
.
getCustomUser
();
if
(
customUser
==
null
)
{
return
"用户域授予标志不能为空"
;
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户域授予标志不能为空"
)
;
}
//用户域是否授予
boolean
hasAuthCustomUser
=
customUser
==
1
;
String
customUserData
=
resourceGroup
.
getCustomUserData
();
if
(
hasAuthCustomUser
)
{
if
(
StringUtils
.
isBlank
(
customUserData
))
{
return
"用户域授予资源为空,请选择不授予"
;
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户域授予资源为空,请选择不授予"
)
;
}
try
{
List
<
ResourceGroupCustomUserDTO
>
customUserList
=
JSON
.
parseArray
(
customUserData
,
ResourceGroupCustomUserDTO
.
class
);
}
catch
(
Exception
e
)
{
return
"用户域数据格式有误"
;
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户域数据格式有误"
)
;
}
}
//微盟订单店铺配置值
setWeimobStore
(
resourceGroup
);
}
private
void
setWeimobStore
(
ResourceGroupDTO
resourceGroupDTO
)
{
Integer
ownEnterpriseId
=
resourceGroupDTO
.
getEnterpriseId
();
String
weimobStoreId
=
resourceGroupDTO
.
getWeimobStoreId
();
Integer
weimobOrderArea
=
resourceGroupDTO
.
getWeimobOrderArea
();
//授予店铺订单资源
if
(
"1"
.
equals
(
weimobOrderArea
)
&&
StringUtils
.
isNotBlank
(
weimobStoreId
))
{
//查询所有的店铺信息
List
<
String
>
wmStoreIdList
=
Arrays
.
stream
(
weimobStoreId
.
split
(
","
)).
collect
(
Collectors
.
toList
());
ServiceResponse
<
List
<
WmStoreDTO
>>
response
=
wmStoreApiService
.
listWmStore
(
wmStoreIdList
,
null
);
if
(
response
.
isSuccess
())
{
List
<
WmStoreDTO
>
wmStoreList
=
response
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
wmStoreList
))
{
//区分自有商户的店铺和共享店铺,分开存放,避免重复授权(共享店铺不能二次共享授权)
StringBuilder
weimobStoreIdOwn
=
new
StringBuilder
();
StringBuilder
weimobStoreIdShare
=
new
StringBuilder
();
for
(
int
i
=
0
,
len
=
wmStoreList
.
size
();
i
<
len
;
i
++)
{
WmStoreDTO
temp
=
wmStoreList
.
get
(
i
);
if
(
i
==
len
-
1
)
{
//最后一个,不用加逗号
if
(
ownEnterpriseId
.
equals
(
temp
.
getEnterpriseId
()))
{
weimobStoreIdOwn
.
append
(
temp
.
getWmStoreId
());
}
else
{
weimobStoreIdShare
.
append
(
temp
.
getWmStoreId
());
}
}
else
{
if
(
ownEnterpriseId
.
equals
(
temp
.
getEnterpriseId
()))
{
weimobStoreIdOwn
.
append
(
temp
.
getWmStoreId
()).
append
(
","
);
}
else
{
weimobStoreIdShare
.
append
(
temp
.
getWmStoreId
()).
append
(
","
);
}
}
}
//赋值
resourceGroupDTO
.
setWeimobStoreIdOwn
(
weimobStoreIdOwn
.
toString
());
resourceGroupDTO
.
setWeimobStoreIdShare
(
weimobStoreIdShare
.
toString
());
}
}
}
return
null
;
}
private
TabSysResourceGroup
checkExistResourceGroup
(
Integer
resourceGroupId
)
{
...
...
gic-platform-auth-service/src/main/resources/dubbo-gic-platform-auth-service.xml
View file @
fbb0ba16
...
...
@@ -81,5 +81,6 @@
<dubbo:reference
interface=
"com.gic.enterprise.service.QrCodeApiService"
id=
"qrCodeApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.enterprise.service.UnionEnterpriseAuthApiService"
id=
"unionEnterpriseAuthApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.enterprise.service.WmStoreApiService"
id=
"wmStoreApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.store.service.UnionStoreChangeApiService"
id=
"unionStoreChangeApiService"
timeout=
"6000"
/>
</beans>
gic-platform-auth-service/src/main/resources/mapper/TabSysResourceGroupMapper.xml
View file @
fbb0ba16
...
...
@@ -12,6 +12,8 @@
<result
column=
"store_order_area"
jdbcType=
"INTEGER"
property=
"storeOrderArea"
/>
<result
column=
"weimob_order_area"
jdbcType=
"INTEGER"
property=
"weimobOrderArea"
/>
<result
column=
"weimob_store_id"
jdbcType=
"VARCHAR"
property=
"weimobStoreId"
/>
<result
column=
"weimob_store_id_own"
jdbcType=
"VARCHAR"
property=
"weimobStoreIdOwn"
/>
<result
column=
"weimob_store_id_share"
jdbcType=
"VARCHAR"
property=
"weimobStoreIdShare"
/>
<result
column=
"sms_id"
jdbcType=
"VARCHAR"
property=
"smsId"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
...
...
@@ -19,7 +21,7 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
resource_group_id, resource_group_name, enterprise_id, custom_user, custom_user_data,
store_resource, goods_resource_id, store_order_area, weimob_order_area, weimob_store_id,
store_resource, goods_resource_id, store_order_area, weimob_order_area, weimob_store_id,
weimob_store_id_own, weimob_store_id_share,
sms_id, create_time, update_time, delete_flag
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
...
...
@@ -32,13 +34,14 @@
insert into tab_sys_resource_group (resource_group_id, resource_group_name,
enterprise_id, custom_user, custom_user_data,
store_resource, goods_resource_id, store_order_area,
weimob_order_area, weimob_store_id,
sms_id,
weimob_order_area, weimob_store_id,
weimob_store_id_own, weimob_store_id_share, sms_id,
create_time, update_time, delete_flag
)
values (#{resourceGroupId,jdbcType=INTEGER}, #{resourceGroupName,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=INTEGER}, #{customUser,jdbcType=INTEGER}, #{customUserData,jdbcType=VARCHAR},
#{storeResource,jdbcType=BIGINT}, #{goodsResourceId,jdbcType=BIGINT}, #{storeOrderArea,jdbcType=INTEGER},
#{weimobOrderArea,jdbcType=INTEGER}, #{weimobStoreId,jdbcType=VARCHAR}, #{smsId,jdbcType=VARCHAR},
#{weimobOrderArea,jdbcType=INTEGER}, #{weimobStoreId,jdbcType=VARCHAR}, #{weimobStoreIdOwn,jdbcType=VARCHAR}, #{weimobStoreIdShare,jdbcType=VARCHAR},
#{smsId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=INTEGER}
)
</insert>
...
...
@@ -75,6 +78,12 @@
<if
test=
"weimobStoreId != null"
>
weimob_store_id,
</if>
<if
test=
"weimobStoreIdOwn != null"
>
weimob_store_id_own,
</if>
<if
test=
"weimobStoreIdShare != null"
>
weimob_store_id_share,
</if>
<if
test=
"smsId != null"
>
sms_id,
</if>
...
...
@@ -119,6 +128,12 @@
<if
test=
"weimobStoreId != null"
>
#{weimobStoreId,jdbcType=VARCHAR},
</if>
<if
test=
"weimobStoreIdOwn != null"
>
#{weimobStoreIdOwn,jdbcType=VARCHAR},
</if>
<if
test=
"weimobStoreIdShare != null"
>
#{weimobStoreIdShare,jdbcType=VARCHAR},
</if>
<if
test=
"smsId != null"
>
#{smsId,jdbcType=VARCHAR},
</if>
...
...
@@ -163,6 +178,12 @@
<if
test=
"weimobStoreId != null"
>
weimob_store_id = #{weimobStoreId,jdbcType=VARCHAR},
</if>
<if
test=
"weimobStoreIdOwn != null"
>
weimob_store_id_own = #{weimobStoreIdOwn,jdbcType=VARCHAR},
</if>
<if
test=
"weimobStoreIdShare != null"
>
weimob_store_id_share = #{weimobStoreIdShare,jdbcType=VARCHAR},
</if>
<if
test=
"smsId != null"
>
sms_id = #{smsId,jdbcType=VARCHAR},
</if>
...
...
@@ -189,6 +210,8 @@
store_order_area = #{storeOrderArea,jdbcType=INTEGER},
weimob_order_area = #{weimobOrderArea,jdbcType=INTEGER},
weimob_store_id = #{weimobStoreId,jdbcType=VARCHAR},
weimob_store_id_own = #{weimobStoreIdOwn,jdbcType=VARCHAR},
weimob_store_id_share = #{weimobStoreIdShare,jdbcType=VARCHAR},
sms_id = #{smsId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
...
...
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