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

修改用户等

parent 0d06e072
...@@ -174,7 +174,7 @@ public class SyncDoorsEventAfterTaskImpl implements ITaskExcuteService { ...@@ -174,7 +174,7 @@ public class SyncDoorsEventAfterTaskImpl implements ITaskExcuteService {
try { try {
recordHikService.getDao().insert(recordHikEntity); recordHikService.getDao().insert(recordHikEntity);
} catch (Exception e) { } catch (Exception e) {
log.error("基础考勤数据保存异常", e.getMessage()); //log.error("基础考勤数据保存异常", e.getMessage());
} }
} }
} }
......
...@@ -185,7 +185,7 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService { ...@@ -185,7 +185,7 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
try { try {
recordHikService.getDao().insert(recordHikEntity); recordHikService.getDao().insert(recordHikEntity);
} catch (Exception e) { } catch (Exception e) {
log.error("基础考勤数据保存异常", e.getMessage()); //log.error("基础考勤数据保存异常", e.getMessage());
} }
} }
// recordHikService.save(saveRecordList); // recordHikService.save(saveRecordList);
......
...@@ -196,8 +196,6 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte ...@@ -196,8 +196,6 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
attendanceRecordEntity.setUpdateUserId(this.getContextUserId(context)); attendanceRecordEntity.setUpdateUserId(this.getContextUserId(context));
attendanceRecordService.update(attendanceRecordEntity, context); attendanceRecordService.update(attendanceRecordEntity, context);
} else { } else {
attendanceRecordService.save(attendanceRecordEntity, context); attendanceRecordService.save(attendanceRecordEntity, context);
} }
} }
......
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.staff.service.impl; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.staff.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
...@@ -32,8 +33,10 @@ import com.mortals.xhx.module.staff.dao.StaffDao; ...@@ -32,8 +33,10 @@ import com.mortals.xhx.module.staff.dao.StaffDao;
import com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl; import com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl;
import com.mortals.xhx.module.staff.dao.ibatis.StaffLeaveDaoImpl; import com.mortals.xhx.module.staff.dao.ibatis.StaffLeaveDaoImpl;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffLeaveEntity;
import com.mortals.xhx.module.staff.model.StaffQuery; import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.model.vo.StaffInfoVo; import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
import com.mortals.xhx.module.staff.service.StaffLeaveService;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -75,7 +78,8 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -75,7 +78,8 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
private AttendanceVacationBalanceService balanceService; private AttendanceVacationBalanceService balanceService;
@Autowired @Autowired
private IdgeneratorService idgeneratorService; private IdgeneratorService idgeneratorService;
@Autowired
private StaffLeaveService staffLeaveService;
@Override @Override
protected String getExtKey(StaffEntity data) { protected String getExtKey(StaffEntity data) {
...@@ -134,8 +138,24 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -134,8 +138,24 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
personReq.setPageSize(1000); personReq.setPageSize(1000);
Rest<PersonDataInfo> personRest = hikPersonService.getPersonList(personReq); Rest<PersonDataInfo> personRest = hikPersonService.getPersonList(personReq);
if (personRest.getCode() == YesNoEnum.YES.getValue()) { if (personRest.getCode() == YesNoEnum.YES.getValue()) {
//做差集 更新本地用户为离职员工
StaffQuery staffQuery = new StaffQuery();
staffQuery.setSource(1);
staffQuery.setStatusNotList(Arrays.asList(StaffSatusEnum.离职.getValue()));
Map<String, StaffEntity> staffCollect = this.find(staffQuery).stream().collect(Collectors.toMap(x -> x.getWorkNum(), y -> y, (o, n) -> n));
List<PersonInfo> personInfoList = personRest.getData().getList(); List<PersonInfo> personInfoList = personRest.getData().getList();
for (PersonInfo personInfo : personInfoList) { for (PersonInfo personInfo : personInfoList) {
if (ObjectUtils.isEmpty(personInfo.getJobNo())) {
log.info("jobNo is null ==>{}", JSON.toJSONString(personInfo));
continue;
}
if (staffCollect.containsKey(personInfo.getJobNo())) {
staffCollect.remove(personInfo.getJobNo());
}
StaffEntity staffEntity = this.getExtCache(StrUtil.padPre(personInfo.getJobNo(), 8, "0")); StaffEntity staffEntity = this.getExtCache(StrUtil.padPre(personInfo.getJobNo(), 8, "0"));
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().deptCode(personInfo.getOrgIndexCode())); DeptEntity deptEntity = deptService.selectOne(new DeptQuery().deptCode(personInfo.getOrgIndexCode()));
//判断本地数据是否为空 //判断本地数据是否为空
...@@ -175,6 +195,43 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -175,6 +195,43 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
staffEntity.setUpdateTime(new Date()); staffEntity.setUpdateTime(new Date());
this.update(staffEntity); this.update(staffEntity);
} }
if (staffCollect.size() > 0) {
//需要将此人员变更为离职
staffCollect.entrySet().stream().forEach(item -> {
StaffEntity staff = item.getValue();
staff.setStatus(StaffSatusEnum.离职.getValue());
staff.setUpdateTime(new Date());
staff.setUpdateUserId(1L);
this.update(staff);
//新增离职人员
StaffLeaveEntity staffLeaveEntity = new StaffLeaveEntity();
staffLeaveEntity.initAttrValue();
staffLeaveEntity.setStaffId(staff.getId());
staffLeaveEntity.setStaffName(staff.getName());
staffLeaveEntity.setGender(staff.getGender());
staffLeaveEntity.setBirthday(staff.getBirthday());
staffLeaveEntity.setPhotoPath(staff.getPhotoPath());
staffLeaveEntity.setPhoneNumber(staff.getPhoneNumber());
staffLeaveEntity.setIdCard(staff.getIdCard());
staffLeaveEntity.setWorkNum(staff.getWorkNum());
staffLeaveEntity.setPoliticalstatus(staff.getPoliticalstatus());
staffLeaveEntity.setDeptId(staff.getDeptId());
staffLeaveEntity.setDeptName(staff.getDeptName());
staffLeaveEntity.setJobId(staff.getPositionId());
staffLeaveEntity.setJobName(staff.getPositionName());
staffLeaveEntity.setStaffType(staff.getStaffType());
staffLeaveEntity.setStatus(StaffSatusEnum.离职.getValue());
staffLeaveEntity.setLeaveDate(new Date());
staffLeaveEntity.setLeaveReason("");
staffLeaveEntity.setAuditStatus(AuditStatusEnum.通过.getValue());
staffLeaveEntity.setCreateUserId(1L);
staffLeaveEntity.setCreateTime(new Date());
staffLeaveService.save(staffLeaveEntity);
});
}
} }
} }
......
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