123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Cors;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using XYY.Authentication.Standard;
- using XYY.Common.Standard;
- using XYY.Core.Standard.ExcelHelper.MSExcelHelper;
- using XYY.Core.Standard.Mvc;
- using XYY.Model.Standard.Order;
- using XYY.Service.Standard.Order;
- namespace XYY.Api.Order.Controllers
- {
- [EnableCors("httpsAllowSpecificOrigins")]
- [Route("api/[controller]/[action]")]
- [ApiController]
- public class OrderStatisticsController : ApiControllerBase
- {
- private readonly ICustomerOrderStatisticsService _customerOrderStatisticsService;
- public OrderStatisticsController(ICustomerOrderStatisticsService customerOrderStatisticsService)
- {
- this._customerOrderStatisticsService = customerOrderStatisticsService;
- }
- [AllowAnonymous]
- public async Task<IActionResult> GetdeliverySignCollectList(QueryModel queryModel)
- {
- var u = User.GetUserContent();
- var dto = await _customerOrderStatisticsService.GetDeliverySignCollectPager(queryModel, u.CustomerId);
- return Ok(dto);
- }
- [AllowAnonymous]
- public async Task<IActionResult> GetDeliverySignDetailList(QueryModel queryModel)
- {
- var u = User.GetUserContent();
- var dto = await _customerOrderStatisticsService.GetDeliverySignDetailPager(queryModel, u.CustomerId);
- return Ok(dto);
- }
- [AllowAnonymous]
- public async Task<IActionResult> OutData(QueryModel queryModel)
- {
- var u = User.GetUserContent();
- var list = await _customerOrderStatisticsService.GetDeliverySignDetailList(queryModel, u.CustomerId);
- var ms = new MSExcelHelper();
- byte[] data = null;
- if (await _customerOrderStatisticsService.IsShowOnlineTime(u.CustomerId))
- {
- data = ms.OutDataAsByte<OutDeliverySignDetailInfoOnlineTime, deliverySignDetail>(list.ToList());
- }
- else { data = ms.OutDataAsByte<OutDeliverySignDetailInfo, deliverySignDetail>(list.ToList()); }
- var utc = DateTime.Now.ToFileTimeUtc();
- return File($"{utc}.xlsx", data);
- }
- [AllowAnonymous]
- public async Task<bool> IsShowOnlineTime()
- {
- var u = User.GetUserContent();
- return await _customerOrderStatisticsService.IsShowOnlineTime(u.CustomerId);
- }
- }
- }
|