update 调整办理监听

remove 删除无用代码
This commit is contained in:
gssong 2024-12-13 23:00:26 +08:00
parent de4f720191
commit fecb3b7302
22 changed files with 37 additions and 583 deletions

View File

@ -30,7 +30,7 @@ public class ProcessTaskEvent implements Serializable {
/**
* 任务id
*/
private String taskId;
private Long taskId;
/**
* 业务id

View File

@ -1,80 +0,0 @@
package org.dromara.workflow.controller;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.web.core.BaseController;
import org.dromara.workflow.domain.bo.WfDefinitionConfigBo;
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
import org.dromara.workflow.service.IWfDefinitionConfigService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 流程定义配置
*
* @author may
* @date 2024-03-18
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/workflow/defConfig")
public class WfDefinitionConfigController extends BaseController {
private final IWfDefinitionConfigService wfDefinitionConfigService;
/**
* 获取流程定义配置详细信息
*
* @param definitionId 主键
*/
@GetMapping("/getByDefId/{definitionId}")
public R<WfDefinitionConfigVo> getByDefId(@NotBlank(message = "流程定义ID不能为空")
@PathVariable String definitionId) {
return R.ok(wfDefinitionConfigService.getByDefId(definitionId));
}
/**
* 新增流程定义配置
*/
@Log(title = "流程定义配置", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/saveOrUpdate")
public R<Void> saveOrUpdate(@Validated(AddGroup.class) @RequestBody WfDefinitionConfigBo bo) {
return toAjax(wfDefinitionConfigService.saveOrUpdate(bo));
}
/**
* 删除流程定义配置
*
* @param ids 主键串
*/
@Log(title = "流程定义配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(wfDefinitionConfigService.deleteByIds(List.of(ids)));
}
/**
* 查询流程定义配置排除当前查询的流程定义
*
* @param tableName 表名
* @param definitionId 流程定义id
*/
@GetMapping("/getByTableNameNotDefId")
public R<List<WfDefinitionConfigVo>> getByTableNameNotDefId(@NotBlank(message = "表名不能为空") @RequestParam String tableName,
@NotBlank(message = "流程定义ID不能为空") @RequestParam String definitionId) {
return R.ok(wfDefinitionConfigService.getByTableNameNotDefId(tableName, definitionId));
}
}

View File

@ -33,11 +33,6 @@ public class WfCategory extends TenantEntity {
*/
private String categoryName;
/**
* 分类编码
*/
private String categoryCode;
/**
* 父级id
*/

View File

@ -1,56 +0,0 @@
package org.dromara.workflow.domain;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 流程定义配置对象 wf_definition_config
*
* @author may
* @date 2024-03-18
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wf_definition_config")
public class WfDefinitionConfig extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id")
private Long id;
/**
* 表名
*/
private String tableName;
/**
* 流程定义ID
*/
private Long definitionId;
/**
* 流程KEY
*/
private String processKey;
/**
* 流程版本
*/
private String version;
/**
* 备注
*/
private String remark;
}

View File

@ -40,7 +40,7 @@ public class FlowInstanceBo implements Serializable {
/**
* 模型分类
*/
private String categoryCode;
private String category;
/**
* 任务名称

View File

@ -29,10 +29,10 @@ public class StartProcessBo implements Serializable {
private String businessKey;
/**
* 表名
* 流程定义编码
*/
@NotBlank(message = "表名不能为空", groups = {AddGroup.class})
private String tableName;
@NotBlank(message = "流程定义编码不能为空", groups = {AddGroup.class})
private String flowCode;
/**
* 流程变量前端会提交一个元素{'entity': {业务详情数据对象}}

View File

@ -33,12 +33,6 @@ public class WfCategoryBo extends BaseEntity {
@NotBlank(message = "分类名称不能为空", groups = {AddGroup.class, EditGroup.class})
private String categoryName;
/**
* 分类编码
*/
@NotBlank(message = "分类编码不能为空", groups = {AddGroup.class, EditGroup.class})
private String categoryCode;
/**
* 父级id
*/

View File

@ -1,59 +0,0 @@
package org.dromara.workflow.domain.bo;
import org.dromara.workflow.domain.WfDefinitionConfig;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 流程定义配置业务对象 wf_form_definition
*
* @author may
* @date 2024-03-18
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = WfDefinitionConfig.class, reverseConvertGenerate = false)
public class WfDefinitionConfigBo extends BaseEntity {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
private Long id;
/**
* 表名
*/
@NotBlank(message = "表名不能为空", groups = {AddGroup.class})
private String tableName;
/**
* 流程定义ID
*/
@NotNull(message = "流程定义ID不能为空", groups = {AddGroup.class})
private Long definitionId;
/**
* 流程KEY
*/
@NotBlank(message = "流程KEY不能为空", groups = {AddGroup.class})
private String processKey;
/**
* 流程版本
*/
@NotBlank(message = "流程版本不能为空", groups = {AddGroup.class})
private String version;
/**
* 备注
*/
private String remark;
}

View File

@ -36,12 +36,6 @@ public class WfCategoryVo implements Serializable {
@ExcelProperty(value = "分类名称")
private String categoryName;
/**
* 分类编码
*/
@ExcelProperty(value = "分类编码")
private String categoryCode;
/**
* 父级id
*/

View File

@ -1,64 +0,0 @@
package org.dromara.workflow.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.workflow.domain.WfDefinitionConfig;
import java.io.Serial;
import java.io.Serializable;
/**
* 流程定义配置视图对象 wf_definition_config
*
* @author may
* @date 2024-03-18
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = WfDefinitionConfig.class)
public class WfDefinitionConfigVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ExcelProperty(value = "主键")
private Long id;
/**
* 表名
*/
@ExcelProperty(value = "表名")
private String tableName;
/**
* 流程定义ID
*/
@ExcelProperty(value = "流程定义ID")
private Long definitionId;
/**
* 流程KEY
*/
@ExcelProperty(value = "流程KEY")
private String processKey;
/**
* 流程版本
*/
@ExcelProperty(value = "流程版本")
private String version;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@ -1,5 +1,6 @@
package org.dromara.workflow.handler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.utils.SpringUtils;
@ -11,6 +12,7 @@ import org.springframework.stereotype.Component;
* @author may
* @date 2024-06-02
*/
@Slf4j
@Component
public class FlowProcessEventHandler {
@ -23,6 +25,7 @@ public class FlowProcessEventHandler {
* @param submit 当为true时为申请人节点办理
*/
public void processHandler(String flowCode, String businessKey, String status, boolean submit) {
log.info("发布流程事件,流程状态: {}, 流程编码: {}, 业务ID: {}", status, flowCode, businessKey);
ProcessEvent processEvent = new ProcessEvent();
processEvent.setFlowCode(flowCode);
processEvent.setBusinessKey(businessKey);
@ -39,7 +42,7 @@ public class FlowProcessEventHandler {
* @param taskId 任务id
* @param businessKey 业务id
*/
public void processTaskHandler(String flowCode, String nodeCode, String taskId, String businessKey) {
public void processTaskHandler(String flowCode, String nodeCode, Long taskId, String businessKey) {
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
processTaskEvent.setFlowCode(flowCode);
processTaskEvent.setNodeCode(nodeCode);

View File

@ -3,15 +3,15 @@ package org.dromara.workflow.listener;
import cn.hutool.core.collection.CollUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.warm.flow.core.entity.Definition;
import org.dromara.warm.flow.core.entity.Instance;
import org.dromara.warm.flow.core.entity.Task;
import org.dromara.warm.flow.core.listener.GlobalListener;
import org.dromara.warm.flow.core.listener.ListenerVariable;
import org.dromara.warm.flow.orm.entity.FlowTask;
import org.dromara.workflow.handler.FlowProcessEventHandler;
import org.dromara.workflow.service.IFlwInstanceService;
import org.dromara.workflow.service.IFlwTaskService;
import org.springframework.stereotype.Component;
@ -30,6 +30,7 @@ public class WorkflowGlobalListener implements GlobalListener {
private final IFlwTaskService taskService;
private final IFlwInstanceService instanceService;
private final FlowProcessEventHandler flowProcessEventHandler;
/**
* 创建监听器任务创建时执行
@ -38,6 +39,15 @@ public class WorkflowGlobalListener implements GlobalListener {
*/
@Override
public void create(ListenerVariable listenerVariable) {
Instance instance = listenerVariable.getInstance();
Definition definition = listenerVariable.getDefinition();
String businessId = instance.getBusinessId();
String flowStatus = instance.getFlowStatus();
Task task = listenerVariable.getTask();
if (task != null && BusinessStatusEnum.WAITING.getStatus().equals(flowStatus)) {
// 判断流程状态发布审批中事件
flowProcessEventHandler.processTaskHandler(definition.getFlowCode(), task.getNodeCode(), task.getId(), businessId);
}
}
/**
@ -68,27 +78,25 @@ public class WorkflowGlobalListener implements GlobalListener {
Instance instance = listenerVariable.getInstance();
Definition definition = listenerVariable.getDefinition();
String businessId = instance.getBusinessId();
String instanceFlowStatus = instance.getFlowStatus();
// 判断流程状态
String status = determineFlowStatus(instance, instanceFlowStatus);
String flowStatus = instance.getFlowStatus();
// 判断流程状态发布驳回作废终止作废已完成事件
String status = determineFlowStatus(instance, flowStatus);
if (StringUtils.isNotBlank(status)) {
// 如果流程状态有效发布事件
publishProcessEvent(status, definition.getFlowCode(), businessId);
flowProcessEventHandler.processHandler(definition.getFlowCode(), businessId, status, false);
}
}
/**
* 根据流程实例和当前流程状态确定最终状态
*
* @param instance 流程实例
* @param instanceFlowStatus 流程实例当前状态
* @param instance 流程实例
* @param flowStatus 流程实例当前状态
* @return 流程最终状态
*/
private String determineFlowStatus(Instance instance, String instanceFlowStatus) {
if (StringUtils.isNotBlank(instanceFlowStatus) && BusinessStatusEnum.initialState(instanceFlowStatus)) {
log.info("流程实例当前状态: {}", instanceFlowStatus);
return instanceFlowStatus;
private String determineFlowStatus(Instance instance, String flowStatus) {
if (StringUtils.isNotBlank(flowStatus) && BusinessStatusEnum.initialState(flowStatus)) {
log.info("流程实例当前状态: {}", flowStatus);
return flowStatus;
} else {
Long instanceId = instance.getId();
List<FlowTask> flowTasks = taskService.selectByInstId(instanceId);
@ -104,21 +112,4 @@ public class WorkflowGlobalListener implements GlobalListener {
}
}
/**
* 发布事件
*
* @param status 状态
* @param flowCode 流程编码
* @param businessId 业务id
*/
private void publishProcessEvent(String status, String flowCode, String businessId) {
log.info("发布流程事件,流程状态: {}, 流程编码: {}, 业务ID: {}", status, flowCode, businessId);
ProcessEvent processEvent = new ProcessEvent();
processEvent.setStatus(status);
processEvent.setSubmit(false);
processEvent.setFlowCode(flowCode);
processEvent.setBusinessKey(businessId);
SpringUtils.context().publishEvent(processEvent);
}
}

View File

@ -1,15 +0,0 @@
package org.dromara.workflow.mapper;
import org.dromara.workflow.domain.WfDefinitionConfig;
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 流程定义配置Mapper接口
*
* @author may
* @date 2024-03-18
*/
public interface WfDefinitionConfigMapper extends BaseMapperPlus<WfDefinitionConfig, WfDefinitionConfigVo> {
}

View File

@ -1,6 +1,5 @@
package org.dromara.workflow.service;
import org.dromara.workflow.domain.WfCategory;
import org.dromara.workflow.domain.bo.WfCategoryBo;
import org.dromara.workflow.domain.vo.WfCategoryVo;
@ -40,12 +39,4 @@ public interface IWfCategoryService {
* 校验并批量删除流程分类信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 按照类别编码查询
*
* @param categoryCode 分类比吗
* @return 结果
*/
WfCategory queryByCategoryCode(String categoryCode);
}

View File

@ -1,83 +0,0 @@
package org.dromara.workflow.service;
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
import org.dromara.workflow.domain.bo.WfDefinitionConfigBo;
import java.util.Collection;
import java.util.List;
/**
* 流程定义配置Service接口
*
* @author may
* @date 2024-03-18
*/
public interface IWfDefinitionConfigService {
/**
* 查询流程定义配置
*
* @param definitionId 流程定义id
* @return 结果
*/
WfDefinitionConfigVo getByDefId(String definitionId);
/**
* 查询流程定义配置
*
* @param tableName 表名
* @return 结果
*/
WfDefinitionConfigVo getByTableNameLastVersion(String tableName);
/**
* 查询流程定义配置
*
* @param definitionId 流程定义id
* @param tableName 表名
* @return 结果
*/
WfDefinitionConfigVo getByDefIdAndTableName(String definitionId, String tableName);
/**
* 查询流程定义配置排除当前查询的流程定义
*
* @param definitionId 流程定义id
* @param tableName 表名
* @return 结果
*/
List<WfDefinitionConfigVo> getByTableNameNotDefId(String tableName, String definitionId);
/**
* 查询流程定义配置列表
*
* @param definitionIds 流程定义id
* @return 结果
*/
List<WfDefinitionConfigVo> queryList(List<String> definitionIds);
/**
* 新增流程定义配置
*
* @param bo 参数
* @return 结果
*/
Boolean saveOrUpdate(WfDefinitionConfigBo bo);
/**
* 删除
*
* @param ids id
* @return 结果
*/
Boolean deleteByIds(Collection<Long> ids);
/**
* 按照流程定义id删除
*
* @param ids 流程定义id
* @return 结果
*/
Boolean deleteByDefIds(Collection<Long> ids);
}

View File

@ -25,7 +25,6 @@ import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
import org.dromara.workflow.mapper.FlwDefMapper;
import org.dromara.workflow.service.IFlwDefinitionService;
import org.dromara.workflow.service.IWfDefinitionConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -46,7 +45,6 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
private final FlowDefinitionMapper flowDefinitionMapper;
private final FlwDefMapper flwDefMapper;
private final FlowHisTaskMapper flowHisTaskMapper;
private final IWfDefinitionConfigService wfDefinitionConfigService;
/**
* 分页查询
@ -59,7 +57,7 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
QueryWrapper<FlowDefinition> queryWrapper = new QueryWrapper<>();
queryWrapper.like(StringUtils.isNotBlank(flowDefinition.getFlowCode()),"flow_code", flowDefinition.getFlowCode());
queryWrapper.like(StringUtils.isNotBlank(flowDefinition.getFlowName()),"flow_Name", flowDefinition.getFlowName());
queryWrapper.like(StringUtils.isNotBlank(flowDefinition.getCategory()),"category", flowDefinition.getCategory());
queryWrapper.eq(StringUtils.isNotBlank(flowDefinition.getCategory()),"category", flowDefinition.getCategory());
queryWrapper.orderByDesc("create_time");
Page<FlowDefinition> page = flwDefMapper.page(pageQuery.build(), queryWrapper);
TableDataInfo<FlowDefinitionVo> build = TableDataInfo.build();
@ -147,7 +145,6 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
}
try {
defService.removeDef(ids);
wfDefinitionConfigService.deleteByDefIds(ids);
} catch (Exception e) {
log.error("Error removing flow definitions: {}", e.getMessage(), e);
throw new RuntimeException("Failed to remove flow definitions", e);

View File

@ -98,9 +98,8 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
*/
@Override
public TableDataInfo<FlowInstanceVo> pageByFinish(FlowInstanceBo flowInstanceBo, PageQuery pageQuery) {
QueryWrapper<FlowInstanceBo> queryWrapper = new QueryWrapper<>();
QueryWrapper<FlowInstanceBo> queryWrapper = buildQueryWrapper(flowInstanceBo);
queryWrapper.in("fi.flow_status", BusinessStatusEnum.finishStatus());
queryWrapper.orderByDesc("fi.create_time");
Page<FlowInstanceVo> page = flwInstanceMapper.page(pageQuery.build(), queryWrapper);
TableDataInfo<FlowInstanceVo> build = TableDataInfo.build();
build.setRows(BeanUtil.copyToList(page.getRecords(), FlowInstanceVo.class));
@ -118,6 +117,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getNodeName()), "fi.node_name", flowInstanceBo.getNodeName());
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowName()), "fd.flow_name", flowInstanceBo.getFlowName());
queryWrapper.like(StringUtils.isNotBlank(flowInstanceBo.getFlowCode()), "fd.flow_code", flowInstanceBo.getFlowCode());
queryWrapper.eq(StringUtils.isNotBlank(flowInstanceBo.getCategory()),"category", flowInstanceBo.getCategory());
queryWrapper.in(CollUtil.isNotEmpty(flowInstanceBo.getCreateByIds()), "fi.create_by", flowInstanceBo.getCreateByIds());
queryWrapper.orderByDesc("fi.create_time");
return queryWrapper;

View File

@ -39,12 +39,10 @@ import org.dromara.workflow.domain.bo.*;
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
import org.dromara.workflow.domain.vo.FlowTaskVo;
import org.dromara.workflow.domain.vo.WfCopy;
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
import org.dromara.workflow.handler.FlowProcessEventHandler;
import org.dromara.workflow.handler.WorkflowPermissionHandler;
import org.dromara.workflow.mapper.FlwTaskMapper;
import org.dromara.workflow.service.IFlwTaskService;
import org.dromara.workflow.service.IWfDefinitionConfigService;
import org.dromara.workflow.utils.WorkflowUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -70,7 +68,6 @@ public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
private final FlowInstanceMapper flowInstanceMapper;
private final FlwTaskMapper flwTaskMapper;
private final UserService userService;
private final IWfDefinitionConfigService wfDefinitionConfigService;
private final FlowTaskMapper flowTaskMapper;
private final FlowHisTaskMapper flowHisTaskMapper;
private final FlowSkipMapper flowSkipMapper;
@ -98,16 +95,6 @@ public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
variables.put(INITIATOR, LoginHelper.getUserIdStr());
// 业务id
variables.put(BUSINESS_KEY, businessKey);
WfDefinitionConfigVo wfDefinitionConfigVo = wfDefinitionConfigService.getByTableNameLastVersion(startProcessBo.getTableName());
if (wfDefinitionConfigVo == null || wfDefinitionConfigVo.getDefinitionId() == null) {
throw new ServiceException("请到流程定义绑定业务表名与流程KEY");
}
Long definitionId = wfDefinitionConfigVo.getDefinitionId();
Definition definition = defService.getById(definitionId);
if (definition == null) {
log.error("流程定义ID【{}】不存在!", definitionId);
throw new ServiceException("请到流程定义ID【" + definitionId + "】不存在!");
}
FlowInstance flowInstance = flowInstanceMapper.selectOne(new LambdaQueryWrapper<>(FlowInstance.class)
.eq(FlowInstance::getBusinessId, businessKey));
if (flowInstance != null) {
@ -115,7 +102,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
return Map.of(PROCESS_INSTANCE_ID, taskList.get(0).getInstanceId(), TASK_ID, taskList.get(0).getId());
}
FlowParams flowParams = new FlowParams();
flowParams.flowCode(wfDefinitionConfigVo.getProcessKey());
flowParams.flowCode(startProcessBo.getFlowCode());
flowParams.variable(startProcessBo.getVariables());
flowParams.flowStatus(BusinessStatusEnum.DRAFT.getStatus());
Instance instance;
@ -147,18 +134,12 @@ public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
List<WfCopy> wfCopyList = completeTaskBo.getWfCopyList();
FlowTask flowTask = flowTaskMapper.selectById(taskId);
Instance ins = insService.getById(flowTask.getInstanceId());
// 获取流程定义信息
Definition definition = defService.getById(flowTask.getDefinitionId());
// 检查流程状态是否为草稿已撤销或已退回状态若是则执行流程提交监听
if (BusinessStatusEnum.isDraftOrCancelOrBack(ins.getFlowStatus())) {
flowProcessEventHandler.processHandler(definition.getFlowCode(), ins.getBusinessId(), ins.getFlowStatus(), true);
}
// 办理任务监听记录任务执行信息
flowProcessEventHandler.processTaskHandler(definition.getFlowCode(), flowTask.getNodeCode(), taskId.toString(), ins.getBusinessId());
// 构建流程参数包括变量跳转类型消息处理人权限等信息
FlowParams flowParams = new FlowParams();
flowParams.variable(completeTaskBo.getVariables());
@ -328,7 +309,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getNodeName()), "t.node_name", flowTaskBo.getNodeName());
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowName()), "t.flow_name", flowTaskBo.getFlowName());
wrapper.like(StringUtils.isNotBlank(flowTaskBo.getFlowCode()), "t.flow_code", flowTaskBo.getFlowCode());
wrapper.in(CollUtil.isNotEmpty(flowTaskBo.getCreateByIds()),"t.create_by",flowTaskBo.getCreateByIds());
wrapper.in(CollUtil.isNotEmpty(flowTaskBo.getCreateByIds()), "t.create_by", flowTaskBo.getCreateByIds());
wrapper.orderByDesc("t.create_time");
return wrapper;
}

View File

@ -88,7 +88,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
bo.setLeaveDays((int) day);
TestLeave add = MapstructUtils.convert(bo, TestLeave.class);
if (StringUtils.isBlank(add.getStatus())) {
add.setStatus(FlowStatus.TOBESUBMIT.getKey());
add.setStatus(BusinessStatusEnum.DRAFT.getStatus());
}
boolean flag = baseMapper.insert(add) > 0;
if (flag) {

View File

@ -49,7 +49,6 @@ public class WfCategoryServiceImpl implements IWfCategoryService {
private LambdaQueryWrapper<WfCategory> buildQueryWrapper(WfCategoryBo bo) {
LambdaQueryWrapper<WfCategory> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), WfCategory::getCategoryName, bo.getCategoryName());
lqw.eq(StringUtils.isNotBlank(bo.getCategoryCode()), WfCategory::getCategoryCode, bo.getCategoryCode());
return lqw;
}
@ -95,14 +94,4 @@ public class WfCategoryServiceImpl implements IWfCategoryService {
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 按照类别编码查询
*
* @param categoryCode 分类比吗
*/
@Override
public WfCategory queryByCategoryCode(String categoryCode) {
return baseMapper.selectOne(new LambdaQueryWrapper<WfCategory>().eq(WfCategory::getCategoryCode, categoryCode));
}
}

View File

@ -1,117 +0,0 @@
package org.dromara.workflow.service.impl;
import cn.hutool.core.collection.CollUtil;
import org.dromara.common.core.utils.MapstructUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.dromara.workflow.domain.WfDefinitionConfig;
import org.dromara.workflow.domain.bo.WfDefinitionConfigBo;
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
import org.dromara.workflow.service.IWfDefinitionConfigService;
import org.springframework.stereotype.Service;
import org.dromara.workflow.mapper.WfDefinitionConfigMapper;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Collection;
/**
* 流程定义配置Service业务层处理
*
* @author may
* @date 2024-03-18
*/
@RequiredArgsConstructor
@Service
public class WfDefinitionConfigServiceImpl implements IWfDefinitionConfigService {
private final WfDefinitionConfigMapper baseMapper;
/**
* 查询流程定义配置
*/
@Override
public WfDefinitionConfigVo getByDefId(String definitionId) {
return baseMapper.selectVoOne(new LambdaQueryWrapper<WfDefinitionConfig>().eq(WfDefinitionConfig::getDefinitionId, definitionId));
}
/**
* 查询流程定义配置
*
* @param tableName 表名
* @return 结果
*/
@Override
public WfDefinitionConfigVo getByTableNameLastVersion(String tableName) {
List<WfDefinitionConfigVo> wfDefinitionConfigVos = baseMapper.selectVoList(
new LambdaQueryWrapper<WfDefinitionConfig>().eq(WfDefinitionConfig::getTableName, tableName).orderByDesc(WfDefinitionConfig::getVersion));
if (CollUtil.isNotEmpty(wfDefinitionConfigVos)) {
return wfDefinitionConfigVos.get(0);
}
return null;
}
/**
* 查询流程定义配置
*
* @param definitionId 流程定义id
* @param tableName 表名
* @return 结果
*/
@Override
public WfDefinitionConfigVo getByDefIdAndTableName(String definitionId, String tableName) {
return baseMapper.selectVoOne(new LambdaQueryWrapper<WfDefinitionConfig>()
.eq(WfDefinitionConfig::getDefinitionId, definitionId)
.eq(WfDefinitionConfig::getTableName, tableName));
}
/**
* 查询流程定义配置排除当前查询的流程定义
*
* @param tableName 表名
* @param definitionId 流程定义id
*/
@Override
public List<WfDefinitionConfigVo> getByTableNameNotDefId(String tableName, String definitionId) {
return baseMapper.selectVoList(new LambdaQueryWrapper<WfDefinitionConfig>()
.eq(WfDefinitionConfig::getTableName, tableName)
.ne(WfDefinitionConfig::getDefinitionId, definitionId));
}
/**
* 查询流程定义配置列表
*/
@Override
public List<WfDefinitionConfigVo> queryList(List<String> definitionIds) {
return baseMapper.selectVoList(new LambdaQueryWrapper<WfDefinitionConfig>().in(WfDefinitionConfig::getDefinitionId, definitionIds));
}
/**
* 新增流程定义配置
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveOrUpdate(WfDefinitionConfigBo bo) {
WfDefinitionConfig add = MapstructUtils.convert(bo, WfDefinitionConfig.class);
baseMapper.delete(new LambdaQueryWrapper<WfDefinitionConfig>().eq(WfDefinitionConfig::getTableName, bo.getTableName()));
add.setTableName(add.getTableName().toLowerCase());
boolean flag = baseMapper.insertOrUpdate(add);
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 批量删除流程定义配置
*/
@Override
public Boolean deleteByIds(Collection<Long> ids) {
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public Boolean deleteByDefIds(Collection<Long> ids) {
return baseMapper.delete(new LambdaQueryWrapper<WfDefinitionConfig>().in(WfDefinitionConfig::getDefinitionId, ids)) > 0;
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.workflow.mapper.WfDefinitionConfigMapper">
</mapper>