| | |
| | | package com.se.simu.controller; |
| | | |
| | | import com.se.simu.domain.LayerVo; |
| | | import com.se.simu.helper.StringHelper; |
| | | import com.se.simu.helper.WebHelper; |
| | | import com.se.simu.service.WaterService; |
| | |
| | | return; |
| | | } |
| | | |
| | | // |
| | | LayerVo layer = waterService.getLayer(serviceName); |
| | | |
| | | WebHelper.writeJson2Page(res, HttpStatus.OK, layer); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | WebHelper.writeStr2Page(res, HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage()); |
| | |
| | | |
| | | private boolean validate(String serviceName, HttpServletResponse res) { |
| | | if (StringHelper.isEmpty(serviceName)) { |
| | | return WebHelper.writeStr2Page(res, HttpStatus.BAD_REQUEST, "服务名不能为空"); |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "服务名不能为空"); |
| | | } |
| | | |
| | | return true; |
| | |
| | | |
| | | private boolean validate(String serviceName, Integer width, Integer height, Long timestamp, HttpServletResponse res) { |
| | | if (StringHelper.isEmpty(serviceName)) { |
| | | return WebHelper.writeStr2Page(res, HttpStatus.BAD_REQUEST, "服务名不能为空"); |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "服务名不能为空"); |
| | | } |
| | | if (null == width || width < MIN_SIZE || width > MAX_SIZE) { |
| | | return WebHelper.writeStr2Page(res, HttpStatus.BAD_REQUEST, "图像宽度不能为空且取值范围为" + MIN_SIZE + "~" + MAX_SIZE + "之间"); |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "图像宽度不能为空且取值范围为" + MIN_SIZE + "~" + MAX_SIZE + "之间"); |
| | | } |
| | | if (null == height || height < MIN_SIZE || height > MAX_SIZE) { |
| | | return WebHelper.writeStr2Page(res, HttpStatus.BAD_REQUEST, "图像高度不能为空且取值范围为" + MIN_SIZE + "~" + MAX_SIZE + "之间"); |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "图像高度不能为空且取值范围为" + MIN_SIZE + "~" + MAX_SIZE + "之间"); |
| | | } |
| | | if (null == timestamp || timestamp < Y2000) { |
| | | return WebHelper.writeStr2Page(res, HttpStatus.BAD_REQUEST, "时间不能为空且大于2000年"); |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "时间不能为空且大于2000年"); |
| | | } |
| | | |
| | | return true; |