|
|
|
@ -25,6 +25,7 @@ import com.ydool.staff.entity.Attachment;
|
|
|
|
|
import com.ydool.staff.entity.Audit;
|
|
|
|
|
import com.ydool.staff.entity.CompanyName;
|
|
|
|
|
import com.ydool.staff.entity.Personnel;
|
|
|
|
|
import com.ydool.staff.entity.PersonnelMiddle;
|
|
|
|
|
import com.ydool.staff.entity.SelectRequest;
|
|
|
|
|
import com.ydool.staff.excel.ExcelPersonnel;
|
|
|
|
|
import com.ydool.staff.excel.PersonnelExportVO;
|
|
|
|
@ -34,6 +35,7 @@ import com.ydool.staff.mapper.AuditLogMapper;
|
|
|
|
|
import com.ydool.staff.mapper.AuditMapper;
|
|
|
|
|
import com.ydool.staff.mapper.CompanyNameMapper;
|
|
|
|
|
import com.ydool.staff.mapper.PersonnelMapper;
|
|
|
|
|
import com.ydool.staff.mapper.PersonnelMiddleMapper;
|
|
|
|
|
import com.ydool.staff.request.AttachmentRequest;
|
|
|
|
|
import com.ydool.staff.request.ChangeRequest;
|
|
|
|
|
import com.ydool.staff.request.PersonnelDeleteRequest;
|
|
|
|
@ -56,6 +58,7 @@ import org.thymeleaf.util.StringUtils;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
@ -100,6 +103,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ConfigMapper configMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private PersonnelMiddleMapper personnelMiddleMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -133,11 +138,21 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
if (StrUtil.isNotBlank(id)) {
|
|
|
|
|
Personnel personnel = personnelMapper.selectById(id);
|
|
|
|
|
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
|
|
|
|
|
List<Audit> list = auditMapper.selectList(new LambdaQueryWrapper<Audit>()
|
|
|
|
|
.eq(Audit::getPersonnelId, personnel.getId())
|
|
|
|
|
.eq(Audit::getApprover,StpUtil.getLoginIdAsString()));
|
|
|
|
|
for (Audit audit : list) {
|
|
|
|
|
if (ArgsConst.WAITING.equals(audit.getAuditOrder())){
|
|
|
|
|
personnelUpdateDto.setAuditBtn(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
personnelUpdateDto.setCardFiles(nameAndPath(personnel.getCardFile(), personnel.getId()));
|
|
|
|
|
personnelUpdateDto.setEngageFiles(nameAndPath(personnel.getEngageFile(), personnel.getId()));
|
|
|
|
|
personnelUpdateDto.setEducationFiles(nameAndPath(personnel.getEducationFile(), personnel.getId()));
|
|
|
|
|
personnelUpdateDto.setJobTitleFiles(nameAndPath(personnel.getJobTitleFile(), personnel.getId()));
|
|
|
|
|
personnelUpdateDto.setAuditFiles(nameAndPath(personnel.getAuditFile(), personnel.getId()));
|
|
|
|
|
|
|
|
|
|
return AjaxResult.ok().data(personnelUpdateDto);
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.fail().msg("查询失败!");
|
|
|
|
@ -193,6 +208,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) {
|
|
|
|
|
PersonnelMiddle middle = new PersonnelMiddle();
|
|
|
|
|
Personnel per = get(updateRequest.getId());
|
|
|
|
|
List<AttachmentRequest> cardFile = updateRequest.getCardFile();
|
|
|
|
|
List<AttachmentRequest> educationFile = updateRequest.getEducationFile();
|
|
|
|
@ -204,20 +220,25 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
String type = ArgsConst.PERSONNEL;
|
|
|
|
|
saveAlteration("民族更改", per.getNation(), updateRequest.getNation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getNation));
|
|
|
|
|
saveAlteration("政治面貌更改", per.getPoliticsStatus(), updateRequest.getPoliticsStatus(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPoliticsStatus));
|
|
|
|
|
saveAlteration("学历更改", per.getEducation(), updateRequest.getEducation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducation));
|
|
|
|
|
saveAlteration("是否应届毕业生更改", per.getFreshGraduate(), updateRequest.getFreshGraduate(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getFreshGraduate));
|
|
|
|
|
saveAlteration("毕业院校更改", per.getAcademy(), updateRequest.getAcademy(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAcademy));
|
|
|
|
|
saveAlteration("专业更改", per.getSpecialty(), updateRequest.getSpecialty(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getSpecialty));
|
|
|
|
|
saveAlteration("所在部门更改", per.getPresentDept(), updateRequest.getPresentDept(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPresentDept));
|
|
|
|
|
saveAlteration("合同形式更改", per.getContractModality(), updateRequest.getContractModality(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getContractModality));
|
|
|
|
|
saveAlteration("身份证附件更改", per.getCardFile(), card, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getCardFile));
|
|
|
|
|
saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile));
|
|
|
|
|
saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile));
|
|
|
|
|
|
|
|
|
|
per.setAlterationSign("1");
|
|
|
|
|
boolean update = updateById(per);
|
|
|
|
|
middle.setBeforeId(per.getId());
|
|
|
|
|
per.setNation(saveAlteration("民族更改", per.getNation(), updateRequest.getNation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getNation)));
|
|
|
|
|
per.setPoliticsStatus(saveAlteration("政治面貌更改", per.getPoliticsStatus(), updateRequest.getPoliticsStatus(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPoliticsStatus)));
|
|
|
|
|
per.setEducation(saveAlteration("学历更改", per.getEducation(), updateRequest.getEducation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducation)));
|
|
|
|
|
per.setFreshGraduate(saveAlteration("是否应届毕业生更改", per.getFreshGraduate(), updateRequest.getFreshGraduate(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getFreshGraduate)));
|
|
|
|
|
per.setAcademy(saveAlteration("毕业院校更改", per.getAcademy(), updateRequest.getAcademy(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAcademy)));
|
|
|
|
|
per.setSpecialty(saveAlteration("专业更改", per.getSpecialty(), updateRequest.getSpecialty(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getSpecialty)));
|
|
|
|
|
per.setPresentDept(saveAlteration("所在部门更改", per.getPresentDept(), updateRequest.getPresentDept(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPresentDept)));
|
|
|
|
|
per.setContractModality(saveAlteration("合同形式更改", per.getContractModality(), updateRequest.getContractModality(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getContractModality)));
|
|
|
|
|
per.setCardFile(saveAlteration("身份证附件更改", per.getCardFile(), card, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getCardFile)));
|
|
|
|
|
per.setEducationFile(saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile)));
|
|
|
|
|
per.setAuditFile(saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile)));
|
|
|
|
|
per.setId("");
|
|
|
|
|
per.setState("1");
|
|
|
|
|
save(per);
|
|
|
|
|
middle.setAfterId(per.getId());
|
|
|
|
|
personnelMiddleMapper.insert(middle);
|
|
|
|
|
saveAttachment(cardFile, ArgsConst.CARD_FILE, updateRequest.getId(), ArgsConst.UPDATE);
|
|
|
|
|
saveAttachment(educationFile, ArgsConst.EDUCATION_FILE, updateRequest.getId(), ArgsConst.UPDATE);
|
|
|
|
|
saveAttachment(auditFile, ArgsConst.AUDIT_FILE, updateRequest.getId(), ArgsConst.UPDATE);
|
|
|
|
@ -225,8 +246,10 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public AjaxResult updateChange(ChangeRequest request) {
|
|
|
|
|
Personnel per = get(request.getId());
|
|
|
|
|
PersonnelMiddle middle = new PersonnelMiddle();
|
|
|
|
|
List<AttachmentRequest> cardFiles = request.getCardFiles();
|
|
|
|
|
List<AttachmentRequest> jobTitleFiles = request.getJobTitleFiles();
|
|
|
|
|
List<AttachmentRequest> engageFiles = request.getEngageFiles();
|
|
|
|
@ -241,22 +264,30 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
String engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type, request.getId()), ',');
|
|
|
|
|
String education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, request.getId()), ',');
|
|
|
|
|
String audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, request.getId()), ',');
|
|
|
|
|
saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getHireType));
|
|
|
|
|
saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getQualification));
|
|
|
|
|
saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitle));
|
|
|
|
|
saveAlteration("岗位职务更改",per.getPosition(),request.getPosition(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPosition));
|
|
|
|
|
saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getWorkState));
|
|
|
|
|
saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPersonnelCharacter));
|
|
|
|
|
saveAlteration("年薪更改",per.getAnnualSalary(),request.getAnnualSalary(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getAnnualSalary));
|
|
|
|
|
saveAlteration("退休时间更改",per.getRetirementTime(),request.getRetirementTime(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRetirementTime));
|
|
|
|
|
saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRecruitNumber));
|
|
|
|
|
saveAlteration("身份证附件更改",per.getCardFile(),card,type,request.getId(),ColumnUtil.getFieldName(Personnel::getCardFile));
|
|
|
|
|
saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEngageFile));
|
|
|
|
|
saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile));
|
|
|
|
|
saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile));
|
|
|
|
|
saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile));
|
|
|
|
|
per.setAlterationSign("0");
|
|
|
|
|
boolean update = updateById(per);
|
|
|
|
|
middle.setBeforeId(per.getId());
|
|
|
|
|
per.setHireType(saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getHireType)));
|
|
|
|
|
per.setQualification(saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getQualification)));
|
|
|
|
|
per.setJobTitle(saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitle)));
|
|
|
|
|
per.setPosition(saveAlteration("岗位职务更改",per.getPosition(),request.getPosition(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPosition)));
|
|
|
|
|
per.setWorkState(saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getWorkState)));
|
|
|
|
|
per.setPersonnelCharacter(saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPersonnelCharacter)));
|
|
|
|
|
per.setAnnualSalary(Integer.valueOf(saveAlteration("年薪更改",per.getAnnualSalary(),request.getAnnualSalary(),type,request.getId(), ColumnUtil.getFieldName(Personnel::getAnnualSalary))));
|
|
|
|
|
per.setRecruitNumber(saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRecruitNumber)));
|
|
|
|
|
per.setCardFile(saveAlteration("身份证附件更改",per.getCardFile(),card,type,request.getId(),ColumnUtil.getFieldName(Personnel::getCardFile)));
|
|
|
|
|
per.setEngageFile(saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEngageFile)));
|
|
|
|
|
per.setJobTitleFile(saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile)));
|
|
|
|
|
per.setEducationFile(saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile)));
|
|
|
|
|
per.setAuditFile(saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile)));
|
|
|
|
|
if (ObjectUtil.isNotNull(per.getRetirementTime())){
|
|
|
|
|
per.setRetirementTime(LocalDate.parse(saveAlteration("退休时间更改",per.getRetirementTime(),request.getRetirementTime(),type,request.getId(), ColumnUtil.getFieldName(Personnel::getRetirementTime))));
|
|
|
|
|
}
|
|
|
|
|
per.setId("");
|
|
|
|
|
per.setState("1");
|
|
|
|
|
save(per);
|
|
|
|
|
middle.setAfterId(per.getId());
|
|
|
|
|
personnelMiddleMapper.insert(middle);
|
|
|
|
|
saveAttachment(cardFiles, ArgsConst.CARD_FILE, request.getId(), ArgsConst.UPDATE);
|
|
|
|
|
saveAttachment(jobTitleFiles, ArgsConst.JOBTITLE_FILE, request.getId(), ArgsConst.UPDATE);
|
|
|
|
|
saveAttachment(engageFiles, ArgsConst.ENGAGE_FILE, request.getId(), ArgsConst.UPDATE);
|
|
|
|
@ -312,7 +343,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void saveAlteration(String details,Object before ,Object after,String type, String id,String fieldName){
|
|
|
|
|
public String saveAlteration(String details,Object before ,Object after,String type, String id,String fieldName){
|
|
|
|
|
if (ObjectUtil.isNotNull(after)){
|
|
|
|
|
if (!after.equals(before)){
|
|
|
|
|
Alteration alteration = new Alteration();
|
|
|
|
@ -327,10 +358,12 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
}
|
|
|
|
|
alteration.setAfterChange(after.toString());
|
|
|
|
|
alterationMapper.insert(alteration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return (String) after;
|
|
|
|
|
}
|
|
|
|
|
return (String) before;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<AttachmentDto> nameAndPath(String file, String id) {
|
|
|
|
|
if (StrUtil.isNotBlank(file)) {
|
|
|
|
@ -366,6 +399,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
.eq(ObjectUtil.isNotNull(request.getResignationTime()),Personnel::getResignationTime,request.getResignationTime())
|
|
|
|
|
.eq(StrUtil.isNotBlank(request.getWorkState()),Personnel::getWorkState,request.getWorkState())
|
|
|
|
|
.eq(StrUtil.isNotBlank(request.getReceipts()),Personnel::getReceipts,request.getReceipts())
|
|
|
|
|
.eq(Personnel::getState,"2")
|
|
|
|
|
.eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign());
|
|
|
|
|
wrapper.lambda().like(Personnel::getUserName,request.getUserName())
|
|
|
|
|
.like(Personnel::getNumberId,request.getNumberId())
|
|
|
|
@ -461,7 +495,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public AjaxResult giveAudit(String id, String type) {
|
|
|
|
|
String loginId = (String) StpUtil.getLoginId();
|
|
|
|
|
|
|
|
|
|
if ("1".equals(get(id).getAuditState())) {
|
|
|
|
|
return AjaxResult.fail().msg("该数据已送审,请勿重复操作!");
|
|
|
|
|
}
|
|
|
|
|
for(int i=0;i<2;i++ ){
|
|
|
|
|
Audit audit = new Audit();
|
|
|
|
|
audit.setPersonnelId(id);
|
|
|
|
@ -485,7 +521,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|
|
|
|
}
|
|
|
|
|
auditMapper.insert(audit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Personnel personnel = get(id);
|
|
|
|
|
personnel.setAuditState(1);
|
|
|
|
|
personnel.setAlterationSign("1");
|
|
|
|
|