代码提交 请假
This commit is contained in:
parent
d621968212
commit
664af6028f
@ -16,9 +16,9 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
|||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
import org.dromara.workflow.domain.bo.TestLeaveBo;
|
import org.dromara.workflow.domain.bo.LxOaLeaveBo;
|
||||||
import org.dromara.workflow.domain.vo.TestLeaveVo;
|
import org.dromara.workflow.domain.vo.LxOaLeaveVo;
|
||||||
import org.dromara.workflow.service.ITestLeaveService;
|
import org.dromara.workflow.service.ILxOaLeaveService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -37,15 +37,15 @@ import java.util.List;
|
|||||||
@RequestMapping("/workflow/leave")
|
@RequestMapping("/workflow/leave")
|
||||||
public class OALeaveController extends BaseController {
|
public class OALeaveController extends BaseController {
|
||||||
|
|
||||||
private final ITestLeaveService testLeaveService;
|
private final ILxOaLeaveService lxOaLeaveService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询请假列表
|
* 查询请假列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("workflow:leave:list")
|
@SaCheckPermission("workflow:leave:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<TestLeaveVo> list(TestLeaveBo bo, PageQuery pageQuery) {
|
public TableDataInfo<LxOaLeaveVo> list(LxOaLeaveBo bo, PageQuery pageQuery) {
|
||||||
return testLeaveService.queryPageList(bo, pageQuery);
|
return lxOaLeaveService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,9 +54,9 @@ public class OALeaveController extends BaseController {
|
|||||||
@SaCheckPermission("workflow:leave:export")
|
@SaCheckPermission("workflow:leave:export")
|
||||||
@Log(title = "请假", businessType = BusinessType.EXPORT)
|
@Log(title = "请假", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(TestLeaveBo bo, HttpServletResponse response) {
|
public void export(LxOaLeaveBo bo, HttpServletResponse response) {
|
||||||
List<TestLeaveVo> list = testLeaveService.queryList(bo);
|
List<LxOaLeaveVo> list = lxOaLeaveService.queryList(bo);
|
||||||
ExcelUtil.exportExcel(list, "请假", TestLeaveVo.class, response);
|
ExcelUtil.exportExcel(list, "请假", LxOaLeaveVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,9 +66,9 @@ public class OALeaveController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("workflow:leave:query")
|
@SaCheckPermission("workflow:leave:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<TestLeaveVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<LxOaLeaveVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long id) {
|
@PathVariable Long id) {
|
||||||
return R.ok(testLeaveService.queryById(id));
|
return R.ok(lxOaLeaveService.queryById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,8 +78,8 @@ public class OALeaveController extends BaseController {
|
|||||||
@Log(title = "请假", businessType = BusinessType.INSERT)
|
@Log(title = "请假", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<TestLeaveVo> add(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) {
|
public R<LxOaLeaveVo> add(@Validated(AddGroup.class) @RequestBody LxOaLeaveBo bo) {
|
||||||
return R.ok(testLeaveService.insertByBo(bo));
|
return R.ok(lxOaLeaveService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,8 +89,8 @@ public class OALeaveController extends BaseController {
|
|||||||
@Log(title = "请假", businessType = BusinessType.UPDATE)
|
@Log(title = "请假", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<TestLeaveVo> edit(@Validated(EditGroup.class) @RequestBody TestLeaveBo bo) {
|
public R<LxOaLeaveVo> edit(@Validated(EditGroup.class) @RequestBody LxOaLeaveBo bo) {
|
||||||
return R.ok(testLeaveService.updateByBo(bo));
|
return R.ok(lxOaLeaveService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,6 +103,6 @@ public class OALeaveController extends BaseController {
|
|||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable Long[] ids) {
|
@PathVariable Long[] ids) {
|
||||||
return toAjax(testLeaveService.deleteWithValidByIds(List.of(ids)));
|
return toAjax(lxOaLeaveService.deleteWithValidByIds(List.of(ids)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
package org.dromara.workflow.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假对象 test_leave
|
||||||
|
*
|
||||||
|
* @author may
|
||||||
|
* @date 2023-07-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("lx_oa_leave")
|
||||||
|
public class LxOaLeave extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假类型
|
||||||
|
*/
|
||||||
|
private String leaveType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假天数
|
||||||
|
*/
|
||||||
|
private Integer leaveDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假原因
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
package org.dromara.workflow.domain.bo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.workflow.domain.TestLeave;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假业务对象 test_leave
|
||||||
|
*
|
||||||
|
* @author may
|
||||||
|
* @date 2023-07-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = TestLeave.class, reverseConvertGenerate = false)
|
||||||
|
public class LxOaLeaveBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假类型
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "请假类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
private String leaveType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "开始时间不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "结束时间不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假天数
|
||||||
|
*/
|
||||||
|
private Integer leaveDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private Integer startLeaveDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private Integer endLeaveDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假原因
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门
|
||||||
|
*/
|
||||||
|
private String dept;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package org.dromara.workflow.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.workflow.domain.TestLeave;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假视图对象 test_leave
|
||||||
|
*
|
||||||
|
* @author may
|
||||||
|
* @date 2023-07-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = TestLeave.class)
|
||||||
|
public class LxOaLeaveVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假类型
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "请假类型")
|
||||||
|
private String leaveType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "开始时间")
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "结束时间")
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假天数
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "请假天数")
|
||||||
|
private Integer leaveDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "请假原因")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.workflow.mapper;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.workflow.domain.LxOaLeave;
|
||||||
|
import org.dromara.workflow.domain.vo.LxOaLeaveVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假Mapper接口
|
||||||
|
*
|
||||||
|
* @author may
|
||||||
|
* @date 2023-07-21
|
||||||
|
*/
|
||||||
|
public interface LxOaLeaveMapper extends BaseMapperPlus<LxOaLeave, LxOaLeaveVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package org.dromara.workflow.service;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.workflow.domain.bo.LxOaLeaveBo;
|
||||||
|
import org.dromara.workflow.domain.vo.LxOaLeaveVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假Service接口
|
||||||
|
*
|
||||||
|
* @author may
|
||||||
|
* @date 2023-07-21
|
||||||
|
*/
|
||||||
|
public interface ILxOaLeaveService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询请假
|
||||||
|
*/
|
||||||
|
LxOaLeaveVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询请假列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<LxOaLeaveVo> queryPageList(LxOaLeaveBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询请假列表
|
||||||
|
*/
|
||||||
|
List<LxOaLeaveVo> queryList(LxOaLeaveBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增请假
|
||||||
|
*/
|
||||||
|
LxOaLeaveVo insertByBo(LxOaLeaveBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改请假
|
||||||
|
*/
|
||||||
|
LxOaLeaveVo updateByBo(LxOaLeaveBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除请假信息
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(List<Long> ids);
|
||||||
|
}
|
@ -0,0 +1,208 @@
|
|||||||
|
package org.dromara.workflow.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.core.domain.event.ProcessCreateTaskEvent;
|
||||||
|
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
|
||||||
|
import org.dromara.common.core.domain.event.ProcessEvent;
|
||||||
|
import org.dromara.common.core.enums.BusinessStatusEnum;
|
||||||
|
import org.dromara.common.core.service.WorkflowService;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
|
import org.dromara.workflow.domain.LxOaLeave;
|
||||||
|
import org.dromara.workflow.domain.bo.LxOaLeaveBo;
|
||||||
|
import org.dromara.workflow.domain.vo.LxOaLeaveVo;
|
||||||
|
import org.dromara.workflow.mapper.LxOaLeaveMapper;
|
||||||
|
import org.dromara.workflow.service.ILxOaLeaveService;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请假Service业务层处理
|
||||||
|
*
|
||||||
|
* @author may
|
||||||
|
* @date 2023-07-21
|
||||||
|
*/
|
||||||
|
@ConditionalOnEnable
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class LxOaLeaveServiceImpl implements ILxOaLeaveService {
|
||||||
|
|
||||||
|
private final LxOaLeaveMapper baseMapper;
|
||||||
|
private final WorkflowService workflowService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* spel条件表达:判断小于2
|
||||||
|
*
|
||||||
|
* @param leaveDays 待判断的变量(可不传自行返回true或false)
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean eval(Integer leaveDays) {
|
||||||
|
if (leaveDays <= 2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询请假
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LxOaLeaveVo queryById(Long id) {
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询请假列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<LxOaLeaveVo> queryPageList(LxOaLeaveBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<LxOaLeave> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<LxOaLeaveVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询请假列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<LxOaLeaveVo> queryList(LxOaLeaveBo bo) {
|
||||||
|
LambdaQueryWrapper<LxOaLeave> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<LxOaLeave> buildQueryWrapper(LxOaLeaveBo bo) {
|
||||||
|
LambdaQueryWrapper<LxOaLeave> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getLeaveType()), LxOaLeave::getLeaveType, bo.getLeaveType());
|
||||||
|
lqw.ge(bo.getStartLeaveDays() != null, LxOaLeave::getLeaveDays, bo.getStartLeaveDays());
|
||||||
|
lqw.le(bo.getEndLeaveDays() != null, LxOaLeave::getLeaveDays, bo.getEndLeaveDays());
|
||||||
|
lqw.orderByDesc(BaseEntity::getCreateTime);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增请假
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LxOaLeaveVo insertByBo(LxOaLeaveBo bo) {
|
||||||
|
long day = DateUtil.betweenDay(bo.getStartDate(), bo.getEndDate(), true);
|
||||||
|
// 截止日期也算一天
|
||||||
|
bo.setLeaveDays((int) day + 1);
|
||||||
|
LxOaLeave add = MapstructUtils.convert(bo, LxOaLeave.class);
|
||||||
|
if (StringUtils.isBlank(add.getStatus())) {
|
||||||
|
add.setStatus(BusinessStatusEnum.DRAFT.getStatus());
|
||||||
|
}
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
// 流程变量
|
||||||
|
Map<String, Object> variable = new HashMap<>();
|
||||||
|
// variable.put("testLeave", testLeave);
|
||||||
|
// variable.put("flag", String.valueOf(testLeave.getDay()));
|
||||||
|
// flowParams.variable(variable);
|
||||||
|
// Instance instance = insService.start(id, flowParams);
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return MapstructUtils.convert(add, LxOaLeaveVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改请假
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LxOaLeaveVo updateByBo(LxOaLeaveBo bo) {
|
||||||
|
LxOaLeave update = MapstructUtils.convert(bo, LxOaLeave.class);
|
||||||
|
baseMapper.updateById(update);
|
||||||
|
return MapstructUtils.convert(update, LxOaLeaveVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除请假
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean deleteWithValidByIds(List<Long> ids) {
|
||||||
|
workflowService.deleteInstance(ids);
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||||
|
* 正常使用只需#processEvent.flowCode=='leave1'
|
||||||
|
* 示例为了方便则使用startsWith匹配了全部示例key
|
||||||
|
*
|
||||||
|
* @param processEvent 参数
|
||||||
|
*/
|
||||||
|
@EventListener(condition = "#processEvent.flowCode.startsWith('leave')")
|
||||||
|
public void processHandler(ProcessEvent processEvent) {
|
||||||
|
log.info("当前任务执行了{}", processEvent.toString());
|
||||||
|
LxOaLeave lxOaLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessId()));
|
||||||
|
lxOaLeave.setStatus(processEvent.getStatus());
|
||||||
|
// 用于例如审批附件 审批意见等 存储到业务表内 自行根据业务实现存储流程
|
||||||
|
Map<String, Object> params = processEvent.getParams();
|
||||||
|
if (MapUtil.isNotEmpty(params)) {
|
||||||
|
// 历史任务扩展(通常为附件)
|
||||||
|
String hisTaskExt = Convert.toStr(params.get("hisTaskExt"));
|
||||||
|
// 办理人
|
||||||
|
String handler = Convert.toStr(params.get("handler"));
|
||||||
|
// 办理意见
|
||||||
|
String message = Convert.toStr(params.get("message"));
|
||||||
|
}
|
||||||
|
if (processEvent.isSubmit()) {
|
||||||
|
lxOaLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||||
|
}
|
||||||
|
baseMapper.updateById(lxOaLeave);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行任务创建监听
|
||||||
|
* 示例:也可通过 @EventListener(condition = "#processCreateTaskEvent.flowCode=='leave1'")进行判断
|
||||||
|
* 在方法中判断流程节点key
|
||||||
|
* if ("xxx".equals(processCreateTaskEvent.getNodeCode())) {
|
||||||
|
* //执行业务逻辑
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @param processCreateTaskEvent 参数
|
||||||
|
*/
|
||||||
|
@EventListener(condition = "#processCreateTaskEvent.flowCode.startsWith('leave')")
|
||||||
|
public void processCreateTaskHandler(ProcessCreateTaskEvent processCreateTaskEvent) {
|
||||||
|
log.info("当前任务创建了{}", processCreateTaskEvent.toString());
|
||||||
|
LxOaLeave lxOaLeave = baseMapper.selectById(Long.valueOf(processCreateTaskEvent.getBusinessId()));
|
||||||
|
lxOaLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||||
|
baseMapper.updateById(lxOaLeave);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听删除流程事件
|
||||||
|
* 正常使用只需#processDeleteEvent.flowCode=='leave1'
|
||||||
|
* 示例为了方便则使用startsWith匹配了全部示例key
|
||||||
|
*
|
||||||
|
* @param processDeleteEvent 参数
|
||||||
|
*/
|
||||||
|
@EventListener(condition = "#processDeleteEvent.flowCode.startsWith('leave')")
|
||||||
|
public void processDeleteHandler(ProcessDeleteEvent processDeleteEvent) {
|
||||||
|
log.info("监听删除流程事件,当前任务执行了{}", processDeleteEvent.toString());
|
||||||
|
LxOaLeave lxOaLeave = baseMapper.selectById(Long.valueOf(processDeleteEvent.getBusinessId()));
|
||||||
|
if (ObjectUtil.isNull(lxOaLeave)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
baseMapper.deleteById(lxOaLeave.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user