From 19a3f82ac44f9203e7a322b2f124de35be9cac3b Mon Sep 17 00:00:00 2001 From: zhuyy Date: Thu, 9 Feb 2023 17:11:16 +0800 Subject: [PATCH] update --- .../{AgesConst.java => ArgsConst.java} | 11 +- .../service/impl/AttachmentServiceImpl.java | 3 +- .../impl/DirectorsSupervisorsServiceImpl.java | 5 +- .../service/impl/MechanismServiceImpl.java | 3 +- .../service/impl/OrganizationServiceImpl.java | 3 +- .../service/impl/PersonnelServiceImpl.java | 200 ++++++++---------- 6 files changed, 108 insertions(+), 117 deletions(-) rename src/main/java/com/ydool/common/constant/{AgesConst.java => ArgsConst.java} (80%) diff --git a/src/main/java/com/ydool/common/constant/AgesConst.java b/src/main/java/com/ydool/common/constant/ArgsConst.java similarity index 80% rename from src/main/java/com/ydool/common/constant/AgesConst.java rename to src/main/java/com/ydool/common/constant/ArgsConst.java index 166d18c..f92a1b0 100644 --- a/src/main/java/com/ydool/common/constant/AgesConst.java +++ b/src/main/java/com/ydool/common/constant/ArgsConst.java @@ -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"; + } diff --git a/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java index a7380c9..f862b47 100644 --- a/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java @@ -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 attachmentLambdaQueryWrapper = new LambdaQueryWrapper<>(); attachmentLambdaQueryWrapper.eq(Attachment::getTargetId, id); - attachmentLambdaQueryWrapper.eq(Attachment::getTargetType, "organization"); + attachmentLambdaQueryWrapper.eq(Attachment::getTargetType, ArgsConst.ORGANIZATION); Page attachmentPage = attachmentMapper.selectPage(new Page<>(), attachmentLambdaQueryWrapper); return AjaxResult.ok().data(attachmentPage); } diff --git a/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java index 15cbc23..0d567e9 100644 --- a/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java @@ -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 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 attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper().eq(Attachment::getTargetId, directorsSupervisors.getId()).eq(Attachment::getTargetType, "directors")); + List attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper().eq(Attachment::getTargetId, directorsSupervisors.getId()).eq(Attachment::getTargetType, ArgsConst.DIRECTORS)); List attachmentDtos = BeanUtil.copyToList(attachmentList, AttachmentDto.class); directorsSupervisors.setAttachmentDtoList(attachmentDtos); return AjaxResult.ok().data(directorsSupervisors); diff --git a/src/main/java/com/ydool/staff/service/impl/MechanismServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/MechanismServiceImpl.java index acc84f0..3893ed2 100644 --- a/src/main/java/com/ydool/staff/service/impl/MechanismServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/MechanismServiceImpl.java @@ -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 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); diff --git a/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java index 808ca42..6322c73 100644 --- a/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/OrganizationServiceImpl.java @@ -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 mechanismList = mechanismMapper.selectList(new LambdaQueryWrapper().eq(Mechanism::getOrganizationId, organization.getId())); - List attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper().eq(Attachment::getTargetId, organization.getId()).eq(Attachment::getTargetType, "organization")); + List attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper().eq(Attachment::getTargetId, organization.getId()).eq(Attachment::getTargetType, ArgsConst.ORGANIZATION)); List partyOrganizationList = partyOrganizationMapper.selectList(new LambdaQueryWrapper()); List toList = BeanUtil.copyToList(attachmentList, AttachmentDto.class); OrganizationRequest organizationRequest = new OrganizationRequest(); diff --git a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java index 56336bf..b46c7c2 100644 --- a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java @@ -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 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 cardFile = updateRequest.getCardFile(); List educationFile = updateRequest.getEducationFile(); List 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 engageFiles = request.getEngageFiles(); List educationFiles = request.getEducationFiles(); List 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 file,String type, String id,String ages){ - if (CollectionUtil.isNotEmpty(file)){ + public void saveAttachment(List 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 saveFilePath(List file, String type, String args, String id){ - if (CollectionUtil.isNotEmpty(file)){ + public ArrayList saveFilePath(List file, String type, String args, String id) { + if (CollectionUtil.isNotEmpty(file)) { ArrayList 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(); } - 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 nameAndPath(String file,String id){ - if (StrUtil.isNotBlank(file)){ + + public List nameAndPath(String file, String id) { + if (StrUtil.isNotBlank(file)) { List cardFile = Arrays.asList(file.split(",")); ArrayList 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 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); }