|
|
@@ -7,6 +7,7 @@ import com.onemap.common.core.utils.StringUtils;
|
|
|
import com.onemap.common.core.web.domain.AjaxResult;
|
|
|
import com.onemap.common.redis.service.RedisService;
|
|
|
import com.onemap.apply.domain.supervise.TSupervisePcsj;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.geotools.data.FeatureSource;
|
|
|
import org.geotools.data.shapefile.ShapefileDataStore;
|
|
|
import org.geotools.data.simple.SimpleFeatureCollection;
|
|
|
@@ -29,6 +30,7 @@ import java.nio.charset.Charset;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
|
|
|
|
|
|
@@ -108,6 +110,13 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ String ywlx = name.substring(0, 2);
|
|
|
+ TSuperviseYwlxDo ywlxDo = tSuperviseYwlxService.selectTSuperviseYwlxMapperByYwlx(ywlx);
|
|
|
+ if (ywlxDo == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//验证shp
|
|
|
String shpPath = tSupervisePcsj.getShppath();
|
|
|
File FShpFile_0 = new File(shpPath);
|
|
|
@@ -118,20 +127,25 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
|
|
|
//获取文件夹
|
|
|
String paremtFilePath = FShpFile_0.getParentFile().getAbsolutePath();
|
|
|
|
|
|
- //验证QDOM
|
|
|
- if (!(new File(paremtFilePath + "/QDOM").exists())) {
|
|
|
- return null;
|
|
|
- }
|
|
|
+ if(ywlxDo.getSjlx()==1){ //年度类型,只校验一个目录
|
|
|
+ //验证DOM
|
|
|
+ if (!(new File(paremtFilePath + "/DOM").exists())) {
|
|
|
+ log.info("当前上传文件中不存在DOM目录,文件名:{}",tSupervisePcsj.getName());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //验证QDOM
|
|
|
+ if (!(new File(paremtFilePath + "/QDOM").exists())) {
|
|
|
+ log.info("当前上传文件中不存在QDOM目录,文件名:{}",tSupervisePcsj.getName());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
- if (!(new File(paremtFilePath + "/DDOM").exists())) {
|
|
|
- return null;
|
|
|
+ if (!(new File(paremtFilePath + "/DDOM").exists())) {
|
|
|
+ log.info("当前上传文件中不存在DDOM目录,文件名:{}",tSupervisePcsj.getName());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- String ywlx = name.substring(0, 2);
|
|
|
- TSuperviseYwlxDo ywlxDo = tSuperviseYwlxService.selectTSuperviseYwlxMapperByYwlx(ywlx);
|
|
|
- if (ywlxDo == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
TSuperviseYwlxFieldDo queryDo = new TSuperviseYwlxFieldDo();
|
|
|
queryDo.setYwlx(ywlx);
|
|
|
List<TSuperviseYwlxFieldDo> listField = tSuperviseYwlxFiledService.selectTSuperviseYwlxFieldList(queryDo);
|
|
|
@@ -184,7 +198,6 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
|
|
|
//这个typeNamae不传递,默认是文件名称
|
|
|
FeatureSource featuresource = shapefileDataStore.getFeatureSource(shapefileDataStore.getTypeNames()[0]);
|
|
|
|
|
|
-
|
|
|
// 获取 srid
|
|
|
CoordinateReferenceSystem crs = featuresource.getSchema().getCoordinateReferenceSystem();
|
|
|
Integer srid = CRS.lookupEpsgCode(crs, true);
|
|
|
@@ -209,6 +222,7 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
|
|
|
Set<String> shpFieldSet = mapField_0.keySet();
|
|
|
|
|
|
//TODO 新版本存储
|
|
|
+ int i=0;
|
|
|
while (simpleFeatureIterator.hasNext()) {
|
|
|
Map<String, Object> jg_filed = new HashMap<>();
|
|
|
jg_filed.put("id", StringUtils.getUUID());
|
|
|
@@ -244,6 +258,9 @@ public class TShpFileHandleServiceImpl implements ITShpFileHandleService {
|
|
|
jg_filed.put(mapField_0.get(metadataShpField).getFieldname(), valueInsertData);
|
|
|
}
|
|
|
tSupervisePcsjXqService.insertTableByMap(jg_filed, tableName_data_0);
|
|
|
+
|
|
|
+ //TODO 需要删除操作
|
|
|
+ if(++i>10)break;
|
|
|
}
|
|
|
|
|
|
tSupervisePcsj.setReadtime(new Date());
|