Commit e4af4d5e authored by 赵啸非's avatar 赵啸非

修改考勤汇总

parent 77f18581
...@@ -95,7 +95,7 @@ public class TestController { ...@@ -95,7 +95,7 @@ public class TestController {
DeptEntity deptEntity1 = new DeptEntity(); DeptEntity deptEntity1 = new DeptEntity();
deptEntity1.setPersonNum(0); deptEntity1.setPersonNum(0);
deptService.getDao().update(deptEntity1,new HashMap<>()); deptService.getDao().update(deptEntity1, new HashMap<>());
collect.entrySet().stream().forEach(item -> { collect.entrySet().stream().forEach(item -> {
Long deptId = item.getKey(); Long deptId = item.getKey();
...@@ -113,10 +113,10 @@ public class TestController { ...@@ -113,10 +113,10 @@ public class TestController {
for (Map.Entry<Long, Long> item : collect.entrySet()) { for (Map.Entry<Long, Long> item : collect.entrySet()) {
Long deptId = item.getKey(); Long deptId = item.getKey();
if (deptId == -1) continue;
DeptEntity deptEntity = deptService.get(deptId); DeptEntity deptEntity = deptService.get(deptId);
if (!ObjectUtils.isEmpty(deptEntity) && !ObjectUtils.isEmpty(deptEntity.getParentId())) { if (!ObjectUtils.isEmpty(deptEntity) && !ObjectUtils.isEmpty(deptEntity.getParentId())) {
int sum = deptService.find(new DeptQuery().parentId(deptEntity.getId())).stream().mapToInt(i -> i.getPersonNum()).sum(); int sum = deptService.find(new DeptQuery().parentId(deptEntity.getId())).stream().map(i -> i.getPersonNum()).reduce(0, Integer::sum);;
DeptEntity parentDept = deptService.get(deptEntity.getParentId()); DeptEntity parentDept = deptService.get(deptEntity.getParentId());
log.info("dept:{},sum:{}", parentDept.getDeptName(), sum); log.info("dept:{},sum:{}", parentDept.getDeptName(), sum);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment