using Infrastructure;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using OpenAuth.App.ServiceApp.DroneCaseInfo;
using OpenAuth.App.ServiceApp.InsTaskHallManager;
using OpenAuth.App.ServiceApp.Request;
using OpenAuth.App.ServiceApp.Response;
namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class DroneCaseinfoController : ControllerBase
{
private readonly DroneCaseinfoApp _app;
public DroneCaseinfoController(DroneCaseinfoApp app)
{
_app = app;
}
[HttpGet]
public string Test(string txt)
{
return _app.Test(txt);
}
///
/// 无人机添加案件
///
///
///
[HttpPost]
public Response AddDroneCaseByDrone([FromBody] AddDroneCaseByDroneReq req)
{
Response response = new Response();
try
{
response.Result = _app.AddDroneCaseByDrone(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 案件详情
///
///
///
[HttpGet]
public Response GetCaseInfo(string id)
{
Response response = new Response();
try
{
response.Result = _app.GetCaseInfo(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 获取GeoJson
/// PC获取图层的GeoJson(判读页面用)
///
///
///
[HttpGet]
public Response GetDroneGeoJson(string id)
{
Response response = new Response();
try
{
response.Result = _app.GetDroneGeoJson(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 案件判读
///
///
///
[HttpPost]
public Response UpdateDroneCaseInfoIntact([FromBody] AddOrUpdateDroneCaseInfoDataBaseReq req)
{
Response response = new Response();
try
{
response.Result = _app.UpdateDroneCaseInfoIntact(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 上报案件
///
///
///
[HttpPost]
public Response AddDroneCaseInfo([FromBody] AddOrUpdateDroneCaseInfoReq req)
{
Response response = new Response();
try
{
if (string.IsNullOrEmpty(req.info.Id))
{
//新增
response.Result = _app.AddDroneCaseInfo(req);
}
else
{
//修改
response.Result = _app.UpdateDroneCaseInfo(req);
}
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
}
}