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.

101 lines
2.8 KiB
C#

using Common.DJYModel;
using Common.Utilities;
using djy.IService.Afr;
using djy.Model;
using djy.Model.Afr;
using djy.Model.AFRDto;
using djy.Model.IsfDto;
using djy_AfrApi.HttpContextUser;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Org.BouncyCastle.Crypto;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace djy_AfrApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
[Authorize]
public class AfrController : ApiBase
{
private readonly ILogger logger;
private readonly IUser user;
private readonly IAfrService _afrService;
//private readonly ILogger bigLogger;
public AfrController(ILogger<AfrController> logger,
IUser user,
IAfrService afrService)
{
this.logger = logger;
this.user = user;
this._afrService = afrService;
// 获取ILogger对象
//ILoggerFactory loggerFactory,
//bigLogger = loggerFactory.CreateLogger("BigDataLogger"); // 通过指定名称获取ILogger对象
}
#region 查询接口
[HttpGet("PageData")]
public async Task<ResponsePage<AFRMaster>> PageData(AFRMasterInputDto input)
{
UserAuthorityDto aut = GetUserAuthorityToFormDto("modIsfList");
input.CompanyId = aut.CompayId?.ToString();
input.UserId = aut.UserId?.ToString();
var pageData = await _afrService.Load(input);
return SuccessPage(pageData);
}
#endregion
#region 新增/编辑
[HttpPost("AddOrUpdate")]
public async Task<Response> AddOrUpdateAsync([FromBody] AFRMasterDto input)
{
await _afrService.SaveInfo(input);
return SuccessResp();
}
#endregion
#region 删除
[HttpPost("Del")]
public async Task<Response> Delete(string ids)
{
await _afrService.Delete(ids);
return SuccessResp();
}
#endregion
#region 第三方接口
[HttpGet("Send")]
public async Task<Response> Send(string ids, string msgType)
{
await _afrService.Send(ids, msgType);
return SuccessResp();
}
[AllowAnonymous]
[HttpPost("Receipt")]
public async Task<Response> SaveReceiptAsync(AFRReceiptDto input)
{
await _afrService.SaveReceipt(input);
return SuccessResp("接收成功");
}
#endregion
[AllowAnonymous]
[HttpGet("[action]")]
public Response GetTime()
{
return SuccessResp(DateTime.Now.ToString());
}
}
}