using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp.DroneCloudQuery;
using OpenAuth.App.ServiceApp.DroneCloudQueryManage.Request;
using OpenAuth.Repository.Domain;
using OpenAuth.WebApi.Model.CustomAttribute;
using Microsoft.AspNetCore.Authorization;
using OpenAuth.App.ServiceApp.Response;
namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
///
/// 云查询
///
[Route("api/[controller]/[action]")]
[ApiController]
public partial class DroneCloudQueryController : ControllerBase
{
private DroneCloudQueryApp _app;
private DroneCloudLandQueryApp _land;
public DroneCloudQueryController(DroneCloudQueryApp app, DroneCloudLandQueryApp land)
{
_app = app;
_land = land;
}
///
///添加云查询任务
///
/// 图斑编号
/// 案件编号
///
[HttpPost]
public Response AddDroneTask(string geomid, string caseno, string countyName)
{
var response = new Response();
if (string.IsNullOrEmpty(geomid))
throw new Exception("图斑不能为空");
try
{
response = _app.AddDroneTask(geomid, caseno, countyName);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 获取需要查询的任务列表
///
///
[HttpGet]
[AllowAnonymous]
public async Task> LoadDroneTask()
{
return await _app.LoadDroneTask();
}
///
/// 添加查询结果
///
///
///
[HttpPost]
public async Task> UpdateCloudQuery(CloudQueryReq req)
{
var response = new Response();
try
{
response = await _app.UpdateCloudQuery(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据云查询id获取查询结果
///
/// 结果id,消息推送的msg
///
[HttpGet]
public async Task> LoadCloudQueryById(string id)
{
return await _app.LoadCloudQueryById(id);
}
///
/// 根据geomid和caseno获取状态
///
///
[HttpGet]
public async Task> LoadCloudQueryByCaseNo(string geomId, string caseno)
{
return await _app.LoadCloudQueryByCaseNo(geomId, caseno);
}
[HttpGet]
public async Task>>> LoadCloudQueryAll(string geomId, string caseno,
int page, int limit)
{
return await _app.LoadCloudQueryAll(geomId, caseno, page, limit);
}
///
///获取土地分类
///
///
[HttpGet]
public async Task>> getLandType()
{
return await _app.getLandType();
}
///
/// 保存土地分类
///
///
[HttpPost]
public Response AddDroneLandType(AddOrUpdateDroneLandType req)
{
return _land.AddOrUpdateDroneLandType(req);
}
///
///添加云查询任务
///
/// 图斑编号
/// 案件编号
///
[HttpPost]
public Response AddDroneLandTask(string geomData, string caseid, string code, string name)
{
var response = new Response();
if (string.IsNullOrEmpty(geomData))
throw new Exception("图斑数据不能为空");
try
{
response = _land.AddDroneTask(geomData, caseid, code, name);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 获取需要查询的任务列表
///
///
[HttpGet]
[AllowAnonymous]
public async Task>> LoadDroneLandTask()
{
return await _land.DroneCloudLandTask();
}
///
/// 添加查询结果
///
///
///
[HttpPost]
public async Task> UpdateCloudLandQuery(CloudQueryReq req)
{
var response = new Response();
try
{
response = await _land.UpdateCloudLandQuery(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 根据云查询id获取查询结果
///
/// 结果id,消息推送的msg
///
[HttpGet]
public async Task> LoadCloudLandQueryById(string id)
{
return await _land.LoadCloudQueryById(id);
}
[HttpGet]
[AllowAnonymous]
public async Task> IsPublic()
{
return await _land.IsPublic();
}
}
}