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
dd42110a
Commit
dd42110a
authored
Jan 15, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加删除本地多余的部门部门
parent
91a4f1bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
15 deletions
+39
-15
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
...mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
+37
-13
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
...-manager/src/test/java/com/mortals/httpclient/system.http
+2
-2
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
View file @
dd42110a
...
@@ -29,6 +29,7 @@ import org.springframework.util.ObjectUtils;
...
@@ -29,6 +29,7 @@ import org.springframework.util.ObjectUtils;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
/**
* DeptService
* DeptService
...
@@ -172,17 +173,19 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -172,17 +173,19 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
StaffQuery
query
=
new
StaffQuery
();
StaffQuery
query
=
new
StaffQuery
();
query
.
setStatusNotList
(
Arrays
.
asList
(
StaffSatusEnum
.
离职
.
getValue
()));
query
.
setStatusNotList
(
Arrays
.
asList
(
StaffSatusEnum
.
离职
.
getValue
()));
query
.
setDeptIdList
(
getChildrenId
(
m
,
list
));
query
.
setDeptIdList
(
getChildrenId
(
m
,
list
));
int
count
=
staffService
.
count
(
query
,
null
);
int
count
=
staffService
.
count
(
query
,
null
);
m
.
setPersonNum
(
count
);
m
.
setPersonNum
(
count
);
return
m
;
return
m
;
}
}
).
collect
(
Collectors
.
toList
());
).
collect
(
Collectors
.
toList
());
return
returnList
.
stream
().
map
(
DeptTreeSelect:
:
new
).
collect
(
Collectors
.
toList
());
return
returnList
.
stream
().
map
(
DeptTreeSelect:
:
new
).
collect
(
Collectors
.
toList
());
}
}
/**
/**
* 递归查询子节点
* 递归查询子节点
* @param root 根节点
*
* @param all 所有节点
* @param root 根节点
* @param all 所有节点
* @return 根节点信息
* @return 根节点信息
*/
*/
private
List
<
DeptEntity
>
getChildren
(
DeptEntity
root
,
List
<
DeptEntity
>
all
)
{
private
List
<
DeptEntity
>
getChildren
(
DeptEntity
root
,
List
<
DeptEntity
>
all
)
{
...
@@ -194,7 +197,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -194,7 +197,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
StaffQuery
query
=
new
StaffQuery
();
StaffQuery
query
=
new
StaffQuery
();
query
.
setDeptIdList
(
getChildrenId
(
m
,
all
));
query
.
setDeptIdList
(
getChildrenId
(
m
,
all
));
query
.
setStatusNotList
(
Arrays
.
asList
(
StaffSatusEnum
.
离职
.
getValue
()));
query
.
setStatusNotList
(
Arrays
.
asList
(
StaffSatusEnum
.
离职
.
getValue
()));
int
count
=
staffService
.
count
(
query
,
null
);
int
count
=
staffService
.
count
(
query
,
null
);
m
.
setPersonNum
(
count
);
m
.
setPersonNum
(
count
);
return
m
;
return
m
;
}
}
...
@@ -202,12 +205,12 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -202,12 +205,12 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
return
children
;
return
children
;
}
}
private
List
<
Long
>
getChildrenId
(
DeptEntity
root
,
List
<
DeptEntity
>
all
){
private
List
<
Long
>
getChildrenId
(
DeptEntity
root
,
List
<
DeptEntity
>
all
)
{
List
<
Long
>
idList
=
new
ArrayList
<>();
List
<
Long
>
idList
=
new
ArrayList
<>();
idList
.
add
(
root
.
getId
());
idList
.
add
(
root
.
getId
());
all
.
forEach
(
item
->{
all
.
forEach
(
item
->
{
if
(
Objects
.
equals
(
item
.
getParentId
(),
root
.
getId
()))
{
if
(
Objects
.
equals
(
item
.
getParentId
(),
root
.
getId
()))
{
idList
.
addAll
(
getChildrenId
(
item
,
all
));
idList
.
addAll
(
getChildrenId
(
item
,
all
));
}
}
});
});
return
idList
;
return
idList
;
...
@@ -266,8 +269,8 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -266,8 +269,8 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
parentDept
.
setPersonNum
(
sum
);
parentDept
.
setPersonNum
(
sum
);
this
.
update
(
parentDept
);
this
.
update
(
parentDept
);
}
}
}
else
{
}
else
{
log
.
info
(
"deptEntity is null.deptId:{}"
,
item
.
getKey
());
log
.
info
(
"deptEntity is null.deptId:{}"
,
item
.
getKey
());
}
}
}
}
...
@@ -287,14 +290,14 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -287,14 +290,14 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
@Override
@Override
public
List
<
DeptEntity
>
getDeptBySalaId
(
Long
salaId
)
throws
AppException
{
public
List
<
DeptEntity
>
getDeptBySalaId
(
Long
salaId
)
throws
AppException
{
DeptQuery
query
=
new
DeptQuery
();
DeptQuery
query
=
new
DeptQuery
();
if
(
salaId
==
null
||
salaId
==
-
1
l
)
{
if
(
salaId
==
null
||
salaId
==
-
1
l
)
{
List
<
DeptEntity
>
allSala
=
dao
.
getList
(
new
DeptQuery
().
parentId
(
71
l
));
List
<
DeptEntity
>
allSala
=
dao
.
getList
(
new
DeptQuery
().
parentId
(
71
l
));
List
<
Long
>
salaList
=
new
ArrayList
<>();
List
<
Long
>
salaList
=
new
ArrayList
<>();
for
(
DeptEntity
item:
allSala
)
{
for
(
DeptEntity
item
:
allSala
)
{
salaList
.
add
(
item
.
getId
());
salaList
.
add
(
item
.
getId
());
}
}
query
.
setParentIdList
(
salaList
);
query
.
setParentIdList
(
salaList
);
}
else
{
}
else
{
query
.
setParentId
(
salaId
);
query
.
setParentId
(
salaId
);
}
}
return
dao
.
getList
(
query
);
return
dao
.
getList
(
query
);
...
@@ -338,6 +341,27 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
...
@@ -338,6 +341,27 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
this
.
update
(
deptEntity
);
this
.
update
(
deptEntity
);
}
}
}
}
//差额删除部门
List
<
DeptEntity
>
localDeptList
=
this
.
find
(
new
DeptQuery
());
// Map<String, DeptEntity> localDeptMap = localDeptList.stream().collect(Collectors.toMap(x -> x.getDeptCode(), y -> y, (o, n) -> n));
//差额对
Map
<
String
,
OrgInfo
>
remoteDeptMap
=
orgInfoList
.
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getOrgIndexCode
(),
y
->
y
,
(
o
,
n
)
->
n
));
List
<
DeptEntity
>
deleteLocalDeptList
=
localDeptList
.
stream
().
map
(
item
->
{
String
deptCode
=
item
.
getDeptCode
();
OrgInfo
orgInfo
=
remoteDeptMap
.
get
(
deptCode
);
if
(
ObjectUtils
.
isEmpty
(
orgInfo
))
{
//需要删除的本地部门
return
item
;
}
else
{
return
null
;
}
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
deleteLocalDeptList
))
{
log
.
info
(
"delete dept lsit size :{}"
,
deleteLocalDeptList
.
size
());
}
}
}
return
Rest
.
ok
();
return
Rest
.
ok
();
...
...
attendance-performance-manager/src/test/java/com/mortals/httpclient/system.http
View file @
dd42110a
...
@@ -49,8 +49,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
...
@@ -49,8 +49,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
Content-Type: application/json
Content-Type: application/json
{
{
"attendanceDateStart": "202
4-10-19
",
"attendanceDateStart": "202
5-01-01
",
"attendanceDateEnd": "202
4-10-31
"
"attendanceDateEnd": "202
5-01-02
"
}
}
###海康考勤打卡记录计算1
###海康考勤打卡记录计算1
...
...
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