| | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | { |
| | | return toAjax(apsGasPipelineMoService.deleteApsGasPipelineMoByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 下载气体预测数据导入模板 |
| | | */ |
| | | @SneakyThrows |
| | | @Operation(summary = "下载气体工单数据导入模板", description = "下载气体工单数据导入模板") |
| | | @RequiresPermissions("gasPipeline:mo:template") |
| | | @Log(title = "下载气体工单数据导入模板", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/template") |
| | | public ResponseEntity<ByteArrayResource> exportTemplate() { |
| | | byte[] file = IOUtils.resourceToByteArray("/templates/上传气体工单数据模板.xlsx"); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, |
| | | String.format("attachment;filename=%s", URLEncoder.encode("气体工单数据模板.xlsx", StandardCharsets.UTF_8))) |
| | | .header(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | | .contentLength(file.length) |
| | | .body(resource); |
| | | } |
| | | } |