Commit 5cff1e01 authored by 赵啸非's avatar 赵啸非

修改用户等

parent a06bdfd0
...@@ -63,7 +63,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -63,7 +63,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
log.info("同步部门"); log.info("同步部门");
syncDepts(); syncDepts();
log.info("同步用户"); log.info("同步用户");
syncPersons();
staffService.syncPersons(null);
// syncPersons();
} catch (Exception e) { } catch (Exception e) {
log.error("同步人事异常", e); log.error("同步人事异常", e);
} }
......
...@@ -3,6 +3,7 @@ package com.mortals.xhx.module.dept.service.impl; ...@@ -3,6 +3,7 @@ package com.mortals.xhx.module.dept.service.impl;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.code.EnableEnum; import com.mortals.xhx.common.code.EnableEnum;
import com.mortals.xhx.common.code.EnabledEnum; import com.mortals.xhx.common.code.EnabledEnum;
import com.mortals.xhx.common.code.StaffSatusEnum;
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;
...@@ -139,7 +140,10 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -139,7 +140,10 @@ 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())); StaffQuery staffQuery = new StaffQuery();
staffQuery.setDeptId(deptEntity.getId());
staffQuery.setStatusNotList(Arrays.asList(StaffSatusEnum.离职.getValue()));
List<StaffEntity> staffEntities = staffService.find(staffQuery);
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<>();
...@@ -176,8 +180,9 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -176,8 +180,9 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
}).map( }).map(
m -> { m -> {
m.setChildren(getChildren(m, all)); m.setChildren(getChildren(m, all));
StaffEntity query = new StaffQuery(); StaffQuery query = new StaffQuery();
query.setDeptIdList(getChildrenId(m, all)); query.setDeptIdList(getChildrenId(m, all));
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;
......
...@@ -16,10 +16,8 @@ import com.mortals.xhx.base.system.role.service.RoleUserService; ...@@ -16,10 +16,8 @@ import com.mortals.xhx.base.system.role.service.RoleUserService;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.module.attendance.model.AttendanceStatEntity; import com.mortals.xhx.module.attendance.model.*;
import com.mortals.xhx.module.attendance.model.AttendanceStatQuery; import com.mortals.xhx.module.attendance.service.AttendanceGroupStaffService;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceQuery;
import com.mortals.xhx.module.attendance.service.AttendanceStatService; import com.mortals.xhx.module.attendance.service.AttendanceStatService;
import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService; import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
...@@ -81,6 +79,8 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -81,6 +79,8 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
private IdgeneratorService idgeneratorService; private IdgeneratorService idgeneratorService;
@Autowired @Autowired
private StaffLeaveService staffLeaveService; private StaffLeaveService staffLeaveService;
@Autowired
private AttendanceGroupStaffService attendanceGroupStaffService;
@Override @Override
protected String getExtKey(StaffEntity data) { protected String getExtKey(StaffEntity data) {
...@@ -201,7 +201,6 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -201,7 +201,6 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
} }
if (staffCollect.size() > 0) { if (staffCollect.size() > 0) {
//需要将此人员变更为离职 //需要将此人员变更为离职
staffCollect.entrySet().stream().forEach(item -> { staffCollect.entrySet().stream().forEach(item -> {
String key = item.getKey(); String key = item.getKey();
...@@ -243,6 +242,12 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -243,6 +242,12 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
if (count == 0) { if (count == 0) {
staffLeaveService.save(staffLeaveEntity); staffLeaveService.save(staffLeaveEntity);
} }
//考勤人员中有离职的 删除
Long[] groudStaffIds = attendanceGroupStaffService.find(new AttendanceGroupStaffQuery().staffId(staff.getId())).stream().toArray(Long[]::new);
if (!ObjectUtils.isEmpty(groudStaffIds)) {
attendanceGroupStaffService.remove(groudStaffIds, null);
}
} }
}); });
} }
......
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