@@ -97,9 +97,12 @@ type NodeCondition struct {
97
97
ParamLabel string `json:"paramLabel,omitempty"`
98
98
IsEmpty bool `json:"isEmpty,omitempty"`
99
99
// 类型为range
100
- LowerBound string `json:"lowerBound,omitempty"`
101
- UpperBound string `json:"upperBound,omitempty"`
102
- Unit string `json:"unit,omitempty"`
100
+ LowerBound string `json:"lowerBound,omitempty"`
101
+ LowerBoundEqual string `json:"lowerBoundEqual,omitempty"`
102
+ UpperBoundEqual string `json:"upperBoundEqual,omitempty"`
103
+ UpperBound string `json:"upperBound,omitempty"`
104
+ BoundEqual string `json:"boundEqual,omitempty"`
105
+ Unit string `json:"unit,omitempty"`
103
106
// 类型为 value
104
107
ParamValues []string `json:"paramValues,omitempty"`
105
108
OriValue []string `json:"oriValue,omitempty"`
@@ -122,6 +125,7 @@ type NodeInfo struct {
122
125
Aprover string `json:"approver"`
123
126
AproverType string `json:"aproverType"`
124
127
MemberCount int8 `json:"memberCount"`
128
+ Level int8 `json:"level"`
125
129
ActType string `json:"actType"`
126
130
}
127
131
@@ -395,16 +399,26 @@ func checkConditions(cond *NodeCondition, value string) (bool, error) {
395
399
if err != nil {
396
400
return false , err
397
401
}
398
- if len (cond .LowerBound ) == 0 && len (cond .UpperBound ) == 0 {
402
+ if len (cond .LowerBound ) == 0 && len (cond .UpperBound ) == 0 && len ( cond . LowerBoundEqual ) == 0 && len ( cond . UpperBoundEqual ) == 0 && len ( cond . BoundEqual ) == 0 {
399
403
return false , errors .New ("条件【" + cond .Type + "】的上限或者下限值不能全为空" )
400
404
}
401
- // 判断下限,lowerBound包含等于
405
+ // 判断下限,lowerBound
402
406
if len (cond .LowerBound ) > 0 {
403
407
low , err := strconv .Atoi (cond .LowerBound )
404
408
if err != nil {
405
409
return false , err
406
410
}
407
- if val < low {
411
+ if val <= low {
412
+ // fmt.Printf("val:%d小于lowerBound:%d\n", val, low)
413
+ return false , nil
414
+ }
415
+ }
416
+ if len (cond .LowerBoundEqual ) > 0 {
417
+ le , err := strconv .Atoi (cond .LowerBoundEqual )
418
+ if err != nil {
419
+ return false , err
420
+ }
421
+ if val < le {
408
422
// fmt.Printf("val:%d小于lowerBound:%d\n", val, low)
409
423
return false , nil
410
424
}
@@ -415,8 +429,25 @@ func checkConditions(cond *NodeCondition, value string) (bool, error) {
415
429
if err != nil {
416
430
return false , err
417
431
}
418
- if val > upper {
419
- // fmt.Printf("val:%d大于upperBound:%d\n", val, upper)
432
+ if val >= upper {
433
+ return false , nil
434
+ }
435
+ }
436
+ if len (cond .UpperBoundEqual ) > 0 {
437
+ ge , err := strconv .Atoi (cond .UpperBoundEqual )
438
+ if err != nil {
439
+ return false , err
440
+ }
441
+ if val > ge {
442
+ return false , nil
443
+ }
444
+ }
445
+ if len (cond .BoundEqual ) > 0 {
446
+ equal , err := strconv .Atoi (cond .BoundEqual )
447
+ if err != nil {
448
+ return false , err
449
+ }
450
+ if val != equal {
420
451
return false , nil
421
452
}
422
453
}
0 commit comments