提交 415db836 authored 作者: zhoushaopan's avatar zhoushaopan

[工作流模块]流程的假删除,以及流程的处理

上级 2bf38c9f
......@@ -53,7 +53,6 @@ public class FlowsInfoController {
@ApiOperation(value = "查询流程信息")
public ResponseEntity searchFlowInfo(@RequestBody SearchFlowInfoVo searchFlowInfoVo){
Page<FlowsInfo> flowsInfoList = flowInfoService.searchFlowInfo(searchFlowInfoVo);
return ResultUtil.success(flowsInfoList,"查询成功");
}
......@@ -61,7 +60,6 @@ public class FlowsInfoController {
@ApiOperation(value = "编辑流程")
public String editFlow(Long id){
return flowInfoService.editFlow(id).getFilePath();
}
@GetMapping("/deploy")
@ApiOperation(value = "部署流程",notes = "部署成功")
......@@ -75,12 +73,6 @@ public class FlowsInfoController {
return ResultUtil.success(flowsInfo.getState(),"流程部署成功");
}
@PostMapping("/disableFlow")
@ApiOperation(value = "禁用流程",notes = "分页查询")
public ResponseEntity disableFlow(@RequestBody Long flowId){
flowInfoService.disableFlow(flowId);
return ResultUtil.success("禁用成功");
}
@PostMapping("/saveXml")
@ApiOperation(value = "保存xml以及其他流程信息")
......@@ -92,9 +84,6 @@ public class FlowsInfoController {
return ResultUtil.success("文件保存成功");
}
//保存流程中的 节点信息和节点内容
@PostMapping("/updateByProcessName")
@ApiOperation(value = "通过流程名称修改")
public ResponseEntity updateByProcessName(@RequestBody FlowsInfoVo flowsInfoVo) {
......
......@@ -89,17 +89,14 @@ public class WorkFlowController {
@ApiOperation("是否挂起")
public ResponseEntity isSuspension(@RequestBody SuspendVo suspendVo){
workFlowService.suspendOrActivateProcessDefinitionByKey(suspendVo);
return ResultUtil.success("该流程已被挂起");
return ResultUtil.success("该流程已被暂停");
}
@DeleteMapping("/deleteFlow")
@ApiOperation("是否删除")
public ResponseEntity deleteFlow(String deployId){
//根据流程id查询出flowsInfo
FlowsInfo flowsInfo = flowInfoService.findByDeployId(deployId);
//删除flowsInfo
flowInfoService.deleteById(flowsInfo.getId());
workFlowService.deleteFlow(deployId);
public ResponseEntity deleteFlow(Long id){
workFlowService.deleteFlow(id);
return ResultUtil.success("该流程已被删除");
}
......
......@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
......@@ -27,6 +28,7 @@ import java.util.Date;
@NoArgsConstructor
@Entity
@WorkFlowCoreNoScan
@SQLDelete(sql = "update flows_info set deleted = 1 where id = ?")
@Api("流程表")
public class FlowsInfo extends BaseEntity {
@Id
......@@ -71,4 +73,6 @@ public class FlowsInfo extends BaseEntity {
* @params: 部署id
*/
private String deployId;
@ApiModelProperty("是否删除")
private Integer deleted = 0;
}
......@@ -47,12 +47,6 @@ public interface FlowInfoService {
*/
FlowsInfo findByDeployId(String deployId);
/**
* 根据id删除
* @param id id
*/
void deleteById(Long id);
/**
* 根据流程主键查询
* @param flowKey 流程主键
......
......@@ -88,8 +88,6 @@ public interface WorkFlowService {
*/
Map<String,Object> findTaskDetail(String taskId);
/**
* 任务完成
* @param taskVo taskVo
......@@ -120,9 +118,9 @@ public interface WorkFlowService {
/**
* 删除流程
* @param deployId 部署id
* @param id 流程id
*/
void deleteFlow(String deployId);
void deleteFlow(Long id);
/**
......
......@@ -66,10 +66,6 @@ public class FlowInfoServiceImpl implements FlowInfoService {
return flowsInfoMapper.findByDeployId(deployId);
}
@Override
public void deleteById(Long id) {
flowsInfoMapper.deleteById(id);
}
@Override
public FlowsInfo findByFlowKey(String flowKey) {
......
......@@ -58,7 +58,6 @@ public class WorkFlowServiceImpl implements WorkFlowService {
private final RuntimeService runtimeService;
private final TaskService taskService;
private final FlowsInfoMapper flowsInfoMapper;
private final UserService userService;
private final HistoryService historyService;
private final ProcessEngineConfigurationImpl processEngineConfiguration;
......@@ -340,15 +339,24 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Override
public void suspendOrActivateProcessDefinitionByKey(SuspendVo suspendVo) {
if (suspendVo.getSuspensionState() == 1){
repositoryService.suspendProcessDefinitionByKey(suspendVo.getProcessDefinitionKey(), true, new Date());
repositoryService.suspendProcessDefinitionByKey(suspendVo.getFlowKey(), true, new Date());
}else {
repositoryService.activateProcessDefinitionById(suspendVo.getProcessDefinitionKey(),true, new Date());
repositoryService.activateProcessDefinitionById(suspendVo.getFlowKey(),true, new Date());
}
}
@Override
public void deleteFlow(String deployId) {
repositoryService.deleteDeployment(deployId);
public void deleteFlow(Long id) {
//通过流程id查询出flowsInfo
FlowsInfo flowsInfo = flowsInfoMapper.findById(id).get();
//先判断流程是否已经部署
if(flowsInfo.getDeployId() != null){
//已经部署了 (启用)
repositoryService.deleteDeployment(flowsInfo.getDeployId(),true);
}
flowsInfo.setState(1);
flowsInfoMapper.save(flowsInfo);
}
@Override
......
......@@ -20,7 +20,7 @@ public class SuspendVo {
/**
* 流程主键
*/
private String processDefinitionKey;
private String flowKey;
/**
* 是否挂起 1 挂起 0 激活
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论