You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.3 KiB
C#

11 months ago
using Common.DJYModel;
using Common.Utilities;
11 months ago
using djy.IService.Afr;
using djy.Model.Afr;
using djy.Model.AFRDto;
11 months ago
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
11 months ago
using System;
11 months ago
using System.Collections.Generic;
11 months ago
using System.Threading.Tasks;
namespace djy_AfrApi.Controllers
{
11 months ago
/// <summary>
/// AFR对接接口
/// </summary>
11 months ago
[Route("api/[controller]")]
[ApiController]
[Authorize]
11 months ago
public class AfrController : ApiBase
{
private readonly ILogger logger;
11 months ago
private readonly IAfrService _afrService;
11 months ago
11 months ago
//private readonly ILogger bigLogger;
public AfrController(ILogger<AfrController> logger,
IAfrService afrService)
11 months ago
{
this.logger = logger;
11 months ago
this._afrService = afrService;
11 months ago
// 获取ILogger对象
11 months ago
//ILoggerFactory loggerFactory,
//bigLogger = loggerFactory.CreateLogger("BigDataLogger"); // 通过指定名称获取ILogger对象
11 months ago
}
#region 查询接口
11 months ago
/// <summary>
/// 分页查询草稿箱或已发送列表的数据
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
11 months ago
[HttpGet("PageData")]
public async Task<ResponsePage<AFRMaster>> PageData(AFRMasterInputDto input)
11 months ago
{
11 months ago
UserAuthorityDto aut = GetUserAuthorityToFormDto("modIsfList");
11 months ago
11 months ago
input.CompanyId = aut.CompayId?.ToString();
input.UserId = aut.UserId?.ToString();
11 months ago
11 months ago
var pageData = await _afrService.Load(input);
return SuccessPage(pageData);
11 months ago
}
11 months ago
/// <summary>
/// 获取详情
/// </summary>
/// <param name="gid"></param>
/// <returns></returns>
11 months ago
[HttpGet("Detail")]
public async Task<Response<AFRMaster>> Detail(string gid)
11 months ago
{
var model = await _afrService.Get(gid);
return SuccessResp(model);
}
11 months ago
#endregion
#region 新增/编辑
11 months ago
/// <summary>
/// 新增或修改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
11 months ago
[HttpPost("AddOrUpdate")]
public async Task<Response> AddOrUpdateAsync([FromBody] AFRMasterDto input)
{
await _afrService.SaveInfo(input);
return SuccessResp();
}
11 months ago
#endregion
#region 删除
11 months ago
/// <summary>
/// 删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
11 months ago
[HttpPost("Del")]
public async Task<Response> Delete(string ids)
{
await _afrService.Delete(ids);
return SuccessResp();
}
11 months ago
#endregion
#region 第三方接口
11 months ago
/// <summary>
/// 发送接口
/// </summary>
11 months ago
/// <param name="ids">主键集合</param>
/// <param name="sendType">1:发送 2原始重发 3修改发送 4删除发送</param>
11 months ago
/// <returns></returns>
11 months ago
[HttpGet("Send")]
11 months ago
public async Task<Response> Send(string ids, int sendType)
11 months ago
{
11 months ago
string message = await _afrService.Send(ids, sendType);
return SuccessResp(message);
11 months ago
}
11 months ago
11 months ago
/// <summary>
/// 接收回执
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
11 months ago
[AllowAnonymous]
[HttpPost("Receipt")]
public async Task<Response> SaveReceiptAsync(AFRReceiptDto input)
{
await _afrService.SaveReceipt(input);
return SuccessResp("接收成功");
}
11 months ago
#endregion
11 months ago
/// <summary>
/// 获取历史记录
/// </summary>
/// <param name="id">主键</param>
/// <returns>历史记录列表</returns>
[HttpGet("GetHistory")]
public async Task<Response<List<AFRMasterHistory>>> GetHistory(string id)
{
var data = await _afrService.GetHistory(id);
return SuccessResp(data);
}
11 months ago
/// <summary>
/// 获取服务器当前时间
/// </summary>
/// <returns></returns>
11 months ago
[AllowAnonymous]
[HttpGet("[action]")]
public Response GetTime()
{
return SuccessResp(DateTime.Now.ToString());
}
11 months ago
}
}