feat(REQ-4624) - 增加表单数据响应模型

This commit is contained in:
wangli 2025-08-04 14:20:02 +08:00
parent 99b7609d14
commit 6fdb3f99ff
2 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,75 @@
package cn.axzo.workflow.common.enums;
import cn.axzo.workflow.common.model.dto.UploadFieldDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import com.alibaba.fastjson.TypeReference;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 流程引擎表单字段类型枚举
* <p>
* 参考文档{@see https://alidocs.dingtalk.com/i/nodes/ZgpG2NdyVXKy17o6fQ5nKGvMWMwvDqPk}
*
* @author wangli
* @since 2025-08-04 11:44
*/
public enum FormFieldTypeEnum {
text("text", "文本", new TypeReference<String>() {
}),
textarea("textarea", "多行文本", new TypeReference<String>() {
}),
upload("upload", "上传文件", new TypeReference<List<UploadFieldDTO>>() {
}),
image("image", "图片", new TypeReference<List<UploadFieldDTO>>() {
}),
date("date", "日期", new TypeReference<String>() {
}),
customComponent("customComponent", "自定义组件", new TypeReference<List<Map<String, Object>>>() {
}),
taskOrder("taskOrder", "任务顺序", new TypeReference<Map<String, Object>>() {
}),
rectifyOrder("rectifyOrder", "整改顺序", new TypeReference<Map<String, Object>>() {
}),
changeSignatureOrder("changeSignatureOrder", "变更签署顺序", new TypeReference<Map<String, Object>>() {
}),
contacts("contacts", "联系人", new TypeReference<List<BpmnTaskDelegateAssigner>>() {
}),
amount("amount", "金额", new TypeReference<String>() {
}),
decimal("decimal", "小数", new TypeReference<Map<String, Object>>() {
}),
;
private final String type;
private final String desc;
private final TypeReference<?> typeReference;
FormFieldTypeEnum(String type, String desc, TypeReference<?> typeReference) {
this.type = type;
this.desc = desc;
this.typeReference = typeReference;
}
public String getType() {
return type;
}
public String getDesc() {
return desc;
}
public TypeReference<?> getTypeReference() {
return typeReference;
}
public static FormFieldTypeEnum valueOfType(String type) {
return Arrays.stream(FormFieldTypeEnum.values())
.filter(i -> Objects.equals(i.getType(), type))
.findAny()
.orElse(null);
}
}

View File

@ -0,0 +1,21 @@
package cn.axzo.workflow.common.model.response.form.instance;
import cn.axzo.workflow.common.enums.FormFieldTypeEnum;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* 表单实例数据的响应模型
*
* @author wangli
* @since 2025-08-04 10:54
*/
@ApiModel("表单实例数据的响应模型")
@Data
public class FormDataVO {
private String fieldId;
private Object fieldValue;
private FormFieldTypeEnum fieldType;
}