|
@@ -303,15 +303,19 @@ public class YbzBJService {
|
|
|
public String exportOneShape(CommonDTO dto) {
|
|
|
File rootPath = new File(System.getProperty("user.dir"));
|
|
|
String prefix = UUID.randomUUID().toString();
|
|
|
- String dkFileName = prefix + ".shp";
|
|
|
- String formatFileName = "shp" + File.separator + dkFileName;
|
|
|
+ Map<String, Object> resultMap = dao.exportOne(dto);
|
|
|
+ String shape = resultMap.get("shape").toString();
|
|
|
+ String dkbh = resultMap.get("dkbh").toString();
|
|
|
+ if (StringUtils.isEmpty(dkbh)) {
|
|
|
+ dkbh = "dk";
|
|
|
+ }
|
|
|
+ String dkFileName = dkbh + ".shp";
|
|
|
+ String formatFileName = "shp" + File.separator + prefix + File.separator + dkFileName;
|
|
|
File dkFile = new File(rootPath, formatFileName);
|
|
|
if (!dkFile.getParentFile().exists()) {
|
|
|
dkFile.getParentFile().mkdirs();
|
|
|
}
|
|
|
String fileFullPath = dkFile.getAbsolutePath();
|
|
|
- Map<String, Object> resultMap = dao.exportOne(dto);
|
|
|
- String shape = resultMap.get("shape").toString();
|
|
|
Geometry geometry = null;
|
|
|
try {
|
|
|
geometry = GeometryUtil.wkt2Geometry(shape);
|
|
@@ -331,13 +335,6 @@ public class YbzBJService {
|
|
|
//压缩shp
|
|
|
ShapeUtil.zipShapeFile(fileFullPath);
|
|
|
|
|
|
- //删除临时生产的.shp文件
|
|
|
- File shpFile = new File(fileFullPath);
|
|
|
- String shpRoot = shpFile.getParentFile().getPath();
|
|
|
- File[] files = new File(shpRoot).listFiles(file -> file.getName().startsWith(prefix) && !file.getName().endsWith(".zip"));
|
|
|
- for (File file : files) {
|
|
|
- file.delete();
|
|
|
- }
|
|
|
return fileFullPath.replace(".shp", ".zip");
|
|
|
}
|
|
|
|