Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
T
tcm-system
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
TCM
tcm-system
Commits
37fec4be
Commit
37fec4be
authored
Dec 23, 2025
by
tangfang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户,角色,权限
parent
82604655
Changes
45
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
2435 additions
and
0 deletions
+2435
-0
TcmAuthorityDao.java
...in/java/com/tcm/system/authority/dao/TcmAuthorityDao.java
+17
-0
TcmRoleAuthorityDao.java
...ava/com/tcm/system/authority/dao/TcmRoleAuthorityDao.java
+11
-0
TcmAuthorityDaoImpl.java
...om/tcm/system/authority/dao/impl/TcmAuthorityDaoImpl.java
+51
-0
TcmRoleAuthorityDaoImpl.java
...cm/system/authority/dao/impl/TcmRoleAuthorityDaoImpl.java
+32
-0
TcmAuthorityService.java
...com/tcm/system/authority/service/TcmAuthorityService.java
+31
-0
TcmAuthorityServiceImpl.java
...ystem/authority/service/impl/TcmAuthorityServiceImpl.java
+285
-0
TcmAuthorityVo.java
...main/java/com/tcm/system/authority/vo/TcmAuthorityVo.java
+180
-0
TcmRoleAuthorityVo.java
.../java/com/tcm/system/authority/vo/TcmRoleAuthorityVo.java
+53
-0
TcmAuthorityPageReqVo.java
...om/tcm/system/authority/vo/req/TcmAuthorityPageReqVo.java
+161
-0
TcmAuthorityReqVo.java
...va/com/tcm/system/authority/vo/req/TcmAuthorityReqVo.java
+6
-0
TcmAuthoritySaveReqVo.java
...om/tcm/system/authority/vo/req/TcmAuthoritySaveReqVo.java
+6
-0
TcmRoleAuthorityReqVo.java
...om/tcm/system/authority/vo/req/TcmRoleAuthorityReqVo.java
+24
-0
TcmAuthorityListByLevelResVo.java
...system/authority/vo/res/TcmAuthorityListByLevelResVo.java
+19
-0
TcmAuthorityListResVo.java
...om/tcm/system/authority/vo/res/TcmAuthorityListResVo.java
+29
-0
TcmAuthorityResVo.java
...va/com/tcm/system/authority/vo/res/TcmAuthorityResVo.java
+6
-0
TcmAuthorityController.java
.../com/tcm/system/authority/web/TcmAuthorityController.java
+106
-0
TcmRoleDao.java
src/main/java/com/tcm/system/role/dao/TcmRoleDao.java
+12
-0
TcmRoleDaoImpl.java
...ain/java/com/tcm/system/role/dao/impl/TcmRoleDaoImpl.java
+33
-0
TcmRoleService.java
...main/java/com/tcm/system/role/service/TcmRoleService.java
+11
-0
TcmRoleServiceImpl.java
.../com/tcm/system/role/service/impl/TcmRoleServiceImpl.java
+26
-0
TcmRoleVo.java
src/main/java/com/tcm/system/role/vo/TcmRoleVo.java
+122
-0
TcmRolePageReqVo.java
...ain/java/com/tcm/system/role/vo/req/TcmRolePageReqVo.java
+29
-0
TcmRoleListResVo.java
...ain/java/com/tcm/system/role/vo/res/TcmRoleListResVo.java
+16
-0
TcmRoleController.java
src/main/java/com/tcm/system/role/web/TcmRoleController.java
+32
-0
TokenDao.java
src/main/java/com/tcm/system/user/dao/TokenDao.java
+11
-0
UserDao.java
src/main/java/com/tcm/system/user/dao/UserDao.java
+17
-0
TokenDaoImpl.java
src/main/java/com/tcm/system/user/dao/impl/TokenDaoImpl.java
+28
-0
UserDaoImpl.java
src/main/java/com/tcm/system/user/dao/impl/UserDaoImpl.java
+32
-0
LoginService.java
src/main/java/com/tcm/system/user/service/LoginService.java
+10
-0
TokenService.java
src/main/java/com/tcm/system/user/service/TokenService.java
+34
-0
UserService.java
src/main/java/com/tcm/system/user/service/UserService.java
+18
-0
ValidateCodeService.java
...java/com/tcm/system/user/service/ValidateCodeService.java
+89
-0
LoginServiceImpl.java
...va/com/tcm/system/user/service/impl/LoginServiceImpl.java
+117
-0
TokenServiceImpl.java
...va/com/tcm/system/user/service/impl/TokenServiceImpl.java
+58
-0
UserServiceImpl.java
...ava/com/tcm/system/user/service/impl/UserServiceImpl.java
+86
-0
RsaContant.java
src/main/java/com/tcm/system/user/vo/RsaContant.java
+29
-0
TcmLoginTokenVo.java
src/main/java/com/tcm/system/user/vo/TcmLoginTokenVo.java
+76
-0
TcmUserVo.java
src/main/java/com/tcm/system/user/vo/TcmUserVo.java
+204
-0
ValidateCodeVo.java
src/main/java/com/tcm/system/user/vo/ValidateCodeVo.java
+48
-0
TcmUserReqVo.java
src/main/java/com/tcm/system/user/vo/req/TcmUserReqVo.java
+16
-0
TcmUserSaveReqVo.java
...ain/java/com/tcm/system/user/vo/req/TcmUserSaveReqVo.java
+37
-0
UserLoginReqVo.java
src/main/java/com/tcm/system/user/vo/req/UserLoginReqVo.java
+90
-0
TcmUserResVo.java
src/main/java/com/tcm/system/user/vo/res/TcmUserResVo.java
+6
-0
UserLoginResVo.java
src/main/java/com/tcm/system/user/vo/res/UserLoginResVo.java
+85
-0
LoginController.java
src/main/java/com/tcm/system/user/web/LoginController.java
+46
-0
No files found.
src/main/java/com/tcm/system/authority/dao/TcmAuthorityDao.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
dao
;
import
com.tcm.system.authority.vo.req.TcmAuthorityPageReqVo
;
import
com.tcm.system.authority.vo.req.TcmAuthorityReqVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityResVo
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
public
interface
TcmAuthorityDao
extends
BaseDao
{
PageSizeData
<
TcmAuthorityResVo
>
findAuthorityPage
(
TcmAuthorityPageReqVo
reqVo
);
List
<
TcmAuthorityResVo
>
findAuthorityList
(
TcmAuthorityReqVo
reqVo
);
}
src/main/java/com/tcm/system/authority/dao/TcmRoleAuthorityDao.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
dao
;
import
com.yanzuoguang.dao.BaseDao
;
/**
* @author zhangjinyao
*/
public
interface
TcmRoleAuthorityDao
extends
BaseDao
{
}
src/main/java/com/tcm/system/authority/dao/impl/TcmAuthorityDaoImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
dao
.
impl
;
import
com.pangding.web.vo.system.pd.authority.AuthorityVo
;
import
com.tcm.system.authority.dao.TcmAuthorityDao
;
import
com.tcm.system.authority.vo.TcmAuthorityVo
;
import
com.tcm.system.authority.vo.req.TcmAuthorityPageReqVo
;
import
com.tcm.system.authority.vo.req.TcmAuthorityReqVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityResVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
public
class
TcmAuthorityDaoImpl
extends
BaseDaoImpl
implements
TcmAuthorityDao
{
private
static
final
String
QUERY
=
"QUERY"
;
@Override
protected
void
init
()
{
register
(
TcmAuthorityVo
.
class
);
table
.
add
(
QUERY
,
"select * from pd_authority where 1=1"
)
.
add
(
"id"
,
"and pid = ? "
)
.
add
(
"pid"
,
"and pid = ? "
)
.
add
(
"sort"
,
"and sort = ? "
)
.
add
(
"search"
,
"and (name like concat(?,'%') "
+
"or alias like concat(?,'%')) "
)
.
add
(
"levelOne"
,
"and pid = '' order by sort asc"
);
}
/**
* 获取权限分页对象
*
* @param reqVo
* @return 权限分页对象
*/
@Override
public
PageSizeData
<
TcmAuthorityResVo
>
findAuthorityPage
(
TcmAuthorityPageReqVo
reqVo
)
{
return
this
.
queryPage
(
TcmAuthorityResVo
.
class
,
reqVo
,
QUERY
,
reqVo
);
}
@Override
public
List
<
TcmAuthorityResVo
>
findAuthorityList
(
TcmAuthorityReqVo
reqVo
)
{
return
this
.
query
(
TcmAuthorityResVo
.
class
,
QUERY
,
reqVo
);
}
}
src/main/java/com/tcm/system/authority/dao/impl/TcmRoleAuthorityDaoImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
dao
.
impl
;
import
com.tcm.system.authority.dao.TcmRoleAuthorityDao
;
import
com.tcm.system.authority.vo.TcmRoleAuthorityVo
;
import
com.yanzuoguang.dao.DaoConst
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
/**
* @author zhangjinyao
*/
@Component
public
class
TcmRoleAuthorityDaoImpl
extends
BaseDaoImpl
implements
TcmRoleAuthorityDao
{
@Override
protected
void
init
()
{
register
(
TcmRoleAuthorityVo
.
class
);
getSql
(
DaoConst
.
LOAD
).
setSql
(
"select ra.role_id,ra.authority_id,a.id,a.pid,a.name,"
+
"a.type,a.alias,a.url,a.remark,a.open_mode,a.sort,a.attribute from pd_role_authority ra "
+
"RIGHT JOIN pd_authority a on ra.authority_id = a.id {INNER} "
+
"where 1=1 {WHERE} ORDER BY a.pid,a.sort,a.attribute"
)
.
add
(
"userId"
,
"AND b.user_id = @userId"
,
"{INNER}"
,
"INNER JOIN pd_user_role AS b ON ra.role_id = b.role_id"
)
.
add
(
"role"
,
" AND ra.role_id = @role"
)
.
add
(
"authority"
,
" AND ra.authority_id = @authority"
)
.
add
(
"platformType"
,
" AND a.platform_type = @platformType"
)
;
}
}
src/main/java/com/tcm/system/authority/service/TcmAuthorityService.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
service
;
import
com.tcm.system.authority.vo.req.TcmAuthorityPageReqVo
;
import
com.tcm.system.authority.vo.req.TcmAuthorityReqVo
;
import
com.tcm.system.authority.vo.req.TcmAuthoritySaveReqVo
;
import
com.tcm.system.authority.vo.req.TcmRoleAuthorityReqVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityListByLevelResVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityListResVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityResVo
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
public
interface
TcmAuthorityService
{
PageSizeData
<
TcmAuthorityResVo
>
findAuthorityPage
(
TcmAuthorityPageReqVo
reqVo
);
List
<
TcmAuthorityResVo
>
findAuthorityList
(
TcmAuthorityReqVo
reqVo
);
TcmAuthorityListResVo
findAuthorityListByLevel
(
TcmRoleAuthorityReqVo
reqVo
);
List
<
TcmAuthorityListByLevelResVo
>
getListByLevel
(
TcmRoleAuthorityReqVo
req
);
TcmAuthorityResVo
findTcmAuthorityInfo
(
TcmAuthorityReqVo
reqVo
);
void
save
(
TcmAuthoritySaveReqVo
authorityVo
);
void
delAuthority
(
TcmAuthorityReqVo
reqVo
);
}
src/main/java/com/tcm/system/authority/service/impl/TcmAuthorityServiceImpl.java
0 → 100644
View file @
37fec4be
This diff is collapsed.
Click to expand it.
src/main/java/com/tcm/system/authority/vo/TcmAuthorityVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
com.yanzuoguang.util.vo.InitDao
;
import
io.swagger.annotations.ApiModelProperty
;
@TableAnnotation
(
"tcm_sys_authority"
)
public
class
TcmAuthorityVo
extends
BaseVo
implements
InitDao
{
@ApiModelProperty
(
notes
=
"权限编号"
)
@TableAnnotation
(
"authority_id"
)
private
String
authorityId
;
@ApiModelProperty
(
notes
=
"父权限id"
)
private
String
pid
;
@ApiModelProperty
(
notes
=
"权限名称"
)
@TableAnnotation
(
"authority_name"
)
private
String
authorityName
;
@ApiModelProperty
(
notes
=
"权限类型"
)
@TableAnnotation
(
"authority_type"
)
private
Integer
authorityType
;
@ApiModelProperty
(
notes
=
"权限别名"
)
@TableAnnotation
(
"authority_alias"
)
private
String
authorityAlias
;
@ApiModelProperty
(
notes
=
"权限url"
)
@TableAnnotation
(
"authorityUrl"
)
private
String
authorityUrl
;
@ApiModelProperty
(
notes
=
"打开方式"
)
@TableAnnotation
(
"open_mode"
)
private
Integer
openMode
;
@ApiModelProperty
(
notes
=
"备注"
)
private
String
remark
;
@ApiModelProperty
(
notes
=
"创建时间"
)
@TableAnnotation
(
"create_time"
)
private
String
createTime
;
@ApiModelProperty
(
notes
=
"排序"
)
@TableAnnotation
(
"authority_sort"
)
private
Integer
authoritySort
;
@ApiModelProperty
(
notes
=
"类型"
)
private
Integer
attribute
;
@ApiModelProperty
(
notes
=
"创建人"
)
@TableAnnotation
(
"create_user"
)
private
String
createUser
;
@ApiModelProperty
(
notes
=
"权限等级 0 一般权限 1 默认权限 2 特殊权限"
)
@TableAnnotation
(
"authority_level"
)
private
Integer
authorityLevel
;
@ApiModelProperty
(
notes
=
"平台类型:0-B端,1-胖丁伙伴"
)
@TableAnnotation
(
"platform_type"
)
private
Integer
platformType
;
@Override
public
void
init
()
{
}
public
String
getAuthorityId
()
{
return
authorityId
;
}
public
void
setAuthorityId
(
String
authorityId
)
{
this
.
authorityId
=
authorityId
;
}
public
String
getPid
()
{
return
pid
;
}
public
void
setPid
(
String
pid
)
{
this
.
pid
=
pid
;
}
public
String
getAuthorityName
()
{
return
authorityName
;
}
public
void
setAuthorityName
(
String
authorityName
)
{
this
.
authorityName
=
authorityName
;
}
public
Integer
getAuthorityType
()
{
return
authorityType
;
}
public
void
setAuthorityType
(
Integer
authorityType
)
{
this
.
authorityType
=
authorityType
;
}
public
String
getAuthorityAlias
()
{
return
authorityAlias
;
}
public
void
setAuthorityAlias
(
String
authorityAlias
)
{
this
.
authorityAlias
=
authorityAlias
;
}
public
String
getAuthorityUrl
()
{
return
authorityUrl
;
}
public
void
setAuthorityUrl
(
String
authorityUrl
)
{
this
.
authorityUrl
=
authorityUrl
;
}
public
Integer
getOpenMode
()
{
return
openMode
;
}
public
void
setOpenMode
(
Integer
openMode
)
{
this
.
openMode
=
openMode
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getAuthoritySort
()
{
return
authoritySort
;
}
public
void
setAuthoritySort
(
Integer
authoritySort
)
{
this
.
authoritySort
=
authoritySort
;
}
public
Integer
getAttribute
()
{
return
attribute
;
}
public
void
setAttribute
(
Integer
attribute
)
{
this
.
attribute
=
attribute
;
}
public
String
getCreateUser
()
{
return
createUser
;
}
public
void
setCreateUser
(
String
createUser
)
{
this
.
createUser
=
createUser
;
}
public
Integer
getAuthorityLevel
()
{
return
authorityLevel
;
}
public
void
setAuthorityLevel
(
Integer
authorityLevel
)
{
this
.
authorityLevel
=
authorityLevel
;
}
public
Integer
getPlatformType
()
{
return
platformType
;
}
public
void
setPlatformType
(
Integer
platformType
)
{
this
.
platformType
=
platformType
;
}
}
src/main/java/com/tcm/system/authority/vo/TcmRoleAuthorityVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
com.yanzuoguang.util.vo.InitDao
;
import
io.swagger.annotations.ApiModelProperty
;
@TableAnnotation
(
"tcm_sys_role_authority"
)
public
class
TcmRoleAuthorityVo
extends
BaseVo
implements
InitDao
{
@ApiModelProperty
(
notes
=
" 编号"
)
@TableAnnotation
(
"role_authority_id"
)
private
String
roleAuthorityId
;
@ApiModelProperty
(
notes
=
" 角色id"
)
@TableAnnotation
(
"role_id"
)
private
String
RoleId
;
@ApiModelProperty
(
notes
=
" 权限id"
)
@TableAnnotation
(
"authority_id"
)
private
String
AuthorityId
;
public
void
init
()
{
}
public
String
getRoleAuthorityId
()
{
return
roleAuthorityId
;
}
public
void
setRoleAuthorityId
(
String
roleAuthorityId
)
{
this
.
roleAuthorityId
=
roleAuthorityId
;
}
public
String
getRoleId
()
{
return
RoleId
;
}
public
void
setRoleId
(
String
roleId
)
{
RoleId
=
roleId
;
}
public
String
getAuthorityId
()
{
return
AuthorityId
;
}
public
void
setAuthorityId
(
String
authorityId
)
{
AuthorityId
=
authorityId
;
}
}
src/main/java/com/tcm/system/authority/vo/req/TcmAuthorityPageReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
.
req
;
import
com.yanzuoguang.util.vo.PageSizeReqVo
;
import
io.swagger.annotations.ApiModelProperty
;
public
class
TcmAuthorityPageReqVo
extends
PageSizeReqVo
{
@ApiModelProperty
(
notes
=
"权限编号"
)
private
String
authorityId
;
@ApiModelProperty
(
notes
=
"父权限id"
)
private
String
pid
;
@ApiModelProperty
(
notes
=
"权限名称"
)
private
String
authorityName
;
@ApiModelProperty
(
notes
=
"权限类型"
)
private
Integer
authorityType
;
@ApiModelProperty
(
notes
=
"权限别名"
)
private
String
authorityAlias
;
@ApiModelProperty
(
notes
=
"权限url"
)
private
String
authorityUrl
;
@ApiModelProperty
(
notes
=
"打开方式"
)
private
Integer
openMode
;
@ApiModelProperty
(
notes
=
"备注"
)
private
String
remark
;
@ApiModelProperty
(
notes
=
"创建时间"
)
private
String
createTime
;
@ApiModelProperty
(
notes
=
"排序"
)
private
Integer
authoritySort
;
@ApiModelProperty
(
notes
=
"类型"
)
private
Integer
attribute
;
@ApiModelProperty
(
notes
=
"创建人"
)
private
String
createUser
;
@ApiModelProperty
(
notes
=
"权限等级 0 一般权限 1 默认权限 2 特殊权限"
)
private
Integer
authorityLevel
;
@ApiModelProperty
(
notes
=
"平台类型:0-B端,1-胖丁伙伴"
)
private
Integer
platformType
;
public
String
getAuthorityId
()
{
return
authorityId
;
}
public
void
setAuthorityId
(
String
authorityId
)
{
this
.
authorityId
=
authorityId
;
}
public
String
getPid
()
{
return
pid
;
}
public
void
setPid
(
String
pid
)
{
this
.
pid
=
pid
;
}
public
String
getAuthorityName
()
{
return
authorityName
;
}
public
void
setAuthorityName
(
String
authorityName
)
{
this
.
authorityName
=
authorityName
;
}
public
Integer
getAuthorityType
()
{
return
authorityType
;
}
public
void
setAuthorityType
(
Integer
authorityType
)
{
this
.
authorityType
=
authorityType
;
}
public
String
getAuthorityAlias
()
{
return
authorityAlias
;
}
public
void
setAuthorityAlias
(
String
authorityAlias
)
{
this
.
authorityAlias
=
authorityAlias
;
}
public
String
getAuthorityUrl
()
{
return
authorityUrl
;
}
public
void
setAuthorityUrl
(
String
authorityUrl
)
{
this
.
authorityUrl
=
authorityUrl
;
}
public
Integer
getOpenMode
()
{
return
openMode
;
}
public
void
setOpenMode
(
Integer
openMode
)
{
this
.
openMode
=
openMode
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getAuthoritySort
()
{
return
authoritySort
;
}
public
void
setAuthoritySort
(
Integer
authoritySort
)
{
this
.
authoritySort
=
authoritySort
;
}
public
Integer
getAttribute
()
{
return
attribute
;
}
public
void
setAttribute
(
Integer
attribute
)
{
this
.
attribute
=
attribute
;
}
public
String
getCreateUser
()
{
return
createUser
;
}
public
void
setCreateUser
(
String
createUser
)
{
this
.
createUser
=
createUser
;
}
public
Integer
getAuthorityLevel
()
{
return
authorityLevel
;
}
public
void
setAuthorityLevel
(
Integer
authorityLevel
)
{
this
.
authorityLevel
=
authorityLevel
;
}
public
Integer
getPlatformType
()
{
return
platformType
;
}
public
void
setPlatformType
(
Integer
platformType
)
{
this
.
platformType
=
platformType
;
}
}
src/main/java/com/tcm/system/authority/vo/req/TcmAuthorityReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
.
req
;
import
com.tcm.system.authority.vo.TcmAuthorityVo
;
public
class
TcmAuthorityReqVo
extends
TcmAuthorityVo
{
}
src/main/java/com/tcm/system/authority/vo/req/TcmAuthoritySaveReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
.
req
;
import
com.tcm.system.authority.vo.TcmAuthorityVo
;
public
class
TcmAuthoritySaveReqVo
extends
TcmAuthorityVo
{
}
src/main/java/com/tcm/system/authority/vo/req/TcmRoleAuthorityReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
.
req
;
public
class
TcmRoleAuthorityReqVo
{
private
String
userId
;
private
String
roleId
;
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
String
roleId
)
{
this
.
roleId
=
roleId
;
}
}
src/main/java/com/tcm/system/authority/vo/res/TcmAuthorityListByLevelResVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
.
res
;
import
com.tcm.system.authority.vo.TcmAuthorityVo
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
TcmAuthorityListByLevelResVo
extends
TcmAuthorityVo
{
List
<
TcmAuthorityListByLevelResVo
>
childList
=
new
ArrayList
();
public
List
<
TcmAuthorityListByLevelResVo
>
getChildList
()
{
return
childList
;
}
public
void
setChildList
(
List
<
TcmAuthorityListByLevelResVo
>
childList
)
{
this
.
childList
=
childList
;
}
}
src/main/java/com/tcm/system/authority/vo/res/TcmAuthorityListResVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
.
res
;
import
com.tcm.system.authority.vo.TcmAuthorityVo
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
TcmAuthorityListResVo
{
private
List
<
TcmAuthorityListByLevelResVo
>
allAuthorityList
=
new
ArrayList
<>();
private
List
<
TcmAuthorityVo
>
roleAuthorityList
=
new
ArrayList
<>();
public
List
<
TcmAuthorityListByLevelResVo
>
getAllAuthorityList
()
{
return
allAuthorityList
;
}
public
void
setAllAuthorityList
(
List
<
TcmAuthorityListByLevelResVo
>
allAuthorityList
)
{
this
.
allAuthorityList
=
allAuthorityList
;
}
public
List
<
TcmAuthorityVo
>
getRoleAuthorityList
()
{
return
roleAuthorityList
;
}
public
void
setRoleAuthorityList
(
List
<
TcmAuthorityVo
>
roleAuthorityList
)
{
this
.
roleAuthorityList
=
roleAuthorityList
;
}
}
src/main/java/com/tcm/system/authority/vo/res/TcmAuthorityResVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
vo
.
res
;
import
com.tcm.system.authority.vo.TcmAuthorityVo
;
public
class
TcmAuthorityResVo
extends
TcmAuthorityVo
{
}
src/main/java/com/tcm/system/authority/web/TcmAuthorityController.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
authority
.
web
;
import
com.tcm.system.authority.service.TcmAuthorityService
;
import
com.tcm.system.authority.vo.req.TcmAuthorityPageReqVo
;
import
com.tcm.system.authority.vo.req.TcmAuthorityReqVo
;
import
com.tcm.system.authority.vo.req.TcmAuthoritySaveReqVo
;
import
com.tcm.system.authority.vo.req.TcmRoleAuthorityReqVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityListResVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityResVo
;
import
com.yanzuoguang.util.helper.CheckerHelper
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
io.swagger.annotations.Api
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/authority"
)
@Api
(
value
=
"权限"
)
public
class
TcmAuthorityController
{
private
TcmAuthorityService
tcmAuthorityService
;
public
TcmAuthorityController
(
TcmAuthorityService
tcmAuthorityService
)
{
this
.
tcmAuthorityService
=
tcmAuthorityService
;
}
/**
* 查询分页权限列表
* @return
*/
@RequestMapping
(
value
=
"/findAuthorityPage"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
PageSizeData
<
TcmAuthorityResVo
>>
findAuthorityPage
(
@RequestBody
TcmAuthorityPageReqVo
reqVo
){
return
ResponseResult
.
result
(
tcmAuthorityService
.
findAuthorityPage
(
reqVo
));
}
/**
* 查询权限列表,不分页,不分层级
* @return
*/
@RequestMapping
(
value
=
"/findAuthorityList"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
List
<
TcmAuthorityResVo
>>
findAuthorityList
(
@RequestBody
TcmAuthorityReqVo
reqVo
){
return
ResponseResult
.
result
(
tcmAuthorityService
.
findAuthorityList
(
reqVo
));
}
/**
* 查询权限详情
* @param reqVo
* @return
*/
@RequestMapping
(
value
=
"/findAuthority"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
TcmAuthorityResVo
>
findAuthority
(
@RequestBody
TcmAuthorityReqVo
reqVo
){
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"anthorityId"
,
reqVo
.
getAuthorityId
())
.
checkException
();
return
ResponseResult
.
result
(
tcmAuthorityService
.
findTcmAuthorityInfo
(
reqVo
));
}
/**
* 按等级返回权限列表
* @param reqVo
* @return
*/
@RequestMapping
(
value
=
"/findAuthorityListByLevel"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
TcmAuthorityListResVo
>
findAuthorityListByLevel
(
@RequestBody
TcmRoleAuthorityReqVo
reqVo
){
return
ResponseResult
.
result
(
tcmAuthorityService
.
findAuthorityListByLevel
(
reqVo
));
}
/**
* 保存权限
* @param req
* @return
*/
@RequestMapping
(
value
=
"/saveAuthority"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
String
>
saveAuthority
(
@RequestBody
TcmAuthoritySaveReqVo
req
){
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"authorityName"
,
req
.
getAuthorityName
())
.
notBlankCheck
(
"authprityType"
,
req
.
getAuthorityType
())
.
notBlankCheck
(
"authorityAlias"
,
req
.
getAuthorityAlias
())
.
notBlankCheck
(
"openMode"
,
req
.
getOpenMode
())
.
notBlankCheck
(
"authoritySort"
,
req
.
getAuthoritySort
())
.
checkException
();
tcmAuthorityService
.
save
(
req
);
return
ResponseResult
.
result
(
"处理成功"
);
}
/**
* 删除权限
* @param reqVo
* @return
*/
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
delete
(
@RequestBody
TcmAuthorityReqVo
reqVo
){
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"anthorityId"
,
reqVo
.
getAuthorityId
())
.
checkException
();
tcmAuthorityService
.
delAuthority
(
reqVo
);
return
new
ResponseResult
();
}
}
src/main/java/com/tcm/system/role/dao/TcmRoleDao.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
dao
;
import
com.tcm.system.role.vo.req.TcmRolePageReqVo
;
import
com.tcm.system.role.vo.res.TcmRoleListResVo
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.util.vo.PageSizeData
;
public
interface
TcmRoleDao
extends
BaseDao
{
PageSizeData
<
TcmRoleListResVo
>
queryList
(
TcmRolePageReqVo
req
);
}
src/main/java/com/tcm/system/role/dao/impl/TcmRoleDaoImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
dao
.
impl
;
import
com.tcm.system.role.dao.TcmRoleDao
;
import
com.tcm.system.role.vo.TcmRoleVo
;
import
com.tcm.system.role.vo.req.TcmRolePageReqVo
;
import
com.tcm.system.role.vo.res.TcmRoleListResVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.stereotype.Component
;
@Component
public
class
TcmRoleDaoImpl
extends
BaseDaoImpl
implements
TcmRoleDao
{
private
static
final
String
QUERY_LIST
=
"QUERY_LIST"
;
@Override
protected
void
init
()
{
register
(
TcmRoleVo
.
class
);
table
.
add
(
QUERY_LIST
,
"select COUNT(a.id) as userNum,a.* from pd_role a "
+
" LEFT JOIN pd_user_role b on a.id = b.role_id where 1=1 {WHERE}"
+
"GROUP BY a.id"
)
.
add
(
"id"
,
" and a.id = ? "
)
.
add
(
"companyId"
,
" and a.company_id = ? "
)
.
add
(
"roleName"
,
" and (a.name LIKE concat(?,'%') OR a.remark LIKE concat(?,'%') )"
);
}
@Override
public
PageSizeData
<
TcmRoleListResVo
>
queryList
(
TcmRolePageReqVo
req
)
{
return
this
.
queryPage
(
TcmRoleListResVo
.
class
,
req
,
QUERY_LIST
,
req
);
}
}
src/main/java/com/tcm/system/role/service/TcmRoleService.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
service
;
import
com.tcm.system.role.vo.req.TcmRolePageReqVo
;
import
com.tcm.system.role.vo.res.TcmRoleListResVo
;
import
com.yanzuoguang.util.vo.PageSizeData
;
public
interface
TcmRoleService
{
PageSizeData
<
TcmRoleListResVo
>
queryList
(
TcmRolePageReqVo
req
);
}
src/main/java/com/tcm/system/role/service/impl/TcmRoleServiceImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
service
.
impl
;
import
com.tcm.system.role.dao.TcmRoleDao
;
import
com.tcm.system.role.service.TcmRoleService
;
import
com.tcm.system.role.vo.req.TcmRolePageReqVo
;
import
com.tcm.system.role.vo.res.TcmRoleListResVo
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.stereotype.Service
;
@Service
public
class
TcmRoleServiceImpl
implements
TcmRoleService
{
private
TcmRoleDao
tcmRoleDao
;
public
TcmRoleServiceImpl
(
TcmRoleDao
tcmRoleDao
)
{
this
.
tcmRoleDao
=
tcmRoleDao
;
}
public
PageSizeData
<
TcmRoleListResVo
>
queryList
(
TcmRolePageReqVo
req
)
{
PageSizeData
<
TcmRoleListResVo
>
roleVoPageSizeData
=
tcmRoleDao
.
queryList
(
req
);
return
roleVoPageSizeData
;
}
}
src/main/java/com/tcm/system/role/vo/TcmRoleVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
vo
;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
com.yanzuoguang.util.vo.InitDao
;
import
io.swagger.annotations.ApiModelProperty
;
@TableAnnotation
(
"tcm_sys_role"
)
public
class
TcmRoleVo
extends
BaseVo
implements
InitDao
{
@ApiModelProperty
(
notes
=
"角色编号"
)
@TableAnnotation
(
"role_id"
)
private
String
roleId
;
@ApiModelProperty
(
notes
=
"角色名称"
)
@TableAnnotation
(
"role_name"
)
private
String
roleName
;
@ApiModelProperty
(
notes
=
"权限"
)
private
String
permissions
;
@ApiModelProperty
(
notes
=
"角色备注"
)
@TableAnnotation
(
"role_remark"
)
private
String
roleRemark
;
@ApiModelProperty
(
notes
=
"角色状态"
)
@TableAnnotation
(
"role_status"
)
private
String
roleStatus
;
@ApiModelProperty
(
notes
=
"创建时间"
)
@TableAnnotation
(
"create_time"
)
private
String
createTime
;
@ApiModelProperty
(
notes
=
"创建者id"
)
@TableAnnotation
(
"create_id"
)
private
String
createId
;
@ApiModelProperty
(
notes
=
"创建者名称"
)
@TableAnnotation
(
"create_name"
)
private
String
createName
;
@ApiModelProperty
(
notes
=
"创建时间"
)
@TableAnnotation
(
"update_time"
)
private
String
updateTime
;
@Override
public
void
init
()
{
}
public
String
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
String
roleId
)
{
this
.
roleId
=
roleId
;
}
public
String
getRoleName
()
{
return
roleName
;
}
public
void
setRoleName
(
String
roleName
)
{
this
.
roleName
=
roleName
;
}
public
String
getPermissions
()
{
return
permissions
;
}
public
void
setPermissions
(
String
permissions
)
{
this
.
permissions
=
permissions
;
}
public
String
getRoleRemark
()
{
return
roleRemark
;
}
public
void
setRoleRemark
(
String
roleRemark
)
{
this
.
roleRemark
=
roleRemark
;
}
public
String
getRoleStatus
()
{
return
roleStatus
;
}
public
void
setRoleStatus
(
String
roleStatus
)
{
this
.
roleStatus
=
roleStatus
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getCreateId
()
{
return
createId
;
}
public
void
setCreateId
(
String
createId
)
{
this
.
createId
=
createId
;
}
public
String
getCreateName
()
{
return
createName
;
}
public
void
setCreateName
(
String
createName
)
{
this
.
createName
=
createName
;
}
public
String
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
String
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
src/main/java/com/tcm/system/role/vo/req/TcmRolePageReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
vo
.
req
;
import
com.yanzuoguang.util.vo.PageSizeReqVo
;
import
io.swagger.annotations.ApiModelProperty
;
public
class
TcmRolePageReqVo
extends
PageSizeReqVo
{
@ApiModelProperty
(
notes
=
"角色编号"
)
private
String
roleId
;
@ApiModelProperty
(
notes
=
"角色名称"
)
private
String
roleName
;
public
String
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
String
roleId
)
{
this
.
roleId
=
roleId
;
}
public
String
getRoleName
()
{
return
roleName
;
}
public
void
setRoleName
(
String
roleName
)
{
this
.
roleName
=
roleName
;
}
}
src/main/java/com/tcm/system/role/vo/res/TcmRoleListResVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
vo
.
res
;
import
com.tcm.system.role.vo.TcmRoleVo
;
public
class
TcmRoleListResVo
extends
TcmRoleVo
{
private
int
userNum
;
public
int
getUserNum
()
{
return
userNum
;
}
public
void
setUserNum
(
int
userNum
)
{
this
.
userNum
=
userNum
;
}
}
src/main/java/com/tcm/system/role/web/TcmRoleController.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
role
.
web
;
import
com.tcm.system.role.service.TcmRoleService
;
import
com.tcm.system.role.vo.req.TcmRolePageReqVo
;
import
com.tcm.system.role.vo.res.TcmRoleListResVo
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/roles"
)
public
class
TcmRoleController
{
private
TcmRoleService
tcmRoleService
;
public
TcmRoleController
(
TcmRoleService
tcmRoleService
)
{
this
.
tcmRoleService
=
tcmRoleService
;
}
@RequestMapping
(
value
=
"/queryList"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
PageSizeData
<
TcmRoleListResVo
>>
queryList
(
@RequestBody
TcmRolePageReqVo
req
){
// CheckerHelper.newInstance()
// .notBlankCheck("companyId",req.getCompanyId())
// .checkException();
return
ResponseResult
.
result
(
tcmRoleService
.
queryList
(
req
));
}
}
src/main/java/com/tcm/system/user/dao/TokenDao.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
dao
;
import
com.yanzuoguang.dao.BaseDao
;
/**
* 登录接口基本操作类
* @author tf
*/
public
interface
TokenDao
extends
BaseDao
{
}
src/main/java/com/tcm/system/user/dao/UserDao.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
dao
;
import
com.tcm.system.user.vo.req.TcmUserReqVo
;
import
com.tcm.system.user.vo.res.TcmUserResVo
;
import
com.yanzuoguang.dao.BaseDao
;
public
interface
UserDao
extends
BaseDao
{
/**
* 查询用户是否存在
* @param req
* @return
*/
TcmUserResVo
queryUser
(
TcmUserReqVo
req
);
}
src/main/java/com/tcm/system/user/dao/impl/TokenDaoImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
dao
.
impl
;
import
com.tcm.system.user.dao.TokenDao
;
import
com.tcm.system.user.vo.TcmLoginTokenVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
/**
* 登录数据库写入实现类
*
* @author tf
*/
@Component
public
class
TokenDaoImpl
extends
BaseDaoImpl
implements
TokenDao
{
private
static
final
int
TOKEN_MEMORY_CACHE_TIME
=
60
;
/**
* 注册SQL语句
*/
@Override
protected
void
init
()
{
// 根据实体生成增删改查语句
register
(
TcmLoginTokenVo
.
class
);
cacheList
.
setClearSecond
(
TOKEN_MEMORY_CACHE_TIME
);
}
}
src/main/java/com/tcm/system/user/dao/impl/UserDaoImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
dao
.
impl
;
import
com.tcm.system.user.dao.UserDao
;
import
com.tcm.system.user.vo.TcmUserVo
;
import
com.tcm.system.user.vo.req.TcmUserReqVo
;
import
com.tcm.system.user.vo.res.TcmUserResVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
@Component
public
class
UserDaoImpl
extends
BaseDaoImpl
implements
UserDao
{
private
static
final
String
QUERY_USER
=
"QUERY_USER"
;
@Override
protected
void
init
()
{
register
(
TcmUserVo
.
class
);
table
.
add
(
QUERY_USER
,
"select * from pd_user where 1=1"
)
.
add
(
"companyId"
,
"and company_id = ? "
)
.
add
(
"account"
,
"and account = ? "
)
.
add
(
"phone"
,
"and phone = ? "
)
.
add
(
"loginAccount"
,
"and (account = ? or phone = ?) "
)
.
add
(
"roleId"
,
" id in (select user_id from pd_user_role where role_id = ? )"
);
}
@Override
public
TcmUserResVo
queryUser
(
TcmUserReqVo
req
)
{
return
this
.
queryFirst
(
TcmUserResVo
.
class
,
QUERY_USER
,
req
);
}
}
src/main/java/com/tcm/system/user/service/LoginService.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
service
;
import
com.tcm.system.user.vo.req.UserLoginReqVo
;
import
com.tcm.system.user.vo.res.UserLoginResVo
;
public
interface
LoginService
{
UserLoginResVo
login
(
UserLoginReqVo
reqVo
);
}
src/main/java/com/tcm/system/user/service/TokenService.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
service
;
import
com.tcm.system.user.vo.TcmLoginTokenVo
;
/**
* 登录服务
*
* @author tf
*/
public
interface
TokenService
{
/**
* 保存接口请求日志
*
* @param loginVo 请求数据
* @retur 保存主键
*/
String
save
(
TcmLoginTokenVo
loginVo
);
/**
* 保存接口请求日志
*
* @param loginVo 请求数据
* @retur 保存主键
*/
TcmLoginTokenVo
load
(
TcmLoginTokenVo
loginVo
);
/**
* 保存接口请求日志
*
* @param loginVo 请求数据
* @retur 保存主键
*/
int
remove
(
TcmLoginTokenVo
loginVo
);
}
src/main/java/com/tcm/system/user/service/UserService.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
service
;
import
com.tcm.system.user.vo.req.TcmUserReqVo
;
import
com.tcm.system.user.vo.req.TcmUserSaveReqVo
;
import
com.tcm.system.user.vo.res.TcmUserResVo
;
public
interface
UserService
{
/**
* 查询用户详情
* @param req
* @return
*/
TcmUserResVo
queryUser
(
TcmUserReqVo
req
);
String
saveUser
(
TcmUserSaveReqVo
req
);
}
src/main/java/com/tcm/system/user/service/ValidateCodeService.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
service
;
import
com.alicp.jetcache.Cache
;
import
com.alicp.jetcache.anno.CacheType
;
import
com.alicp.jetcache.anno.CreateCache
;
import
com.google.code.kaptcha.impl.DefaultKaptcha
;
import
com.pangding.web.cache.CacheName
;
import
com.tcm.system.user.vo.ValidateCodeVo
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.stereotype.Component
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
@Component
public
class
ValidateCodeService
{
private
final
DefaultKaptcha
defaultKaptcha
;
@CreateCache
(
name
=
CacheName
.
USER_PASSWORD_CODE
,
cacheType
=
CacheType
.
REMOTE
,
expire
=
60
,
timeUnit
=
TimeUnit
.
MINUTES
)
private
Cache
<
String
,
String
>
cache
;
public
ValidateCodeService
(
DefaultKaptcha
defaultKaptcha
)
{
this
.
defaultKaptcha
=
defaultKaptcha
;
}
/**
* 生成验证码
*
* @return 验证码效果
*/
public
ValidateCodeVo
getCode
()
{
// 生成文字验证码
String
text
=
defaultKaptcha
.
createText
();
// 生成图片验证码
BufferedImage
image
=
defaultKaptcha
.
createImage
(
text
);
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
try
{
ImageIO
.
write
(
image
,
"jpg"
,
out
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
// 对字节组Base64编码
String
img
=
Base64
.
getEncoder
().
encodeToString
(
out
.
toByteArray
());
ValidateCodeVo
code
=
new
ValidateCodeVo
(
StringHelper
.
getNewID
(),
img
);
// 验证验证码文字
cache
.
put
(
code
.
getId
(),
text
);
return
code
;
}
public
void
validate
(
String
codeId
,
String
codeValue
,
boolean
validate
)
{
if
(!
validate
)
{
return
;
}
if
(
StringHelper
.
isEmpty
(
codeId
))
{
throw
new
CodeException
(
"验证码不能为空"
);
}
String
text
=
cache
.
get
(
codeId
);
if
(
StringHelper
.
isEmpty
(
text
))
{
throw
new
CodeException
(
"验证码失效"
);
}
cache
.
remove
(
codeId
);
if
(
StringHelper
.
compare
(
text
,
codeValue
,
true
))
{
return
;
}
throw
new
CodeException
(
"验证码错误"
);
}
public
void
validate
(
String
codeId
,
String
codeValue
,
List
<
String
>
names
)
{
boolean
validate
=
false
;
for
(
String
name
:
names
)
{
if
(!
StringHelper
.
isEmpty
(
name
))
{
validate
=
true
;
break
;
}
}
this
.
validate
(
codeId
,
codeValue
,
validate
);
}
}
src/main/java/com/tcm/system/user/service/impl/LoginServiceImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
service
.
impl
;
import
com.pangding.web.util.RSAUtils
;
import
com.tcm.system.authority.dao.TcmRoleAuthorityDao
;
import
com.tcm.system.authority.service.TcmAuthorityService
;
import
com.tcm.system.authority.vo.req.TcmRoleAuthorityReqVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityListByLevelResVo
;
import
com.tcm.system.user.service.LoginService
;
import
com.tcm.system.user.service.TokenService
;
import
com.tcm.system.user.service.UserService
;
import
com.tcm.system.user.service.ValidateCodeService
;
import
com.tcm.system.user.vo.RsaContant
;
import
com.tcm.system.user.vo.TcmLoginTokenVo
;
import
com.tcm.system.user.vo.req.TcmUserReqVo
;
import
com.tcm.system.user.vo.req.UserLoginReqVo
;
import
com.tcm.system.user.vo.res.TcmUserResVo
;
import
com.tcm.system.user.vo.res.UserLoginResVo
;
import
com.yanzuoguang.token.TokenHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
LoginServiceImpl
implements
LoginService
{
private
ValidateCodeService
validateCodeService
;
private
UserService
userService
;
private
TokenService
tokenService
;
private
TcmAuthorityService
tcmAuthorityService
;
private
RsaContant
rsaContant
;
public
LoginServiceImpl
(
ValidateCodeService
validateCodeService
,
UserService
userService
,
TokenService
tokenService
,
TcmAuthorityService
tcmAuthorityService
,
RsaContant
rsaContant
)
{
this
.
validateCodeService
=
validateCodeService
;
this
.
userService
=
userService
;
this
.
tokenService
=
tokenService
;
this
.
tcmAuthorityService
=
tcmAuthorityService
;
this
.
rsaContant
=
rsaContant
;
}
/**
* 登陆,验证用户名或手机号,密码是否正确
* 返回token,account,
*
* @param reqVo
* @return
*/
@Override
public
UserLoginResVo
login
(
UserLoginReqVo
reqVo
){
// 当输入用户名和密码时,检测验证码
List
<
String
>
items
=
new
ArrayList
<>();
items
.
add
(
reqVo
.
getAccountOrPhone
());
items
.
add
(
reqVo
.
getPassword
());
validateCodeService
.
validate
(
reqVo
.
getCodeId
(),
reqVo
.
getCodeValue
(),
items
);
TcmUserReqVo
userReqVo
=
new
TcmUserReqVo
();
userReqVo
.
setLoginAccount
(
reqVo
.
getAccountOrPhone
());
TcmUserResVo
userVo
=
userService
.
queryUser
(
userReqVo
);
if
(
StringHelper
.
isEmpty
(
userVo
))
{
throw
new
CodeException
(
"用户名不存在"
);
}
try
{
/*通过私钥将rsa加密的密码解密*/
String
password
=
RSAUtils
.
decryptionByPrivateKey
(
reqVo
.
getPassword
(),
rsaContant
.
getPrivateKey
());
if
(!(
StringHelper
.
md5
(
password
).
equals
(
userVo
.
getPassword
())))
{
throw
new
CodeException
(
"用户名或密码错误"
);
}
}
catch
(
Exception
e
){
throw
new
CodeException
(
e
.
getMessage
());
}
String
token
=
createToken
(
reqVo
.
getAccountOrPhone
());
// 登录返回参数
UserLoginResVo
resVo
=
new
UserLoginResVo
();
resVo
.
setToken
(
token
);
resVo
.
setTcmUserVo
(
userVo
);
// 保存登录token
TcmLoginTokenVo
loginVo
=
new
TcmLoginTokenVo
();
loginVo
.
setToken
(
token
);
loginVo
.
setDataPwd
(
token
);
loginVo
.
setData
(
JsonHelper
.
serialize
(
reqVo
));
loginVo
.
setExpairTime
(
DateHelper
.
getNow
());
tokenService
.
save
(
loginVo
);
// 输出结果
TokenHelper
.
write
(
token
,
loginVo
);
reqVo
.
setToken
(
token
);
/*获取用户权限列表*/
TcmRoleAuthorityReqVo
roleAuthorityGetReqVo
=
new
TcmRoleAuthorityReqVo
();
roleAuthorityGetReqVo
.
setUserId
(
userVo
.
getUserId
());
List
<
TcmAuthorityListByLevelResVo
>
roleAuthorityVoList
=
tcmAuthorityService
.
findAuthorityListByLevel
(
roleAuthorityGetReqVo
);
resVo
.
setAuthorityListByLevel
(
roleAuthorityVoList
);
resVo
.
setCode
(
"00"
);
return
resVo
;
}
public
String
createToken
(
String
accountOrPhone
){
String
token
=
""
;
try
{
token
=
RSAUtils
.
encryptionByPublicKey
(
accountOrPhone
,
rsaContant
.
getPublickey
());
token
=
StringHelper
.
md5
(
token
);
}
catch
(
Exception
e
){
}
return
token
;
}
}
src/main/java/com/tcm/system/user/service/impl/TokenServiceImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
service
.
impl
;
import
com.tcm.system.user.dao.TokenDao
;
import
com.tcm.system.user.service.TokenService
;
import
com.tcm.system.user.vo.TcmLoginTokenVo
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
org.springframework.stereotype.Service
;
@Service
public
class
TokenServiceImpl
implements
TokenService
{
private
TokenDao
tokenDao
;
public
TokenServiceImpl
(
TokenDao
tokenDao
)
{
this
.
tokenDao
=
tokenDao
;
}
/**
* 保存接口请求日志
*
* @param loginVo
*/
@Override
public
String
save
(
TcmLoginTokenVo
loginVo
)
{
TcmLoginTokenVo
to
=
tokenDao
.
load
(
loginVo
,
TcmLoginTokenVo
.
class
);
if
(
JsonHelper
.
compare
(
to
,
loginVo
))
{
return
to
.
getToken
();
}
else
if
(
to
!=
null
)
{
return
tokenDao
.
update
(
loginVo
);
}
else
{
return
tokenDao
.
create
(
loginVo
);
}
}
/**
* 保存接口请求日志
*
* @param loginVo 请求数据
* @retur 保存主键
*/
@Override
public
TcmLoginTokenVo
load
(
TcmLoginTokenVo
loginVo
)
{
return
tokenDao
.
load
(
loginVo
,
TcmLoginTokenVo
.
class
);
}
/**
* 保存接口请求日志
*
* @param loginVo 请求数据
* @retur 保存主键
*/
@Override
public
int
remove
(
TcmLoginTokenVo
loginVo
)
{
return
tokenDao
.
remove
(
loginVo
);
}
}
src/main/java/com/tcm/system/user/service/impl/UserServiceImpl.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
service
.
impl
;
import
com.pangding.web.util.RSAUtils
;
import
com.pangding.web.vo.system.pd.authority.UserVo
;
import
com.tcm.system.user.dao.UserDao
;
import
com.tcm.system.user.service.UserService
;
import
com.tcm.system.user.vo.RsaContant
;
import
com.tcm.system.user.vo.TcmUserVo
;
import
com.tcm.system.user.vo.req.TcmUserReqVo
;
import
com.tcm.system.user.vo.req.TcmUserSaveReqVo
;
import
com.tcm.system.user.vo.res.TcmUserResVo
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.stereotype.Service
;
@Service
public
class
UserServiceImpl
implements
UserService
{
private
UserDao
userDao
;
private
RsaContant
rsaContant
;
public
UserServiceImpl
(
UserDao
userDao
,
RsaContant
rsaContant
)
{
this
.
userDao
=
userDao
;
this
.
rsaContant
=
rsaContant
;
}
@Override
public
TcmUserResVo
queryUser
(
TcmUserReqVo
req
)
{
return
userDao
.
queryUser
(
req
);
}
@Override
public
String
saveUser
(
TcmUserSaveReqVo
req
)
{
this
.
isValid
(
req
.
getUsername
());
this
.
checkAccount
(
req
);
try
{
/*将RSA加密后的密码解密*/
String
password
=
RSAUtils
.
decryptionByPrivateKey
(
req
.
getPassword
(),
rsaContant
.
getPrivateKey
());
String
confirmPassword
=
RSAUtils
.
decryptionByPrivateKey
(
req
.
getConfirmPassword
(),
rsaContant
.
getPrivateKey
());
if
(!
StringHelper
.
compare
(
password
,
confirmPassword
))
{
throw
new
CodeException
(
"确认密码错误"
);
}
String
md5Password
=
this
.
passwordEncoder
(
password
);
req
.
setPassword
(
md5Password
);
TcmUserVo
userVo
=
new
TcmUserVo
();
if
(
StringHelper
.
isEmpty
(
req
.
getUserId
()))
{
req
.
setUserId
(
StringHelper
.
getNewID
());
ObjectHelper
.
writeWithFrom
(
userVo
,
req
);
userDao
.
create
(
userVo
);
}
else
{
ObjectHelper
.
writeWithFrom
(
userVo
,
req
);
userDao
.
update
(
userVo
);
}
}
catch
(
Exception
e
){
throw
new
CodeException
(
e
.
getMessage
());
}
return
req
.
getUserId
();
}
// @Override
public
void
isValid
(
String
account
)
{
String
regex
=
"^(?!\\d+$)[\\da-zA-Z]+$"
;
if
(!
account
.
matches
(
regex
))
{
throw
new
CodeException
(
"错误的用户名:"
+
account
+
",用户名仅支持字母和数字的组合,且不能为纯数字"
);
}
}
// @Override
public
void
checkAccount
(
TcmUserSaveReqVo
userVo
)
{
TcmUserSaveReqVo
tcmUserSaveReqVo
=
new
TcmUserSaveReqVo
();
tcmUserSaveReqVo
.
setUsername
(
userVo
.
getUsername
());
UserVo
userVo1
=
userDao
.
load
(
tcmUserSaveReqVo
,
UserVo
.
class
);
if
((
null
!=
userVo1
&&
null
==
userVo
.
getUserId
())
||
(
null
!=
userVo1
&&
null
!=
userVo
.
getUserId
()
&&
!
userVo1
.
getId
().
equals
(
userVo
.
getUserId
())))
{
throw
new
CodeException
(
"用户名"
+
userVo
.
getUsername
()
+
"已存在"
);
}
}
// @Override
public
String
passwordEncoder
(
String
password
)
{
return
StringHelper
.
md5
(
password
);
}
}
src/main/java/com/tcm/system/user/vo/RsaContant.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
@Component
public
class
RsaContant
{
@Value
(
"${rsa.privatekey}"
)
private
String
privateKey
;
@Value
(
"${rsa.publickey}"
)
private
String
publickey
;
public
String
getPrivateKey
()
{
return
privateKey
;
}
public
void
setPrivateKey
(
String
privateKey
)
{
this
.
privateKey
=
privateKey
;
}
public
String
getPublickey
()
{
return
publickey
;
}
public
void
setPublickey
(
String
publickey
)
{
this
.
publickey
=
publickey
;
}
}
src/main/java/com/tcm/system/user/vo/TcmLoginTokenVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
com.yanzuoguang.util.vo.InitDao
;
import
io.swagger.annotations.ApiModelProperty
;
@TableAnnotation
(
"tcm_login_token"
)
public
class
TcmLoginTokenVo
extends
BaseVo
implements
InitDao
{
@ApiModelProperty
(
notes
=
"登陆凭证"
)
private
String
token
;
@ApiModelProperty
(
notes
=
"数据密码"
)
@TableAnnotation
(
"data_pwd"
)
private
String
dataPwd
;
@ApiModelProperty
(
notes
=
"数据"
)
private
String
data
;
@ApiModelProperty
(
notes
=
"时间"
)
@TableAnnotation
(
"expair_time"
)
private
String
expairTime
;
@ApiModelProperty
(
notes
=
"登录类型 0 B端登录,1C端登录,2第三方登录 3 app登录"
)
@TableAnnotation
(
"login_type"
)
private
Integer
loginType
;
public
void
init
()
{
}
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
String
getDataPwd
()
{
return
dataPwd
;
}
public
void
setDataPwd
(
String
dataPwd
)
{
this
.
dataPwd
=
dataPwd
;
}
public
String
getData
()
{
return
data
;
}
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
public
String
getExpairTime
()
{
return
expairTime
;
}
public
void
setExpairTime
(
String
expairTime
)
{
this
.
expairTime
=
expairTime
;
}
public
Integer
getLoginType
()
{
return
loginType
;
}
public
void
setLoginType
(
Integer
loginType
)
{
this
.
loginType
=
loginType
;
}
}
src/main/java/com/tcm/system/user/vo/TcmUserVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
com.yanzuoguang.util.vo.InitDao
;
import
io.swagger.annotations.ApiModelProperty
;
@TableAnnotation
(
"tcm_sys_user"
)
public
class
TcmUserVo
extends
BaseVo
implements
InitDao
{
@ApiModelProperty
(
notes
=
"用户编号"
)
@TableAnnotation
(
"user_id"
)
private
String
userId
;
@ApiModelProperty
(
notes
=
"账户"
)
private
String
username
;
@ApiModelProperty
(
notes
=
"密码"
)
private
String
password
;
@ApiModelProperty
(
notes
=
"真实姓名"
)
@TableAnnotation
(
"real_name"
)
private
String
realName
;
@ApiModelProperty
(
notes
=
"头像"
)
@TableAnnotation
(
"head_pic"
)
private
String
headPic
;
@ApiModelProperty
(
notes
=
"昵称"
)
@TableAnnotation
(
"nick_name"
)
private
String
nickName
;
@ApiModelProperty
(
notes
=
"胖丁用户id"
)
@TableAnnotation
(
"pangd_user_id"
)
private
String
pangdUserId
;
@ApiModelProperty
(
notes
=
"第三方id"
)
@TableAnnotation
(
"third_openid"
)
private
String
thirdOpenid
;
@ApiModelProperty
(
notes
=
"角色id"
)
@TableAnnotation
(
"role_id"
)
private
String
roleId
;
@ApiModelProperty
(
notes
=
"电话"
)
private
String
phone
;
@ApiModelProperty
(
notes
=
"备注"
)
@TableAnnotation
(
"user_remark"
)
private
String
userRemark
;
@ApiModelProperty
(
notes
=
"状态:0-启用,1-禁用"
)
@TableAnnotation
(
"user_status"
)
private
Integer
userStatus
;
@ApiModelProperty
(
notes
=
"创建时间"
)
@TableAnnotation
(
"create_time"
)
private
String
createTime
;
@ApiModelProperty
(
notes
=
"创建者id"
)
@TableAnnotation
(
"create_id"
)
private
String
createId
;
@ApiModelProperty
(
notes
=
"创建者名称"
)
@TableAnnotation
(
"create_name"
)
private
String
createName
;
@ApiModelProperty
(
notes
=
"创建时间"
)
@TableAnnotation
(
"update_time"
)
private
String
updateTime
;
@Override
public
void
init
()
{
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getRealName
()
{
return
realName
;
}
public
void
setRealName
(
String
realName
)
{
this
.
realName
=
realName
;
}
public
String
getHeadPic
()
{
return
headPic
;
}
public
void
setHeadPic
(
String
headPic
)
{
this
.
headPic
=
headPic
;
}
public
String
getNickName
()
{
return
nickName
;
}
public
void
setNickName
(
String
nickName
)
{
this
.
nickName
=
nickName
;
}
public
String
getPangdUserId
()
{
return
pangdUserId
;
}
public
void
setPangdUserId
(
String
pangdUserId
)
{
this
.
pangdUserId
=
pangdUserId
;
}
public
String
getThirdOpenid
()
{
return
thirdOpenid
;
}
public
void
setThirdOpenid
(
String
thirdOpenid
)
{
this
.
thirdOpenid
=
thirdOpenid
;
}
public
String
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
String
roleId
)
{
this
.
roleId
=
roleId
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getUserRemark
()
{
return
userRemark
;
}
public
void
setUserRemark
(
String
userRemark
)
{
this
.
userRemark
=
userRemark
;
}
public
Integer
getUserStatus
()
{
return
userStatus
;
}
public
void
setUserStatus
(
Integer
userStatus
)
{
this
.
userStatus
=
userStatus
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getCreateId
()
{
return
createId
;
}
public
void
setCreateId
(
String
createId
)
{
this
.
createId
=
createId
;
}
public
String
getCreateName
()
{
return
createName
;
}
public
void
setCreateName
(
String
createName
)
{
this
.
createName
=
createName
;
}
public
String
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
String
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
src/main/java/com/tcm/system/user/vo/ValidateCodeVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
public
class
ValidateCodeVo
{
@ApiModelProperty
(
notes
=
"验证码序号"
)
private
String
id
;
@ApiModelProperty
(
notes
=
"验证码图片,base64的图片"
)
private
String
img
;
@ApiModelProperty
(
notes
=
"二维码内容,仅仅在调试模式下生效"
)
private
String
code
;
public
ValidateCodeVo
()
{
}
public
ValidateCodeVo
(
String
id
,
String
img
)
{
this
.
id
=
id
;
this
.
img
=
img
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getImg
()
{
return
img
;
}
public
void
setImg
(
String
img
)
{
this
.
img
=
img
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
}
src/main/java/com/tcm/system/user/vo/req/TcmUserReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
.
req
;
import
com.tcm.system.user.vo.TcmUserVo
;
public
class
TcmUserReqVo
extends
TcmUserVo
{
private
String
loginAccount
;
public
String
getLoginAccount
()
{
return
loginAccount
;
}
public
void
setLoginAccount
(
String
loginAccount
)
{
this
.
loginAccount
=
loginAccount
;
}
}
src/main/java/com/tcm/system/user/vo/req/TcmUserSaveReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
.
req
;
import
com.tcm.system.user.vo.TcmUserVo
;
public
class
TcmUserSaveReqVo
extends
TcmUserVo
{
private
String
reqId
;
private
String
confirmPassword
;
private
Integer
updateType
;
public
String
getReqId
()
{
return
reqId
;
}
public
void
setReqId
(
String
reqId
)
{
this
.
reqId
=
reqId
;
}
public
String
getConfirmPassword
()
{
return
confirmPassword
;
}
public
void
setConfirmPassword
(
String
confirmPassword
)
{
this
.
confirmPassword
=
confirmPassword
;
}
public
Integer
getUpdateType
()
{
return
updateType
;
}
public
void
setUpdateType
(
Integer
updateType
)
{
this
.
updateType
=
updateType
;
}
}
src/main/java/com/tcm/system/user/vo/req/UserLoginReqVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
.
req
;
import
com.pangding.web.vo.system.pd.LoginTokenVo
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
io.swagger.annotations.ApiModelProperty
;
public
class
UserLoginReqVo
extends
LoginTokenVo
{
private
String
reqId
=
StringHelper
.
getNewID
();
@ApiModelProperty
(
notes
=
"Y 账户或者电话号码"
)
private
String
accountOrPhone
;
@ApiModelProperty
(
notes
=
"Y 密码:密码需加密之后传给后端"
)
private
String
password
;
@ApiModelProperty
(
notes
=
"登录类型,0Pc端,1app端,2分销客户端。为空代表pc端"
)
private
Integer
loginType
;
@ApiModelProperty
(
notes
=
"返回状态码"
)
private
String
code
;
@ApiModelProperty
(
notes
=
"验证码Id"
)
private
String
codeId
;
@ApiModelProperty
(
notes
=
"验证码值"
)
private
String
codeValue
;
public
String
getReqId
()
{
return
reqId
;
}
public
void
setReqId
(
String
reqId
)
{
this
.
reqId
=
reqId
;
}
public
String
getAccountOrPhone
()
{
return
accountOrPhone
;
}
public
void
setAccountOrPhone
(
String
accountOrPhone
)
{
this
.
accountOrPhone
=
accountOrPhone
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
Integer
getLoginType
()
{
return
loginType
;
}
public
void
setLoginType
(
Integer
loginType
)
{
this
.
loginType
=
loginType
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getCodeId
()
{
return
codeId
;
}
public
void
setCodeId
(
String
codeId
)
{
this
.
codeId
=
codeId
;
}
public
String
getCodeValue
()
{
return
codeValue
;
}
public
void
setCodeValue
(
String
codeValue
)
{
this
.
codeValue
=
codeValue
;
}
}
src/main/java/com/tcm/system/user/vo/res/TcmUserResVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
.
res
;
import
com.tcm.system.user.vo.TcmUserVo
;
public
class
TcmUserResVo
extends
TcmUserVo
{
}
src/main/java/com/tcm/system/user/vo/res/UserLoginResVo.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
vo
.
res
;
import
com.pangding.web.vo.system.pd.authority.UserVo
;
import
com.pangding.web.vo.system.res.authority.AuthorityListByLevelResVo
;
import
com.tcm.system.authority.vo.res.TcmAuthorityListByLevelResVo
;
import
com.tcm.system.user.vo.TcmUserVo
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.List
;
public
class
UserLoginResVo
{
@ApiModelProperty
(
notes
=
"token"
)
private
String
token
;
@ApiModelProperty
(
notes
=
"登录用户信息"
)
private
TcmUserResVo
tcmUserVo
;
@ApiModelProperty
(
notes
=
"返回编号"
)
private
String
code
;
@ApiModelProperty
(
notes
=
"错误信息"
)
private
String
msg
;
@ApiModelProperty
(
notes
=
"电子签约地址"
)
private
String
url
;
@ApiModelProperty
(
notes
=
"权限列表"
)
private
List
<
TcmAuthorityListByLevelResVo
>
authorityListByLevel
;
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
TcmUserResVo
getTcmUserVo
()
{
return
tcmUserVo
;
}
public
void
setTcmUserVo
(
TcmUserResVo
tcmUserVo
)
{
this
.
tcmUserVo
=
tcmUserVo
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
List
<
TcmAuthorityListByLevelResVo
>
getAuthorityListByLevel
()
{
return
authorityListByLevel
;
}
public
void
setAuthorityListByLevel
(
List
<
TcmAuthorityListByLevelResVo
>
authorityListByLevel
)
{
this
.
authorityListByLevel
=
authorityListByLevel
;
}
}
src/main/java/com/tcm/system/user/web/LoginController.java
0 → 100644
View file @
37fec4be
package
com
.
tcm
.
system
.
user
.
web
;
import
com.tcm.system.user.service.LoginService
;
import
com.tcm.system.user.vo.req.UserLoginReqVo
;
import
com.tcm.system.user.vo.res.UserLoginResVo
;
import
com.yanzuoguang.util.helper.CheckerHelper
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
value
=
"login"
)
@Api
(
value
=
"用户登录类"
)
public
class
LoginController
{
private
LoginService
loginService
;
public
LoginController
(
LoginService
loginService
)
{
this
.
loginService
=
loginService
;
}
/**
* 登陆,验证用户名或手机号,密码是否正确
* 返回token,account,LoginCompanyResVo对象(id:公司id,status:公司状态,companyAttribute:属性,bankCardCodeList:绑定的银行卡数组)
*
* @param req
* @return
*/
@ApiOperation
(
value
=
"登录"
,
notes
=
"返回登录信息"
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
UserLoginResVo
>
mobile
(
@RequestBody
UserLoginReqVo
req
)
throws
Exception
{
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"account or phone"
,
req
.
getAccountOrPhone
())
.
notBlankCheck
(
"password"
,
req
.
getPassword
())
.
notBlankCheck
(
"loginType"
,
req
.
getLoginType
())
.
checkException
();
return
ResponseResult
.
result
(
loginService
.
login
(
req
));
}
}
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