|
@@ -4,9 +4,14 @@ import com.onemap.apply.domain.gdbh.*;
|
|
|
import com.onemap.apply.mapper.gdbh.*;
|
|
|
import com.onemap.apply.service.gdbh.ITGdbhGdService;
|
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.io.BufferedWriter;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileWriter;
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
@@ -32,6 +37,8 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
|
|
|
private TGdbhFlightBatchMapper tGdbhFlightBatchMapper;
|
|
|
@Resource
|
|
|
private TGdbhFlightVideoMapper tGdbhFlightVideoMapper;
|
|
|
+ @Value("${file.path}")
|
|
|
+ private String uploadFilePath;
|
|
|
|
|
|
@Override
|
|
|
public List<TGdbhGdServerDTO> selectTGdbhGdServerList(TGdbhGdServerDTO tGdbhGdServer) {
|
|
@@ -158,7 +165,8 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
|
|
|
public List<TGdbhFlightBatchDto> uavQuery(TGdbhFlightBatchDto tGdbhFlightBatchDto) {
|
|
|
List<TGdbhFlightBatchDto> bathDtos = tGdbhFlightBatchMapper.selectList();
|
|
|
for (TGdbhFlightBatchDto bathDto : bathDtos) {
|
|
|
- if (StringUtils.isNotEmpty(bathDto.getBatch())){
|
|
|
+ if (StringUtils.isNotEmpty(bathDto.getBatch())) {
|
|
|
+ String fpfPath = "/gdbh/flight/batch_video/" + bathDto.getBatch().trim() + ".fpf";
|
|
|
TGdbhFlightVideoDto queryvideo = new TGdbhFlightVideoDto();
|
|
|
queryvideo.setBatch(bathDto.getBatch());
|
|
|
List<TGdbhFlightVideoDto> videoDtoList = tGdbhFlightVideoMapper.selectList(queryvideo);
|
|
@@ -166,11 +174,81 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
|
|
|
TGdbhFlightDto queryFlightDto = new TGdbhFlightDto();
|
|
|
queryFlightDto.setBatch(bathDto.getBatch());
|
|
|
List<TGdbhFlightDto> flightDtoList = tGdbhFlightMapper.selectList(queryFlightDto);
|
|
|
+ writeFpf(flightDtoList, uploadFilePath + fpfPath);
|
|
|
+ bathDto.setFpf(fpfPath);
|
|
|
bathDto.setFlightDtoList(flightDtoList);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
return bathDtos;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private void writeFpf(List<TGdbhFlightDto> flightDtoList, String filePathString) {
|
|
|
+ File filePath = new File(filePathString);
|
|
|
+ if (!filePath.exists()) {
|
|
|
+ try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
|
|
|
+ writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<SceneRoute xmlns=\"http://www.supermap.com.cn/ugc60\">");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<route name=\"飞行路线_1\" speed=\"10\" lineType=\"0\" showroutestop=\"True\" showrouteline=\"True\" altitudefree=\"False\" headingfree=\"False\" tiltfree=\"False\" flycircle=\"False\" alongline=\"False\">");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<style>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<geostyle3d>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<linecolor>RGBA(147,112,219,100)</linecolor>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<linewidth>2</linewidth>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<altitudeMode>Absolute</altitudeMode>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("<bottomAltitude>0.00</bottomAltitude>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("</geostyle3d>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ writer.write("</style>");
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ for (int i = 0; i < flightDtoList.size(); i++) {
|
|
|
+ TGdbhFlightDto dto = flightDtoList.get(i);
|
|
|
+ String fpf = "<routestop name=\"" + dto.getPhoto_name() + "\" speed=\"0\" excluded=\"False\" viewType=\"camera\">" +
|
|
|
+ "<camera>" +
|
|
|
+ "<longitude>" + dto.getLongitude() + "</longitude>" +
|
|
|
+ "<latitude>" + dto.getLatitude() + "</latitude>" +
|
|
|
+ "<altitude>" + dto.getHeight() + "</altitude>" +
|
|
|
+ "<heading>0.000001</heading>" +
|
|
|
+ "<tilt>0.100000000000000006</tilt>" +
|
|
|
+ "<altitudeMode>Absolute</altitudeMode>" +
|
|
|
+ "</camera>" +
|
|
|
+ "<style>" +
|
|
|
+ "<geostyle3d>" +
|
|
|
+ "<icon/>" +
|
|
|
+ "<markersize>4.8</markersize>" +
|
|
|
+ "<markericonscale>1</markericonscale>" +
|
|
|
+ "<markercolor>RGBA(255,255,255,255)</markercolor>" +
|
|
|
+ "</geostyle3d>" +
|
|
|
+ "</style>" +
|
|
|
+ "<setting>" +
|
|
|
+ "<turnTime>1.5</turnTime>" +
|
|
|
+ "<turnSlowly>False</turnSlowly>" +
|
|
|
+ "<stopPlayMode>StopPause</stopPlayMode>" +
|
|
|
+ "<autoPlay>False</autoPlay>" +
|
|
|
+ "<pauseTime>0</pauseTime>" +
|
|
|
+ "<angularSpeed>1</angularSpeed>" +
|
|
|
+ "</setting>" +
|
|
|
+ "</routestop>";
|
|
|
+ writer.write(fpf);
|
|
|
+ writer.newLine(); // 写入换行
|
|
|
+ }
|
|
|
+ writer.write("</route>");
|
|
|
+ writer.newLine(); // 写入换
|
|
|
+ writer.write("</SceneRoute>");
|
|
|
+ System.out.println("File written successfully!");
|
|
|
+ } catch (IOException e) {
|
|
|
+ System.err.println("Error writing file: " + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|