Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
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-enterprise
Commits
9ae5fad9
Commit
9ae5fad9
authored
Feb 24, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
联合授权资源组用户域
parent
b8449447
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
31 deletions
+112
-31
UnionEnterpriseAuthApiService.java
...gic/enterprise/service/UnionEnterpriseAuthApiService.java
+7
-0
UnionEnterpriseAuthResDetailApiService.java
...prise/service/UnionEnterpriseAuthResDetailApiService.java
+21
-0
TabSysUnionEnterpriseAuthMapper.java
...nterprise/dao/mapper/TabSysUnionEnterpriseAuthMapper.java
+8
-0
UnionEnterpriseAuthService.java
...om/gic/enterprise/service/UnionEnterpriseAuthService.java
+7
-0
UnionEnterpriseAuthServiceImpl.java
...terprise/service/impl/UnionEnterpriseAuthServiceImpl.java
+9
-0
UnionEnterpriseAuthApiServiceImpl.java
...e/outer/impl/union/UnionEnterpriseAuthApiServiceImpl.java
+5
-0
UnionEnterpriseAuthResDetailApiServiceImpl.java
...mpl/union/UnionEnterpriseAuthResDetailApiServiceImpl.java
+47
-31
TabSysUnionEnterpriseAuthMapper.xml
...main/resources/mapper/TabSysUnionEnterpriseAuthMapper.xml
+8
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/UnionEnterpriseAuthApiService.java
View file @
9ae5fad9
...
...
@@ -137,4 +137,11 @@ public interface UnionEnterpriseAuthApiService {
* @return
*/
ServiceResponse
<
Page
<
UnionEnterpriseAuthResLogDTO
>>
listUnionEnterpriseAuthResLog
(
UnionEnterpriseAuthResLogQO
param
);
/**
* 资源组是否已经联合授权
* @param resourceGroupId
* @return
*/
ServiceResponse
<
Boolean
>
hasUnionEnterpriseAuth
(
Integer
resourceGroupId
);
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/UnionEnterpriseAuthResDetailApiService.java
View file @
9ae5fad9
...
...
@@ -40,4 +40,25 @@ public interface UnionEnterpriseAuthResDetailApiService {
*/
ServiceResponse
<
Void
>
relieveForStore
(
@NotNull
Integer
authStatus
,
@NotNull
Integer
ownEnterpriseId
,
@NotNull
Integer
unionEnterpriseId
);
/**
* 用户域资源授权回调
* @param authStatus 资源联合状态 UnionEnterpriseAuthDetailStatusEnum
* @param ownEnterpriseId 自有商户ID
* @param unionEnterpriseId 联合商户ID
* @param authKey 用于重新授权节点
* @param remark 授权备注
* @return
*/
ServiceResponse
<
Void
>
unionForUser
(
@NotNull
Integer
authStatus
,
@NotNull
Integer
ownEnterpriseId
,
@NotNull
Integer
unionEnterpriseId
,
String
authKey
,
String
remark
);
/**
* 用户域资源解除联合进程
* @param authStatus UnionEnterpriseAuthDetailStatusEnum 会有资源处理中,解除成功等状态
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
ServiceResponse
<
Void
>
relieveForUser
(
@NotNull
Integer
authStatus
,
@NotNull
Integer
ownEnterpriseId
,
@NotNull
Integer
unionEnterpriseId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/dao/mapper/TabSysUnionEnterpriseAuthMapper.java
View file @
9ae5fad9
...
...
@@ -100,4 +100,11 @@ public interface TabSysUnionEnterpriseAuthMapper {
* @return
*/
List
<
TabSysUnionEnterpriseAuth
>
listUnionEnterprise
(
@Param
(
"ownEnterpriseId"
)
Integer
ownEnterpriseId
);
/**
* 联合授权数量
* @param resourceGroupId
* @return
*/
int
countUnionEnterpriseAuth
(
@Param
(
"resourceGroupId"
)
Integer
resourceGroupId
);
}
\ No newline at end of file
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/UnionEnterpriseAuthService.java
View file @
9ae5fad9
...
...
@@ -69,4 +69,11 @@ public interface UnionEnterpriseAuthService {
* @return
*/
List
<
TabSysUnionEnterpriseAuth
>
listUnionEnterpriseAuth
(
@NotNull
Integer
ownEnterpriseId
);
/**
* 是否已经联合授权
* @param resourceGroupId
* @return
*/
Boolean
hasUnionEnterpriseAuth
(
Integer
resourceGroupId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/UnionEnterpriseAuthServiceImpl.java
View file @
9ae5fad9
...
...
@@ -72,4 +72,13 @@ public class UnionEnterpriseAuthServiceImpl implements UnionEnterpriseAuthServic
return
tabSysUnionEnterpriseAuthMapper
.
listUnionEnterprise
(
ownEnterpriseId
);
}
@Override
public
Boolean
hasUnionEnterpriseAuth
(
Integer
resourceGroupId
)
{
int
count
=
tabSysUnionEnterpriseAuthMapper
.
countUnionEnterpriseAuth
(
resourceGroupId
);
if
(
count
>
0
)
{
return
true
;
}
return
false
;
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/union/UnionEnterpriseAuthApiServiceImpl.java
View file @
9ae5fad9
...
...
@@ -375,6 +375,11 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
return
ServiceResponse
.
success
(
PageHelperUtils
.
changePageHelperToCurrentPage
(
page
,
UnionEnterpriseAuthResLogDTO
.
class
));
}
@Override
public
ServiceResponse
<
Boolean
>
hasUnionEnterpriseAuth
(
Integer
resourceGroupId
)
{
return
ServiceResponse
.
success
(
unionEnterpriseAuthService
.
hasUnionEnterpriseAuth
(
resourceGroupId
));
}
private
Map
<
Integer
,
TabEnterprise
>
getEnterprise
(
List
<
Integer
>
enterpriseIdList
)
{
List
<
TabEnterprise
>
enterpriseList
=
enterpriseService
.
listEnterpriseByIds
(
enterpriseIdList
);
if
(
CollectionUtils
.
isNotEmpty
(
enterpriseList
))
{
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/union/UnionEnterpriseAuthResDetailApiServiceImpl.java
View file @
9ae5fad9
...
...
@@ -46,55 +46,48 @@ public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpri
@Override
public
ServiceResponse
<
Void
>
unionForStore
(
@NotNull
Integer
authStatus
,
@NotNull
Integer
ownEnterpriseId
,
@NotNull
Integer
unionEnterpriseId
,
String
authKey
,
String
remark
)
{
TabSysUnionEnterpriseAuth
old
=
unionEnterpriseAuthService
.
getUnionEnterprise
(
ownEnterpriseId
,
unionEnterpriseId
);
if
(
old
==
null
)
{
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"联合商户不存在"
);
}
TabSysUnionEnterpriseAuthResDetail
detail
=
unionEnterpriseAuthResDetailService
.
getUnionEnterpriseAuthResDetail
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
());
boolean
isUnionSuccess
=
UnionEnterpriseAuthDetailStatusEnum
.
HAS_AUTH
.
getCode
().
equals
(
authStatus
);
//日志
if
(
isUnionSuccess
)
{
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
(),
UnionEnterpriseAuthResOperateEnum
.
UNION
.
getMessage
(),
null
,
new
Date
());
}
else
{
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
(),
UnionEnterpriseAuthResOperateEnum
.
UNION
.
getMessage
(),
new
Date
(),
null
);
}
//如果是,则判断其他资源是否已经完成
if
(
isUnionSuccess
&&
isAllDealSuccess
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
(),
true
))
{
//更新最新联合时间()
UnionEnterpriseAuthDTO
dto
=
new
UnionEnterpriseAuthDTO
();
dto
.
setUnionEnterpriseAuthId
(
old
.
getUnionEnterpriseAuthId
());
dto
.
setLastUnionTime
(
new
Date
());
unionEnterpriseAuthService
.
update
(
dto
);
}
unionEnterpriseAuthResDetailService
.
union
(
detail
.
getUnionEnterpriseAuthResDetailId
(),
authStatus
,
authKey
,
remark
);
unionCommon
(
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
(),
authStatus
,
ownEnterpriseId
,
unionEnterpriseId
,
authKey
,
remark
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
relieveForStore
(
@NotNull
Integer
authStatus
,
@NotNull
Integer
ownEnterpriseId
,
@NotNull
Integer
unionEnterpriseId
)
{
relieveCommon
(
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
(),
authStatus
,
ownEnterpriseId
,
unionEnterpriseId
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
unionForUser
(
@NotNull
Integer
authStatus
,
@NotNull
Integer
ownEnterpriseId
,
@NotNull
Integer
unionEnterpriseId
,
String
authKey
,
String
remark
)
{
unionCommon
(
UnionEnterpriseAuthResTypeEnum
.
USER_AREA
.
getCode
(),
authStatus
,
ownEnterpriseId
,
unionEnterpriseId
,
authKey
,
remark
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
relieveForUser
(
@NotNull
Integer
authStatus
,
@NotNull
Integer
ownEnterpriseId
,
@NotNull
Integer
unionEnterpriseId
)
{
relieveCommon
(
UnionEnterpriseAuthResTypeEnum
.
USER_AREA
.
getCode
(),
authStatus
,
ownEnterpriseId
,
unionEnterpriseId
);
return
ServiceResponse
.
success
();
}
private
void
relieveCommon
(
Integer
resourceType
,
Integer
authStatus
,
Integer
ownEnterpriseId
,
Integer
unionEnterpriseId
)
{
TabSysUnionEnterpriseAuth
old
=
unionEnterpriseAuthService
.
getUnionEnterprise
(
ownEnterpriseId
,
unionEnterpriseId
);
if
(
old
==
null
)
{
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"联合商户不存在"
);
}
TabSysUnionEnterpriseAuthResDetail
detail
=
unionEnterpriseAuthResDetailService
.
getUnionEnterpriseAuthResDetail
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
()
);
.
getUnionEnterpriseAuthResDetail
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
);
boolean
isAllRelieveSuccess
=
UnionEnterpriseAuthDetailStatusEnum
.
HAS_RELIEVE
.
getCode
().
equals
(
authStatus
);
if
(
isAllRelieveSuccess
)
{
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
()
,
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
,
UnionEnterpriseAuthResOperateEnum
.
RELIEVED
.
getMessage
(),
null
,
new
Date
());
}
else
{
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
()
,
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
,
UnionEnterpriseAuthResOperateEnum
.
RELIEVED
.
getMessage
(),
new
Date
(),
null
);
}
//如果是,则判断其他资源是否已经完成
UnionEnterpriseAuthDTO
dto
=
new
UnionEnterpriseAuthDTO
();
dto
.
setUnionEnterpriseAuthId
(
old
.
getUnionEnterpriseAuthId
());
if
(
isAllRelieveSuccess
&&
isAllDealSuccess
(
old
.
getUnionEnterpriseAuthId
(),
UnionEnterpriseAuthResTypeEnum
.
STORE
.
getCode
()
,
false
))
{
if
(
isAllRelieveSuccess
&&
isAllDealSuccess
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
,
false
))
{
//更新最新联合时间()
dto
.
setLastRelieveTime
(
new
Date
());
dto
.
setStatusFlag
(
UnionEnterpriseAuthStatusEnum
.
RELIEVED
.
getCode
());
...
...
@@ -103,11 +96,34 @@ public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpri
}
unionEnterpriseAuthService
.
update
(
dto
);
unionEnterpriseAuthResDetailService
.
union
(
detail
.
getUnionEnterpriseAuthResDetailId
(),
authStatus
,
null
,
null
);
return
ServiceResponse
.
success
();
}
private
void
unionCommon
(
Integer
authStatus
,
Integer
ownEnterpriseId
,
Integer
unionEnterpriseId
,
String
authKey
,
String
remark
)
{
private
void
unionCommon
(
Integer
resourceType
,
Integer
authStatus
,
Integer
ownEnterpriseId
,
Integer
unionEnterpriseId
,
String
authKey
,
String
remark
)
{
TabSysUnionEnterpriseAuth
old
=
unionEnterpriseAuthService
.
getUnionEnterprise
(
ownEnterpriseId
,
unionEnterpriseId
);
if
(
old
==
null
)
{
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"联合商户不存在"
);
}
TabSysUnionEnterpriseAuthResDetail
detail
=
unionEnterpriseAuthResDetailService
.
getUnionEnterpriseAuthResDetail
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
);
boolean
isUnionSuccess
=
UnionEnterpriseAuthDetailStatusEnum
.
HAS_AUTH
.
getCode
().
equals
(
authStatus
);
//日志
if
(
isUnionSuccess
)
{
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
,
UnionEnterpriseAuthResOperateEnum
.
UNION
.
getMessage
(),
null
,
new
Date
());
}
else
{
unionEnterpriseAuthResLogService
.
saveUnionEnterpriseAuthResLog
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
,
UnionEnterpriseAuthResOperateEnum
.
UNION
.
getMessage
(),
new
Date
(),
null
);
}
//如果是,则判断其他资源是否已经完成
if
(
isUnionSuccess
&&
isAllDealSuccess
(
old
.
getUnionEnterpriseAuthId
(),
resourceType
,
true
))
{
//更新最新联合时间()
UnionEnterpriseAuthDTO
dto
=
new
UnionEnterpriseAuthDTO
();
dto
.
setUnionEnterpriseAuthId
(
old
.
getUnionEnterpriseAuthId
());
dto
.
setLastUnionTime
(
new
Date
());
unionEnterpriseAuthService
.
update
(
dto
);
}
unionEnterpriseAuthResDetailService
.
union
(
detail
.
getUnionEnterpriseAuthResDetailId
(),
authStatus
,
authKey
,
remark
);
}
/**
...
...
gic-platform-enterprise-service/src/main/resources/mapper/TabSysUnionEnterpriseAuthMapper.xml
View file @
9ae5fad9
...
...
@@ -319,4 +319,11 @@
and status_flag != 3
and own_enterprise_id = #{ownEnterpriseId}
</select>
<select
id=
"countUnionEnterpriseAuth"
resultType=
"int"
>
select count(1) from tab_sys_union_enterprise_auth
where delete_flag = 0
and status_flag != 3
and resource_group_id = #{resourceGroupId}
</select>
</mapper>
\ No newline at end of file
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