Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
07c454fe
Commit
07c454fe
authored
Jul 16, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户类型修改
parent
3cbf9bc6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
26 deletions
+25
-26
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/EnabledEnum.java
...rc/main/java/com/mortals/xhx/common/code/EnabledEnum.java
+10
-10
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
...mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
+15
-16
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/EnabledEnum.java
View file @
07c454fe
...
@@ -4,12 +4,12 @@ import java.util.LinkedHashMap;
...
@@ -4,12 +4,12 @@ import java.util.LinkedHashMap;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
* 启用状态 (0.停止,1.启用)枚举类
* 启用状态 (0.停止,1.启用)枚举类
*
*
* @author zxfei
* @author zxfei
*/
*/
public
enum
EnabledEnum
{
public
enum
EnabledEnum
{
停
止
(
0
,
"停止
"
),
停
用
(
0
,
"停用
"
),
启用
(
1
,
"启用"
);
启用
(
1
,
"启用"
);
private
Integer
value
;
private
Integer
value
;
private
String
desc
;
private
String
desc
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
View file @
07c454fe
package
com.mortals.xhx.module.dept.service.impl
;
package
com.mortals.xhx.module.dept.service.impl
;
import
com.mortals.xhx.common.code.EnableEnum
;
import
com.mortals.xhx.common.code.EnabledEnum
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
com.mortals.xhx.module.staff.service.StaffService
;
...
@@ -7,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -7,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.common.code.DeptStatusEnum
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.module.dept.dao.DeptDao
;
import
com.mortals.xhx.module.dept.dao.DeptDao
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
...
@@ -34,13 +35,13 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -34,13 +35,13 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
@Override
@Override
protected
void
saveBefore
(
DeptEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveBefore
(
DeptEntity
entity
,
Context
context
)
throws
AppException
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getParentId
()))
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getParentId
()))
{
//如果父节点为空,默认挂载到根目录
//如果父节点为空,默认挂载到根目录
entity
.
setParentId
(
0L
);
entity
.
setParentId
(
0L
);
}
}
DeptEntity
parentDeptEntity
=
this
.
get
(
entity
.
getParentId
());
DeptEntity
parentDeptEntity
=
this
.
get
(
entity
.
getParentId
());
if
(!
ObjectUtils
.
isEmpty
(
parentDeptEntity
)
&&
DeptStatus
Enum
.
停用
.
getValue
()
==
parentDeptEntity
.
getDeptStatus
())
{
if
(!
ObjectUtils
.
isEmpty
(
parentDeptEntity
)
&&
Enabled
Enum
.
停用
.
getValue
()
==
parentDeptEntity
.
getDeptStatus
())
{
throw
new
AppException
(
"部门信息停用,不允许新增"
);
throw
new
AppException
(
"部门信息停用,不允许新增"
);
}
}
...
@@ -56,7 +57,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -56,7 +57,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
DeptEntity
newParentEntity
=
this
.
get
(
entity
.
getParentId
());
DeptEntity
newParentEntity
=
this
.
get
(
entity
.
getParentId
());
DeptEntity
oldEntity
=
this
.
get
(
entity
.
getId
());
DeptEntity
oldEntity
=
this
.
get
(
entity
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
newParentEntity
)
&&
!
ObjectUtils
.
isEmpty
(
oldEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
newParentEntity
)
&&
!
ObjectUtils
.
isEmpty
(
oldEntity
))
{
String
newAncestors
=
newParentEntity
.
getAncestors
()
+
","
+
entity
.
getId
();
String
newAncestors
=
newParentEntity
.
getAncestors
()
+
","
+
entity
.
getId
();
String
oldAncestors
=
oldEntity
.
getAncestors
();
String
oldAncestors
=
oldEntity
.
getAncestors
();
entity
.
setAncestors
(
newAncestors
);
entity
.
setAncestors
(
newAncestors
);
updateDeptChildren
(
entity
.
getId
(),
newAncestors
,
oldAncestors
,
context
);
updateDeptChildren
(
entity
.
getId
(),
newAncestors
,
oldAncestors
,
context
);
...
@@ -67,7 +68,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -67,7 +68,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
@Override
@Override
protected
void
updateAfter
(
DeptEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateAfter
(
DeptEntity
entity
,
Context
context
)
throws
AppException
{
if
(
DeptStatus
Enum
.
启用
.
getValue
()
==
entity
.
getDeptStatus
())
{
if
(
Enabled
Enum
.
启用
.
getValue
()
==
entity
.
getDeptStatus
())
{
updateParentDeptStatus
(
entity
,
context
);
updateParentDeptStatus
(
entity
,
context
);
}
}
super
.
updateAfter
(
entity
,
context
);
super
.
updateAfter
(
entity
,
context
);
...
@@ -80,10 +81,10 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -80,10 +81,10 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
*/
*/
private
void
updateParentDeptStatus
(
DeptEntity
dept
,
Context
context
)
{
private
void
updateParentDeptStatus
(
DeptEntity
dept
,
Context
context
)
{
DeptEntity
deptEntity
=
this
.
get
(
dept
.
getParentId
());
DeptEntity
deptEntity
=
this
.
get
(
dept
.
getParentId
());
if
(!
ObjectUtils
.
isEmpty
(
deptEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
deptEntity
))
{
deptEntity
.
setDeptStatus
(
DeptStatus
Enum
.
启用
.
getValue
());
deptEntity
.
setDeptStatus
(
Enabled
Enum
.
启用
.
getValue
());
deptEntity
.
setUpdateTime
(
new
Date
());
deptEntity
.
setUpdateTime
(
new
Date
());
deptEntity
.
setUpdateUser
(
context
==
null
?
"admin"
:
context
.
getUser
().
getLoginName
());
deptEntity
.
setUpdateUser
(
context
==
null
?
"admin"
:
context
.
getUser
().
getLoginName
());
DeptEntity
condition
=
new
DeptEntity
();
DeptEntity
condition
=
new
DeptEntity
();
condition
.
setId
(
deptEntity
.
getId
());
condition
.
setId
(
deptEntity
.
getId
());
this
.
updateBatch
(
deptEntity
,
condition
,
context
);
this
.
updateBatch
(
deptEntity
,
condition
,
context
);
...
@@ -138,12 +139,12 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -138,12 +139,12 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
for
(
Iterator
<
DeptEntity
>
iterator
=
list
.
iterator
();
iterator
.
hasNext
();
)
{
for
(
Iterator
<
DeptEntity
>
iterator
=
list
.
iterator
();
iterator
.
hasNext
();
)
{
DeptEntity
deptEntity
=
iterator
.
next
();
DeptEntity
deptEntity
=
iterator
.
next
();
List
<
StaffEntity
>
staffEntities
=
staffService
.
find
(
new
StaffQuery
().
deptId
(
deptEntity
.
getId
()));
List
<
StaffEntity
>
staffEntities
=
staffService
.
find
(
new
StaffQuery
().
deptId
(
deptEntity
.
getId
()));
List
<
Map
<
String
,
Object
>>
personList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
personList
=
new
ArrayList
<>();
staffEntities
.
forEach
(
item
->
{
staffEntities
.
forEach
(
item
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"staffId"
,
item
.
getId
());
map
.
put
(
"staffId"
,
item
.
getId
());
map
.
put
(
"staffName"
,
item
.
getName
());
map
.
put
(
"staffName"
,
item
.
getName
());
map
.
put
(
"deptId"
,
item
.
getDeptId
());
map
.
put
(
"deptId"
,
item
.
getDeptId
());
personList
.
add
(
map
);
personList
.
add
(
map
);
});
});
deptEntity
.
setPersonList
(
personList
);
deptEntity
.
setPersonList
(
personList
);
...
@@ -208,6 +209,4 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -208,6 +209,4 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
}
}
}
}
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