code review 工作流的相关代码
This commit is contained in:
parent
cc56a66332
commit
c186d279ba
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo;
|
|||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("待办任务 Response VO")
|
||||
|
@ -10,6 +9,8 @@ import lombok.ToString;
|
|||
@ToString
|
||||
public class TodoTaskRespVO {
|
||||
|
||||
// TODO @jason:swagger 注解。这样接口文档才完整哈
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,13 +9,13 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
// TODO @jason:类注释
|
||||
@Component
|
||||
public class ReportBackEndProcessor implements ExecutionListener {
|
||||
|
||||
@Resource
|
||||
private OaLeaveMapper leaveMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void notify(DelegateExecution delegateExecution) {
|
||||
|
|
|
@ -52,6 +52,7 @@ public class OALeaveServiceImpl implements OALeaveService {
|
|||
// 插入 OA 请假单
|
||||
OALeaveDO leave = OALeaveConvert.INSTANCE.convert(createReqVO);
|
||||
leave.setStatus(1);
|
||||
// TODO @jason:应该是存储 userId??
|
||||
leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
|
||||
leaveMapper.insert(leave);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import java.util.List;
|
||||
|
||||
// TODO @芋艿:前缀,注释
|
||||
// TODO @json:类和方法的注释。咱是开源项目,有注释,大家才能更容易读懂
|
||||
public interface TaskService {
|
||||
|
||||
PageResult<TodoTaskRespVO> getTodoTaskPage(TodoTaskPageReqVO pageReqVO);
|
||||
|
|
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.*;
|
|||
import cn.iocoder.yudao.adminserver.modules.activiti.convert.workflow.TaskConvert;
|
||||
import cn.iocoder.yudao.adminserver.modules.activiti.service.workflow.TaskService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import org.activiti.api.runtime.shared.query.Page;
|
||||
import org.activiti.api.runtime.shared.query.Pageable;
|
||||
|
@ -42,11 +41,6 @@ public class TaskServiceImpl implements TaskService {
|
|||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
|
||||
public TaskServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TodoTaskRespVO> getTodoTaskPage(TodoTaskPageReqVO pageReqVO) {
|
||||
// TODO @jason:封装一个方法,用于转换成 activiti 的分页对象
|
||||
|
@ -129,9 +123,11 @@ public class TaskServiceImpl implements TaskService {
|
|||
List<TaskStepVO> steps = new ArrayList<>();
|
||||
finished.forEach(instance -> {
|
||||
TaskStepVO stepVO = TaskConvert.INSTANCE.convert(instance);
|
||||
stepVO.setStatus(1);
|
||||
stepVO.setStatus(1); // TODO @jason:1 这个 magic number 要枚举起来。
|
||||
// TODO @jason:可以考虑把 comments 读取后,在统一调用 convert 拼接。另外 Comment 是废弃的类,有没其它可以使用的哈?
|
||||
List<Comment> comments = activitiTaskService.getTaskComments(instance.getTaskId());
|
||||
if (!CollUtil.isEmpty(comments)) {
|
||||
// TODO @jason:IDEA 在 t.getFullMessage() 有提示告警,可以解决下。
|
||||
stepVO.setComment(Optional.ofNullable(comments.get(0)).map(t->t.getFullMessage()).orElse(""));
|
||||
}
|
||||
steps.add(stepVO);
|
||||
|
|
|
@ -101,6 +101,7 @@ public class SecurityFrameworkUtils {
|
|||
WebFrameworkUtils.setLoginUserType(request, loginUser.getUserType());
|
||||
// TODO @jason:使用 userId 会不会更合适哈?
|
||||
// TODO @芋道源码 该值被赋值给 user task 中assignee , username 显示更直白一点
|
||||
// TODO @jason:有办法设置 userId,然后 activiti 有地方读取到 username 么?毕竟 username 只是 User 的登陆账号,并不能绝对像 userId 代表一个用户
|
||||
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(loginUser.getUsername());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue