This commit is contained in:
zhuyy 2023-02-09 17:11:16 +08:00
parent 9642903945
commit 19a3f82ac4
6 changed files with 108 additions and 117 deletions

View File

@ -5,7 +5,7 @@ package com.ydool.common.constant;
* @version 1.0
* @date 2023/2/8 11:04
*/
public class AgesConst {
public class ArgsConst {
/**
*身份证附件
@ -43,4 +43,13 @@ public class AgesConst {
* 附件所属人员
*/
public static final String PERSONNEL = "personnel";
/**
* 附件所属内设机构
*/
public static final String ORGANIZATION = "organization";
/**
* 附件所属董监
*/
public static final String DIRECTORS = "directors";
}

View File

@ -6,6 +6,7 @@ import cn.hutool.core.io.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.mapper.AttachmentMapper;
@ -80,7 +81,7 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
public AjaxResult selectOrganizationFileList(String id) {
LambdaQueryWrapper<Attachment> attachmentLambdaQueryWrapper = new LambdaQueryWrapper<>();
attachmentLambdaQueryWrapper.eq(Attachment::getTargetId, id);
attachmentLambdaQueryWrapper.eq(Attachment::getTargetType, "organization");
attachmentLambdaQueryWrapper.eq(Attachment::getTargetType, ArgsConst.ORGANIZATION);
Page<Attachment> attachmentPage = attachmentMapper.selectPage(new Page<>(), attachmentLambdaQueryWrapper);
return AjaxResult.ok().data(attachmentPage);
}

View File

@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.DirectorsSupervisorsDto;
@ -70,7 +71,7 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
List<Attachment> attachments = BeanUtil.copyToList(attachmentDtoList, Attachment.class);
for (Attachment attachment : attachments) {
attachment.setTargetId(directorsSupervisors.getId());
attachment.setTargetType("directors");
attachment.setTargetType(ArgsConst.DIRECTORS);
attachmentMapper.insert(attachment);
}
return AjaxResult.ok().msg("新增成功!");
@ -103,7 +104,7 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
if (ObjectUtil.isNull(directorsSupervisors)) {
return AjaxResult.fail().msg("未找到相关信息!");
}
List<Attachment> attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, directorsSupervisors.getId()).eq(Attachment::getTargetType, "directors"));
List<Attachment> attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, directorsSupervisors.getId()).eq(Attachment::getTargetType, ArgsConst.DIRECTORS));
List<AttachmentDto> attachmentDtos = BeanUtil.copyToList(attachmentList, AttachmentDto.class);
directorsSupervisors.setAttachmentDtoList(attachmentDtos);
return AjaxResult.ok().data(directorsSupervisors);

View File

@ -3,6 +3,7 @@ package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Mechanism;
@ -79,7 +80,7 @@ public class MechanismServiceImpl extends BaseService<MechanismMapper, Mechanism
List<Attachment> attachments = mechanismRequest.getAttachments();
for (Attachment attachment : attachments) {
attachment.setTargetId(organization.getId());
attachment.setTargetType("organization");
attachment.setTargetType(ArgsConst.ORGANIZATION);
attachment.setSize(attachment.getSize());
attachment.setSuffix(attachment.getSuffix());
attachmentMapper.insert(attachment);

View File

@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.entity.*;
@ -68,7 +69,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
return AjaxResult.fail().msg("未找到相关信息!");
} else {
List<Mechanism> mechanismList = mechanismMapper.selectList(new LambdaQueryWrapper<Mechanism>().eq(Mechanism::getOrganizationId, organization.getId()));
List<Attachment> attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, organization.getId()).eq(Attachment::getTargetType, "organization"));
List<Attachment> attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, organization.getId()).eq(Attachment::getTargetType, ArgsConst.ORGANIZATION));
List<PartyOrganization> partyOrganizationList = partyOrganizationMapper.selectList(new LambdaQueryWrapper<PartyOrganization>());
List<AttachmentDto> toList = BeanUtil.copyToList(attachmentList, AttachmentDto.class);
OrganizationRequest organizationRequest = new OrganizationRequest();

View File

@ -1,15 +1,13 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollStreamUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService;
import com.ydool.common.constant.AgesConst;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.ColumnUtil;
import com.ydool.staff.dto.AttachmentDto;
@ -19,12 +17,10 @@ import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.Alteration;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.request.ChangeRequest;
@ -35,17 +31,13 @@ import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.entity.Dept;
import com.ydool.system.mapper.DeptMapper;
import org.apache.poi.ss.formula.functions.Column;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource;
import javax.validation.constraints.Null;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@ -73,15 +65,15 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
/**
* 人员列表
*
* @return
*/
@Override
public AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column) {
public AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column) {
QueryWrapper wrapper = selectWrapper(request, orderBy, column);
Page personnelPage = page(page, wrapper);
List<Personnel> list = personnelPage.getRecords();
personnelPage.setRecords(list.stream().map(e->{
personnelPage.setRecords(list.stream().map(e -> {
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
CompanyName companyName = companyNameMapper.selectById(e.getCompanyName());
Dept dept = deptMapper.selectById(e.getPresentDept());
@ -91,11 +83,10 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return dto;
}).collect(Collectors.toList()));
return AjaxResult.ok().data(personnelPage);
}
public AjaxResult getById(String id) {
if (StrUtil.isNotBlank(id)){
if (StrUtil.isNotBlank(id)) {
Personnel personnel = personnelMapper.selectById(id);
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
personnelUpdateDto.setCardFiles(nameAndPath(personnel.getCardFile(), personnel.getId()));
@ -118,24 +109,25 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
/**
* 新增人员申报
*
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult savePersonnel(PersonnelRequest personnelRequest) {
Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class);
personnel.setCardFile(StringUtils.join(saveFilePath(personnelRequest.getCardFile(),AgesConst.CARD_FILE,AgesConst.SAVE,""),','));
personnel.setEngageFile(StringUtils.join(saveFilePath(personnelRequest.getEngageFile(),AgesConst.ENGAGE_FILE,AgesConst.SAVE,""),','));
personnel.setJobTitleFile(StringUtils.join(saveFilePath(personnelRequest.getJobTitleFile(),AgesConst.EDUCATION_FILE,AgesConst.SAVE,""),','));
personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(),AgesConst.JOBTITLE_FILE,AgesConst.SAVE,""),','));
personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(),AgesConst.AUDIT_FILE,AgesConst.SAVE,""),','));
personnel.setCardFile(StringUtils.join(saveFilePath(personnelRequest.getCardFile(), ArgsConst.CARD_FILE, ArgsConst.SAVE, ""), ','));
personnel.setEngageFile(StringUtils.join(saveFilePath(personnelRequest.getEngageFile(), ArgsConst.ENGAGE_FILE, ArgsConst.SAVE, ""), ','));
personnel.setJobTitleFile(StringUtils.join(saveFilePath(personnelRequest.getJobTitleFile(), ArgsConst.EDUCATION_FILE, ArgsConst.SAVE, ""), ','));
personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(), ArgsConst.JOBTITLE_FILE, ArgsConst.SAVE, ""), ','));
personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, ArgsConst.SAVE, ""), ','));
boolean save = save(personnel);
saveAttachment(personnelRequest.getCardFile(),AgesConst.CARD_FILE,personnel.getId(),AgesConst.SAVE);
saveAttachment(personnelRequest.getEngageFile(),AgesConst.ENGAGE_FILE,personnel.getId(),AgesConst.SAVE);
saveAttachment(personnelRequest.getEducationFile(),AgesConst.EDUCATION_FILE,personnel.getId(),AgesConst.SAVE);
saveAttachment(personnelRequest.getJobTitleFile(),AgesConst.JOBTITLE_FILE,personnel.getId(),AgesConst.SAVE);
saveAttachment(personnelRequest.getAuditFile(),AgesConst.AUDIT_FILE,personnel.getId(),AgesConst.SAVE);
return save ? AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!");
saveAttachment(personnelRequest.getCardFile(), ArgsConst.CARD_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getEngageFile(), ArgsConst.ENGAGE_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getEducationFile(), ArgsConst.EDUCATION_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getJobTitleFile(), ArgsConst.JOBTITLE_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, personnel.getId(), ArgsConst.SAVE);
return save ? AjaxResult.ok().msg("保存成功!") : AjaxResult.fail().msg("保存失败!");
}
@Override
@ -157,32 +149,32 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
List<AttachmentRequest> cardFile = updateRequest.getCardFile();
List<AttachmentRequest> educationFile = updateRequest.getEducationFile();
List<AttachmentRequest> auditFile = updateRequest.getAuditFile();
String card = StringUtils.join(saveFilePath(cardFile, AgesConst.CARD_FILE, AgesConst.UPDATE, updateRequest.getId()), ',');
String education = StringUtils.join(saveFilePath(educationFile,AgesConst.EDUCATION_FILE,AgesConst.UPDATE,updateRequest.getId()),',');
String audit = StringUtils.join(saveFilePath(auditFile,AgesConst.AUDIT_FILE,AgesConst.UPDATE,updateRequest.getId()),',');
String card = StringUtils.join(saveFilePath(cardFile, ArgsConst.CARD_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
String education = StringUtils.join(saveFilePath(educationFile, ArgsConst.EDUCATION_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
String audit = StringUtils.join(saveFilePath(auditFile, ArgsConst.AUDIT_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
System.out.println("per = " + per);
if (per.getAuditState().equals(0)||per.getAuditState().equals(1)) {
if (per.getAuditState().equals(0) || per.getAuditState().equals(1)) {
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
}
String type =AgesConst.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));
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.setAuditState(0);
boolean update = updateById(per);
saveAttachment(cardFile,AgesConst.CARD_FILE,updateRequest.getId(),AgesConst.UPDATE);
saveAttachment(educationFile,AgesConst.EDUCATION_FILE,updateRequest.getId(),AgesConst.UPDATE);
saveAttachment(auditFile,AgesConst.AUDIT_FILE,updateRequest.getId(),AgesConst.UPDATE);
return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!");
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);
return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!");
}
@Override
@ -193,76 +185,77 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
List<AttachmentRequest> engageFiles = request.getEngageFiles();
List<AttachmentRequest> educationFiles = request.getEducationFiles();
List<AttachmentRequest> auditFiles = request.getAuditFiles();
if (per.getAuditState().equals(0)||per.getAuditState().equals(1)) {
if (per.getAuditState().equals(0) || per.getAuditState().equals(1)) {
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
}
String type =AgesConst.CHANGE;
String card = StringUtils.join(saveFilePath(cardFiles, AgesConst.CARD_FILE, type, request.getId()), ',');
String jobTitle = StringUtils.join(saveFilePath(jobTitleFiles,AgesConst.JOBTITLE_FILE,type,request.getId()),',');
String engage = StringUtils.join(saveFilePath(engageFiles,AgesConst.ENGAGE_FILE,type,request.getId()),',');
String education = StringUtils.join(saveFilePath(educationFiles,AgesConst.EDUCATION_FILE,type,request.getId()),',');
String audit = StringUtils.join(saveFilePath(auditFiles,AgesConst.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));
String type = ArgsConst.CHANGE;
String card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, request.getId()), ',');
String jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, request.getId()), ',');
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.setAuditState(0);
boolean update = updateById(per);
saveAttachment(cardFiles,AgesConst.CARD_FILE,request.getId(),AgesConst.UPDATE);
saveAttachment(jobTitleFiles,AgesConst.JOBTITLE_FILE,request.getId(),AgesConst.UPDATE);
saveAttachment(engageFiles,AgesConst.ENGAGE_FILE,request.getId(),AgesConst.UPDATE);
saveAttachment(educationFiles,AgesConst.EDUCATION_FILE,request.getId(),AgesConst.UPDATE);
saveAttachment(auditFiles,AgesConst.AUDIT_FILE,request.getId(),AgesConst.UPDATE);
return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!");
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);
saveAttachment(educationFiles, ArgsConst.EDUCATION_FILE, request.getId(), ArgsConst.UPDATE);
saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, request.getId(), ArgsConst.UPDATE);
return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!");
}
/**
* 保存附件
*
* @param file
* @param type
* @param id
*/
public void saveAttachment(List<AttachmentRequest> file,String type, String id,String ages){
if (CollectionUtil.isNotEmpty(file)){
public void saveAttachment(List<AttachmentRequest> file, String type, String id, String ages) {
if (CollectionUtil.isNotEmpty(file)) {
for (AttachmentRequest request : file) {
Attachment attachment = BeanUtil.copyProperties(request, Attachment.class);
attachment.setTargetType(type);
attachment.setTargetId(id);
if (AgesConst.UPDATE.equals(ages)){
if (ArgsConst.UPDATE.equals(ages)) {
attachment.setFileState(0);
}else {
} else {
attachment.setFileState(1);
}
attachmentService.savePersonnel(attachment);
}
}
}
/**
* 保存附件返路径
*
* @param file
* @param type
* @param args
* @param id
* @return
*/
public ArrayList<String> saveFilePath(List<AttachmentRequest> file, String type, String args, String id){
if (CollectionUtil.isNotEmpty(file)){
public ArrayList<String> saveFilePath(List<AttachmentRequest> file, String type, String args, String id) {
if (CollectionUtil.isNotEmpty(file)) {
ArrayList<String> path = new ArrayList<>();
for (AttachmentRequest request : file) {
if (AgesConst.UPDATE.equals(args)){
attachmentService.deleteById(type,id);
if (ArgsConst.UPDATE.equals(args)) {
attachmentService.deleteById(type, id);
}
path.add(request.getPath());
}
@ -271,70 +264,55 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return new ArrayList<>();
}
public void saveAlteration(String details,Object before ,Object after,String type, String id,String fieldName){
if (ObjectUtil.isNotNull(after)){
public void saveAlteration(String details, Object before, Object after, String type, String id, String fieldName) {
if (ObjectUtil.isNotNull(after)) {
System.out.println("after = " + after);
if (!before.equals(after)){
if (!before.equals(after)) {
Alteration alteration = new Alteration();
alteration.setDetails(details);
alteration.setFieldName(fieldName);
alteration.setType(type);
alteration.setRelevancyId(id);
if (ObjectUtil.isNotNull(before)){
alteration.setBeforeChange( before.toString());
}else {
if (ObjectUtil.isNotNull(before)) {
alteration.setBeforeChange(before.toString());
} else {
alteration.setBeforeChange("");
}
alteration.setAfterChange(after.toString());
alterationMapper.insert(alteration);
}
}
}
public List<AttachmentDto> nameAndPath(String file,String id){
if (StrUtil.isNotBlank(file)){
public List<AttachmentDto> nameAndPath(String file, String id) {
if (StrUtil.isNotBlank(file)) {
List<String> cardFile = Arrays.asList(file.split(","));
ArrayList<AttachmentDto> attachmentDtos = new ArrayList<>();
for (String s : cardFile) {
AttachmentDto dto = new AttachmentDto();
Attachment attachment = attachmentService.selectByIdAndPath(id, s);
if (ObjectUtil.isNotEmpty(attachment)){
if (ObjectUtil.isNotEmpty(attachment)) {
dto.setName(attachment.getName());
dto.setPath(attachment.getPath());
dto.setSize(attachment.getSize());
attachmentDtos.add(dto);
}
}
return attachmentDtos;
}
return null;
}
public QueryWrapper selectWrapper(SelectRequest request,String orderBy,String column){
public QueryWrapper selectWrapper(SelectRequest request, String orderBy, String column) {
QueryWrapper<Personnel> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType())
.eq(StrUtil.isNotBlank(request.getPresentDept()),Personnel::getPresentDept,request.getPresentDept())
.eq(StrUtil.isNotBlank(request.getPoliticsStatus()),Personnel::getPoliticsStatus,request.getPoliticsStatus())
.eq(StrUtil.isNotBlank(request.getHireType()),Personnel::getHireType,request.getHireType())
.eq(StrUtil.isNotBlank(request.getPosition()),Personnel::getPosition,request.getPosition())
.eq(StrUtil.isNotBlank(request.getContractModality()),Personnel::getContractModality,request.getContractModality())
.eq(StrUtil.isNotBlank(request.getQualification()),Personnel::getQualification,request.getQualification())
.eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType())
.eq(ObjectUtil.isNotNull(request.getHireDate()),Personnel::getHireDate,request.getHireDate())
.eq(ObjectUtil.isNotNull(request.getResignationTime()),Personnel::getResignationTime,request.getResignationTime())
.eq(StrUtil.isNotBlank(request.getWorkState()),Personnel::getWorkState,request.getWorkState())
.eq(StrUtil.isNotBlank(request.getReceipts()),Personnel::getRecruitNumber,request.getReceipts())
.eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign());
wrapper.lambda().like(Personnel::getUserName,request.getUserName())
.like(Personnel::getNumberId,request.getNumberId())
wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()), Personnel::getPersonnelType, request.getPersonnelType()).eq(StrUtil.isNotBlank(request.getPresentDept()), Personnel::getPresentDept, request.getPresentDept()).eq(StrUtil.isNotBlank(request.getPoliticsStatus()), Personnel::getPoliticsStatus, request.getPoliticsStatus()).eq(StrUtil.isNotBlank(request.getHireType()), Personnel::getHireType, request.getHireType()).eq(StrUtil.isNotBlank(request.getPosition()), Personnel::getPosition, request.getPosition()).eq(StrUtil.isNotBlank(request.getContractModality()), Personnel::getContractModality, request.getContractModality()).eq(StrUtil.isNotBlank(request.getQualification()), Personnel::getQualification, request.getQualification()).eq(StrUtil.isNotBlank(request.getPersonnelType()), Personnel::getPersonnelType, request.getPersonnelType()).eq(ObjectUtil.isNotNull(request.getHireDate()), Personnel::getHireDate, request.getHireDate()).eq(ObjectUtil.isNotNull(request.getResignationTime()), Personnel::getResignationTime, request.getResignationTime()).eq(StrUtil.isNotBlank(request.getWorkState()), Personnel::getWorkState, request.getWorkState()).eq(StrUtil.isNotBlank(request.getReceipts()), Personnel::getRecruitNumber, request.getReceipts()).eq(StrUtil.isNotBlank(request.getAlterationSign()), Personnel::getAlterationSign, request.getAlterationSign());
wrapper.lambda().like(Personnel::getUserName, request.getUserName()).like(Personnel::getNumberId, request.getNumberId())
.exists(StrUtil.isNotBlank(request.getCompanyName()), "select t2.id from t_lc_company_name t2 where " + "t_lc_personnel.company_name = t2.id and t2.company_name like '%" + request.getCompanyName() + "%'");
/*.like(Personnel::getAuditFile,request.getFileName()).or()
.like(Personnel::getCardFile,request.getFileName()).or()
.like(Personnel::getEducationFile,request.getFileName()).or()
.like(Personnel::getEngageFile,request.getFileName()).or()
.like(Personnel::getJobTitleFile,request.getFileName()).or()*/
.exists(StrUtil.isNotBlank(request.getCompanyName()), "select t2.id from t_lc_company_name t2 where " +
"t_lc_personnel.company_name = t2.id and t2.company_name like '%" + request.getCompanyName() + "%'");
if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) {
wrapper.orderByDesc(column);
}