156 lines
6.3 KiB
C#
156 lines
6.3 KiB
C#
using Infrastructure.Attribute;
|
|
using Microsoft.AspNetCore.Http;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ARW.Model;
|
|
using ARW.Repository;
|
|
using ARW.Repository.Business.OrderManage.Orders;
|
|
using ARW.Service.Api.IBusinessService.OrderManage.Orders;
|
|
using ARW.Model.Dto.Api.OrderManage.Orders;
|
|
using ARW.Model.Models.Business.OrderManage.Orders;
|
|
using ARW.Model.Vo.Api.OrderManage.Orders;
|
|
|
|
namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
|
{
|
|
/// <summary>
|
|
/// 订单接口实现类Api
|
|
///
|
|
/// @author lwh
|
|
/// @date 2023-09-01
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IOrderServiceApi), ServiceLifetime = LifeTime.Transient)]
|
|
public class OrderServiceImplApi : BaseService<Order>, IOrderServiceApi
|
|
{
|
|
private readonly OrderRepository _OrderRepository;
|
|
|
|
public OrderServiceImplApi(OrderRepository OrderRepository)
|
|
{
|
|
this._OrderRepository = OrderRepository;
|
|
}
|
|
|
|
#region Api接口代码
|
|
|
|
|
|
/// <summary>
|
|
/// 查询订单列表(Api)
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public async Task<PagedInfo<OrderVoApi>> GetOrderListApi(OrderQueryDtoApi parm)
|
|
{
|
|
//开始拼装查询条件d
|
|
var predicate = Expressionable.Create<Order>();
|
|
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.OrderNumber), s => s.OrderNumber.Contains(parm.OrderNumber));
|
|
predicate = predicate.AndIF(parm.PayType != null, s => s.PayType == parm.PayType);
|
|
predicate = predicate.AndIF(parm.PayStatus != null, s => s.PayStatus == parm.PayStatus);
|
|
predicate = predicate.AndIF(parm.DeliveryType != null, s => s.DeliveryType == parm.DeliveryType);
|
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.LogisticsTrackingNumber), s => s.LogisticsTrackingNumber.Contains(parm.LogisticsTrackingNumber));
|
|
predicate = predicate.AndIF(parm.DeliveryStatus != null, s => s.DeliveryStatus == parm.DeliveryStatus);
|
|
predicate = predicate.AndIF(parm.ReceiptStatus != null, s => s.ReceiptStatus == parm.ReceiptStatus);
|
|
predicate = predicate.AndIF(parm.OrderStatus != null, s => s.OrderStatus == parm.OrderStatus);
|
|
var query = _OrderRepository
|
|
.Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
|
.Select(s => new OrderVoApi
|
|
{
|
|
OrderId = s.OrderId,
|
|
OrderGuid = s.OrderGuid,
|
|
PaymentGuid = s.PaymentGuid,
|
|
CustomerGuid = s.CustomerGuid,
|
|
OrderNumber = s.OrderNumber,
|
|
GoodsTotalAmoun = s.GoodsTotalAmoun,
|
|
OrderAmount = s.OrderAmount,
|
|
CouponGuid = s.CouponGuid,
|
|
CouponMoney = s.CouponMoney,
|
|
PointsMoney = s.PointsMoney,
|
|
PointsNum = s.PointsNum,
|
|
PayPrice = s.PayPrice,
|
|
UpdatePrice = s.UpdatePrice,
|
|
OrderRemark = s.OrderRemark,
|
|
PayType = s.PayType,
|
|
PayStatus = s.PayStatus,
|
|
PayTime = s.PayTime,
|
|
DeliveryType = s.DeliveryType,
|
|
ExpressPrice = s.ExpressPrice,
|
|
LogisticsCompanyGuid = s.LogisticsCompanyGuid,
|
|
LogisticsCompany = s.LogisticsCompany,
|
|
LogisticsTrackingNumber = s.LogisticsTrackingNumber,
|
|
DeliveryStatus = s.DeliveryStatus,
|
|
DeliveryTime = s.DeliveryTime,
|
|
ReceiptStatus = s.ReceiptStatus,
|
|
ReceiptTime = s.ReceiptTime,
|
|
OrderStatus = s.OrderStatus,
|
|
PointsBonus = s.PointsBonus,
|
|
IsSettled = s.IsSettled,
|
|
TransactionId = s.TransactionId,
|
|
IsComment = s.IsComment,
|
|
OrderSource = s.OrderSource,
|
|
});
|
|
|
|
|
|
return await query.ToPageAsync(parm);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询订单详情(Api)
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public async Task<string> GetOrderDetails(OrderDtoApi parm)
|
|
{
|
|
|
|
var query = _OrderRepository
|
|
.Queryable()
|
|
.Where(s => s.OrderGuid == parm.OrderGuid)
|
|
.Select(s => new OrderApiDetailsVo
|
|
{
|
|
OrderId = s.OrderId,
|
|
OrderGuid = s.OrderGuid,
|
|
PaymentGuid = s.PaymentGuid,
|
|
CustomerGuid = s.CustomerGuid,
|
|
OrderNumber = s.OrderNumber,
|
|
GoodsTotalAmoun = s.GoodsTotalAmoun,
|
|
OrderAmount = s.OrderAmount,
|
|
CouponGuid = s.CouponGuid,
|
|
CouponMoney = s.CouponMoney,
|
|
PointsMoney = s.PointsMoney,
|
|
PointsNum = s.PointsNum,
|
|
PayPrice = s.PayPrice,
|
|
UpdatePrice = s.UpdatePrice,
|
|
OrderRemark = s.OrderRemark,
|
|
PayType = s.PayType,
|
|
PayStatus = s.PayStatus,
|
|
PayTime = s.PayTime,
|
|
DeliveryType = s.DeliveryType,
|
|
ExpressPrice = s.ExpressPrice,
|
|
LogisticsCompanyGuid = s.LogisticsCompanyGuid,
|
|
LogisticsCompany = s.LogisticsCompany,
|
|
LogisticsTrackingNumber = s.LogisticsTrackingNumber,
|
|
DeliveryStatus = s.DeliveryStatus,
|
|
DeliveryTime = s.DeliveryTime,
|
|
ReceiptStatus = s.ReceiptStatus,
|
|
ReceiptTime = s.ReceiptTime,
|
|
OrderStatus = s.OrderStatus,
|
|
PointsBonus = s.PointsBonus,
|
|
IsSettled = s.IsSettled,
|
|
TransactionId = s.TransactionId,
|
|
IsComment = s.IsComment,
|
|
OrderSource = s.OrderSource,
|
|
}).Take(1);
|
|
|
|
|
|
return await query.ToJsonAsync();
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|