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 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> 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 AddOrUpdateAsync([FromBody] AFRMasterDto input) { await _afrService.SaveInfo(input); return SuccessResp(); } #endregion #region 删除 [HttpPost("Del")] public async Task Delete(string ids) { await _afrService.Delete(ids); return SuccessResp(); } #endregion #region 第三方接口 [HttpGet("Send")] public async Task Send(string ids, string msgType) { await _afrService.Send(ids, msgType); return SuccessResp(); } [AllowAnonymous] [HttpPost("Receipt")] public async Task SaveReceiptAsync(AFRReceiptDto input) { await _afrService.SaveReceipt(input); return SuccessResp("接收成功"); } #endregion [AllowAnonymous] [HttpGet("[action]")] public Response GetTime() { return SuccessResp(DateTime.Now.ToString()); } } }