| | |
| | | }); |
| | | } |
| | | }else { |
| | | BigDecimal dataValue = Objects.nonNull(list.getDataValue())?BigDecimal.valueOf(Integer.parseInt(list.getDataValue())):BigDecimal.ZERO; |
| | | BigDecimal dataValue = Objects.nonNull(list.getDataValue())?BigDecimal.valueOf(Double.parseDouble(list.getDataValue())):BigDecimal.ZERO; |
| | | result.forEach(it->{ |
| | | it.setAvgNum(it.getAvgNum().add(dataValue)); |
| | | }); |
| | |
| | | private BigDecimal numAvg(List<String> list , BigDecimal num){ |
| | | int nums = 1; |
| | | for (int i=0;i<list.size();i=i+2){ |
| | | if(num.compareTo(BigDecimal.valueOf(Integer.parseInt(list.get(i))))>= 0 ){ |
| | | return num.add(BigDecimal.valueOf(Integer.parseInt(list.get(nums)))); |
| | | if(num.compareTo(BigDecimal.valueOf(Double.parseDouble(list.get(i))))>= 0 ){ |
| | | return num.add(BigDecimal.valueOf(Double.parseDouble(list.get(i+1)))); |
| | | } |
| | | nums+=2; |
| | | } |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private double getDivisor(String code,double num){ |
| | | double rs = 0.0; |
| | | if (code.contains("-")){ |
| | | String data = code.substring(1); |
| | | rs = num - Double.parseDouble(data); |
| | | } else if (code.contains("*")){ |
| | | String data = code.substring(1); |
| | | rs = num * Double.parseDouble(data); |
| | | } else if (code.contains("/")){ |
| | | String data = code.substring(1); |
| | | rs = num / Double.parseDouble(data); |
| | | } else if (code.contains(",")){ |
| | | String[] split = code.split(","); |
| | | for (String s : split) { |
| | | String[] split1 = s.split("<"); |
| | | double sp1 = Double.parseDouble(split1[0]); |
| | | double sp2 = Double.parseDouble(split1[1]); |
| | | double sp3 = Double.parseDouble(split1[2]); |
| | | if (num>=sp1 && num<=sp2){ |
| | | rs = num + sp3; |
| | | } |
| | | } |
| | | }else { |
| | | rs = num + Double.parseDouble(code); |
| | | } |
| | | return rs; |
| | | } |
| | | } |