Browse Source

流程管理列表页

test
smallchill 6 years ago
parent
commit
c470546a7b
  1. 2
      blade-service-api/blade-dict-api/src/main/java/org/springblade/system/utils/DictUtil.java
  2. 20
      blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/controller/FlowManagerController.java
  3. 6
      blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/entity/FlowProcess.java
  4. 10
      blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/service/FlowService.java
  5. 29
      blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/service/impl/FlowServiceImpl.java

2
blade-service-api/blade-dict-api/src/main/java/org/springblade/system/utils/DictUtil.java

@ -29,7 +29,7 @@ public class DictUtil {
*/
public static String getValue(String code, Integer dictKey) {
String dictValue = CacheUtil.get(CacheConstant.DICT_VALUE, code + StringPool.UNDERSCORE + dictKey, String.class);
if (Func.isEmpty(dictKey)) {
if (Func.isEmpty(dictValue)) {
R<String> result = dictClient.getValue(code, dictKey);
if (result.isSuccess()) {
CacheUtil.put(CacheConstant.DICT_VALUE, code + StringPool.UNDERSCORE + dictKey, result.getData());

20
blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/controller/FlowManagerController.java

@ -16,7 +16,16 @@
*/
package org.springblade.flowable.engine.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.flowable.engine.entity.FlowProcess;
import org.springblade.flowable.engine.service.FlowService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -30,5 +39,16 @@ import org.springframework.web.bind.annotation.RestController;
@AllArgsConstructor
public class FlowManagerController {
private FlowService flowService;
/**
* 分页
*/
@GetMapping("/list")
@ApiOperation(value = "分页", notes = "传入notice", position = 1)
public R<IPage<FlowProcess>> list(@ApiParam("流程类型") String category, Query query) {
IPage<FlowProcess> pages = flowService.selectManagerPage(Condition.getPage(query), category);
return R.data(pages);
}
}

6
blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/entity/ProcessDefinition.java → blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/entity/FlowProcess.java

@ -26,12 +26,12 @@ import java.io.Serializable;
import java.util.Date;
/**
* ProcessDefinition
* FlowProcess
*
* @author Chill
*/
@Data
public class ProcessDefinition implements Serializable {
public class FlowProcess implements Serializable {
private String id;
private String name;
@ -45,7 +45,7 @@ public class ProcessDefinition implements Serializable {
private Integer suspensionState;
private Date deploymentTime;
public ProcessDefinition(ProcessDefinitionEntityImpl entity) {
public FlowProcess(ProcessDefinitionEntityImpl entity) {
this.id = entity.getId();
this.name = entity.getName();
this.key = entity.getKey();

10
blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/service/FlowService.java

@ -19,6 +19,7 @@ package org.springblade.flowable.engine.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.flowable.engine.entity.FlowModel;
import org.springblade.flowable.engine.entity.FlowProcess;
/**
* FlowService
@ -36,6 +37,15 @@ public interface FlowService extends IService<FlowModel> {
*/
IPage<FlowModel> selectFlowPage(IPage<FlowModel> page, FlowModel flowModel);
/**
* 流程管理列表
*
* @param page 分页工具
* @param category 分类
* @return
*/
IPage<FlowProcess> selectManagerPage(IPage<FlowProcess> page, String category);
/**
* 部署流程
*

29
blade-service/blade-flow/src/main/java/org/springblade/flowable/engine/service/impl/FlowServiceImpl.java

@ -28,12 +28,16 @@ import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.Process;
import org.flowable.editor.language.json.converter.BpmnJsonConverter;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.repository.ProcessDefinitionQuery;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.flowable.engine.constant.FlowableConstant;
import org.springblade.flowable.engine.entity.FlowModel;
import org.springblade.flowable.engine.entity.FlowProcess;
import org.springblade.flowable.engine.mapper.FlowMapper;
import org.springblade.flowable.engine.service.FlowService;
import org.springframework.stereotype.Service;
@ -63,6 +67,31 @@ public class FlowServiceImpl extends ServiceImpl<FlowMapper, FlowModel> implemen
return page.setRecords(baseMapper.selectFlowPage(page, flowModel));
}
@Override
public IPage<FlowProcess> selectManagerPage(IPage<FlowProcess> page, String category) {
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().latestVersion().orderByProcessDefinitionKey().asc();
if (StringUtils.isNotEmpty(category)){
processDefinitionQuery.processDefinitionCategory(category);
}
page.setTotal(processDefinitionQuery.count());
List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(Func.toInt(page.getCurrent() - 1), Func.toInt(page.getSize()));
List<FlowProcess> flowProcessList = new ArrayList<>();
for (ProcessDefinition processDefinition : processDefinitionList) {
String deploymentId = processDefinition.getDeploymentId();
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
FlowProcess flowProcess = new FlowProcess((ProcessDefinitionEntityImpl) processDefinition);
flowProcess.setDeploymentTime(deployment.getDeploymentTime());
flowProcessList.add(flowProcess);
}
page.setRecords(flowProcessList);
return page;
}
@Override
public boolean deploy(String modelId, String category) {

Loading…
Cancel
Save