查询所有组织

This commit is contained in:
wuweida 2022-05-09 09:31:23 +08:00
parent c46036c450
commit 0fef3344ec
4 changed files with 145 additions and 4 deletions

View File

@ -4,10 +4,7 @@ import com.hisense.monitormanage.dto.ChannelLabelDto;
import com.hisense.monitormanage.dto.ChengguanDto;
import com.hisense.monitormanage.dto.ScenicCameraDto;
import com.hisense.monitormanage.entity.*;
import com.hisense.monitormanage.mapper.CameraChannelMapper;
import com.hisense.monitormanage.mapper.CameraMapper;
import com.hisense.monitormanage.mapper.ProjectMapper;
import com.hisense.monitormanage.mapper.ScenicMapper;
import com.hisense.monitormanage.mapper.*;
import com.hisense.monitormanage.service.MonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -39,6 +36,9 @@ public class Controller {
@Autowired
private CameraChannelMapper cameraChannelMapper;
@Autowired
private CameraOrgenMapper cameraOrgenMapper;
@RequestMapping("all")
public Object all(){
List<Project> projects = projectMapper.selectList(null);
@ -131,6 +131,11 @@ public class Controller {
return success;
}
/**
* 查询所有标签
* @param label
* @return
*/
@RequestMapping("selectAllLabel")
public Result selectAllLabel(Label label ){
@ -141,6 +146,66 @@ public class Controller {
return success;
}
/**
* 查询所有组织
* @param cameraOrgan
* @return
*/
@RequestMapping("selectAllOrgan")
public Result selectAllOrgan(CameraOrgan cameraOrgan){
List<CameraOrgan> organs = cameraOrgenMapper.selectAllOrgan(cameraOrgan);
Result success = Result.success(organs);
return success;
}
//根据用户已输入的文字请求输入建议信息
//text:用户输入的文字信息,必填
//maxSuggestions最大建议数量0~10默认2
@RequestMapping("suggest")
public Result suggest(
@RequestParam(value ="text") String text,
@RequestParam(value = "maxSuggestions",required = false,defaultValue = "2") Integer maxSuggestions
){
Map<String,Object> map = new HashMap<>();
map.put("text",text);
map.put("maxSuggestions",maxSuggestions);
return monitorService.suggest(map);
}
//根据用户已输入的文字请求匹配的地址信息
//singleLine:用户输入的文字性地名地址信息必填
//maxSuggestions最大建议数量0~10默认2
//magicKey:地名地址唯一ID,Suggest操作返回的JSON数组中包含的magicKey
//outSR:坐标系信息,包含"wkid"属性是表示空间参考的ID示例{ "wkid":4490 }
@RequestMapping("geocode")
public Result geocode(
@RequestParam(value="singleLine") String singleLine,
@RequestParam(value = "maxSuggestions",required = false,defaultValue = "2") Integer maxSuggestions,
@RequestParam(value = "magicKey",required = false,defaultValue = "") String magicKey,
@RequestParam(value = "outSR",required = false,defaultValue = "") String outSR
){
Map<String,Object> map = new HashMap<>();
map.put("SingleLine",singleLine);
map.put("maxSuggestions",maxSuggestions);
map.put("magicKey",magicKey);
map.put("outSR",outSR);
return monitorService.geocode(map);
}
//根据用户已输入的坐标请求附近的地址信息
//location:坐标,必填,请注意编码示例{"x":120.40632244540544,"y":36.08136665300961,"spatialReference":{"wkid":4490,"latestWkid":4490}}
@RequestMapping("reverseGeocode")
public Result reverseGeocode(
@RequestParam(value="location") String location
){
Map<String,Object> map = new HashMap<>();
map.put("location",location);
return monitorService.reverseGeocode(map);
}
//查询视频点播巡检结果只取异常的
@RequestMapping("listChannelPlayStates")
public Result listChannelPlayStates(

View File

@ -2,6 +2,12 @@ package com.hisense.monitormanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.entity.CameraOrgan;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface CameraOrgenMapper extends BaseMapper<CameraOrgan> {
@Select("select * from t_camera_organ")
List<CameraOrgan> selectAllOrgan(CameraOrgan cameraOrgan);
}

View File

@ -359,6 +359,68 @@ public class MonitorService {
}
}
//地名地址搜索服务的Suggest操作
public Result suggest(Map<String,Object> map){
String url = "http://q3d.qd.gov.cn:8195/portalproxy/qcserver/rest/services/qcgd/GeocodeServer/suggest?"+"text={text}&key={key}";
map.put("key",key);
ResponseEntity<String> responseEntity;
try{
responseEntity = restTemplate.getForEntity(url, String.class,map);
HttpStatus statusCode = responseEntity.getStatusCode();
if(statusCode.is2xxSuccessful()){
return Result.success(responseEntity.getBody());
}else{
return Result.error(String.valueOf(statusCode.value()));
}
} catch (Exception e){
log.info("[suggest] exception:{}",e.getMessage());
return Result.error(e.getMessage());
}
}
//地名地址搜索服务的Geocode操作
public Result geocode(Map<String,Object> map){
String url = "http://q3d.qd.gov.cn:8195/portalproxy/qcserver/rest/services/qcgd/GeocodeServer/findAddressCandidates?"
+"SingleLine={SingleLine}&key={key}";
map.put("key",key);
ResponseEntity<String> responseEntity;
try{
responseEntity = restTemplate.getForEntity(url, String.class,map);
HttpStatus statusCode = responseEntity.getStatusCode();
if(statusCode.is2xxSuccessful()){
return Result.success(responseEntity.getBody());
}else{
return Result.error(String.valueOf(statusCode.value()));
}
} catch (Exception e){
log.info("[geocode] exception:{}",e.getMessage());
return Result.error(e.getMessage());
}
}
//地名地址搜索服务的reverseGeocode操作
public Result reverseGeocode(Map<String,Object> map){
String url = "http://q3d.qd.gov.cn:8195/portalproxy/qcserver/rest/services/qcgd/GeocodeServer/reverseGeocode?"
+"location={location}&key={key}";
map.put("key",key);
ResponseEntity<String> responseEntity;
try {
responseEntity = restTemplate.getForEntity(url, String.class, map);
HttpStatus statusCode = responseEntity.getStatusCode();
if(statusCode.is2xxSuccessful()){
return Result.success(responseEntity.getBody());
}else{
return Result.error(String.valueOf(statusCode.value()));
}
}catch (HttpClientErrorException e){
log.info("[reverseGeocode] exception:{}",e.getMessage());
return Result.error(e.getMessage());
}
}
//查询视频点播巡检结果
public void listChannelPlayStates(Map<String,Object> map){
String url = monitorDomain + "/nms/api/channel/play/list";

View File

@ -30,4 +30,12 @@ class MonitorManageApplicationTests {
}
@Test
public void reverseGeocodeTest(){
String location = "location";
Map<String,Object> map = new HashMap<>();
map.put("location",location);
monitorService.reverseGeocode(map);
}
}