Commit 804f6fae authored by 吴春's avatar 吴春

提交代码

parent ee0b7bb6
......@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Extend.BaseSetUp;
namespace Mall.Model.Extend.Product
{
......@@ -189,7 +190,7 @@ namespace Mall.Model.Extend.Product
/// <summary>
/// 商品分类包邮规则
/// </summary>
public List<RB_FreeShipping> FreeShippingList { get; set; }
public RB_FreeShipping_Extend FreeShippingModel { get; set; }
}
}
......@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.BaseSetUp;
namespace Mall.Model.Extend.Product
{
......@@ -66,5 +67,15 @@ namespace Mall.Model.Extend.Product
/// 库存数量
/// </summary>
public int? InventoryNum { get; set; }
/// <summary>
/// 供应商ids 2020-08-04 Add By:W
/// </summary>
public string SupplierIds { get; set; }
/// <summary>
/// 商品分类包邮规则
/// </summary>
public RB_FreeShipping_Extend FreeShippingModel { get; set; }
}
}
......@@ -1002,6 +1002,20 @@ namespace Mall.Module.BaseSetUp
return model;
}
/// <summary>
/// 物流规则列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_FreeShipping_Extend> GetFreeShippingListByCategoryIds(RB_FreeShipping_Extend query)
{
return freeShippingRepository.GetFreeShippingListByCategoryIds(query);
}
/// <summary>
/// 新增/修改分类包邮基础信息
/// </summary>
......
......@@ -9,6 +9,7 @@ using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User;
using Mall.Common.Plugin;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.BaseSetUp;
using Mall.Model.Extend.Product;
using Mall.Model.Extend.User;
using Mall.Module.User;
......@@ -227,7 +228,7 @@ namespace Mall.Module.Product
/// 推荐供应商返佣比例
/// </summary>
private readonly RB_SupplierCommissionRepository supplierCommissionRepository = new RB_SupplierCommissionRepository();
private RB_FreeShippingRepository freeShippingRepository = new RB_FreeShippingRepository();
#region 购物车
......@@ -255,6 +256,11 @@ namespace Mall.Module.Product
var speciVList = goods_SpecificationValueRepository.GetList(new RB_Goods_SpecificationValue_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var speciPList = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var mpriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var categoryList = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
string categoryIds = string.Join(",", categoryList.Select(x => x.CategoryId).Distinct());
var freeShippingList = freeShippingRepository.GetFreeShippingListByCategoryIds(new RB_FreeShipping_Extend { MallBaseId = demodel.MallBaseId, TenantId = demodel.TenantId, CategoryIds = categoryIds });
foreach (var item in list)
{
item.CoverImage = "";
......@@ -322,6 +328,20 @@ namespace Mall.Module.Product
}
}
}
if (freeShippingList != null && freeShippingList.Any())
{
var nowcategory = categoryList.Where(x => x.GoodsId == item.GoodsId).Select(x=>x.CategoryId);
var fullNumPinkageModel = freeShippingList.Where(x =>nowcategory.Contains(x.CategoryId)&& x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
}
item.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
}
}
}
return list;
......@@ -3292,7 +3312,8 @@ namespace Mall.Module.Product
var DetailList = demodel.DetailList.Where(x => x.CommissionPrice > 0).ToList();
foreach (var item in DetailList)
{
if ((item.PresentFXGrade ?? 0) > 0) {
if ((item.PresentFXGrade ?? 0) > 0)
{
//是赠送VIP等级的 暂直接表示 反购买VIP佣金 2020-08-03 ld
continue;
}
......@@ -3480,7 +3501,8 @@ namespace Mall.Module.Product
UserId = n1umodel.Id;
break;
}
else {
else
{
UserId = 0;
numodel = n1umodel;//继续查找下一级
}
......@@ -3740,31 +3762,36 @@ namespace Mall.Module.Product
if (OneUserId > 0)
{
var dis1Model = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, UserId = OneUserId, AuditStatus = DistributorAuditStatusEnum.Audited })?.FirstOrDefault();
if (dis1Model != null) {
if (dis1Model != null)
{
OneDistributorGrade = dis1Model?.GradeId ?? 0;
}
else {
else
{
OneDistributorGrade = -1;//不是分销商
}
}
if (TwoUserId > 0 && OneDistributorGrade >=0)
if (TwoUserId > 0 && OneDistributorGrade >= 0)
{
var dis2Model = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, UserId = TwoUserId, AuditStatus = DistributorAuditStatusEnum.Audited })?.FirstOrDefault();
if (dis2Model != null) {
if (dis2Model != null)
{
TwoDistributorGrade = dis2Model?.GradeId ?? 0;
}
else {
else
{
TwoDistributorGrade = -1;
}
}
if (ThreeUserId > 0 && TwoDistributorGrade >=0)
if (ThreeUserId > 0 && TwoDistributorGrade >= 0)
{
var dis3Model = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, UserId = ThreeUserId, AuditStatus = DistributorAuditStatusEnum.Audited })?.FirstOrDefault();
if (dis3Model != null)
{
ThreeDistributorGrade = dis3Model?.GradeId ?? 0;
}
else {
else
{
ThreeDistributorGrade = -1;
}
}
......@@ -4065,25 +4092,29 @@ namespace Mall.Module.Product
}
#region 推荐返佣
if (demodel.DetailList.Where(x => x.SupplierId > 0).Any()) {
if (demodel.DetailList.Where(x => x.SupplierId > 0).Any())
{
string supplierIds = string.Join(",", demodel.DetailList.Where(x => x.SupplierId > 0).Select(x => x.SupplierId));
var supplist = supplierRepository.GetList(new RB_Supplier_Extend() { SupplierIds = supplierIds }).Where(x => x.Introducer > 0).ToList();
if (supplist.Any()) {
if (supplist.Any())
{
//有 就需要反推荐佣金
//查出返佣的比例
var scList = supplierCommissionRepository.GetListBySupplierIds(string.Join(",", supplist.Select(x => x.ID)));
//查出所有的订单
var detailList = demodel.DetailList.Where(x => supplist.Select(x => x.ID).Contains(x.SupplierId)).ToList();
foreach (var item in detailList) {
foreach (var item in detailList)
{
var supplierModel = supplist.Where(x => x.ID == item.SupplierId).FirstOrDefault();
var qscList = scList.Where(x => x.SupplierId == item.SupplierId).ToList();
if (item.CostMoney > 0 && ((item.Final_Price ?? 0) - (item.CostMoney ?? 0) - item.TCommissionMoney)>0 && qscList.Any())
if (item.CostMoney > 0 && ((item.Final_Price ?? 0) - (item.CostMoney ?? 0) - item.TCommissionMoney) > 0 && qscList.Any())
{
decimal Profit = (item.Final_Price ?? 0) * (item.Number ?? 0) - (item.CostMoney ?? 0) * (item.Number ?? 0) - item.TCommissionMoney;
decimal GrossMargin = Math.Round(Profit / ((item.Final_Price ?? 0) * (item.Number ?? 0)), 2, MidpointRounding.AwayFromZero);
var scModel = qscList.Where(x => (x.CommissionType * 10) > GrossMargin).OrderBy(x => x.CommissionType).FirstOrDefault();
decimal Commission = Math.Round(Profit * scModel.CommissionRate / 100, 2, MidpointRounding.AwayFromZero);
if (Commission > 0) {
if (Commission > 0)
{
//插入返佣记录
goods_OrderIntroductionRepository.Insert(new RB_Goods_OrderIntroduction()
{
......@@ -5205,7 +5236,8 @@ namespace Mall.Module.Product
string areaName = (arealist.Where(x => x.ID == item.Province).FirstOrDefault()?.Name ?? "") + " " + (arealist.Where(x => x.ID == item.City).FirstOrDefault()?.Name ?? "") + " " + (arealist.Where(x => x.ID == item.District).FirstOrDefault()?.Name ?? "");
item.ShoppingAddress = areaName + " " + item.ShoppingAddress;
foreach (var qitem in item.DetailList) {
foreach (var qitem in item.DetailList)
{
qitem.OrderIntroduction = oclist.Where(x => x.OrderId == item.OrderId && x.OrderDetailId == qitem.Id).FirstOrDefault();
}
}
......@@ -7836,7 +7868,8 @@ namespace Mall.Module.Product
x.Mobile,
x.Commission
}),
VipCommissionInfo = clist.Select(x => new {
VipCommissionInfo = clist.Select(x => new
{
x.Id,
x.Grade,
x.GradeDescription,
......@@ -8865,7 +8898,8 @@ namespace Mall.Module.Product
{
List<RB_Goods_OrderDetail_Extend> RList = new List<RB_Goods_OrderDetail_Extend>();
var list = goods_OrderIntroductionRepository.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) {
if (list.Any())
{
//获取订单明细
string DetailIds = string.Join(",", list.Select(x => x.OrderDetailId ?? 0));
var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, OrderDetailIds = DetailIds });
......@@ -8878,9 +8912,11 @@ namespace Mall.Module.Product
//获取分销商
var dislist = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, UserIds = string.Join(",", list.Select(x => x.UserId).Distinct()) });
foreach (var item in list) {
foreach (var item in list)
{
var dmodel = dlist.Where(x => x.Id == item.OrderDetailId).FirstOrDefault();
if (dmodel != null) {
if (dmodel != null)
{
var umodel = ulist.Where(x => x.Id == item.UserId).FirstOrDefault();
item.UserName = umodel?.Name ?? "";
item.Mobile = umodel?.Moblie ?? "";
......
......@@ -8,6 +8,7 @@ using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Entity.Product;
using Mall.Model.Entity.User;
using Mall.Model.Extend.BaseSetUp;
using Mall.Model.Extend.Product;
using Mall.Model.Extend.User;
using Mall.Model.Query;
......@@ -16,6 +17,7 @@ using Mall.Repository.BaseSetUp;
using Mall.Repository.Product;
using Mall.Repository.User;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using VT.FW.DB;
namespace Mall.Module.Product
......@@ -158,7 +160,7 @@ namespace Mall.Module.Product
/// </summary>
private readonly RB_Distributor_FXGradeRepository distributor_FXGradeRepository = new RB_Distributor_FXGradeRepository();
private RB_FreeShippingRepository freeShippingRepository = new RB_FreeShippingRepository();
......@@ -1049,6 +1051,24 @@ namespace Mall.Module.Product
#region 基本信息
//查询分类
model.CategoryList = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
//2020-08-05 根据分类查找商品对应的分类包邮规则 add by :W
if (model.CategoryList != null && model.CategoryList.Any())
{
string categoryIds = string.Join(",", model.CategoryList.Select(x => x.CategoryId));
var freeShippingList = freeShippingRepository.GetFreeShippingListByCategoryIds(new RB_FreeShipping_Extend { MallBaseId = model.MallBaseId, TenantId = model.TenantId, CategoryIds = categoryIds });
if (freeShippingList != null && freeShippingList.Any())
{
var fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
}
model.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
}
}
//最大售价
decimal MaxSellMoney = model.SellingPrice ?? 0;
model.SpecificationList = new List<RB_Goods_Specification_Extend>();
......@@ -1915,6 +1935,9 @@ namespace Mall.Module.Product
is_quick_shop = model.IsQuickBuy,
is_sell_well = model.IsSellWell,
is_negotiable = model.IsGoodsNegotiable,
freeShippingName = model.FreeShippingModel.Name,
fullMoneyPinkage = model.FreeShippingModel.FullMoneyPinkage,
fullNumPinkage = model.FreeShippingModel.FullNumPinkage,
cats = model.CategoryList.Select(x => new
{
x.CategoryId,
......@@ -6083,6 +6106,19 @@ namespace Mall.Module.Product
#endregion
#region 分类包邮规则信息
/// <summary>
/// 物流规则列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_FreeShipping_Extend> GetFreeShippingListByCategoryIds(RB_FreeShipping_Extend query)
{
return freeShippingRepository.GetFreeShippingListByCategoryIds(query);
}
#endregion
}
}
......@@ -90,21 +90,18 @@ namespace Mall.Repository.BaseSetUp
INNER JOIN rb_mallbase as c on a.MallBaseId = c.ID and a.TenantId = c.TenantId WHERE a.{nameof(RB_FreeShipping_Extend.Status)}=0 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_FreeShipping_Extend.ID)}={query.ID}");
}
if (query.TenantId > 0)
{
builder.Append($" AND {nameof(RB_FreeShipping_Extend.TenantId)}={query.TenantId}");
builder.Append($" AND a.{nameof(RB_FreeShipping_Extend.TenantId)}={query.TenantId}");
}
if (query.MallBaseId > 0)
{
builder.Append($" AND {nameof(RB_FreeShipping_Extend.MallBaseId)}={query.MallBaseId}");
builder.Append($" AND a.{nameof(RB_FreeShipping_Extend.MallBaseId)}={query.MallBaseId}");
}
if (!string.IsNullOrWhiteSpace(query.CategoryIds))
{
builder.Append($" AND {nameof(RB_FreeShippingCategory_Extend.CategoryId)} in({query.CategoryIds})");
builder.Append($" AND b.{nameof(RB_FreeShippingCategory_Extend.CategoryId)} in({query.CategoryIds})");
}
}
return Get<RB_FreeShipping_Extend>(builder.ToString()).ToList();
......
......@@ -63,7 +63,10 @@ namespace Mall.WebApi.Controllers.MallBase
x.GoodsStatus,
x.TenantId,
x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
FreeShippingName = x.FreeShippingModel.Name,
FreeShippingFullMoneyPinkage = x.FreeShippingModel.FullMoneyPinkage,
FreeShippingFullNumPinkage = x.FreeShippingModel.FullNumPinkage,
});
List<object> robj = new List<object>() {
new {
......
......@@ -15,6 +15,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.AOP\Mall.AOP.csproj" />
<ProjectReference Include="..\Mall.CacheManager\Mall.CacheManager.csproj" />
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.DataHelper\Mall.DataHelper.csproj" />
......
......@@ -22,6 +22,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;
namespace Mall.WindowsService.Module
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment