Commit 98159f7d by zhouhaibao

fix(strategy): 修正条件引擎中的值类型映射

- 修复了 SopConditionEngine 中日期值和文本值的处理逻辑颠倒问题
- 纠正了值类型的 switch 语句分支映射关系
- 更新了注释中值类型的描述顺序以匹配实际实现
1 parent e3d94867
...@@ -56,7 +56,7 @@ public class SopStrategyCondition implements Serializable { ...@@ -56,7 +56,7 @@ public class SopStrategyCondition implements Serializable {
private String variableName; private String variableName;
/** /**
* 值类型:3-文本 2-数值 1-日期 4-枚举 * 值类型:1-文本 2-数值 3-日期 4-枚举
*/ */
@Column(name = "value_type", nullable = false) @Column(name = "value_type", nullable = false)
private Integer valueType; private Integer valueType;
......
...@@ -100,11 +100,11 @@ public class SopConditionEngine { ...@@ -100,11 +100,11 @@ public class SopConditionEngine {
private Object getFixedValue(SopStrategyCondition condition, Integer valueType) { private Object getFixedValue(SopStrategyCondition condition, Integer valueType) {
switch (valueType != null ? valueType : 1) { switch (valueType != null ? valueType : 1) {
case 1: case 3:
return condition.getDateValue(); return condition.getDateValue();
case 2: case 2:
return condition.getNumberValue(); return condition.getNumberValue();
case 3: case 1:
return condition.getTextValue(); return condition.getTextValue();
case 4: case 4:
return condition.getEnumValue(); return condition.getEnumValue();
...@@ -117,11 +117,11 @@ public class SopConditionEngine { ...@@ -117,11 +117,11 @@ public class SopConditionEngine {
String conditionStr = conditionValue != null ? String.valueOf(conditionValue) : null; String conditionStr = conditionValue != null ? String.valueOf(conditionValue) : null;
switch (valueType != null ? valueType : 1) { switch (valueType != null ? valueType : 1) {
case 3: case 1:
return compareText(actualValue, conditionStr, operator); return compareText(actualValue, conditionStr, operator);
case 2: case 2:
return compareNumber(actualValue, conditionStr, operator); return compareNumber(actualValue, conditionStr, operator);
case 1: case 3:
return compareDate(actualValue, conditionValue, operator); return compareDate(actualValue, conditionValue, operator);
case 4: case 4:
return compareEnum(actualValue, conditionStr, operator); return compareEnum(actualValue, conditionStr, operator);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!