| | |
| | | Object preconditionActualValue = commonMapper.getPreconditionStatus(precondition); |
| | | /*String preconditionActualValueStr = preconditionActualValue.toString(); |
| | | if(precondition.getValue().equals(preconditionActualValueStr)){*/ |
| | | //采用浮点进行数值对比 |
| | | //采用浮点/整型进行数值对比 |
| | | if(preconditionActualValue instanceof Integer) { |
| | | Integer actualValue = (Integer) preconditionActualValue; |
| | | Integer defaultValue = Integer.parseInt(precondition.getValue()); |
| | | |
| | | if (defaultValue.equals(actualValue)) { |
| | | precondition.setStatus(1); |
| | | } else { |
| | | precondition.setStatus(0); |
| | | code.set(-1); |
| | | } |
| | | precondition.setActualValue(actualValue.toString()); |
| | | } |
| | | else if(preconditionActualValue instanceof Float) { |
| | | Float actualValue = (Float) preconditionActualValue; |
| | | Float defaultValue = Float.parseFloat(precondition.getValue()); |
| | | |
| | |
| | | code.set(-1); |
| | | } |
| | | precondition.setActualValue(actualValue.toString()); |
| | | } |
| | | }); |
| | | return new Response().set(code.get(),preconditions); |
| | | } |
| | |
| | | preconditions.stream().forEach(precondition -> { |
| | | //获取对应的值 |
| | | Object preconditionActualValue = commonMapper.getPreconditionStatus(precondition); |
| | | //采用浮点进行数值对比 |
| | | //采用浮点/整型进行数值对比 |
| | | if(preconditionActualValue instanceof Float) { |
| | | Float actualValue = (Float) preconditionActualValue; |
| | | Float defaultValue = Float.parseFloat(precondition.getValue()); |
| | | |
| | |
| | | //记录当前值 |
| | | precondition.setActualValue(actualValue.toString()); |
| | | } |
| | | } |
| | | //采用浮点/整型进行数值对比 |
| | | if(preconditionActualValue instanceof Integer) { |
| | | Integer actualValue = (Integer) preconditionActualValue; |
| | | Integer defaultValue = Integer.parseInt(precondition.getValue()); |
| | | |
| | | if (defaultValue.equals(actualValue)) { |
| | | //条件达成,达成数上+1 |
| | | passNum.set(passNum.get() + 1); |
| | | //记录当前值 |
| | | precondition.setActualValue(actualValue.toString()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | //演示需要 |