| | |
| | | import com.lf.server.mapper.sys.ReportMapper; |
| | | import com.lf.server.service.all.RedisService; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import org.locationtech.jts.geom.Coordinate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Override |
| | | public List<CountEntity> countExplorationPoints() { |
| | | String key = RedisCacheKey.dataCountKey("countExplorationPoints"); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<CountEntity>) obj; |
| | | } |
| | | // Object obj = redisService.get(key); |
| | | // if (obj instanceof List<?>) { |
| | | // return (List<CountEntity>) obj; |
| | | // } |
| | | |
| | | List<CountEntity> list = reportMapper.countExplorationPoints(); |
| | | if (null != list && list.size() > 0) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | double area = JtsHelper.calcAreaByPoints(ces); |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("["); |
| | | for (CoordinateEntity e : ces) { |
| | | sb.append(e.getX() + "," + e.getY() + ","); |
| | | } |
| | | sb.replace(sb.length() - 1, sb.length(), "]"); |
| | | |
| | | // double area = JtsHelper.calcAreaByPoints(ces) |
| | | double area = callJsFn(sb.toString()); |
| | | ce.setArea(area); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 调用JS方法 |
| | | */ |
| | | private double callJsFn(String str) { |
| | | String staticPath = PathHelper.getStaticPath(); |
| | | Object obj = JsHelper.callJsFn(staticPath + "js/turf.min.6.5.js", "pointsToPolygon", str); |
| | | if (null == obj) { |
| | | return 0d; |
| | | } |
| | | |
| | | return (double) obj; |
| | | } |
| | | |
| | | /** |
| | | * 创建报告 |
| | | */ |
| | | public void createReport(UserEntity ue, ReportEntity re, HttpServletResponse res) throws Exception { |