Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
fc780606
Commit
fc780606
authored
May 31, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] add UserContoller getUser by UserName logic
parent
66e264c0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
117 deletions
+102
-117
UserController.java
...main/java/pwc/taxtech/atms/controller/UserController.java
+8
-0
FieldsMapper.java
...-api/src/main/java/pwc/taxtech/atms/dto/FieldsMapper.java
+39
-0
UserRoleService.java
...c/main/java/pwc/taxtech/atms/service/UserRoleService.java
+2
-0
UserService.java
...i/src/main/java/pwc/taxtech/atms/service/UserService.java
+1
-0
UserRoleServiceImpl.java
...va/pwc/taxtech/atms/service/impl/UserRoleServiceImpl.java
+14
-38
UserServiceImpl.java
...n/java/pwc/taxtech/atms/service/impl/UserServiceImpl.java
+38
-79
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/UserController.java
View file @
fc780606
...
...
@@ -223,4 +223,12 @@ public class UserController {
return
userRoleService
.
updateUserRoleForOrg
(
userRoleList
);
}
@SuppressWarnings
(
"rawtypes"
)
@ApiOperation
(
value
=
"查询用户信息"
,
notes
=
"税务运营管理平台>增值税申报"
)
@RequestMapping
(
value
=
"getUserByName"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
@ResponseBody
OperationResultDto
getUserByName
(
@RequestBody
UserDto
userParam
)
{
return
userRoleService
.
GetUserByUserName
(
userParam
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/FieldsMapper.java
0 → 100644
View file @
fc780606
package
pwc
.
taxtech
.
atms
.
dto
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.lang.reflect.Field
;
public
class
FieldsMapper
{
private
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
FieldsMapper
.
class
);
/**
* 将source对象的属性填充到destination对象对应属性中
*
* @param source 原始对象
* @param destination 目标对象
*/
public
static
<
S
,
D
>
void
map
(
S
source
,
D
destination
)
throws
ClassNotFoundException
,
IllegalAccessException
{
Class
clsDestination
=
Class
.
forName
(
destination
.
getClass
().
getName
());
Class
clsSource
=
Class
.
forName
(
source
.
getClass
().
getName
());
Field
[]
declaredFields
=
clsDestination
.
getDeclaredFields
();
for
(
Field
field
:
declaredFields
)
{
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
try
{
if
(
"serialVersionUID"
.
equals
(
fieldName
))
{
continue
;
}
Field
sourceField
=
clsSource
.
getDeclaredField
(
fieldName
);
sourceField
.
setAccessible
(
true
);
field
.
set
(
destination
,
sourceField
.
get
(
source
));
}
catch
(
NoSuchFieldException
e
)
{
LOGGER
.
warn
(
"NoSuchFieldException {}"
,
fieldName
);
}
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/UserRoleService.java
View file @
fc780606
...
...
@@ -67,4 +67,6 @@ public interface UserRoleService {
@SuppressWarnings
(
"rawtypes"
)
OperationResultDto
deleteUserRoleByOrgID
(
UserOrgDto
userDto
);
UserDto
GetUserByUserName
(
UserDto
userParam
);
}
atms-api/src/main/java/pwc/taxtech/atms/service/UserService.java
View file @
fc780606
...
...
@@ -48,4 +48,5 @@ public interface UserService {
List
<
UserOrganization
>
findUserOrganizationByUserIDAndOrganizationID
(
String
userID
,
String
organizationID
);
UserDto
getUserByDto
(
UserDto
userParam
);
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/UserRoleServiceImpl.java
View file @
fc780606
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.nutz.lang.Strings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.util.StringUtils
;
import
pwc.taxtech.atms.common.ApplicationException
;
import
pwc.taxtech.atms.common.CommonConstants
;
import
pwc.taxtech.atms.common.CommonUtils
;
...
...
@@ -36,42 +28,21 @@ import pwc.taxtech.atms.dto.organization.OrgRoleDtoList;
import
pwc.taxtech.atms.dto.organization.OrganizationDto
;
import
pwc.taxtech.atms.dto.organization.SimpleRoleDto
;
import
pwc.taxtech.atms.dto.role.RoleDto
;
import
pwc.taxtech.atms.dto.user.DimensionUser
;
import
pwc.taxtech.atms.dto.user.NameDto
;
import
pwc.taxtech.atms.dto.user.OrganizationRoleInfo
;
import
pwc.taxtech.atms.dto.user.RoleInfo
;
import
pwc.taxtech.atms.dto.user.UpdateParam
;
import
pwc.taxtech.atms.dto.user.UserAndUserRoleSaveDto
;
import
pwc.taxtech.atms.dto.user.UserDto
;
import
pwc.taxtech.atms.dto.user.UserOrgDto
;
import
pwc.taxtech.atms.dto.user.UserOrgRoleDto
;
import
pwc.taxtech.atms.dto.user.UserOrganizationDto
;
import
pwc.taxtech.atms.dto.user.UserRoleDimensionValueDto
;
import
pwc.taxtech.atms.dto.user.UserRoleDisplayInfo
;
import
pwc.taxtech.atms.dto.user.UserRoleQuery
;
import
pwc.taxtech.atms.dto.user.UserRoleQueryDto
;
import
pwc.taxtech.atms.entitiy.Organization
;
import
pwc.taxtech.atms.entitiy.Role
;
import
pwc.taxtech.atms.entitiy.User
;
import
pwc.taxtech.atms.entitiy.UserDimensionValue
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueExample
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueOrg
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueOrgExample
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueRole
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueRoleExample
;
import
pwc.taxtech.atms.entitiy.UserExample
;
import
pwc.taxtech.atms.entitiy.UserOrganization
;
import
pwc.taxtech.atms.entitiy.UserOrganizationExample
;
import
pwc.taxtech.atms.entitiy.UserOrganizationRole
;
import
pwc.taxtech.atms.entitiy.UserOrganizationRoleExample
;
import
pwc.taxtech.atms.entitiy.UserRole
;
import
pwc.taxtech.atms.entitiy.UserRoleExample
;
import
pwc.taxtech.atms.dto.user.*
;
import
pwc.taxtech.atms.entitiy.*
;
import
pwc.taxtech.atms.entitiy.UserRoleExample.Criteria
;
import
pwc.taxtech.atms.service.OrganizationService
;
import
pwc.taxtech.atms.service.PermissionService
;
import
pwc.taxtech.atms.service.UserRoleService
;
import
pwc.taxtech.atms.service.UserService
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
public
class
UserRoleServiceImpl
extends
AbstractService
implements
UserRoleService
{
...
...
@@ -1679,4 +1650,9 @@ public class UserRoleServiceImpl extends AbstractService implements UserRoleServ
result
.
setResult
(
true
);
return
result
;
}
@Override
public
UserDto
GetUserByUserName
(
UserDto
userParam
)
{
return
userService
.
getUserByDto
(
userParam
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/UserServiceImpl.java
View file @
fc780606
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -15,84 +8,35 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
com.alibaba.fastjson.JSON
;
import
pwc.taxtech.atms.common.ApplicationException
;
import
pwc.taxtech.atms.common.AuthUserHelper
;
import
pwc.taxtech.atms.common.CheckState
;
import
pwc.taxtech.atms.common.CommonConstants
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.OperateLogType
;
import
pwc.taxtech.atms.common.OperationAction
;
import
pwc.taxtech.atms.common.OperationModule
;
import
pwc.taxtech.atms.common.UserLoginType
;
import
pwc.taxtech.atms.common.UserStatus
;
import
pwc.taxtech.atms.common.*
;
import
pwc.taxtech.atms.common.message.UserMessage
;
import
pwc.taxtech.atms.constant.DimensionConstant
;
import
pwc.taxtech.atms.constant.PermissionCode
;
import
pwc.taxtech.atms.constant.PermissionUrl
;
import
pwc.taxtech.atms.dao.PermissionMapper
;
import
pwc.taxtech.atms.dao.RoleMapper
;
import
pwc.taxtech.atms.dao.RolePermissionMapper
;
import
pwc.taxtech.atms.dao.UserMapper
;
import
pwc.taxtech.atms.dao.UserOrganizationMapper
;
import
pwc.taxtech.atms.dao.UserRoleMapper
;
import
pwc.taxtech.atms.dto.AtmsTokenDto
;
import
pwc.taxtech.atms.dto.LogOnDto
;
import
pwc.taxtech.atms.dto.LoginInputDto
;
import
pwc.taxtech.atms.dto.LoginOutputDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.UpdateLogParams
;
import
pwc.taxtech.atms.dao.*
;
import
pwc.taxtech.atms.dto.*
;
import
pwc.taxtech.atms.dto.organization.DimensionRoleDto
;
import
pwc.taxtech.atms.dto.organization.OrgCustomDto
;
import
pwc.taxtech.atms.dto.organization.SimpleRoleDto
;
import
pwc.taxtech.atms.dto.permission.OrganizationPermissionDto
;
import
pwc.taxtech.atms.dto.permission.OrganizationPermissionKeyDto
;
import
pwc.taxtech.atms.dto.permission.PermissionDto
;
import
pwc.taxtech.atms.dto.permission.PermissionKeyDto
;
import
pwc.taxtech.atms.dto.permission.UserPermissionDto
;
import
pwc.taxtech.atms.dto.permission.UserPermissionKeyDto
;
import
pwc.taxtech.atms.dto.user.RoleInfo
;
import
pwc.taxtech.atms.dto.user.UserAndUserRoleSaveDto
;
import
pwc.taxtech.atms.dto.user.UserDto
;
import
pwc.taxtech.atms.dto.user.UserPasswordDto
;
import
pwc.taxtech.atms.dto.user.UserRoleDimensionValueDto
;
import
pwc.taxtech.atms.dto.user.UserRoleInfo
;
import
pwc.taxtech.atms.dto.user.VMUser
;
import
pwc.taxtech.atms.dto.user.WebUserDto
;
import
pwc.taxtech.atms.entitiy.Menu
;
import
pwc.taxtech.atms.entitiy.Permission
;
import
pwc.taxtech.atms.entitiy.PermissionExample
;
import
pwc.taxtech.atms.entitiy.Role
;
import
pwc.taxtech.atms.entitiy.RoleExample
;
import
pwc.taxtech.atms.entitiy.RolePermission
;
import
pwc.taxtech.atms.entitiy.RolePermissionExample
;
import
pwc.taxtech.atms.entitiy.User
;
import
pwc.taxtech.atms.entitiy.UserDimensionValue
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueExample
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueRole
;
import
pwc.taxtech.atms.entitiy.UserDimensionValueRoleExample
;
import
pwc.taxtech.atms.entitiy.UserExample
;
import
pwc.taxtech.atms.entitiy.UserOrganization
;
import
pwc.taxtech.atms.entitiy.UserOrganizationExample
;
import
pwc.taxtech.atms.entitiy.UserOrganizationRole
;
import
pwc.taxtech.atms.entitiy.UserOrganizationRoleExample
;
import
pwc.taxtech.atms.entitiy.UserRole
;
import
pwc.taxtech.atms.entitiy.UserRoleExample
;
import
pwc.taxtech.atms.dto.permission.*
;
import
pwc.taxtech.atms.dto.user.*
;
import
pwc.taxtech.atms.entitiy.*
;
import
pwc.taxtech.atms.entitiy.UserRoleExample.Criteria
;
import
pwc.taxtech.atms.security.AtmsPasswordEncoder
;
import
pwc.taxtech.atms.security.JwtUtil
;
import
pwc.taxtech.atms.security.LdapAuthenticationProvider
;
import
pwc.taxtech.atms.service.MenuService
;
import
pwc.taxtech.atms.service.OperationLogService
;
import
pwc.taxtech.atms.service.OrganizationService
;
import
pwc.taxtech.atms.service.RoleService
;
import
pwc.taxtech.atms.service.UserAccountService
;
import
pwc.taxtech.atms.service.UserRoleService
;
import
pwc.taxtech.atms.service.UserService
;
/** @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\UserService.cs */
import
pwc.taxtech.atms.service.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\UserService.cs
*/
@Service
public
class
UserServiceImpl
extends
AbstractService
implements
UserService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserServiceImpl
.
class
);
...
...
@@ -275,7 +219,7 @@ public class UserServiceImpl extends AbstractService implements UserService {
}
private
List
<
OrganizationPermissionDto
>
getOrganizationPermissionList
(
User
user
,
List
<
RolePermission
>
rolePermissionList
,
List
<
Permission
>
permissionList
)
{
List
<
RolePermission
>
rolePermissionList
,
List
<
Permission
>
permissionList
)
{
VMUser
vmUser
=
new
VMUser
();
vmUser
.
setID
(
user
.
getID
());
vmUser
.
setEmail
(
user
.
getEmail
());
...
...
@@ -324,7 +268,7 @@ public class UserServiceImpl extends AbstractService implements UserService {
}
private
List
<
OrganizationPermissionKeyDto
>
getOrganizationPermissionKeyList
(
User
user
,
List
<
RolePermission
>
rolePermissionList
,
List
<
Permission
>
permissionList
)
{
List
<
RolePermission
>
rolePermissionList
,
List
<
Permission
>
permissionList
)
{
VMUser
vmUser
=
new
VMUser
();
vmUser
.
setID
(
user
.
getID
());
vmUser
.
setEmail
(
user
.
getEmail
());
...
...
@@ -809,7 +753,7 @@ public class UserServiceImpl extends AbstractService implements UserService {
}
private
UpdateLogParams
generateUpdateLogParams
(
Integer
logType
,
String
operationContent
,
String
operationObject
,
Integer
action
,
Integer
module
)
{
Integer
action
,
Integer
module
)
{
UpdateLogParams
updateLogParams
=
new
UpdateLogParams
();
updateLogParams
.
setOperateLogType
(
logType
);
updateLogParams
.
setOperationContent
(
operationContent
);
...
...
@@ -828,6 +772,21 @@ public class UserServiceImpl extends AbstractService implements UserService {
return
userOrganizationMapper
.
selectByExample
(
userOrganizationExample
);
}
@Override
public
UserDto
getUserByDto
(
UserDto
userParam
)
{
User
user
=
userMapper
.
selectByUserName
(
userParam
.
getUserName
());
UserDto
dto
=
null
;
if
(
user
!=
null
)
{
dto
=
new
UserDto
();
try
{
FieldsMapper
.
map
(
user
,
dto
);
}
catch
(
Exception
e
)
{
throw
new
ApplicationException
(
"server internal error"
);
}
}
return
dto
;
}
private
List
<
UserRole
>
findUserRoleByUserIDWithoutProjectID
(
String
userID
)
{
UserRoleExample
userRoleExample
=
new
UserRoleExample
();
Criteria
criteria
=
userRoleExample
.
createCriteria
();
...
...
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