人员模块多条件查询

This commit is contained in:
mash 2023-02-08 16:48:02 +08:00
parent 42a9a604cd
commit bf4a9217f2
13 changed files with 368 additions and 85 deletions

View File

@ -0,0 +1,46 @@
package com.ydool.common.constant;
/**
* @author msh
* @version 1.0
* @date 2023/2/8 11:04
*/
public class AgesConst {
/**
*身份证附件
*/
public static final String CARD_FILE = "card";
/**
* 聘任证书附件
*/
public static final String ENGAGE_FILE = "engage";
/**
* 职称证书附件
*/
public static final String JOBTITLE_FILE = "jobtitle";
/**
* 学历证书附件
*/
public static final String EDUCATION_FILE = "education";
/**
* 审批资料附件
*/
public static final String AUDIT_FILE = "audit";
/**
* 新增类型参数
*/
public static final String SAVE = "save";
/**
* 修改类型参数
*/
public static final String UPDATE = "update";
/**
* 附件所属变更
*/
public static final String CHANGE = "Change";
/**
* 附件所属人员
*/
public static final String PERSONNEL = "personnel";
}

View File

@ -39,6 +39,7 @@ public interface UrlConstant {
String ORGANIZATION = API + "/organization";
String PARTY_ORGANIZATION = API + "/party_organization";
String DIRECTORS_SUPERVISORS = API + "/directors_supervisors";
String ALTERATION = API + "/alteration";

View File

@ -0,0 +1,40 @@
package com.ydool.staff.controller;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.service.IAlterationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author msh
* @version 1.0
* @date 2023/2/7 17:04
*/
@RestController
@RequestMapping(UrlConstant.ALTERATION)
@Api(tags = "人员变更", value = "人员变更")
@ApiSupport(order = 9)
public class AlterationController extends BaseController {
@Resource
private IAlterationService alterationService;
@GetMapping( "alterationPage")
@ApiOperation(value = "变更记录列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "员工id")})
public AjaxResult alterationPage(String id){
return alterationService.alterationList(id);
}
}

View File

@ -8,6 +8,7 @@ import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.UploadUtils;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest;
@ -40,14 +41,15 @@ public class PersonnelController extends BaseController {
@Autowired
IAttachmentService attachmentService;
@GetMapping( "personnelList")
@PostMapping( "personnelList")
@ApiOperation(value = "人员列表,传id查一条",response = PersonnelDto.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "orderBy", value = "排序顺序 降序desc升序asc"),
@ApiImplicitParam(name = "column", value = "排序字段 字段名"),
@ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数"),
@ApiImplicitParam(name = "id", value = "人员id")})
public AjaxResult personnelList(String id){
return personnelService.personnelList(getPage(),id);
@ApiImplicitParam(name = "size", value = "每页条数")})
public AjaxResult personnelList(@RequestBody SelectRequest request, String orderBy,String column){
return personnelService.personnelList(getPage(),request,orderBy,column);
}
@PostMapping(value = "savePersonnel")
@ -72,6 +74,7 @@ public class PersonnelController extends BaseController {
return personnelService.updateChange(request);
}
@GetMapping("/download")
@ApiOperation(value = "下载文件")
@ApiImplicitParams({@ApiImplicitParam(name = "path", value = "文件路径"), @ApiImplicitParam(name = "fileName", value = "文件名")})

View File

@ -0,0 +1,37 @@
package com.ydool.staff.dto;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author msh
* @version 1.0
* @date 2023/2/7 17:11
*/
@Data
public class AlterationDto {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "变更前")
private String beforeChange;
@ApiModelProperty(value = "变更后")
private String afterChange;
@ApiModelProperty(value = "变更内容")
private String details;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdAt;
@ApiModelProperty(value = "变更人")
private String createdName;
}

View File

@ -44,4 +44,8 @@ public class Attachment extends BaseEntity{
@TableField(exist = false)
private String suffix;
@ApiModelProperty(value = "附件状态0暂存 1已存")
private Integer fileState;
}

View File

@ -32,12 +32,6 @@ public class Personnel extends BaseEntity {
private static final long serialVersionUID = 1L;
public static final String CARD_FILE = "card";
public static final String ENGAGE_FILE = "engage";
public static final String JOBTITLE_FILE = "jobtitle";
public static final String EDUCATION_FILE = "education";
public static final String AUDIT_FILE = "audit";
@ApiModelProperty(value = "统一社会信用代码")
private String socialCreditCode;
@ -155,4 +149,7 @@ public class Personnel extends BaseEntity {
@ApiModelProperty(value = "变更标志")
private String alterationSign;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝")
private Integer auditState;
}

View File

@ -0,0 +1,75 @@
package com.ydool.staff.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author msh
* @version 1.0
* @date 2023/2/8 13:55
*/
@Data
public class SelectRequest {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "文件名")
private String fileName;
@ApiModelProperty(value = "姓名")
private String userName;
@ApiModelProperty(value = "企业名称")
private String companyName;
@ApiModelProperty(value = "身份证号")
private String numberId;
@ApiModelProperty(value = "所在部门")
private String presentDept;
@ApiModelProperty(value = "政治面貌")
private String politicsStatus;
@ApiModelProperty(value = "录用方式")
private String hireType;
@ApiModelProperty(value = "岗位职务")
private String position;
@ApiModelProperty(value = "合同形式")
private String contractModality;
@ApiModelProperty(value = "执业资格证书")
private String qualification;
@ApiModelProperty(value = "专业技术职称")
private String jobTitle;
@ApiModelProperty(value = "人员类型")
private String personnelType;
@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 resignationTime;
@ApiModelProperty(value = "工作状态")
private String workState;
@ApiModelProperty(value = "人员招聘单号")
private String recruitNumber;
@ApiModelProperty(value = "变更标志")
private String alterationSign;
}

View File

@ -35,7 +35,7 @@ public class PersonnelUpdateRequest {
@ApiModelProperty(value = "是否应届毕业生")
@NotBlank(message = "是否应届毕业生不能为空")
private Boolean freshGraduate;
private Integer freshGraduate;
@ApiModelProperty(value = "毕业院校")
@NotBlank(message = "毕业院校不能为空")

View File

@ -1,5 +1,8 @@
package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
/**
* <p>
* 变更记录表 服务类
@ -10,5 +13,7 @@ package com.ydool.staff.service;
*/
public interface IAlterationService {
AjaxResult alterationList(String id);
}

View File

@ -2,6 +2,7 @@ package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest;
@ -22,7 +23,7 @@ public interface IPersonnelService {
* 人员列表
* @return
*/
AjaxResult personnelList(Page page , String id);
AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column);
AjaxResult personnelByExchangeList();

View File

@ -1,11 +1,26 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.spring.SpringUtil;
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.data.dto.AjaxResult;
import com.ydool.staff.dto.AlterationDto;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.entity.Alteration;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.service.IAlterationService;
import com.ydool.system.entity.Dept;
import com.ydool.system.entity.User;
import com.ydool.system.mapper.UserMapper;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 变更记录表 服务类
@ -17,5 +32,19 @@ import org.springframework.stereotype.Service;
@Service
public class AlterationServiceImpl extends BaseService<AlterationMapper, Alteration> implements IAlterationService {
@Override
public AjaxResult alterationList(String id) {
List<Alteration> list = list(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id));
List<AlterationDto> alterationDtos = BeanUtil.copyToList(list, AlterationDto.class);
for (Alteration dto : list) {
UserMapper userMapper = SpringUtil.getBean(UserMapper.class);
User user = userMapper.selectById(dto.getCreatedId());
for (AlterationDto alterationDto : alterationDtos) {
alterationDto.setCreatedName(user.getUserName());
}
}
return AjaxResult.ok().data(alterationDtos);
}
}

View File

@ -5,8 +5,10 @@ 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.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.PersonnelByExchangeDto;
@ -14,9 +16,12 @@ 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.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;
@ -58,7 +63,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Resource
private AlterationMapper alterationMapper;
@Resource
private OrganizationMapper organizationMapper;
private CompanyNameMapper companyNameMapper;
@Resource
private DeptMapper deptMapper;
@ -68,9 +73,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
* @return
*/
@Override
public AjaxResult personnelList(Page page , String id) {
if (ObjectUtil.isNotNull(id)){
Personnel personnel = personnelMapper.selectById(id);
public AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column) {
if (ObjectUtil.isNotNull(request.getId())){
Personnel personnel = personnelMapper.selectById(request.getId());
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
personnelUpdateDto.setCardFiles(nameAndPath(personnel.getCardFile(), personnel.getId()));
personnelUpdateDto.setEngageFiles(nameAndPath(personnel.getEngageFile(), personnel.getId()));
@ -79,14 +84,16 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
personnelUpdateDto.setAuditFiles(nameAndPath(personnel.getAuditFile(), personnel.getId()));
return AjaxResult.ok().data(personnelUpdateDto);
}
Page personnelPage = page(page, new LambdaQueryWrapper<>());
QueryWrapper wrapper = selectWrapper(request, orderBy, column);
Page personnelPage = page(page, wrapper);
List<Personnel> list = personnelPage.getRecords();
personnelPage.setRecords(list.stream().map(e->{
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
Organization organization = organizationMapper.selectById(e.getCompanyName());
CompanyName companyName = companyNameMapper.selectById(e.getCompanyName());
Dept dept = deptMapper.selectById(e.getPresentDept());
dto.setPresentDept(dept.getName());
dto.setCompanyName(organization.getCompanyName());
dto.setCompanyName(companyName.getCompanyName());
dto.setCreatedAt(e.getCreatedAt());
return dto;
}).collect(Collectors.toList()));
@ -110,17 +117,17 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Transactional(rollbackFor = Exception.class)
public AjaxResult savePersonnel(PersonnelRequest personnelRequest) {
Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class);
personnel.setCardFile(StringUtils.join(saveFilePath(personnelRequest.getCardFile(),Personnel.CARD_FILE,"",""),','));
personnel.setEngageFile(StringUtils.join(saveFilePath(personnelRequest.getEngageFile(),Personnel.ENGAGE_FILE,"",""),','));
personnel.setJobTitleFile(StringUtils.join(saveFilePath(personnelRequest.getJobTitleFile(),Personnel.EDUCATION_FILE,"",""),','));
personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(),Personnel.JOBTITLE_FILE,"",""),','));
personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(),Personnel.AUDIT_FILE,"",""),','));
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,""),','));
boolean save = save(personnel);
saveAttachment(personnelRequest.getCardFile(),Personnel.CARD_FILE,personnel.getId());
saveAttachment(personnelRequest.getEngageFile(),Personnel.ENGAGE_FILE,personnel.getId());
saveAttachment(personnelRequest.getEducationFile(),Personnel.EDUCATION_FILE,personnel.getId());
saveAttachment(personnelRequest.getJobTitleFile(),Personnel.JOBTITLE_FILE,personnel.getId());
saveAttachment(personnelRequest.getAuditFile(),Personnel.AUDIT_FILE,personnel.getId());
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("保存失败!");
}
@ -143,16 +150,16 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Transactional(rollbackFor = Exception.class)
public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) {
Personnel per = get(updateRequest.getId());
Personnel personnel = BeanUtil.copyProperties(updateRequest, Personnel.class);
List<AttachmentRequest> cardFile = updateRequest.getCardFile();
List<AttachmentRequest> educationFile = updateRequest.getEducationFile();
List<AttachmentRequest> auditFile = updateRequest.getAuditFile();
personnel.setCardFile(StringUtils.join(saveFilePath(cardFile,Personnel.CARD_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()),','));
boolean update = updateById(personnel);
String type ="personnel";
if (update){
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()),',');
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());
saveAlteration("政治面貌更改",per.getPoliticsStatus(),updateRequest.getPoliticsStatus(),type,updateRequest.getId());
saveAlteration("学历更改",per.getEducation(),updateRequest.getEducation(),type,updateRequest.getId());
@ -161,34 +168,35 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
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());
saveAlteration("身份证附件更改",per.getCardFile(),card,type,updateRequest.getId());
saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,updateRequest.getId());
saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,updateRequest.getId());
}
saveAttachment(cardFile,Personnel.CARD_FILE,personnel.getId());
saveAttachment(educationFile,Personnel.EDUCATION_FILE,personnel.getId());
saveAttachment(auditFile,Personnel.AUDIT_FILE,personnel.getId());
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("修改失败!");
}
@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){
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());
saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId());
saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId());
@ -198,18 +206,18 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
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());
saveAlteration("身份证附件更改",per.getCardFile(),card,type,request.getId());
saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,request.getId());
saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId());
saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId());
saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId());
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("修改失败!");
}
@ -219,12 +227,17 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
* @param type
* @param id
*/
public void saveAttachment(List<AttachmentRequest> file,String type, String id){
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)){
attachment.setFileState(0);
}else {
attachment.setFileState(1);
}
attachmentService.savePersonnel(attachment);
}
}
@ -243,7 +256,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
if (CollectionUtil.isNotEmpty(file)){
ArrayList<String> path = new ArrayList<>();
for (AttachmentRequest request : file) {
if ("update".equals(args)){
if (AgesConst.UPDATE.equals(args)){
attachmentService.deleteById(type,id);
}
path.add(request.getPath());
@ -254,7 +267,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
public void saveAlteration(String details,Object before ,Object after,String type, String id){
if (ObjectUtil.isNotNull(after)){
if (!before.equals(after)){
Alteration alteration = new Alteration();
alteration.setDetails(details);
alteration.setType(type);
@ -267,7 +280,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
alteration.setAfterChange(after.toString());
alterationMapper.insert(alteration);
}
}
public List<AttachmentDto> nameAndPath(String file,String id){
if (StrUtil.isNotBlank(file)){
@ -288,5 +300,38 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
return null;
}
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.getRecruitNumber()),Personnel::getRecruitNumber,request.getRecruitNumber())
.eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign());
wrapper.lambda().like(Personnel::getUserName,request.getUserName())
.like(Personnel::getNumberId,request.getNumberId())
/*.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);
}
if ("asc".equals(orderBy) && StrUtil.isNotBlank(column)) {
wrapper.orderByAsc(column);
}
return wrapper;
}
}