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
e744cda9
Commit
e744cda9
authored
Sep 02, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
8953e98f
8245ffec
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
578 additions
and
0 deletions
+578
-0
AuthCodeDTO.java
...-auth-api/src/main/java/com/gic/auth/dto/AuthCodeDTO.java
+89
-0
AuthCodeApiService.java
...rc/main/java/com/gic/auth/service/AuthCodeApiService.java
+31
-0
TabSysAuthCodeMapper.java
...in/java/com/gic/auth/dao/mapper/TabSysAuthCodeMapper.java
+59
-0
TabSysAuthCode.java
...ice/src/main/java/com/gic/auth/entity/TabSysAuthCode.java
+113
-0
AuthCodeService.java
...e/src/main/java/com/gic/auth/service/AuthCodeService.java
+11
-0
AuthCodeServiceImpl.java
...n/java/com/gic/auth/service/impl/AuthCodeServiceImpl.java
+38
-0
AuthCodeApiServiceImpl.java
...m/gic/auth/service/outer/impl/AuthCodeApiServiceImpl.java
+39
-0
dubbo-gic-platform-auth-service.xml
...ce/src/main/resources/dubbo-gic-platform-auth-service.xml
+1
-0
TabSysAuthCodeMapper.xml
...ervice/src/main/resources/mapper/TabSysAuthCodeMapper.xml
+142
-0
AuthCodeController.java
.../java/com/gic/auth/web/controller/AuthCodeController.java
+53
-0
dubbo-gic-platform-auth-web.xml
...th-web/src/main/resources/dubbo-gic-platform-auth-web.xml
+2
-0
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/dto/AuthCodeDTO.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
dto
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* tab_sys_auth_code
*/
public
class
AuthCodeDTO
implements
Serializable
{
/**
*
*/
private
Integer
authCodeId
;
/**
* 验证码
*/
private
String
authCode
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 关联业务id
*/
private
Integer
relationId
;
/**
* 1有效 0失效
*/
private
Integer
status
;
/**
*
*/
private
Date
expirationTime
;
public
Integer
getAuthCodeId
()
{
return
authCodeId
;
}
public
void
setAuthCodeId
(
Integer
authCodeId
)
{
this
.
authCodeId
=
authCodeId
;
}
public
String
getAuthCode
()
{
return
authCode
;
}
public
void
setAuthCode
(
String
authCode
)
{
this
.
authCode
=
authCode
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getRelationId
()
{
return
relationId
;
}
public
void
setRelationId
(
Integer
relationId
)
{
this
.
relationId
=
relationId
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Date
getExpirationTime
()
{
return
expirationTime
;
}
public
void
setExpirationTime
(
Date
expirationTime
)
{
this
.
expirationTime
=
expirationTime
;
}
}
\ No newline at end of file
gic-platform-auth-api/src/main/java/com/gic/auth/service/AuthCodeApiService.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
service
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.AuthCodeDTO
;
public
interface
AuthCodeApiService
{
/** @Description: 保存验证码
* @author taogs
* @Date 11:09 2019/9/2
* @Param
* @return
*/
ServiceResponse
<
Integer
>
saveAuth
(
AuthCodeDTO
authCodeDTO
);
/** @Description: 设置验证码无效
* @author taogs
* @Date 11:09 2019/9/2
* @Param
* @return
*/
ServiceResponse
<
Integer
>
expireAuthCode
(
Integer
authCodeId
);
/** @Description: 获取验证码
* @author taogs
* @Date 11:10 2019/9/2
* @Param
* @return
*/
ServiceResponse
<
AuthCodeDTO
>
getAuthCode
(
Integer
enterpriseId
,
Integer
relationId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysAuthCodeMapper.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
com.gic.auth.entity.TabSysAuthCode
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
TabSysAuthCodeMapper
{
/**
* 根据主键删除
*
* @param authCodeId 主键
* @return 更新条目数
*/
int
deleteByPrimaryKey
(
Integer
authCodeId
);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insert
(
TabSysAuthCode
record
);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insertSelective
(
TabSysAuthCode
record
);
/**
* 根据主键查询
*
* @param authCodeId 主键
* @return 实体对象
*/
TabSysAuthCode
selectByPrimaryKey
(
Integer
authCodeId
);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKeySelective
(
TabSysAuthCode
record
);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabSysAuthCode
record
);
List
<
TabSysAuthCode
>
getAuthCode
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"relationId"
)
Integer
relationId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabSysAuthCode.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
entity
;
import
java.util.Date
;
/**
* tab_sys_auth_code
*/
public
class
TabSysAuthCode
{
/**
*
*/
private
Integer
authCodeId
;
/**
* 验证码
*/
private
String
authCode
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 关联业务id
*/
private
Integer
relationId
;
/**
* 1有效 0失效
*/
private
Integer
status
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
expirationTime
;
/**
*
*/
private
Date
updateTime
;
public
Integer
getAuthCodeId
()
{
return
authCodeId
;
}
public
void
setAuthCodeId
(
Integer
authCodeId
)
{
this
.
authCodeId
=
authCodeId
;
}
public
String
getAuthCode
()
{
return
authCode
;
}
public
void
setAuthCode
(
String
authCode
)
{
this
.
authCode
=
authCode
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getRelationId
()
{
return
relationId
;
}
public
void
setRelationId
(
Integer
relationId
)
{
this
.
relationId
=
relationId
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getExpirationTime
()
{
return
expirationTime
;
}
public
void
setExpirationTime
(
Date
expirationTime
)
{
this
.
expirationTime
=
expirationTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/AuthCodeService.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
service
;
import
com.gic.auth.entity.TabSysAuthCode
;
public
interface
AuthCodeService
{
int
saveAuthCode
(
TabSysAuthCode
tabSysAuthCode
);
int
expireAuthCode
(
Integer
authCodeId
);
TabSysAuthCode
getAuthCode
(
Integer
enterpriseId
,
Integer
relationId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/AuthCodeServiceImpl.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
service
.
impl
;
import
com.gic.auth.dao.mapper.TabSysAuthCodeMapper
;
import
com.gic.auth.entity.TabSysAuthCode
;
import
com.gic.auth.service.AuthCodeService
;
import
com.gic.enterprise.constants.Constants
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
(
"authCodeService"
)
public
class
AuthCodeServiceImpl
implements
AuthCodeService
{
@Autowired
private
TabSysAuthCodeMapper
tabSysAuthCodeMapper
;
@Override
public
int
saveAuthCode
(
TabSysAuthCode
tabSysAuthCode
)
{
return
this
.
tabSysAuthCodeMapper
.
insert
(
tabSysAuthCode
);
}
@Override
public
int
expireAuthCode
(
Integer
authCodeId
)
{
TabSysAuthCode
tabSysAuthCode
=
new
TabSysAuthCode
();
tabSysAuthCode
.
setAuthCodeId
(
authCodeId
);
tabSysAuthCode
.
setStatus
(
Constants
.
DEL_STATUS
);
return
this
.
tabSysAuthCodeMapper
.
updateByPrimaryKeySelective
(
tabSysAuthCode
);
}
@Override
public
TabSysAuthCode
getAuthCode
(
Integer
enterpriseId
,
Integer
relationId
)
{
List
<
TabSysAuthCode
>
list
=
this
.
tabSysAuthCodeMapper
.
getAuthCode
(
enterpriseId
,
relationId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
return
list
.
get
(
0
);
}
return
null
;
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/AuthCodeApiServiceImpl.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.AuthCodeDTO
;
import
com.gic.auth.entity.TabSysAuthCode
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
@Service
(
"authCodeApiService"
)
public
class
AuthCodeApiServiceImpl
implements
AuthCodeApiService
{
@Autowired
private
AuthCodeService
authCodeService
;
@Override
public
ServiceResponse
<
Integer
>
saveAuth
(
AuthCodeDTO
authCodeDTO
)
{
TabSysAuthCode
sysAuthCode
=
EntityUtil
.
changeEntityByJSON
(
TabSysAuthCode
.
class
,
authCodeDTO
);
sysAuthCode
.
setCreateTime
(
new
Date
());
sysAuthCode
.
setUpdateTime
(
new
Date
());
sysAuthCode
.
setStatus
(
Constants
.
NORMAL_STATUS
);
int
result
=
this
.
authCodeService
.
saveAuthCode
(
sysAuthCode
);
return
ServiceResponse
.
success
(
result
);
}
@Override
public
ServiceResponse
<
Integer
>
expireAuthCode
(
Integer
authCodeId
)
{
int
result
=
this
.
authCodeService
.
expireAuthCode
(
authCodeId
);
return
ServiceResponse
.
success
(
result
);
}
@Override
public
ServiceResponse
<
AuthCodeDTO
>
getAuthCode
(
Integer
enterpriseId
,
Integer
relationId
)
{
TabSysAuthCode
sysAuthCode
=
this
.
authCodeService
.
getAuthCode
(
enterpriseId
,
relationId
);
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityByJSON
(
AuthCodeDTO
.
class
,
sysAuthCode
));
}
}
gic-platform-auth-service/src/main/resources/dubbo-gic-platform-auth-service.xml
View file @
e744cda9
...
...
@@ -20,4 +20,5 @@
<dubbo:reference
interface=
"com.gic.log.api.service.LogApiService"
id=
"logApiService"
timeout=
"6000"
/>
<!--资源组-->
<dubbo:service
interface=
"com.gic.auth.service.ResourceApiService"
ref=
"resourceApiService"
timeout=
"6000"
/>
<dubbo:service
interface=
"com.gic.auth.service.AuthCodeApiService"
ref=
"authCodeApiService"
timeout=
"6000"
/>
</beans>
gic-platform-auth-service/src/main/resources/mapper/TabSysAuthCodeMapper.xml
0 → 100644
View file @
e744cda9
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.gic.auth.dao.mapper.TabSysAuthCodeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.auth.entity.TabSysAuthCode"
>
<id
column=
"auth_code_id"
jdbcType=
"INTEGER"
property=
"authCodeId"
/>
<result
column=
"auth_code"
jdbcType=
"VARCHAR"
property=
"authCode"
/>
<result
column=
"enterprise_id"
jdbcType=
"INTEGER"
property=
"enterpriseId"
/>
<result
column=
"relation_id"
jdbcType=
"INTEGER"
property=
"relationId"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"expiration_time"
jdbcType=
"TIMESTAMP"
property=
"expirationTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
auth_code_id, auth_code, enterprise_id, relation_id, status, create_time, expiration_time,
update_time
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_auth_code
where auth_code_id = #{authCodeId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from tab_sys_auth_code
where auth_code_id = #{authCodeId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.auth.entity.TabSysAuthCode"
>
insert into tab_sys_auth_code (auth_code_id, auth_code, enterprise_id,
relation_id, status, create_time,
expiration_time, update_time)
values (#{authCodeId,jdbcType=INTEGER}, #{authCode,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=INTEGER},
#{relationId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{expirationTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.auth.entity.TabSysAuthCode"
>
insert into tab_sys_auth_code
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"authCodeId != null"
>
auth_code_id,
</if>
<if
test=
"authCode != null"
>
auth_code,
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id,
</if>
<if
test=
"relationId != null"
>
relation_id,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"expirationTime != null"
>
expiration_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"authCodeId != null"
>
#{authCodeId,jdbcType=INTEGER},
</if>
<if
test=
"authCode != null"
>
#{authCode,jdbcType=VARCHAR},
</if>
<if
test=
"enterpriseId != null"
>
#{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"relationId != null"
>
#{relationId,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"expirationTime != null"
>
#{expirationTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.auth.entity.TabSysAuthCode"
>
update tab_sys_auth_code
<set>
<if
test=
"authCode != null"
>
auth_code = #{authCode,jdbcType=VARCHAR},
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"relationId != null"
>
relation_id = #{relationId,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
status = #{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"expirationTime != null"
>
expiration_time = #{expirationTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where auth_code_id = #{authCodeId,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.auth.entity.TabSysAuthCode"
>
update tab_sys_auth_code
set auth_code = #{authCode,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
relation_id = #{relationId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
expiration_time = #{expirationTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where auth_code_id = #{authCodeId,jdbcType=INTEGER}
</update>
<select
id=
"getAuthCode"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_auth_code
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
<if
test=
"relationId != null"
>
and relation_id = #{relationId}
</if>
and status=1
and expiration_time
>
= now()
order by create_time desc
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/AuthCodeController.java
0 → 100644
View file @
e744cda9
package
com
.
gic
.
auth
.
web
.
controller
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.AuthCodeDTO
;
import
com.gic.auth.service.AuthCodeApiService
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
org.apache.log4j.LogManager
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Calendar
;
import
java.util.Date
;
@RestController
public
class
AuthCodeController
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
AuthCodeController
.
class
);
@Autowired
private
AuthCodeApiService
authCodeApiService
;
@RequestMapping
(
"send-auth-code"
)
public
RestResponse
sendAuthCode
(
Integer
eid
){
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
//todo 调用发送验证码模块获取验证码
String
code
=
"12345"
;
AuthCodeDTO
authCodeDTO
=
new
AuthCodeDTO
();
authCodeDTO
.
setAuthCode
(
code
);
authCodeDTO
.
setEnterpriseId
(
enterpriseId
);
authCodeDTO
.
setRelationId
(
eid
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
calendar
.
add
(
Calendar
.
MINUTE
,
5
);
authCodeDTO
.
setExpirationTime
(
calendar
.
getTime
());
ServiceResponse
<
Integer
>
serviceResponse
=
this
.
authCodeApiService
.
saveAuth
(
authCodeDTO
);
return
RestResponse
.
success
(
serviceResponse
.
getResult
());
}
@RequestMapping
(
"expire-auth-code"
)
public
RestResponse
expireAuthCode
(
Integer
authCodeId
){
ServiceResponse
<
Integer
>
serviceResponse
=
this
.
authCodeApiService
.
expireAuthCode
(
authCodeId
);
return
RestResponse
.
success
(
serviceResponse
.
getResult
());
}
@RequestMapping
(
"get-auth-code"
)
public
RestResponse
getAuthCode
(
Integer
eid
){
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
ServiceResponse
<
AuthCodeDTO
>
authCode
=
this
.
authCodeApiService
.
getAuthCode
(
enterpriseId
,
eid
);
return
RestResponse
.
success
(
authCode
.
getResult
());
}
}
gic-platform-auth-web/src/main/resources/dubbo-gic-platform-auth-web.xml
View file @
e744cda9
...
...
@@ -41,5 +41,6 @@
<!--资源组-->
<dubbo:reference
interface=
"com.gic.auth.service.ResourceApiService"
id=
"resourceApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.auth.service.AuthCodeApiService"
id=
"authCodeApiService"
timeout=
"6000"
/>
</beans>
\ 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