From 7185f65d9e4087fef18567365ea621845fe2659e Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 28 二月 2024 16:17:08 +0800 Subject: [PATCH] 使用JTS计算面积 --- src/main/java/com/lf/server/service/sys/ReportService.java | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lf/server/service/sys/ReportService.java b/src/main/java/com/lf/server/service/sys/ReportService.java index a01529c..353c1f6 100644 --- a/src/main/java/com/lf/server/service/sys/ReportService.java +++ b/src/main/java/com/lf/server/service/sys/ReportService.java @@ -1,9 +1,9 @@ package com.lf.server.service.sys; import com.lf.server.entity.all.RedisCacheKey; -import com.lf.server.entity.all.ResAuthEntity; import com.lf.server.entity.all.SettingData; import com.lf.server.entity.all.StaticData; +import com.lf.server.entity.ctrl.CoordinateEntity; import com.lf.server.entity.ctrl.CountEntity; import com.lf.server.entity.data.DownloadEntity; import com.lf.server.entity.sys.AttachEntity; @@ -13,7 +13,6 @@ import com.lf.server.mapper.sys.ReportMapper; import com.lf.server.service.all.RedisService; import com.lf.server.service.data.DownloadService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -139,12 +138,28 @@ return list; } + @Override + public List<CoordinateEntity> selectExplorationPoints(String code) { + return reportMapper.selectExplorationPoints(StringHelper.getRightLike(code)); + } + /** * 缁熻閽诲瓟鐐归潰绉� */ private void countExplorationArea(List<CountEntity> list) { + for (CountEntity ce : list) { + if (0 == ce.getCount()) { + continue; + } + List<CoordinateEntity> ces = selectExplorationPoints(ce.getM3()); + if (null == ces || ces.size() < 3) { + continue; + } + double area = JtsHelper.calcAreaByPoints(ces); + ce.setArea(area); + } } /** -- Gitblit v1.9.3