添加校验所有地图数据接口

This commit is contained in:
joylink_zhangsai 2021-05-10 15:44:34 +08:00
parent a4b42d13d8
commit fb2f66f275
3 changed files with 31 additions and 0 deletions

View File

@ -209,6 +209,12 @@ public class MapController {
return this.iMapService.isMapNameExist(name);
}
@ApiOperation("校验所有地图数据")
@GetMapping("/all/simulationCheck")
public List<MapVO> doSimulationCheckAll(@ApiIgnore @RequestAttribute UserVO user) {
return this.iMapService.doSimulationCheckAll(user);
}
@ApiOperation(value = "检测地图仿真数据是否存在错误")
@GetMapping(path = "/{id}/simulationCheck")
public List<String> doSimulationCheck(@PathVariable Long id, @ApiIgnore @RequestAttribute UserVO user) {

View File

@ -297,4 +297,10 @@ public interface IMapService {
* 查询属于该集中站的区段
*/
List<MapSectionNewVO> querySectionBelongTheDeviceStation(Long mapId, String stationCode);
/**
* 校验所有地图数据
* @return
*/
List<MapVO> doSimulationCheckAll(UserVO user);
}

View File

@ -882,6 +882,25 @@ public class MapService implements IMapService {
.filter(section -> section.getStationCode().equals(stationCode)).collect(Collectors.toList());
}
@Override
public List<MapVO> doSimulationCheckAll(UserVO user) {
List<MapVO> mapVOS = listOnline();
List<MapVO> errorMaps = new ArrayList<>();
for (MapVO map : mapVOS) {
List<String> list = null;
try {
list = doSimulationCheck(map.getId(), user);
} catch (RuntimeException e) {
errorMaps.add(map);
e.printStackTrace();
}
if (!CollectionUtils.isEmpty(list)) {
errorMaps.add(map);
}
}
return errorMaps;
}
/**
* 该版本的地图数据是否存在
*/