if (StringUtils.isNotBlank(orderHeader.getCityId())) {
//使用正则表达式判断一个字符串类型的数据是纯数字
String cityId = orderHeader.getCityId();
int id=Integer.parseInt(cityId);
City city = cityService.getcitybyid(id);
modelAndView.addObject("cityName", city.getCityname());
}else {
modelAndView.addObject("cityName", cityId);
}
}
//使用正则表达式判断一个字符串类型的数据是纯数字
String cityId = orderHeader.getCityId();
boolean isInt = cityId.matches("[0-9]+");
//为真代表是整形数据
int id=Integer.parseInt(cityId);
City city = cityService.getcitybyid(id);
modelAndView.addObject("cityName", city.getCityname());
}else {
modelAndView.addObject("cityName", cityId);
}
}