请假申请流程-表名称替换
This commit is contained in:
parent
6d46dc9fe9
commit
8443917d42
@ -15,9 +15,9 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.workflow.domain.bo.TestLeaveBo;
|
||||
import org.dromara.workflow.domain.vo.TestLeaveVo;
|
||||
import org.dromara.workflow.service.ITestLeaveService;
|
||||
import org.dromara.workflow.domain.bo.SysUserLeaveBo;
|
||||
import org.dromara.workflow.domain.vo.SysUserLeaveVo;
|
||||
import org.dromara.workflow.service.ISysUserLeaveService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -33,17 +33,17 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/leave")
|
||||
public class TestLeaveController extends BaseController {
|
||||
public class SysUserLeaveController extends BaseController {
|
||||
|
||||
private final ITestLeaveService testLeaveService;
|
||||
private final ISysUserLeaveService sysUserLeaveService;
|
||||
|
||||
/**
|
||||
* 查询请假列表
|
||||
*/
|
||||
@SaCheckPermission("workflow:leave:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TestLeaveVo> list(TestLeaveBo bo, PageQuery pageQuery) {
|
||||
return testLeaveService.queryPageList(bo, pageQuery);
|
||||
public TableDataInfo<SysUserLeaveVo> list(SysUserLeaveBo bo, PageQuery pageQuery) {
|
||||
return sysUserLeaveService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,9 +52,9 @@ public class TestLeaveController extends BaseController {
|
||||
@SaCheckPermission("workflow:leave:export")
|
||||
@Log(title = "请假", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TestLeaveBo bo, HttpServletResponse response) {
|
||||
List<TestLeaveVo> list = testLeaveService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "请假", TestLeaveVo.class, response);
|
||||
public void export(SysUserLeaveBo bo, HttpServletResponse response) {
|
||||
List<SysUserLeaveVo> list = sysUserLeaveService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "请假", SysUserLeaveVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,9 +64,9 @@ public class TestLeaveController extends BaseController {
|
||||
*/
|
||||
@SaCheckPermission("workflow:leave:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<TestLeaveVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
public R<SysUserLeaveVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(testLeaveService.queryById(id));
|
||||
return R.ok(sysUserLeaveService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,8 +76,8 @@ public class TestLeaveController extends BaseController {
|
||||
@Log(title = "请假", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<TestLeaveVo> add(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) {
|
||||
return R.ok(testLeaveService.insertByBo(bo));
|
||||
public R<SysUserLeaveVo> add(@Validated(AddGroup.class) @RequestBody SysUserLeaveBo bo) {
|
||||
return R.ok(sysUserLeaveService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,8 +87,8 @@ public class TestLeaveController extends BaseController {
|
||||
@Log(title = "请假", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<TestLeaveVo> edit(@Validated(EditGroup.class) @RequestBody TestLeaveBo bo) {
|
||||
return R.ok(testLeaveService.updateByBo(bo));
|
||||
public R<SysUserLeaveVo> edit(@Validated(EditGroup.class) @RequestBody SysUserLeaveBo bo) {
|
||||
return R.ok(sysUserLeaveService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,6 +101,6 @@ public class TestLeaveController extends BaseController {
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(testLeaveService.deleteWithValidByIds(List.of(ids)));
|
||||
return toAjax(sysUserLeaveService.deleteWithValidByIds(List.of(ids)));
|
||||
}
|
||||
}
|
@ -10,15 +10,15 @@ import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 请假对象 test_leave
|
||||
* 请假对象 sys_user_leave
|
||||
*
|
||||
* @author may
|
||||
* @date 2023-07-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("test_leave")
|
||||
public class TestLeave extends BaseEntity {
|
||||
@TableName("sys_user_leave")
|
||||
public class SysUserLeave extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
@ -9,20 +9,20 @@ 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 org.dromara.workflow.domain.SysUserLeave;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 请假业务对象 test_leave
|
||||
* 请假业务对象 sys_user_leave
|
||||
*
|
||||
* @author may
|
||||
* @date 2023-07-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = TestLeave.class, reverseConvertGenerate = false)
|
||||
public class TestLeaveBo extends BaseEntity {
|
||||
@AutoMapper(target = SysUserLeave.class, reverseConvertGenerate = false)
|
||||
public class SysUserLeaveBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
@ -54,7 +54,7 @@ public class TestLeaveBo extends BaseEntity {
|
||||
* 请假天数
|
||||
*/
|
||||
@NotNull(message = "请假天数不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer leaveDays;
|
||||
private String leaveDays;
|
||||
|
||||
/**
|
||||
* 开始时间
|
@ -4,7 +4,7 @@ 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 org.dromara.workflow.domain.SysUserLeave;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -12,15 +12,15 @@ import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 请假视图对象 test_leave
|
||||
* 请假视图对象 sys_user_leave
|
||||
*
|
||||
* @author may
|
||||
* @date 2023-07-21
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = TestLeave.class)
|
||||
public class TestLeaveVo implements Serializable {
|
||||
@AutoMapper(target = SysUserLeave.class)
|
||||
public class SysUserLeaveVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -53,7 +53,7 @@ public class TestLeaveVo implements Serializable {
|
||||
* 请假天数
|
||||
*/
|
||||
@ExcelProperty(value = "请假天数")
|
||||
private Integer leaveDays;
|
||||
private String leaveDays;
|
||||
|
||||
/**
|
||||
* 备注
|
@ -0,0 +1,38 @@
|
||||
package org.dromara.workflow.listening;
|
||||
|
||||
import org.flowable.engine.ProcessEngine;
|
||||
import org.flowable.engine.ProcessEngines;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class leaveWorkFlowOutcome {
|
||||
|
||||
private void leaveWorkFlowOutcome(){
|
||||
|
||||
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
||||
Deployment deploy = processEngine.getRepositoryService()
|
||||
.createDeployment()
|
||||
.addClasspathResource("bpmn/leaveInclusiveGateway.bpmn")
|
||||
.name("请假流程")
|
||||
.deploy();
|
||||
Map<String, Object> assignees = new HashMap<>();
|
||||
assignees.put("type", 5);
|
||||
String businessKey = "1";
|
||||
ProcessInstance processInstance = processEngine.getRuntimeService()
|
||||
.startProcessInstanceByKey("leaveInclusiveGateway", businessKey, assignees);
|
||||
TaskService taskService = processEngine.getTaskService();
|
||||
Task task = taskService
|
||||
.createTaskQuery()
|
||||
.processDefinitionKey("leaveInclusiveGateway")
|
||||
.taskAssignee("张三")
|
||||
.singleResult();
|
||||
if (task != null) {
|
||||
taskService.complete(task.getId());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.workflow.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.workflow.domain.SysUserLeave;
|
||||
import org.dromara.workflow.domain.vo.SysUserLeaveVo;
|
||||
|
||||
/**
|
||||
* 请假Mapper接口
|
||||
*
|
||||
* @author may
|
||||
* @date 2023-07-21
|
||||
*/
|
||||
public interface SysUserLeaveMapper extends BaseMapperPlus<SysUserLeave, SysUserLeaveVo> {
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package org.dromara.workflow.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.workflow.domain.TestLeave;
|
||||
import org.dromara.workflow.domain.vo.TestLeaveVo;
|
||||
|
||||
/**
|
||||
* 请假Mapper接口
|
||||
*
|
||||
* @author may
|
||||
* @date 2023-07-21
|
||||
*/
|
||||
public interface TestLeaveMapper extends BaseMapperPlus<TestLeave, TestLeaveVo> {
|
||||
|
||||
}
|
@ -2,8 +2,8 @@ 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.TestLeaveBo;
|
||||
import org.dromara.workflow.domain.vo.TestLeaveVo;
|
||||
import org.dromara.workflow.domain.bo.SysUserLeaveBo;
|
||||
import org.dromara.workflow.domain.vo.SysUserLeaveVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -14,32 +14,32 @@ import java.util.List;
|
||||
* @author may
|
||||
* @date 2023-07-21
|
||||
*/
|
||||
public interface ITestLeaveService {
|
||||
public interface ISysUserLeaveService {
|
||||
|
||||
/**
|
||||
* 查询请假
|
||||
*/
|
||||
TestLeaveVo queryById(Long id);
|
||||
SysUserLeaveVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询请假列表
|
||||
*/
|
||||
TableDataInfo<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery);
|
||||
TableDataInfo<SysUserLeaveVo> queryPageList(SysUserLeaveBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询请假列表
|
||||
*/
|
||||
List<TestLeaveVo> queryList(TestLeaveBo bo);
|
||||
List<SysUserLeaveVo> queryList(SysUserLeaveBo bo);
|
||||
|
||||
/**
|
||||
* 新增请假
|
||||
*/
|
||||
TestLeaveVo insertByBo(TestLeaveBo bo);
|
||||
SysUserLeaveVo insertByBo(SysUserLeaveBo bo);
|
||||
|
||||
/**
|
||||
* 修改请假
|
||||
*/
|
||||
TestLeaveVo updateByBo(TestLeaveBo bo);
|
||||
SysUserLeaveVo updateByBo(SysUserLeaveBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除请假信息
|
@ -388,7 +388,7 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
||||
WfDefinitionConfigBo wfDefinitionConfigBo = new WfDefinitionConfigBo();
|
||||
wfDefinitionConfigBo.setDefinitionId(processDefinition.getId());
|
||||
wfDefinitionConfigBo.setProcessKey(processDefinition.getKey());
|
||||
wfDefinitionConfigBo.setTableName("test_leave");
|
||||
wfDefinitionConfigBo.setTableName("sys_user_leave");
|
||||
wfDefinitionConfigBo.setVersion(processDefinition.getVersion());
|
||||
wfDefinitionConfigService.saveOrUpdate(wfDefinitionConfigBo);
|
||||
}
|
||||
|
@ -15,11 +15,11 @@ 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.domain.TestLeave;
|
||||
import org.dromara.workflow.domain.bo.TestLeaveBo;
|
||||
import org.dromara.workflow.domain.vo.TestLeaveVo;
|
||||
import org.dromara.workflow.mapper.TestLeaveMapper;
|
||||
import org.dromara.workflow.service.ITestLeaveService;
|
||||
import org.dromara.workflow.domain.SysUserLeave;
|
||||
import org.dromara.workflow.domain.bo.SysUserLeaveBo;
|
||||
import org.dromara.workflow.domain.vo.SysUserLeaveVo;
|
||||
import org.dromara.workflow.mapper.SysUserLeaveMapper;
|
||||
import org.dromara.workflow.service.ISysUserLeaveService;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -36,16 +36,16 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
public class SysUserLeaveServiceImpl implements ISysUserLeaveService {
|
||||
|
||||
private final TestLeaveMapper baseMapper;
|
||||
private final SysUserLeaveMapper baseMapper;
|
||||
private final WorkflowService workflowService;
|
||||
|
||||
/**
|
||||
* 查询请假
|
||||
*/
|
||||
@Override
|
||||
public TestLeaveVo queryById(Long id) {
|
||||
public SysUserLeaveVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@ -53,9 +53,9 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
* 查询请假列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
|
||||
Page<TestLeaveVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
public TableDataInfo<SysUserLeaveVo> queryPageList(SysUserLeaveBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysUserLeave> lqw = buildQueryWrapper(bo);
|
||||
Page<SysUserLeaveVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@ -63,16 +63,16 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
* 查询请假列表
|
||||
*/
|
||||
@Override
|
||||
public List<TestLeaveVo> queryList(TestLeaveBo bo) {
|
||||
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
|
||||
public List<SysUserLeaveVo> queryList(SysUserLeaveBo bo) {
|
||||
LambdaQueryWrapper<SysUserLeave> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TestLeave> buildQueryWrapper(TestLeaveBo bo) {
|
||||
LambdaQueryWrapper<TestLeave> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLeaveType()), TestLeave::getLeaveType, bo.getLeaveType());
|
||||
lqw.ge(bo.getStartLeaveDays() != null, TestLeave::getLeaveDays, bo.getStartLeaveDays());
|
||||
lqw.le(bo.getEndLeaveDays() != null, TestLeave::getLeaveDays, bo.getEndLeaveDays());
|
||||
private LambdaQueryWrapper<SysUserLeave> buildQueryWrapper(SysUserLeaveBo bo) {
|
||||
LambdaQueryWrapper<SysUserLeave> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLeaveType()), SysUserLeave::getLeaveType, bo.getLeaveType());
|
||||
lqw.ge(bo.getStartLeaveDays() != null, SysUserLeave::getLeaveDays, bo.getStartLeaveDays());
|
||||
lqw.le(bo.getEndLeaveDays() != null, SysUserLeave::getLeaveDays, bo.getEndLeaveDays());
|
||||
lqw.orderByDesc(BaseEntity::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
@ -81,8 +81,8 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
* 新增请假
|
||||
*/
|
||||
@Override
|
||||
public TestLeaveVo insertByBo(TestLeaveBo bo) {
|
||||
TestLeave add = MapstructUtils.convert(bo, TestLeave.class);
|
||||
public SysUserLeaveVo insertByBo(SysUserLeaveBo bo) {
|
||||
SysUserLeave add = MapstructUtils.convert(bo, SysUserLeave.class);
|
||||
if (StringUtils.isBlank(add.getStatus())) {
|
||||
add.setStatus(BusinessStatusEnum.DRAFT.getStatus());
|
||||
}
|
||||
@ -90,17 +90,17 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return MapstructUtils.convert(add, TestLeaveVo.class);
|
||||
return MapstructUtils.convert(add, SysUserLeaveVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改请假
|
||||
*/
|
||||
@Override
|
||||
public TestLeaveVo updateByBo(TestLeaveBo bo) {
|
||||
TestLeave update = MapstructUtils.convert(bo, TestLeave.class);
|
||||
public SysUserLeaveVo updateByBo(SysUserLeaveBo bo) {
|
||||
SysUserLeave update = MapstructUtils.convert(bo, SysUserLeave.class);
|
||||
baseMapper.updateById(update);
|
||||
return MapstructUtils.convert(update, TestLeaveVo.class);
|
||||
return MapstructUtils.convert(update, SysUserLeaveVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,7 +124,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
@EventListener(condition = "#processEvent.key.startsWith('leave')")
|
||||
public void processHandler(ProcessEvent processEvent) {
|
||||
log.info("当前任务执行了{}", processEvent.toString());
|
||||
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessKey()));
|
||||
SysUserLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessKey()));
|
||||
testLeave.setStatus(processEvent.getStatus());
|
||||
if (processEvent.isSubmit()) {
|
||||
testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||
@ -145,7 +145,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
@EventListener(condition = "#processTaskEvent.key=='leave1' && #processTaskEvent.taskDefinitionKey=='Activity_14633hx'")
|
||||
public void processTaskHandler(ProcessTaskEvent processTaskEvent) {
|
||||
log.info("当前任务执行了{}", processTaskEvent.toString());
|
||||
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey()));
|
||||
SysUserLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey()));
|
||||
testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||
baseMapper.updateById(testLeave);
|
||||
}
|
Loading…
Reference in New Issue
Block a user