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

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

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