| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据给定的工作空间ID、航线名称、机场纬度和经度,生成并返回一个包含航线文件的MultipartFile对象。 |
| | | * |
| | | * @param workspaceId 工作空间ID,用于查询相关数据。 |
| | | * @param waylineName 航线名称,用于命名生成的文件。 |
| | | * @param airportLat 机场纬度,用于地理坐标转换和航迹点排序。 |
| | | * @param airportLon 机场经度,用于地理坐标转换和航迹点排序。 |
| | | * @return MultipartFile 对象,包含压缩后的航迹文件。 |
| | | * @throws IOException 如果文件操作失败,则抛出IOException。 |
| | | */ |
| | | @Transactional |
| | | public MultipartFile listFile(String workspaceId, String waylineName, double airportLat, double airportLon) throws IOException { |
| | | List<TbDkjbxxEntity> list = iTbDkjbxxMapper.selectList(null); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult uploadUrl(String url,String taskName) { |
| | | public void uploadUrl(String url, String taskName) { |
| | | if (url.isEmpty()) { |
| | | throw new IllegalArgumentException("上传文件为空"); |
| | | } |
| | | String saveFilePath = territoryConfigPojo.getResource(); // 要保存文件的本地路径 |
| | | |
| | | try { |
| | | downloadFile(url, saveFilePath); |
| | | System.out.println("文件下载完成"); |
| | | } catch (IOException e) { |
| | | System.out.println("下载文件时发生错误:" + e.getMessage()); |
| | | throw new IllegalArgumentException("下载db文件发生错误" + e); |
| | | } |
| | | TimerUtil util=new TimerUtil(); |
| | | util.dbSave(territoryConfigPojo.getResource(),territoryConfigPojo.getResourcesave(),taskName); |
| | | return ResponseResult.success(); |
| | | TimerUtil util = new TimerUtil(); |
| | | util.dbSave(territoryConfigPojo.getResource(), territoryConfigPojo.getResourcesave(), taskName); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据地址下载文件 |
| | | * |
| | | * @param fileUrl |
| | | * @param saveFilePath |
| | | * @throws IOException |
| | | */ |
| | | public static void downloadFile(String fileUrl, String saveFilePath) throws IOException { |
| | | // 创建URL对象 |
| | | URL url = new URL(fileUrl); |
| | |
| | | builder.bsm(file.getFId()) |
| | | .dkbh(file.getFTbbh()) |
| | | .dkfw(file.getFShape()) |
| | | .xzqdm(file.getFXzqdmsys()) |
| | | .xzqdm(file.getFXzqdm()) |
| | | .build(); |
| | | // 将构建好的LotInfo对象添加到infos列表中 |
| | | infos.add(builder.build()); |