yxk-20260429-增加/saveBpmForm接口,保存业务数据的同时更新流程的json_data

This commit is contained in:
ye1023
2026-04-29 17:42:26 +08:00
parent 8c2f048b02
commit f42b673fb1
4 changed files with 52 additions and 0 deletions
+4
View File
@@ -17,6 +17,10 @@
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-module-bpm-flowable</artifactId>
</dependency>
</dependencies>
</project>
@@ -1,5 +1,7 @@
package org.jeecg.modules.demo.bgpartymatter.controller;
import com.alibaba.fastjson.JSONObject;
import org.flowable.engine.RuntimeService;
import org.jeecg.common.system.query.QueryGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.common.system.query.QueryRuleEnum;
@@ -16,6 +18,7 @@ import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import java.util.HashMap;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.bgpartymatter.dto.BgPartymatterBpmSaveDTO;
import org.jeecg.modules.demo.bgpartymatter.entity.BgPartymatterFeedback;
import org.jeecg.modules.demo.bgpartymatter.entity.BgPartymatter;
import org.jeecg.modules.demo.bgpartymatter.service.IBgPartymatterService;
@@ -55,6 +58,8 @@ public class BgPartymatterController extends JeecgController<BgPartymatter, IBgP
@Autowired
private IBgPartymatterFeedbackService bgPartymatterFeedbackService;
@Autowired
protected RuntimeService runtimeService;
/*---------------------------------主表处理-begin-------------------------------------*/
@@ -116,6 +121,20 @@ public class BgPartymatterController extends JeecgController<BgPartymatter, IBgP
return Result.OK("编辑成功!");
}
@PostMapping(value = "/saveBpmForm")
public Result<String> saveBpmForm(@RequestBody BgPartymatterBpmSaveDTO dto) {
if (dto == null || dto.getFormData() == null || oConvertUtils.isEmpty(dto.getFormData().getId())) {
return Result.error("表单数据不存在");
}
if (oConvertUtils.isEmpty(dto.getProcessInstanceId())) {
return Result.error("流程实例ID不能为空");
}
String varField = oConvertUtils.isEmpty(dto.getVarField()) ? "json_data" : dto.getVarField();
bgPartymatterService.updateById(dto.getFormData());
runtimeService.setVariable(dto.getProcessInstanceId(), varField, JSONObject.toJSONString(dto.getFormData()));
return Result.OK("保存成功");
}
/**
* 通过id删除
* @param id
@@ -0,0 +1,23 @@
package org.jeecg.modules.demo.bgpartymatter.dto;
import java.io.Serializable;
import org.jeecg.modules.demo.bgpartymatter.entity.BgPartymatter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "BgPartymatter BPM form save DTO")
public class BgPartymatterBpmSaveDTO 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 = "BgPartymatter form data")
private BgPartymatter formData;
}