Commit 7b4ded1d authored by 赵啸非's avatar 赵啸非

修改考勤汇总

parent 42bfbb35
...@@ -111,26 +111,19 @@ public class TestController { ...@@ -111,26 +111,19 @@ public class TestController {
DeptEntity deptEntity = deptService.get(deptId); DeptEntity deptEntity = deptService.get(deptId);
updateDeptPersonNum(deptEntity); updateDeptPersonNum(deptEntity);
}); });
return "ok"; return "ok";
} }
private void updateDeptPersonNum(DeptEntity deptEntity) { private void updateDeptPersonNum(DeptEntity deptEntity) {
if(ObjectUtils.isEmpty(deptEntity.getParentId())){ if(!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().mapToInt(i -> i.getPersonNum()).sum();
DeptEntity parentDept = deptService.get(deptEntity.getParentId()); DeptEntity parentDept = deptService.get(deptEntity.getParentId());
if(ObjectUtils.isEmpty(parentDept)){ if(ObjectUtils.isEmpty(parentDept)){
parentDept.setPersonNum(sum); parentDept.setPersonNum(sum);
deptService.update(parentDept); deptService.update(parentDept);
updateDeptPersonNum(parentDept); updateDeptPersonNum(parentDept);
} }
} }
} }
......
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