refactor: 添加相关缺少字段

This commit is contained in:
kyle 2024-01-17 09:29:14 +08:00
parent fc2a8f1311
commit 3720a648d7
8 changed files with 47 additions and 31 deletions

View File

@ -18,7 +18,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
public class BpmProcessInstanceCCMyPageReqVO extends PageParam {
@Schema(description = "流程名称", example = "芋道")
private String name;
private String processInstanceName;
@Schema(description = "流程编号", example = "123456768")
private String processInstanceId;

View File

@ -23,11 +23,7 @@ public class BpmProcessInstanceCCPageItemRespVO {
@Schema(description = "发起人别名")
private String startUserNickname;
/**
* 表单名
*/
@Schema(description = "流程实例的名字")
private String name;
/**
* 流程主键
*/
@ -44,18 +40,16 @@ public class BpmProcessInstanceCCPageItemRespVO {
@Schema(description = "发起抄送的任务名称")
private String taskName;
/**
* 用户主键
*/
@Schema(description = "用户编号")
private Long userId;
@Schema(description = "用户别名")
private String userNickname;
@Schema(description = "抄送原因")
private String reason;
@Schema(description = "抄送人")
private String creator;
@Schema(description = "抄送人别名")
private String creatorNickname;
@Schema(description = "抄送时间")
private LocalDateTime createTime;
}

View File

@ -36,14 +36,14 @@ public interface BpmProcessInstanceCopyConvert {
) {
List<BpmProcessInstanceCCPageItemRespVO> list = convertList(page.getList());
for (BpmProcessInstanceCCPageItemRespVO vo : list) {
MapUtils.findAndThen(userMap, vo.getUserId(),
userName -> vo.setUserNickname(userName));
MapUtils.findAndThen(userMap, Long.valueOf(vo.getCreator()),
vo::setCreatorNickname);
MapUtils.findAndThen(userMap, vo.getStartUserId(),
userName -> vo.setStartUserNickname(userName));
vo::setStartUserNickname);
MapUtils.findAndThen(taskMap, vo.getTaskId(),
name -> vo.setTaskName(name));
vo::setTaskName);
MapUtils.findAndThen(processInstaneMap, vo.getProcessInstanceId(),
name -> vo.setProcessInstanceName(name));
vo::setProcessInstanceName);
}
return new PageResult<>(list, page.getTotal());
}

View File

@ -33,7 +33,7 @@ public class BpmProcessInstanceCopyDO extends BaseDO {
/**
* 流程名
*/
private String name;
private String processInstanceName;
/**
* 流程主键
*/
@ -43,6 +43,12 @@ public class BpmProcessInstanceCopyDO extends BaseDO {
* 任务主键
*/
private String taskId;
/**
* 任务名称
*/
private String taskName;
/**
* 用户主键
*/
@ -53,4 +59,9 @@ public class BpmProcessInstanceCopyDO extends BaseDO {
*/
private String reason;
/**
* 流程分类
*/
private String processDefinitionCategory;
}

View File

@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCMyPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.cc.BpmProcessInstanceCopyDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
@ -14,7 +13,7 @@ public interface BpmProcessInstanceCopyMapper extends BaseMapperX<BpmProcessInst
return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessInstanceCopyDO>()
.eqIfPresent(BpmProcessInstanceCopyDO::getUserId, loginUserId)
.eqIfPresent(BpmProcessInstanceCopyDO::getProcessInstanceId, reqVO.getProcessInstanceId())
.likeIfPresent(BpmProcessInstanceCopyDO::getName, reqVO.getName())
.likeIfPresent(BpmProcessInstanceCopyDO::getProcessInstanceName, reqVO.getProcessInstanceName())
.betweenIfPresent(BpmProcessInstanceCopyDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(BpmProcessInstanceCopyDO::getId));
}

View File

@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -75,6 +76,7 @@ public class BpmProcessInstanceCopyServiceImpl implements BpmProcessInstanceCopy
// 调用
// 设置任务id
copyDO.setTaskId(sourceInfo.getTaskId());
copyDO.setTaskName(FlowableUtils.getTaskNameByTaskId(sourceInfo.getTaskId()));
copyDO.setProcessInstanceId(sourceInfo.getProcessInstanceId());
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
.processInstanceId(sourceInfo.getProcessInstanceId())
@ -84,7 +86,9 @@ public class BpmProcessInstanceCopyServiceImpl implements BpmProcessInstanceCopy
return false;
}
copyDO.setStartUserId(FlowableUtils.getStartUserIdFromProcessInstance(processInstance));
copyDO.setName(FlowableUtils.getFlowName(processInstance.getProcessDefinitionId()));
copyDO.setProcessInstanceName(processInstance.getName());
ProcessDefinition processDefinition = FlowableUtils.getProcessDefinition(processInstance.getProcessDefinitionId());
copyDO.setProcessDefinitionCategory(processDefinition.getCategory());
copyDO.setReason(sourceInfo.getReason());
copyDO.setCreator(sourceInfo.getCreator());
copyDO.setCreateTime(LocalDateTime.now());
@ -131,7 +135,6 @@ public class BpmProcessInstanceCopyServiceImpl implements BpmProcessInstanceCopy
userIds.add(doItem.getStartUserId());
Long userId = Long.valueOf(doItem.getCreator());
userIds.add(userId);
doItem.setUserId(userId);
}
Map<String, String> taskNameByTaskIds = FlowableUtils.getTaskNameByTaskIds(taskIds);

View File

@ -31,11 +31,7 @@ public class BpmProcessInstanceCopyVO {
@Schema(description = "发起人别名")
private String startUserNickname;
/**
* 表单名
*/
@Schema(description = "流程实例的名字")
private String name;
/**
* 流程主键
*/
@ -51,6 +47,8 @@ public class BpmProcessInstanceCopyVO {
@Schema(description = "发起抄送的任务编号")
private String taskId;
@Schema(description = "发起抄送的任务名称")
private String taskName;
/**
* 用户主键
*/
@ -60,6 +58,12 @@ public class BpmProcessInstanceCopyVO {
@Schema(description = "用户别名")
private Long userNickname;
@Schema(description = "抄送原因")
private String reason;
@Schema(description = "抄送人")
private String creator;
@Schema(description = "抄送时间")
private LocalDateTime createTime;
}

View File

@ -31,12 +31,17 @@ public class FlowableUtils {
* @param processDefinitionId
* @return
*/
public static String getFlowName(String processDefinitionId) {
public static String getProcessDefinitionName(String processDefinitionId) {
RepositoryService repositoryService = SpringUtil.getBean(RepositoryService.class);
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId);
return processDefinition.getName();
}
public static ProcessDefinition getProcessDefinition(String processDefinitionId) {
RepositoryService repositoryService = SpringUtil.getBean(RepositoryService.class);
return repositoryService.getProcessDefinition(processDefinitionId);
}
/**
* 获取节点数据
*