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
0e56776b
Commit
0e56776b
authored
Jun 11, 2019
by
zjy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user/role/tright 6.11
需要增加:修改权限sort和将后面的-1 还需要调用其他服务
parent
4ae1ad8e
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
106 additions
and
30 deletions
+106
-30
AuthorityController.java
...angding/web/authority/controller/AuthorityController.java
+2
-3
CompanyManagementController.java
...web/authority/controller/CompanyManagementController.java
+2
-2
AuthorityDao.java
...ain/java/com/pangding/web/authority/dao/AuthorityDao.java
+3
-0
AuthorityDaoImpl.java
...com/pangding/web/authority/dao/impl/AuthorityDaoImpl.java
+11
-0
AuthorityServiceImpl.java
...ding/web/authority/service/impl/AuthorityServiceImpl.java
+15
-5
CompanyServiceImpl.java
...ngding/web/authority/service/impl/CompanyServiceImpl.java
+13
-1
RegisterServiceImpl.java
...gding/web/authority/service/impl/RegisterServiceImpl.java
+1
-0
RoleServiceImpl.java
.../pangding/web/authority/service/impl/RoleServiceImpl.java
+18
-5
CompanyBankCardConstant.java
.../pangding/web/authority/util/CompanyBankCardConstant.java
+2
-2
AuthorityVo.java
src/main/java/com/pangding/web/authority/vo/AuthorityVo.java
+3
-3
CompanyBankCardVo.java
...java/com/pangding/web/authority/vo/CompanyBankCardVo.java
+3
-3
AuthorityAfterReqVo.java
.../pangding/web/authority/vo/reqvo/AuthorityAfterReqVo.java
+27
-0
AuthorityGetReqVo.java
...om/pangding/web/authority/vo/reqvo/AuthorityGetReqVo.java
+3
-3
CompanyBankCardGetReqVo.java
...gding/web/authority/vo/reqvo/CompanyBankCardGetReqVo.java
+3
-3
No files found.
src/main/java/com/pangding/web/authority/controller/AuthorityController.java
View file @
0e56776b
...
...
@@ -4,6 +4,7 @@ package com.pangding.web.authority.controller;
import
com.pangding.web.authority.service.AuthorityService
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo
;
import
com.pangding.web.authority.vo.resvo.AuthorityResVo
;
import
com.pangding.web.authority.vo.resvo.WebAuthorityResVo
;
import
com.yanzuoguang.util.helper.CheckerHelper
;
...
...
@@ -38,7 +39,6 @@ public class AuthorityController {
.
notBlankCheck
(
"authorityName"
,
authorityVo
.
getName
())
.
notBlankCheck
(
"type"
,
authorityVo
.
getType
())
.
notBlankCheck
(
"alias"
,
authorityVo
.
getAlias
())
.
notBlankCheck
(
"authorityUrl"
,
authorityVo
.
getUrl
())
.
notBlankCheck
(
"openMode"
,
authorityVo
.
getOpenMode
())
.
notBlankCheck
(
"remark"
,
authorityVo
.
getRemark
())
.
notBlankCheck
(
"sort"
,
authorityVo
.
getSort
())
...
...
@@ -56,7 +56,6 @@ public class AuthorityController {
public
ResponseResult
<
String
>
updateAuthority
(
@RequestBody
AuthorityVo
authorityVo
){
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"authorityName"
,
authorityVo
.
getName
())
.
notBlankCheck
(
"authorityUrl"
,
authorityVo
.
getUrl
())
.
notBlankCheck
(
"type"
,
authorityVo
.
getType
())
.
notBlankCheck
(
"alias"
,
authorityVo
.
getAlias
())
.
notBlankCheck
(
"openMode"
,
authorityVo
.
getOpenMode
())
...
...
@@ -90,7 +89,7 @@ public class AuthorityController {
* @return
*/
@RequestMapping
(
value
=
"/listByLevel"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
listByLevel
(
@RequestBody
AuthorityListReqVo
reqVo
){
public
ResponseResult
<
List
<
AuthorityListByLevelResVo
>>
listByLevel
(
@RequestBody
AuthorityListReqVo
reqVo
){
return
ResponseResult
.
result
(
authorityServiceImpl
.
getListByLevel
(
reqVo
));
}
...
...
src/main/java/com/pangding/web/authority/controller/CompanyManagementController.java
View file @
0e56776b
...
...
@@ -105,12 +105,12 @@ public class CompanyManagementController {
* @return 二维码url
*/
@RequestMapping
(
value
=
"/generateQrCodeUrl"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
generateQrCodeUrl
(
@RequestBody
GenerateQrCodeUrlReqVo
reqVo
){
public
ResponseResult
<
String
>
generateQrCodeUrl
(
@RequestBody
GenerateQrCodeUrlReqVo
reqVo
){
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"companyId"
,
reqVo
.
getCompanyId
())
.
notBlankCheck
(
"select"
,
reqVo
.
getSelect
())
.
checkException
();
return
companyServiceImpl
.
generateQrCodeUrl
(
reqVo
);
return
ResponseResult
.
result
(
companyServiceImpl
.
generateQrCodeUrl
(
reqVo
)
);
}
/**y
...
...
src/main/java/com/pangding/web/authority/dao/AuthorityDao.java
View file @
0e56776b
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.AuthorityAfterReqVo
;
import
com.pangding.web.authority.vo.reqvo.AuthorityListReqVo
;
import
com.pangding.web.authority.vo.reqvo.ListAuthorityByPageReqVo
;
import
com.yanzuoguang.dao.BaseDao
;
...
...
@@ -30,4 +31,6 @@ public interface AuthorityDao extends BaseDao {
List
<
AuthorityVo
>
getLevelOne
(
AuthorityListReqVo
reqVo
);
List
<
AuthorityVo
>
after
(
AuthorityAfterReqVo
afterReqVo
);
}
src/main/java/com/pangding/web/authority/dao/impl/AuthorityDaoImpl.java
View file @
0e56776b
...
...
@@ -2,6 +2,7 @@ package com.pangding.web.authority.dao.impl;
import
com.pangding.web.authority.dao.AuthorityDao
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.AuthorityAfterReqVo
;
import
com.pangding.web.authority.vo.reqvo.AuthorityListReqVo
;
import
com.pangding.web.authority.vo.reqvo.ListAuthorityByPageReqVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
...
...
@@ -19,6 +20,7 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
private
static
final
String
CHECK_VALID
=
"CHECK_VALID"
;
private
static
final
String
SELECT
=
"SELECT"
;
private
static
final
String
GET_LEVEL_ONE
=
"GET_LEVEL_ONE"
;
private
static
final
String
AFTER
=
"AFTER"
;
@Override
protected
void
init
()
{
...
...
@@ -34,6 +36,10 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
table
.
add
(
GET_LEVEL_ONE
,
"select * from pd_authority where 1=1 "
)
.
add
(
"levelOne"
,
"and pid = '' "
);
table
.
add
(
AFTER
,
"select * from pd_authority where 1=1 "
)
.
add
(
"pid"
,
"and pid = ? "
)
.
add
(
"sort"
,
"and sort >= ? "
);
}
/**
...
...
@@ -61,4 +67,9 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
public
List
<
AuthorityVo
>
getLevelOne
(
AuthorityListReqVo
reqVo
)
{
return
this
.
query
(
AuthorityVo
.
class
,
GET_LEVEL_ONE
,
reqVo
);
}
@Override
public
List
<
AuthorityVo
>
after
(
AuthorityAfterReqVo
afterReqVo
)
{
return
this
.
query
(
AuthorityVo
.
class
,
AFTER
,
afterReqVo
);
}
}
src/main/java/com/pangding/web/authority/service/impl/AuthorityServiceImpl.java
View file @
0e56776b
...
...
@@ -44,12 +44,13 @@ public class AuthorityServiceImpl implements AuthorityService {
* @return 用户id
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
save
(
AuthorityVo
authorityVo
)
{
this
.
checkValid
(
authorityVo
);
if
(
null
!=
authorityVo
.
getPid
()
&&
!
authorityVo
.
getPid
().
isEmpty
()){
if
(
null
==
authorityVo
.
getPid
()
||
authorityVo
.
getPid
().
isEmpty
()){
authorityVo
.
setPid
(
""
);
}
checkSort
(
authorityVo
);
afterPlus
(
authorityVo
);
authorityVo
.
setId
(
StringHelper
.
getNewID
());
authorityDao
.
create
(
authorityVo
);
return
authorityVo
.
getId
();
...
...
@@ -59,13 +60,21 @@ public class AuthorityServiceImpl implements AuthorityService {
* 检查权限排序是否重复
* @param authorityVo 权限对象
*/
private
void
checkSort
(
AuthorityVo
authorityVo
){
private
void
afterPlus
(
AuthorityVo
authorityVo
){
AuthorityGetReqVo
reqVo
=
new
AuthorityGetReqVo
();
reqVo
.
setPid
(
authorityVo
.
getPid
());
reqVo
.
setSort
(
authorityVo
.
getSort
());
AuthorityVo
authorityVo1
=
authorityDao
.
load
(
reqVo
,
AuthorityVo
.
class
);
if
(
authorityVo1
!=
null
){
throw
new
CodeException
(
"该权限排序已存在"
);
AuthorityAfterReqVo
afterReqVo
=
new
AuthorityAfterReqVo
();
ObjectHelper
.
writeWithFrom
(
afterReqVo
,
authorityVo
);
List
<
AuthorityVo
>
authorityVoList
=
authorityDao
.
after
(
afterReqVo
);
for
(
AuthorityVo
authorityVo2:
authorityVoList
)
{
String
sort
=
authorityVo2
.
getSort
();
String
newSort
=
(
Integer
.
parseInt
(
sort
)+
1
)
+
""
;
authorityVo2
.
setSort
(
newSort
);
authorityDao
.
update
(
authorityVo2
);
}
}
}
...
...
@@ -76,12 +85,13 @@ public class AuthorityServiceImpl implements AuthorityService {
* @return 用户id
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
update
(
AuthorityVo
authorityVo
)
{
this
.
checkValid
(
authorityVo
);
if
(
null
!=
authorityVo
.
getPid
()
&&
!
authorityVo
.
getPid
().
isEmpty
()){
authorityVo
.
setPid
(
""
);
}
checkSort
(
authorityVo
);
afterPlus
(
authorityVo
);
authorityDao
.
update
(
authorityVo
);
return
authorityVo
.
getId
();
}
...
...
src/main/java/com/pangding/web/authority/service/impl/CompanyServiceImpl.java
View file @
0e56776b
...
...
@@ -421,7 +421,10 @@ public class CompanyServiceImpl implements CompanyService{
getReqVo
.
setId
(
reqVo
.
getId
());
CompanyBankCardVo
companyBankCardVo
=
companyBankCardDao
.
load
(
getReqVo
,
CompanyBankCardVo
.
class
);
if
(
null
!=
companyBankCardVo
){
ObjectHelper
.
writeWithFrom
(
companyBankCardVo
,
reqVo
);
reqVo
.
setStatus
(
companyBankCardVo
.
getStatus
());
reqVo
.
setBindingCode
(
companyBankCardVo
.
getBindingCode
());
reqVo
.
setBindingTime
(
companyBankCardVo
.
getBindingTime
());
reqVo
.
setIsDefault
(
companyBankCardVo
.
getIsDefault
());
companyBankCardDao
.
update
(
companyBankCardVo
);
}
}
...
...
@@ -469,6 +472,15 @@ public class CompanyServiceImpl implements CompanyService{
if
(
null
==
result
||
!
"00"
.
equals
(
result
.
getCode
())){
throw
new
CodeException
(
"解绑失败,请重试"
);
}
if
(
CompanyBankCardConstant
.
IS_DEFAULT
.
equals
(
bankCardVo
.
getIsDefault
())){
CompanyBankCardGetReqVo
getReqVo
=
new
CompanyBankCardGetReqVo
();
getReqVo
.
setCompanyId
(
bankCardVo
.
getCompanyId
());
CompanyBankCardVo
companyBankCardVo
=
companyBankCardDao
.
load
(
getReqVo
,
CompanyBankCardVo
.
class
);
if
(
null
!=
companyBankCardVo
){
companyBankCardVo
.
setIsDefault
(
CompanyBankCardConstant
.
IS_DEFAULT
);
companyExtendDaoImpl
.
update
(
companyBankCardVo
);
}
}
companyBankCardDao
.
remove
(
bankCardVo
);
}
...
...
src/main/java/com/pangding/web/authority/service/impl/RegisterServiceImpl.java
View file @
0e56776b
...
...
@@ -229,6 +229,7 @@ public class RegisterServiceImpl implements RegisterService {
/*此处应该调用第三方接口传入companyVo发送手机验证码并更新公司状态*/
CompanyReqVo
companyReqVo
=
new
CompanyReqVo
();
companyReqVo
.
setBankList
(
new
ArrayList
());
ObjectHelper
.
writeWithFrom
(
companyReqVo
,
reqVo
);
CompanyBankReqVo
companyBankReqVo
=
new
CompanyBankReqVo
();
ObjectHelper
.
writeWithFrom
(
companyBankReqVo
,
reqVo
);
...
...
src/main/java/com/pangding/web/authority/service/impl/RoleServiceImpl.java
View file @
0e56776b
...
...
@@ -88,16 +88,29 @@ public class RoleServiceImpl implements RoleService {
List
<
String
>
authorityIds
=
webRoleReqVo
.
getAuthorityIds
();
if
(
authorityIds
!=
null
&&
!
authorityIds
.
isEmpty
()){
for
(
String
authorityId
:
authorityIds
)
{
RoleAuthorityVo
roleAuthorityRelation
=
new
RoleAuthorityVo
();
roleAuthorityRelation
.
setAuthorityId
(
authorityId
);
roleAuthorityRelation
.
setRoleId
(
webRoleReqVo
.
getId
());
roleAuthorityRelation
.
setId
(
StringHelper
.
getNewID
());
roleAuthorityDaoImpl
.
create
(
roleAuthorityRelation
);
saveRoleAuthority
(
reqVo
.
getRoleId
(),
authorityId
);
}
}
return
roleVo
.
getId
();
}
private
void
saveRoleAuthority
(
String
roleId
,
String
authorityId
){
AuthorityGetReqVo
getReqVo
=
new
AuthorityGetReqVo
();
getReqVo
.
setId
(
authorityId
);
AuthorityVo
authorityVo
=
authorityDaoImpl
.
load
(
getReqVo
,
AuthorityVo
.
class
);
if
(
null
!=
authorityVo
&&
null
!=
authorityVo
.
getPid
()
&&
!
authorityVo
.
getPid
().
isEmpty
()){
saveRoleAuthority
(
roleId
,
authorityVo
.
getPid
());
}
RoleAuthorityVo
roleAuthorityVo
=
new
RoleAuthorityVo
();
roleAuthorityVo
.
setRoleId
(
roleId
);
roleAuthorityVo
.
setAuthorityId
(
authorityId
);
RoleAuthorityVo
existVo
=
roleAuthorityDaoImpl
.
load
(
roleAuthorityVo
,
RoleAuthorityVo
.
class
);
if
(
null
==
existVo
){
roleAuthorityVo
.
setId
(
StringHelper
.
getNewID
());
roleAuthorityDaoImpl
.
create
(
roleAuthorityVo
);
}
}
/**
* 通过主键id查询RoleVo对象
*
...
...
src/main/java/com/pangding/web/authority/util/CompanyBankCardConstant.java
View file @
0e56776b
...
...
@@ -9,11 +9,11 @@ public class CompanyBankCardConstant {
* 设置银行卡为默认卡
* 值:1
*/
public
static
final
int
IS_DEFAULT
=
1
;
public
static
final
String
IS_DEFAULT
=
"1"
;
/**
* 不设置为默认卡
* 值:0
*/
public
static
final
int
IS_NOT_DEFAULT
=
0
;
public
static
final
String
IS_NOT_DEFAULT
=
"0"
;
}
src/main/java/com/pangding/web/authority/vo/AuthorityVo.java
View file @
0e56776b
...
...
@@ -37,13 +37,13 @@ public class AuthorityVo extends BaseVo implements InitDao {
private
String
createTime
;
private
int
sort
;
private
String
sort
;
public
int
getSort
()
{
public
String
getSort
()
{
return
sort
;
}
public
void
setSort
(
int
sort
)
{
public
void
setSort
(
String
sort
)
{
this
.
sort
=
sort
;
}
...
...
src/main/java/com/pangding/web/authority/vo/CompanyBankCardVo.java
View file @
0e56776b
...
...
@@ -47,7 +47,7 @@ public class CompanyBankCardVo extends BaseVo {
private
String
bindingTime
;
@TableAnnotation
(
"is_default"
)
private
int
isDefault
;
private
String
isDefault
;
public
String
getPhone
()
{
return
phone
;
...
...
@@ -57,11 +57,11 @@ public class CompanyBankCardVo extends BaseVo {
this
.
phone
=
phone
;
}
public
int
getIsDefault
()
{
public
String
getIsDefault
()
{
return
isDefault
;
}
public
void
setIsDefault
(
int
isDefault
)
{
public
void
setIsDefault
(
String
isDefault
)
{
this
.
isDefault
=
isDefault
;
}
...
...
src/main/java/com/pangding/web/authority/vo/reqvo/AuthorityAfterReqVo.java
0 → 100644
View file @
0e56776b
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
/**
* @Author zhangjinyao
* @create 2019/6/11 19:14
*/
public
class
AuthorityAfterReqVo
{
private
String
pid
;
private
String
sort
;
public
String
getPid
()
{
return
pid
;
}
public
void
setPid
(
String
pid
)
{
this
.
pid
=
pid
;
}
public
String
getSort
()
{
return
sort
;
}
public
void
setSort
(
String
sort
)
{
this
.
sort
=
sort
;
}
}
src/main/java/com/pangding/web/authority/vo/reqvo/AuthorityGetReqVo.java
View file @
0e56776b
...
...
@@ -10,7 +10,7 @@ public class AuthorityGetReqVo {
private
String
pid
;
private
int
sort
;
private
String
sort
;
public
String
getReqId
()
{
return
reqId
;
...
...
@@ -20,11 +20,11 @@ public class AuthorityGetReqVo {
this
.
reqId
=
reqId
;
}
public
int
getSort
()
{
public
String
getSort
()
{
return
sort
;
}
public
void
setSort
(
int
sort
)
{
public
void
setSort
(
String
sort
)
{
this
.
sort
=
sort
;
}
...
...
src/main/java/com/pangding/web/authority/vo/reqvo/CompanyBankCardGetReqVo.java
View file @
0e56776b
...
...
@@ -11,13 +11,13 @@ public class CompanyBankCardGetReqVo {
private
String
companyId
;
private
int
isDefault
;
private
String
isDefault
;
public
int
getIsDefault
()
{
public
String
getIsDefault
()
{
return
isDefault
;
}
public
void
setIsDefault
(
int
isDefault
)
{
public
void
setIsDefault
(
String
isDefault
)
{
this
.
isDefault
=
isDefault
;
}
...
...
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