|
@@ -83,11 +83,22 @@ public class VectorController {
|
|
|
boolean unzip = FileUtils.unzip(entity.getFileUrl(), INPUT_FILE_PATH);
|
|
|
|
|
|
if (!unzip) {
|
|
|
- return new R(50006, MsgCode.E50006);
|
|
|
+ log.info("zip error: {}", MsgCode.E51001);
|
|
|
+ return new R(51001, MsgCode.E51001);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
String fileName = StringUtils.substringBefore(entity.getFileName(), ".");
|
|
|
|
|
|
+ // 判断文件内容是否跟目录名称一样
|
|
|
+ String shpPath = INPUT_FILE_PATH + fileName + File.separator + fileName + ".shp";
|
|
|
+ File file = new File(shpPath);
|
|
|
+ if (!file.exists()) {
|
|
|
+ log.info("zip error: {}", MsgCode.E51002);
|
|
|
+ return new R(51002, MsgCode.E51002);
|
|
|
+ }
|
|
|
+
|
|
|
FileEntity fileEntity = new FileEntity();
|
|
|
|
|
|
// 添加文件夹到数据库
|
|
@@ -107,7 +118,7 @@ public class VectorController {
|
|
|
// fileEntity.setFileUrl(INPUT_FILE_PATH + fileName + File.separator + sName);
|
|
|
|
|
|
fileEntity.setFileName(fileName + ".shp");
|
|
|
- fileEntity.setFileUrl(INPUT_FILE_PATH + fileName + File.separator + fileName + ".shp");
|
|
|
+ fileEntity.setFileUrl(shpPath);
|
|
|
|
|
|
fileEntity.setCreateTime(new Date());
|
|
|
fileEntity.setUpdateTime(new Date());
|
|
@@ -204,9 +215,13 @@ public class VectorController {
|
|
|
fileEntity = strictCoordTransform(entity, Command.VECTOR_TRANSFORM_STRICT_WGS80);
|
|
|
}
|
|
|
|
|
|
- } else if (isJudge == 1001 && coord != null) {
|
|
|
+ } else if (isJudge == 1001) {
|
|
|
// 严格坐标转换 (西安80转wgs84),需要参数
|
|
|
log.info("need to strict transform");
|
|
|
+ if (coord == null) {
|
|
|
+ log.info("error: {}", MsgCode.E50009);
|
|
|
+ return new R(50009, MsgCode.E50009);
|
|
|
+ }
|
|
|
fileEntity = strictCoordTransform(entity, Command.VECTOR_TRANSFORM_STRICT_WGS84);
|
|
|
|
|
|
} else if (0 == isJudge){ // 不转换坐标
|