From fecb972c549d7227ae18a6ee199fc5daa34b1dc6 Mon Sep 17 00:00:00 2001 From: attiya <2413103649@qq.com> Date: Tue, 13 May 2025 10:49:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=A7=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 125708be..00000000 --- a/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Attribution Assurance License - -Copyright (c) 2002 by AUTHOR PROFESSIONAL IDENTIFICATION * URL "PROMOTIONAL SLOGAN FOR AUTHOR'S PROFESSIONAL PRACTICE" - -All Rights Reserved - -ATTRIBUTION ASSURANCE LICENSE (adapted from the original BSD license) - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the conditions below are met. These conditions require a modest attribution to attiya (the "Author"), who hopes that its promotional value may help justify the thousands of dollars in otherwise billable time invested in writing this and other freely available, open-source software. - -1. Redistributions of source code, in whole or part and with or without modification (the "Code"), must prominently display this GPG-signed text in verifiable form. - -2. Redistributions of the Code in binary form must be accompanied by this GPG-signed text in any documentation and, each time the resulting executable program or a program dependent thereon is launched, a prominent display (e.g., splash screen or banner text) of the Author's attribution information, which includes: - - (a) Name ("AUTHOR"), - (b) Professional identification ("PROFESSIONAL IDENTIFICATION"), and - (c) URL ("URL"). - -3. Neither the name nor any trademark of the Author may be used to endorse or promote products derived from this software without specific prior written permission. - -4. Users are entirely responsible, to the exclusion of the Author and any other persons, for compliance with (1) regulations set by owners or administrators of employed equipment, (2) licensing terms of any other software, and (3) local regulations regarding use, including those regarding import, export, and use of encryption software. - -THIS FREE SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR ANY CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, EFFECTS OF UNAUTHORIZED OR MALICIOUS NETWORK ACCESS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From ca2c32462e72859fa50713531037e457c85ea483 Mon Sep 17 00:00:00 2001 From: attiya <2413103649@qq.com> Date: Tue, 13 May 2025 14:12:32 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8A=A5=E6=96=87=E5=AE=B9=E9=94=99?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cdzy/ebikereport/component/ReoprtHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ebike-report/src/main/java/com/cdzy/ebikereport/component/ReoprtHandler.java b/ebike-report/src/main/java/com/cdzy/ebikereport/component/ReoprtHandler.java index 101b52b6..461ccdfa 100644 --- a/ebike-report/src/main/java/com/cdzy/ebikereport/component/ReoprtHandler.java +++ b/ebike-report/src/main/java/com/cdzy/ebikereport/component/ReoprtHandler.java @@ -67,8 +67,11 @@ public class ReoprtHandler { redisUtil.set(deviceId, resGpsDto); double[] doubles = CoordinateUtil.WGS84ToGCJ02(resGpsDto.getLongitude(), resGpsDto.getLatitude()); redisUtil.addLocation(new Point(doubles[0], doubles[1]),deviceId); - EbikeTracking ebikeTracking = new EbikeTracking(deviceId,doubles[1], doubles[0]); - operateFeignClient.saveEbikeTracking(ebikeTracking); + boolean outOfChina = CoordinateUtil.outOfChina(doubles[0], doubles[1]); + if (!outOfChina) { + EbikeTracking ebikeTracking = new EbikeTracking(deviceId,doubles[1], doubles[0]); + operateFeignClient.saveEbikeTracking(ebikeTracking); + } } } From 081dc26d85680339bf08002e8e9f23aa406c2cf6 Mon Sep 17 00:00:00 2001 From: attiya <2413103649@qq.com> Date: Tue, 13 May 2025 14:33:16 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=BF=90=E8=90=A5=E5=8C=BA=E5=88=A0?= =?UTF-8?q?=E9=99=A4=EF=BC=9AredisGeo=E6=95=B0=E6=8D=AE=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EbikeOperationRegionServiceImpl.java | 7 +++ .../cdzy/ebikeoperate/utils/RedisUtil.java | 43 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/ebike-operate/src/main/java/com/cdzy/ebikeoperate/service/impl/EbikeOperationRegionServiceImpl.java b/ebike-operate/src/main/java/com/cdzy/ebikeoperate/service/impl/EbikeOperationRegionServiceImpl.java index 556f79c7..15908d00 100644 --- a/ebike-operate/src/main/java/com/cdzy/ebikeoperate/service/impl/EbikeOperationRegionServiceImpl.java +++ b/ebike-operate/src/main/java/com/cdzy/ebikeoperate/service/impl/EbikeOperationRegionServiceImpl.java @@ -47,6 +47,7 @@ import static com.cdzy.ebikeoperate.model.pojo.table.EbikeAdministrationZoneTabl import static com.cdzy.ebikeoperate.model.pojo.table.EbikeOperationRegionTableDef.EBIKE_OPERATION_REGION; import static com.cdzy.ebikeoperate.model.pojo.table.EbikePointTableDef.EBIKE_POINT; import static com.cdzy.ebikeoperate.model.pojo.table.EbikeRegionLevelTableDef.EBIKE_REGION_LEVEL; +import static com.cdzy.ebikeoperate.model.pojo.table.EbikeSiteRegionTableDef.EBIKE_SITE_REGION; import static com.cdzy.ebikeoperate.model.pojo.table.EbikeStaffRegionTableDef.EBIKE_STAFF_REGION; /** @@ -135,9 +136,15 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl ebikeOperationRegions = this.mapper.selectListByIds(delRegionDto.getIds()); + //做不同运营商考虑,通过循环进行删除 ebikeOperationRegions.forEach(region -> delPoints(region.getOrgId(), region.getOperationRegionId()) ); + QueryWrapper queryWrapper = QueryWrapper.create() + .where(EBIKE_SITE_REGION.OPERATION_REGION_ID.in(delRegionDto.getIds())); + staffRegionMapper.deleteByQuery(queryWrapper); + //站点与运营商解耦仅与运营区有关,做批量删除 + redisUtil.deleteStieByOperationIds(delRegionDto.getIds()); this.mapper.deleteBatchByIds(delRegionDto.getIds()); } diff --git a/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java b/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java index 4b114a19..511e5a90 100644 --- a/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java +++ b/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java @@ -321,6 +321,32 @@ public class RedisUtil { Polygon polygon = parsePolygonFromWKT(polygonFromWKT); return isPointInPolygon(lng, lat, polygon); } + /** + * 判断坐标点是否在附近站点区内 + * @param lng 经度 + * @param lat 纬度 + * @return true-在内部;false-在外部或边界上(根据业务需求调整) + */ + public Long isPointInSiteWithSiteRegionId(double lng, double lat,Long areaId) { + //查询附近停车区 + List nearbyParking = findNearbyParking(lng, lat,areaId); + if (nearbyParking.isEmpty()) { + return null; + } + //获取第一个大致包含该点位的停车区 + String regionId = checkPointInArea(lng, lat, nearbyParking,areaId); + if (regionId == null) { + return null; + } + //进行更精确的判断 + String polygonFromWKT = getPolygonFromWKT(areaId,regionId,"parking_area:meta:"); + Polygon polygon = parsePolygonFromWKT(polygonFromWKT); + boolean inPolygon = isPointInPolygon(lng, lat, polygon); + if (inPolygon) { + return Long.valueOf(regionId); + } + return null; + } /** * 判断坐标点是否在附近运营区内 @@ -809,4 +835,21 @@ public class RedisUtil { public Boolean releaseLock(String key) { return redisTemplate.delete(key); } + + public void deleteStieByOperationIds(List ids) { + List parkingKeyList = new ArrayList<>(); + List siteKeyList = new ArrayList<>(); + List parkingAreaKeyList = new ArrayList<>(); + List siteAreaKeyList = new ArrayList<>(); + for (Long id : ids) { + parkingKeyList.add(parkingKey+id); + siteKeyList.add(siteKey+id); + parkingAreaKeyList.add("parking_area:meta:"+id); + siteAreaKeyList.add("site_area:meta:"+id); + } + redisTemplate.delete(parkingKeyList); + redisTemplate.delete(siteKeyList); + redisTemplate.delete(parkingAreaKeyList); + redisTemplate.delete(siteAreaKeyList); + } } From f3f7474c25ea8973022636300f765bf2ef5649ec Mon Sep 17 00:00:00 2001 From: attiya <2413103649@qq.com> Date: Tue, 13 May 2025 14:42:40 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=AE=97=E6=B3=95=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cdzy/ebikeoperate/utils/RedisUtil.java | 4 ++- .../java/com/cdzy/orders/uitls/RedisUtil.java | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java b/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java index 511e5a90..74b714e4 100644 --- a/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java +++ b/ebike-operate/src/main/java/com/cdzy/ebikeoperate/utils/RedisUtil.java @@ -321,8 +321,10 @@ public class RedisUtil { Polygon polygon = parsePolygonFromWKT(polygonFromWKT); return isPointInPolygon(lng, lat, polygon); } + + /** - * 判断坐标点是否在附近站点区内 + * 判断坐标点是否在附近站点区内并返回站点id * @param lng 经度 * @param lat 纬度 * @return true-在内部;false-在外部或边界上(根据业务需求调整) diff --git a/ebike-orders/src/main/java/com/cdzy/orders/uitls/RedisUtil.java b/ebike-orders/src/main/java/com/cdzy/orders/uitls/RedisUtil.java index ff6a36f8..1d6bf599 100644 --- a/ebike-orders/src/main/java/com/cdzy/orders/uitls/RedisUtil.java +++ b/ebike-orders/src/main/java/com/cdzy/orders/uitls/RedisUtil.java @@ -253,6 +253,35 @@ public class RedisUtil { return isPointInPolygon(lng, lat, polygon); } + + + /** + * 判断坐标点是否在附近站点区内并返回站点id + * @param lng 经度 + * @param lat 纬度 + * @return true-在内部;false-在外部或边界上(根据业务需求调整) + */ + public Long isPointInSiteWithSiteRegionId(double lng, double lat,Long areaId) { + //查询附近停车区 + List nearbyParking = findNearbyParking(lng, lat,areaId); + if (nearbyParking.isEmpty()) { + return null; + } + //获取第一个大致包含该点位的停车区 + String regionId = checkPointInArea(lng, lat, nearbyParking,areaId); + if (regionId == null) { + return null; + } + //进行更精确的判断 + String polygonFromWKT = getPolygonFromWKT(areaId,regionId,"parking_area:meta:"); + Polygon polygon = parsePolygonFromWKT(polygonFromWKT); + boolean inPolygon = isPointInPolygon(lng, lat, polygon); + if (inPolygon) { + return Long.valueOf(regionId); + } + return null; + } + /** * 判断坐标点是否在附近运营区内 * @param lng 经度