update 人事审批相关

This commit is contained in:
mash 2023-06-21 15:10:55 +08:00
parent 7ecdfaf63a
commit 68964e2461
12 changed files with 362 additions and 227 deletions

View File

@ -88,7 +88,7 @@ public class PersonnelController extends BaseController {
@PostMapping(value = "updateChange") @PostMapping(value = "updateChange")
@ApiOperation(value = "人员变更") @ApiOperation(value = "人员变更")
public AjaxResult updateChange(@RequestBody ChangeRequest request){ public AjaxResult updateChange(@RequestBody PersonnelUpdateRequest request){
return personnelService.updateChange(request); return personnelService.updateChange(request);
} }

View File

@ -64,5 +64,8 @@ public class ExchangeOneDto {
@ApiModelProperty(value = "终审意见") @ApiModelProperty(value = "终审意见")
private String finalTrialRemark; private String finalTrialRemark;
@ApiModelProperty(value = "审批按钮")
private boolean auditBtn = false;
} }

View File

@ -29,7 +29,7 @@ public class Audit extends BaseEntity{
@ApiModelProperty(value = "人员id") @ApiModelProperty(value = "人员id")
private String personnelId; private String personnelId;
@ApiModelProperty(value = "审批类型 personnel一般人员 change变更人员") @ApiModelProperty(value = "审批类型 personnel一般人员 change变更人员, exchange :人员选调")
private String perType; private String perType;
@ApiModelProperty(value = "审批状态submit提交 pass通过 reject拒绝") @ApiModelProperty(value = "审批状态submit提交 pass通过 reject拒绝")

View File

@ -74,5 +74,8 @@ public class SelectRequest {
@ApiModelProperty(value = "变更表变更标志") @ApiModelProperty(value = "变更表变更标志")
private String changeAlterationSign; private String changeAlterationSign;
@ApiModelProperty(value = "类型personnel 人员申报change 变更")
private String type;
} }

View File

@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -51,7 +52,7 @@ public class ChangeRequest {
@ApiModelProperty(value = "退休时间") @ApiModelProperty(value = "退休时间")
@NotNull(message = "退休时间不能为空") @NotNull(message = "退休时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date retirementTime; private LocalDate retirementTime;
@ApiModelProperty(value = "人员招聘单号") @ApiModelProperty(value = "人员招聘单号")
private String recruitNumber; private String recruitNumber;
@ -70,4 +71,8 @@ public class ChangeRequest {
@ApiModelProperty(value = "审批资料附件") @ApiModelProperty(value = "审批资料附件")
private List<AttachmentRequest> auditFiles; private List<AttachmentRequest> auditFiles;
@ApiModelProperty(value = "类型save 保存 audit 保存并送审")
private String type;
} }

View File

@ -39,4 +39,7 @@ public class ExchangeRequest {
@ApiModelProperty(value = "选调相关附件") @ApiModelProperty(value = "选调相关附件")
private List<AttachmentDto> attachmentList; private List<AttachmentDto> attachmentList;
@ApiModelProperty(value = "类型save 保存 audit 保存并送审")
private String type;
} }

View File

@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -108,6 +109,13 @@ public class PersonnelRequest {
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date hireDate; private Date hireDate;
@ApiModelProperty(value = "离职时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private LocalDate resignationTime;
@ApiModelProperty(value = "退休时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date retirementTime;
@ApiModelProperty(value = "退休返聘开始时间") @ApiModelProperty(value = "退休返聘开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")

View File

@ -25,9 +25,6 @@ public class PersonnelUpdateRequest {
@ApiModelProperty(value = "姓名") @ApiModelProperty(value = "姓名")
private String userName; private String userName;
@ApiModelProperty(value = "企业名称")
private String companyName;
@ApiModelProperty(value = "性别") @ApiModelProperty(value = "性别")
private String gender; private String gender;
@ -65,12 +62,6 @@ public class PersonnelUpdateRequest {
@ApiModelProperty(value = "专业技术职称") @ApiModelProperty(value = "专业技术职称")
private String jobTitle; private String jobTitle;
@ApiModelProperty(value = "所在部门")
private String presentDept;
@ApiModelProperty(value = "岗位职务")
private String position;
@ApiModelProperty(value = "合同形式") @ApiModelProperty(value = "合同形式")
private String contractModality; private String contractModality;
@ -113,17 +104,21 @@ public class PersonnelUpdateRequest {
private String remark; private String remark;
@ApiModelProperty(value = "身份证附件") @ApiModelProperty(value = "身份证附件")
private List<AttachmentRequest> cardFile; private List<AttachmentRequest> cardFileList;
@ApiModelProperty(value = "聘任证书附件") @ApiModelProperty(value = "聘任证书附件")
private List<AttachmentRequest> engageFile; private List<AttachmentRequest> engageFileList;
@ApiModelProperty(value = "职称证书附件") @ApiModelProperty(value = "职称证书附件")
private List<AttachmentRequest> jobTitleFile; private List<AttachmentRequest> jobTitleFileList;
@ApiModelProperty(value = "学历证书附件") @ApiModelProperty(value = "学历证书附件")
private List<AttachmentRequest> educationFile; private List<AttachmentRequest> educationFileList;
@ApiModelProperty(value = "审批资料附件") @ApiModelProperty(value = "审批资料附件")
private List<AttachmentRequest> auditFile; private List<AttachmentRequest> auditFileList;
@ApiModelProperty(value = "类型save 保存 audit 保存并送审")
private String type;
} }

View File

@ -4,7 +4,6 @@ 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.dto.AttachmentDto; import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.entity.SelectRequest; import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.GiveAuditRequest; import com.ydool.staff.request.GiveAuditRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest; import com.ydool.staff.request.PersonnelRequest;
@ -59,7 +58,7 @@ public interface IPersonnelService {
* @param request * @param request
* @return * @return
*/ */
AjaxResult updateChange(ChangeRequest request); AjaxResult updateChange(PersonnelUpdateRequest request);
void export(PersonnelDeleteRequest param,HttpServletResponse response); void export(PersonnelDeleteRequest param,HttpServletResponse response);

View File

@ -92,12 +92,14 @@ 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();
System.out.println("loginId = " + loginId);
User loginUser = userMapper.selectById(loginId); 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::getAuditOrder, ArgsConst.WAITING)
.eq(Audit::getApprover, loginId)); .eq(Audit::getApprover, loginId));
System.out.println("one = " + one);
if (ObjectUtil.isEmpty(one)) { if (ObjectUtil.isEmpty(one)) {
return AjaxResult.fail().msg("该用户不能审批!"); return AjaxResult.fail().msg("该用户不能审批!");
} }
@ -108,38 +110,6 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
one.setApproverTime(new Date()); one.setApproverTime(new Date());
// 同意 // 同意
if ("2".equals(auditRequest.getStatus())) { if ("2".equals(auditRequest.getStatus())) {
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
if (loginUser.getLoginName().equals(director.getParamValue())) {
one.setAuditOrder(ArgsConst.FIRST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one);
if (update) {
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getLoginName, configMapper.selectOne(new LambdaQueryWrapper<Config>()
.eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)).getParamValue()));
Audit auditOne = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getApprover, user.getId()).eq(Audit::getPerType, auditRequest.getType()).eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
auditOne.setAuditOrder(ArgsConst.WAITING);
updateById(auditOne);
if (ArgsConst.PERSONNEL.equals(auditRequest.getType()) || ArgsConst.CHANGE.equals(auditRequest.getType())) {
Personnel personnel = personnelMapper.selectById(auditOne.getPersonnelId());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())) {
personnel.setAuditState(2);
personnel.setFirstTrialRemark(auditRequest.getAuditOpinion());
} else if (ArgsConst.CHANGE.equals(auditRequest.getType())) {
personnel.setChangeAuditState(2);
personnel.setFirstTrialRemark(auditRequest.getAuditOpinion());
}
personnelMapper.updateById(personnel);
} else if (ArgsConst.EXCHANGE.equals(auditRequest.getType())) {
Exchange exchange = exchangeMapper.selectById(auditOne.getPersonnelId());
exchange.setFirstTrialRemark(auditRequest.getAuditOpinion());
exchange.setAuditState(2);
exchangeMapper.updateById(exchange);
}
saveAuditLog(auditRequest.getPersonnelId(), loginId, auditRequest.getType(), "一般初审通过", auditRequest.getAuditOpinion());
}
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(loginUser.getLoginName())) { if (leadership.getParamValue().equals(loginUser.getLoginName())) {
one.setAuditOrder(ArgsConst.LAST); one.setAuditOrder(ArgsConst.LAST);
@ -147,38 +117,57 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
boolean update = updateById(one); boolean update = updateById(one);
if (update) { if (update) {
saveAuditLog(auditRequest.getPersonnelId(), loginId, auditRequest.getType(), "一般终审通过", auditRequest.getAuditOpinion()); saveAuditLog(auditRequest.getPersonnelId(), loginId, auditRequest.getType(), "一般终审通过", auditRequest.getAuditOpinion());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType()) || ArgsConst.CHANGE.equals(auditRequest.getType())) { if (ArgsConst.PERSONNEL.equals(auditRequest.getType()) || ArgsConst.CHANGE.equals(auditRequest.getType())) {
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId()); Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getBeforeId, personnel.getId()).eq(PersonnelMiddle::getState, "1"); LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>()
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())) { .eq(PersonnelMiddle::getBeforeId, personnel.getId()).eq(PersonnelMiddle::getType,auditRequest.getType())
wrapper.eq(PersonnelMiddle::getType, ArgsConst.PERSONNEL); .eq(PersonnelMiddle::getState, "1");
} else if (ArgsConst.CHANGE.equals(auditRequest.getType())) {
wrapper.eq(PersonnelMiddle::getType, ArgsConst.CHANGE);
}
PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper); PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper);
System.out.println("middle = " + middle);
if (ObjectUtil.isNotEmpty(middle)){
Personnel personnelOne = personnelMapper.selectById(middle.getAfterId()); Personnel personnelOne = personnelMapper.selectById(middle.getAfterId());
String id = personnelOne.getId();
personnelOne.setState("2"); personnelOne.setState("2");
System.out.println("personnelOne = " + personnelOne);
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())) { if (ArgsConst.PERSONNEL.equals(auditRequest.getType())) {
personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion()); personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion());
personnelOne.setWorkState("在职");
personnelOne.setAlterationSign("2"); personnelOne.setAlterationSign("2");
personnelOne.setAuditState(3); personnelOne.setAuditState(3);
workFlow(personnel.getCreatedId(),ArgsConst.PERSONNEL,auditRequest.getPersonnelId(),"企业人员申报",true);
} }
if (ArgsConst.CHANGE.equals(auditRequest.getType())) { if (ArgsConst.CHANGE.equals(auditRequest.getType())) {
System.out.println(" =11111111111111 ");
personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion()); personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion());
personnelOne.setChangeAlterationSign("2"); personnelOne.setChangeAlterationSign("2");
personnelOne.setChangeAuditState(3); personnelOne.setChangeAuditState(3);
workFlow(personnel.getCreatedId(),ArgsConst.CHANGE,auditRequest.getPersonnelId(),"人员变更申报",true);
} }
personnelOne.setId(personnel.getId()); String id = personnel.getId();
personnel.setId(id); String idOne = personnelOne.getId();
personnelOne.setId(id);
personnel.setId(idOne);
personnel.setState("0"); personnel.setState("0");
middle.setState("0"); middle.setState("0");
personnelMapper.updateById(personnelOne); personnelMapper.updateById(personnelOne);
personnelMapper.updateById(personnel); personnelMapper.updateById(personnel);
personnelMiddleMapper.updateById(middle); personnelMiddleMapper.updateById(middle);
}else {
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())) {
personnel.setFinalTrialRemark(auditRequest.getAuditOpinion());
personnel.setAlterationSign("2");
personnel.setAuditState(3);
workFlow(personnel.getCreatedId(),ArgsConst.PERSONNEL,auditRequest.getPersonnelId(),"企业人员申报",true);
}
if (ArgsConst.CHANGE.equals(auditRequest.getType())) {
personnel.setFinalTrialRemark(auditRequest.getAuditOpinion());
personnel.setChangeAlterationSign("2");
personnel.setChangeAuditState(3);
workFlow(personnel.getCreatedId(),ArgsConst.CHANGE,auditRequest.getPersonnelId(),"人员变更申报",true);
}
personnel.setState("2");
personnelMapper.updateById(personnel);
}
} else if (ArgsConst.EXCHANGE.equals(auditRequest.getType())) { } else if (ArgsConst.EXCHANGE.equals(auditRequest.getType())) {
Exchange exchange = exchangeMapper.selectOne(new LambdaQueryWrapper<Exchange>().eq(Exchange::getState, "1").eq(Exchange::getId, auditRequest.getPersonnelId())); Exchange exchange = exchangeMapper.selectOne(new LambdaQueryWrapper<Exchange>().eq(Exchange::getState, "1").eq(Exchange::getId, auditRequest.getPersonnelId()));
Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId()); Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId());
@ -190,6 +179,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
personnel.setPosition(exchange.getWillPosition()); personnel.setPosition(exchange.getWillPosition());
exchangeMapper.updateById(exchange); exchangeMapper.updateById(exchange);
personnelMapper.updateById(personnel); personnelMapper.updateById(personnel);
workFlow(exchange.getCreatedId(),ArgsConst.EXCHANGE,auditRequest.getPersonnelId(),"人员选调申报",true);
} }
} }
return update ? AjaxResult.ok().msg("审批成功!") : AjaxResult.fail().msg("审批成功!"); return update ? AjaxResult.ok().msg("审批成功!") : AjaxResult.fail().msg("审批成功!");
@ -198,40 +188,21 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
// 拒绝 // 拒绝
List<Audit> auditList = list(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId())); List<Audit> auditList = list(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
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()); System.out.println("middle = " + middle);
Personnel afterPersonnel = new Personnel();
if (ObjectUtil.isNotEmpty(middle)) {
afterPersonnel = personnelMapper.selectById(middle.getAfterId());
}
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId()); Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
Exchange exchange = exchangeMapper.selectById(auditRequest.getPersonnelId()); Exchange exchange = exchangeMapper.selectById(auditRequest.getPersonnelId());
if (loginUser.getLoginName().equals(director.getParamValue())) {
one.setAuditOrder(ArgsConst.REJECT);
one.setOpinion(auditRequest.getAuditOpinion());
boolean update = updateById(one);
if (update) {
saveAuditLog(auditRequest.getPersonnelId(), loginId, auditRequest.getType(), "一般初审拒绝", auditRequest.getAuditOpinion());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType()) || ArgsConst.CHANGE.equals(auditRequest.getType())) {
updateByPer(1, afterPersonnel.getId(), personnel, auditRequest.getType(), auditRequest.getAuditOpinion());
}
if (ArgsConst.EXCHANGE.equals(auditRequest.getType())) {
exchange.setAuditState(4);
exchange.setState("0");
exchange.setFirstTrialRemark(auditRequest.getAuditOpinion());
exchangeMapper.updateById(exchange);
}
for (Audit auditOne : auditList) {
delete(auditOne.getId());
}
}
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(loginUser.getLoginName())) { if (leadership.getParamValue().equals(loginUser.getLoginName())) {
one.setAuditOrder(ArgsConst.REJECT); one.setAuditOrder(ArgsConst.REJECT);
one.setOpinion(auditRequest.getAuditOpinion()); one.setOpinion(auditRequest.getAuditOpinion());
boolean update = updateById(one); boolean update = updateById(one);
if (update) { if (update) {
saveAuditLog(auditRequest.getPersonnelId(), loginId, auditRequest.getType(), "一般终审拒绝", auditRequest.getAuditOpinion()); saveAuditLog(auditRequest.getPersonnelId(), loginId, auditRequest.getType(), "终审拒绝", auditRequest.getAuditOpinion());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType()) || ArgsConst.CHANGE.equals(auditRequest.getType())) { if (ArgsConst.PERSONNEL.equals(auditRequest.getType()) || ArgsConst.CHANGE.equals(auditRequest.getType())) {
updateByPer(2, afterPersonnel.getId(), personnel, auditRequest.getType(), auditRequest.getAuditOpinion()); updateByPer(2, afterPersonnel.getId(), personnel, auditRequest.getType(), auditRequest.getAuditOpinion());
} else if (ArgsConst.EXCHANGE.equals(auditRequest.getType())) { } else if (ArgsConst.EXCHANGE.equals(auditRequest.getType())) {
@ -239,6 +210,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
exchange.setState("0"); exchange.setState("0");
exchange.setFinalTrialRemark(auditRequest.getAuditOpinion()); exchange.setFinalTrialRemark(auditRequest.getAuditOpinion());
exchangeMapper.updateById(exchange); exchangeMapper.updateById(exchange);
workFlow(exchange.getCreatedId(),ArgsConst.EXCHANGE,exchange.getId(),"人员选调申报",false);
} }
for (Audit auditOne : auditList) { for (Audit auditOne : auditList) {
delete(auditOne.getId()); delete(auditOne.getId());
@ -249,7 +221,20 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return null; return null;
} }
public void workFlow(String createdId,String type,String personnelId,String args,Boolean flag ){
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setFlowType(type);
workFlowNotice.setUserId(createdId);
if (flag){
workFlowNotice.setTitle("您的"+args+"已通过");
}else {
workFlowNotice.setTitle("您的"+args+"未通过");
}
workFlowNotice.setFlowId(personnelId);
workFlowNoticeService.save(workFlowNotice);
}
public Integer saveAuditLog(String personnelId, String approverId, String type, String auditSate, String opinion) { public Integer saveAuditLog(String personnelId, String approverId, String type, String auditSate, String opinion) {
AuditLog auditLog = new AuditLog(); AuditLog auditLog = new AuditLog();
auditLog.setPersonnelId(personnelId); auditLog.setPersonnelId(personnelId);
@ -270,9 +255,14 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
if (ArgsConst.PERSONNEL.equals(type)) { if (ArgsConst.PERSONNEL.equals(type)) {
personnel.setAuditState(4); personnel.setAuditState(4);
personnel.setAlterationSign("2"); personnel.setAlterationSign("2");
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, personnel.getRecruitNumber()));
places.setStatus(false);
placesMapper.updateById(places);
workFlow(personnel.getCreatedId(),ArgsConst.PERSONNEL,personnel.getId(),"企业人员申报",false);
} else if (ArgsConst.CHANGE.equals(type)) { } else if (ArgsConst.CHANGE.equals(type)) {
personnel.setChangeAuditState(4); personnel.setChangeAuditState(4);
personnel.setChangeAlterationSign("2"); personnel.setChangeAlterationSign("2");
workFlow(personnel.getCreatedId(),ArgsConst.CHANGE,personnel.getId(),"人员变更申报",false);
} }
personnelMapper.updateById(personnel); personnelMapper.updateById(personnel);

View File

@ -21,6 +21,7 @@ import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Exchange; import com.ydool.staff.entity.Exchange;
import com.ydool.staff.entity.Personnel; import com.ydool.staff.entity.Personnel;
import com.ydool.staff.mapper.AttachmentMapper; import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.mapper.AuditMapper;
import com.ydool.staff.mapper.CompanyNameMapper; import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.ExchangeMapper; import com.ydool.staff.mapper.ExchangeMapper;
import com.ydool.staff.mapper.PersonnelMapper; import com.ydool.staff.mapper.PersonnelMapper;
@ -28,6 +29,7 @@ import com.ydool.staff.request.ExchangeRequest;
import com.ydool.staff.request.GiveAuditRequest; import com.ydool.staff.request.GiveAuditRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.service.IExchangeService; import com.ydool.staff.service.IExchangeService;
import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.entity.Config; import com.ydool.system.entity.Config;
import com.ydool.system.entity.Dept; import com.ydool.system.entity.Dept;
import com.ydool.system.entity.User; import com.ydool.system.entity.User;
@ -59,13 +61,15 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
@Resource @Resource
private PersonnelMapper personnelMapper; private PersonnelMapper personnelMapper;
@Resource @Resource
private IPersonnelService personnelService;
@Resource
private AttachmentMapper attachmentMapper; private AttachmentMapper attachmentMapper;
@Resource @Resource
private ExchangeMapper exchangeMapper; private ExchangeMapper exchangeMapper;
@Resource @Resource
private DeptMapper deptMapper; private AuditMapper auditMapper;
@Resource @Resource
private CompanyNameMapper companyNameMapper; private CompanyNameMapper companyNameMapper;
@Resource @Resource
@ -89,17 +93,26 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
Page exchangePage = page(page,wrapper); Page exchangePage = page(page,wrapper);
List<Exchange> list = exchangePage.getRecords(); List<Exchange> list = exchangePage.getRecords();
exchangePage.setRecords(list.stream().map(e->{ exchangePage.setRecords(list.stream().map(e->{
System.out.println("e = " + e);
ExchangePageDto dto = BeanUtil.copyProperties(e, ExchangePageDto.class); ExchangePageDto dto = BeanUtil.copyProperties(e, ExchangePageDto.class);
Personnel personnel = personnelMapper.selectById(dto.getPersonnelId()); Personnel personnel = new Personnel();
CompanyName original = companyNameMapper.selectById(personnel.getCompanyName()); if (StrUtil.isNotBlank(e.getPersonnelId())){
CompanyName will = companyNameMapper.selectById(e.getWillCompanyId()); personnel = personnelMapper.selectById(dto.getPersonnelId());
Dept originalDept = deptMapper.selectById(personnel.getPresentDept()); }
Dept willDept = deptMapper.selectById(e.getWillDept()); CompanyName original = new CompanyName();
if (ObjectUtil.isNotEmpty(personnel)){
original = companyNameMapper.selectById(personnel.getCompanyName());
}
CompanyName will = new CompanyName();
if (StrUtil.isNotBlank(e.getWillCompanyId())){
will = companyNameMapper.selectById(e.getWillCompanyId());
}
User user = userMapper.selectById((String)StpUtil.getLoginId()); User user = userMapper.selectById((String)StpUtil.getLoginId());
if(ObjectUtil.isNotEmpty(personnel)){ if(ObjectUtil.isNotEmpty(personnel)){
dto.setUserName(personnel.getUserName()); dto.setUserName(personnel.getUserName());
dto.setCardId(personnel.getNumberId()); dto.setCardId(personnel.getNumberId());
dto.setNowPosition(personnel.getPosition()); dto.setNowPosition(personnel.getPosition());
dto.setNowDept(personnel.getPresentDept());
} }
if (ObjectUtil.isNotEmpty(original)){ if (ObjectUtil.isNotEmpty(original)){
dto.setOriginalCompanyName(original.getCompanyName()); dto.setOriginalCompanyName(original.getCompanyName());
@ -107,12 +120,6 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
if (ObjectUtil.isNotEmpty(will)){ if (ObjectUtil.isNotEmpty(will)){
dto.setWillCompanyName(will.getCompanyName()); dto.setWillCompanyName(will.getCompanyName());
} }
if (ObjectUtil.isNotEmpty(originalDept)){
dto.setNowDept(originalDept.getName());
}
if (ObjectUtil.isNotEmpty(willDept)){
dto.setWillDept(willDept.getName());
}
if (ObjectUtil.isNotEmpty(user)){ if (ObjectUtil.isNotEmpty(user)){
dto.setWritten(user.getUserName()); dto.setWritten(user.getUserName());
} }
@ -138,6 +145,14 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
attachment.setTargetType(ArgsConst.EXCHANGE); attachment.setTargetType(ArgsConst.EXCHANGE);
attachmentMapper.insert(attachment); attachmentMapper.insert(attachment);
} }
if("audit".equals(exchangeRequest.getType())){
GiveAuditRequest req = new GiveAuditRequest();
String[] ids = new String[]{exchange.getId()};
req.setIds(ids);
req.setType(ArgsConst.EXCHANGE);
personnelService.giveAudit(req);
}
return save ?AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!"); return save ?AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!");
} }
@ -163,6 +178,7 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
@Override @Override
public AjaxResult selectById(String id) { public AjaxResult selectById(String id) {
Exchange exchange = getById(id); Exchange exchange = getById(id);
String loginId = (String) StpUtil.getLoginId();
Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId()); Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId());
if (ObjectUtil.isEmpty(personnel)){ if (ObjectUtil.isEmpty(personnel)){
return AjaxResult.fail().msg("该人员不存在!"); return AjaxResult.fail().msg("该人员不存在!");
@ -171,19 +187,19 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
if (ObjectUtil.isEmpty(nowCompany)){ if (ObjectUtil.isEmpty(nowCompany)){
return AjaxResult.fail().msg("该企业不存在!"); return AjaxResult.fail().msg("该企业不存在!");
} }
Dept nowDept = deptMapper.selectById(personnel.getPresentDept()); /*Dept nowDept = deptMapper.selectById(personnel.getPresentDept());
if (ObjectUtil.isEmpty(nowDept)){ if (ObjectUtil.isEmpty(nowDept)){
return AjaxResult.fail().msg("该部门不存在!"); return AjaxResult.fail().msg("该部门不存在!");
} }*/
CompanyName willCompany = companyNameMapper.selectById(exchange.getWillCompanyId()); CompanyName willCompany = companyNameMapper.selectById(exchange.getWillCompanyId());
if (ObjectUtil.isEmpty(willCompany)){ if (ObjectUtil.isEmpty(willCompany)){
return AjaxResult.fail().msg("该企业不存在!"); return AjaxResult.fail().msg("该企业不存在!");
} }
Dept dept = deptMapper.selectById(exchange.getWillDept()); /* Dept dept = deptMapper.selectById(exchange.getWillDept());
if (ObjectUtil.isEmpty(dept)){ if (ObjectUtil.isEmpty(dept)){
return AjaxResult.fail().msg("该部门不存在!"); return AjaxResult.fail().msg("该部门不存在!");
} }*/
List<Attachment> attachments = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, exchange.getId())); List<Attachment> attachments = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, exchange.getId()));
List<AttachmentDto> attachmentDtos = BeanUtil.copyToList(attachments, AttachmentDto.class); List<AttachmentDto> attachmentDtos = BeanUtil.copyToList(attachments, AttachmentDto.class);
@ -194,10 +210,20 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
exchangeOneDto.setOriginalCode(nowCompany.getCreditCode()); exchangeOneDto.setOriginalCode(nowCompany.getCreditCode());
exchangeOneDto.setUserName(personnel.getUserName()); exchangeOneDto.setUserName(personnel.getUserName());
exchangeOneDto.setCardId(personnel.getNumberId()); exchangeOneDto.setCardId(personnel.getNumberId());
exchangeOneDto.setNowDept(nowDept.getName()); /*exchangeOneDto.setNowDept(nowDept.getName());
exchangeOneDto.setWillDept(dept.getName()); exchangeOneDto.setWillDept(dept.getName());*/
exchangeOneDto.setNowPosition(personnel.getPosition()); exchangeOneDto.setNowPosition(personnel.getPosition());
exchangeOneDto.setExcFiles(attachmentDtos); exchangeOneDto.setExcFiles(attachmentDtos);
LambdaQueryWrapper<Audit> wrapper = new LambdaQueryWrapper<Audit>()
.eq(Audit::getPersonnelId, id)
.eq(Audit::getPerType,ArgsConst.EXCHANGE)
.eq(Audit::getApprover, StpUtil.getLoginIdAsString())
.eq(Audit::getAuditOrder, ArgsConst.WAITING);
Audit audit = auditMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(audit)){
exchangeOneDto.setAuditBtn(true);
}
return AjaxResult.ok().data(exchangeOneDto); return AjaxResult.ok().data(exchangeOneDto);
} }

View File

@ -16,6 +16,8 @@ import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.ColumnUtil; import com.ydool.common.utils.ColumnUtil;
import com.ydool.common.utils.EasyExcelAlibabaUtil; import com.ydool.common.utils.EasyExcelAlibabaUtil;
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
import com.ydool.oa.workFlow.service.WorkFlowNoticeService;
import com.ydool.staff.dto.AttachmentDto; 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;
@ -27,6 +29,7 @@ import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Exchange; import com.ydool.staff.entity.Exchange;
import com.ydool.staff.entity.Personnel; import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.PersonnelMiddle; import com.ydool.staff.entity.PersonnelMiddle;
import com.ydool.staff.entity.Places;
import com.ydool.staff.entity.SelectRequest; import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.excel.ExcelPersonnel; import com.ydool.staff.excel.ExcelPersonnel;
import com.ydool.staff.excel.PersonnelExportVO; import com.ydool.staff.excel.PersonnelExportVO;
@ -38,8 +41,8 @@ import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.ExchangeMapper; import com.ydool.staff.mapper.ExchangeMapper;
import com.ydool.staff.mapper.PersonnelMapper; import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.mapper.PersonnelMiddleMapper; import com.ydool.staff.mapper.PersonnelMiddleMapper;
import com.ydool.staff.mapper.PlacesMapper;
import com.ydool.staff.request.AttachmentRequest; import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.GiveAuditRequest; import com.ydool.staff.request.GiveAuditRequest;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest; import com.ydool.staff.request.PersonnelRequest;
@ -54,11 +57,11 @@ import com.ydool.system.entity.User;
import com.ydool.system.mapper.ConfigMapper; import com.ydool.system.mapper.ConfigMapper;
import com.ydool.system.mapper.DeptMapper; import com.ydool.system.mapper.DeptMapper;
import com.ydool.system.mapper.UserMapper; import com.ydool.system.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.thymeleaf.util.StringUtils; import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -114,6 +117,11 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Resource @Resource
private ExchangeMapper exchangeMapper; private ExchangeMapper exchangeMapper;
@Autowired
WorkFlowNoticeService workFlowNoticeService;
@Resource
private PlacesMapper placesMapper;
/** /**
* 人员列表 * 人员列表
@ -154,14 +162,19 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return AjaxResult.fail().msg("id不能为空查询失败"); return AjaxResult.fail().msg("id不能为空查询失败");
} }
Personnel personnel = new Personnel(); Personnel personnel = new Personnel();
if (type.equals(ArgsConst.UPDATE)){ if (!type.equals(ArgsConst.UPDATE)){
BeanUtil.copyProperties(personnelMapper.selectById(id),personnel); BeanUtil.copyProperties(personnelMapper.selectById(id),personnel);
}else { }else {
LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>() LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>()
.eq(PersonnelMiddle::getBeforeId, id).eq(PersonnelMiddle::getState, "1") .eq(PersonnelMiddle::getBeforeId, id).eq(PersonnelMiddle::getState, "1")
.eq(PersonnelMiddle::getType, personnelType); .eq(PersonnelMiddle::getType, personnelType);
PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper); PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(middle)){
BeanUtil.copyProperties(personnelMapper.selectById(middle.getAfterId()),personnel); BeanUtil.copyProperties(personnelMapper.selectById(middle.getAfterId()),personnel);
}else {
BeanUtil.copyProperties(personnelMapper.selectById(id),personnel);
}
} }
if (ObjectUtil.isEmpty(personnel))return AjaxResult.fail().msg("该人员不存在!"); if (ObjectUtil.isEmpty(personnel))return AjaxResult.fail().msg("该人员不存在!");
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class); PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
@ -170,7 +183,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
.eq(Audit::getPerType,personnelType) .eq(Audit::getPerType,personnelType)
.eq(Audit::getApprover, StpUtil.getLoginIdAsString()) .eq(Audit::getApprover, StpUtil.getLoginIdAsString())
.eq(Audit::getAuditOrder, ArgsConst.WAITING); .eq(Audit::getAuditOrder, ArgsConst.WAITING);
Audit audit = auditMapper.selectOne(wrapper); Audit audit = auditMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(audit)){ if (ObjectUtil.isNotEmpty(audit)){
personnelUpdateDto.setAuditBtn(true); personnelUpdateDto.setAuditBtn(true);
@ -189,13 +201,13 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
public AjaxResult personnelByExchangeList() { public AjaxResult personnelByExchangeList() {
List<Personnel> list = list(new LambdaQueryWrapper<Personnel>().eq(Personnel::getState,"2").eq(Personnel::getWorkState,"在职")); List<Personnel> list = list(new LambdaQueryWrapper<Personnel>().eq(Personnel::getState,"2").eq(Personnel::getAuditState,3).eq(Personnel::getWorkState,"在职"));
List<PersonnelByExchangeDto> dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class); List<PersonnelByExchangeDto> dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class);
for (PersonnelByExchangeDto dto : dtos) { for (PersonnelByExchangeDto dto : dtos) {
CompanyName companyName = companyNameMapper.selectById(dto.getCompanyName()); CompanyName companyName = companyNameMapper.selectById(dto.getCompanyName());
dto.setCompanyName(companyName.getCompanyName()); dto.setCompanyName(companyName.getCompanyName());
Dept dept = deptMapper.selectById(dto.getPresentDept()); //Dept dept = deptMapper.selectById(dto.getPresentDept());
dto.setPresentDept(dept.getName()); //dto.setPresentDept(dept.getName());
} }
return AjaxResult.ok().data(dtos); return AjaxResult.ok().data(dtos);
} }
@ -219,16 +231,21 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(), ArgsConst.JOBTITLE_FILE, ArgsConst.SAVE, ""), ',')); personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(), ArgsConst.JOBTITLE_FILE, ArgsConst.SAVE, ""), ','));
personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, ArgsConst.SAVE, ""), ',')); personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, ArgsConst.SAVE, ""), ','));
boolean save = save(personnel); boolean save = save(personnel);
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, personnel.getRecruitNumber()));
places.setStatus(true);
placesMapper.updateById(places);
saveAttachment(personnelRequest.getCardFile(), ArgsConst.CARD_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getCardFile(), ArgsConst.CARD_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getEngageFile(), ArgsConst.ENGAGE_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getEngageFile(), ArgsConst.ENGAGE_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getEducationFile(), ArgsConst.EDUCATION_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getEducationFile(), ArgsConst.EDUCATION_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getJobTitleFile(), ArgsConst.JOBTITLE_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getJobTitleFile(), ArgsConst.JOBTITLE_FILE, personnel.getId(), ArgsConst.SAVE);
saveAttachment(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, personnel.getId(), ArgsConst.SAVE); saveAttachment(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, personnel.getId(), ArgsConst.SAVE);
if("audit".equals(personnelRequest.getType())){ if("audit".equals(personnelRequest.getType())){
personnel.setAlterationSign("1");
updateById(personnel);
GiveAuditRequest request = new GiveAuditRequest(); GiveAuditRequest request = new GiveAuditRequest();
String[] ids = new String[]{personnel.getId()}; String[] ids = new String[]{personnel.getId()};
request.setIds(ids); request.setIds(ids);
request.setType("personnel"); request.setType(ArgsConst.PERSONNEL);
return giveAudit(request); return giveAudit(request);
} }
@ -257,80 +274,82 @@ 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) {
PersonnelMiddle middle = new PersonnelMiddle(); Personnel personnel = get(updateRequest.getId());
Personnel per = get(updateRequest.getId()); if (!personnel.getRecruitNumber().equals(updateRequest.getRecruitNumber())){
List<AttachmentRequest> cardFile = updateRequest.getCardFile(); Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, personnel.getRecruitNumber()));
List<AttachmentRequest> educationFile = updateRequest.getEducationFile(); places.setStatus(false);
List<AttachmentRequest> auditFile = updateRequest.getAuditFile(); placesMapper.updateById(places);
List<AttachmentRequest> engageFile = updateRequest.getEngageFile(); }
List<AttachmentRequest> jobTitleFile = updateRequest.getJobTitleFile(); Personnel per = BeanUtil.copyProperties(updateRequest, Personnel.class);
List<AttachmentRequest> cardFile = updateRequest.getCardFileList();
List<AttachmentRequest> educationFile = updateRequest.getEducationFileList();
List<AttachmentRequest> auditFile = updateRequest.getAuditFileList();
List<AttachmentRequest> engageFile = updateRequest.getEngageFileList();
List<AttachmentRequest> jobTitleFile = updateRequest.getJobTitleFileList();
String card = StringUtils.join(saveFilePath(cardFile, ArgsConst.CARD_FILE, ArgsConst.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 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()), ','); String audit = StringUtils.join(saveFilePath(auditFile, ArgsConst.AUDIT_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
String engage = StringUtils.join(saveFilePath(engageFile, ArgsConst.ENGAGE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ','); String engage = StringUtils.join(saveFilePath(engageFile, ArgsConst.ENGAGE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
String job = StringUtils.join(saveFilePath(jobTitleFile, ArgsConst.JOBTITLE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ','); String job = StringUtils.join(saveFilePath(jobTitleFile, ArgsConst.JOBTITLE_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
if ("1".equals(per.getAlterationSign())) {
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
}
if ("1".equals(per.getChangeAlterationSign())) {
return AjaxResult.fail().msg("该人员在变更中,资料未完成审批,请等待领导审批!");
}
String type = ArgsConst.PERSONNEL;
per.setAlterationSign("1");
boolean update = updateById(per);
middle.setBeforeId(per.getId());
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)).toString());
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)).toString());
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)).toString());
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)).toString());
if (StrUtil.isNotBlank(card)){ if (StrUtil.isNotBlank(card)){
per.setCardFile(saveAlteration("身份证附件更改", per.getCardFile(), card, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getCardFile)).toString()); per.setCardFile(card);
} }
if (StrUtil.isNotBlank(education)){ if (StrUtil.isNotBlank(education)){
per.setEducationFile(saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile)).toString()); per.setEducationFile(education);
} }
if (StrUtil.isNotBlank(audit)){ if (StrUtil.isNotBlank(audit)){
per.setAuditFile(saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile)).toString()); per.setAuditFile(audit);
} }
if (StrUtil.isNotBlank(engage)){ if (StrUtil.isNotBlank(engage)){
per.setEngageFile(saveAlteration("审批资料附件更改", per.getAuditFile(), engage, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEngageFile)).toString()); per.setEngageFile(engage);
} }
if (StrUtil.isNotBlank(job)){ if (StrUtil.isNotBlank(job)){
per.setJobTitleFile(saveAlteration("审批资料附件更改", per.getAuditFile(), job, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getJobTitleFile)).toString()); per.setJobTitleFile(job);
} }
per.setId("");
per.setState("1");
per.setAlterationSign("1");
save(per);
middle.setAfterId(per.getId());
middle.setType(ArgsConst.PERSONNEL);
personnelMiddleService.savePer(middle);
saveAttachment(cardFile, ArgsConst.CARD_FILE, updateRequest.getId(), ArgsConst.UPDATE); saveAttachment(cardFile, ArgsConst.CARD_FILE, updateRequest.getId(), ArgsConst.UPDATE);
saveAttachment(educationFile, ArgsConst.EDUCATION_FILE, updateRequest.getId(), ArgsConst.UPDATE); saveAttachment(educationFile, ArgsConst.EDUCATION_FILE, updateRequest.getId(), ArgsConst.UPDATE);
saveAttachment(auditFile, ArgsConst.AUDIT_FILE, updateRequest.getId(), ArgsConst.UPDATE); saveAttachment(auditFile, ArgsConst.AUDIT_FILE, updateRequest.getId(), ArgsConst.UPDATE);
saveAttachment(jobTitleFile, ArgsConst.JOBTITLE_FILE, updateRequest.getId(), ArgsConst.UPDATE);
saveAttachment(engageFile, ArgsConst.ENGAGE_FILE, updateRequest.getId(), ArgsConst.UPDATE);
per.setState("2");
per.setAlterationSign("1");
boolean update = updateById(per);
if (update){
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, updateRequest.getRecruitNumber()));
places.setStatus(true);
placesMapper.updateById(places);
}
if("audit".equals(updateRequest.getType())){
GiveAuditRequest request = new GiveAuditRequest();
String[] ids = new String[]{per.getId()};
request.setIds(ids);
request.setType("personnel");
return giveAudit(request);
}
return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!"); return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!");
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult updateChange(ChangeRequest request) { public AjaxResult updateChange(PersonnelUpdateRequest request) {
Personnel per = get(request.getId());
PersonnelMiddle middle = new PersonnelMiddle(); PersonnelMiddle middle = new PersonnelMiddle();
List<AttachmentRequest> cardFiles = request.getCardFiles(); String id = null;
List<AttachmentRequest> jobTitleFiles = request.getJobTitleFiles(); PersonnelMiddle personnelMiddle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, request.getId()).eq(PersonnelMiddle::getState,"1"));
List<AttachmentRequest> engageFiles = request.getEngageFiles(); if (ObjectUtil.isNotNull(personnelMiddle)){
List<AttachmentRequest> educationFiles = request.getEducationFiles(); id = personnelMiddle.getBeforeId();
List<AttachmentRequest> auditFiles = request.getAuditFiles(); }else {
if ("入职".equals(per.getWorkState())) { id = request.getId();
return AjaxResult.fail().msg("该人员未在职,不能变更数据");
} }
if ("1".equals(per.getAlterationSign())) { Personnel per = get(id);
return AjaxResult.fail().msg("该人员在申报中,资料未完成审批,请等待领导审批!"); 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();
if (per.getChangeAuditState()==2) {
return AjaxResult.fail().msg("待领导审批,不能变更数据");
} }
String type = ArgsConst.CHANGE; String type = ArgsConst.CHANGE;
String card = StringUtils.join(saveFilePath(cardFiles, ArgsConst.CARD_FILE, type, request.getId()), ','); 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 jobTitle = StringUtils.join(saveFilePath(jobTitleFiles, ArgsConst.JOBTITLE_FILE, type, request.getId()), ',');
@ -340,32 +359,59 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
per.setChangeAlterationSign("1"); 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)).toString()); per.setRecruitNumber(saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,id,ColumnUtil.getFieldName(Personnel::getRecruitNumber)).toString());
per.setQualification(saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getQualification)).toString()); per.setUserName(saveAlteration("姓名更改",per.getUserName(),request.getUserName(),type,id,ColumnUtil.getFieldName(Personnel::getUserName)).toString());
per.setJobTitle(saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitle)).toString()); per.setGender(saveAlteration("性别更改",per.getGender(),request.getGender(),type,id,ColumnUtil.getFieldName(Personnel::getGender)).toString());
per.setPosition(saveAlteration("岗位职务更改",per.getPosition(),request.getPosition(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPosition)).toString()); per.setBirthday(LocalDate.parse(saveAlteration("出生日期更改",per.getBirthday(),request.getBirthday(),type,id, ColumnUtil.getFieldName(Personnel::getBirthday)).toString()));
per.setWorkState(saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getWorkState)).toString()); per.setNumberId(saveAlteration("身份证号更改",per.getNumberId(),request.getNumberId(),type,id,ColumnUtil.getFieldName(Personnel::getNumberId)).toString());
per.setPersonnelCharacter(saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getPersonnelCharacter)).toString()); per.setNation(saveAlteration("民族更改",per.getNation(),request.getNation(),type,id,ColumnUtil.getFieldName(Personnel::getNation)).toString());
per.setAnnualSalary((Integer) saveAlteration("年薪更改", per.getAnnualSalary(), request.getAnnualSalary(), type, request.getId(), ColumnUtil.getFieldName(Personnel::getAnnualSalary))); per.setPoliticsStatus(saveAlteration("政治面貌更改",per.getPoliticsStatus(),request.getPoliticsStatus(),type,id,ColumnUtil.getFieldName(Personnel::getPoliticsStatus)).toString());
per.setRecruitNumber(saveAlteration("人员招聘单号更改",per.getRecruitNumber(),request.getRecruitNumber(),type,request.getId(),ColumnUtil.getFieldName(Personnel::getRecruitNumber)).toString()); per.setEducation(saveAlteration("学历更改",per.getEducation(),request.getEducation(),type,id,ColumnUtil.getFieldName(Personnel::getEducation)).toString());
per.setFreshGraduate(saveAlteration("是否应届毕业生更改",per.getFreshGraduate(),request.getFreshGraduate(),type,id,ColumnUtil.getFieldName(Personnel::getFreshGraduate)).toString());
per.setAcademy(saveAlteration("毕业院校更改",per.getAcademy(),request.getAcademy(),type,id,ColumnUtil.getFieldName(Personnel::getAcademy)).toString());
per.setSpecialty(saveAlteration("专业更改",per.getSpecialty(),request.getSpecialty(),type,id,ColumnUtil.getFieldName(Personnel::getSpecialty)).toString());
per.setHireType(saveAlteration("录用方式更改",per.getHireType(),request.getHireType(),type,id,ColumnUtil.getFieldName(Personnel::getHireType)).toString());
per.setQualification(saveAlteration("执业资格更改",per.getQualification(),request.getQualification(),type,id,ColumnUtil.getFieldName(Personnel::getQualification)).toString());
per.setJobTitle(saveAlteration("专业技术职称更改",per.getJobTitle(),request.getJobTitle(),type,id,ColumnUtil.getFieldName(Personnel::getJobTitle)).toString());
per.setContractModality(saveAlteration("合同形式更改",per.getContractModality(),request.getContractModality(),type,id,ColumnUtil.getFieldName(Personnel::getContractModality)).toString());
per.setPersonnelType(saveAlteration("人员类型更改",per.getPersonnelType(),request.getPersonnelType(),type,id,ColumnUtil.getFieldName(Personnel::getPersonnelType)).toString());
per.setWorkState(saveAlteration("工作状态更改",per.getWorkState(),request.getWorkState(),type,id,ColumnUtil.getFieldName(Personnel::getWorkState)).toString());
per.setPersonnelCharacter(saveAlteration("人员性质更改",per.getPersonnelCharacter(),request.getPersonnelCharacter(),type,id,ColumnUtil.getFieldName(Personnel::getPersonnelCharacter)).toString());
per.setAnnualSalary((Integer) saveAlteration("年薪更改", per.getAnnualSalary(), request.getAnnualSalary(), type, id, ColumnUtil.getFieldName(Personnel::getAnnualSalary)));
if (ObjectUtil.isNotNull(per.getHireDate())) {
per.setHireDate(LocalDate.parse(saveAlteration("入职时间更改", per.getHireDate(), request.getHireDate(), type, id, ColumnUtil.getFieldName(Personnel::getHireDate)).toString()));
}
if (ObjectUtil.isNotNull(per.getRetirementTime())) {
per.setRetirementTime(LocalDate.parse(saveAlteration("退休时间更改", per.getRetirementTime(), request.getRetirementTime(), type, id, ColumnUtil.getFieldName(Personnel::getRetirementTime)).toString()));
}
if (ObjectUtil.isNotNull(per.getResignationTime())) {
per.setResignationTime(LocalDate.parse(saveAlteration("离职时间更改", per.getResignationTime(), request.getResignationTime(), type, id, ColumnUtil.getFieldName(Personnel::getResignationTime)).toString()));
}
if (ObjectUtil.isNotNull(per.getTxfpStartTime())) {
per.setTxfpStartTime(LocalDate.parse(saveAlteration("退休返聘开始时间更改", per.getTxfpStartTime(), request.getTxfpStartTime(), type, id, ColumnUtil.getFieldName(Personnel::getTxfpStartTime)).toString()));
}
if (ObjectUtil.isNotNull(per.getTxfpEndTime())) {
per.setTxfpEndTime(LocalDate.parse(saveAlteration("退休返聘结束时间更改", per.getTxfpEndTime(), request.getTxfpEndTime(), type, id, ColumnUtil.getFieldName(Personnel::getTxfpEndTime)).toString()));
}
per.setRemark(saveAlteration("备注更改", per.getRemark(), request.getRemark(), type, id, ColumnUtil.getFieldName(Personnel::getRemark)).toString());
if (StrUtil.isNotBlank(card)){ if (StrUtil.isNotBlank(card)){
per.setCardFile(saveAlteration("身份证附件更改",per.getCardFile(),card,type,request.getId(),ColumnUtil.getFieldName(Personnel::getCardFile)).toString()); per.setCardFile(saveAlteration("身份证附件更改",per.getCardFile(),card,type,id,ColumnUtil.getFieldName(Personnel::getCardFile)).toString());
} }
if (StrUtil.isNotBlank(jobTitle)){ if (StrUtil.isNotBlank(jobTitle)){
per.setEngageFile(saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEngageFile)).toString()); per.setEngageFile(saveAlteration("聘任证书附件更改",per.getEngageFile(),jobTitle,type,id,ColumnUtil.getFieldName(Personnel::getEngageFile)).toString());
} }
if (StrUtil.isNotBlank(engage)){ if (StrUtil.isNotBlank(engage)){
per.setJobTitleFile(saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile)).toString()); per.setJobTitleFile(saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,id,ColumnUtil.getFieldName(Personnel::getJobTitleFile)).toString());
} }
if (StrUtil.isNotBlank(education)){ if (StrUtil.isNotBlank(education)){
per.setEducationFile(saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile)).toString()); per.setEducationFile(saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,id,ColumnUtil.getFieldName(Personnel::getEducationFile)).toString());
} }
if (StrUtil.isNotBlank(audit)){ if (StrUtil.isNotBlank(audit)){
per.setAuditFile(saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile)).toString()); per.setAuditFile(saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,id,ColumnUtil.getFieldName(Personnel::getAuditFile)).toString());
}
if (ObjectUtil.isNotNull(per.getRetirementTime())){
per.setRetirementTime((LocalDate) saveAlteration("退休时间更改",per.getRetirementTime(),request.getRetirementTime(),type,request.getId(), ColumnUtil.getFieldName(Personnel::getRetirementTime)));
} }
System.out.println("personnelMiddle = " + personnelMiddle);
if (ObjectUtil.isEmpty(personnelMiddle)){
per.setId(""); per.setId("");
per.setState("1"); per.setState("1");
per.setChangeAlterationSign("1"); per.setChangeAlterationSign("1");
@ -373,11 +419,24 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
middle.setAfterId(per.getId()); middle.setAfterId(per.getId());
middle.setType(ArgsConst.CHANGE); middle.setType(ArgsConst.CHANGE);
personnelMiddleService.savePer(middle); personnelMiddleService.savePer(middle);
}else {
per.setState("1");
per.setId(personnelMiddle.getAfterId());
updateById(per);
}
saveAttachment(cardFiles, ArgsConst.CARD_FILE, request.getId(), ArgsConst.UPDATE); saveAttachment(cardFiles, ArgsConst.CARD_FILE, request.getId(), ArgsConst.UPDATE);
saveAttachment(jobTitleFiles, ArgsConst.JOBTITLE_FILE, request.getId(), ArgsConst.UPDATE); saveAttachment(jobTitleFiles, ArgsConst.JOBTITLE_FILE, request.getId(), ArgsConst.UPDATE);
saveAttachment(engageFiles, ArgsConst.ENGAGE_FILE, request.getId(), ArgsConst.UPDATE); saveAttachment(engageFiles, ArgsConst.ENGAGE_FILE, request.getId(), ArgsConst.UPDATE);
saveAttachment(educationFiles, ArgsConst.EDUCATION_FILE, request.getId(), ArgsConst.UPDATE); saveAttachment(educationFiles, ArgsConst.EDUCATION_FILE, request.getId(), ArgsConst.UPDATE);
saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, request.getId(), ArgsConst.UPDATE); saveAttachment(auditFiles, ArgsConst.AUDIT_FILE, request.getId(), ArgsConst.UPDATE);
if("audit".equals(request.getType())){
GiveAuditRequest req = new GiveAuditRequest();
String[] ids = new String[]{id};
req.setIds(ids);
req.setType(ArgsConst.CHANGE);
return giveAudit(req);
}
return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!"); return update ? AjaxResult.ok().msg("修改成功!") : AjaxResult.fail().msg("修改失败!");
} }
@ -431,6 +490,21 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
public Object 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 one = alterationMapper.selectOne(new LambdaQueryWrapper<Alteration>().eq(Alteration::getRelevancyId, id).eq(Alteration::getFieldName, fieldName));
if (ObjectUtil.isNotEmpty(one)){
one.setDetails(details);
one.setFieldName(fieldName);
one.setType(type);
one.setRelevancyId(id);
if (ObjectUtil.isNotNull(before)) {
one.setBeforeChange(before.toString());
} else {
one.setBeforeChange("");
}
one.setAfterChange(after.toString());
alterationMapper.updateById(one);
}else {
Alteration alteration = new Alteration(); Alteration alteration = new Alteration();
alteration.setDetails(details); alteration.setDetails(details);
alteration.setFieldName(fieldName); alteration.setFieldName(fieldName);
@ -443,7 +517,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
alteration.setAfterChange(after.toString()); alteration.setAfterChange(after.toString());
alterationMapper.insert(alteration); alterationMapper.insert(alteration);
}
} }
return after; return after;
} }
@ -472,6 +546,13 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
public QueryWrapper selectWrapper(SelectRequest request,String orderBy,String column){ public QueryWrapper selectWrapper(SelectRequest request,String orderBy,String column){
QueryWrapper<Personnel> wrapper = new QueryWrapper<>(); QueryWrapper<Personnel> wrapper = new QueryWrapper<>();
if(ArgsConst.PERSONNEL.equals(request.getType())){
wrapper.lambda().ne(Personnel::getAuditState,"3");
}else{
wrapper.lambda().eq(Personnel::getAuditState,"3").ne(Personnel::getState,1).ne(Personnel::getState,0);
}
wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType()) wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType())
.eq(StrUtil.isNotBlank(request.getPresentDept()),Personnel::getPresentDept,request.getPresentDept()) .eq(StrUtil.isNotBlank(request.getPresentDept()),Personnel::getPresentDept,request.getPresentDept())
.eq(StrUtil.isNotBlank(request.getPoliticsStatus()),Personnel::getPoliticsStatus,request.getPoliticsStatus()) .eq(StrUtil.isNotBlank(request.getPoliticsStatus()),Personnel::getPoliticsStatus,request.getPoliticsStatus())
@ -484,7 +565,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
.eq(ObjectUtil.isNotNull(request.getResignationTime()),Personnel::getResignationTime,request.getResignationTime()) .eq(ObjectUtil.isNotNull(request.getResignationTime()),Personnel::getResignationTime,request.getResignationTime())
.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(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()); .eq(StrUtil.isNotBlank(request.getChangeAlterationSign()),Personnel::getChangeAlterationSign,request.getChangeAlterationSign());
@ -589,7 +669,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
String loginId = (String) StpUtil.getLoginId(); String loginId = (String) StpUtil.getLoginId();
for (String id : ids) { for (String id : ids) {
for(int i=0;i<=2;i++ ){ for(int i=0;i<=1;i++ ){
Audit audit = new Audit(); Audit audit = new Audit();
audit.setPersonnelId(id); audit.setPersonnelId(id);
audit.setPerType(request.getType()); audit.setPerType(request.getType());
@ -598,37 +678,60 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
audit.setAuditOrder(ArgsConst.GIVE_AUDIT); audit.setAuditOrder(ArgsConst.GIVE_AUDIT);
audit.setApprover(loginId); audit.setApprover(loginId);
audit.setApproverTime(new Date()); audit.setApproverTime(new Date());
}else if(i==1){
audit.setAuditOrder(ArgsConst.FIRST);
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
audit.setAuditOrder(ArgsConst.WAITING);
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
audit.setApprover(user.getId());
}else { }else {
audit.setAuditOrder(ArgsConst.LAST); audit.setAuditOrder(ArgsConst.LAST);
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
audit.setAuditOrder(ArgsConst.WAITING);
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())); User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
audit.setApprover(user.getId()); audit.setApprover(user.getId());
//通知
User loginUser = userMapper.selectById(loginId);
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setUserId(user.getId());
if (request.getType().equals(ArgsConst.PERSONNEL)){
workFlowNotice.setTitle(loginUser.getUserName() + "的企业人员申报待你审批");
workFlowNotice.setFlowType(ArgsConst.PERSONNEL);
}else if(request.getType().equals(ArgsConst.CHANGE)){
workFlowNotice.setTitle(loginUser.getUserName() + "的人员变更申报待你审批");
workFlowNotice.setFlowType(ArgsConst.CHANGE);
}else {
workFlowNotice.setTitle(loginUser.getUserName() + "的人员选调申报待你审批");
workFlowNotice.setFlowType(ArgsConst.EXCHANGE);
}
workFlowNotice.setFlowId(id);
workFlowNoticeService.save(workFlowNotice);
} }
auditMapper.insert(audit); auditMapper.insert(audit);
} }
if (ArgsConst.PERSONNEL.equals(request.getType())){ if (ArgsConst.PERSONNEL.equals(request.getType())){
Personnel personnel = get(id); Personnel personnel = get(id);
personnel.setAuditState(1); personnel.setAuditState(2);
updateById(personnel); updateById(personnel);
} }
if (ArgsConst.CHANGE.equals(request.getType())){ if (ArgsConst.CHANGE.equals(request.getType())){
Personnel personnel = get(id); PersonnelMiddle one = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getAfterId, id));
personnel.setChangeAuditState(1); if (ObjectUtil.isNotEmpty(one)){
Personnel personnel = get(one.getBeforeId());
Personnel personnel1 = get(id);
personnel.setChangeAuditState(2);
personnel1.setChangeAuditState(2);
updateById(personnel); updateById(personnel);
updateById(personnel1);
}else {
Personnel personnel = get(id);
personnel.setChangeAuditState(2);
updateById(personnel);
}
} }
if (ArgsConst.EXCHANGE.equals(request.getType())){ if (ArgsConst.EXCHANGE.equals(request.getType())){
Exchange exchange = exchangeMapper.selectById(id); Exchange exchange = exchangeMapper.selectById(id);
exchange.setAuditState(1); exchange.setAuditState(2);
exchangeMapper.updateById(exchange); exchangeMapper.updateById(exchange);
} }
auditService.saveAuditLog(id, loginId,request.getType(), "一般送审提交",""); auditService.saveAuditLog(id, loginId,request.getType(), "一般送审提交","");
} }
if (ids.length==1){ if (ids.length==1){
return AjaxResult.ok().msg("送审成功!"); return AjaxResult.ok().msg("送审成功!");