190 lines
4.7 KiB
C#
190 lines
4.7 KiB
C#
using DocumentFormat.OpenXml.EMMA;
|
|
using Infrastructure;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using OpenAuth.App;
|
|
using OpenAuth.App.Request;
|
|
using OpenAuth.App.Response;
|
|
using OpenAuth.App.ServiceApp.MiManager.Request;
|
|
using OpenAuth.App.ServiceApp.Request;
|
|
using OpenAuth.App.ServiceApp.Response;
|
|
using OpenAuth.Repository.Domain;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace OpenAuth.WebApi.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 违法上报
|
|
/// </summary>
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class MiViolationReportController : ControllerBase
|
|
{
|
|
private readonly MiViolationReportApp _app;
|
|
public MiViolationReportController(MiViolationReportApp app)
|
|
{
|
|
_app = app;
|
|
}
|
|
|
|
#region 查询
|
|
|
|
#region 分页
|
|
/// <summary>
|
|
/// 分页
|
|
/// </summary>
|
|
[HttpGet]
|
|
public async Task<Response<PageInfo<List<dynamic>>>> LoadAllPage([FromQuery] MiviolationReq request)
|
|
{
|
|
return await _app.LoadAllPage(request);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 实体
|
|
/// <summary>
|
|
/// 上报详情
|
|
/// </summary>
|
|
[HttpGet]
|
|
public async Task<Response<dynamic>> Get(string id)
|
|
{
|
|
var result = new Response<dynamic>();
|
|
try
|
|
{
|
|
result.Result = await _app.Get(id);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region 增删改
|
|
|
|
#region 添加
|
|
/// <summary>
|
|
/// 添加
|
|
/// </summary>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> Add(MiViolationReport model)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.Add(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 修改
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> Update(MiViolationReport model)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.Update(model);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> Delete([FromBody] List<string> models)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.Delete(models);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 上报
|
|
/// <summary>
|
|
/// 上报
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> Report(MiViolationReportRequest request)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.Report(request);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region
|
|
/// <summary>
|
|
/// 处理
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<Response<bool>> ReportHandle(HandleInfo info)
|
|
{
|
|
var result = new Response<bool>();
|
|
try
|
|
{
|
|
result = await _app.ReportHandle(info);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = 500;
|
|
result.Message = ex.InnerException?.Message ?? ex.Message;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
} |