168 lines
4.9 KiB
C#
168 lines
4.9 KiB
C#
using Infrastructure;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using OpenAuth.Repository.Domain;
|
|
using OpenAuth.App.ServiceApp.TaxZongdiManage;
|
|
using OpenAuth.App.ServiceApp.TaxZongdiManage.Request;
|
|
|
|
namespace OpenAuth.WebApi.Controllers.ServiceController
|
|
{
|
|
/// <summary>
|
|
/// 用地信息
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class TaxZongdiController : ControllerBase
|
|
{
|
|
TaxZongdiApp _comApp;
|
|
public TaxZongdiController(
|
|
TaxZongdiApp comApp)
|
|
{
|
|
_comApp = comApp;
|
|
}
|
|
|
|
#region 获取分页数据列表
|
|
/// <summary>
|
|
/// 获取分页列表
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[AllowAnonymous]
|
|
public async Task<Response<PageInfo<List<dynamic>>>> LoadZongdiPageList([FromQuery] TaxZongdiReq req)
|
|
{
|
|
var result = new Response<PageInfo<List<dynamic>>>();
|
|
try
|
|
{
|
|
var data = await _comApp.LoadZongdiPageList(req);
|
|
result = data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据id获取单个用地信息
|
|
/// </summary>
|
|
/// <param name="gid">企业用地gid</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[AllowAnonymous]
|
|
public async Task<Response<TaxZongdi>> GetZongdiInfoById(int gid)
|
|
{
|
|
var result = new Response<TaxZongdi>();
|
|
try
|
|
{
|
|
var data = await _comApp.GetZongdiInfoById(gid);
|
|
result.Result = data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
#endregion
|
|
#region
|
|
/// <summary>
|
|
/// 添加用地信息
|
|
/// </summary>
|
|
/// <param name="req"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="Exception"></exception>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public async Task<Response<bool>> AddZongdi(TaxZongdi req)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
var data = await _comApp.AddZongdi(req);
|
|
result = data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑用地信息
|
|
/// </summary>
|
|
/// <param name="req"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="Exception"></exception>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public async Task<Response<bool>> UpdateZongdi(TaxZongdi req)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
var data = await _comApp.UpdateZongdi(req);
|
|
result = data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除用地信息
|
|
/// </summary>
|
|
/// <param name="ids">企业用地gid</param>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public async Task<Response<bool>> DeleteZongdi(int[] ids)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
var data = await _comApp.DeleteZongdi(ids);
|
|
result = data;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 企业用地数据导入
|
|
/// <summary>
|
|
/// 上传企业用地数据
|
|
/// </summary>
|
|
/// <param name="formFiles">文件</param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public Response<bool> ImportZongdiInfo(IFormFileCollection formFiles)
|
|
{
|
|
Response<bool> response = new Response<bool>();
|
|
try
|
|
{
|
|
response = _comApp.ImportZongdiInfo(formFiles);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
response.Code = 500;
|
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
return response;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|