1. 新增业务流程任务表单可配置自定义路由表单选项

fix:
1. 修复 mysql 脚本部分字段未同步脚本的错误
2. 角色为空无法登录系统
3. 主子表缩写命名下代码生成器错误

(cherry picked from commit 3812611b04)
This commit is contained in:
chenbowen
2025-08-06 17:45:38 +08:00
committed by chenbowen
parent 2fee797fe8
commit d21418fb1e
44 changed files with 1037 additions and 632 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -190,7 +190,7 @@ class Convertor(ABC):
yield field, comment_string
def table_comment(self, table_sql: str) -> str:
match = re.search(r"COMMENT \= '([^']+)';", table_sql)
match = re.search(r"COMMENT\s*=\s*'([^']+)';", table_sql)
return match.group(1) if match else None
def print(self):
@@ -837,7 +837,7 @@ def main():
)
args = parser.parse_args()
sql_file = pathlib.Path("../mysql/ai.sql").resolve().as_posix()
sql_file = pathlib.Path("../mysql/ruoyi-vue-pro.sql").resolve().as_posix()
convertor = None
if args.type == "postgres":
convertor = PostgreSQLConvertor(sql_file)

View File

@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.bpm.controller.admin.task;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.business.core.util.DeptUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -142,7 +143,18 @@ public class BpmTaskController {
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
// 获得 Form Map
Map<Long, BpmFormDO> formMap = formService.getFormMap(
convertSet(taskList, task -> NumberUtils.parseLong(task.getFormKey())));
convertSet(taskList, task -> {
String formKey = task.getFormKey();
if (StrUtil.isBlank(formKey)) {
return 0L;
}
try {
return Long.parseLong(formKey);
} catch (NumberFormatException e) {
// 如果 formKey 不是数字比如是URL返回0L
return 0L;
}
}));
return success(BpmTaskConvert.INSTANCE.buildTaskListByProcessInstanceId(taskList,
formMap, userMap, deptMap));
}

View File

@@ -27,4 +27,7 @@ public class BpmTaskApproveReqVO {
@Schema(description = "下一个节点审批人", example = "{nodeId:[1, 2]}")
private Map<String, List<Long>> nextAssignees; // 为什么是 Map而不是 List 呢?因为下一个节点可能是多个,例如说并行网关的情况
// 新增任务变量实例,业务表单
@Schema(description = "任务变量实例,业务表单", example = "{'formField1': 'value1', 'formField2': 'value2'}")
private Map<String, String> taskVariables;
}

View File

@@ -68,6 +68,8 @@ public class BpmTaskRespVO {
@Schema(description = "表单编号", example = "1024")
private Long formId;
@Schema(description = "表单路由", example = "1024")
private String formPath;
@Schema(description = "表单名字", example = "请假表单")
private String formName;
@Schema(description = "表单的配置JSON 字符串")

View File

@@ -103,7 +103,15 @@ public interface BpmTaskConvert {
}
taskVO.setStatus(taskStatus).setReason(FlowableUtils.getTaskReason(task));
// 表单信息
BpmFormDO form = MapUtil.get(formMap, NumberUtils.parseLong(task.getFormKey()), BpmFormDO.class);
BpmFormDO form = null;
try {
Long formId = NumberUtils.parseLong(task.getFormKey());
form = MapUtil.get(formMap, formId, BpmFormDO.class);
} catch (NumberFormatException e) {
// 如果 formKey 不是数字比如是URL设置 formPath
taskVO.setFormPath(task.getFormKey());
taskVO.setFormVariables(FlowableUtils.getTaskFormVariable(task));
}
if (form != null) {
taskVO.setFormId(form.getId()).setFormName(form.getName()).setFormConf(form.getConf())
.setFormFields(form.getFields()).setFormVariables(FlowableUtils.getTaskFormVariable(task));
@@ -146,6 +154,9 @@ public interface BpmTaskConvert {
if (form != null) {
bpmTaskRespVO.setFormId(form.getId()).setFormName(form.getName())
.setFormConf(form.getConf()).setFormFields(form.getFields());
}else{
// 任务级别的业务表单
bpmTaskRespVO.setFormPath(todoTask.getFormKey());
}
return bpmTaskRespVO;
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.*;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
@@ -165,7 +166,13 @@ public class BpmTaskServiceImpl implements BpmTaskService {
// 4. 任务表单
BpmFormDO taskForm = null;
if (StrUtil.isNotBlank(todoTask.getFormKey())) {
taskForm = formService.getForm(NumberUtils.parseLong(todoTask.getFormKey()));
try {
Long formId = Long.parseLong(todoTask.getFormKey());
taskForm = formService.getForm(formId);
} catch (NumberFormatException e) {
// 如果 formKey 不是数字比如是URL则不处理表单
taskForm = null;
}
}
return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm)
@@ -573,6 +580,13 @@ public class BpmTaskServiceImpl implements BpmTaskService {
processVariables.putAll(reqVO.getVariables());
}
// 如果任务变量不为空,设置任务级别的变量实例信息
if (CollUtil.isNotEmpty(reqVO.getTaskVariables())) {
Map<String, String> taskVariables = new HashMap<>();
taskVariables.put("taskVariables", JSONUtil.toJsonStr(reqVO.getTaskVariables()));
taskService.setVariablesLocal(task.getId(), taskVariables);
}
// 4. 校验并处理 APPROVE_USER_SELECT 当前审批人,选择下一节点审批人的逻辑
Map<String, Object> variables = validateAndSetNextAssignees(task.getTaskDefinitionKey(), processVariables,
bpmnModel, reqVO.getNextAssignees(), instance);

View File

@@ -83,7 +83,7 @@ public interface ErrorCodeConstants {
ErrorCode BUSINESS_FILE_NOT_EXISTS = new ErrorCode(1_002_201_010, "业务附件关联不存在");
// ========== 数据命名与简写标准 ==========
ErrorCode STD_NMS_NOT_EXISTS = new ErrorCode(1_002_030_000, "数据命名与简写标准不存在");
ErrorCode STANDARD_NAME_NOT_EXISTS = new ErrorCode(1_002_030_000, "数据命名与简写标准不存在");
ErrorCode STD_ABBR_NOT_EXISTS = new ErrorCode(1_002_030_001, "字段名 {} 不存在命名规范定义,请核对字段定义");
}

Some files were not shown because too many files have changed in this diff Show More