修改人工拍照图片保存,新增面状航线保存、修改接口,图斑文件上传格式修改
| | |
| | | |
| | | @TableField("job_name") |
| | | private String jobName; |
| | | |
| | | @TableField(value = "drone_data", typeHandler = FastjsonTypeHandler.class) |
| | | private Object dronedata; |
| | | |
| | | } |
| | |
| | | MediaFileEntity fileEntity = this.fileUploadConvertToEntity(file); |
| | | fileEntity.setWorkspaceId(workspaceId); |
| | | fileEntity.setFileId(UUID.randomUUID().toString()); |
| | | int count=mapper.insert(fileEntity); |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | updateStatue(file.getName()); |
| | | if (!file.getObjectKey().endsWith(".mp4")){ |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | saveNailFile(workspaceId,file,file1); |
| | | Object data = ImgUtil.getInfo(file1); |
| | | fileEntity.setDroneData(data); |
| | | file1.delete(); |
| | | } |
| | | else { |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | saveNailFile(workspaceId,file,file1); |
| | | file1.delete(); |
| | | } |
| | | return count; |
| | | int count = mapper.insert(fileEntity); |
| | | String url = pojo.getEndpoint() + "/" + pojo.getBucket() + file.getObjectKey(); |
| | | if (file.getObjectKey().endsWith(".jpeg")) { |
| | | File file1 = TbFjServiceImpl.downloadFile(url); |
| | | Object data = ImgUtil.getInfo(file1); |
| | | fileEntity.setDroneData(data); |
| | | saveNailFile(workspaceId, file, file1,data); |
| | | count = mapper.insert(fileEntity); |
| | | file1.delete(); |
| | | } |
| | | if (file.getObjectKey().endsWith(".mp4")) { |
| | | saveNailFile(workspaceId, file, null,null); |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | public void saveNailFile(String workspaceId,FileUploadDTO file,File file1) throws IOException { |
| | | public void saveNailFile(String workspaceId, FileUploadDTO file, File file1,Object data) throws IOException { |
| | | updateStatue(file.getName()); |
| | | boolean endsWith = file.getObjectKey().endsWith(".mp4"); |
| | | if (endsWith) { |
| | | MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity((file)); |
| | |
| | | File nailFile = new File(ImgZipUtil.compressImage(file1, 50).toURI()); |
| | | MediaFileNailEntity nailEntity = this.fileUploadConvertToNailEntity(file); |
| | | nailEntity.setIsOriginal(false); |
| | | nailEntity.setDronedata(data); |
| | | nailEntity.setWorkspaceId(workspaceId); |
| | | nailEntity.setFileName("nail" + file.getName()); |
| | | nailEntity.setObjectKey("/nail" + file.getPath() + "/" + file.getName()); |
| | |
| | | String nailName = nailEntity.getObjectKey(); |
| | | nailEntity.setFileId(UUID.randomUUID().toString()); |
| | | uploadFile(pojo.getEndpoint(), pojo.getAccessKey(), pojo.getSecretKey(), pojo.getBucket(), nailName, nailFile, "image/jpeg"); |
| | | uploadFile("http://139.196.74.78:9000", "sxkj", "sxkj2024", "cloud-bucket", nailName, nailFile, "image/jpeg"); |
| | | nailMapper.insert(nailEntity); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Object mediaInfo(String filename) { |
| | | String name = filename; |
| | |
| | | // 下载并压缩文件到本地目录 |
| | | String localSaveDir = "/data/software/minio-data/zip-bucket/"; // 修改为你想保存的本地目录 |
| | | downloader.downloadAndZipFolders(jobIds, localSaveDir); |
| | | } catch (Exception e) { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResponseResult.error("下载失败"+e.getMessage()); |
| | | return ResponseResult.error("下载失败" + e.getMessage()); |
| | | } |
| | | return ResponseResult.success("下载成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getUniqueFilePaths(List<String> jobIds) { |
| | | return mapper.selectList( |
| | |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<MediaFileDTO> getFilesByWorkspaceAndJobId(String workspaceId, String jobId) { |
| | | return mapper.selectList(new LambdaQueryWrapper<MediaFileEntity>() |
| | |
| | | |
| | | return builder.build(); |
| | | } |
| | | |
| | | public static void uploadFile(String endpoint, String accessKey, String secretKey, String bucketName, String objectName, File file, String type) { |
| | | try { |
| | | // 创建MinIO客户端实例 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PaginationData<MediaFileEntity> getJobId(int pageNum, int pageSize, String workspaceId) { |
| | | List<MediaFileEntity> allRecords = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PaginationData<MediaFileEntity> getPhotoByJobId(int pageNum, int pageSize, String workspaceId, String jobId) { |
| | | |
| | |
| | | |
| | | return new PaginationData<>(pagedUniqueFiles, pagination); |
| | | } |
| | | |
| | | |
| | | |
| | | public List<MediaFileEntity> getMedia(String jobId) { |
| | |
| | | private String destKMZFile; |
| | | @Value("${patches.url.path.kmz.sourceDir}") |
| | | private String sourceDir; |
| | | @Value("${patches.url.path.kmz.planeKmzFile}") |
| | | private String planeKMZFile; |
| | | @Value("${patches.xml.temple.template}") |
| | | private String template; |
| | | @Value("${patches.xml.temple.waylines}") |
| | | private String waylines; |
| | | |
| | | @Value("${patches.xml.temple.planeTemplate}") |
| | | private String planeTemplate; |
| | | @Value("${patches.xml.temple.planeWaylines}") |
| | | private String planeWaylines; |
| | | |
| | | |
| | | @Value("${patches.xml.target.template}") |
| | | private String targetTemplate; |
| | | @Value("${patches.xml.target.waylines}") |
| | | private String targetWaylines; |
| | | |
| | | @Value("${patches.xml.target.planeTemplate}") |
| | | private String planeTargetTemplate; |
| | | @Value("${patches.xml.target.planeWaylines}") |
| | | private String planeTargetWaylines; |
| | | |
| | | } |
| | |
| | | public ResponseResult patchesToWayline(@RequestBody List<LotInfo> lotInfos, |
| | | @RequestParam String waylineName, |
| | | @RequestParam String workspaceId, |
| | | @RequestParam String patchesId, |
| | | @RequestParam (required = false) String patchesId, |
| | | @RequestParam double lat, |
| | | @RequestParam double lon, |
| | | @RequestParam(defaultValue = "1",required = false) String isTemp, |
| | |
| | | |
| | | @Override |
| | | public PaginationData getPhoto(PatchesParam param, String dkbh) { |
| | | LotInfo lotInfo = getLotinfoToDb(dkbh); |
| | | int statue = lotInfo.getIsPush(); |
| | | |
| | | if (statue == 1) { |
| | | List<MediaFileMarkEntity> allResults = markMapper.selectList( |
| | | new LambdaQueryWrapper<MediaFileMarkEntity>() |
| | | .like(MediaFileMarkEntity::getFileName, "%" + dkbh + "~" + "%")); |
| | | |
| | | // 去重处理 |
| | | Map<String, MediaFileMarkEntity> uniqueFileMap = new LinkedHashMap<>(); |
| | | List<MediaFileMarkEntity> uniqueResults = allResults.stream() |
| | | .filter(mediaFile -> uniqueFileMap.putIfAbsent(mediaFile.getFileName(), mediaFile) == null) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 计算分页信息 |
| | | int total = uniqueResults.size(); |
| | | int start = (param.getPage() - 1) * param.getPageSize(); |
| | | int end = Math.min(start + param.getPageSize(), total); |
| | | |
| | | // 获取当前页的结果 |
| | | List<MediaFileMarkEntity> pageResults = uniqueResults.subList(start, end); |
| | | |
| | | // 创建临时的 Page 对象 |
| | | Page<MediaFileMarkEntity> resultPage = new Page<>(param.getPage(), param.getPageSize()); |
| | | resultPage.setRecords(pageResults); |
| | | resultPage.setTotal(total); |
| | | |
| | | // 返回分页数据 |
| | | return new PaginationData<>(pageResults, new Pagination(resultPage)); |
| | | } else { |
| | | // LotInfo lotInfo = getLotinfoToDb(dkbh); |
| | | // int statue = lotInfo.getIsPush(); |
| | | // |
| | | // if (statue == 1) { |
| | | // List<MediaFileMarkEntity> allResults = markMapper.selectList( |
| | | // new LambdaQueryWrapper<MediaFileMarkEntity>() |
| | | // .like(MediaFileMarkEntity::getFileName, "%" + dkbh + "~" + "%")); |
| | | // |
| | | // // 去重处理 |
| | | // Map<String, MediaFileMarkEntity> uniqueFileMap = new LinkedHashMap<>(); |
| | | // List<MediaFileMarkEntity> uniqueResults = allResults.stream() |
| | | // .filter(mediaFile -> uniqueFileMap.putIfAbsent(mediaFile.getFileName(), mediaFile) == null) |
| | | // .collect(Collectors.toList()); |
| | | // |
| | | // // 计算分页信息 |
| | | // int total = uniqueResults.size(); |
| | | // int start = (param.getPage() - 1) * param.getPageSize(); |
| | | // int end = Math.min(start + param.getPageSize(), total); |
| | | // |
| | | // // 获取当前页的结果 |
| | | // List<MediaFileMarkEntity> pageResults = uniqueResults.subList(start, end); |
| | | // |
| | | // // 创建临时的 Page 对象 |
| | | // Page<MediaFileMarkEntity> resultPage = new Page<>(param.getPage(), param.getPageSize()); |
| | | // resultPage.setRecords(pageResults); |
| | | // resultPage.setTotal(total); |
| | | // |
| | | // // 返回分页数据 |
| | | // return new PaginationData<>(pageResults, new Pagination(resultPage)); |
| | | // } |
| | | // else { |
| | | List<MediaFileEntity> allResults = fileMapper.selectList( |
| | | new LambdaQueryWrapper<MediaFileEntity>() |
| | | .like(MediaFileEntity::getFileName, "%" + dkbh + "~" + "%")); |
| | |
| | | // 返回分页数据 |
| | | return new PaginationData<>(pageResults, new Pagination(resultPage)); |
| | | } |
| | | } |
| | | // } |
| | | |
| | | |
| | | |
| | |
| | | import java.io.StringWriter; |
| | | import java.util.*; |
| | | |
| | | import static com.dji.sample.patches.utils.TimerUtil.getNowDay; |
| | | import static com.dji.sample.patches.utils.TimerUtil.getNowTimeName; |
| | | |
| | | public class ShapeFileUtil { |
| | | |
| | | //将文件解压 |
| | |
| | | FeatureJSON fjson = new FeatureJSON(); |
| | | JSONObject geoJsonObject = new JSONObject(); |
| | | geoJsonObject.put("type", "FeatureCollection"); |
| | | // 获取FeatureCollection |
| | | FeatureCollection collection = getFeatureCollectionByShpFile(zipFile); |
| | | // 获取FeatureCollection |
| | | FeatureCollection collection = getFeatureCollectionByShpFile(zipFile); |
| | | |
| | | FeatureIterator iterator = collection.features(); |
| | | //遍历feature转为json对象 |
| | | while (iterator.hasNext()) { |
| | | ShpDTO shpDTO = new ShpDTO(); |
| | | SimpleFeature feature = (SimpleFeature) iterator.next(); |
| | | StringWriter writer = new StringWriter(); |
| | | fjson.writeFeature(feature, writer); |
| | | String temp = writer.toString(); |
| | | byte[] b = temp.getBytes("iso8859-1"); |
| | | temp = new String(b, "gbk"); |
| | | JSONObject json = JSONObject.parseObject(temp); |
| | | shpDTO.setDKFW(json.getJSONObject("geometry").get("coordinates").toString()); |
| | | shpDTO.setGEO(json.getJSONObject("geometry").get("type").toString()); |
| | | shpDTO.setXZQDM(json.getJSONObject("properties").get("XZQDM").toString()); |
| | | FeatureIterator iterator = collection.features(); |
| | | //遍历feature转为json对象 |
| | | while (iterator.hasNext()) { |
| | | ShpDTO shpDTO = new ShpDTO(); |
| | | SimpleFeature feature = (SimpleFeature) iterator.next(); |
| | | StringWriter writer = new StringWriter(); |
| | | fjson.writeFeature(feature, writer); |
| | | String temp = writer.toString(); |
| | | byte[] b = temp.getBytes("iso8859-1"); |
| | | temp = new String(b, "gbk"); |
| | | JSONObject json = JSONObject.parseObject(temp); |
| | | shpDTO.setDKFW(json.getJSONObject("geometry").getString("coordinates")); |
| | | |
| | | if ((json.getJSONObject("geometry").get("type")) != null) { |
| | | shpDTO.setGEO(json.getJSONObject("geometry").getString("type")); |
| | | } |
| | | |
| | | if ((json.getJSONObject("properties").get("XZQDM")) != null) { |
| | | shpDTO.setXZQDM(json.getJSONObject("properties").getString("XZQDM")); |
| | | } |
| | | if ((json.getJSONObject("properties").getDouble("XZB")) != null && |
| | | json.getJSONObject("properties").getDouble("YZB") != null) { |
| | | double[] xy = getLongitudeLatitude(CoordinateSystemUtil.pointCGCStoWGS( |
| | | json.getJSONObject("properties").getDouble("XZB"), |
| | | json.getJSONObject("properties").getDouble("YZB"))); |
| | | json.getJSONObject("properties").getDouble("XZB"), |
| | | json.getJSONObject("properties").getDouble("YZB"))); |
| | | shpDTO.setXZB(xy[0]); |
| | | shpDTO.setYZB(xy[1]); |
| | | shpDTO.setDKBH(json.getJSONObject("properties").getString("JCBH")); |
| | | shpDTO.setJCMJ(json.getJSONObject("properties").getDouble("JCMC")); |
| | | shpDTO.setTBLX(json.getJSONObject("properties").getString("TBLX")); |
| | | shpDTO.setDDTC(json.getJSONObject("properties").getString("DDTC")); |
| | | shpDTO.setHSX(json.getJSONObject("properties").getString("HSX")); |
| | | shpDTO.setJCLX(json.getJSONObject("properties").getString("JCLX")); |
| | | dtoList.add(shpDTO); |
| | | } |
| | | iterator.close(); |
| | | if ((json.getJSONObject("properties").getString("JCBH") != null)) { |
| | | shpDTO.setDKBH(json.getJSONObject("properties").getString("JCBH")); |
| | | }else { |
| | | shpDTO.setDKBH(getNowDay()); |
| | | } |
| | | if (json.getJSONObject("properties").getDouble("JCMC") != null) { |
| | | shpDTO.setJCMJ(json.getJSONObject("properties").getDouble("JCMC")); |
| | | } |
| | | if (json.getJSONObject("properties").getString("TBLX") != null) { |
| | | shpDTO.setTBLX(json.getJSONObject("properties").getString("TBLX")); |
| | | } |
| | | if (json.getJSONObject("properties").getString("DDTC") != null) { |
| | | shpDTO.setDDTC(json.getJSONObject("properties").getString("DDTC")); |
| | | } |
| | | if (json.getJSONObject("properties").getString("HSX") != null) { |
| | | shpDTO.setHSX(json.getJSONObject("properties").getString("HSX")); |
| | | } |
| | | if (json.getJSONObject("properties").getString("JCLX") != null) { |
| | | shpDTO.setJCLX(json.getJSONObject("properties").getString("JCLX")); |
| | | } |
| | | dtoList.add(shpDTO); |
| | | } |
| | | iterator.close(); |
| | | return dtoList; |
| | | } |
| | | |
| | |
| | | |
| | | public static String getNowTimeName() { |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | |
| | | // 格式化时间,生成当前时间 |
| | | return "云飞行计划" + currentTime.format(DateTimeFormatter.ofPattern("MMddHHmmssSS")); |
| | | } |
| | |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | |
| | | // 格式化时间,生成当前时间 |
| | | return "云飞行计划" + currentTime.format(DateTimeFormatter.ofPattern("MMdd")); |
| | | return currentTime.format(DateTimeFormatter.ofPattern("MMddHHmmssSSS")); |
| | | } |
| | | } |
| | |
| | | XMLTemplateModel xmlModel = XMLTemplateModel.initPolygon(param); |
| | | |
| | | //生成航线文件 |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, "src\\main\\resources\\template\\template-polygon.xml", "src\\main\\resources\\template\\wpmz2\\template.xml"); |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, "src\\main\\resources\\template\\waylines-polygon.xml", "src\\main\\resources\\template\\wpmz2\\waylines.xml"); |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, "src\\main\\resources\\template\\template-polygon.xml", "src\\main\\resources\\template\\wpmz\\template.kml"); |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, "src\\main\\resources\\template\\waylines-polygon.xml", "src\\main\\resources\\template\\wpmz\\waylines.wpml"); |
| | | } |
| | | |
| | | //新建点航线测试 |
| | |
| | | // XMLTemplateModel xmlModel = XMLTemplateModel.init(coordinates, list); |
| | | // |
| | | // //生成航线文件 |
| | | // CreateWaylineFileUtils.createWaylineFile(xmlModel, "src\\main\\resources\\template\\template.xml", "src\\main\\resources\\template\\wpmz\\template.xml", "src\\main\\resources\\template\\waylines.xml", "src\\main\\resources\\template\\wpmz\\waylines.xml"); |
| | | // CreateWaylineFileUtils.createWaylineFile(xmlModel, "src\\main\\resources\\template\\template.kml", "src\\main\\resources\\template\\wpmz\\template.kml", "src\\main\\resources\\template\\waylines.wpml", "src\\main\\resources\\template\\wpmz\\waylines.wpml"); |
| | | // |
| | | // |
| | | // } |
| | |
| | | */ |
| | | public static void createWaylineFile(XMLTemplateModel xmlModel,String templeFilePath,String targetTempleFilePath,String waylineFilePath,String targetWaylineFilePath) { |
| | | |
| | | // xml2XmlDoc(xmlModel, "home\\drone\\server\\template\\template.xml", "home\\drone\\server\\template\\wpmz\\template.kml"); |
| | | // xml2XmlDoc(xmlModel, "home\\drone\\server\\template\\waylines.xml", "home\\drone\\server\\template\\wpmz\\waylines.wpml"); |
| | | // xml2XmlDoc(xmlModel, "home\\drone\\server\\template\\template.kml", "home\\drone\\server\\template\\wpmz\\template.kml"); |
| | | // xml2XmlDoc(xmlModel, "home\\drone\\server\\template\\waylines.wpml", "home\\drone\\server\\template\\wpmz\\waylines.wpml"); |
| | | |
| | | xml2XmlDoc(xmlModel, templeFilePath, targetTempleFilePath); |
| | | xml2XmlDoc(xmlModel, waylineFilePath, targetWaylineFilePath); |
| | |
| | | package com.dji.sample.wayline.plane.controller; |
| | | |
| | | import com.dji.sample.common.model.CustomClaim; |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.patches.config.pojo.PatchesConfigPojo; |
| | | import com.dji.sample.patches.utils.MultipartFileTOFileUtil; |
| | | import com.dji.sample.patches.utils.TimerUtil; |
| | | import com.dji.sample.patches.utils.ZipUtil; |
| | | import com.dji.sample.patches.xml.mode.XMLTemplateModel; |
| | | import com.dji.sample.patches.xml.utils.CreateWaylineFileUtils; |
| | | import com.dji.sample.wayline.plane.PlaneCourseUtils; |
| | | import com.dji.sample.wayline.plane.param.CreateWaylineParam; |
| | | import com.dji.sample.wayline.service.IWaylineFileService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | |
| | | import static com.dji.sample.component.AuthInterceptor.TOKEN_CLAIM; |
| | | |
| | | /** |
| | | * @Author AIX |
| | |
| | | @RestController |
| | | @RequestMapping("/wayline/plane/createWayline") |
| | | public class CreateWayLineController { |
| | | @Autowired |
| | | private PatchesConfigPojo patchesConfigPojo; |
| | | @Autowired |
| | | private IWaylineFileService waylineFileService; |
| | | |
| | | @PostMapping("/createPoints") |
| | | public ResponseResult createPoints(@RequestBody CreateWaylineParam param) { |
| | | return ResponseResult.success(PlaneCourseUtils.createWaylinePoints(param)); |
| | | } |
| | | |
| | | @PostMapping("/saveWayLineFile") |
| | | public ResponseResult saveWayLineFile(@RequestBody CreateWaylineParam param) { |
| | | // 初始化模板对象 |
| | | @PostMapping("/{workspace_id}/saveWayLineFile") |
| | | public ResponseResult saveWayLineFile(@PathVariable(name = "workspace_id") String workspaceId, |
| | | @RequestBody CreateWaylineParam param, |
| | | HttpServletRequest request |
| | | ) throws IOException { |
| | | CustomClaim customClaim = (CustomClaim) request.getAttribute(TOKEN_CLAIM); |
| | | String creator = customClaim.getUsername(); |
| | | // 初始化模板对象 |
| | | XMLTemplateModel xmlModel = XMLTemplateModel.initPolygon(param); |
| | | |
| | | //生成航线文件 |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, "src\\main\\resources\\template\\template-polygon.xml", "src\\main\\resources\\template\\wpmz2\\template.xml"); |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, "src\\main\\resources\\template\\waylines-polygon.xml", "src\\main\\resources\\template\\wpmz2\\waylines.xml"); |
| | | |
| | | //kmz、上传航线库 |
| | | |
| | | // 生成航线文件 |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, patchesConfigPojo.getPlaneTemplate(), patchesConfigPojo.getPlaneTargetTemplate()); |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, patchesConfigPojo.getPlaneWaylines(), patchesConfigPojo.getPlaneTargetWaylines()); |
| | | // kmz、上传航线库 |
| | | String destKMZFile = patchesConfigPojo.getPlaneKMZFile() + param.getWaylineName() + ".kmz"; // 输出的KMZ文件路径 |
| | | ZipUtil.zipFolder(patchesConfigPojo.getSourceDir(), destKMZFile); |
| | | MultipartFile multipartFile = MultipartFileTOFileUtil.convert(new File(destKMZFile)); |
| | | waylineFileService.importKmzFile(multipartFile, workspaceId, creator, null, "1"); |
| | | return ResponseResult.success(); |
| | | |
| | | } |
| | | |
| | | } |
| | | @PutMapping("/{workspace_id}/updateWayLineFile/{id}") |
| | | public ResponseResult updateWayLineFile(@PathVariable(name = "workspace_id") String workspaceId, |
| | | @PathVariable(name = "id") String id, |
| | | @RequestBody CreateWaylineParam param, |
| | | HttpServletRequest request) throws IOException { |
| | | CustomClaim customClaim = (CustomClaim) request.getAttribute(TOKEN_CLAIM); |
| | | String creator = customClaim.getUsername(); |
| | | String newName = param.getWaylineName() + TimerUtil.getNowDay(); |
| | | // 初始化模板对象 |
| | | XMLTemplateModel xmlModel = XMLTemplateModel.initPolygon(param); |
| | | // 生成航线文件 |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, patchesConfigPojo.getPlaneTemplate(), patchesConfigPojo.getPlaneTargetTemplate()); |
| | | CreateWaylineFileUtils.createWaylineFileByPolygon(xmlModel, patchesConfigPojo.getPlaneWaylines(), patchesConfigPojo.getPlaneTargetWaylines()); |
| | | // kmz、上传航线库 |
| | | String destKMZFile = patchesConfigPojo.getPlaneKMZFile() + newName + ".kmz"; // 输出的KMZ文件路径 |
| | | ZipUtil.zipFolder(patchesConfigPojo.getSourceDir(), destKMZFile); |
| | | MultipartFile multipartFile = MultipartFileTOFileUtil.convert(new File(destKMZFile)); |
| | | waylineFileService.importPlaneKmzFile(multipartFile, workspaceId, creator, newName, id); |
| | | return ResponseResult.success(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | private PayloadInfo payloadInfo; |
| | | |
| | | |
| | | private String waylineName; |
| | | } |
| | |
| | | */ |
| | | WaylineFileDTO importKmzFileBack (MultipartFile file, String workspaceId, String creator); |
| | | WaylineFileEntity selectByName(String name); |
| | | |
| | | WaylineFileDTO importPlaneKmzFile (MultipartFile file, String workspaceId, String creator,String newName,String id); |
| | | List<WaylineListDTO> waylineList(String workspaceId,String droneName); |
| | | |
| | | int updateWayline(WaylineFileEntity entity); |
| | |
| | | WaylineFileEntity file = this.dtoConvertToEntity(metadata); |
| | | file.setWaylineId(UUID.randomUUID().toString()); |
| | | file.setWorkspaceId(workspaceId); |
| | | |
| | | if (!StringUtils.hasText(file.getSign())) { |
| | | try (InputStream object = ossService.getObject(OssConfiguration.bucket, metadata.getObjectKey())) { |
| | | if (object.available() == 0) { |
| | |
| | | int insertId = mapper.insert(file); |
| | | return insertId > 0 ? file.getId() : insertId; |
| | | } |
| | | |
| | | public Integer updateWaylineFile(String workspaceId, String newName, String id) { |
| | | String objectKey = "/" + newName; |
| | | LambdaUpdateWrapper<WaylineFileEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(WaylineFileEntity::getWaylineId, id) |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .set(WaylineFileEntity::getObjectKey, objectKey); |
| | | |
| | | // 使用 mapper 执行更新操作 |
| | | boolean updated = mapper.update(null, updateWrapper) > 0; |
| | | if (!updated) { |
| | | throw new RuntimeException("更新 objectKey 失败"); |
| | | } |
| | | |
| | | return updated ? 1 : 0; // 返回更新结果 |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer saveWaylineFiles(String workspaceId, WaylineFileDTO metadata, String patchesId,String isTemp) { |
| | |
| | | } |
| | | return waylineFile; |
| | | } |
| | | @Override |
| | | public WaylineFileDTO importPlaneKmzFile(MultipartFile file, String workspaceId, String creator,String newName,String id) { |
| | | WaylineFileDTO waylineFile = null; |
| | | Optional<WaylineFileDTO> waylineFileOpt = validKmzFile(file); |
| | | if (waylineFileOpt.isEmpty()) { |
| | | throw new RuntimeException("文件格式错误"); |
| | | } |
| | | |
| | | try { |
| | | waylineFile = waylineFileOpt.get(); |
| | | waylineFile.setWaylineId(workspaceId); |
| | | waylineFile.setUsername(creator); |
| | | ossService.putObject(OssConfiguration.bucket, waylineFile.getObjectKey(), file.getInputStream()); |
| | | this.updateWaylineFile(workspaceId,newName,id); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return waylineFile; |
| | | } |
| | | |
| | | @Override |
| | | public WaylineFileEntity selectByName(String name) { |
| | |
| | | oss: |
| | | enable: true |
| | | provider: minio |
| | | endpoint: http://139.196.74.78:9000 |
| | | external-endpoint: http://139.196.74.78:9000 |
| | | access-key: sxkj |
| | | secret-key: sxkj2024 |
| | | endpoint: http://dev.jxpskj.com:9000 |
| | | external-endpoint: http://dev.jxpskj.com:9000 |
| | | access-key: pskj |
| | | secret-key: pskj@2021 |
| | | bucket: cloud-bucket |
| | | expire: 3600 |
| | | region: us-east-1 |
| | |
| | | unzip: src/main/resources/tmp/ |
| | | kmz: |
| | | destKMZFile: src/main/resources/template/kmz/ |
| | | planeKmzFile: src/main/resources/template/kmz2/ |
| | | sourceDir: src/main/resources/template/wpmz/ |
| | | |
| | | xml: |
| | | temple: |
| | | template: src/main/resources/template/template.xml |
| | | waylines: src/main/resources/template/waylines.xml |
| | | planeTemplate: src/main/resources/template/template-polygon.xml |
| | | planeWaylines: src/main/resources/template/waylines-polygon.xml |
| | | target: |
| | | template: src/main/resources/template/wpmz/template.kml |
| | | waylines: src/main/resources/template/wpmz/waylines.wpml |
| | | planeTemplate: src/main/resources/template/wpmz/template.kml |
| | | planeWaylines: src/main/resources/template/wpmz/waylines.wpml |
| | | |
| | | |
| | | db: |
| | |
| | | unzip: /home/drone/server/temp/ |
| | | kmz: |
| | | destKMZFile: /home/drone/server/template/kmz/ |
| | | planeKmzFile: /home/drone/server/template/kmz2/ |
| | | sourceDir: /home/drone/server/template/wpmz/ |
| | | #解析图斑航线模板的地址 |
| | | xml: |
| | | temple: |
| | | template: /home/drone/server/template/template.xml |
| | | waylines: /home/drone/server/template/waylines.xml |
| | | planeTemplate: /home/drone/server/template/template-polygon.xml |
| | | planeWaylines: /home/drone/server/template/waylines-polygon.xml |
| | | target: |
| | | template: /home/drone/server/template/wpmz/template.kml |
| | | waylines: /home/drone/server/template/wpmz/waylines.wpml |
| | | planeTemplate: /home/drone/server/template/wpmz/template.kml |
| | | planeWaylines: /home/drone/server/template/wpmz/waylines.wpml |
| | | |
| | | |
| | | db: |
| | | sqlite: |