lanlingxian_ziranziyuanhegu.../OpenAuth.WebApi/Controllers/ServiceControllers/DroneSsnyController.cs

300 lines
10 KiB
C#
Raw Normal View History

2025-05-22 09:38:37 +08:00
using Infrastructure;
using Infrastructure.Utilities.Excel;
2025-05-22 09:38:37 +08:00
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp.DroneSsnydManage;
using OpenAuth.App.ServiceApp.DroneSsnydManage.Request;
using OpenAuth.Repository.Domain;
namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
/// <summary>
/// 批后监管--项目信息
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class DroneSsnyController : ControllerBase
{
DroneSsnyApp droneSsnyApp;
public DroneSsnyController(DroneSsnyApp droneSsnyApp)
{
this.droneSsnyApp = droneSsnyApp;
}
/// <summary>
2025-05-20 17:20:40 +08:00
/// 到期预警
/// </summary>
2025-05-21 16:03:36 +08:00
/// <param name="xiangmumc">项目名称</param>
/// <param name="countyid">县</param>
/// <param name="streetid">镇</param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
2025-05-22 16:24:46 +08:00
[AllowAnonymous]
2025-05-22 14:38:11 +08:00
public Response<PageInfo<List<DroneSsnyd>>> TimeoutWarning(string xiangmumc, string countyid, string streetid,
int page, int limit)
{
var response = new Response<PageInfo<List<DroneSsnyd>>>();
try
{
2025-05-22 14:38:11 +08:00
response.Result = droneSsnyApp.TimeoutWarning(xiangmumc, countyid, streetid, page, limit);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
/// <summary>
/// 超期报警
/// </summary>
2025-05-21 16:03:36 +08:00
/// <param name="xiangmumc">项目名称</param>
/// <param name="countyid">县</param>
/// <param name="streetid">镇</param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
2025-05-22 16:24:46 +08:00
[AllowAnonymous]
2025-05-22 14:38:11 +08:00
public Response<PageInfo<List<DroneSsnyd>>> TimeOutAlarmList(string xiangmumc, string countyid, string streetid,
int page, int limit)
{
var response = new Response<PageInfo<List<DroneSsnyd>>>();
try
{
2025-05-21 16:03:36 +08:00
response.Result = droneSsnyApp.TimeOutAlarmList(xiangmumc, countyid, streetid, page, limit);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
2025-05-22 14:38:11 +08:00
/// <summary>
/// 历史项目
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpGet]
2025-05-22 16:10:42 +08:00
public Response<PageInfo<List<DroneSsnyd>>> HistoryProject([FromQuery] DroneSsnyAppPageReq req)
{
var response = new Response<PageInfo<List<DroneSsnyd>>>();
try
{
response.Result = droneSsnyApp.HistoryProject(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
/// <summary>
/// 项目变更列表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpGet]
2025-05-22 16:10:42 +08:00
public Response<PageInfo<List<DroneSsnyd>>> ProjectChange([FromQuery] DroneSsnyAppPageReq req)
{
var response = new Response<PageInfo<List<DroneSsnyd>>>();
try
{
response.Result = droneSsnyApp.ProjectChange(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
2025-05-22 16:10:42 +08:00
// todo 编号维护 名称维护 项目续期 项目详情 停止生产 项目称交
/// <summary>
/// 编号维护
/// </summary>
/// <param name="id"></param>
/// <param name="newXiangmuNo"></param>
/// <returns></returns>
[HttpPost]
2025-05-22 16:24:46 +08:00
2025-05-22 16:10:42 +08:00
public async Task<Response<bool>> MaintainNumber(string id, string newXiangmuNo)
{
var response = new Response<bool>();
try
{
await droneSsnyApp.MaintainNumber(id, newXiangmuNo);
response.Result = true;
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
/// <summary>
/// 历史项目导出
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpGet]
public IActionResult HistoryProjectExport([FromQuery] DroneSnnyAppReq req)
{
var data = droneSsnyApp.HistoryProjectList(req);
var x = ExcelExporter.ExportToExcel(data, "历史项目");
return File(x.Result.ToArray(),
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"历史项目导出" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx");
}
2025-05-22 14:38:11 +08:00
/// <summary>
/// 项目变更导出
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpGet]
public IActionResult ProjectChangeExport([FromQuery] DroneSnnyAppReq req)
{
var data = droneSsnyApp.ProjectChangeExport(req);
var x = ExcelExporter.ExportToExcel(data, "项目变更");
return File(x.Result.ToArray(),
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"项目变更导出" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx");
}
2025-05-22 09:38:37 +08:00
#region 预警报警导出
2025-05-22 14:38:11 +08:00
2025-05-22 09:38:37 +08:00
/// <summary>
/// 超期预警数据导出
/// </summary>
/// <param name="import"></param>
/// <returns></returns>
[HttpPost]
2025-05-22 16:24:46 +08:00
[AllowAnonymous]
2025-05-22 09:38:37 +08:00
public IActionResult TimeoutWarningExport([FromQuery] TimeOutReq import)
{
var data = new Response();
List<string> headers = null;
2025-05-22 14:38:11 +08:00
headers = new List<string>
{
"项目编号", "项目名称", "乡镇", "村庄", "权利人", "行政区划", "备案编号", "项目开始时间", "项目结束时间", "项目当前用途", "设施农业申请用地面积", "生产设施用地",
"辅助设施用地", "下发时间", "项目状态"
};
2025-05-22 09:38:37 +08:00
var response = droneSsnyApp.TimeoutWarningExport(import.xiangmumc, import.countyid, import.streetid);
if (response.Count > 0)
{
var excelRes = droneSsnyApp.ListToExcel(response, headers);
if (excelRes.Code == 200)
{
return File(excelRes.Result.ToArray(),
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"超期预警" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
}
else
{
data.Code = excelRes.Code;
data.Message = "导出失败";
}
}
else
{
data.Code = 300;
data.Message = "暂无数据";
}
2025-05-22 14:38:11 +08:00
2025-05-22 09:38:37 +08:00
return Ok(data);
}
/// <summary>
/// 超期报警数据导出
/// </summary>
/// <param name="import"></param>
/// <returns></returns>
[HttpPost]
2025-05-22 16:24:46 +08:00
[AllowAnonymous]
2025-05-22 09:38:37 +08:00
public IActionResult TimeoutAlarmExport([FromQuery] TimeOutReq import)
{
var data = new Response();
List<string> headers = null;
2025-05-22 14:38:11 +08:00
headers = new List<string>
{
"项目编号", "项目名称", "乡镇", "村庄", "权利人", "行政区划", "备案编号", "项目开始时间", "项目结束时间", "项目当前用途", "设施农业申请用地面积", "生产设施用地",
"辅助设施用地", "下发时间", "项目状态"
};
2025-05-22 09:38:37 +08:00
var response = droneSsnyApp.TimeOutAlarmExport(import.xiangmumc, import.countyid, import.streetid);
if (response.Count > 0)
{
var excelRes = droneSsnyApp.ListToExcel(response, headers);
if (excelRes.Code == 200)
{
return File(excelRes.Result.ToArray(),
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"超期报警" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
}
else
{
data.Code = excelRes.Code;
data.Message = "导出失败";
}
}
else
{
data.Code = 300;
data.Message = "暂无数据";
}
2025-05-22 14:38:11 +08:00
2025-05-22 09:38:37 +08:00
return Ok(data);
}
#endregion
2025-05-22 10:53:15 +08:00
#region 项目列表
2025-05-22 14:38:11 +08:00
2025-05-22 10:53:15 +08:00
/// <summary>
/// 项目列表
/// </summary>
/// <param name="xiangmumc">项目名称</param>
/// <param name="countyid">县</param>
/// <param name="streetid">镇</param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
2025-05-22 14:38:11 +08:00
public Response<PageInfo<List<DroneSsnyd>>> GetDronssnydList(string xiangmumc, string countyid, string streetid,
int page, int limit)
2025-05-22 10:53:15 +08:00
{
var response = new Response<PageInfo<List<DroneSsnyd>>>();
try
{
response.Result = droneSsnyApp.GetDronssnydList(xiangmumc, countyid, streetid, page, limit);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
2025-05-22 14:38:11 +08:00
2025-05-22 10:53:15 +08:00
#endregion
}
}