@JsonView(Views.Public.class)
@RequestMapping(params = {"meteoStationId", "readTimestamp", "temoerature", "pressuere", "windDirection", "windSpeed"},value = "/update", method = RequestMethod.PUT)
public @ResponseBody AjaxResponseBody update(
@RequestParam(value = "meteoStationId")@NotNull String meteoStationIdS,
@RequestParam(value = "readTimestamp")@NotNull String readTimestampS,
@RequestParam(value = "temoerature") String temoeraturS,
@RequestParam(value = "pressuere") String pressuereS,
@RequestParam(value = "windDirection") String windDirectionS,
@RequestParam(value = "windSpeed") String windSpeedS
){
AjaxResponseBody result = new AjaxResponseBody();
Long meteoStationId = Long.parseLong(meteoStationIdS);
Timestamp readTimestam = new Timestamp(Long.parseLong(readTimestampS));
WeatherStation station = weatherStationsBD.getOne(meteoStationId, readTimestam);
if (station==null){
result.setCode("error");
result.setMsg("error");
return result;
}
if (temoeraturS!=null) {
BigDecimal temoerature = new BigDecimal(temoeraturS);
station.setTemoerature(temoerature);
}
if (windDirectionS!=null) {
Integer windDirection = Integer.parseInt(windDirectionS);
station.setWindDirection(windDirection);
}
if (pressuereS!=null) {
Integer pressuere = Integer.parseInt(pressuereS);
station.setPressuere(pressuere);
}
if (windSpeedS!=null) {
Integer windSpeed = Integer.parseInt(windSpeedS);
station.setWindSpeed(windSpeed);
}
weatherStationsBD.add(station);
result.setCode("200");
result.setMsg("OK");
return result;
}
..., method = RequestMethod.PUT
.public @ResponseBody AjaxResponseBody update(@RequestBody Measurement measurement) { ... }