Commit d7bede1a authored by huyuchen's avatar huyuchen

huych-入职登记提交

parent 15e3fb82
......@@ -44,6 +44,19 @@ public interface TEmployeeLogService extends IService<TEmployeeLog> {
**/
<T> TEmployeeLog saveModificationRecord(Integer type, String empId, String projectId, T oldInfo, T newInfo);
/**
* 生成修改记录
* @Author pwang
* @Date 2022-06-22 11:32
* @param type 类型:0人员档案;1项目档案;2人员和项目档案;3员工合同更新
* @param empId 档案id
* @param projectId 项目id
* @param oldInfo
* @param newInfo
* @return
**/
<T> TEmployeeLog saveModificationRecord(Integer type, String empId, String projectId, T oldInfo, T newInfo,String userId,String userName);
/**
* 生成修改记录
* @Author pwang
......
......@@ -231,8 +231,11 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
}
if (Common.isNotNull(preExit)) {
pre.setId(preExit.getId());
baseMapper.deleteById(preExit);
baseMapper.insert(pre);
String natureItemBefore = null;
String natureItemAfter = null;
String contractItemBefore = null;
......@@ -306,6 +309,10 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
}
}
}
if (!preExit.getProcessStatus().equals(pre.getProcessStatus())) {
preExit.setProcessStatus(CommonConstants.THREE_STRING.equals(preExit.getProcessStatus()) ? "拒绝入职": "已完成");
pre.setProcessStatus("短信待发放");
}
if (null != natureItemBefore) {
preExit.setEmpNature(natureItemBefore);
}
......@@ -325,46 +332,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
pre.setContractSubName(contractXfAfter);
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[4],
pre.getId().toString(), "", preExit, pre);
baseMapper.deleteById(preExit);
// if (Common.isNotNull(preVo.getServerItem())) {
// pre.setServerItem(preVo.getServerItem());
// }
// if (Common.isNotNull(preVo.getFileProvince())) {
// pre.setFileProvince(preVo.getFileProvince());
// }
// if (Common.isNotNull(preVo.getFileCity())) {
// pre.setFileCity(preVo.getFileCity());
// }
// if (Common.isNotNull(preVo.getFileTown())) {
// pre.setFileTown(preVo.getFileTown());
// } else {
// pre.setFileTown(null);
// }
// if (Common.isNotNull(preVo.getProvinceCode())) {
// pre.setProvinceCode(preVo.getProvinceCode());
// }
// if (Common.isNotNull(preVo.getCityCode())) {
// pre.setCityCode(preVo.getCityCode());
// }
// if (Common.isNotNull(preVo.getTownCode())) {
// pre.setTownCode(preVo.getTownCode());
// } else {
// pre.setTownCode(null);
// }
// if (Common.isNotNull(preVo.getContractType())) {
// pre.setContractType(preVo.getContractType());
// }
// if (Common.isNotNull(preVo.getEmpNature())) {
// pre.setEmpNature(preVo.getEmpNature());
// }
// if (Common.isNotNull(preVo.getContractSubName())) {
// pre.setContractSubName(preVo.getContractSubName());
// }else {
// pre.setContractSubName(null);
// }
pre.getId(), "", preExit, pre,pre.getCreateBy(),pre.getCreateName());
}
baseMapper.insert(pre);
if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
// 事务提交后触发调度
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
......
......@@ -67,6 +67,33 @@ public class TEmployeeLogServiceImpl extends ServiceImpl<TEmployeeLogMapper, TEm
return null;
}
@Override
public <T> TEmployeeLog saveModificationRecord(Integer type, String empId, String projectId, T oldInfo, T newInfo,String userId,String userName) {
try{
//比较记录不影响业务逻辑,用try套住
//比较差异
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异
if(!Common.isEmpty(differenceKey)){
TEmployeeLog employeeLog = new TEmployeeLog();
employeeLog.setProjectId(projectId);
employeeLog.setType(type);
employeeLog.setEmpId(empId);
employeeLog.setCreateTime(LocalDateTime.now());
employeeLog.setOldInfo(JSON.toJSONString(oldInfo,features));
employeeLog.setNewInfo(JSON.toJSONString(newInfo,features));
employeeLog.setDifferenceInfo(differenceKey);
employeeLog.setCreateBy(userId);
employeeLog.setCreateName(userName);
baseMapper.insert(employeeLog);
return employeeLog;
}
}catch (Exception e){
log.error(JSON.toJSON(oldInfo)+"插入修改记录报错>>>",e);
}
return null;
}
@Override
public <T> TEmployeeLog saveModificationRecord(Integer type, String empId, String projectId, T oldInfo, T newInfo,YifuUser user) {
try{
......
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