| | |
| | | import com.dji.sample.common.util.MinioUrlUtils; |
| | | import com.dji.sample.media.model.MediaFileEntity; |
| | | import com.dji.sample.media.service.impl.FileServiceImpl; |
| | | import com.dji.sample.patches.constant.FileSufConstant; |
| | | import com.dji.sample.patches.model.Param.PatchesParam; |
| | | import com.dji.sample.patches.model.entity.LotInfo; |
| | | import com.dji.sample.patches.service.GetPatchesService; |
| | |
| | | // timerUtil.mytask5(); |
| | | // timerUtil.mytask6(); |
| | | // timerUtil.mytask7(); |
| | | |
| | | timerUtil.GtdbOperation(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("db存储发送出现异常" + e); |
| | | } |
| | |
| | | @RequestParam double airportLat, |
| | | @RequestParam double airportLon, |
| | | HttpServletRequest request) throws Exception { |
| | | // 检查格式是否正确 |
| | | if(!checkFileType(file.getOriginalFilename())){ |
| | | throw new RuntimeException("文件格式异常"); |
| | | } |
| | | CustomClaim customClaim = (CustomClaim) request.getAttribute(TOKEN_CLAIM); |
| | | String creator = customClaim.getUsername(); |
| | | MultipartFile multipartFile = shpToDataSourceService.insertGeo(file, workspaceId, waylineName, airportLat, airportLon, creator); |
| | |
| | | return ResponseResult.success(infoMap); |
| | | } |
| | | |
| | | /** |
| | | * 检查文件格式是否正确 |
| | | * @param originalFilename |
| | | * @return |
| | | */ |
| | | private boolean checkFileType(String originalFilename) { |
| | | if (originalFilename.endsWith(FileSufConstant.FILE_SUFFIX_ZIP) || |
| | | originalFilename.endsWith(FileSufConstant.FILE_SUFFIX_KML) || |
| | | originalFilename.endsWith(FileSufConstant.FILE_SUFFIX_KMZ) |
| | | ){ |
| | | return true; |
| | | } |
| | | // 返回 |
| | | return false; |
| | | } |
| | | |
| | | @GetMapping("/getExcel") |
| | | public ResponseEntity<byte[]> exportExcel(@RequestParam String workspaceId) { |
| | | List<LotInfo> lotInfos = getPatchesService.listLotinfo(workspaceId); |
| | | public ResponseEntity<byte[]> exportExcel(@RequestParam String ids) { |
| | | // List<LotInfo> lotInfos = getPatchesService.listLotinfo(workspaceId); |
| | | try { |
| | | List<LotInfo> lotInfos = getPatchesService.getLotInfosByIDs(ids); |
| | | ByteArrayInputStream excelStream = ExcelUtil.exportLotInfoToExcel(lotInfos); |
| | | byte[] excelData = excelStream.readAllBytes(); |
| | | excelStream.close(); |
| | |
| | | return new ResponseEntity<>(excelData, headers, HttpStatus.OK); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return new ResponseEntity<>(("Failed to generate Excel file.").getBytes(), HttpStatus.INTERNAL_SERVER_ERROR); |
| | | return new ResponseEntity<>(("生成excel失败.").getBytes(), HttpStatus.INTERNAL_SERVER_ERROR); |
| | | } |
| | | } |
| | | } |