人员附件修改相关

This commit is contained in:
mash 2023-02-07 15:18:35 +08:00
parent 26fb9a3818
commit bcd3d389a7
12 changed files with 482 additions and 18 deletions

View File

@ -8,6 +8,7 @@ import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.UploadUtils; import com.ydool.common.utils.UploadUtils;
import com.ydool.staff.dto.PersonnelDto; import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest; import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest; import com.ydool.staff.request.PersonnelUpdateRequest;
@ -65,6 +66,12 @@ public class PersonnelController extends BaseController {
return personnelService.updatePersonnel(personnelDeleteRequest); return personnelService.updatePersonnel(personnelDeleteRequest);
} }
@PostMapping(value = "updateChange")
@ApiOperation(value = "人员变更")
public AjaxResult updateChange(@RequestBody ChangeRequest request){
return personnelService.updateChange(request);
}
@GetMapping("/download") @GetMapping("/download")
@ApiOperation(value = "下载文件") @ApiOperation(value = "下载文件")
@ApiImplicitParams({@ApiImplicitParam(name = "path", value = "文件路径"), @ApiImplicitParam(name = "fileName", value = "文件名")}) @ApiImplicitParams({@ApiImplicitParam(name = "path", value = "文件路径"), @ApiImplicitParam(name = "fileName", value = "文件名")})

View File

@ -0,0 +1,21 @@
package com.ydool.staff.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author msh
* @version 1.0
* @date 2023/2/7 13:13
*/
@Data
public class AttachmentDto {
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "路径")
private String path;
@ApiModelProperty(value = "大小")
private String size;
}

View File

@ -0,0 +1,135 @@
package com.ydool.staff.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author msh
* @version 1.0
* @date 2023/2/7 13:29
*/
@Data
public class PersonnelUpdateDto {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "统一社会信用代码")
private String socialCreditCode;
@ApiModelProperty(value = "姓名")
private String userName;
@ApiModelProperty(value = "企业名称")
private String companyName;
@ApiModelProperty(value = "性别")
private Integer gender;
@ApiModelProperty(value = "出生日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date birthday;
@ApiModelProperty(value = "身份证号")
private String numberId;
@ApiModelProperty(value = "民族")
private String nation;
@ApiModelProperty(value = "政治面貌")
private String politicsStatus;
@ApiModelProperty(value = "学历")
private String education;
@ApiModelProperty(value = "是否应届毕业生")
private Integer freshGraduate;
@ApiModelProperty(value = "毕业院校")
private String academy;
@ApiModelProperty(value = "专业")
private String specialty;
@ApiModelProperty(value = "录用方式")
private String hireType;
@ApiModelProperty(value = "执业资格证书")
private String qualification;
@ApiModelProperty(value = "专业技术职称")
private String jobTitle;
@ApiModelProperty(value = "所在部门")
private String presentDept;
@ApiModelProperty(value = "岗位职务")
private String position;
@ApiModelProperty(value = "合同形式")
private String contractModality;
@ApiModelProperty(value = "人员类型")
private String personnelType;
@ApiModelProperty(value = "工作状态")
private String workState;
@ApiModelProperty(value = "人员性质")
private String personnelCharacter;
@ApiModelProperty(value = "年薪")
private BigDecimal annualSalary;
@ApiModelProperty(value = "入职时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date hireDate;
@ApiModelProperty(value = "退休时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date retirementTime;
@ApiModelProperty(value = "离职时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date resignationTime;
@ApiModelProperty(value = "退休返聘开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date txfpStartTime;
@ApiModelProperty(value = "退休返聘结束时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date txfpEndTime;
@ApiModelProperty(value = "人员招聘单号")
private String recruitNumber;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "初审意见")
private String firstTrialRemark;
@ApiModelProperty(value = "终审意见")
private String finalTrialRemark;
@ApiModelProperty(value = "身份证附件")
private List<AttachmentDto> cardFiles;
@ApiModelProperty(value = "聘任证书附件")
private List<AttachmentDto> engageFiles;
@ApiModelProperty(value = "职称证书附件")
private List<AttachmentDto> jobTitleFiles;
@ApiModelProperty(value = "学历证书附件")
private List<AttachmentDto> educationFiles;
@ApiModelProperty(value = "审批资料附件")
private List<AttachmentDto> auditFiles;
}

View File

@ -0,0 +1,42 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 变更记录表
* </p>
*
* @author msh
* @since 2023-02-06
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_lc_alteration")
@ApiModel(value="Alteration对象", description="变更记录表")
public class Alteration extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "关联id")
private String relevancyId;
@ApiModelProperty(value = "变更前")
private String beforeChange;
@ApiModelProperty(value = "变更后")
private String afterChange;
@ApiModelProperty(value = "变更内容")
private String details;
@ApiModelProperty(value = "变更类型")
private String type;
}

View File

@ -0,0 +1,18 @@
package com.ydool.staff.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.ydool.staff.entity.Alteration;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 变更记录表 Mapper 接口
* </p>
*
* @author msh
* @since 2023-02-06
*/
@Mapper
public interface AlterationMapper extends MPJBaseMapper<Alteration> {
}

View File

@ -0,0 +1,73 @@
package com.ydool.staff.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author msh
* @version 1.0
* @date 2023/2/1 11:53
*/
@Data
public class ChangeRequest {
@ApiModelProperty(value = "id")
@NotBlank(message = "id不能为空")
private String id;
@ApiModelProperty(value = "录用方式")
@NotBlank(message = "录用方式不能为空")
private String hireType;
@ApiModelProperty(value = "执业资格")
@NotBlank(message = "执业资格不能为空")
private String qualification;
@ApiModelProperty(value = "专业技术职称")
private String jobTitle;
@ApiModelProperty(value = "岗位职务")
@NotBlank(message = "岗位职务不能为空")
private String position;
@ApiModelProperty(value = "工作状态")
@NotBlank(message = "工作状态不能为空")
private String workState;
@ApiModelProperty(value = "人员性质")
@NotBlank(message = "人员性质不能为空")
private String personnelCharacter;
@ApiModelProperty(value = "年薪")
@NotBlank(message = "年薪不能为空")
private BigDecimal annualSalary;
@ApiModelProperty(value = "退休时间")
@NotNull(message = "退休时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date retirementTime;
@ApiModelProperty(value = "人员招聘单号")
private String recruitNumber;
@ApiModelProperty(value = "身份证附件")
private List<AttachmentRequest> cardFiles;
@ApiModelProperty(value = "聘任证书附件")
private List<AttachmentRequest> engageFiles;
@ApiModelProperty(value = "职称证书附件")
private List<AttachmentRequest> jobTitleFiles;
@ApiModelProperty(value = "学历证书附件")
private List<AttachmentRequest> educationFiles;
@ApiModelProperty(value = "审批资料附件")
private List<AttachmentRequest> auditFiles;
}

View File

@ -0,0 +1,14 @@
package com.ydool.staff.service;
/**
* <p>
* 变更记录表 服务类
* </p>
*
* @author msh
* @since 2023-02-06
*/
public interface IAlterationService {
}

View File

@ -19,7 +19,7 @@ public interface IAttachmentService {
boolean deleteById(String targetType,String id); boolean deleteById(String targetType,String id);
Attachment selectFile(String path, String id); Attachment selectByIdAndPath(String id,String path);
AjaxResult fileList(Page<Attachment> page, String id); AjaxResult fileList(Page<Attachment> page, String id);
} }

View File

@ -2,6 +2,7 @@ package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest; import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest; import com.ydool.staff.request.PersonnelUpdateRequest;
@ -47,6 +48,11 @@ public interface IPersonnelService {
AjaxResult updatePersonnel(PersonnelUpdateRequest personnelDeleteRequest); AjaxResult updatePersonnel(PersonnelUpdateRequest personnelDeleteRequest);
/**
* 人员变更
* @param request
* @return
*/
AjaxResult updateChange(ChangeRequest request);
} }

View File

@ -0,0 +1,21 @@
package com.ydool.staff.service.impl;
import com.ydool.common.base.BaseService;
import com.ydool.staff.entity.Alteration;
import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.service.IAlterationService;
import org.springframework.stereotype.Service;
/**
* <p>
* 变更记录表 服务类
* </p>
*
* @author msh
* @since 2023-02-06
*/
@Service
public class AlterationServiceImpl extends BaseService<AlterationMapper, Alteration> implements IAlterationService {
}

View File

@ -6,12 +6,10 @@ import com.ydool.common.base.BaseService;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.mapper.AttachmentMapper; import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.service.IAttachmentService; import com.ydool.staff.service.IAttachmentService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
@ -39,8 +37,9 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
} }
@Override @Override
public Attachment selectFile(String path, String id) { public Attachment selectByIdAndPath(String id, String path) {
return getOne(new LambdaQueryWrapper<Attachment>().eq(Attachment::getPath, path).eq(Attachment::getTargetId, id)); Attachment one = getOne(new LambdaQueryWrapper<Attachment>().eq(Attachment::getPath, path).eq(Attachment::getTargetId, id));
return one;
} }
@Override @Override

View File

@ -1,28 +1,42 @@
package com.ydool.staff.service.impl; package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.PersonnelByExchangeDto; import com.ydool.staff.dto.PersonnelByExchangeDto;
import com.ydool.staff.dto.PersonnelDto; import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.Alteration;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel; import com.ydool.staff.entity.Personnel;
import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelMapper; import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.request.AttachmentRequest; import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest; import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest; import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IAttachmentService; import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IPersonnelService; import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.entity.Dept;
import com.ydool.system.mapper.DeptMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils; import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -38,6 +52,15 @@ import java.util.stream.Collectors;
public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel> implements IPersonnelService { public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel> implements IPersonnelService {
@Resource @Resource
private IAttachmentService attachmentService; private IAttachmentService attachmentService;
@Resource
private PersonnelMapper personnelMapper;
@Resource
private AlterationMapper alterationMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private DeptMapper deptMapper;
/** /**
* 人员列表 * 人员列表
@ -46,12 +69,23 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
public AjaxResult personnelList(Page page , String id) { public AjaxResult personnelList(Page page , String id) {
if (ObjectUtil.isNotNull(id)){ if (ObjectUtil.isNotNull(id)){
return AjaxResult.ok().data(get(id)); Personnel personnel = personnelMapper.selectById(id);
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
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);
} }
Page personnelPage = page(page, new LambdaQueryWrapper<>()); Page personnelPage = page(page, new LambdaQueryWrapper<>());
List<Personnel> list = personnelPage.getRecords(); List<Personnel> list = personnelPage.getRecords();
personnelPage.setRecords(list.stream().map(e->{ personnelPage.setRecords(list.stream().map(e->{
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class); PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
Organization organization = organizationMapper.selectById(e.getCompanyName());
Dept dept = deptMapper.selectById(e.getPresentDept());
dto.setPresentDept(dept.getName());
dto.setCompanyName(organization.getCompanyName());
dto.setCreatedAt(e.getCreatedAt()); dto.setCreatedAt(e.getCreatedAt());
return dto; return dto;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
@ -107,6 +141,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) { public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) {
Personnel per = get(updateRequest.getId());
Personnel personnel = BeanUtil.copyProperties(updateRequest, Personnel.class); Personnel personnel = BeanUtil.copyProperties(updateRequest, Personnel.class);
List<AttachmentRequest> cardFile = updateRequest.getCardFile(); List<AttachmentRequest> cardFile = updateRequest.getCardFile();
List<AttachmentRequest> educationFile = updateRequest.getEducationFile(); List<AttachmentRequest> educationFile = updateRequest.getEducationFile();
@ -115,12 +150,68 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
personnel.setEducationFile(StringUtils.join(saveFilePath(educationFile,Personnel.EDUCATION_FILE,"update",personnel.getId()),',')); personnel.setEducationFile(StringUtils.join(saveFilePath(educationFile,Personnel.EDUCATION_FILE,"update",personnel.getId()),','));
personnel.setAuditFile(StringUtils.join(saveFilePath(auditFile,Personnel.AUDIT_FILE,"update",personnel.getId()),',')); personnel.setAuditFile(StringUtils.join(saveFilePath(auditFile,Personnel.AUDIT_FILE,"update",personnel.getId()),','));
boolean update = updateById(personnel); boolean update = updateById(personnel);
String type ="personnel";
if (update){
saveAlteration("民族更改",per.getNation(),updateRequest.getNation(),type,updateRequest.getId());
saveAlteration("政治面貌更改",per.getPoliticsStatus(),updateRequest.getPoliticsStatus(),type,updateRequest.getId());
saveAlteration("学历更改",per.getEducation(),updateRequest.getEducation(),type,updateRequest.getId());
saveAlteration("是否应届毕业生更改",per.getFreshGraduate(),updateRequest.getFreshGraduate(),type,updateRequest.getId());
saveAlteration("毕业院校更改",per.getAcademy(),updateRequest.getAcademy(),type,updateRequest.getId());
saveAlteration("专业更改",per.getSpecialty(),updateRequest.getSpecialty(),type,updateRequest.getId());
saveAlteration("所在部门更改",per.getPresentDept(),updateRequest.getPresentDept(),type,updateRequest.getId());
saveAlteration("合同形式更改",per.getContractModality(),updateRequest.getContractModality(),type,updateRequest.getId());
saveAlteration("身份证附件更改",per.getCardFile(),personnel.getCardFile(),type,updateRequest.getId());
saveAlteration("学历证书附件更改",per.getEducationFile(),personnel.getEducationFile(),type,updateRequest.getId());
saveAlteration("审批资料附件更改",per.getAuditFile(),personnel.getAuditFile(),type,updateRequest.getId());
}
saveAttachment(cardFile,Personnel.CARD_FILE,personnel.getId()); saveAttachment(cardFile,Personnel.CARD_FILE,personnel.getId());
saveAttachment(educationFile,Personnel.EDUCATION_FILE,personnel.getId()); saveAttachment(educationFile,Personnel.EDUCATION_FILE,personnel.getId());
saveAttachment(auditFile,Personnel.AUDIT_FILE,personnel.getId()); saveAttachment(auditFile,Personnel.AUDIT_FILE,personnel.getId());
return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!"); return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!");
} }
@Override
public AjaxResult updateChange(ChangeRequest request) {
Personnel per = get(request.getId());
Personnel personnel = BeanUtil.copyProperties(request, Personnel.class);
List<AttachmentRequest> cardFiles = request.getCardFiles();
List<AttachmentRequest> jobTitleFiles = request.getJobTitleFiles();
List<AttachmentRequest> engageFiles = request.getEngageFiles();
List<AttachmentRequest> educationFiles = request.getEducationFiles();
List<AttachmentRequest> auditFiles = request.getAuditFiles();
personnel.setCardFile(StringUtils.join(saveFilePath(cardFiles,Personnel.CARD_FILE,"Change",personnel.getId()),','));
personnel.setJobTitleFile(StringUtils.join(saveFilePath(jobTitleFiles,Personnel.JOBTITLE_FILE,"Change",personnel.getId()),','));
personnel.setEngageFile(StringUtils.join(saveFilePath(engageFiles,Personnel.ENGAGE_FILE,"Change",personnel.getId()),','));
personnel.setEducationFile(StringUtils.join(saveFilePath(educationFiles,Personnel.EDUCATION_FILE,"Change",personnel.getId()),','));
personnel.setAuditFile(StringUtils.join(saveFilePath(auditFiles,Personnel.AUDIT_FILE,"Change",personnel.getId()),','));
boolean update = updateById(personnel);
String type ="Change";
if (update){
saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,request.getId());
saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId());
saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId());
saveAlteration("岗位职务更改",per.getPosition(),request.getPosition(),type,request.getId());
saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,request.getId());
saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,request.getId());
saveAlteration("年薪更改",per.getAnnualSalary(),request.getAnnualSalary(),type,request.getId());
saveAlteration("退休时间更改",per.getRetirementTime(),request.getRetirementTime(),type,request.getId());
saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,request.getId());
saveAlteration("身份证附件更改",per.getCardFile(),personnel.getCardFile(),type,request.getId());
saveAlteration("聘任证书附件更改",per.getEngageFile(),personnel.getEngageFile(),type,request.getId());
saveAlteration("职称证书附件更改",per.getJobTitleFile(),personnel.getJobTitleFile(),type,request.getId());
saveAlteration("学历证书附件更改",per.getEducationFile(),personnel.getEducationFile(),type,request.getId());
saveAlteration("审批资料附件更改",per.getAuditFile(),personnel.getAuditFile(),type,request.getId());
}
saveAttachment(cardFiles,Personnel.CARD_FILE,personnel.getId());
saveAttachment(jobTitleFiles,Personnel.JOBTITLE_FILE,personnel.getId());
saveAttachment(engageFiles,Personnel.ENGAGE_FILE,personnel.getId());
saveAttachment(educationFiles,Personnel.EDUCATION_FILE,personnel.getId());
saveAttachment(auditFiles,Personnel.AUDIT_FILE,personnel.getId());
return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!");
}
/** /**
* 保存附件 * 保存附件
* @param file * @param file
@ -128,6 +219,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
* @param id * @param id
*/ */
public void saveAttachment(List<AttachmentRequest> file,String type, String id){ public void saveAttachment(List<AttachmentRequest> file,String type, String id){
if (CollectionUtil.isNotEmpty(file)){
for (AttachmentRequest request : file) { for (AttachmentRequest request : file) {
Attachment attachment = BeanUtil.copyProperties(request, Attachment.class); Attachment attachment = BeanUtil.copyProperties(request, Attachment.class);
attachment.setTargetType(type); attachment.setTargetType(type);
@ -136,6 +228,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
} }
}
/** /**
* 保存附件返路径 * 保存附件返路径
* @param file * @param file
@ -145,6 +239,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
* @return * @return
*/ */
public ArrayList<String> saveFilePath(List<AttachmentRequest> file, String type, String args, String id){ public ArrayList<String> saveFilePath(List<AttachmentRequest> file, String type, String args, String id){
if (CollectionUtil.isNotEmpty(file)){
ArrayList<String> path = new ArrayList<>(); ArrayList<String> path = new ArrayList<>();
for (AttachmentRequest request : file) { for (AttachmentRequest request : file) {
if ("update".equals(args)){ if ("update".equals(args)){
@ -154,5 +249,38 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
return path; return path;
} }
return null;
}
public void saveAlteration(String details,Object before ,Object after,String type, String id){
if (ObjectUtil.isNotNull(after)){
Alteration alteration = new Alteration();
alteration.setDetails(details);
alteration.setType(type);
alteration.setRelevancyId(id);
alteration.setBeforeChange((String) before);
alteration.setAfterChange((String) after);
alterationMapper.insert(alteration);
}
}
public List<AttachmentDto> nameAndPath(String file,String id){
if (StrUtil.isNotBlank(file)){
List<String> cardFile = Arrays.asList(file.split(","));
ArrayList<AttachmentDto> attachmentDtos = new ArrayList<>();
AttachmentDto dto = new AttachmentDto();
for (String s : cardFile) {
Attachment attachment = attachmentService.selectByIdAndPath(id, s);
if (ObjectUtil.isNotEmpty(attachment)){
dto.setName(attachment.getName());
dto.setPath(attachment.getPath());
dto.setSize(attachment.getSize());
attachmentDtos.add(dto);
}
}
return attachmentDtos;
}
return null;
}
} }