| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | |
| | |
| | | private MinioPojo pojo; |
| | | |
| | | @PostMapping("/createPoints") |
| | | public ResponseResult createPoints(@RequestBody CreateWaylineParam param) { |
| | | public ResponseResult createPoints(@RequestBody @Valid CreateWaylineParam param) { |
| | | return ResponseResult.success(PlaneCourseUtils.createWaylinePoints(param)); |
| | | } |
| | | |
| | | @PostMapping("/{workspace_id}/saveWayLineFile") |
| | | public ResponseResult saveWayLineFile(@PathVariable(name = "workspace_id") String workspaceId, |
| | | @RequestBody CreateWaylineParam param, |
| | | @RequestBody @Valid 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, 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"); |
| | | // XMLTemplateModel xmlModel = XMLTemplateModel.initPolygon(param); |
| | | //// 生成航线文件 |
| | | // 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(); |
| | | } |
| | | |