|
@@ -41,8 +41,7 @@ public class PayControlRule implements Serializable {
|
|
|
private String operatorString;
|
|
|
|
|
|
@ApiModelProperty(example="1",notes = "条件值",position = 20)
|
|
|
- @JsonSerialize(using = BigDecimalJsonSerializer.class)
|
|
|
- private BigDecimal value;
|
|
|
+ private String value;
|
|
|
|
|
|
@ApiModelProperty(example="0",notes = "执行动作,0关阀 1开阀",position = 30)
|
|
|
private Integer action;
|
|
@@ -77,31 +76,31 @@ public class PayControlRule implements Serializable {
|
|
|
|
|
|
|
|
|
public Boolean checkCondition(BigDecimal data){
|
|
|
- if(this.operator != null && this.value != null && data != null){
|
|
|
+ if(this.operator != null && StringUtils.isNotBlank(this.value) && data != null){
|
|
|
switch (this.operator) {
|
|
|
case 1: {
|
|
|
condition = "=";
|
|
|
- return value.compareTo(data) == 0;
|
|
|
+ return new BigDecimal(value).compareTo(data) == 0;
|
|
|
}
|
|
|
case 2: {
|
|
|
condition = "<>";
|
|
|
- return value.compareTo(data) != 0;
|
|
|
+ return new BigDecimal(value).compareTo(data) != 0;
|
|
|
}
|
|
|
case 3: {
|
|
|
condition = ">";
|
|
|
- return value.compareTo(data) == -1;
|
|
|
+ return new BigDecimal(value).compareTo(data) == -1;
|
|
|
}
|
|
|
case 4: {
|
|
|
condition = "<";
|
|
|
- return value.compareTo(data) == 1;
|
|
|
+ return new BigDecimal(value).compareTo(data) == 1;
|
|
|
}
|
|
|
case 5: {
|
|
|
condition = ">=";
|
|
|
- return value.compareTo(data) != 1;
|
|
|
+ return new BigDecimal(value).compareTo(data) != 1;
|
|
|
}
|
|
|
case 6: {
|
|
|
condition = "<=";
|
|
|
- return value.compareTo(data) != -1;
|
|
|
+ return new BigDecimal(value).compareTo(data) != -1;
|
|
|
}
|
|
|
}
|
|
|
}
|