区域:停车区、营运区的geo数据删除
This commit is contained in:
parent
ebd0b07599
commit
28f0f696e7
@ -40,9 +40,9 @@ class EbikeSeversetestApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void contextLoads() {
|
void contextLoads() {
|
||||||
EbikeCmd cmd = new EbikeCmd();
|
EbikeCmd cmd = new EbikeCmd();
|
||||||
cmd.setCmdCode("temp_lock");
|
cmd.setCmdCode("continue_cycling");
|
||||||
cmd.setCmdName("临时停车");
|
cmd.setCmdName("继续骑行");
|
||||||
cmd.setDescribe("临时停车");
|
cmd.setDescribe("继续骑行");
|
||||||
cmdMapper.insert(cmd);
|
cmdMapper.insert(cmd);
|
||||||
System.out.println(cmd.getCmdId());
|
System.out.println(cmd.getCmdId());
|
||||||
}
|
}
|
||||||
@ -50,11 +50,11 @@ class EbikeSeversetestApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void addParam() {
|
void addParam() {
|
||||||
EbikeParam param = new EbikeParam();
|
EbikeParam param = new EbikeParam();
|
||||||
param.setParamName("stamp");
|
param.setParamName("idx");
|
||||||
param.setCmdId("260237383134347264");
|
param.setCmdId("271826173502169088");
|
||||||
param.setLevel(1);
|
param.setLevel(2);
|
||||||
param.setValueType(2);
|
param.setValueType(3);
|
||||||
// param.setParentId(260499792692523008L);
|
param.setParentId(271827039835688960L);
|
||||||
ebikeParamMapper.insert(param);
|
ebikeParamMapper.insert(param);
|
||||||
System.out.println(param.getParamId());
|
System.out.println(param.getParamId());
|
||||||
}
|
}
|
||||||
@ -62,8 +62,8 @@ class EbikeSeversetestApplicationTests {
|
|||||||
@Test
|
@Test
|
||||||
void addParamValue() {
|
void addParamValue() {
|
||||||
EbikeParamValue paramValue = new EbikeParamValue();
|
EbikeParamValue paramValue = new EbikeParamValue();
|
||||||
paramValue.setParamValue("84");
|
paramValue.setParamValue("8");
|
||||||
paramValue.setParamId(266754356462866432L);
|
paramValue.setParamId(271827551599529984L);
|
||||||
ebikeParamValueMapper.insert(paramValue);
|
ebikeParamValueMapper.insert(paramValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,10 +123,7 @@ public class EbikeRegionController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("delOperation")
|
@PostMapping("delOperation")
|
||||||
public JsonResult<?> delOperation(@RequestBody @Validated ReqDelRegionDto delRegionDto) {
|
public JsonResult<?> delOperation(@RequestBody @Validated ReqDelRegionDto delRegionDto) {
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
ebikeRegionService.delOperation(delRegionDto);
|
||||||
.where(EBIKE_REGION.TYPE.eq(EbikeRegionType.OPERATION))
|
|
||||||
.where(EBIKE_REGION.REGION_ID.in(delRegionDto.getRegionIds()));
|
|
||||||
ebikeRegionService.remove(queryWrapper);
|
|
||||||
return JsonResult.success();
|
return JsonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +228,7 @@ public class EbikeRegionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询站点。
|
* 分页查询停车区。
|
||||||
*
|
*
|
||||||
* @param pageParam 分页参数
|
* @param pageParam 分页参数
|
||||||
* @return {@code 200} 添加成功,{@code 500} 添加失败
|
* @return {@code 200} 添加成功,{@code 500} 添加失败
|
||||||
@ -262,11 +259,7 @@ public class EbikeRegionController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("delPark")
|
@PostMapping("delPark")
|
||||||
public JsonResult<?> delPark(@RequestBody @Validated ReqDelRegionDto delRegionDto) {
|
public JsonResult<?> delPark(@RequestBody @Validated ReqDelRegionDto delRegionDto) {
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
ebikeRegionService.delPark(delRegionDto);
|
||||||
.where(EBIKE_REGION.TYPE.eq(EbikeRegionType.PARKING))
|
|
||||||
.where(EBIKE_REGION.REGION_ID.in(delRegionDto.getRegionIds()));
|
|
||||||
ebikeRegionService.remove(queryWrapper);
|
|
||||||
redisUtil.batchDeleteParkingArea(delRegionDto.getRegionIds());
|
|
||||||
return JsonResult.success();
|
return JsonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.cdzy.ebikeoperate.service;
|
|||||||
|
|
||||||
import com.cdzy.common.model.PageParam;
|
import com.cdzy.common.model.PageParam;
|
||||||
import com.cdzy.ebikeoperate.model.dto.request.ReqAuthorizeOperationDto;
|
import com.cdzy.ebikeoperate.model.dto.request.ReqAuthorizeOperationDto;
|
||||||
|
import com.cdzy.ebikeoperate.model.dto.request.ReqDelRegionDto;
|
||||||
import com.cdzy.ebikeoperate.model.dto.request.ReqEbikeRegionDto;
|
import com.cdzy.ebikeoperate.model.dto.request.ReqEbikeRegionDto;
|
||||||
import com.cdzy.ebikeoperate.model.dto.request.ReqSaveRegionDto;
|
import com.cdzy.ebikeoperate.model.dto.request.ReqSaveRegionDto;
|
||||||
import com.cdzy.ebikeoperate.model.dto.response.EbikeRegionDto;
|
import com.cdzy.ebikeoperate.model.dto.response.EbikeRegionDto;
|
||||||
@ -95,4 +96,16 @@ public interface EbikeRegionService extends IService<EbikeRegion> {
|
|||||||
* @param authorizeOperationDto 授权信息
|
* @param authorizeOperationDto 授权信息
|
||||||
*/
|
*/
|
||||||
void authorizeOperation(ReqAuthorizeOperationDto authorizeOperationDto);
|
void authorizeOperation(ReqAuthorizeOperationDto authorizeOperationDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除运营区
|
||||||
|
* @param delRegionDto 信息
|
||||||
|
*/
|
||||||
|
void delOperation(ReqDelRegionDto delRegionDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除停车区
|
||||||
|
* @param delRegionDto
|
||||||
|
*/
|
||||||
|
void delPark(ReqDelRegionDto delRegionDto);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,10 +14,7 @@ import com.cdzy.ebikeoperate.mapper.EbikeAdministrationZoneMapper;
|
|||||||
import com.cdzy.ebikeoperate.mapper.EbikePointMapper;
|
import com.cdzy.ebikeoperate.mapper.EbikePointMapper;
|
||||||
import com.cdzy.ebikeoperate.mapper.EbikeRegionMapper;
|
import com.cdzy.ebikeoperate.mapper.EbikeRegionMapper;
|
||||||
import com.cdzy.ebikeoperate.mapper.EbikeStaffRegionMapper;
|
import com.cdzy.ebikeoperate.mapper.EbikeStaffRegionMapper;
|
||||||
import com.cdzy.ebikeoperate.model.dto.request.ReqAuthorizeOperationDto;
|
import com.cdzy.ebikeoperate.model.dto.request.*;
|
||||||
import com.cdzy.ebikeoperate.model.dto.request.ReqEbikePointDto;
|
|
||||||
import com.cdzy.ebikeoperate.model.dto.request.ReqEbikeRegionDto;
|
|
||||||
import com.cdzy.ebikeoperate.model.dto.request.ReqSaveRegionDto;
|
|
||||||
import com.cdzy.ebikeoperate.model.dto.response.EbikeRegionDto;
|
import com.cdzy.ebikeoperate.model.dto.response.EbikeRegionDto;
|
||||||
import com.cdzy.ebikeoperate.model.dto.response.RedisPoint;
|
import com.cdzy.ebikeoperate.model.dto.response.RedisPoint;
|
||||||
import com.cdzy.ebikeoperate.model.dto.response.ZoneDto;
|
import com.cdzy.ebikeoperate.model.dto.response.ZoneDto;
|
||||||
@ -269,6 +266,41 @@ public class EbikeRegionServiceImpl extends ServiceImpl<EbikeRegionMapper, Ebike
|
|||||||
staffRegionMapper.insertBatch(staffRegions);
|
staffRegionMapper.insertBatch(staffRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delOperation(ReqDelRegionDto delRegionDto) {
|
||||||
|
List<EbikeRegion> list = this.mapper.selectListByIds(delRegionDto.getRegionIds());
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
list.forEach(region -> {
|
||||||
|
redisUtil.delOperationArea(region.getOrgId(), region.getRegionId());
|
||||||
|
});
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.where(EBIKE_REGION.TYPE.eq(EbikeRegionType.PARKING))
|
||||||
|
.where(EBIKE_REGION.PARENT_ID.in(delRegionDto.getRegionIds()));
|
||||||
|
List<EbikeRegion> regions = this.mapper.selectListByQuery(queryWrapper);
|
||||||
|
regions.forEach(region -> {
|
||||||
|
redisUtil.delParkingArea(region.getOrgId(), region.getRegionId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.where(EBIKE_REGION.TYPE.eq(EbikeRegionType.OPERATION).or(EBIKE_REGION.TYPE.eq(EbikeRegionType.PARKING)))
|
||||||
|
.where(EBIKE_REGION.REGION_ID.in(delRegionDto.getRegionIds()).or(EBIKE_REGION.PARENT_ID.in(delRegionDto.getRegionIds())));
|
||||||
|
this.mapper.deleteByQuery(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delPark(ReqDelRegionDto delRegionDto) {
|
||||||
|
List<EbikeRegion> list = this.mapper.selectListByIds(delRegionDto.getRegionIds());
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
list.forEach(region -> {
|
||||||
|
redisUtil.delParkingArea(region.getOrgId(), region.getRegionId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.where(EBIKE_REGION.TYPE.eq(EbikeRegionType.PARKING))
|
||||||
|
.where(EBIKE_REGION.REGION_ID.in(delRegionDto.getRegionIds()));
|
||||||
|
this.mapper.deleteByQuery(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
private List<RspBikeInfo> getRspBikeInfos(List<RedisPoint> points) {
|
private List<RspBikeInfo> getRspBikeInfos(List<RedisPoint> points) {
|
||||||
//TODO:优化为点列表+电量,再通过详情接口获取车辆详情
|
//TODO:优化为点列表+电量,再通过详情接口获取车辆详情
|
||||||
if (points != null && !points.isEmpty()) {
|
if (points != null && !points.isEmpty()) {
|
||||||
|
|||||||
@ -68,7 +68,17 @@ public class RedisUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加停车区地理位置
|
* 添加停车区数据
|
||||||
|
* @param areaId 运营区Id
|
||||||
|
* @param regionId 停车区Id
|
||||||
|
*/
|
||||||
|
public void delParkingArea(Long areaId,Long regionId) {
|
||||||
|
redisTemplate.opsForGeo().remove(parkingKey+areaId, regionId);
|
||||||
|
delParkingAreaMeta(areaId,regionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加运营区
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addOperationArea(Long orgId,Long regionId, List<Coordinate> vertices) {
|
public void addOperationArea(Long orgId,Long regionId, List<Coordinate> vertices) {
|
||||||
@ -77,6 +87,15 @@ public class RedisUtil {
|
|||||||
addOperationAreaMeta(orgId,regionId,vertices);
|
addOperationAreaMeta(orgId,regionId,vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除运营区
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void delOperationArea(Long orgId,Long regionId) {
|
||||||
|
redisTemplate.opsForGeo().remove(operationKey+orgId,regionId);
|
||||||
|
delOperationAreaMeta(orgId,regionId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加圆形停车区地理位置
|
* 添加圆形停车区地理位置
|
||||||
*
|
*
|
||||||
@ -337,6 +356,10 @@ public class RedisUtil {
|
|||||||
redisTemplate.opsForHash().put("parking_area:meta:" + areaId, "mbr"+regionId, mbrStr);
|
redisTemplate.opsForHash().put("parking_area:meta:" + areaId, "mbr"+regionId, mbrStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delParkingAreaMeta(Long areaId,Long regionId) {
|
||||||
|
redisTemplate.opsForHash().delete("parking_area:meta:" + areaId, "vertices"+regionId);
|
||||||
|
redisTemplate.opsForHash().delete("parking_area:meta:" + areaId, "mbr"+regionId);
|
||||||
|
}
|
||||||
|
|
||||||
public void addOperationAreaMeta(Long orgId,Long regionId, List<Coordinate> vertices) {
|
public void addOperationAreaMeta(Long orgId,Long regionId, List<Coordinate> vertices) {
|
||||||
|
|
||||||
@ -354,6 +377,11 @@ public class RedisUtil {
|
|||||||
redisTemplate.opsForHash().put("operation_area:meta:" + orgId, "mbr"+regionId, mbrStr);
|
redisTemplate.opsForHash().put("operation_area:meta:" + orgId, "mbr"+regionId, mbrStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delOperationAreaMeta(Long orgId,Long regionId) {
|
||||||
|
redisTemplate.opsForHash().delete("operation_area:meta:" + orgId, "vertices"+regionId);
|
||||||
|
redisTemplate.opsForHash().delete("operation_area:meta:" + orgId, "mbr"+regionId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除指定停车区的元数据(MBR 和顶点)
|
* 删除指定停车区的元数据(MBR 和顶点)
|
||||||
* @param orgId 组织ID
|
* @param orgId 组织ID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user