From fcefe41e05439f548a58c7e5b6aa6e58f7b80ada Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期一, 23 十二月 2024 11:57:46 +0800 Subject: [PATCH] 1. 新增接口网格数据excel模板、网格数据excel导入 2. 接口解析网格数据抛出相关excel报错信息 3. FileExchange.kt新增excel转换到GridDataDetail列表方法 4. 新增导入excel的单元测试代码 --- src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt index 2ac67d6..b1f9225 100644 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt +++ b/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt @@ -7,7 +7,11 @@ import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam import org.springframework.web.bind.annotation.* +import org.springframework.web.multipart.MultipartFile +import springfox.documentation.annotations.ApiIgnore import java.time.LocalDateTime +import java.time.format.DateTimeFormatter +import javax.servlet.http.HttpServletResponse /** * 鍗槦閬ユ祴 @@ -49,4 +53,22 @@ @ApiParam("缃戞牸缁刬d") @RequestParam(required = false) groupId: Int?, @ApiParam("缃戞牸鍗曞厓鏍糹d") @RequestParam(required = false) cellId: Int?, ) = resPack { satelliteTelemetryService.fetchGridDataDetail(dataId, groupId, cellId) } + + + @ApiOperation(value = "瀵煎叆鍗槦閬ユ祴PM2.5缁撴灉鏁版嵁") + @PostMapping("/import/grid/data") + fun importGridData( + @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int, + @ApiParam("閬ユ祴鏁版嵁绫诲瀷", allowableValues = "0锛氬師濮嬪崼鏄熼仴娴嬫暟鎹紱1锛氳瀺鍚堟暟鎹�") @RequestParam(required = false) type: Int?, + @ApiParam("閬ユ祴鏁版嵁鏃堕棿") + @RequestParam @JsonFormat(pattern = "YYYY-MM-DD HH:mm:ss") dateTime: String?, + @ApiParam("瑕嗙洊鏃ф暟鎹� 0: 涓嶈鐩� 1: 瑕嗙洊") @RequestParam update: Int?, + @RequestParam("excel") file: MultipartFile, + ) = resPack { + satelliteTelemetryService.importGridData(groupId, type, LocalDateTime.parse(dateTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), update, file) + } + + @ApiOperation(value = "涓嬭浇鍗槦閬ユ祴PM2.5缁撴灉鏁版嵁瀵煎叆妯℃澘") + @GetMapping("/import/grid/data/download/template") + fun downloadTemplate(@ApiIgnore response: HttpServletResponse) = satelliteTelemetryService.downloadTemplate(response) } \ No newline at end of file -- Gitblit v1.9.3