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
8e17bb3d
Commit
8e17bb3d
authored
Sep 10, 2019
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加验证码验证接口
parent
6681df08
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
2 deletions
+38
-2
AuthCodeApiService.java
...rc/main/java/com/gic/auth/service/AuthCodeApiService.java
+2
-0
MenuServiceImpl.java
.../main/java/com/gic/auth/service/impl/MenuServiceImpl.java
+3
-0
AuthCodeApiServiceImpl.java
...m/gic/auth/service/outer/impl/AuthCodeApiServiceImpl.java
+24
-0
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+9
-2
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/service/AuthCodeApiService.java
View file @
8e17bb3d
...
...
@@ -30,4 +30,6 @@ public interface AuthCodeApiService {
ServiceResponse
<
AuthCodeDTO
>
getAuthCode
(
Integer
enterpriseId
,
Integer
relationId
);
ServiceResponse
<
AuthCodeDTO
>
getAuthCode
(
Integer
authCodeId
);
ServiceResponse
validateAuthCode
(
Integer
authCodeId
,
String
authCode
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/MenuServiceImpl.java
View file @
8e17bb3d
package
com
.
gic
.
auth
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.auth.dao.mapper.TabSysMenuMapper
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.service.MenuService
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -13,6 +15,7 @@ public class MenuServiceImpl implements MenuService {
private
TabSysMenuMapper
tabSysMenuMapper
;
@Override
public
List
<
TabSysMenu
>
listMenu
()
{
System
.
out
.
println
(
"menuService:"
+
JSON
.
toJSONString
(
RpcContext
.
getContext
().
getAttachments
()));
return
this
.
tabSysMenuMapper
.
listMenu
();
}
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/AuthCodeApiServiceImpl.java
View file @
8e17bb3d
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.AuthCodeDTO
;
import
com.gic.auth.entity.TabSysAuthCode
;
...
...
@@ -7,6 +8,9 @@ import com.gic.auth.service.AuthCodeApiService;
import
com.gic.auth.service.AuthCodeService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.constants.Constants
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.response.EnterpriseServiceResponse
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -39,7 +43,27 @@ public class AuthCodeApiServiceImpl implements AuthCodeApiService {
@Override
public
ServiceResponse
<
AuthCodeDTO
>
getAuthCode
(
Integer
authCodeId
)
{
System
.
out
.
println
(
"authCodeApiService:"
+
JSON
.
toJSONString
(
RpcContext
.
getContext
().
getAttachments
()));
TabSysAuthCode
sysAuthCode
=
this
.
authCodeService
.
getAuthCode
(
authCodeId
);
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityByJSON
(
AuthCodeDTO
.
class
,
sysAuthCode
));
}
@Override
public
ServiceResponse
validateAuthCode
(
Integer
authCodeId
,
String
authCode
)
{
TabSysAuthCode
sysAuthCode
=
this
.
authCodeService
.
getAuthCode
(
authCodeId
);
if
(
sysAuthCode
!=
null
){
if
(
sysAuthCode
.
getStatus
()
==
0
){
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
AUTHCODE_USED
);
}
if
(
sysAuthCode
.
getExpirationTime
().
before
(
new
Date
())){
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
AUTHCODE_EXPIRE
);
}
if
(!
sysAuthCode
.
getAuthCode
().
equals
(
authCode
)){
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
AUTHCODE_MISTAKE
);
}
}
else
{
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
AUTHCODE_ERR
);
}
return
ServiceResponse
.
success
();
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
8e17bb3d
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.service.AuthCodeApiService
;
import
com.gic.auth.service.MenuApiService
;
import
com.gic.auth.service.MenuService
;
import
com.gic.commons.util.EntityUtil
;
...
...
@@ -14,14 +16,18 @@ import org.springframework.stereotype.Service;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@Service
(
"menuApiService"
)
public
class
MenuApiServiceImpl
implements
MenuApiService
{
@Autowired
private
MenuService
menuService
;
@Autowired
private
AuthCodeApiService
authCodeApiService
;
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
getUserMenu
(
Integer
userId
,
Integer
enterpriseId
,
Integer
currentMenu
)
{
System
.
out
.
println
(
RpcContext
.
getContext
().
getAttachments
()
);
System
.
out
.
println
(
UserDetailUtils
.
getUserDetail
(
));
Map
<
String
,
String
>
attachments
=
RpcContext
.
getContext
().
getAttachments
(
);
System
.
out
.
println
(
"menuApiService:"
+
JSON
.
toJSONString
(
attachments
));
List
<
TabSysMenu
>
menuList
=
this
.
menuService
.
listMenu
();
int
level
=
1
;
int
parentId
=
0
;
...
...
@@ -30,6 +36,7 @@ public class MenuApiServiceImpl implements MenuApiService {
parentId
=
currentMenu
;
level
=
menu
.
getLevel
()+
1
;
}
this
.
authCodeApiService
.
getAuthCode
(
1
);
return
ServiceResponse
.
success
(
this
.
treeMenu
(
menuList
,
level
,
parentId
));
}
...
...
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