Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
d1b957b6
Commit
d1b957b6
authored
Dec 20, 2019
by
zuoyh
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'new-emploee-upd'
parents
a5370691
6c7f81d2
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
809 additions
and
133 deletions
+809
-133
AppUserPositionChangeRecordDTO.java
...qi/security/admin/dto/AppUserPositionChangeRecordDTO.java
+112
-0
AppUserPositionTempDTO.java
...ub/wxiaoqi/security/admin/dto/AppUserPositionTempDTO.java
+19
-2
AppUserPositionTempFindDTO.java
...xiaoqi/security/admin/dto/AppUserPositionTempFindDTO.java
+1
-0
AppUserPositionChangeRecord.java
...qi/security/admin/entity/AppUserPositionChangeRecord.java
+100
-0
AppUserPositionTemp.java
...ub/wxiaoqi/security/admin/entity/AppUserPositionTemp.java
+4
-0
AppUserDetailBiz.java
...m/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
+32
-17
AppUserLoginBiz.java
...om/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
+38
-17
AppUserPositionChangeRecordBiz.java
...qi/security/admin/biz/AppUserPositionChangeRecordBiz.java
+188
-0
AppUserPositionTempBiz.java
...ub/wxiaoqi/security/admin/biz/AppUserPositionTempBiz.java
+212
-90
AppUserPositionChangeRecordMapper.java
...urity/admin/mapper/AppUserPositionChangeRecordMapper.java
+7
-0
AppUsersManageController.java
...wxiaoqi/security/admin/rest/AppUsersManageController.java
+20
-3
AppUserPositionController.java
.../security/admin/rest/admin/AppUserPositionController.java
+76
-4
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/AppUserPositionChangeRecordDTO.java
0 → 100644
View file @
d1b957b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
/**
* 员工变更记录表
*/
@Data
public
class
AppUserPositionChangeRecordDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
private
Integer
id
;
/**
* 用户id
*/
private
String
phone
;
/**
* 用户名称
*/
private
String
userName
;
/**
* 变更后所在公司ID
*/
private
Integer
newCompanyId
;
/**
* 变更前所在公司ID
*/
private
Integer
oldCompanyId
;
/**
* 变更后所在公司名称
*/
private
String
newCompanyName
;
/**
* 变更前所在公司名称
*/
private
String
oldCompanyName
;
/**
* 旧职位ID
*/
private
Integer
oldJobId
;
/**
* 新职位ID
*/
private
Integer
newJobId
;
/**
* 新职位名称
*/
private
String
newJobName
;
/**
* 旧职位名称
*/
private
String
oldJobName
;
/**
* 操作人名称
*/
private
Integer
operatorId
;
/**
* 操作时间
*/
private
Timestamp
crtTime
;
/**
* 状态
* 1:入职;2:职位变更;3:身份变更 4:公司所属变更;5离职
*/
private
Integer
jobRemark
;
/***
* 旧身份ID
*/
private
Integer
oldPositionId
;
/***
* 新身份ID
*/
private
Integer
newPositionId
;
/***
* 新身份名称
*/
private
String
newPositionName
;
/***
* 旧身份名称
*/
private
String
oldPositionName
;
/**
* 员工职位、所属公司、离职、入职等的实际上任时间
*/
private
Timestamp
relTime
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/AppUserPositionTempDTO.java
View file @
d1b957b6
...
...
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Builder
;
import
lombok.Data
;
import
java.sql.Timestamp
;
/**
* @author libin
* @version 1.0
...
...
@@ -20,11 +22,9 @@ public class AppUserPositionTempDTO {
@ApiModelProperty
(
value
=
"手机号码"
)
private
String
phone
;
@ApiModelProperty
(
value
=
"姓名"
)
private
String
name
;
@ApiModelProperty
(
value
=
"身份id"
)
private
Integer
positionId
;
...
...
@@ -37,4 +37,21 @@ public class AppUserPositionTempDTO {
@ApiModelProperty
(
value
=
"分公司"
)
private
String
companyName
;
@ApiModelProperty
(
value
=
"变动操作内容"
)
private
Integer
ChangeStatus
;
@ApiModelProperty
(
value
=
"员工职位、所属公司、离职、入职等的实际上任时间"
)
private
Timestamp
relTime
;
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
private
Integer
isDel
;
@ApiModelProperty
(
value
=
"员工职位状态:0-正常;1-离职"
)
private
Integer
isQuit
;
@ApiModelProperty
(
value
=
"用户id"
)
private
Integer
userId
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/AppUserPositionTempFindDTO.java
View file @
d1b957b6
...
...
@@ -15,4 +15,5 @@ public class AppUserPositionTempFindDTO extends PageParam {
private
String
name
;
private
Integer
status
;
private
Integer
companyId
;
private
Integer
positionId
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppUserPositionChangeRecord.java
0 → 100644
View file @
d1b957b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.sql.Timestamp
;
import
java.util.Date
;
/**
* 员工变更记录表
*/
@Table
(
name
=
"app_user_position_change_record"
)
@Data
public
class
AppUserPositionChangeRecord
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
//此处加上注解
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
@ApiModelProperty
(
"用户id"
)
@Column
(
name
=
"phone"
)
private
String
phone
;
@ApiModelProperty
(
"用户名称"
)
@Column
(
name
=
"user_name"
)
private
String
userName
;
@ApiModelProperty
(
"变更后所在公司ID"
)
@Column
(
name
=
"new_company_id"
)
private
Integer
newCompanyId
;
@ApiModelProperty
(
"变更前所在公司ID"
)
@Column
(
name
=
"old_company_id"
)
private
Integer
oldCompanyId
;
@ApiModelProperty
(
"变更后所在公司名称"
)
@Column
(
name
=
"new_company_name"
)
private
String
newCompanyName
;
@ApiModelProperty
(
"变更前所在公司名称"
)
@Column
(
name
=
"old_company_name"
)
private
String
oldCompanyName
;
@ApiModelProperty
(
"旧职位ID"
)
@Column
(
name
=
"old_job_id"
)
private
Integer
oldJobId
;
@ApiModelProperty
(
"新职位ID"
)
@Column
(
name
=
"new_job_id"
)
private
Integer
newJobId
;
@ApiModelProperty
(
"操作人名称"
)
@Column
(
name
=
"operator_id"
)
private
Integer
operatorId
;
@ApiModelProperty
(
"操作时间"
)
@Column
(
name
=
"crt_time"
)
private
Timestamp
crtTime
;
@ApiModelProperty
(
"员工职位、所属公司、离职、入职等的实际上任时间"
)
@Column
(
name
=
"rel_time"
)
private
Timestamp
relTime
;
@ApiModelProperty
(
"新身份ID"
)
@Column
(
name
=
"new_position_id"
)
private
Integer
newPositionId
;
@ApiModelProperty
(
"旧身份ID"
)
@Column
(
name
=
"old_position_id"
)
private
Integer
oldPositionId
;
@ApiModelProperty
(
"1:入职;2:职位变更;3:身份变更 4:公司所属变更;5离职"
)
@Column
(
name
=
"job_remark"
)
private
Integer
jobRemark
;
@ApiModelProperty
(
"新身份名称"
)
@Column
(
name
=
"new_position_name"
)
private
String
newPositionName
;
@ApiModelProperty
(
"旧身份名称"
)
@Column
(
name
=
"old_position_name"
)
private
String
oldPositionName
;
@ApiModelProperty
(
"新职位名称"
)
@Column
(
name
=
"new_job_name"
)
private
String
newJobName
;
@ApiModelProperty
(
"旧职位名称"
)
@Column
(
name
=
"old_job_name"
)
private
String
oldJobName
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppUserPositionTemp.java
View file @
d1b957b6
...
...
@@ -75,5 +75,9 @@ public class AppUserPositionTemp implements Serializable {
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
private
Integer
isDel
;
@Column
(
name
=
"is_quit"
)
@ApiModelProperty
(
value
=
"员工职位状态:0-正常;1-离职"
)
private
Integer
isQuit
;
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
View file @
d1b957b6
...
...
@@ -95,13 +95,13 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
AppUserDetail
entity
=
new
AppUserDetail
();
Example
example
=
new
Example
(
AppUserDetail
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"userid"
,
userVo
.
getUserid
());
criteria
.
andEqualTo
(
"userid"
,
userVo
.
getUserid
());
try
{
BeanUtils
.
copyProperties
(
entity
,
userVo
);
if
(
entity
!=
null
)
{
entity
.
setUpdHost
(
AppPermissionService
.
getIp
());
entity
.
setUpdatetime
(
Instant
.
now
().
toEpochMilli
()
/
1000L
);
mapper
.
updateByExampleSelective
(
entity
,
example
);
mapper
.
updateByExampleSelective
(
entity
,
example
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -134,7 +134,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
@CacheClear
(
pre
=
"user{1}"
)
public
void
updateUserPositionByUserId
(
Integer
userId
,
Integer
positionId
)
{
mapper
.
updateUserPositionByUserId
(
userId
,
positionId
);
mapper
.
updateUserPositionByUserId
(
userId
,
positionId
);
}
public
AppUserInfoVo
findUserInfoByCode
(
String
code
)
{
...
...
@@ -144,31 +144,31 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
appUserDetail
.
setCode
(
code
);
AppUserDetail
userDetail
=
mapper
.
selectOne
(
appUserDetail
);
if
(
userDetail
==
null
)
{
if
(
userDetail
==
null
)
{
return
appUserInfoVo
;
}
appUserInfoVo
.
setHeadimgurl
(
userDetail
.
getHeadimgurl
());
appUserInfoVo
.
setHeadimgurl
(
userDetail
.
getHeadimgurl
());
appUserInfoVo
.
setNickname
(
userDetail
.
getNickname
());
return
appUserInfoVo
;
return
appUserInfoVo
;
}
public
List
<
Integer
>
getUserIdByUsername
(
String
keywords
)
{
return
mapper
.
getUserIdByUsername
(
keywords
);
}
public
void
updateByUserId
(
AccountBindDTO
accountBindDTO
,
Integer
userId
)
{
public
void
updateByUserId
(
AccountBindDTO
accountBindDTO
,
Integer
userId
)
{
AppUserDetail
appUserDetail
=
new
AppUserDetail
();
if
(
accountBindDTO
.
getType
().
equals
(
"wx"
)){
if
(
accountBindDTO
.
getType
().
equals
(
"wx"
))
{
appUserDetail
.
setWxNickname
(
accountBindDTO
.
getNickName
());
}
if
(
accountBindDTO
.
getType
().
equals
(
"q"
))
{
if
(
accountBindDTO
.
getType
().
equals
(
"q"
))
{
appUserDetail
.
setQqNickname
(
accountBindDTO
.
getNickName
());
}
Example
example
=
new
Example
(
AppUserDetail
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"userid"
,
userId
);
mapper
.
updateByExampleSelective
(
appUserDetail
,
example
);
criteria
.
andEqualTo
(
"userid"
,
userId
);
mapper
.
updateByExampleSelective
(
appUserDetail
,
example
);
}
public
List
<
AppUserVo
>
getUserByUserIds
(
List
<
Integer
>
ids
)
{
...
...
@@ -177,21 +177,21 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
public
List
<
UserStaffBo
>
findAllStaffs
()
{
List
<
UserStaffBo
>
userStaffBos
=
mapper
.
selectAllStaffs
();
return
CollectionUtils
.
isEmpty
(
userStaffBos
)
?
Collections
.
EMPTY_LIST
:
userStaffBos
;
return
CollectionUtils
.
isEmpty
(
userStaffBos
)
?
Collections
.
EMPTY_LIST
:
userStaffBos
;
}
public
List
<
AppUserVo
>
getUserByUserIdList
(
List
<
Integer
>
userIds
)
{
List
<
AppUserVo
>
appUserVos
=
mapper
.
getUserByUserIdList
(
userIds
);
return
CollectionUtils
.
isEmpty
(
appUserVos
)
?
Collections
.
EMPTY_LIST
:
appUserVos
;
List
<
AppUserVo
>
appUserVos
=
mapper
.
getUserByUserIdList
(
userIds
);
return
CollectionUtils
.
isEmpty
(
appUserVos
)
?
Collections
.
EMPTY_LIST
:
appUserVos
;
}
public
PageDataVO
<
UserStaffBo
>
findAllStaffsByCompanyIdAndPostionIdWithPage
(
StaffStatisticsFindDTO
staffStatisticsFindDTO
)
{
return
PageDataVO
.
pageInfo
(
staffStatisticsFindDTO
.
getPage
(),
staffStatisticsFindDTO
.
getLimit
(),()->
mapper
.
findAllStaffsByCompanyIdAndPostionId
(
staffStatisticsFindDTO
));
return
PageDataVO
.
pageInfo
(
staffStatisticsFindDTO
.
getPage
(),
staffStatisticsFindDTO
.
getLimit
(),
()
->
mapper
.
findAllStaffsByCompanyIdAndPostionId
(
staffStatisticsFindDTO
));
}
public
List
<
UserStaffBo
>
findStaffsByIdsAndCompanyAndPostion
(
StaffStatisticsFindDTO
staffStatisticsFindDTO
)
{
List
<
UserStaffBo
>
staffBos
=
mapper
.
findAllStaffsByCompanyIdAndPostionId
(
staffStatisticsFindDTO
);
return
CollectionUtils
.
isEmpty
(
staffBos
)
?
Collections
.
EMPTY_LIST
:
staffBos
;
return
CollectionUtils
.
isEmpty
(
staffBos
)
?
Collections
.
EMPTY_LIST
:
staffBos
;
}
public
AppUserVo
findByCode
(
String
code
)
{
...
...
@@ -199,7 +199,7 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
AppUserDetail
appUserDetail
=
new
AppUserDetail
();
appUserDetail
.
setCode
(
code
);
appUserDetail
=
mapper
.
selectOne
(
appUserDetail
);
org
.
springframework
.
beans
.
BeanUtils
.
copyProperties
(
appUserDetail
,
appUserVo
);
org
.
springframework
.
beans
.
BeanUtils
.
copyProperties
(
appUserDetail
,
appUserVo
);
return
appUserVo
;
}
...
...
@@ -207,4 +207,19 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
return
mapper
.
getUser
(
userId
);
}
/**
* 判断员工是否是APP用户
*
* @return
*/
public
AppUserDetail
checkeIsAppUser
(
Integer
userid
)
{
Example
example
=
new
Example
(
AppUserDetail
.
class
);
example
.
createCriteria
().
andEqualTo
(
"userid"
,
userid
);
List
<
AppUserDetail
>
appUserDetailList
=
mapper
.
selectByExample
(
example
);
if
(
appUserDetailList
!=
null
&&
appUserDetailList
.
size
()
!=
0
)
{
return
appUserDetailList
.
get
(
0
);
}
return
null
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
View file @
d1b957b6
...
...
@@ -66,6 +66,10 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
@Autowired
private
AppUserSellingWaterBiz
appUserSellingWaterBiz
;
@Autowired
private
AppUserPositionTempBiz
appUserPositionTempBiz
;
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Override
public
void
insertSelective
(
AppUserLogin
entity
)
{
...
...
@@ -333,8 +337,8 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
}
public
List
<
AppUserLogin
>
getUserByUsernameAndRealName
(
String
username
,
String
realName
)
{
return
mapper
.
getUserByUsernameAndRealName
(
username
,
realName
);
return
mapper
.
getUserByUsernameAndRealName
(
username
,
realName
);
}
...
...
@@ -410,7 +414,7 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
public
List
<
Integer
>
findAppuser
(
String
phone
,
String
leaderPhone
,
String
name
)
{
List
<
Integer
>
memberIds
=
null
;
//1.根据leader手机号查询userid
boolean
isNoNullLeaderPhone
=
StringUtils
.
isNotEmpty
(
leaderPhone
)
&&
leaderPhone
.
trim
().
length
()>
0
;
boolean
isNoNullLeaderPhone
=
StringUtils
.
isNotEmpty
(
leaderPhone
)
&&
leaderPhone
.
trim
().
length
()
>
0
;
if
(
isNoNullLeaderPhone
)
{
List
<
AppUserLogin
>
appUserLogins
=
mapper
.
selectbyPhones
(
Arrays
.
asList
(
leaderPhone
));
Integer
leaderId
=
null
;
...
...
@@ -418,34 +422,34 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
return
Collections
.
EMPTY_LIST
;
}
leaderId
=
appUserLogins
.
get
(
0
).
getId
();
//2.根据leader userId查询下级 userid
if
(
Objects
.
nonNull
(
leaderId
))
{
memberIds
=
appUserSellingWaterBiz
.
findMemberIdByLeaderIdAndOrdreType
(
leaderId
,
3
);
if
(
CollectionUtils
.
isEmpty
(
memberIds
)){
return
Collections
.
EMPTY_LIST
;
//2.根据leader userId查询下级 userid
if
(
Objects
.
nonNull
(
leaderId
))
{
memberIds
=
appUserSellingWaterBiz
.
findMemberIdByLeaderIdAndOrdreType
(
leaderId
,
3
);
if
(
CollectionUtils
.
isEmpty
(
memberIds
))
{
return
Collections
.
EMPTY_LIST
;
}
}
}
}
List
<
Integer
>
userIds
=
mapper
.
findAppUser
(
phone
,
name
,
memberIds
);
return
userIds
==
null
?
Collections
.
EMPTY_LIST
:
userIds
;
return
userIds
==
null
?
Collections
.
EMPTY_LIST
:
userIds
;
}
public
List
<
UserBo
>
findUserDetailInfo
(
List
<
UserBo
>
userBos
)
{
Map
<
String
,
Integer
>
userIdAndFacilitateIdMap
=
userBos
.
stream
().
filter
(
x
->
Objects
.
nonNull
(
x
.
getFacilitateId
())).
collect
(
Collectors
.
toMap
(
UserBo:
:
getOrderNo
,
UserBo:
:
getFacilitateId
));
Map
<
String
,
Integer
>
userIdAndFacilitateIdMap
=
userBos
.
stream
().
filter
(
x
->
Objects
.
nonNull
(
x
.
getFacilitateId
())).
collect
(
Collectors
.
toMap
(
UserBo:
:
getOrderNo
,
UserBo:
:
getFacilitateId
));
List
<
Integer
>
userIdList
=
userBos
.
stream
().
map
(
UserBo:
:
getUserId
).
distinct
().
collect
(
Collectors
.
toList
());
//查询上级人
List
<
AppUserRelation
>
appUserRelationList
=
appUserRelationBiz
.
findLeaderByUserIds
(
userIdList
);
Map
<
Integer
,
Integer
>
memberIdAndParentMap
=
appUserRelationList
.
stream
().
collect
(
Collectors
.
toMap
(
AppUserRelation:
:
getUserId
,
AppUserRelation:
:
getParentId
));
List
<
Integer
>
uids
=
new
ArrayList
<>();
uids
.
addAll
(
userIdAndFacilitateIdMap
==
null
?
Collections
.
EMPTY_LIST
:
userIdList
);
uids
.
addAll
(
userIdAndFacilitateIdMap
==
null
?
Collections
.
EMPTY_LIST
:
userIdAndFacilitateIdMap
.
values
());
uids
.
addAll
(
memberIdAndParentMap
==
null
?
Collections
.
EMPTY_LIST
:
memberIdAndParentMap
.
values
());
List
<
Integer
>
uids
=
new
ArrayList
<>();
uids
.
addAll
(
userIdAndFacilitateIdMap
==
null
?
Collections
.
EMPTY_LIST
:
userIdList
);
uids
.
addAll
(
userIdAndFacilitateIdMap
==
null
?
Collections
.
EMPTY_LIST
:
userIdAndFacilitateIdMap
.
values
());
uids
.
addAll
(
memberIdAndParentMap
==
null
?
Collections
.
EMPTY_LIST
:
memberIdAndParentMap
.
values
());
List
<
UserBo
>
userBoList
=
mapper
.
selectByUserIds
(
uids
);
Map
<
Integer
,
UserBo
>
userMap
=
userBoList
==
null
?
Collections
.
EMPTY_MAP
:
userBoList
.
stream
().
collect
(
Collectors
.
toMap
(
UserBo:
:
getUserId
,
Function
.
identity
()));
if
(
userMap
.
isEmpty
()){
Map
<
Integer
,
UserBo
>
userMap
=
userBoList
==
null
?
Collections
.
EMPTY_MAP
:
userBoList
.
stream
().
collect
(
Collectors
.
toMap
(
UserBo:
:
getUserId
,
Function
.
identity
()));
if
(
userMap
.
isEmpty
())
{
return
Collections
.
EMPTY_LIST
;
}
...
...
@@ -468,4 +472,21 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
}
return
userBos
;
}
@CacheClear
(
pre
=
"user{1}"
)
public
void
updateUserPosition
(
Integer
userId
,
Integer
positionId
,
Integer
operatorId
)
{
AppUserLogin
appUserLogin
=
selectById
(
userId
);
if
(
appUserLogin
!=
null
)
{
String
phone
=
appUserLogin
.
getUsername
();
appUserPositionTempBiz
.
findUserPositionTemp
(
userId
,
positionId
,
operatorId
);
}
appUserDetailBiz
.
updateUserPositionByUserId
(
userId
,
positionId
);
}
@CacheClear
(
pre
=
"user{1}"
)
public
void
updateUserPosition
(
Integer
userId
,
Integer
positionId
)
{
appUserDetailBiz
.
updateUserPositionByUserId
(
userId
,
positionId
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserPositionChangeRecordBiz.java
0 → 100644
View file @
d1b957b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.alibaba.druid.sql.visitor.functions.If
;
import
com.github.wxiaoqi.security.admin.dto.AppUserPositionChangeRecordDTO
;
import
com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO
;
import
com.github.wxiaoqi.security.admin.entity.AppUserPosition
;
import
com.github.wxiaoqi.security.admin.entity.AppUserPositionChangeRecord
;
import
com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp
;
import
com.github.wxiaoqi.security.admin.mapper.AppUserPositionChangeRecordMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
lombok.NonNull
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jsoup.select.Evaluator
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Transactional
@Service
(
"appUserPositionChangeRecordBiz"
)
public
class
AppUserPositionChangeRecordBiz
extends
BaseBiz
<
AppUserPositionChangeRecordMapper
,
AppUserPositionChangeRecord
>
{
@Autowired
private
AppUserPositionBiz
appUserPositionBiz
;
@Autowired
private
AppUserJobLevelBiz
appUserJobLevelBiz
;
public
static
final
int
USER_ADD_COMPANY
=
1
;
public
static
final
int
JOB_CHANGE
=
2
;
public
static
final
int
POSITION_CHANGE
=
3
;
public
static
final
int
COMPANY_CHANGE
=
4
;
public
static
final
int
USER_LEAVE_COMPANT
=
5
;
public
static
final
int
USER_AND_ADD_COMPANY
=
6
;
/**
* 变更记录表插入
*
* @param userPositionTemp
*/
public
void
addPositionChangeRecord
(
AppUserPositionTemp
userPositionTemp
,
AppUserPositionTemp
oldData
,
Integer
operatorId
,
Timestamp
relTime
)
{
AppUserPositionChangeRecord
appUserPositionChangeRecord
=
new
AppUserPositionChangeRecord
();
if
(!(
userPositionTemp
.
getIsQuit
().
equals
(
oldData
.
getIsQuit
())))
{
appUserPositionChangeRecord
.
setJobRemark
(
USER_LEAVE_COMPANT
);
}
//状态1:职位变动
if
(!(
userPositionTemp
.
getJobId
().
equals
(
oldData
.
getJobId
())))
{
appUserPositionChangeRecord
.
setOldJobId
(
oldData
.
getJobId
());
appUserPositionChangeRecord
.
setNewJobId
(
userPositionTemp
.
getJobId
());
appUserPositionChangeRecord
.
setJobRemark
(
JOB_CHANGE
);
findUserJobName
(
appUserPositionChangeRecord
);
}
//状态2:身份变动
if
(!(
userPositionTemp
.
getPositionId
().
equals
(
oldData
.
getPositionId
())))
{
appUserPositionChangeRecord
.
setOldPositionId
(
oldData
.
getPositionId
());
appUserPositionChangeRecord
.
setNewPositionId
(
userPositionTemp
.
getPositionId
());
appUserPositionChangeRecord
.
setJobRemark
(
POSITION_CHANGE
);
findUserPositionName
(
appUserPositionChangeRecord
);
}
//状态3:公司变动调整
if
(!(
userPositionTemp
.
getCompanyId
().
equals
(
oldData
.
getCompanyId
())))
{
appUserPositionChangeRecord
.
setOldCompanyId
(
oldData
.
getCompanyId
());
appUserPositionChangeRecord
.
setOldCompanyName
(
oldData
.
getCompanyName
());
appUserPositionChangeRecord
.
setNewCompanyId
(
userPositionTemp
.
getCompanyId
());
appUserPositionChangeRecord
.
setNewCompanyName
(
userPositionTemp
.
getCompanyName
());
appUserPositionChangeRecord
.
setJobRemark
(
COMPANY_CHANGE
);
}
appUserPositionChangeRecord
.
setPhone
(
userPositionTemp
.
getPhone
());
appUserPositionChangeRecord
.
setRelTime
(
relTime
);
appUserPositionChangeRecord
.
setUserName
(
userPositionTemp
.
getName
());
appUserPositionChangeRecord
.
setCrtTime
(
new
Timestamp
(
System
.
currentTimeMillis
()));
appUserPositionChangeRecord
.
setOperatorId
(
operatorId
);
mapper
.
insert
(
appUserPositionChangeRecord
);
}
/**
* 入职时插入记录表
*
* @param userPositionTemp
* @param updUserId
*/
public
void
addJoinJobRecord
(
AppUserPositionTempDTO
userPositionTemp
,
Integer
updUserId
)
{
AppUserPositionChangeRecord
appUserPositionChangeRecord
=
new
AppUserPositionChangeRecord
();
appUserPositionChangeRecord
.
setPhone
(
userPositionTemp
.
getPhone
());
appUserPositionChangeRecord
.
setUserName
(
userPositionTemp
.
getName
());
appUserPositionChangeRecord
.
setRelTime
(
userPositionTemp
.
getRelTime
());
appUserPositionChangeRecord
.
setCrtTime
(
new
Timestamp
(
System
.
currentTimeMillis
()));
appUserPositionChangeRecord
.
setJobRemark
(
USER_ADD_COMPANY
);
appUserPositionChangeRecord
.
setOperatorId
(
updUserId
);
mapper
.
insert
(
appUserPositionChangeRecord
);
}
/**
* 员工复职
*
* @param userPositionTemp
* @param updUserId
*/
public
void
andAddJoinJobRecord
(
AppUserPositionTempDTO
userPositionTemp
,
Integer
updUserId
)
{
AppUserPositionChangeRecord
appUserPositionChangeRecord
=
new
AppUserPositionChangeRecord
();
appUserPositionChangeRecord
.
setPhone
(
userPositionTemp
.
getPhone
());
if
(
userPositionTemp
.
getPositionId
()
!=
null
)
{
appUserPositionChangeRecord
.
setNewPositionId
(
userPositionTemp
.
getPositionId
());
}
appUserPositionChangeRecord
.
setUserName
(
userPositionTemp
.
getName
());
appUserPositionChangeRecord
.
setRelTime
(
userPositionTemp
.
getRelTime
());
appUserPositionChangeRecord
.
setCrtTime
(
new
Timestamp
(
System
.
currentTimeMillis
()));
appUserPositionChangeRecord
.
setJobRemark
(
USER_AND_ADD_COMPANY
);
appUserPositionChangeRecord
.
setOperatorId
(
updUserId
);
mapper
.
insert
(
appUserPositionChangeRecord
);
}
/**
* APP用户修改身份
*
* @param userPositionTemp
* @param updUserId
*/
public
void
andAddJoinJobRecord
(
AppUserPositionTemp
userPositionTemp
,
Integer
updUserId
)
{
AppUserPositionChangeRecord
appUserPositionChangeRecord
=
new
AppUserPositionChangeRecord
();
appUserPositionChangeRecord
.
setPhone
(
userPositionTemp
.
getPhone
());
if
(
userPositionTemp
.
getPositionId
()
!=
null
)
{
appUserPositionChangeRecord
.
setNewPositionId
(
userPositionTemp
.
getPositionId
());
}
appUserPositionChangeRecord
.
setUserName
(
userPositionTemp
.
getName
());
appUserPositionChangeRecord
.
setCrtTime
(
new
Timestamp
(
System
.
currentTimeMillis
()));
appUserPositionChangeRecord
.
setJobRemark
(
USER_AND_ADD_COMPANY
);
appUserPositionChangeRecord
.
setOperatorId
(
updUserId
);
mapper
.
insert
(
appUserPositionChangeRecord
);
}
/**
* 查询新旧职位名称
* zyh
*
* @param appUserPositionChangeRecord
* @return
*/
public
AppUserPositionChangeRecord
findUserJobName
(
AppUserPositionChangeRecord
appUserPositionChangeRecord
)
{
appUserPositionChangeRecord
.
setNewJobName
(
appUserJobLevelBiz
.
selectById
(
appUserPositionChangeRecord
.
getNewJobId
()).
getName
());
appUserPositionChangeRecord
.
setOldJobName
(
appUserJobLevelBiz
.
selectById
(
appUserPositionChangeRecord
.
getOldJobId
()).
getName
());
return
appUserPositionChangeRecord
;
}
/**
* 查询新旧身份名称
* zyh
*
* @param appUserPositionChangeRecord
* @return
*/
public
AppUserPositionChangeRecord
findUserPositionName
(
AppUserPositionChangeRecord
appUserPositionChangeRecord
)
{
appUserPositionChangeRecord
.
setOldPositionName
(
appUserPositionBiz
.
selectById
(
appUserPositionChangeRecord
.
getOldPositionId
()).
getName
());
appUserPositionChangeRecord
.
setNewPositionName
(
appUserPositionBiz
.
selectById
(
appUserPositionChangeRecord
.
getNewPositionId
()).
getName
());
return
appUserPositionChangeRecord
;
}
/**
* 查询员工信息变更记录表
*/
public
List
<
AppUserPositionChangeRecordDTO
>
findPositionChangeRecord
(
AppUserPositionTemp
userPositionTemp
)
{
Example
example
=
new
Example
(
AppUserPositionChangeRecord
.
class
);
example
.
createCriteria
().
andEqualTo
(
"phone"
,
userPositionTemp
.
getPhone
());
List
<
AppUserPositionChangeRecord
>
list
=
selectByExample
(
example
);
List
<
AppUserPositionChangeRecordDTO
>
listAppUserPositionChangeRecordDTO
=
new
ArrayList
<>();
list
.
stream
().
forEach
(
x
->
{
AppUserPositionChangeRecordDTO
appUserPositionChangeRecordDTO
=
new
AppUserPositionChangeRecordDTO
();
BeanUtils
.
copyProperties
(
x
,
appUserPositionChangeRecordDTO
);
listAppUserPositionChangeRecordDTO
.
add
(
appUserPositionChangeRecordDTO
);
});
return
listAppUserPositionChangeRecordDTO
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserPositionTempBiz.java
View file @
d1b957b6
This diff is collapsed.
Click to expand it.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserPositionChangeRecordMapper.java
0 → 100644
View file @
d1b957b6
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.entity.AppUserPositionChangeRecord
;
import
tk.mybatis.mapper.common.Mapper
;
public
interface
AppUserPositionChangeRecordMapper
extends
Mapper
<
AppUserPositionChangeRecord
>
{
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUsersManageController.java
View file @
d1b957b6
...
...
@@ -12,19 +12,24 @@ import com.github.wxiaoqi.security.admin.entity.User;
import
com.github.wxiaoqi.security.admin.vo.AppUserManageVo
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Set
;
/**
* app用户管理类
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping
(
"appUsersManage"
)
public
class
AppUsersManageController
extends
BaseController
<
AppUserManageBiz
,
AppUserManage
>
{
...
...
@@ -44,6 +49,10 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired
private
VehicleFeign
vehicleFeign
;
@Autowired
private
UserAuthUtil
userAuthUtil
;
private
Integer
ALL_PERMISSIONS
=
1
;
/**
* 查询所有
...
...
@@ -137,9 +146,17 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
}
@PutMapping
(
"/user_position"
)
public
ObjectRestResponse
<
Void
>
setUserPositionById
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"positionId"
)
Integer
positionId
){
appUserDetailBiz
.
updateUserPositionByUserId
(
id
,
positionId
);
return
ObjectRestResponse
.
succ
();
public
ObjectRestResponse
<
Void
>
setUserPositionById
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"positionId"
)
Integer
positionId
,
HttpServletRequest
request
)
{
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
Integer
operatorId
=
Integer
.
valueOf
(
infoFromToken
.
getId
());
appUserLoginBiz
.
updateUserPosition
(
id
,
positionId
,
operatorId
);
return
ObjectRestResponse
.
succ
();
}
catch
(
Exception
e
)
{
log
.
error
(
"修改失败【{}】"
,
e
);
throw
new
BaseException
(
"修改失败"
);
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/admin/AppUserPositionController.java
View file @
d1b957b6
...
...
@@ -6,15 +6,22 @@ import com.github.wxiaoqi.security.admin.biz.AppUserPositionTempBiz;
import
com.github.wxiaoqi.security.admin.dto.AppUserPositionTempDTO
;
import
com.github.wxiaoqi.security.admin.dto.AppUserPositionTempFindDTO
;
import
com.github.wxiaoqi.security.admin.dto.UserPostionDTO
;
import
com.github.wxiaoqi.security.admin.entity.AppUserPositionTemp
;
import
com.github.wxiaoqi.security.admin.vo.AppUserPositionTempVo
;
import
com.github.wxiaoqi.security.admin.vo.WalletPostionVo
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.excel.ExcelImport
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -24,6 +31,7 @@ import java.util.Map;
* @description
* @data 2019/7/17 16:13
*/
@Slf4j
@RestController
@RequestMapping
(
"/postion/admin"
)
public
class
AppUserPositionController
{
...
...
@@ -37,6 +45,13 @@ public class AppUserPositionController {
@Autowired
private
AppUserPositionTempBiz
appUserPositionTempBiz
;
@Autowired
private
UserAuthUtil
userAuthUtil
;
@Autowired
private
UserAuthConfig
userAuthConfig
;
@GetMapping
(
"/jobs"
)
public
ObjectRestResponse
findAllJobs
()
{
return
ObjectRestResponse
.
succ
(
jobLevelBiz
.
selectListAll
());
...
...
@@ -57,21 +72,78 @@ public class AppUserPositionController {
/**
* 新增或编辑身份信息
*
* @return
*/
@PostMapping
(
"/addUserPostion"
)
public
ObjectRestResponse
<
Void
>
addUserPostion
(
@RequestBody
AppUserPositionTempDTO
appUserPositionTempDTO
){
return
appUserPositionTempBiz
.
add
(
appUserPositionTempDTO
);
public
ObjectRestResponse
<
Void
>
addUserPostion
(
@RequestBody
AppUserPositionTempDTO
appUserPositionTempDTO
,
HttpServletRequest
request
)
{
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
Integer
s
=
Integer
.
valueOf
(
infoFromToken
.
getId
());
return
appUserPositionTempBiz
.
add
(
appUserPositionTempDTO
,
Integer
.
valueOf
(
infoFromToken
.
getId
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"新增失败【{}】"
,
e
);
throw
new
BaseException
(
"新增失败"
);
}
}
/**
* 新增或编辑身份信息
*
* @return
*/
@PostMapping
(
"/updUserPostion"
)
public
ObjectRestResponse
<
Void
>
updUserPostion
(
@RequestBody
AppUserPositionTempDTO
appUserPositionTempDTO
){
public
ObjectRestResponse
<
Void
>
updUserPostion
(
@RequestBody
AppUserPositionTempDTO
appUserPositionTempDTO
,
HttpServletRequest
request
)
{
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
return
appUserPositionTempBiz
.
add
(
appUserPositionTempDTO
,
Integer
.
valueOf
(
infoFromToken
.
getId
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"修改失败【{}】"
,
e
);
throw
new
BaseException
(
"修改失败"
);
}
}
/**
* 员工信息更改,并插入变更记录表
* zuoyh
*
* @return
*/
@PostMapping
(
"/updUserChange"
)
public
ObjectRestResponse
<
Void
>
updUserChange
(
@RequestBody
AppUserPositionTempDTO
appUserPositionTempDTO
,
HttpServletRequest
request
)
{
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
Integer
operatorId
=
Integer
.
valueOf
(
infoFromToken
.
getId
());
return
ObjectRestResponse
.
succ
(
appUserPositionTempBiz
.
addUserPositionChangeRecord
(
appUserPositionTempDTO
.
getChangeStatus
(),
appUserPositionTempDTO
,
operatorId
))
;
}
catch
(
Exception
e
)
{
log
.
error
(
"修改失败【{}】"
,
e
);
throw
new
BaseException
(
"修改失败"
);
}
}
return
appUserPositionTempBiz
.
add
(
appUserPositionTempDTO
);
/**
* 查询员工信息变更记录表
*/
@GetMapping
(
"/findPositionChangeRecord"
)
public
ObjectRestResponse
findPositionChangeRecord
(
AppUserPositionTemp
appUserPositionTemp
)
{
return
ObjectRestResponse
.
succ
(
appUserPositionTempBiz
.
findPositionChangeRecord
(
appUserPositionTemp
));
}
/**
* 员工复职位
*/
@PostMapping
(
"/updAddPositionChangeRecord"
)
public
ObjectRestResponse
updAddPositionChangeRecord
(
@RequestBody
AppUserPositionTempDTO
appUserPositionTempDTO
,
HttpServletRequest
request
)
{
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
Integer
operatorId
=
Integer
.
valueOf
(
infoFromToken
.
getId
());
appUserPositionTempBiz
.
andAddUserPositionChangeRecord
(
appUserPositionTempDTO
,
operatorId
);
return
ObjectRestResponse
.
succ
();
}
catch
(
Exception
e
)
{
log
.
error
(
"修改失败【{}】"
,
e
);
throw
new
BaseException
(
"修改失败"
);
}
}
/**
...
...
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