add 添加历史流程定义查询 调整流程发布

This commit is contained in:
gssong 2024-08-17 11:18:53 +08:00
parent fb30169da8
commit 0195163181
3 changed files with 44 additions and 5 deletions

View File

@ -46,6 +46,16 @@ public class FlwDefinitionController extends BaseController {
return iFlwDefinitionService.page(flowDefinition, pageQuery);
}
/**
* 获取历史流程定义列表
*
* @param flowCode 参数
*/
@GetMapping("/getHisListByKey/{flowCode}")
public R<List<FlowDefinitionVo>> getHisListByKey(@PathVariable String flowCode) {
return R.ok(iFlwDefinitionService.getHisListByKey(flowCode));
}
/**
* 获取流程定义详细信息
*
@ -86,7 +96,7 @@ public class FlwDefinitionController extends BaseController {
* @param id 流程定义id
*/
@Log(title = "流程定义", businessType = BusinessType.INSERT)
@GetMapping("/publish/{id}")
@PutMapping("/publish/{id}")
@Transactional(rollbackFor = Exception.class)
public R<Boolean> publish(@PathVariable Long id) {
return R.ok(defService.publish(id));
@ -98,11 +108,10 @@ public class FlwDefinitionController extends BaseController {
* @param id 流程定义id
*/
@Log(title = "流程定义", businessType = BusinessType.INSERT)
@GetMapping("/unPublish/{id}")
@PutMapping("/unPublish/{id}")
@Transactional(rollbackFor = Exception.class)
public R<Void> unPublish(@PathVariable Long id) {
defService.unPublish(id);
return R.ok();
public R<Boolean> unPublish(@PathVariable Long id) {
return R.ok(defService.unPublish(id));
}
/**

View File

@ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.workflow.domain.vo.FlowDefinitionVo;
import java.io.IOException;
import java.util.List;
/**
* 流程定义 服务层
@ -24,6 +25,14 @@ public interface IFlwDefinitionService {
*/
TableDataInfo<FlowDefinitionVo> page(FlowDefinition flowDefinition, PageQuery pageQuery);
/**
* 获取历史流程定义列表
*
* @param flowCode 参数
* @return 返回列表
*/
List<FlowDefinitionVo> getHisListByKey(String flowCode);
/**
* 导出流程定义
*

View File

@ -1,10 +1,13 @@
package org.dromara.workflow.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.warm.flow.core.entity.Definition;
import com.warm.flow.core.enums.PublishStatus;
import com.warm.flow.core.service.DefService;
import com.warm.flow.core.utils.page.Page;
import com.warm.flow.orm.entity.FlowDefinition;
import com.warm.flow.orm.mapper.FlowDefinitionMapper;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -18,6 +21,8 @@ import org.dromara.workflow.service.IFlwDefinitionService;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
/**
* 流程定义 服务层实现
@ -30,6 +35,8 @@ import java.io.IOException;
public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
private final DefService defService;
private final FlowDefinitionMapper flowDefinitionMapper;
/**
* 分页查询
*
@ -46,6 +53,20 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
return build;
}
/**
* 获取历史流程定义列表
*
* @param flowCode 参数
*/
@Override
public List<FlowDefinitionVo> getHisListByKey(String flowCode) {
LambdaQueryWrapper<FlowDefinition> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FlowDefinition::getFlowCode, flowCode);
wrapper.in(FlowDefinition::getIsPublish, Arrays.asList(PublishStatus.UNPUBLISHED.getKey(), PublishStatus.EXPIRED.getKey()));
List<FlowDefinition> list = flowDefinitionMapper.selectList(wrapper);
return BeanUtil.copyToList(list, FlowDefinitionVo.class);
}
/**
* 导出流程定义
*