|
@@ -28,6 +28,7 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.huaxu.service.SceneService;
|
|
@@ -280,7 +281,7 @@ public class SceneController {
|
|
|
if(rate>=Double.parseDouble(params[0])){
|
|
|
map.put("level","高");
|
|
|
}
|
|
|
- else if(rate>=Double.parseDouble(params[1]) && rate<Double.parseDouble(params[0])){
|
|
|
+ else if(rate>=Double.parseDouble(mParam[1]) && rate<Double.parseDouble(mParam[0])){
|
|
|
map.put("level","中");
|
|
|
}
|
|
|
else if(rate<Double.parseDouble(params[2])){
|
|
@@ -424,10 +425,16 @@ public class SceneController {
|
|
|
* @param str
|
|
|
* @return true:是,false不是
|
|
|
*/
|
|
|
- private boolean validateNumber(String str) {
|
|
|
- if(StringUtils.isBlank(str)) {
|
|
|
- return false;
|
|
|
+ public static boolean validateNumber(String str){
|
|
|
+ Pattern pattern = Pattern.compile("[0-9]*");
|
|
|
+ if(str.indexOf(".")>0){//判断是否有小数点
|
|
|
+ if(str.indexOf(".")==str.lastIndexOf(".") && str.split("\\.").length==2){ //判断是否只有一个小数点
|
|
|
+ return pattern.matcher(str.replace(".","")).matches();
|
|
|
+ }else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ return pattern.matcher(str).matches();
|
|
|
}
|
|
|
- return str.matches("[+-]?[0-9]+(\\\\.[0-9]+)?");
|
|
|
}
|
|
|
}
|