yxk-20260430-增加setProcessVariable接口,设置流程变量
This commit is contained in:
+17
@@ -10,11 +10,13 @@ import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.flowable.common.engine.api.FlowableException;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.bpm.dto.ProcessVariableDTO;
|
||||
import org.jeecg.modules.bpm.service.impl.ActProcessService;
|
||||
import org.jeecg.modules.extbpm.process.service.IExtActProcessService;
|
||||
import org.jeecg.modules.extbpm.util.CommonRandomUtil;
|
||||
@@ -49,6 +51,8 @@ public class ActProcessController {
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private ActProcessService actProcessService;
|
||||
@Autowired
|
||||
private IExtActProcessService extActProcessService;
|
||||
@@ -74,6 +78,19 @@ public class ActProcessController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/setProcessVariable")
|
||||
@Operation(summary = "设置流程变量")
|
||||
public Result<String> setProcessVariable(@RequestBody ProcessVariableDTO dto) {
|
||||
if (dto == null || oConvertUtils.isEmpty(dto.getProcessInstanceId())) {
|
||||
return Result.error("流程实例ID不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dto.getVarField())) {
|
||||
return Result.error("流程变量名不能为空");
|
||||
}
|
||||
runtimeService.setVariable(dto.getProcessInstanceId(), dto.getVarField(), dto.getVarVal());
|
||||
return Result.OK("保存成功");
|
||||
}
|
||||
|
||||
@PostMapping("deploy")
|
||||
@Operation(summary = "部署流程文件")
|
||||
public Result deploy(@RequestParam("processFile") MultipartFile file) throws IOException {
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package org.jeecg.modules.bpm.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "Process variable DTO")
|
||||
public class ProcessVariableDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "Process instance id")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "Process variable name")
|
||||
private String varField;
|
||||
|
||||
@Schema(description = "Process variable value")
|
||||
private Object varVal;
|
||||
}
|
||||
Reference in New Issue
Block a user