审核改动

This commit is contained in:
mash 2023-02-22 13:53:03 +08:00
parent 31a2f3ede5
commit 588830390a
4 changed files with 165 additions and 124 deletions

View File

@ -144,12 +144,18 @@ public class Personnel extends BaseEntity {
@ApiModelProperty(value = "审批资料附件") @ApiModelProperty(value = "审批资料附件")
private String auditFile; private String auditFile;
@ApiModelProperty(value = "变更标志") @ApiModelProperty(value = "变更标志: 0未变更 1变更中 2变更完成")
private String alterationSign; private String alterationSign;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝") @ApiModelProperty(value = "审批状态 0 未送审 1 待人事审批2待领导审批3已通过4已拒绝")
private Integer auditState; private Integer auditState;
@ApiModelProperty(value = "变更表变更标志: 0未变更 1变更中 2变更完成")
private String changeAlterationSign;
@ApiModelProperty(value = "变更表审批状态 0 未送审 1 待人事审批2 待领导审批3已通过4已拒绝")
private Integer changeAuditState;
@ApiModelProperty(value = "单据状态") @ApiModelProperty(value = "单据状态")
private String receipts; private String receipts;

View File

@ -71,5 +71,8 @@ public class SelectRequest {
@ApiModelProperty(value = "变更标志") @ApiModelProperty(value = "变更标志")
private String alterationSign; private String alterationSign;
@ApiModelProperty(value = "变更表变更标志")
private String changeAlterationSign;
} }

View File

@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -41,9 +42,10 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
private UserMapper userMapper; private UserMapper userMapper;
@Resource @Resource
private AuditLogMapper auditLogMapper; private AuditLogMapper auditLogMapper;
@Resource @Resource
private IPersonnelService personnelService; private OrganizationMapper organizationMapper;
@Resource
private DirectorsSupervisorsMapper directorsSupervisorsMapper;
@Resource @Resource
private AuditMapper auditMapper; private AuditMapper auditMapper;
@ -52,10 +54,6 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
private PersonnelMapper personnelMapper; private PersonnelMapper personnelMapper;
@Resource @Resource
private PersonnelMiddleMapper personnelMiddleMapper; private PersonnelMiddleMapper personnelMiddleMapper;
@Autowired
DirectorsSupervisorsMapper directorsSupervisorsMapper;
@Autowired
OrganizationMapper organizationMapper;
@Override @Override
public AjaxResult getAuditList(Page page) { public AjaxResult getAuditList(Page page) {
@ -67,24 +65,29 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult audit(AuditRequest auditRequest) { public AjaxResult audit(AuditRequest auditRequest) {
String loginId = (String) StpUtil.getLoginId(); String loginId = (String) StpUtil.getLoginId();
User loginUser = userMapper.selectById(loginId);
Audit one = getOne(new LambdaQueryWrapper<Audit>() Audit one = getOne(new LambdaQueryWrapper<Audit>()
.eq(Audit::getPersonnelId, auditRequest.getPersonnelId()) .eq(Audit::getPersonnelId, auditRequest.getPersonnelId())
.eq(Audit::getPerType,auditRequest.getType()) .eq(Audit::getPerType,auditRequest.getType())
.eq(Audit::getAuditOrder, ArgsConst.WAITING)
.eq(Audit::getApprover, loginId)); .eq(Audit::getApprover, loginId));
if (ArgsConst.WAITING.equals(one.getAuditState())){ System.out.println("one = " + one);
one.setOpinion(auditRequest.getAuditOpinion());
one.setApproverTime(new Date());
if(ObjectUtil.isEmpty(one)){
return AjaxResult.fail().msg("该用户不能审批!"); return AjaxResult.fail().msg("该用户不能审批!");
} }
if (ArgsConst.PASS.equals(one.getAuditState())){ if(ArgsConst.PASS.equals(one.getAuditState())){
return AjaxResult.fail().msg("用户已审批,请勿重复操作!"); return AjaxResult.fail().msg("用户已审批,请勿重复操作!");
} }
List<Audit> list = list(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
//同意 //同意
if ("2".equals(auditRequest.getStatus())){ if ("2".equals(auditRequest.getStatus())){
for (Audit audit : list) {
User byId = userMapper.selectById(audit.getApprover());
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR)); Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
if (byId.getLoginName().equals(director.getParamValue())){ System.out.println("director = " + director);
one.setAuditOrder(ArgsConst.PASS); if (loginUser.getLoginName().equals(director.getParamValue())){
System.out.println("111111111111111");
one.setAuditOrder(ArgsConst.FIRST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one); boolean update = updateById(one);
if (update){ if (update){
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
@ -93,13 +96,19 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
Audit auditOne = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getApprover, user.getId()).eq(Audit::getPersonnelId, auditRequest.getPersonnelId())); Audit auditOne = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getApprover, user.getId()).eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
auditOne.setAuditOrder(ArgsConst.WAITING); auditOne.setAuditOrder(ArgsConst.WAITING);
updateById(auditOne); updateById(auditOne);
Personnel personnel = personnelMapper.selectById(auditOne.getPersonnelId());
personnel.setAuditState(2);
personnelMapper.updateById(personnel);
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般初审通过"); saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般初审通过");
} }
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!"); return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
} }
Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
if (leadership.getParamValue().equals(byId.getLoginName())){ System.out.println("leadership = " + leadership);
one.setAuditOrder(ArgsConst.PASS); if (leadership.getParamValue().equals(loginUser.getLoginName())){
System.out.println("22222222222222");
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one); boolean update = updateById(one);
if (update){ if (update){
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般终审通过"); saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般终审通过");
@ -108,6 +117,8 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
Personnel personnelOne = personnelMapper.selectById(middle.getAfterId()); Personnel personnelOne = personnelMapper.selectById(middle.getAfterId());
String id = personnelOne.getId(); String id = personnelOne.getId();
personnelOne.setState("2"); personnelOne.setState("2");
personnelOne.setAlterationSign("2");
personnelOne.setAuditState(3);
personnelOne.setId(personnel.getId()); personnelOne.setId(personnel.getId());
personnel.setId(id); personnel.setId(id);
personnel.setState("0"); personnel.setState("0");
@ -119,18 +130,16 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!"); return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
} }
} }
}
//拒绝 //拒绝
for (Audit audit : list) {
List<Audit> auditList = list(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId())); List<Audit> auditList = list(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
User byId = userMapper.selectById(audit.getAuditOrder());
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR)); Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getBeforeId, auditRequest.getPersonnelId()).eq(PersonnelMiddle::getState, "1")); PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getBeforeId, auditRequest.getPersonnelId()).eq(PersonnelMiddle::getState, "1"));
Personnel afterPersonnel = personnelMapper.selectById(middle.getAfterId()); Personnel afterPersonnel = personnelMapper.selectById(middle.getAfterId());
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId()); Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
if (byId.getLoginName().equals(director.getParamValue())){ if (loginUser.getLoginName().equals(director.getParamValue())){
one.setAuditOrder(ArgsConst.REJECT); one.setAuditOrder(ArgsConst.REJECT);
one.setOpinion(audit.getOpinion()); one.setOpinion(auditRequest.getAuditOpinion());
boolean update = updateById(one); boolean update = updateById(one);
if (update){ if (update){
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般初审拒绝"); saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般初审拒绝");
@ -142,9 +151,9 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!"); return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
} }
Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
if (leadership.getParamValue().equals(byId.getLoginName())){ if (leadership.getParamValue().equals(loginUser.getLoginName())){
one.setAuditOrder(ArgsConst.REJECT); one.setAuditOrder(ArgsConst.REJECT);
one.setOpinion(audit.getOpinion()); one.setOpinion(auditRequest.getAuditOpinion());
boolean update = updateById(one); boolean update = updateById(one);
if (update){ if (update){
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般终审拒绝"); saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般终审拒绝");
@ -155,11 +164,9 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
} }
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!"); return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
} }
}
return null; return null;
} }
@Override
public Integer saveAuditLog(String personnelId,String approverId,String auditSate){ public Integer saveAuditLog(String personnelId,String approverId,String auditSate){
AuditLog auditLog = new AuditLog(); AuditLog auditLog = new AuditLog();
auditLog.setPersonnelId(personnelId); auditLog.setPersonnelId(personnelId);
@ -167,11 +174,10 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
auditLog.setAuditState(auditSate); auditLog.setAuditState(auditSate);
return auditLogMapper.insert(auditLog); return auditLogMapper.insert(auditLog);
} }
public void updateByPer(String afterId,Personnel personnel){ public void updateByPer(String afterId,Personnel personnel){
delete(afterId); delete(afterId);
personnel.setAuditState(0); personnel.setAuditState(4);
personnel.setAlterationSign("0"); personnel.setAlterationSign("2");
personnelMapper.updateById(personnel); personnelMapper.updateById(personnel);
} }

View File

@ -235,19 +235,20 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
per.setAlterationSign("1"); per.setAlterationSign("1");
boolean update = updateById(per); boolean update = updateById(per);
middle.setBeforeId(per.getId()); middle.setBeforeId(per.getId());
per.setNation(saveAlteration("民族更改", per.getNation(), updateRequest.getNation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getNation))); per.setNation(saveAlteration("民族更改", per.getNation(), updateRequest.getNation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getNation)).toString());
per.setPoliticsStatus(saveAlteration("政治面貌更改", per.getPoliticsStatus(), updateRequest.getPoliticsStatus(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPoliticsStatus))); per.setPoliticsStatus(saveAlteration("政治面貌更改", per.getPoliticsStatus(), updateRequest.getPoliticsStatus(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPoliticsStatus)).toString());
per.setEducation(saveAlteration("学历更改", per.getEducation(), updateRequest.getEducation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducation))); per.setEducation(saveAlteration("学历更改", per.getEducation(), updateRequest.getEducation(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducation)).toString());
per.setFreshGraduate(saveAlteration("是否应届毕业生更改", per.getFreshGraduate(), updateRequest.getFreshGraduate(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getFreshGraduate))); per.setFreshGraduate(saveAlteration("是否应届毕业生更改", per.getFreshGraduate(), updateRequest.getFreshGraduate(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getFreshGraduate)).toString());
per.setAcademy(saveAlteration("毕业院校更改", per.getAcademy(), updateRequest.getAcademy(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAcademy))); per.setAcademy(saveAlteration("毕业院校更改", per.getAcademy(), updateRequest.getAcademy(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAcademy)).toString());
per.setSpecialty(saveAlteration("专业更改", per.getSpecialty(), updateRequest.getSpecialty(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getSpecialty))); per.setSpecialty(saveAlteration("专业更改", per.getSpecialty(), updateRequest.getSpecialty(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getSpecialty)).toString());
per.setPresentDept(saveAlteration("所在部门更改", per.getPresentDept(), updateRequest.getPresentDept(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPresentDept))); per.setPresentDept(saveAlteration("所在部门更改", per.getPresentDept(), updateRequest.getPresentDept(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getPresentDept)).toString());
per.setContractModality(saveAlteration("合同形式更改", per.getContractModality(), updateRequest.getContractModality(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getContractModality))); per.setContractModality(saveAlteration("合同形式更改", per.getContractModality(), updateRequest.getContractModality(), type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getContractModality)).toString());
per.setCardFile(saveAlteration("身份证附件更改", per.getCardFile(), card, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getCardFile))); per.setCardFile(saveAlteration("身份证附件更改", per.getCardFile(), card, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getCardFile)).toString());
per.setEducationFile(saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile))); per.setEducationFile(saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile)).toString());
per.setAuditFile(saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile))); per.setAuditFile(saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile)).toString());
per.setId(""); per.setId("");
per.setState("1"); per.setState("1");
per.setAlterationSign("1");
save(per); save(per);
middle.setAfterId(per.getId()); middle.setAfterId(per.getId());
personnelMiddleService.savePer(middle); personnelMiddleService.savePer(middle);
@ -267,7 +268,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
List<AttachmentRequest> engageFiles = request.getEngageFiles(); List<AttachmentRequest> engageFiles = request.getEngageFiles();
List<AttachmentRequest> educationFiles = request.getEducationFiles(); List<AttachmentRequest> educationFiles = request.getEducationFiles();
List<AttachmentRequest> auditFiles = request.getAuditFiles(); List<AttachmentRequest> auditFiles = request.getAuditFiles();
if ("1".equals(per.getAlterationSign())) { if ("1".equals(per.getChangeAlterationSign())) {
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!"); return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
} }
String type = ArgsConst.CHANGE; String type = ArgsConst.CHANGE;
@ -276,27 +277,38 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
String engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_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 education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, request.getId()), ',');
String audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, request.getId()), ','); String audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, request.getId()), ',');
per.setAlterationSign("0"); per.setChangeAlterationSign("1");
boolean update = updateById(per); boolean update = updateById(per);
middle.setBeforeId(per.getId()); middle.setBeforeId(per.getId());
per.setHireType(saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getHireType))); per.setHireType(saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getHireType)).toString());
per.setQualification(saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getQualification))); per.setQualification(saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getQualification)).toString());
per.setJobTitle(saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitle))); per.setJobTitle(saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitle)).toString());
per.setPosition(saveAlteration("岗位职务更改",per.getPosition(),request.getPosition(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPosition))); per.setPosition(saveAlteration("岗位职务更改",per.getPosition(),request.getPosition(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPosition)).toString());
per.setWorkState(saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getWorkState))); per.setWorkState(saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getWorkState)).toString());
per.setPersonnelCharacter(saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPersonnelCharacter))); per.setPersonnelCharacter(saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPersonnelCharacter)).toString());
per.setAnnualSalary(Integer.valueOf(saveAlteration("年薪更改",per.getAnnualSalary(),request.getAnnualSalary(),type,request.getId(), ColumnUtil.getFieldName(Personnel::getAnnualSalary)))); per.setAnnualSalary((Integer) saveAlteration("年薪更改", per.getAnnualSalary(), request.getAnnualSalary(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getAnnualSalary)));
per.setRecruitNumber(saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRecruitNumber))); per.setRecruitNumber(saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRecruitNumber)).toString());
per.setCardFile(saveAlteration("身份证附件更改",per.getCardFile(),card,type,request.getId(),ColumnUtil.getFieldName(Personnel::getCardFile))); if (StrUtil.isNotBlank(card)){
per.setEngageFile(saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEngageFile))); per.setCardFile(saveAlteration("身份证附件更改",per.getCardFile(),card,type,request.getId(),ColumnUtil.getFieldName(Personnel::getCardFile)).toString());
per.setJobTitleFile(saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile))); }
per.setEducationFile(saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile))); if (StrUtil.isNotBlank(jobTitle)){
per.setAuditFile(saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile))); per.setEngageFile(saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEngageFile)).toString());
}
if (StrUtil.isNotBlank(engage)){
per.setJobTitleFile(saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile)).toString());
}
if (StrUtil.isNotBlank(education)){
per.setEducationFile(saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile)).toString());
}
if (StrUtil.isNotBlank(audit)){
per.setAuditFile(saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile)).toString());
}
if (ObjectUtil.isNotNull(per.getRetirementTime())){ if (ObjectUtil.isNotNull(per.getRetirementTime())){
per.setRetirementTime(LocalDate.parse(saveAlteration("退休时间更改",per.getRetirementTime(),request.getRetirementTime(),type,request.getId(), ColumnUtil.getFieldName(Personnel::getRetirementTime)))); per.setRetirementTime((LocalDate) saveAlteration("退休时间更改",per.getRetirementTime(),request.getRetirementTime(),type,request.getId(), ColumnUtil.getFieldName(Personnel::getRetirementTime)));
} }
per.setId(""); per.setId("");
per.setState("1"); per.setState("1");
per.setChangeAlterationSign("1");
save(per); save(per);
middle.setAfterId(per.getId()); middle.setAfterId(per.getId());
personnelMiddleService.savePer(middle); personnelMiddleService.savePer(middle);
@ -355,7 +367,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return null; return null;
} }
public String saveAlteration(String details,Object before ,Object after,String type, String id,String fieldName){ public Object saveAlteration(String details,Object before ,Object after,String type, String id,String fieldName){
if (ObjectUtil.isNotNull(after)){ if (ObjectUtil.isNotNull(after)){
if (!after.equals(before)){ if (!after.equals(before)){
Alteration alteration = new Alteration(); Alteration alteration = new Alteration();
@ -372,9 +384,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
alterationMapper.insert(alteration); alterationMapper.insert(alteration);
} }
return (String) after; return after;
} }
return (String) before; return before;
} }
public List<AttachmentDto> nameAndPath(String file, String id) { public List<AttachmentDto> nameAndPath(String file, String id) {
@ -412,7 +424,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
.eq(StrUtil.isNotBlank(request.getWorkState()),Personnel::getWorkState,request.getWorkState()) .eq(StrUtil.isNotBlank(request.getWorkState()),Personnel::getWorkState,request.getWorkState())
.eq(StrUtil.isNotBlank(request.getReceipts()),Personnel::getReceipts,request.getReceipts()) .eq(StrUtil.isNotBlank(request.getReceipts()),Personnel::getReceipts,request.getReceipts())
.eq(Personnel::getState,"2") .eq(Personnel::getState,"2")
.eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign()); .eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign())
.eq(StrUtil.isNotBlank(request.getChangeAlterationSign()),Personnel::getChangeAlterationSign,request.getChangeAlterationSign());
wrapper.lambda().like(Personnel::getUserName,request.getUserName()) wrapper.lambda().like(Personnel::getUserName,request.getUserName())
.like(Personnel::getNumberId,request.getNumberId()) .like(Personnel::getNumberId,request.getNumberId())
.exists(StrUtil.isNotBlank(request.getCompanyName()), "select t2.id from t_lc_company_name t2 where " + .exists(StrUtil.isNotBlank(request.getCompanyName()), "select t2.id from t_lc_company_name t2 where " +
@ -506,21 +520,10 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult giveAudit(GiveAuditRequest request) { public AjaxResult giveAudit(GiveAuditRequest request) {
String loginId = (String) StpUtil.getLoginId();
String[] ids = request.getIds(); String[] ids = request.getIds();
if (ObjectUtil.isNotEmpty(request)){ verifyIds(ids,request.getType());
updatePersonnel(request.getRequest()); String loginId = (String) StpUtil.getLoginId();
}
for (String id : ids) { for (String id : ids) {
Personnel personnel1 = get(id);
System.out.println("personnel1 = " + personnel1);
if (1==(personnel1.getAuditState())) {
return AjaxResult.fail().msg("该数据已送审,请勿重复操作!");
}
if ("0".equals(personnel1.getAlterationSign())){
return AjaxResult.fail().msg("变更数据未保存,不能送审!");
}
for(int i=0;i<=2;i++ ){ for(int i=0;i<=2;i++ ){
Audit audit = new Audit(); Audit audit = new Audit();
audit.setPersonnelId(id); audit.setPersonnelId(id);
@ -578,6 +581,29 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
public AjaxResult verifyIds(String[] ids,String type){
for (String id : ids) {
Personnel personnel = get(id);
System.out.println("personnel1 = " + personnel);
if (ArgsConst.PERSONNEL.equals(type)){
if (1 == (personnel.getAuditState())) {
return AjaxResult.fail().msg("该数据已送审请勿重复操作!");
}
if ("0".equals(personnel.getAlterationSign())) {
return AjaxResult.fail().msg("变更数据未保存,不能送审!");
}
}else if (ArgsConst.CHANGE.equals(type)){
if (1 == (personnel.getChangeAuditState())) {
return AjaxResult.fail().msg("该数据已送审请勿重复操作!");
}
if ("0".equals(personnel.getChangeAlterationSign())) {
return AjaxResult.fail().msg("变更数据未保存,不能送审!");
}
}
}
return null;
}
} }