GisSurveyThirdExporter.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. package com.shkpr.service.alambizplugin.components;
  2. import com.fasterxml.jackson.core.type.TypeReference;
  3. import com.global.base.log.LogLevelFlag;
  4. import com.global.base.log.LogPrintMgr;
  5. import com.shkpr.service.alambizplugin.apiparam.GisSurveyThirdExportParams;
  6. import com.shkpr.service.alambizplugin.commtools.CRSUtil;
  7. import com.shkpr.service.alambizplugin.commtools.ThirdImportTemplateUtils;
  8. import com.shkpr.service.alambizplugin.constants.CommAsyncStatusEnum;
  9. import com.shkpr.service.alambizplugin.constants.CommCRSDefine;
  10. import com.shkpr.service.alambizplugin.constants.FileTypeEnum;
  11. import com.shkpr.service.alambizplugin.constants.GisMetadataDefine;
  12. import com.shkpr.service.alambizplugin.constants.GisSurveyExcelDefine;
  13. import com.shkpr.service.alambizplugin.constants.LogFlagBusiType;
  14. import com.shkpr.service.alambizplugin.dbdao.services.intef.GisMetadataLayerTemplateService;
  15. import com.shkpr.service.alambizplugin.dbdao.services.intef.GisSurveyJobInfoService;
  16. import com.shkpr.service.alambizplugin.dbdao.services.intef.GisSurveyLayerApplyService;
  17. import com.shkpr.service.alambizplugin.dto.CommAsyncResult;
  18. import com.shkpr.service.alambizplugin.dto.GisMetadataLayerTemplate;
  19. import com.shkpr.service.alambizplugin.dto.GisMetadataPropertyTemplate;
  20. import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApply;
  21. import com.shkpr.service.alambizplugin.dto.GisSurveyPropertyValue;
  22. import org.apache.commons.compress.archivers.ArchiveException;
  23. import org.apache.commons.lang3.StringUtils;
  24. import org.geotools.data.DataUtilities;
  25. import org.geotools.feature.SchemaException;
  26. import org.locationtech.jts.geom.Coordinate;
  27. import org.locationtech.jts.geom.Geometry;
  28. import org.opengis.feature.simple.SimpleFeatureType;
  29. import org.springframework.scheduling.annotation.Async;
  30. import org.springframework.scheduling.annotation.AsyncResult;
  31. import org.springframework.stereotype.Component;
  32. import org.springframework.util.concurrent.ListenableFuture;
  33. import java.io.IOException;
  34. import java.math.BigDecimal;
  35. import java.nio.file.Files;
  36. import java.nio.file.Path;
  37. import java.time.Duration;
  38. import java.time.LocalDateTime;
  39. import java.util.Collections;
  40. import java.util.Comparator;
  41. import java.util.HashMap;
  42. import java.util.LinkedHashMap;
  43. import java.util.List;
  44. import java.util.Map;
  45. import java.util.Objects;
  46. import java.util.stream.Collectors;
  47. /**
  48. * 第三方导出执行器
  49. *
  50. * @author 欧阳劲驰
  51. * @since 1.0.0
  52. */
  53. @Component
  54. public class GisSurveyThirdExporter {
  55. /**
  56. * 结果前缀
  57. */
  58. public final static String RESULT_PREFIX = "third-export-";
  59. /**
  60. * log
  61. */
  62. private final String mStrClassName;
  63. private final String mBizType;
  64. private final AsyncResultManager asyncResultManager;
  65. private final GisSurveyJobInfoService jobInfoService;
  66. private final GisMetadataLayerTemplateService layerTemplateService;
  67. private final GisSurveyLayerApplyService gisSurveyLayerApplyService;
  68. public GisSurveyThirdExporter(AsyncResultManager asyncResultManager, GisSurveyJobInfoService jobInfoService
  69. , GisMetadataLayerTemplateService layerTemplateService, GisSurveyLayerApplyService gisSurveyLayerApplyService) {
  70. mStrClassName = "GisSurveyThirdExporter";
  71. mBizType = LogFlagBusiType.BUSI_GIS_SURVEY.toStrValue();
  72. this.asyncResultManager = asyncResultManager;
  73. this.jobInfoService = jobInfoService;
  74. this.layerTemplateService = layerTemplateService;
  75. this.gisSurveyLayerApplyService = gisSurveyLayerApplyService;
  76. }
  77. /**
  78. * 第三方导出任务
  79. *
  80. * @param params 导出参数
  81. * @return 导出结果
  82. */
  83. @Async
  84. public ListenableFuture<CommAsyncResult<Map<String, String>>> thirdExportTask(GisSurveyThirdExportParams params) {
  85. //参数
  86. String jobId = params.getJobId();
  87. FileTypeEnum fileType = params.getFileTypeEnum();
  88. String targetCRSCode = params.getTargetCRSCode();
  89. String operator = params.getOperator();
  90. //构建返回
  91. CommAsyncResult<Map<String, String>> result = CommAsyncResult.fail(params.getJobId());
  92. result.setOperator(operator);
  93. try {
  94. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
  95. , String.format(
  96. "开始执行第三方导出;任务id: %s"
  97. , jobId
  98. )
  99. );
  100. //查询元素更新时间
  101. LocalDateTime refreshTime = jobInfoService.findRefreshTime(jobId);
  102. //查询点线数据
  103. List<GisSurveyLayerApply> points = gisSurveyLayerApplyService.findAllByJobIdAndKind(jobId, GisMetadataDefine.TYPE_KINE.POINT);
  104. List<GisSurveyLayerApply> lines = gisSurveyLayerApplyService.findAllByJobIdAndKind(jobId, GisMetadataDefine.TYPE_KINE.LINE);
  105. //处理坐标系
  106. if (!Objects.equals(targetCRSCode, CommCRSDefine.CGCS2000)) transformGeom(targetCRSCode, points, lines);
  107. //获取图层key
  108. List<String> pointLayer = getLayerKeys(points);
  109. List<String> lineLayer = getLayerKeys(lines);
  110. //查询点图层模版
  111. List<GisMetadataLayerTemplate> pointLayerTemplates = layerTemplateService.findByKeyIn(pointLayer);
  112. //查询线图层模版
  113. List<GisMetadataLayerTemplate> lineLayerTemplates = layerTemplateService.findByKeyIn(lineLayer);
  114. //结果flag
  115. final String FLAG = RESULT_PREFIX + jobId;
  116. //创建临时文件夹
  117. if (!asyncResultManager.createTempDirectory(FLAG))
  118. return new AsyncResult<>(result);
  119. //根据文件类型导出
  120. Path outputPath = null;
  121. if (fileType == FileTypeEnum.EXCEL)
  122. outputPath = exportExcel(points, lines, pointLayerTemplates, lineLayerTemplates, FLAG);
  123. if (fileType == FileTypeEnum.SHAPE_FILE)
  124. outputPath = exportShape(points, lines, pointLayerTemplates, lineLayerTemplates, FLAG);
  125. if (outputPath == null || !Files.exists(outputPath)) {
  126. //打印报错信息
  127. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR, mBizType, mStrClassName
  128. , String.format("第三方导出文件写入失败, 任务id:%s", jobId)
  129. );
  130. return new AsyncResult<>(result);
  131. }
  132. //获取上次结果
  133. CommAsyncResult<Map<String, String>> lastResult = asyncResultManager.getResult(FLAG, new TypeReference<CommAsyncResult<Map<String, String>>>() {
  134. });
  135. //设置数据
  136. Map<String, String> data = new HashMap<>();
  137. if (lastResult != null && lastResult.getData() != null) data = lastResult.getData();
  138. data.put(fileType.getName(), FLAG + "/" + outputPath.getFileName().toString());
  139. //设置数据时间
  140. Map<String, LocalDateTime> refreshTimes = new HashMap<>();
  141. if (lastResult != null && lastResult.getRefreshTimes() != null) refreshTimes = lastResult.getRefreshTimes();
  142. refreshTimes.put(fileType.getName(), refreshTime);
  143. //导出完成
  144. result.setStatus(CommAsyncStatusEnum.SUCCESS.getCode());
  145. result.setCompleteTime(LocalDateTime.now());
  146. result.setData(data);
  147. result.setRefreshTimes(refreshTimes);
  148. result.setSubitemKeys(Collections.singletonList(fileType.getName()));
  149. //写入结果
  150. Path resultPath = asyncResultManager.writeJson(result, FLAG, AsyncResultManager.RESULT_FILE_NAME);
  151. if (resultPath == null || !Files.exists(resultPath)) {
  152. //打印报错信息
  153. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR, mBizType, mStrClassName
  154. , String.format("第三方导出文件写入失败, 任务id:%s", jobId)
  155. );
  156. return new AsyncResult<>(CommAsyncResult.fail(jobId));
  157. }
  158. //替换结果
  159. if (!asyncResultManager.replaceResult(FLAG)) return new AsyncResult<>(CommAsyncResult.fail(jobId));
  160. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
  161. , String.format(
  162. "结束第三方导出;任务id: %s, 用时(毫秒):%d"
  163. , jobId
  164. , Duration.between(result.getRequestTime(), result.getCompleteTime()).toMillis()
  165. )
  166. );
  167. return new AsyncResult<>(result);
  168. } catch (InterruptedException | IOException | ArchiveException | SchemaException e) {
  169. //打印报错信息
  170. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR, mBizType, mStrClassName
  171. , String.format("第三方导出异常 任务id:%s error:%s", jobId, e)
  172. );
  173. return new AsyncResult<>(CommAsyncResult.fail(jobId));
  174. }
  175. }
  176. /**
  177. * 转换geom
  178. *
  179. * @param targetCRSCode 目标坐标系
  180. * @param points 点集合
  181. * @param lines 线结合
  182. */
  183. private void transformGeom(String targetCRSCode, List<GisSurveyLayerApply> points, List<GisSurveyLayerApply> lines) {
  184. //处理点
  185. points.parallelStream().forEach(point -> {
  186. //获取geom
  187. Geometry geometry = point.getGis();
  188. if (geometry == null) return;
  189. //转换geom
  190. Geometry transform = CRSUtil.transform(geometry, CommCRSDefine.CGCS2000, targetCRSCode);
  191. if (transform == null) return;
  192. //回填元素
  193. point.setGis(transform);
  194. //获取解析后的经纬度
  195. Coordinate coordinate = transform.getCoordinate();
  196. String lngStr = BigDecimal.valueOf(coordinate.getX()).toPlainString();
  197. String latStr = BigDecimal.valueOf(coordinate.getY()).toPlainString();
  198. //回填经纬度属性
  199. List<GisSurveyPropertyValue> propertyValues = point.getPropertyValues();
  200. propertyValues.stream()
  201. .filter(it -> Objects.equals(it.getProperty(), GisSurveyExcelDefine.TEMPLATE.LAT))
  202. .forEach(it -> it.setValue(latStr));
  203. propertyValues.stream()
  204. .filter(it -> Objects.equals(it.getProperty(), GisSurveyExcelDefine.TEMPLATE.LNG))
  205. .forEach(it -> it.setValue(lngStr));
  206. });
  207. //处理线
  208. lines.parallelStream().forEach(line -> {
  209. //获取geom
  210. Geometry geometry = line.getGis();
  211. if (geometry == null) return;
  212. //转换geom
  213. Geometry transform = CRSUtil.transform(geometry, CommCRSDefine.CGCS2000, targetCRSCode);
  214. if (transform == null) return;
  215. //回填元素
  216. line.setGis(transform);
  217. });
  218. }
  219. /**
  220. * 导出excel
  221. *
  222. * @param points 点
  223. * @param lines 线
  224. * @param pointLayerTemplates 点图层模版
  225. * @param lineLayerTemplates 线图层模版
  226. * @param FLAG 结果flag
  227. * @return excel路径
  228. * @throws IOException io异常
  229. */
  230. private Path exportExcel(List<GisSurveyLayerApply> points, List<GisSurveyLayerApply> lines, List<GisMetadataLayerTemplate> pointLayerTemplates, List<GisMetadataLayerTemplate> lineLayerTemplates, String FLAG) throws IOException {
  231. //构建excel头
  232. Map<String, Map<String, String>> excelHeader = buildExcelHeader(pointLayerTemplates, lineLayerTemplates);
  233. //构建excel数据
  234. Map<String, List<Map<String, Object>>> excelData = buildExcelData(points, lines, pointLayerTemplates, lineLayerTemplates);
  235. //导出excel
  236. return asyncResultManager.writeExcel(excelHeader, excelData, FLAG, "third-export.xlsx");
  237. }
  238. /**
  239. * 导出shape
  240. *
  241. * @param points 点
  242. * @param lines 线
  243. * @param pointLayerTemplates 点图层模版
  244. * @param lineLayerTemplates 线图层模版
  245. * @param FLAG 结果flag
  246. * @return shape路径
  247. * @throws IOException io异常
  248. * @throws ArchiveException 压缩异常
  249. */
  250. private Path exportShape(List<GisSurveyLayerApply> points, List<GisSurveyLayerApply> lines, List<GisMetadataLayerTemplate> pointLayerTemplates, List<GisMetadataLayerTemplate> lineLayerTemplates, String FLAG) throws IOException, ArchiveException, SchemaException {
  251. //构建shape数据
  252. Map<SimpleFeatureType, List<Map<String, Object>>> shapeData = buildShapeData(points, lines, pointLayerTemplates, lineLayerTemplates);
  253. //导出shape
  254. return asyncResultManager.writeShape(shapeData, FLAG, "third-export.zip");
  255. }
  256. /**
  257. * 获取图层key
  258. *
  259. * @param datas 数据
  260. * @return 图层key集合
  261. */
  262. private List<String> getLayerKeys(List<GisSurveyLayerApply> datas) {
  263. //去重图层
  264. return datas.parallelStream()
  265. .map(GisSurveyLayerApply::getLayer)
  266. .filter(StringUtils::isNotBlank)
  267. .distinct()
  268. .collect(Collectors.toList());
  269. }
  270. /**
  271. * 构建excel表头
  272. *
  273. * @param pointLayerTemplates 点图层模版
  274. * @param lineLayerTemplates 线图层模版
  275. * @return excel数据
  276. */
  277. private Map<String, Map<String, String>> buildExcelHeader(List<GisMetadataLayerTemplate> pointLayerTemplates
  278. , List<GisMetadataLayerTemplate> lineLayerTemplates) {
  279. //点excel表头
  280. Map<String, String> pointExcelHeader = new LinkedHashMap<>();
  281. //线excel表头
  282. Map<String, String> lineExcelHeader = new LinkedHashMap<>();
  283. //点模版表头
  284. Map<String, String> pointTemplateHeader = pointLayerTemplates.stream()
  285. .flatMap(it -> it.getPropertyTemplates().stream())
  286. .sorted(Comparator.comparing(GisMetadataPropertyTemplate::getOrdering))
  287. .collect(Collectors.toMap(GisMetadataPropertyTemplate::getKey, GisMetadataPropertyTemplate::getName
  288. , (it1, it2) -> it1, LinkedHashMap::new));
  289. //线模版表头
  290. Map<String, String> lineTemplateHeader = lineLayerTemplates.stream()
  291. .flatMap(it -> it.getPropertyTemplates().stream())
  292. .collect(Collectors.toMap(GisMetadataPropertyTemplate::getKey, GisMetadataPropertyTemplate::getName
  293. , (it1, it2) -> it1, LinkedHashMap::new));
  294. //加入图层表头
  295. pointExcelHeader.put(GisSurveyExcelDefine.TEMPLATE.LAYER, GisSurveyExcelDefine.FILE.POINT_LAYER);
  296. lineExcelHeader.put(GisSurveyExcelDefine.TEMPLATE.LAYER, GisSurveyExcelDefine.FILE.LINE_LAYER);
  297. //加入模版表头
  298. pointExcelHeader.putAll(pointTemplateHeader);
  299. lineExcelHeader.putAll(lineTemplateHeader);
  300. //excel表头
  301. Map<String, Map<String, String>> excelHeader = new HashMap<>();
  302. excelHeader.put(GisMetadataDefine.TYPE_KINE.POINT, pointExcelHeader);
  303. excelHeader.put(GisMetadataDefine.TYPE_KINE.LINE, lineExcelHeader);
  304. return excelHeader;
  305. }
  306. /**
  307. * 构建excel数据
  308. *
  309. * @param points 点元素
  310. * @param lines 线元素
  311. * @param pointLayerTemplates 点图层模版
  312. * @param lineLayerTemplates 线图层模版
  313. * @return excel数据
  314. */
  315. private Map<String, List<Map<String, Object>>> buildExcelData(List<GisSurveyLayerApply> points, List<GisSurveyLayerApply> lines
  316. , List<GisMetadataLayerTemplate> pointLayerTemplates, List<GisMetadataLayerTemplate> lineLayerTemplates) {
  317. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, "开始构建excel数据 ======>");
  318. long begin = System.currentTimeMillis();
  319. //excel数据
  320. Map<String, List<Map<String, Object>>> excelData = new HashMap<>();
  321. excelData.put(GisMetadataDefine.TYPE_KINE.POINT, buildExcelSheetData(points, pointLayerTemplates));
  322. excelData.put(GisMetadataDefine.TYPE_KINE.LINE, buildExcelSheetData(lines, lineLayerTemplates));
  323. long end = System.currentTimeMillis();
  324. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
  325. , String.format(
  326. "结束构建excel数据,用时(毫秒):%d"
  327. , (end - begin)
  328. )
  329. );
  330. return excelData;
  331. }
  332. /**
  333. * 构建excel页数据
  334. *
  335. * @param layerApplies 采集元素集合
  336. * @param layerTemplates 图层模版
  337. * @return excel数据
  338. */
  339. private List<Map<String, Object>> buildExcelSheetData(List<GisSurveyLayerApply> layerApplies, List<GisMetadataLayerTemplate> layerTemplates) {
  340. return layerApplies.parallelStream()
  341. .map(it -> {
  342. //处理模版数据
  343. Map<String, Object> rowData = it.getPropertyValues().stream()
  344. .filter(it1 -> !StringUtils.isAnyBlank(it1.getProperty(), it1.getValue()))
  345. .collect(Collectors.toMap(GisSurveyPropertyValue::getProperty, GisSurveyPropertyValue::getValue
  346. , (i1, i2) -> i1));
  347. //处理图层数据
  348. if (StringUtils.isNotBlank(it.getLayer())) {
  349. //获取模版
  350. GisMetadataLayerTemplate gisMetadataLayerTemplate = layerTemplates.stream()
  351. .filter(it1 -> Objects.equals(it1.getKey(), it.getLayer()))
  352. .findFirst().orElse(null);
  353. //存入图层
  354. if (gisMetadataLayerTemplate != null)
  355. rowData.put(GisSurveyExcelDefine.TEMPLATE.LAYER, gisMetadataLayerTemplate.getName());
  356. }
  357. return rowData;
  358. }).collect(Collectors.toList());
  359. }
  360. /**
  361. * 构建shape数据
  362. *
  363. * @param points 点元素
  364. * @param lines 线元素
  365. * @param pointLayerTemplates 点图层模版
  366. * @param lineLayerTemplates 线图层模版
  367. * @return excel数据
  368. */
  369. private Map<SimpleFeatureType, List<Map<String, Object>>> buildShapeData(List<GisSurveyLayerApply> points, List<GisSurveyLayerApply> lines
  370. , List<GisMetadataLayerTemplate> pointLayerTemplates, List<GisMetadataLayerTemplate> lineLayerTemplates) throws SchemaException {
  371. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, "开始构建shape属性头和数据 ======>");
  372. long begin = System.currentTimeMillis();
  373. //点模版规格
  374. String pointTemplateSpec = pointLayerTemplates.stream()
  375. .flatMap(it -> it.getPropertyTemplates().stream())
  376. .sorted(Comparator.comparing(GisMetadataPropertyTemplate::getOrdering))
  377. .map(it ->
  378. String.format("%s%s"
  379. , StringUtils.substring(it.getName(), 0, 5)
  380. , GisSurveyExcelDefine.FILE_HANDLE.COL_SPEC)
  381. )
  382. .distinct()
  383. .collect(Collectors.joining(","));
  384. //线模版规格
  385. String lineTemplateSpec = lineLayerTemplates.stream()
  386. .flatMap(it -> it.getPropertyTemplates().stream())
  387. .sorted(Comparator.comparing(GisMetadataPropertyTemplate::getOrdering))
  388. .map(it ->
  389. String.format("%s%s"
  390. , StringUtils.substring(it.getName(), 0, 5)
  391. , GisSurveyExcelDefine.FILE_HANDLE.COL_SPEC)
  392. )
  393. .distinct()
  394. .collect(Collectors.joining(","));
  395. //创建点类型
  396. final SimpleFeatureType POINT_TYPE = DataUtilities.createType(
  397. "point",
  398. String.format("%s%s", GisSurveyExcelDefine.FILE_HANDLE.POINT_SPEC, pointTemplateSpec)
  399. );
  400. //创建线类型
  401. final SimpleFeatureType LINE_TYPE = DataUtilities.createType(
  402. "line",
  403. String.format("%s%s", GisSurveyExcelDefine.FILE_HANDLE.LINE_SPEC, lineTemplateSpec)
  404. );
  405. //shape数据
  406. Map<SimpleFeatureType, List<Map<String, Object>>> shapeData = new HashMap<>();
  407. shapeData.put(POINT_TYPE, buildShapeItemData(points, pointLayerTemplates));
  408. shapeData.put(LINE_TYPE, buildShapeItemData(lines, lineLayerTemplates));
  409. long end = System.currentTimeMillis();
  410. LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
  411. , String.format(
  412. "结束构建shape属性头和数据,用时(毫秒):%d"
  413. , (end - begin)
  414. )
  415. );
  416. return shapeData;
  417. }
  418. /**
  419. * 构建shape项数据
  420. *
  421. * @param layerApplies 采集元素集合
  422. * @param layerTemplates 图层模版
  423. * @return excel数据
  424. */
  425. private List<Map<String, Object>> buildShapeItemData(List<GisSurveyLayerApply> layerApplies, List<GisMetadataLayerTemplate> layerTemplates) {
  426. return layerApplies.parallelStream()
  427. .map(it -> {
  428. Map<String, Object> rowData = new HashMap<>();
  429. //获取图层模版
  430. GisMetadataLayerTemplate layerTemplate = ThirdImportTemplateUtils.getLayerTemplate(it, layerTemplates);
  431. //处理图层数据
  432. if (layerTemplate != null) {
  433. //存入图层
  434. if (GisMetadataDefine.TYPE_KINE.POINT.equals(it.getKind()))
  435. rowData.put(GisSurveyExcelDefine.FILE.POINT_LAYER, layerTemplate.getName());
  436. if (GisMetadataDefine.TYPE_KINE.LINE.equals(it.getKind()))
  437. rowData.put(GisSurveyExcelDefine.FILE.LINE_LAYER, layerTemplate.getName());
  438. //遍历属性
  439. it.getPropertyValues().forEach(propertyValue -> {
  440. //获取属性模版
  441. GisMetadataPropertyTemplate propertyTemplate = ThirdImportTemplateUtils
  442. .getPropertyTemplate(layerTemplate, propertyValue.getProperty());
  443. //填入属性数据
  444. if (propertyTemplate != null)
  445. rowData.put(StringUtils.substring(propertyTemplate.getName(), 0, 5)
  446. , propertyValue.getValue());
  447. });
  448. }
  449. //存入geom
  450. rowData.put(GisSurveyExcelDefine.FILE.THE_GEOM, it.getGis());
  451. return rowData;
  452. }).collect(Collectors.toList());
  453. }
  454. }