update 调整请假申请返回值,我的发起查询

This commit is contained in:
gssong 2024-03-21 21:48:44 +08:00
parent 6f5a368c86
commit ed8202891f
5 changed files with 27 additions and 20 deletions

View File

@ -77,7 +77,7 @@ public class TestLeaveController extends BaseController {
@Log(title = "请假", businessType = BusinessType.INSERT) @Log(title = "请假", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping() @PostMapping()
public R<TestLeave> add(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) { public R<TestLeaveVo> add(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) {
return R.ok(testLeaveService.insertByBo(bo)); return R.ok(testLeaveService.insertByBo(bo));
} }
@ -88,7 +88,7 @@ public class TestLeaveController extends BaseController {
@Log(title = "请假", businessType = BusinessType.UPDATE) @Log(title = "请假", businessType = BusinessType.UPDATE)
@RepeatSubmit() @RepeatSubmit()
@PutMapping() @PutMapping()
public R<TestLeave> edit(@Validated(EditGroup.class) @RequestBody TestLeaveBo bo) { public R<TestLeaveVo> edit(@Validated(EditGroup.class) @RequestBody TestLeaveBo bo) {
return R.ok(testLeaveService.updateByBo(bo)); return R.ok(testLeaveService.updateByBo(bo));
} }

View File

@ -92,4 +92,9 @@ public class ProcessInstanceVo implements Serializable {
* 待办任务集合 * 待办任务集合
*/ */
private List<TaskVo> taskVoList; private List<TaskVo> taskVoList;
/**
* 表单配置
*/
private WfFormDefinitionVo wfFormDefinitionVo;
} }

View File

@ -35,12 +35,12 @@ public interface ITestLeaveService {
/** /**
* 新增请假 * 新增请假
*/ */
TestLeave insertByBo(TestLeaveBo bo); TestLeaveVo insertByBo(TestLeaveBo bo);
/** /**
* 修改请假 * 修改请假
*/ */
TestLeave updateByBo(TestLeaveBo bo); TestLeaveVo updateByBo(TestLeaveBo bo);
/** /**
* 校验并批量删除请假信息 * 校验并批量删除请假信息

View File

@ -61,6 +61,8 @@ import java.util.List;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.dromara.workflow.common.constant.FlowConstant.PROCESS_DEFINITION_ID;
/** /**
* 流程实例 服务层实现 * 流程实例 服务层实现
* *
@ -654,6 +656,10 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
} }
list.add(processInstanceVo); list.add(processInstanceVo);
} }
if (CollUtil.isNotEmpty(list)) {
List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId);
WorkflowUtils.setWfFormDefinitionVo(list, processDefinitionIds, PROCESS_DEFINITION_ID);
}
long count = query.count(); long count = query.count();
return new TableDataInfo<>(list, count); return new TableDataInfo<>(list, count);
} }

View File

@ -43,7 +43,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
@Override @Override
public TestLeaveVo queryById(Long id) { public TestLeaveVo queryById(Long id) {
TestLeaveVo testLeaveVo = baseMapper.selectVoById(id); TestLeaveVo testLeaveVo = baseMapper.selectVoById(id);
WorkflowUtils.setProcessInstanceVo(testLeaveVo,String.valueOf(id)); WorkflowUtils.setProcessInstanceVo(testLeaveVo, String.valueOf(id));
return testLeaveVo; return testLeaveVo;
} }
@ -75,8 +75,8 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
private LambdaQueryWrapper<TestLeave> buildQueryWrapper(TestLeaveBo bo) { private LambdaQueryWrapper<TestLeave> buildQueryWrapper(TestLeaveBo bo) {
LambdaQueryWrapper<TestLeave> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<TestLeave> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(bo.getLeaveType()), TestLeave::getLeaveType, bo.getLeaveType()); lqw.eq(StringUtils.isNotBlank(bo.getLeaveType()), TestLeave::getLeaveType, bo.getLeaveType());
lqw.ge(bo.getStartLeaveDays() != null,TestLeave::getLeaveDays, bo.getStartLeaveDays()); lqw.ge(bo.getStartLeaveDays() != null, TestLeave::getLeaveDays, bo.getStartLeaveDays());
lqw.le(bo.getEndLeaveDays() != null,TestLeave::getLeaveDays, bo.getEndLeaveDays()); lqw.le(bo.getEndLeaveDays() != null, TestLeave::getLeaveDays, bo.getEndLeaveDays());
lqw.orderByDesc(BaseEntity::getCreateTime); lqw.orderByDesc(BaseEntity::getCreateTime);
return lqw; return lqw;
} }
@ -85,31 +85,27 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
* 新增请假 * 新增请假
*/ */
@Override @Override
public TestLeave insertByBo(TestLeaveBo bo) { public TestLeaveVo insertByBo(TestLeaveBo bo) {
TestLeave add = MapstructUtils.convert(bo, TestLeave.class); TestLeave add = MapstructUtils.convert(bo, TestLeave.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if (flag) { if (flag) {
bo.setId(add.getId()); bo.setId(add.getId());
} }
return add; TestLeaveVo testLeaveVo = MapstructUtils.convert(add, TestLeaveVo.class);
WorkflowUtils.setProcessInstanceVo(testLeaveVo, String.valueOf(add.getId()));
return testLeaveVo;
} }
/** /**
* 修改请假 * 修改请假
*/ */
@Override @Override
public TestLeave updateByBo(TestLeaveBo bo) { public TestLeaveVo updateByBo(TestLeaveBo bo) {
TestLeave update = MapstructUtils.convert(bo, TestLeave.class); TestLeave update = MapstructUtils.convert(bo, TestLeave.class);
validEntityBeforeSave(update); baseMapper.updateById(update);
return baseMapper.updateById(update) > 0 ? update : null; TestLeaveVo testLeaveVo = MapstructUtils.convert(update, TestLeaveVo.class);
} WorkflowUtils.setProcessInstanceVo(testLeaveVo, String.valueOf(update.getId()));
return testLeaveVo;
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(TestLeave entity) {
//TODO 做一些数据校验,如唯一约束
} }
/** /**