优化流程参数保存
This commit is contained in:
@@ -59,10 +59,10 @@ public class FlowableClientFeignClientImpl implements IFlowableFeignClient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse updateNodeParamProcessInstanceId(String processDefinitionId, String processInstanceId) {
|
||||
public SdmResponse updateNodeParamProcessInstanceId(String runId, String processDefinitionId, String processInstanceId) {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = flowableFeignClient.updateNodeParamProcessInstanceId(processDefinitionId, processInstanceId);
|
||||
response = flowableFeignClient.updateNodeParamProcessInstanceId(runId, processDefinitionId, processInstanceId);
|
||||
log.info("更新流程参数的流程实例id:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface IFlowableFeignClient {
|
||||
SdmResponse saveParamsByDefinitionId(@RequestParam String processDefinitionId, @RequestParam String nodeId, @RequestParam String runId,@RequestBody Map<String, Object> params);
|
||||
|
||||
@PostMapping("/process/updateNodeParamProcessInstanceId")
|
||||
SdmResponse updateNodeParamProcessInstanceId(@RequestParam String processDefinitionId, @RequestParam String processInstanceId);
|
||||
SdmResponse updateNodeParamProcessInstanceId(@RequestParam String runId, @RequestParam String processDefinitionId, @RequestParam String processInstanceId);
|
||||
|
||||
@GetMapping("/process/getProcessAndNodeDetailByInstanceId")
|
||||
SdmResponse<ProcessInstanceDetailResponse> getProcessAndNodeDetailByInstanceId(@RequestParam String processDefinitionId,@RequestParam(required = false) String processInstanceId,@RequestParam String runId);
|
||||
|
||||
@@ -109,8 +109,8 @@ public class ProcessController implements IFlowableFeignClient {
|
||||
|
||||
// 启动流程实例后,更新流程参数的流程实例id
|
||||
@PostMapping("/updateNodeParamProcessInstanceId")
|
||||
public SdmResponse updateNodeParamProcessInstanceId(@RequestParam String processDefinitionId, @RequestParam String processInstanceId) {
|
||||
processNodeParamService.updateNodeParamProcessInstanceId(processInstanceId, processDefinitionId);
|
||||
public SdmResponse updateNodeParamProcessInstanceId(@RequestParam String runId, @RequestParam String processDefinitionId, @RequestParam String processInstanceId) {
|
||||
processNodeParamService.updateNodeParamProcessInstanceId(runId,processDefinitionId ,processInstanceId);
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -135,8 +135,10 @@ public class UniversalDelegate implements JavaDelegate {
|
||||
try {
|
||||
if (Files.exists(fullLocalPath)) {
|
||||
//直接删除整个目录
|
||||
log.info("本地目录已存在,将删除并重新创建: {}", fullLocalPath);
|
||||
FileUtils.deleteDirectory(fullLocalPath.toFile());
|
||||
}
|
||||
log.info("创建本地目录: {}", fullLocalPath);
|
||||
Files.createDirectories(fullLocalPath);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法准备本地目录: " + fullLocalPath, e);
|
||||
|
||||
@@ -15,6 +15,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface IProcessNodeParamService extends IService<ProcessNodeParam> {
|
||||
void saveParamByProcessDefinitionId(String processDefinitionId, String nodeId, String runId, Map<String, Object> params);
|
||||
void updateNodeParamProcessInstanceId(String processInstanceId, String processDefinitionId);
|
||||
void updateNodeParamProcessInstanceId(String runId,String processDefinitionId, String processInstanceId );
|
||||
Map<String, Object> getParam(String processDefinitionId, String nodeId, String runId);
|
||||
}
|
||||
@@ -56,16 +56,17 @@ public class ProcessNodeParamServiceImpl extends ServiceImpl<ProcessNodeParamMap
|
||||
}
|
||||
|
||||
// 流程启动后,更新流程实例ID
|
||||
public void updateNodeParamProcessInstanceId(String processInstanceId, String processDefinitionId) {
|
||||
List<ProcessNodeParam> processNodeParams = this.lambdaQuery().eq(ProcessNodeParam::getProcessDefinitionId, processDefinitionId).list();
|
||||
public void updateNodeParamProcessInstanceId(String runId, String processDefinitionId,String processInstanceId ) {
|
||||
List<ProcessNodeParam> processNodeParams = this.lambdaQuery()
|
||||
.eq(ProcessNodeParam::getRunId, runId)
|
||||
.eq(ProcessNodeParam::getProcessDefinitionId, processDefinitionId).list();
|
||||
|
||||
if (ObjectUtils.isNotEmpty(processNodeParams)) {
|
||||
processNodeParams.forEach(param -> {
|
||||
this.lambdaUpdate()
|
||||
.eq(ProcessNodeParam::getId, param.getId())
|
||||
.set(ProcessNodeParam::getProcessInstanceId, processInstanceId)
|
||||
.update();
|
||||
});
|
||||
this.lambdaUpdate()
|
||||
.eq(ProcessNodeParam::getRunId, runId)
|
||||
.eq(ProcessNodeParam::getProcessDefinitionId, processDefinitionId)
|
||||
.set(ProcessNodeParam::getProcessInstanceId, processInstanceId)
|
||||
.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,4 +42,4 @@ fi
|
||||
|
||||
# 启动项目
|
||||
echo "正在启动项目..."
|
||||
nohup java ${JVM_OPTS} -Dspring.profiles.active=dev -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
nohup java ${JVM_OPTS} -Dspring.profiles.active=dev -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5006 -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
|
||||
@@ -1203,7 +1203,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
.set(SimulationRun::getFlowInstanceId, sdmResponse.getData().getProcessInstanceId())
|
||||
.set(SimulationRun::getStatus, RunStatusEnum.RUNNING.getCode())
|
||||
.eq(SimulationRun::getUuid, req.getRunId()).update();
|
||||
flowableFeignClient.updateNodeParamProcessInstanceId(simulationRun.getProcessDefinitionId(), sdmResponse.getData().getProcessInstanceId());
|
||||
flowableFeignClient.updateNodeParamProcessInstanceId(req.getRunId(), simulationRun.getProcessDefinitionId(), sdmResponse.getData().getProcessInstanceId());
|
||||
} else {
|
||||
return SdmResponse.failed("流程实例启动失败");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user