using Hopetry;
using Hopetry.WebApi;
using Hopetry.WebApi.Controllers;
using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using OpenAuth.App;
using System;
using System.Collections.Generic;
namespace Hopetry.WebApi.Controllers
{
///
/// 根据网格获取资源
///
[Route("api/[controller]/[action]")]
[ApiController]
public class FireGrideResourceController : ControllerBase
{
IConfiguration _configuration;
private FireGrideResourceApp _firegridapp;
public FireGrideResourceController(IConfiguration configuration, FireGrideResourceApp firegridapp)
{
_configuration = configuration;
_firegridapp = firegridapp;
}
///
/// 根据起火点坐标,查询起火点所在的网格
///
/// 坐标
/// 坐标
///
[HttpGet]
[AllowAnonymous]
public Response GetGridInfoByLngLat(string lng, string lat)
{
Response response = new Response();
try
{
response.Result = _firegridapp.GetGridInfoByLngLat(lng, lat);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据网格id获取水源地信息
///
/// 网格id
///
[HttpGet]
[AllowAnonymous]
public Response> GetWaterResource()
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetWaterResource();
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据网格id获取水源地信息
///
/// 网格id
///
[HttpGet]
[AllowAnonymous]
public Response> GetWuziResource()
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetWuziResource();
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据网格id获取防火营房信息
///
/// 网格id
///
[HttpGet]
[AllowAnonymous]
public Response> GetWg_Barrack(long id)
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetWg_Barrack(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据网格id获取水防火物资数据
///
/// 网格id
///
[HttpGet]
[AllowAnonymous]
public Response> GetMaterials(long id)
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetMaterials(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据网格id获取道路信息
///
/// 网格id
///
[HttpGet]
[AllowAnonymous]
public Response> GetWgRoad(long id)
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetWgRoad(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 获取所有道路信息
///
///
[HttpGet]
[AllowAnonymous]
public Response> GetAllWgRoad()
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetAllWgRoad();
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据网格id获取水网信息
///
/// 网格id
///
[HttpGet]
[AllowAnonymous]
public Response> GetWgWaterNetwork(long id)
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetWgWaterNetwork(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 查询全部道路信息
///
///
[HttpGet]
[AllowAnonymous]
public Response> GetAllRode()
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetAllRode();
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 查询全部营房信息
///
///
[HttpGet]
[AllowAnonymous]
public Response> GetAllYingFang()
{
Response> response = new Response>();
try
{
response.Result = _firegridapp.GetAllYingFang();
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
}
}