Commit d0b7b557 authored by 刘斌's avatar 刘斌

feat: 重新改版流程

parent 68ac42ee
...@@ -30,7 +30,12 @@ public enum HrFlowEnum { ...@@ -30,7 +30,12 @@ public enum HrFlowEnum {
/** /**
* 已完成 * 已完成
*/ */
FINISH(2, "已完成"); FINISH(2, "已完成"),
/**
* 已撤销
*/
CANCEL(3, "已撤销");
/** /**
* 状态 * 状态
...@@ -44,4 +49,8 @@ public enum HrFlowEnum { ...@@ -44,4 +49,8 @@ public enum HrFlowEnum {
private static final Map<Integer, HrFlowEnum> STATUS_MAP = Arrays.stream(HrFlowEnum.values()) private static final Map<Integer, HrFlowEnum> STATUS_MAP = Arrays.stream(HrFlowEnum.values())
.collect(Collectors.toConcurrentMap(HrFlowEnum::getStatus, Function.identity())); .collect(Collectors.toConcurrentMap(HrFlowEnum::getStatus, Function.identity()));
public static boolean isNotAbleToApply(Integer status) {
return status != null && !CANCEL.status.equals(status);
}
} }
...@@ -75,8 +75,8 @@ public class EmployeeFlowCtrl { ...@@ -75,8 +75,8 @@ public class EmployeeFlowCtrl {
@SaCheckPermission("employee:flow:add") @SaCheckPermission("employee:flow:add")
@PinSysLog(value = "人事审批对象", businessType = BusinessType.INSERT) @PinSysLog(value = "人事审批对象", businessType = BusinessType.INSERT)
@PostMapping() @PostMapping()
public Response add(@Validated(AddGroup.class) @RequestBody EmployeeFlowParam param) { public SingleResponse<EmployeeFlowVo> add(@Validated(AddGroup.class) @RequestBody EmployeeFlowParam param) {
return ResponseUtils.ofResult(employeeFlowServ.insertByParam(param)); return SingleResponse.of(employeeFlowServ.insertByParam(param));
} }
/** /**
...@@ -85,8 +85,8 @@ public class EmployeeFlowCtrl { ...@@ -85,8 +85,8 @@ public class EmployeeFlowCtrl {
@SaCheckPermission("employee:flow:edit") @SaCheckPermission("employee:flow:edit")
@PinSysLog(value = "人事审批对象", businessType = BusinessType.UPDATE) @PinSysLog(value = "人事审批对象", businessType = BusinessType.UPDATE)
@PutMapping() @PutMapping()
public Response edit(@Validated(EditGroup.class) @RequestBody EmployeeFlowParam param) { public SingleResponse<EmployeeFlowVo> edit(@Validated(EditGroup.class) @RequestBody EmployeeFlowParam param) {
return ResponseUtils.ofResult(employeeFlowServ.updateByParam(param)); return SingleResponse.of(employeeFlowServ.updateByParam(param));
} }
/** /**
......
...@@ -8,6 +8,7 @@ import com.alibaba.cola.dto.PageResponse; ...@@ -8,6 +8,7 @@ import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response; import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse; import com.alibaba.cola.dto.SingleResponse;
import com.anplus.hr.domain.params.*; import com.anplus.hr.domain.params.*;
import com.anplus.hr.domain.vo.EmployeeFlowVo;
import com.anplus.hr.domain.vo.EmployeeInfoImportVo; import com.anplus.hr.domain.vo.EmployeeInfoImportVo;
import com.anplus.hr.domain.vo.EmployeeInfoVo; import com.anplus.hr.domain.vo.EmployeeInfoVo;
import com.anplus.hr.service.EmployeeInfoServ; import com.anplus.hr.service.EmployeeInfoServ;
...@@ -162,8 +163,8 @@ public class EmployeeInfoCtrl { ...@@ -162,8 +163,8 @@ public class EmployeeInfoCtrl {
@SaCheckPermission("employee:info:add") @SaCheckPermission("employee:info:add")
@PinSysLog(value = "员工信息-入职申请", businessType = BusinessType.UPDATE) @PinSysLog(value = "员工信息-入职申请", businessType = BusinessType.UPDATE)
@PostMapping("/applyEntry") @PostMapping("/applyEntry")
public Response applyEntry(@RequestBody EmployeeEntryApplyParam param) { public SingleResponse<EmployeeFlowVo> applyEntry(@RequestBody EmployeeEntryApplyParam param) {
return ResponseUtils.ofResult(employeeInfoServ.applyEntry(param)); return SingleResponse.of(employeeInfoServ.applyEntry(param));
} }
/** /**
...@@ -173,8 +174,8 @@ public class EmployeeInfoCtrl { ...@@ -173,8 +174,8 @@ public class EmployeeInfoCtrl {
@SaCheckPermission("employee:info:edit") @SaCheckPermission("employee:info:edit")
@PinSysLog(value = "员工信息-调职申请", businessType = BusinessType.UPDATE) @PinSysLog(value = "员工信息-调职申请", businessType = BusinessType.UPDATE)
@PostMapping("/applyTransfer") @PostMapping("/applyTransfer")
public Response applyTransfer(@Validated @RequestBody EmployeeTransferApplyParam param) { public SingleResponse<EmployeeFlowVo> applyTransfer(@Validated @RequestBody EmployeeTransferApplyParam param) {
return ResponseUtils.ofResult(employeeInfoServ.applyTransfer(param)); return SingleResponse.of(employeeInfoServ.applyTransfer(param));
} }
/** /**
...@@ -184,8 +185,8 @@ public class EmployeeInfoCtrl { ...@@ -184,8 +185,8 @@ public class EmployeeInfoCtrl {
@SaCheckPermission("employee:info:resign") @SaCheckPermission("employee:info:resign")
@PinSysLog(value = "员工信息-离职申请", businessType = BusinessType.UPDATE) @PinSysLog(value = "员工信息-离职申请", businessType = BusinessType.UPDATE)
@PostMapping("/applyResign") @PostMapping("/applyResign")
public Response applyResign(@Validated @RequestBody EmployeeResignApplyParam param) { public SingleResponse<EmployeeFlowVo> applyResign(@Validated @RequestBody EmployeeResignApplyParam param) {
return ResponseUtils.ofResult(employeeInfoServ.applyResign(param)); return SingleResponse.of(employeeInfoServ.applyResign(param));
} }
/** /**
...@@ -195,8 +196,8 @@ public class EmployeeInfoCtrl { ...@@ -195,8 +196,8 @@ public class EmployeeInfoCtrl {
@SaCheckPermission("employee:info:regular") @SaCheckPermission("employee:info:regular")
@PinSysLog(value = "员工信息-转正申请", businessType = BusinessType.UPDATE) @PinSysLog(value = "员工信息-转正申请", businessType = BusinessType.UPDATE)
@PostMapping("/applyRegular") @PostMapping("/applyRegular")
public Response applyRegular(@Validated @RequestBody EmployeeRegularApplyParam param) { public SingleResponse<EmployeeFlowVo> applyRegular(@Validated @RequestBody EmployeeRegularApplyParam param) {
return ResponseUtils.ofResult(employeeInfoServ.applyRegular(param)); return SingleResponse.of(employeeInfoServ.applyRegular(param));
} }
/** /**
...@@ -206,8 +207,8 @@ public class EmployeeInfoCtrl { ...@@ -206,8 +207,8 @@ public class EmployeeInfoCtrl {
@SaCheckPermission("employee:info:contractRenewal") @SaCheckPermission("employee:info:contractRenewal")
@PinSysLog(value = "员工信息-合同续约申请", businessType = BusinessType.UPDATE) @PinSysLog(value = "员工信息-合同续约申请", businessType = BusinessType.UPDATE)
@PostMapping("/applyRenewalContract") @PostMapping("/applyRenewalContract")
public Response applyRenewalContract(@Validated @RequestBody EmployeeRenewalContractApplyParam param) { public SingleResponse<EmployeeFlowVo> applyRenewalContract(@Validated @RequestBody EmployeeRenewalContractApplyParam param) {
return ResponseUtils.ofResult(employeeInfoServ.applyRenewalContract(param)); return SingleResponse.of(employeeInfoServ.applyRenewalContract(param));
} }
/** /**
......
package com.anplus.hr.domain.params; package com.anplus.hr.domain.params;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
...@@ -14,6 +15,12 @@ public class EmployeeEntryApplyParam { ...@@ -14,6 +15,12 @@ public class EmployeeEntryApplyParam {
private Long id; private Long id;
/**
* 员工id
*/
@NotBlank(message = "员工不能为空")
private Long employeeId;
/** /**
* 入职时间 * 入职时间
*/ */
......
package com.anplus.hr.domain.params; package com.anplus.hr.domain.params;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
...@@ -22,6 +23,12 @@ public class EmployeeRegularApplyParam { ...@@ -22,6 +23,12 @@ public class EmployeeRegularApplyParam {
private Long id; private Long id;
/**
* 员工id
*/
@NotBlank(message = "员工不能为空")
private Long employeeId;
/** /**
* 劳动合同开始时间 * 劳动合同开始时间
*/ */
......
...@@ -20,6 +20,12 @@ public class EmployeeRenewalContractApplyParam { ...@@ -20,6 +20,12 @@ public class EmployeeRenewalContractApplyParam {
private Long id; private Long id;
/**
* 员工id
*/
@NotBlank(message = "员工不能为空")
private Long employeeId;
/** /**
* 合同形式 * 合同形式
*/ */
......
...@@ -18,6 +18,12 @@ public class EmployeeResignApplyParam { ...@@ -18,6 +18,12 @@ public class EmployeeResignApplyParam {
private Long id; private Long id;
/**
* 员工id
*/
@NotBlank(message = "员工不能为空")
private Long employeeId;
/** /**
* 离职类型 * 离职类型
*/ */
......
...@@ -15,6 +15,12 @@ public class EmployeeTransferApplyParam { ...@@ -15,6 +15,12 @@ public class EmployeeTransferApplyParam {
private Long id; private Long id;
/**
* 员工id
*/
@NotBlank(message = "员工不能为空")
private Long employeeId;
/** /**
* 板块 * 板块
*/ */
......
...@@ -36,6 +36,11 @@ public class EmployeeFlowVo implements Serializable { ...@@ -36,6 +36,11 @@ public class EmployeeFlowVo implements Serializable {
@ExcelProperty(value = "申请编号") @ExcelProperty(value = "申请编号")
private String applyCode; private String applyCode;
/**
* 流程code
*/
private String flowCode;
/** /**
* 审批类型 * 审批类型
*/ */
...@@ -48,17 +53,17 @@ public class EmployeeFlowVo implements Serializable { ...@@ -48,17 +53,17 @@ public class EmployeeFlowVo implements Serializable {
@ExcelProperty(value = "员工信息ID") @ExcelProperty(value = "员工信息ID")
private Long employeeId; private Long employeeId;
// /** /**
// * 开始时间 * 员工姓名
// */ */
// @ExcelProperty(value = "开始时间") @ExcelProperty(value = "员工姓名")
// private LocalDateTime startDate; private String name;
//
// /** /**
// * 结束时间 * 员工部门
// */ */
// @ExcelProperty(value = "结束时间") @ExcelProperty(value = "员工部门")
// private LocalDateTime endDate; private String deptName;
/** /**
* 审计内容 * 审计内容
......
...@@ -538,6 +538,11 @@ public class EmployeeInfoVo implements TransPojo, Serializable { ...@@ -538,6 +538,11 @@ public class EmployeeInfoVo implements TransPojo, Serializable {
@ExcelProperty(value = "绩效比例") @ExcelProperty(value = "绩效比例")
private String performanceRatio; private String performanceRatio;
/**
* 员工状态
*/
private Integer status;
/** /**
* 入职审批状态 * 入职审批状态
......
...@@ -14,6 +14,8 @@ public interface EmployeeAuditLogServ { ...@@ -14,6 +14,8 @@ public interface EmployeeAuditLogServ {
Boolean saveAuditLogs(List<SysAuditLog> auditLog); Boolean saveAuditLogs(List<SysAuditLog> auditLog);
Boolean removeAuditLogs(List<Long> logIds);
default void initAuditLog(String auditName, String auditField, String auditFieldName, String afterVal, List<SysAuditLog> list) { default void initAuditLog(String auditName, String auditField, String auditFieldName, String afterVal, List<SysAuditLog> list) {
SysAuditLog auditLog = new SysAuditLog(); SysAuditLog auditLog = new SysAuditLog();
auditLog.setAuditName(auditName); auditLog.setAuditName(auditName);
......
...@@ -48,7 +48,7 @@ public interface EmployeeFlowServ extends IService<EmployeeFlow> { ...@@ -48,7 +48,7 @@ public interface EmployeeFlowServ extends IService<EmployeeFlow> {
* @param param 人事审批对象 * @param param 人事审批对象
* @return 是否新增成功 * @return 是否新增成功
*/ */
Boolean insertByParam(EmployeeFlowParam param); EmployeeFlowVo insertByParam(EmployeeFlowParam param);
/** /**
* 修改人事审批对象 * 修改人事审批对象
...@@ -56,7 +56,15 @@ public interface EmployeeFlowServ extends IService<EmployeeFlow> { ...@@ -56,7 +56,15 @@ public interface EmployeeFlowServ extends IService<EmployeeFlow> {
* @param param 人事审批对象 * @param param 人事审批对象
* @return 是否修改成功 * @return 是否修改成功
*/ */
Boolean updateByParam(EmployeeFlowParam param); EmployeeFlowVo updateByParam(EmployeeFlowParam param);
/**
* 新增或修改人事审批对象
*
* @param param 人事审批对象
* @return 是否新增或修改成功
*/
EmployeeFlowVo insertOrUpdateByParam(EmployeeFlowParam param);
/** /**
* 提交请假并发起流程 * 提交请假并发起流程
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.cola.dto.PageResponse; import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response; import com.alibaba.cola.dto.Response;
import com.anplus.hr.domain.vo.EmployeeFlowVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.anplus.hr.domain.EmployeeInfo; import com.anplus.hr.domain.EmployeeInfo;
...@@ -113,35 +114,35 @@ public interface EmployeeInfoServ extends IService<EmployeeInfo> { ...@@ -113,35 +114,35 @@ public interface EmployeeInfoServ extends IService<EmployeeInfo> {
* *
* @param param 参数 * @param param 参数
*/ */
Boolean applyEntry(EmployeeEntryApplyParam param); EmployeeFlowVo applyEntry(EmployeeEntryApplyParam param);
/** /**
* 员工调职申请 * 员工调职申请
* *
* @param param 参数 * @param param 参数
*/ */
Boolean applyTransfer(EmployeeTransferApplyParam param); EmployeeFlowVo applyTransfer(EmployeeTransferApplyParam param);
/** /**
* 员工离职申请 * 员工离职申请
* *
* @param param 参数 * @param param 参数
*/ */
Boolean applyResign(EmployeeResignApplyParam param); EmployeeFlowVo applyResign(EmployeeResignApplyParam param);
/** /**
* 员工转正申请 * 员工转正申请
* *
* @param param 参数 * @param param 参数
*/ */
Boolean applyRegular(EmployeeRegularApplyParam param); EmployeeFlowVo applyRegular(EmployeeRegularApplyParam param);
/** /**
* 员工续签合同申请 * 员工续签合同申请
* *
* @param param 参数 * @param param 参数
*/ */
Boolean applyRenewalContract(EmployeeRenewalContractApplyParam param); EmployeeFlowVo applyRenewalContract(EmployeeRenewalContractApplyParam param);
/** /**
* 校验并批量删除员工信息信息 * 校验并批量删除员工信息信息
......
...@@ -43,4 +43,9 @@ public class EmployeeAuditLogServImpl implements EmployeeAuditLogServ { ...@@ -43,4 +43,9 @@ public class EmployeeAuditLogServImpl implements EmployeeAuditLogServ {
public Boolean saveAuditLogs(List<SysAuditLog> auditLog) { public Boolean saveAuditLogs(List<SysAuditLog> auditLog) {
return SqlHelper.retBool(auditLogMapper.insert(auditLog)); return SqlHelper.retBool(auditLogMapper.insert(auditLog));
} }
@Override
public Boolean removeAuditLogs(List<Long> logIds) {
return SqlHelper.retBool(auditLogMapper.deleteByIds(logIds));
}
} }
\ No newline at end of file
...@@ -118,12 +118,20 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ ...@@ -118,12 +118,20 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ
@Override @Override
public EmployeeFlowVo queryById(Long id) { public EmployeeFlowVo queryById(Long id) {
EmployeeFlow employeeFlow = employeeFlowMapper.selectById(id); EmployeeFlow employeeFlow = employeeFlowMapper.selectById(id);
EmployeeFlowVo employeeFlowVo = MapstructUtils.convert(employeeFlow, EmployeeFlowVo.class);
if (employeeFlow.getEmployeeId() != null) {
EmployeeInfo employeeInfo = employeeInfoMapper.selectById(employeeFlow.getEmployeeId());
employeeFlowVo.setName(employeeInfo.getName());
employeeFlowVo.setDeptName(employeeInfo.getPlate() +
" / " + employeeInfo.getFirstLevelDepartment() +
" / " + Convert.toStr(employeeInfo.getSecondLevelDepartment()) +
" / " + Convert.toStr(employeeInfo.getThirdLevelDepartment()));
}
List<SysAuditLogVo> sysAuditLogVoList = null; List<SysAuditLogVo> sysAuditLogVoList = null;
if (StrUtil.isNotBlank(employeeFlow.getLogIds())) { if (StrUtil.isNotBlank(employeeFlow.getLogIds())) {
List<SysAuditLog> auditLogs = employeeAuditLogServ.queryAuditLogs(employeeFlow.getLogIds()); List<SysAuditLog> auditLogs = employeeAuditLogServ.queryAuditLogs(employeeFlow.getLogIds());
sysAuditLogVoList = MapstructUtils.convert(auditLogs, SysAuditLogVo.class); sysAuditLogVoList = MapstructUtils.convert(auditLogs, SysAuditLogVo.class);
} }
EmployeeFlowVo employeeFlowVo = MapstructUtils.convert(employeeFlow, EmployeeFlowVo.class);
employeeFlowVo.setAuditLogList(sysAuditLogVoList); employeeFlowVo.setAuditLogList(sysAuditLogVoList);
return employeeFlowVo; return employeeFlowVo;
} }
...@@ -135,10 +143,13 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ ...@@ -135,10 +143,13 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ
* @return 是否新增成功 * @return 是否新增成功
*/ */
@Override @Override
public Boolean insertByParam(EmployeeFlowParam param) { public EmployeeFlowVo insertByParam(EmployeeFlowParam param) {
EmployeeFlow employeeFlow = MapstructUtils.convert(param, EmployeeFlow.class); EmployeeFlow employeeFlow = MapstructUtils.convert(param, EmployeeFlow.class);
employeeFlow.setId(snGen.nextId()); employeeFlow.setId(snGen.nextId());
return this.save(employeeFlow); employeeFlow.setStatus(BusinessStatusEnum.DRAFT.getStatus());
employeeFlow.setApplyCode(System.currentTimeMillis() + StrUtil.EMPTY);
this.save(employeeFlow);
return MapstructUtils.convert(employeeFlow, EmployeeFlowVo.class);
} }
/** /**
...@@ -148,9 +159,28 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ ...@@ -148,9 +159,28 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ
* @return 是否修改成功 * @return 是否修改成功
*/ */
@Override @Override
public Boolean updateByParam(EmployeeFlowParam param) { public EmployeeFlowVo updateByParam(EmployeeFlowParam param) {
EmployeeFlow employeeFlow = MapstructUtils.convert(param, EmployeeFlow.class); EmployeeFlow employeeFlow = MapstructUtils.convert(param, EmployeeFlow.class);
return this.updateById(employeeFlow); this.updateById(employeeFlow);
return MapstructUtils.convert(employeeFlow, EmployeeFlowVo.class);
}
/**
* 新增或修改人事审批对象
*
* @param param 人事审批对象
* @return 是否新增或修改成功
*/
@Override
public EmployeeFlowVo insertOrUpdateByParam(EmployeeFlowParam param) {
EmployeeFlowVo employeeFlowVo;
if (Convert.toLong(param.getId(), 0L) > 0) {
employeeFlowVo = this.updateByParam(param);
} else {
employeeFlowVo = this.insertByParam(param);
}
employeeFlowVo.setFlowCode(param.getFlowCode());
return employeeFlowVo;
} }
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
...@@ -158,11 +188,11 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ ...@@ -158,11 +188,11 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ
public EmployeeFlowVo submitAndFlowStart(EmployeeFlowParam param) { public EmployeeFlowVo submitAndFlowStart(EmployeeFlowParam param) {
// long day = DateUtil.betweenDay(param.getStartDate(), param.getEndDate(), true); // long day = DateUtil.betweenDay(param.getStartDate(), param.getEndDate(), true);
if (ObjectUtil.isNull(param.getId())) { if (ObjectUtil.isNull(param.getId())) {
param.setId(snGen.nextId());
param.setStatus(BusinessStatusEnum.DRAFT.getStatus()); param.setStatus(BusinessStatusEnum.DRAFT.getStatus());
param.setApplyCode(System.currentTimeMillis() + StrUtil.EMPTY); param.setApplyCode(System.currentTimeMillis() + StrUtil.EMPTY);
} }
EmployeeFlow employeeFlow = MapstructUtils.convert(param, EmployeeFlow.class); EmployeeFlow employeeFlow = MapstructUtils.convert(param, EmployeeFlow.class);
employeeFlow.setId(snGen.nextId());
boolean flag = baseMapper.insertOrUpdate(employeeFlow); boolean flag = baseMapper.insertOrUpdate(employeeFlow);
if (flag) { if (flag) {
param.setId(employeeFlow.getId()); param.setId(employeeFlow.getId());
...@@ -240,12 +270,17 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ ...@@ -240,12 +270,17 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ
String businessCode = MapUtil.getStr(params, "businessCode", StrUtil.EMPTY); String businessCode = MapUtil.getStr(params, "businessCode", StrUtil.EMPTY);
employeeFlow.setApplyCode(businessCode); employeeFlow.setApplyCode(businessCode);
} }
this.handleProcessSubmit(processEvent.getFlowCode(), employeeFlow.getEmployeeId());
} else if (processEvent.getStatus().equals(BusinessStatusEnum.FINISH.getStatus())) { } else if (processEvent.getStatus().equals(BusinessStatusEnum.FINISH.getStatus())) {
List<SysAuditLog> auditLogs = new ArrayList<>(6); List<SysAuditLog> auditLogs = new ArrayList<>(6);
if (StrUtil.isNotBlank(employeeFlow.getLogIds())) { if (StrUtil.isNotBlank(employeeFlow.getLogIds())) {
auditLogs = employeeAuditLogServ.queryAuditLogs(employeeFlow.getLogIds()); auditLogs = employeeAuditLogServ.queryAuditLogs(employeeFlow.getLogIds());
} }
this.handleProcessFinished(processEvent.getFlowCode(), employeeFlow, auditLogs); this.handleProcessFinished(processEvent.getFlowCode(), employeeFlow, auditLogs);
} else if (processEvent.getStatus().equals(BusinessStatusEnum.CANCEL.getStatus())
|| processEvent.getStatus().equals(BusinessStatusEnum.TERMINATION.getStatus())
|| processEvent.getStatus().equals(BusinessStatusEnum.INVALID.getStatus())) {
this.handleProcessEnd(processEvent.getFlowCode(), employeeFlow.getEmployeeId());
} }
baseMapper.updateById(employeeFlow); baseMapper.updateById(employeeFlow);
} }
...@@ -282,6 +317,60 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ ...@@ -282,6 +317,60 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ
baseMapper.deleteById(employeeFlow.getId()); baseMapper.deleteById(employeeFlow.getId());
} }
/**
* 处理流程提交
*/
private void handleProcessSubmit(String flowCode, Long employeeId) {
EmployeeInfo employeeInfo = employeeInfoMapper.selectById(employeeId);
switch (flowCode) {
case HrFlowTypeConstant.ENTRY_CODE:
employeeInfo.setEntryApplyStatus(HrFlowEnum.WAITING.getStatus());
break;
case HrFlowTypeConstant.TRANSFER_CODE:
employeeInfo.setTransferApplyStatus(HrFlowEnum.WAITING.getStatus());
break;
case HrFlowTypeConstant.RENEWAL_CONTRACT_CODE:
employeeInfo.setRenewalApplyStatus(HrFlowEnum.WAITING.getStatus());
break;
case HrFlowTypeConstant.REGULARIZATION_CODE:
employeeInfo.setRegularApplyStatus(HrFlowEnum.WAITING.getStatus());
break;
case HrFlowTypeConstant.RESIGN_CODE:
employeeInfo.setResignationApplyStatus(HrFlowEnum.WAITING.getStatus());
break;
default:
break;
}
employeeInfoMapper.updateById(employeeInfo);
}
/**
* 处理流程非正常结束
*/
private void handleProcessEnd(String flowCode, Long employeeId) {
EmployeeInfo employeeInfo = employeeInfoMapper.selectById(employeeId);
switch (flowCode) {
case HrFlowTypeConstant.ENTRY_CODE:
employeeInfo.setEntryApplyStatus(HrFlowEnum.CANCEL.getStatus());
break;
case HrFlowTypeConstant.TRANSFER_CODE:
employeeInfo.setTransferApplyStatus(HrFlowEnum.CANCEL.getStatus());
break;
case HrFlowTypeConstant.RENEWAL_CONTRACT_CODE:
employeeInfo.setRenewalApplyStatus(HrFlowEnum.CANCEL.getStatus());
break;
case HrFlowTypeConstant.REGULARIZATION_CODE:
employeeInfo.setRegularApplyStatus(HrFlowEnum.CANCEL.getStatus());
break;
case HrFlowTypeConstant.RESIGN_CODE:
employeeInfo.setResignationApplyStatus(HrFlowEnum.CANCEL.getStatus());
break;
default:
break;
}
employeeInfoMapper.updateById(employeeInfo);
}
/** /**
* 流程结束处理 * 流程结束处理
* *
...@@ -415,7 +504,7 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ ...@@ -415,7 +504,7 @@ public class EmployeeFlowServImpl extends ServiceImpl<EmployeeFlowMapper, Employ
employeeChangeLogServ.insertByEmployee(employeeFlow.getApplyCode(), oldEmployeeInfo, transferDate, EmployeeChangeLogTypeConstant.TransferOut); employeeChangeLogServ.insertByEmployee(employeeFlow.getApplyCode(), oldEmployeeInfo, transferDate, EmployeeChangeLogTypeConstant.TransferOut);
employeeChangeLogServ.insertByEmployee(employeeFlow.getApplyCode(), employeeInfo, transferDate, EmployeeChangeLogTypeConstant.TransferIn); employeeChangeLogServ.insertByEmployee(employeeFlow.getApplyCode(), employeeInfo, transferDate, EmployeeChangeLogTypeConstant.TransferIn);
break; break;
case HrFlowTypeConstant.RENEWAL_CONTRACT: case HrFlowTypeConstant.RENEWAL_CONTRACT_CODE:
// 续签流程结束 // 续签流程结束
employeeInfo.setRenewalApplyStatus(HrFlowEnum.FINISH.getStatus()); employeeInfo.setRenewalApplyStatus(HrFlowEnum.FINISH.getStatus());
for (SysAuditLog auditLog : auditLogs) { for (SysAuditLog auditLog : auditLogs) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment