package com.se.simu.controller; import com.se.simu.domain.po.DataPo; import com.se.simu.domain.vo.R; import com.se.simu.helper.ShpHelper; import com.se.simu.helper.StringHelper; import com.se.simu.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @Api(tags = "Test") @Slf4j @RestController @RequestMapping("/test") @SuppressWarnings("ALL") public class TestController extends BaseController { @Resource UwService uwService; @Resource GedbService gedbService; @Resource SimuService simuService; @Resource Hdf5Service hdf5Service; @Resource ResultService resultService; @ApiOperation(value = "当前时间 *") @GetMapping("/getTime") public Object getTime() { return System.currentTimeMillis(); } @ApiOperation(value = "testCallExe *") @ApiImplicitParams({ @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "20241010095328") }) @GetMapping("/testCallExe") public R testCallExe(String path) { try { DataPo data = new DataPo(); data.setInPath(path); String str = uwService.callExe(data); return success(str); } catch (Exception ex) { return fail(ex, null); } } @ApiOperation(value = "testResuslt *") @ApiImplicitParams({ @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "20241107092342"), @ApiImplicitParam(name = "time", value = "时间", dataType = "String", paramType = "query", example = "2024-11-07 09:23:42") }) @GetMapping("/testResuslt") public R testResuslt(String path, String time) { try { DataPo data = new DataPo(); data.setEpsg(4548); data.setInPath(path); data.setStartTime(StringHelper.YMDHMS_FORMAT.parse(time)); resultService.process(data); return success("ok"); } catch (Exception ex) { return fail(ex, null); } } @ApiOperation(value = "testSww2Tif *") @GetMapping("/testSww2Tif") public R testSww2Tif() { try { DataPo data = new DataPo(); data.setEpsg(4548); data.setInPath("20241010095328"); data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-09-30 00:00:00")); Object rs = uwService.copeDrainFiles(data); return success(rs); } catch (Exception ex) { return fail(ex, null); } } @ApiOperation(value = "testRainfall *") @GetMapping("/testRainfall") public R testRainfall() { try { DataPo data = new DataPo(); data.setEpsg(4548); data.setTotal(60.0); data.setDuration(60); data.setInPath("20241010095328"); data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-07-01 00:00:00")); uwService.createRainFile(data); return success("ok"); } catch (Exception ex) { return fail(ex, null); } } @ApiOperation(value = "testToken *") @GetMapping("/testToken") public R testToken() { try { String token = gedbService.getToken(); return success(token); } catch (Exception ex) { return fail(ex, null); } } @ApiOperation(value = "testPolygonize *") @GetMapping("/testPolygonize") public R testPolygonize() { try { ShpHelper.test(); return success("ok"); } catch (Exception ex) { return fail(ex, null); } } @ApiOperation(value = "testH5 *") @GetMapping("/testH5") public R testH5() { try { DataPo data = new DataPo(); data.setEpsg(4548); data.setInPath("20241010095328"); data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-09-30 00:00:00")); hdf5Service.test(data); return success("ok"); } catch (Exception ex) { return fail(ex, null); } } }