|
|
|
using BBWY.Common.Models;
|
|
|
|
using BBWY.Server.Model.Db;
|
|
|
|
using BBWY.Server.Model.Dto;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
|
|
|
|
namespace BBWY.Server.Business
|
|
|
|
{
|
|
|
|
public class ServiceOrderBusiness : BaseBusiness, IDenpendency
|
|
|
|
{
|
|
|
|
public ServiceOrderBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator) : base(fsql, nLogManager, idGenerator)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public ServiceOrderResponse GetList(ClientQueryServiceOrderRequest request)
|
|
|
|
{
|
|
|
|
var list = fsql.Select<ServiceOrder, OrderSku>().InnerJoin((s, osku) => s.OrderId == osku.OrderId && s.SkuId == osku.SkuId)
|
|
|
|
.Where((s, osku) => s.ShopId == request.ShopId)
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Sku), (s, osku) => s.SkuId == request.Sku)
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), (s, osku) => s.ProductId == request.Spu)
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.OrderId), (s, osku) => s.OrderId == request.OrderId)
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.ServiceId), (s, osku) => s.ServiceId == request.ServiceId)
|
|
|
|
.WhereIf(request.ServiceOrderState != null, (s, osku) => s.Status == request.ServiceOrderState)
|
|
|
|
.WhereIf(request.ReturnDirection != null, (s, osku) => s.ReturnDirection == request.ReturnDirection)
|
|
|
|
.WhereIf(request.StartDate != null, (s, osku) => s.ApplyTime >= request.StartDate)
|
|
|
|
.WhereIf(request.EndDate != null, (s, osku) => s.ApplyTime <= request.EndDate)
|
|
|
|
.OrderByDescending((s, osku) => s.ApplyTime)
|
|
|
|
.Count(out var total)
|
|
|
|
.Page(request.PageIndex, request.PageSize)
|
|
|
|
.ToList((s, osku) => new ServiceOrderItemResponse
|
|
|
|
{
|
|
|
|
Id = s.Id,
|
|
|
|
ApplyTime = s.ApplyTime,
|
|
|
|
CreateTime = s.CreateTime,
|
|
|
|
ExpressName = s.ExpressName,
|
|
|
|
WayBillNo = s.WayBillNo,
|
|
|
|
ImageName = s.ImageName,
|
|
|
|
OrderId = s.OrderId,
|
|
|
|
SkuId = s.SkuId,
|
|
|
|
ProductId = s.ProductId,
|
|
|
|
ProductAppearance = s.ProductAppearance,
|
|
|
|
ProductFunction = s.ProductFunction,
|
|
|
|
ProductHealth = s.ProductHealth,
|
|
|
|
ProductPackage = s.ProductPackage,
|
|
|
|
ServiceResult = s.ServiceResult,
|
|
|
|
TransportDetails = s.TransportDetails,
|
|
|
|
WareHouseGrounpRemark = s.WareHouseGrounpRemark,
|
|
|
|
Status = s.Status,
|
|
|
|
ServiceId = s.ServiceId,
|
|
|
|
ShopId = s.ShopId,
|
|
|
|
|
|
|
|
Title = osku.Title,
|
|
|
|
ItemTotal = osku.ItemTotal.Value,
|
|
|
|
Logo = osku.Logo,
|
|
|
|
Price = osku.Price.Value,
|
|
|
|
SkuItemCount = osku.ItemTotal.Value,
|
|
|
|
ReturnDirection = s.ReturnDirection,
|
|
|
|
ServiceOrderRemark = s.ServiceOrderRemark,
|
|
|
|
StatusUpdateTime = s.StatusUpdateTime,
|
|
|
|
PurchaseOrderId = s.PurchaseOrderId,
|
|
|
|
PurchasePlatform = s.PurchasePlatform
|
|
|
|
});
|
|
|
|
return new ServiceOrderResponse()
|
|
|
|
{
|
|
|
|
Count = total,
|
|
|
|
Items = list
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|