添加项目文件。

This commit is contained in:
JianWeie
2021-12-20 21:27:32 +08:00
parent 747486f5cb
commit 82d825b7a5
3514 changed files with 887941 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 商品图片关联表 接口实现
/// </summary>
public class CoreCmsBillAftersalesImagesRepository : BaseRepository<CoreCmsBillAftersalesImages>,
ICoreCmsBillAftersalesImagesRepository
{
public CoreCmsBillAftersalesImagesRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
}
}

View File

@@ -0,0 +1,27 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 售后单明细表 接口实现
/// </summary>
public class CoreCmsBillAftersalesItemRepository : BaseRepository<CoreCmsBillAftersalesItem>,
ICoreCmsBillAftersalesItemRepository
{
public CoreCmsBillAftersalesItemRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
}
}

View File

@@ -0,0 +1,122 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Utility.Helper;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 退货单表 接口实现
/// </summary>
public class CoreCmsBillAftersalesRepository : BaseRepository<CoreCmsBillAftersales>, ICoreCmsBillAftersalesRepository
{
public CoreCmsBillAftersalesRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
#region
/// <summary>
/// 根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <returns></returns>
public async Task<IPageList<CoreCmsBillAftersales>> QueryPageAsync(Expression<Func<CoreCmsBillAftersales, bool>> predicate,
Expression<Func<CoreCmsBillAftersales, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20)
{
RefAsync<int> totalCount = 0;
var page = await DbClient.Queryable<CoreCmsBillAftersales, CoreCmsUser>((p, sc) => new JoinQueryInfos(
JoinType.Left, p.userId == sc.id))
.Select((p, sc) => new CoreCmsBillAftersales
{
aftersalesId = p.aftersalesId,
orderId = p.orderId,
userId = p.userId,
type = p.type,
refundAmount = p.refundAmount,
status = p.status,
reason = p.reason,
mark = p.mark,
createTime = p.createTime,
updateTime = p.updateTime,
userNickName = sc.nickName
})
.MergeTable()
.Mapper(p => p.items, p => p.items.First().aftersalesId)
.Mapper(p => p.images, p => p.images.First().aftersalesId)
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate)
.ToPageListAsync(pageIndex, pageSize, totalCount);
if (page.Any())
{
var billAftersalesStatus = EnumHelper.EnumToList<GlobalEnumVars.BillAftersalesStatus>();
foreach (var item in page)
{
var statusModel = billAftersalesStatus.Find(p => p.value == item.status);
if (statusModel != null) item.statusName = statusModel.description;
}
}
var list = new PageList<CoreCmsBillAftersales>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
#region
/// <summary>
/// 获取单个数据
/// </summary>
/// <param name="aftersalesId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public async Task<CoreCmsBillAftersales> GetInfo(string aftersalesId, int userId = 0)
{
var model = userId > 0
? await DbClient.Queryable<CoreCmsBillAftersales>()
.Where(p => p.aftersalesId == aftersalesId && p.userId == userId).FirstAsync()
: await DbClient.Queryable<CoreCmsBillAftersales>()
.Where(p => p.aftersalesId == aftersalesId).FirstAsync();
if (model != null)
{
model.order = await DbClient.Queryable<CoreCmsOrder>().Where(p => p.orderId == model.orderId).FirstAsync();
model.images = await DbClient.Queryable<CoreCmsBillAftersalesImages>().Where(p => p.aftersalesId == aftersalesId).OrderBy(p => p.sortId).ToListAsync();
model.items = await DbClient.Queryable<CoreCmsBillAftersalesItem>().Where(p => p.aftersalesId == aftersalesId).OrderBy(p => p.createTime).ToListAsync();
model.billRefund = await DbClient.Queryable<CoreCmsBillRefund>().Where(p => p.aftersalesId == aftersalesId).FirstAsync();
model.billReship = await DbClient.Queryable<CoreCmsBillReship>().Where(p => p.aftersalesId == aftersalesId).FirstAsync();
}
return model;
}
#endregion
}
}

View File

@@ -0,0 +1,27 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 发货单详情表 接口实现
/// </summary>
public class CoreCmsBillDeliveryItemRepository : BaseRepository<CoreCmsBillDeliveryItem>,
ICoreCmsBillDeliveryItemRepository
{
public CoreCmsBillDeliveryItemRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
}
}

View File

@@ -0,0 +1,62 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Utility.Helper;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 发货单表 接口实现
/// </summary>
public class CoreCmsBillDeliveryRepository : BaseRepository<CoreCmsBillDelivery>, ICoreCmsBillDeliveryRepository
{
public CoreCmsBillDeliveryRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
/// <summary>
/// 发货单统计7天统计
/// </summary>
/// <returns></returns>
public async Task<List<StatisticsOut>> Statistics()
{
var dt = DateTime.Now.AddDays(-8);
var list = await DbClient.Queryable<CoreCmsBillDelivery>()
.Where(p => p.createTime >= dt)
.Select(it => new
{
it.deliveryId,
createTime = it.createTime.Date
})
.MergeTable()
.GroupBy(it => it.createTime)
.Select(it => new StatisticsOut { day = it.createTime.ToString("yyyy-MM-dd"), nums = SqlFunc.AggregateCount(it.deliveryId) })
.ToListAsync();
return list;
}
}
}

View File

@@ -0,0 +1,78 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 提货单表 接口实现
/// </summary>
public class CoreCmsBillLadingRepository : BaseRepository<CoreCmsBillLading>, ICoreCmsBillLadingRepository
{
public CoreCmsBillLadingRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
/// <summary>
/// 添加提货单
/// </summary>
/// <returns></returns>
public async Task<WebApiCallBack> AddData(string orderId, int storeId, string name, string mobile)
{
var jm = new WebApiCallBack();
var model = new CoreCmsBillLading();
model.id = GenerateId();
model.orderId = orderId;
model.storeId = storeId;
model.name = name;
model.mobile = mobile;
model.clerkId = 0;
model.status = false;
model.createTime = DateTime.Now;
model.isDel = false;
//事物处理过程结束
await DbClient.Insertable(model).ExecuteCommandAsync();
jm.code = 0;
jm.msg = "添加成功";
return jm;
}
/// <summary>
/// 生成唯一提货单号
/// </summary>
/// <returns></returns>
private string GenerateId()
{
bool bl;
string id;
do
{
id = CommonHelper.GetSerialNumberType((int) GlobalEnumVars.SerialNumberType.);
var id1 = id;
bl = DbClient.Queryable<CoreCmsBillLading>().Any(p => p.id == id1);
} while (bl);
return id;
}
}
}

View File

@@ -0,0 +1,133 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 支付单表 接口实现
/// </summary>
public class CoreCmsBillPaymentsRepository : BaseRepository<CoreCmsBillPayments>, ICoreCmsBillPaymentsRepository
{
public CoreCmsBillPaymentsRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
/// <summary>
/// 支付单7天统计
/// </summary>
/// <returns></returns>
public async Task<List<StatisticsOut>> Statistics()
{
var dt = DateTime.Now.AddDays(-8);
var list = await DbClient.Queryable<CoreCmsBillPayments>()
.Where(p => p.createTime >= dt && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed && p.type == (int)GlobalEnumVars.BillPaymentsType.Order)
.Select(it => new
{
it.paymentId,
createTime = it.createTime.Date
})
.MergeTable()
.GroupBy(it => it.createTime)
.Select(it => new StatisticsOut { day = it.createTime.ToString("yyyy-MM-dd"), nums = SqlFunc.AggregateCount(it.paymentId) })
.ToListAsync();
return list;
}
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
public new async Task<IPageList<CoreCmsBillPayments>> QueryPageAsync(Expression<Func<CoreCmsBillPayments, bool>> predicate,
Expression<Func<CoreCmsBillPayments, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<CoreCmsBillPayments> page;
if (blUseNoLock)
page = await DbClient.Queryable<CoreCmsBillPayments, CoreCmsUser>((p, sc) => new JoinQueryInfos(
JoinType.Left, p.userId == sc.id))
.Select((p, sc) => new CoreCmsBillPayments
{
paymentId = p.paymentId,
money = p.money,
userId = p.userId,
type = p.type,
status = p.status,
paymentCode = p.paymentCode,
ip = p.ip,
parameters = p.parameters,
payedMsg = p.payedMsg,
tradeNo = p.tradeNo,
createTime = p.createTime,
updateTime = p.updateTime,
userNickName = sc.nickName
})
.MergeTable()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate)
.With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
else
page = await DbClient.Queryable<CoreCmsBillPayments, CoreCmsUser>((p, sc) => new JoinQueryInfos(
JoinType.Left, p.userId == sc.id))
.Select((p, sc) => new CoreCmsBillPayments
{
paymentId = p.paymentId,
money = p.money,
userId = p.userId,
type = p.type,
status = p.status,
paymentCode = p.paymentCode,
ip = p.ip,
parameters = p.parameters,
payedMsg = p.payedMsg,
tradeNo = p.tradeNo,
createTime = p.createTime,
updateTime = p.updateTime,
userNickName = sc.nickName
})
.MergeTable()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate)
.ToPageListAsync(pageIndex, pageSize, totalCount);
var list = new PageList<CoreCmsBillPayments>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -0,0 +1,107 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 退款单表 接口实现
/// </summary>
public class CoreCmsBillRefundRepository : BaseRepository<CoreCmsBillRefund>, ICoreCmsBillRefundRepository
{
public CoreCmsBillRefundRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
public new async Task<IPageList<CoreCmsBillRefund>> QueryPageAsync(Expression<Func<CoreCmsBillRefund, bool>> predicate,
Expression<Func<CoreCmsBillRefund, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<CoreCmsBillRefund> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<CoreCmsBillRefund, CoreCmsUser>((p, sc) => new JoinQueryInfos(
JoinType.Left, p.userId == sc.id))
.Select((p, sc) => new CoreCmsBillRefund
{
refundId = p.refundId,
aftersalesId = p.aftersalesId,
money = p.money,
userId = p.userId,
sourceId = p.sourceId,
type = p.type,
paymentCode = p.paymentCode,
tradeNo = p.tradeNo,
status = p.status,
memo = p.memo,
createTime = p.createTime,
updateTime = p.updateTime,
userNickName = sc.nickName
})
.MergeTable()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate)
.With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<CoreCmsBillRefund, CoreCmsUser>((p, sc) => new JoinQueryInfos(
JoinType.Left, p.userId == sc.id))
.Select((p, sc) => new CoreCmsBillRefund
{
refundId = p.refundId,
aftersalesId = p.aftersalesId,
money = p.money,
userId = p.userId,
sourceId = p.sourceId,
type = p.type,
paymentCode = p.paymentCode,
tradeNo = p.tradeNo,
status = p.status,
memo = p.memo ?? "",
createTime = p.createTime,
updateTime = p.updateTime,
userNickName = sc.nickName
})
.MergeTable()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate)
.ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<CoreCmsBillRefund>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -0,0 +1,28 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 退货单明细表 接口实现
/// </summary>
public class CoreCmsBillReshipItemRepository : BaseRepository<CoreCmsBillReshipItem>, ICoreCmsBillReshipItemRepository
{
public CoreCmsBillReshipItemRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
}
}

View File

@@ -0,0 +1,113 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using SqlSugar;
namespace CoreCms.Net.Repository
{
/// <summary>
/// 退货单表 接口实现
/// </summary>
public class CoreCmsBillReshipRepository : BaseRepository<CoreCmsBillReship>, ICoreCmsBillReshipRepository
{
public CoreCmsBillReshipRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
/// <summary>
/// 获取单个数据带导航
/// </summary>
/// <param name="predicate"></param>
/// <param name="orderByExpression"></param>
/// <param name="orderByType"></param>
/// <returns></returns>
public async Task<CoreCmsBillReship> GetDetails(Expression<Func<CoreCmsBillReship, bool>> predicate,
Expression<Func<CoreCmsBillReship, object>> orderByExpression, OrderByType orderByType)
{
var model = await DbClient.Queryable<CoreCmsBillReship, CoreCmsUser>((p, sc) => new JoinQueryInfos(
JoinType.Left, p.userId == sc.id))
.Select((p, sc) => new CoreCmsBillReship
{
reshipId = p.reshipId,
orderId = p.orderId,
aftersalesId = p.aftersalesId,
userId = p.userId,
logiCode = p.logiCode,
logiNo = p.logiNo,
status = p.status,
memo = p.memo,
createTime = p.createTime,
updateTime = p.updateTime,
userNickName = sc.nickName
})
.MergeTable()
.Mapper(p => p.items, p => p.reshipId)
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate)
.FirstAsync();
return model;
}
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <returns></returns>
public async Task<IPageList<CoreCmsBillReship>> QueryPageAsync(Expression<Func<CoreCmsBillReship, bool>> predicate,
Expression<Func<CoreCmsBillReship, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20)
{
RefAsync<int> totalCount = 0;
List<CoreCmsBillReship> page = await DbClient.Queryable<CoreCmsBillReship, CoreCmsUser>((p, sc) => new JoinQueryInfos(
JoinType.Left, p.userId == sc.id))
.Select((p, sc) => new CoreCmsBillReship
{
reshipId = p.reshipId,
orderId = p.orderId,
aftersalesId = p.aftersalesId,
userId = p.userId,
logiCode = p.logiCode,
logiNo = p.logiNo,
status = p.status,
memo = p.memo,
createTime = p.createTime,
updateTime = p.updateTime,
userNickName = sc.nickName
})
.MergeTable()
.Mapper(p => p.items, p => p.reshipId)
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate)
.ToPageListAsync(pageIndex, pageSize, totalCount);
var list = new PageList<CoreCmsBillReship>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}