code review 工作流的相关代码

This commit is contained in:
YunaiV 2021-11-02 07:56:05 +08:00
parent cc56a66332
commit c186d279ba
6 changed files with 9 additions and 9 deletions

View File

@ -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 @jasonswagger 注解这样接口文档才完整哈
private String id;
/**

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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 @jason1 这个 magic number 要枚举起来
// TODO @jason可以考虑把 comments 读取后在统一调用 convert 拼接另外 Comment 是废弃的类有没其它可以使用的哈
List<Comment> comments = activitiTaskService.getTaskComments(instance.getTaskId());
if (!CollUtil.isEmpty(comments)) {
// TODO @jasonIDEA t.getFullMessage() 有提示告警可以解决下
stepVO.setComment(Optional.ofNullable(comments.get(0)).map(t->t.getFullMessage()).orElse(""));
}
steps.add(stepVO);

View File

@ -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());
}