feat(REQ-5965) - 调整单选复现条件的存储模式

This commit is contained in:
wangli 2025-12-22 10:40:06 +08:00
parent a7dc35862a
commit 34d4cdea1e
4 changed files with 14 additions and 31 deletions

View File

@ -118,7 +118,7 @@ public interface BpmnConstants {
String CONFIG_FIELD_META = "field"; String CONFIG_FIELD_META = "field";
String CONFIG_FIELD_PERMISSION = "fieldPermission"; String CONFIG_FIELD_PERMISSION = "fieldPermission";
String CONFIG_CONDITION_PERMISSION = "conditionPermission"; String CONFIG_CONDITION_PERMISSION = "conditionPermission";
String CONFIG_FIELD_OPTION = "option"; String CONFIG_FIELD_OPTIONS = "options";
String CONFIG_NODE_TYPE = "nodeType"; String CONFIG_NODE_TYPE = "nodeType";
String CONFIG_BUTTON_TYPE_INITIATOR = "initiator"; String CONFIG_BUTTON_TYPE_INITIATOR = "initiator";
String CONFIG_BUTTON_TYPE_CURRENT = "current"; String CONFIG_BUTTON_TYPE_CURRENT = "current";

View File

@ -27,7 +27,7 @@ public class BpmnFieldOptionConf implements Serializable {
* 选项的值 * 选项的值
*/ */
@ApiModelProperty(value = "选项的值", example = "1") @ApiModelProperty(value = "选项的值", example = "1")
private String value; private Object value;
public String getName() { public String getName() {
return name; return name;
@ -37,11 +37,11 @@ public class BpmnFieldOptionConf implements Serializable {
this.name = name; this.name = name;
} }
public String getValue() { public Object getValue() {
return value; return value;
} }
public void setValue(String value) { public void setValue(Object value) {
this.value = value; this.value = value;
} }
} }

View File

@ -90,7 +90,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_INITIATOR; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_INITIATOR;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_META; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_META;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTION; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTIONS;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_NOTICE; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_NOTICE;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_TYPE; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_TYPE;
@ -346,22 +346,10 @@ public final class BpmnJsonConverterUtil {
field.addAttribute(fieldCode); field.addAttribute(fieldCode);
if (!CollectionUtils.isEmpty(i.getOptions())) { if (!CollectionUtils.isEmpty(i.getOptions())) {
i.getOptions().forEach(j -> { ExtensionAttribute fieldOptions = new ExtensionAttribute();
ExtensionElement option = new ExtensionElement(); fieldCode.setName(CONFIG_FIELD_OPTIONS);
option.setName(CONFIG_FIELD_OPTION); fieldCode.setValue(JSON.toJSONString(i.getOptions()));
field.addAttribute(fieldOptions);
ExtensionAttribute optionName = new ExtensionAttribute();
optionName.setName(ELEMENT_ATTRIBUTE_NAME);
optionName.setValue(j.getName());
option.addAttribute(optionName);
ExtensionAttribute optionValue = new ExtensionAttribute();
optionValue.setName(ELEMENT_ATTRIBUTE_VALUE);
optionValue.setValue(j.getValue());
option.addAttribute(optionValue);
field.addChildElement(option);
});
} }
fieldConfigElement.addChildElement(field); fieldConfigElement.addChildElement(field);
}); });

View File

@ -86,7 +86,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY_
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CONDITION_PERMISSION; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CONDITION_PERMISSION;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_META; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_META;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTION; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTIONS;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_PERMISSION; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_PERMISSION;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_LEADER_RANGE_UNIT; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_LEADER_RANGE_UNIT;
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_EXCLUDE_COOPERATE_TYPES; import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_EXCLUDE_COOPERATE_TYPES;
@ -433,15 +433,9 @@ public final class BpmnMetaParserHelper {
conf.setName(i.getAttributeValue(null, ELEMENT_ATTRIBUTE_NAME)); conf.setName(i.getAttributeValue(null, ELEMENT_ATTRIBUTE_NAME));
conf.setCode(i.getAttributeValue(null, ELEMENT_ATTRIBUTE_CODE)); conf.setCode(i.getAttributeValue(null, ELEMENT_ATTRIBUTE_CODE));
List<BpmnFieldOptionConf> options = new ArrayList<>(); String fieldOptionsJsonStr = i.getAttributeValue(null, CONFIG_FIELD_OPTIONS);
if (!CollectionUtils.isEmpty(i.getChildElements())) { if (StringUtils.hasText(fieldOptionsJsonStr)) {
i.getChildElements().get(CONFIG_FIELD_OPTION).forEach(j -> { conf.setOptions(JSON.parseArray(fieldOptionsJsonStr, BpmnFieldOptionConf.class));
BpmnFieldOptionConf option = new BpmnFieldOptionConf();
option.setName(j.getAttributeValue(null, ELEMENT_ATTRIBUTE_NAME));
option.setValue(j.getAttributeValue(null, ELEMENT_ATTRIBUTE_VALUE));
options.add(option);
});
conf.setOptions(options);
} }
fields.add(conf); fields.add(conf);
@ -703,6 +697,7 @@ public final class BpmnMetaParserHelper {
return defaultValid(flowElement, CONFIG_CONDITION_PERMISSION).map(element -> JSON.parseObject(element.getElementText(), new TypeReference<List<ConditionPermissionMetaInfo>>() { return defaultValid(flowElement, CONFIG_CONDITION_PERMISSION).map(element -> JSON.parseObject(element.getElementText(), new TypeReference<List<ConditionPermissionMetaInfo>>() {
}.getType())); }.getType()));
} }
public static Optional<ImmutableTable<String, String, Integer>> getFormFieldPermissionForCalc(FlowElement flowElement) { public static Optional<ImmutableTable<String, String, Integer>> getFormFieldPermissionForCalc(FlowElement flowElement) {
List<FormPermissionMetaInfo> fieldMetaInfos = getFormFieldPermissionConf(flowElement).orElse(new ArrayList<>()); List<FormPermissionMetaInfo> fieldMetaInfos = getFormFieldPermissionConf(flowElement).orElse(new ArrayList<>());
return getFormFieldPermissionForModel(fieldMetaInfos); return getFormFieldPermissionForModel(fieldMetaInfos);