增加网格操作后的处理
This commit is contained in:
parent
1056cb657c
commit
1ca53fbfcb
@ -32,7 +32,7 @@ public class GridAppController extends DefaultBaseController {
|
|||||||
@ApiOperation(value = "网格详情", notes = "网格详情接口")
|
@ApiOperation(value = "网格详情", notes = "网格详情接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
@ApiImplicitParam(name = "gridIdId", value = "网格ID", paramType = "path")
|
@ApiImplicitParam(name = "gridId", value = "网格ID", paramType = "path")
|
||||||
})
|
})
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("get/{gridId}")
|
@GetMapping("get/{gridId}")
|
||||||
@ -54,6 +54,7 @@ public class GridAppController extends DefaultBaseController {
|
|||||||
@ApiOperation(value = "网格列表", notes = "网格列表接口")
|
@ApiOperation(value = "网格列表", notes = "网格列表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path"),
|
||||||
})
|
})
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("list/area-code/{areaCode}")
|
@GetMapping("list/area-code/{areaCode}")
|
||||||
@ -65,6 +66,7 @@ public class GridAppController extends DefaultBaseController {
|
|||||||
@ApiOperation(value = "网格(排除查询网格)列表", notes = "网格(排除查询网格)列表接口")
|
@ApiOperation(value = "网格(排除查询网格)列表", notes = "网格(排除查询网格)列表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "gridId", value = "网格ID", paramType = "path"),
|
||||||
})
|
})
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("list/except/{gridId}")
|
@GetMapping("list/except/{gridId}")
|
||||||
@ -94,6 +96,7 @@ public class GridAppController extends DefaultBaseController {
|
|||||||
@ApiOperation(value = "网格分页列表", notes = "网格分页列表接口")
|
@ApiOperation(value = "网格分页列表", notes = "网格分页列表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "areaCode", value = "地区编码", paramType = "path", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||||
@ -108,4 +111,15 @@ public class GridAppController extends DefaultBaseController {
|
|||||||
return gridService.listPageByAreaCode(areaCode, page);
|
return gridService.listPageByAreaCode(areaCode, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "关联网格列表", notes = "关联网格列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "relationId", value = "关联ID,如用户时为userId", paramType = "path"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-with-point/relation-id/{relationId}")
|
||||||
|
public List<GridDTO> listWithPointByRelationId(@RequestHeader("token") String token, @PathVariable("relationId") String relationId) {
|
||||||
|
return gridService.listWithPointByRelationId(relationId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -123,4 +123,12 @@ public interface IGridRelationService {
|
|||||||
*/
|
*/
|
||||||
List<String> listRelationId(String gridId);
|
List<String> listRelationId(String gridId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网格关联ID列表
|
||||||
|
*
|
||||||
|
* @param gridIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> listRelationId(List<String> gridIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -261,4 +261,11 @@ public interface IGridService {
|
|||||||
*/
|
*/
|
||||||
SuccessResultList<List<GridDTO>> listPageByAreaCode(String areaCode, ListPage page);
|
SuccessResultList<List<GridDTO>> listPageByAreaCode(String areaCode, ListPage page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关系网格列表
|
||||||
|
*
|
||||||
|
* @param relationId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<GridDTO> listWithPointByRelationId(String relationId);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package ink.wgink.module.map.service.grid.impl;
|
|||||||
|
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
import ink.wgink.exceptions.RemoveException;
|
import ink.wgink.exceptions.RemoveException;
|
||||||
|
import ink.wgink.interfaces.map.IGridRelationDeleteAfterHandler;
|
||||||
|
import ink.wgink.interfaces.map.IGridRelationSaveAfterHandler;
|
||||||
import ink.wgink.module.map.dao.grid.IGridRelationDao;
|
import ink.wgink.module.map.dao.grid.IGridRelationDao;
|
||||||
import ink.wgink.module.map.pojo.dtos.grid.GridRelationDTO;
|
import ink.wgink.module.map.pojo.dtos.grid.GridRelationDTO;
|
||||||
import ink.wgink.module.map.service.grid.IGridRelationService;
|
import ink.wgink.module.map.service.grid.IGridRelationService;
|
||||||
@ -22,6 +24,10 @@ public class GridRelationServiceImpl extends DefaultBaseService implements IGrid
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGridRelationDao gridRelationDao;
|
private IGridRelationDao gridRelationDao;
|
||||||
|
@Autowired(required = false)
|
||||||
|
private IGridRelationSaveAfterHandler gridRelationSaveAfterHandler;
|
||||||
|
@Autowired(required = false)
|
||||||
|
private IGridRelationDeleteAfterHandler gridRelationDeleteAfterHandler;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(String gridId, List<String> relationIdArray) {
|
public void save(String gridId, List<String> relationIdArray) {
|
||||||
@ -35,36 +41,54 @@ public class GridRelationServiceImpl extends DefaultBaseService implements IGrid
|
|||||||
params.put("relationId", relationId);
|
params.put("relationId", relationId);
|
||||||
gridRelationDao.save(params);
|
gridRelationDao.save(params);
|
||||||
}
|
}
|
||||||
|
gridRelationSaveAfterHandler.handle(relationIdArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String gridId) {
|
public void delete(String gridId) {
|
||||||
|
List<String> relationIds = listRelationId(gridId);
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
params.put("gridId", gridId);
|
params.put("gridId", gridId);
|
||||||
gridRelationDao.delete(params);
|
gridRelationDao.delete(params);
|
||||||
|
if (gridRelationDeleteAfterHandler != null) {
|
||||||
|
gridRelationDeleteAfterHandler.handle(relationIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String gridId, String relationId) throws RemoveException {
|
public void delete(String gridId, String relationId) throws RemoveException {
|
||||||
|
List<String> existRelationIds = listRelationIdByGridIdAndRelationIds(gridId, Arrays.asList(relationId));
|
||||||
Map<String, Object> params = getHashMap(4);
|
Map<String, Object> params = getHashMap(4);
|
||||||
params.put("gridId", gridId);
|
params.put("gridId", gridId);
|
||||||
params.put("relationId", relationId);
|
params.put("relationId", relationId);
|
||||||
gridRelationDao.delete(params);
|
gridRelationDao.delete(params);
|
||||||
|
if (gridRelationDeleteAfterHandler != null) {
|
||||||
|
gridRelationDeleteAfterHandler.handle(existRelationIds);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String gridId, List<String> relationIds) {
|
public void delete(String gridId, List<String> relationIds) {
|
||||||
|
List<String> existRelationIds = listRelationIdByGridIdAndRelationIds(gridId, relationIds);
|
||||||
Map<String, Object> params = getHashMap(4);
|
Map<String, Object> params = getHashMap(4);
|
||||||
params.put("gridId", gridId);
|
params.put("gridId", gridId);
|
||||||
params.put("relationIds", relationIds);
|
params.put("relationIds", relationIds);
|
||||||
gridRelationDao.delete(params);
|
gridRelationDao.delete(params);
|
||||||
|
if (gridRelationDeleteAfterHandler != null) {
|
||||||
|
gridRelationDeleteAfterHandler.handle(existRelationIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteByGridIds(List<String> gridIds) {
|
public void deleteByGridIds(List<String> gridIds) {
|
||||||
|
List<String> existRelationIds = listRelationId(gridIds);
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
params.put("gridIds", gridIds);
|
params.put("gridIds", gridIds);
|
||||||
gridRelationDao.delete(params);
|
gridRelationDao.delete(params);
|
||||||
|
if (gridRelationDeleteAfterHandler != null) {
|
||||||
|
gridRelationDeleteAfterHandler.handle(existRelationIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,6 +96,9 @@ public class GridRelationServiceImpl extends DefaultBaseService implements IGrid
|
|||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
params.put("relationId", relationId);
|
params.put("relationId", relationId);
|
||||||
gridRelationDao.delete(params);
|
gridRelationDao.delete(params);
|
||||||
|
if (gridRelationDeleteAfterHandler != null) {
|
||||||
|
gridRelationDeleteAfterHandler.handle(Arrays.asList(relationId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -125,6 +152,12 @@ public class GridRelationServiceImpl extends DefaultBaseService implements IGrid
|
|||||||
return listRelationIdByGridRelation(gridRelationDTOs);
|
return listRelationIdByGridRelation(gridRelationDTOs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listRelationId(List<String> gridIds) {
|
||||||
|
List<GridRelationDTO> gridRelationDTOs = listByGridIds(gridIds);
|
||||||
|
return listRelationIdByGridRelation(gridRelationDTOs);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网格ID列表
|
* 获取网格ID列表
|
||||||
*
|
*
|
||||||
@ -142,6 +175,21 @@ public class GridRelationServiceImpl extends DefaultBaseService implements IGrid
|
|||||||
return new ArrayList<>(gridIdSet);
|
return new ArrayList<>(gridIdSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网格ID列表
|
||||||
|
*
|
||||||
|
* @param gridId
|
||||||
|
* @param relationIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> listRelationIdByGridIdAndRelationIds(String gridId, List<String> relationIds) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("gridId", gridId);
|
||||||
|
params.put("relationIds", relationIds);
|
||||||
|
List<GridRelationDTO> gridRelationDTOs = list(params);
|
||||||
|
return listGridIdByGridRelation(gridRelationDTOs);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取网格ID列表
|
* 获取网格ID列表
|
||||||
*
|
*
|
||||||
|
@ -394,6 +394,15 @@ public class GridServiceImpl extends DefaultBaseService implements IGridService
|
|||||||
return listPage(page);
|
return listPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GridDTO> listWithPointByRelationId(String relationId) {
|
||||||
|
List<GridDTO> gridDTOs = listByRelationId(relationId);
|
||||||
|
gridDTOs.forEach(gridDTO -> {
|
||||||
|
gridDTO.setPointArray(gridPointService.list(gridDTO.getGridId()));
|
||||||
|
});
|
||||||
|
return gridDTOs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置网格点
|
* 设置网格点
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user