| | |
| | | |
| | | import com.se.simu.helper.WebHelper; |
| | | import com.se.simu.service.WaterService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * 内涝控制器 |
| | | * 内涝管理 |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-16 |
| | | */ |
| | | @Api(tags = "内涝管理") |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/waterlogging") |
| | |
| | | |
| | | private final static long Y2000 = 949334400000L; |
| | | |
| | | /** |
| | | * 获取当前时间 |
| | | */ |
| | | @GetMapping("/getTime") |
| | | public Object getTime() { |
| | | return System.currentTimeMillis(); |
| | | } |
| | | |
| | | /** |
| | | * 获取元数据信息 |
| | | */ |
| | | @ApiOperation(value = "获取元数据信息") |
| | | @GetMapping("/{serviceName}/layer.json") |
| | | public void getLayer(@PathVariable String serviceName, HttpServletResponse res) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取地形高度图 |
| | | */ |
| | | @ApiOperation(value = "获取地形高度图") |
| | | @GetMapping("/{serviceName}/terrain") |
| | | public void getTerraMap(@PathVariable String serviceName, Integer width, Integer height, HttpServletResponse res) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取水面高度图 |
| | | */ |
| | | @ApiOperation(value = "获取水面高度图") |
| | | @GetMapping("/{serviceName}/waterMap") |
| | | public void getWaterMap(@PathVariable String serviceName, Integer width, Integer height, Long timestamp, HttpServletResponse res) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取水流向流速图 |
| | | */ |
| | | @ApiOperation(value = "获取水流向流速图") |
| | | @GetMapping("/{serviceName}/flowMap") |
| | | public void getFlowMap(@PathVariable String serviceName, Integer width, Integer height, Long timestamp, HttpServletResponse res) { |
| | | try { |
| | |
| | | if (null == height || height < MIN_SIZE || height > MAX_SIZE) { |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "图像高度不能为空且取值范围为" + MIN_SIZE + "~" + MAX_SIZE + "之间"); |
| | | } |
| | | if (null == timestamp || timestamp < Y2000) { |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "时间不能为空且大于2000年"); |
| | | if (null == timestamp || timestamp < 0) { |
| | | return WebHelper.writeJson2Page(res, HttpStatus.BAD_REQUEST, "时间不能为空且大于0"); |
| | | } |
| | | |
| | | return true; |