Merge branch 'main' of http://47.109.71.130:3000/attiya/ebike-share
This commit is contained in:
commit
e15bf17422
23
LICENSE
23
LICENSE
@ -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.
|
|
||||||
@ -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.EbikeOperationRegionTableDef.EBIKE_OPERATION_REGION;
|
||||||
import static com.cdzy.ebikeoperate.model.pojo.table.EbikePointTableDef.EBIKE_POINT;
|
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.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;
|
import static com.cdzy.ebikeoperate.model.pojo.table.EbikeStaffRegionTableDef.EBIKE_STAFF_REGION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,9 +136,15 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
|||||||
@Override
|
@Override
|
||||||
public void delOperation(ReqBatchRegionDto delRegionDto) {
|
public void delOperation(ReqBatchRegionDto delRegionDto) {
|
||||||
List<EbikeOperationRegion> ebikeOperationRegions = this.mapper.selectListByIds(delRegionDto.getIds());
|
List<EbikeOperationRegion> ebikeOperationRegions = this.mapper.selectListByIds(delRegionDto.getIds());
|
||||||
|
//做不同运营商考虑,通过循环进行删除
|
||||||
ebikeOperationRegions.forEach(region ->
|
ebikeOperationRegions.forEach(region ->
|
||||||
delPoints(region.getOrgId(), region.getOperationRegionId())
|
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());
|
this.mapper.deleteBatchByIds(delRegionDto.getIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -322,6 +322,34 @@ public class RedisUtil {
|
|||||||
return isPointInPolygon(lng, lat, polygon);
|
return isPointInPolygon(lng, lat, polygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断坐标点是否在附近站点区内并返回站点id
|
||||||
|
* @param lng 经度
|
||||||
|
* @param lat 纬度
|
||||||
|
* @return true-在内部;false-在外部或边界上(根据业务需求调整)
|
||||||
|
*/
|
||||||
|
public Long isPointInSiteWithSiteRegionId(double lng, double lat,Long areaId) {
|
||||||
|
//查询附近停车区
|
||||||
|
List<String> 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 经度
|
* @param lng 经度
|
||||||
@ -809,4 +837,21 @@ public class RedisUtil {
|
|||||||
public Boolean releaseLock(String key) {
|
public Boolean releaseLock(String key) {
|
||||||
return redisTemplate.delete(key);
|
return redisTemplate.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteStieByOperationIds(List<Long> ids) {
|
||||||
|
List<String> parkingKeyList = new ArrayList<>();
|
||||||
|
List<String> siteKeyList = new ArrayList<>();
|
||||||
|
List<String> parkingAreaKeyList = new ArrayList<>();
|
||||||
|
List<String> 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -253,6 +253,35 @@ public class RedisUtil {
|
|||||||
return isPointInPolygon(lng, lat, polygon);
|
return isPointInPolygon(lng, lat, polygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断坐标点是否在附近站点区内并返回站点id
|
||||||
|
* @param lng 经度
|
||||||
|
* @param lat 纬度
|
||||||
|
* @return true-在内部;false-在外部或边界上(根据业务需求调整)
|
||||||
|
*/
|
||||||
|
public Long isPointInSiteWithSiteRegionId(double lng, double lat,Long areaId) {
|
||||||
|
//查询附近停车区
|
||||||
|
List<String> 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 经度
|
* @param lng 经度
|
||||||
|
|||||||
@ -67,8 +67,11 @@ public class ReoprtHandler {
|
|||||||
redisUtil.set(deviceId, resGpsDto);
|
redisUtil.set(deviceId, resGpsDto);
|
||||||
double[] doubles = CoordinateUtil.WGS84ToGCJ02(resGpsDto.getLongitude(), resGpsDto.getLatitude());
|
double[] doubles = CoordinateUtil.WGS84ToGCJ02(resGpsDto.getLongitude(), resGpsDto.getLatitude());
|
||||||
redisUtil.addLocation(new Point(doubles[0], doubles[1]),deviceId);
|
redisUtil.addLocation(new Point(doubles[0], doubles[1]),deviceId);
|
||||||
EbikeTracking ebikeTracking = new EbikeTracking(deviceId,doubles[1], doubles[0]);
|
boolean outOfChina = CoordinateUtil.outOfChina(doubles[0], doubles[1]);
|
||||||
operateFeignClient.saveEbikeTracking(ebikeTracking);
|
if (!outOfChina) {
|
||||||
|
EbikeTracking ebikeTracking = new EbikeTracking(deviceId,doubles[1], doubles[0]);
|
||||||
|
operateFeignClient.saveEbikeTracking(ebikeTracking);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user