Files
xgy-oa/klp-hrm/src/main/java/com/klp/hrm/controller/HrmFlowTaskController.java

116 lines
4.6 KiB
Java
Raw Normal View History

2025-12-16 16:56:14 +08:00
package com.klp.hrm.controller;
import com.klp.common.annotation.Log;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.PageQuery;
import com.klp.common.core.domain.R;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.enums.BusinessType;
import com.klp.hrm.domain.bo.HrmFlowTaskBo;
2025-12-30 13:47:53 +08:00
import com.klp.hrm.domain.bo.HrmFlowTaskApproveBo;
2025-12-16 16:56:14 +08:00
import com.klp.hrm.domain.bo.HrmSealStampBo;
import com.klp.hrm.domain.vo.HrmFlowTaskVo;
import com.klp.hrm.service.IHrmFlowTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/hrm/flow/task")
public class HrmFlowTaskController extends BaseController {
private final IHrmFlowTaskService service;
@GetMapping("/list")
public TableDataInfo<HrmFlowTaskVo> list(HrmFlowTaskBo bo, PageQuery pageQuery) {
return service.queryPageList(bo, pageQuery);
}
@GetMapping("/todo")
public R<List<HrmFlowTaskVo>> todo(@RequestParam(required = false) Long assigneeUserId) {
2025-12-30 13:47:53 +08:00
2025-12-16 16:56:14 +08:00
HrmFlowTaskBo bo = new HrmFlowTaskBo();
2025-12-30 13:47:53 +08:00
bo.setAssigneeUserId(assigneeUserId);
2025-12-16 16:56:14 +08:00
bo.setStatus("pending");
return R.ok(service.queryList(bo));
2025-12-30 13:47:53 +08:00
}
/**
* 详情页使用 bizType + bizId 查询当前用户的待办任务pending
*/
@GetMapping("/todoByBiz")
public R<HrmFlowTaskVo> todoByBiz(@RequestParam @NotNull String bizType,
@RequestParam @NotNull Long bizId,
@RequestParam(required = false) Long assigneeUserId) {
return R.ok(service.queryTodoByBiz(bizType, bizId, assigneeUserId));
2025-12-16 16:56:14 +08:00
}
@GetMapping("/{taskId}")
public R<HrmFlowTaskVo> getInfo(@PathVariable @NotNull Long taskId) {
return R.ok(service.queryById(taskId));
}
@Log(title = "流程任务", businessType = BusinessType.INSERT)
@PostMapping
public R<Void> add(@Validated @RequestBody HrmFlowTaskBo bo) {
return toAjax(service.insertByBo(bo));
}
@Log(title = "流程任务", businessType = BusinessType.UPDATE)
@PutMapping
public R<Void> edit(@Validated @RequestBody HrmFlowTaskBo bo) {
return toAjax(service.updateByBo(bo));
}
@Log(title = "流程任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{taskIds}")
public R<Void> remove(@PathVariable @NotEmpty Long[] taskIds) {
return toAjax(service.deleteWithValidByIds(Arrays.asList(taskIds), true));
}
@Log(title = "流程任务审批通过", businessType = BusinessType.UPDATE)
@PostMapping("/{taskId}/approve")
public R<Void> approve(@PathVariable @NotNull Long taskId,
@RequestParam(required = false) Long actionUserId,
2025-12-30 13:47:53 +08:00
@RequestBody(required = false) HrmFlowTaskApproveBo approveBo) {
String remark = approveBo != null ? approveBo.getRemark() : null;
HrmSealStampBo stampBo = approveBo != null ? approveBo.getStampBo() : null;
2025-12-16 16:56:14 +08:00
return toAjax(service.approve(taskId, actionUserId, remark, stampBo));
}
@Log(title = "流程任务审批驳回", businessType = BusinessType.UPDATE)
@PostMapping("/{taskId}/reject")
public R<Void> reject(@PathVariable @NotNull Long taskId,
@RequestParam(required = false) Long actionUserId,
@RequestParam(required = false) String remark) {
return toAjax(service.reject(taskId, actionUserId, remark));
}
@Log(title = "流程任务撤回", businessType = BusinessType.UPDATE)
@PostMapping("/{taskId}/withdraw")
public R<Void> withdraw(@PathVariable @NotNull Long taskId,
@RequestParam(required = false) Long actionUserId,
@RequestParam(required = false) String remark) {
return toAjax(service.withdraw(taskId, actionUserId, remark));
}
2025-12-30 13:47:53 +08:00
@Log(title = "流程任务转发", businessType = BusinessType.UPDATE)
@PostMapping("/{taskId}/transfer")
public R<Void> transfer(@PathVariable @NotNull Long taskId,
@RequestParam @NotNull Long newAssigneeUserId,
@RequestParam(required = false) Long actionUserId,
@RequestParam(required = false) String remark) {
return toAjax(service.transfer(taskId, newAssigneeUserId, actionUserId, remark));
}
2025-12-16 16:56:14 +08:00
}