update 人事审批相关01

This commit is contained in:
mash 2023-06-21 16:15:12 +08:00
parent 68964e2461
commit 5f92ddae7a
1 changed files with 42 additions and 27 deletions

View File

@ -188,11 +188,11 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
personnelUpdateDto.setAuditBtn(true);
}
personnelUpdateDto.setBeforeId(id);
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()));
personnelUpdateDto.setCardFiles(nameAndPath(personnel.getCardFile(), id));
personnelUpdateDto.setEngageFiles(nameAndPath(personnel.getEngageFile(), id));
personnelUpdateDto.setEducationFiles(nameAndPath(personnel.getEducationFile(), id));
personnelUpdateDto.setJobTitleFiles(nameAndPath(personnel.getJobTitleFile(), id));
personnelUpdateDto.setAuditFiles(nameAndPath(personnel.getAuditFile(), id));
return AjaxResult.ok().data(personnelUpdateDto);
@ -332,30 +332,47 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult updateChange(PersonnelUpdateRequest request) {
PersonnelMiddle middle = new PersonnelMiddle();
String id = null;
PersonnelMiddle personnelMiddle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, request.getId()).eq(PersonnelMiddle::getState,"1"));
if (ObjectUtil.isNotNull(personnelMiddle)){
id = personnelMiddle.getBeforeId();
}else {
id = request.getId();
}
Personnel per = get(id);
System.out.println("request = " + request.getId());
List<AttachmentRequest> cardFiles = request.getCardFileList();
List<AttachmentRequest> jobTitleFiles = request.getJobTitleFileList();
List<AttachmentRequest> engageFiles = request.getEngageFileList();
List<AttachmentRequest> educationFiles = request.getEducationFileList();
List<AttachmentRequest> auditFiles = request.getAuditFileList();
PersonnelMiddle middle = new PersonnelMiddle();
String type = ArgsConst.CHANGE;
PersonnelMiddle personnelMiddle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, request.getId()).eq(PersonnelMiddle::getState,"1"));
String id = null;String card = null;String jobTitle = null;String engage = null;String education =null;String audit = null;
System.out.println("personnelMiddle = " + personnelMiddle);
if (ObjectUtil.isNotNull(personnelMiddle)){
id = personnelMiddle.getBeforeId();
System.out.println("id" + id);
card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, id), ',');
jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, id), ',');
engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type,id), ',');
education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, id), ',');
audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, id), ',');
saveAttachment(cardFiles, ArgsConst.CARD_FILE, id, ArgsConst.UPDATE);
saveAttachment(jobTitleFiles, ArgsConst.JOBTITLE_FILE, id, ArgsConst.UPDATE);
saveAttachment(engageFiles, ArgsConst.ENGAGE_FILE, id, ArgsConst.UPDATE);
saveAttachment(educationFiles, ArgsConst.EDUCATION_FILE, id, ArgsConst.UPDATE);
saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, id, ArgsConst.UPDATE);
}else {
id = request.getId();
card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, id), ',');
jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, id), ',');
engage = StringUtils.join(saveFilePath(engageFiles, ArgsConst.ENGAGE_FILE, type,id), ',');
education = StringUtils.join(saveFilePath(educationFiles, ArgsConst.EDUCATION_FILE, type, id), ',');
audit = StringUtils.join(saveFilePath(auditFiles, ArgsConst.AUDIT_FILE, type, id), ',');
saveAttachment(cardFiles, ArgsConst.CARD_FILE, id, ArgsConst.UPDATE);
saveAttachment(jobTitleFiles, ArgsConst.JOBTITLE_FILE, id, ArgsConst.UPDATE);
saveAttachment(engageFiles, ArgsConst.ENGAGE_FILE, id, ArgsConst.UPDATE);
saveAttachment(educationFiles, ArgsConst.EDUCATION_FILE, id, ArgsConst.UPDATE);
saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, id, ArgsConst.UPDATE);
}
Personnel per = get(id);
if (per.getChangeAuditState()==2) {
return AjaxResult.fail().msg("待领导审批,不能变更数据");
}
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()), ',');
per.setChangeAlterationSign("1");
boolean update = updateById(per);
middle.setBeforeId(per.getId());
@ -424,11 +441,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
per.setId(personnelMiddle.getAfterId());
updateById(per);
}
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);
if("audit".equals(request.getType())){
GiveAuditRequest req = new GiveAuditRequest();
@ -474,11 +486,14 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
* @return
*/
public ArrayList<String> saveFilePath(List<AttachmentRequest> file, String type, String args, String id) {
System.out.println("file = " + id);
if (CollectionUtil.isNotEmpty(file)) {
ArrayList<String> path = new ArrayList<>();
for (AttachmentRequest request : file) {
if (ArgsConst.UPDATE.equals(args)) {
attachmentService.deleteById(type, id);
} if (ArgsConst.CHANGE.equals(args)) {
attachmentService.deleteById(type, id);
}
path.add(request.getPath());
}
@ -533,8 +548,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
Attachment attachment = attachmentService.selectByIdAndPath(id, s);
if (ObjectUtil.isNotEmpty(attachment)) {
dto.setName(attachment.getName());
dto.setPath(attachment.getPath());
dto.setSize(attachment.getSize());
dto.setPath(attachment.getPath());
dto.setSuffix(attachment.getSuffix());
attachmentDtos.add(dto);
}