Commit 8fb99e6f authored by 吴春's avatar 吴春

商品实体添加供应商id

parent bb6a8fca
...@@ -380,5 +380,13 @@ namespace Mall.Model.Entity.Product ...@@ -380,5 +380,13 @@ namespace Mall.Model.Entity.Product
/// 商品类型 /// 商品类型
/// </summary> /// </summary>
public OrderTypeEnum? GoodsType { get; set; } public OrderTypeEnum? GoodsType { get; set; }
/// <summary>
/// 供应商id
/// </summary>
public int SupplierId { get; set; }
} }
} }
...@@ -202,7 +202,8 @@ namespace Mall.Module.Product ...@@ -202,7 +202,8 @@ namespace Mall.Module.Product
{ {
var SpecificationList = new List<RB_Goods_Specification_Extend>(); var SpecificationList = new List<RB_Goods_Specification_Extend>();
var SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>(); var SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
if (list.Where(x => x.IsCustomSpecification == 1).Any()) { if (list.Where(x => x.IsCustomSpecification == 1).Any())
{
string goodsIds = string.Join(",", list.Where(x => x.IsCustomSpecification == 1).Select(x => x.Id)); string goodsIds = string.Join(",", list.Where(x => x.IsCustomSpecification == 1).Select(x => x.Id));
SpecificationList = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }); SpecificationList = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
if (SpecificationList.Any()) if (SpecificationList.Any())
...@@ -241,11 +242,13 @@ namespace Mall.Module.Product ...@@ -241,11 +242,13 @@ namespace Mall.Module.Product
item.SpecificationList = new List<RB_Goods_Specification_Extend>(); item.SpecificationList = new List<RB_Goods_Specification_Extend>();
item.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>(); item.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
if (item.IsCustomSpecification == 1) { if (item.IsCustomSpecification == 1)
{
item.SpecificationList = SpecificationList.Where(x => x.GoodsId == item.Id).ToList(); item.SpecificationList = SpecificationList.Where(x => x.GoodsId == item.Id).ToList();
item.SpecificationPriceList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList(); item.SpecificationPriceList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList();
} }
if (item.EnjoyMember == 1 && item.SeparateSetMember == 1) { if (item.EnjoyMember == 1 && item.SeparateSetMember == 1)
{
item.MemberPriceList = MemberPriceList.Where(x => x.GoodsId == item.Id).ToList(); item.MemberPriceList = MemberPriceList.Where(x => x.GoodsId == item.Id).ToList();
} }
...@@ -773,9 +776,10 @@ namespace Mall.Module.Product ...@@ -773,9 +776,10 @@ namespace Mall.Module.Product
if (distributor_HPCommissionRepository.Exists(wheres)) if (distributor_HPCommissionRepository.Exists(wheres))
{ {
//获取和平分销返佣 //获取和平分销返佣
if (disModel.HPGradeId > 0 && model.CostPrice > 0) { if (disModel.HPGradeId > 0 && model.CostPrice > 0)
{
string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId)); string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId));
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled=1, CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId }); var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled = 1, CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId });
if (hpcList.Any()) if (hpcList.Any())
{ {
RB_Distributor_HPCommission_Extend hpcModel; RB_Distributor_HPCommission_Extend hpcModel;
...@@ -784,7 +788,8 @@ namespace Mall.Module.Product ...@@ -784,7 +788,8 @@ namespace Mall.Module.Product
//有使用非通用返佣 //有使用非通用返佣
hpcModel = hpcList.Where(x => x.IsCommon != 1).FirstOrDefault(); hpcModel = hpcList.Where(x => x.IsCommon != 1).FirstOrDefault();
} }
else { else
{
//查询通用返佣 //查询通用返佣
hpcModel = hpcList.Where(x => x.IsCommon == 1).FirstOrDefault(); hpcModel = hpcList.Where(x => x.IsCommon == 1).FirstOrDefault();
} }
...@@ -875,7 +880,7 @@ namespace Mall.Module.Product ...@@ -875,7 +880,7 @@ namespace Mall.Module.Product
/// 获取商品分享 /// 获取商品分享
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public object GetAppletGoodsShareInfo(int goodsId, int userId, string path, int mallBaseId) public object GetAppletGoodsShareInfo(int goodsId, int userId, string path, int mallBaseId)
{ {
string QRPath = GetWeiXinQRCode(path, 430, mallBaseId); string QRPath = GetWeiXinQRCode(path, 430, mallBaseId);
var umodel = member_UserRepository.GetEntity(userId); var umodel = member_UserRepository.GetEntity(userId);
...@@ -904,7 +909,7 @@ namespace Mall.Module.Product ...@@ -904,7 +909,7 @@ namespace Mall.Module.Product
}; };
if (goodsModel == null) if (goodsModel == null)
{ {
info= new info = new
{ {
goods_name = "", goods_name = "",
multi_map = new List<string>(), multi_map = new List<string>(),
...@@ -1277,7 +1282,7 @@ namespace Mall.Module.Product ...@@ -1277,7 +1282,7 @@ namespace Mall.Module.Product
if (disModel.HPGradeId > 0 && model.CostPrice > 0) if (disModel.HPGradeId > 0 && model.CostPrice > 0)
{ {
string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId)); string categoryids = string.Join(",", model.CategoryList.Select(x => x.CategoryId));
var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() {Enabled=1, CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId }); var hpcList = distributor_HPCommissionRepository.GetList(new RB_Distributor_HPCommission_Extend() { Enabled = 1, CategoryIdsT = categoryids, TenantId = TenantId, MallBaseId = MallBaseId });
if (hpcList.Any()) if (hpcList.Any())
{ {
RB_Distributor_HPCommission_Extend hpcModel; RB_Distributor_HPCommission_Extend hpcModel;
...@@ -1295,7 +1300,7 @@ namespace Mall.Module.Product ...@@ -1295,7 +1300,7 @@ namespace Mall.Module.Product
var gList = distributor_HPGradeRatioRepository.GetList(new RB_Distributor_HPGradeRatio_Extend() { CommissionId = hpcModel.Id, TenantId = TenantId, MallBaseId = MallBaseId }); var gList = distributor_HPGradeRatioRepository.GetList(new RB_Distributor_HPGradeRatio_Extend() { CommissionId = hpcModel.Id, TenantId = TenantId, MallBaseId = MallBaseId });
var ratioModel = gList.Where(x => x.GradeId == disModel.HPGradeId).FirstOrDefault(); var ratioModel = gList.Where(x => x.GradeId == disModel.HPGradeId).FirstOrDefault();
decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100)); decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100));
model.MaxShare = MaxSellMoney - MPrice > 0 ? MaxSellMoney - MPrice : 0; model.MaxShare = MaxSellMoney - MPrice > 0 ? MaxSellMoney - MPrice : 0;
if (hpcModel.DecimalType == 1) if (hpcModel.DecimalType == 1)
{ {
...@@ -1623,24 +1628,29 @@ namespace Mall.Module.Product ...@@ -1623,24 +1628,29 @@ namespace Mall.Module.Product
#region 返回参数 #region 返回参数
string shipping = ""; string shipping = "";
if (model.FullNumPinkage > 0) { if (model.FullNumPinkage > 0)
{
shipping += "单品满" + model.FullNumPinkage + "件包邮"; shipping += "单品满" + model.FullNumPinkage + "件包邮";
} }
if (model.FullMoneyPinkage > 0) { if (model.FullMoneyPinkage > 0)
{
if (model.FullNumPinkage > 0) if (model.FullNumPinkage > 0)
{ {
shipping += ",单品满¥" + model.FullMoneyPinkage.Value.ToString("#0.00") + "包邮"; shipping += ",单品满¥" + model.FullMoneyPinkage.Value.ToString("#0.00") + "包邮";
} }
else { else
{
shipping += "单品满¥" + model.FullMoneyPinkage.Value.ToString("#0.00") + "包邮"; shipping += "单品满¥" + model.FullMoneyPinkage.Value.ToString("#0.00") + "包邮";
} }
} }
string limit = ""; string limit = "";
if (model.AreaList.Any()) { if (model.AreaList.Any())
{
limit = "仅限" + string.Join(",", model.AreaList.Select(x => x.AreaName)) + "购买"; limit = "仅限" + string.Join(",", model.AreaList.Select(x => x.AreaName)) + "购买";
} }
int IsAllowShare = 1; int IsAllowShare = 1;
if (model.CategoryList.Where(x => x.IsForeignShare == 2).Any()) { if (model.CategoryList.Where(x => x.IsForeignShare == 2).Any())
{
IsAllowShare = 2; IsAllowShare = 2;
} }
...@@ -1762,7 +1772,8 @@ namespace Mall.Module.Product ...@@ -1762,7 +1772,8 @@ namespace Mall.Module.Product
is_quick_shop = model.IsQuickBuy, is_quick_shop = model.IsQuickBuy,
is_sell_well = model.IsSellWell, is_sell_well = model.IsSellWell,
is_negotiable = model.IsGoodsNegotiable, is_negotiable = model.IsGoodsNegotiable,
cats = model.CategoryList.Select(x => new { cats = model.CategoryList.Select(x => new
{
x.CategoryId, x.CategoryId,
x.CategoryName x.CategoryName
})//分类 })//分类
...@@ -3271,7 +3282,8 @@ namespace Mall.Module.Product ...@@ -3271,7 +3282,8 @@ namespace Mall.Module.Product
item.SpecificationPriceList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList(); item.SpecificationPriceList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList();
} }
item.AreaList = new List<RB_Goods_Area_Extend>(); item.AreaList = new List<RB_Goods_Area_Extend>();
if (item.IsAreaBuy == 1) { if (item.IsAreaBuy == 1)
{
item.AreaList = AreaList.Where(x => x.GoodsId == item.Id).ToList(); item.AreaList = AreaList.Where(x => x.GoodsId == item.Id).ToList();
} }
...@@ -3332,7 +3344,8 @@ namespace Mall.Module.Product ...@@ -3332,7 +3344,8 @@ namespace Mall.Module.Product
{ nameof(RB_Goods.SeparateDistributionType),demodel.SeparateDistributionType}, { nameof(RB_Goods.SeparateDistributionType),demodel.SeparateDistributionType},
{ nameof(RB_Goods.SeparateDistributionMoneyType),demodel.SeparateDistributionMoneyType}, { nameof(RB_Goods.SeparateDistributionMoneyType),demodel.SeparateDistributionMoneyType},
{ nameof(RB_Goods.SeparateSetMember),demodel.SeparateSetMember}, { nameof(RB_Goods.SeparateSetMember),demodel.SeparateSetMember},
{ nameof(RB_Goods.IsQuickBuy),demodel.IsQuickBuy} { nameof(RB_Goods.IsQuickBuy),demodel.IsQuickBuy},
{ nameof(RB_Goods.SupplierId),demodel.SupplierId}
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){ new WhereHelper(){
...@@ -3958,10 +3971,11 @@ namespace Mall.Module.Product ...@@ -3958,10 +3971,11 @@ namespace Mall.Module.Product
model.DistributionCommissionTreeList.Add(treemodel); model.DistributionCommissionTreeList.Add(treemodel);
} }
} }
else {//分销商等级有变更 else
{//分销商等级有变更
foreach (var qitem in KeyList) foreach (var qitem in KeyList)
{ {
var treemodel = model.DistributionCommissionList.Where(x => (x.SpecificationSort ?? "") == qitem).FirstOrDefault(); var treemodel = model.DistributionCommissionList.Where(x => (x.SpecificationSort ?? "") == qitem).FirstOrDefault();
treemodel.GradeCommissionList = new List<RB_Goods_DistributionCommission_Extend>(); treemodel.GradeCommissionList = new List<RB_Goods_DistributionCommission_Extend>();
var gradeCommList = model.DistributionCommissionList.Where(x => (x.SpecificationSort ?? "") == qitem).ToList(); var gradeCommList = model.DistributionCommissionList.Where(x => (x.SpecificationSort ?? "") == qitem).ToList();
dgradeList = dgradeList.OrderByDescending(x => x.Grade).ToList(); dgradeList = dgradeList.OrderByDescending(x => x.Grade).ToList();
...@@ -3972,7 +3986,8 @@ namespace Mall.Module.Product ...@@ -3972,7 +3986,8 @@ namespace Mall.Module.Product
{ {
treemodel.GradeCommissionList.AddRange(gradeMList); treemodel.GradeCommissionList.AddRange(gradeMList);
} }
else { else
{
//表示新的 //表示新的
treemodel.GradeCommissionList.Add(new RB_Goods_DistributionCommission_Extend() treemodel.GradeCommissionList.Add(new RB_Goods_DistributionCommission_Extend()
{ {
...@@ -4012,7 +4027,8 @@ namespace Mall.Module.Product ...@@ -4012,7 +4027,8 @@ namespace Mall.Module.Product
} }
} }
SortNum++; SortNum++;
if (model.DistributionCommissionTreeList.Any()) { if (model.DistributionCommissionTreeList.Any())
{
//倒序排一次 //倒序排一次
model.DistributionCommissionTreeList = model.DistributionCommissionTreeList.OrderByDescending(x => x.Sort).ToList(); model.DistributionCommissionTreeList = model.DistributionCommissionTreeList.OrderByDescending(x => x.Sort).ToList();
} }
...@@ -4062,7 +4078,8 @@ namespace Mall.Module.Product ...@@ -4062,7 +4078,8 @@ namespace Mall.Module.Product
model.MemberPriceTreeList.Add(treemodel); model.MemberPriceTreeList.Add(treemodel);
} }
} }
else {//会员等级有变更 else
{//会员等级有变更
var KeyList = model.MemberPriceList.Select(x => x.SpecificationSort ?? "").Distinct().ToList(); var KeyList = model.MemberPriceList.Select(x => x.SpecificationSort ?? "").Distinct().ToList();
foreach (var qitem in KeyList) foreach (var qitem in KeyList)
{ {
...@@ -4136,7 +4153,7 @@ namespace Mall.Module.Product ...@@ -4136,7 +4153,7 @@ namespace Mall.Module.Product
}); });
} }
} }
model.CustomShareImagePath = model.CustomShareImage; model.CustomShareImagePath = model.CustomShareImage;
//服务列表 //服务列表
model.ServiceList = new List<RB_ImageCommonModel>(); model.ServiceList = new List<RB_ImageCommonModel>();
if (model.IsDefaultService == 2) if (model.IsDefaultService == 2)
...@@ -4444,31 +4461,41 @@ namespace Mall.Module.Product ...@@ -4444,31 +4461,41 @@ namespace Mall.Module.Product
foreach (var item in list) foreach (var item in list)
{ {
#region 导入验证 #region 导入验证
if (string.IsNullOrEmpty(item.Name)) { if (string.IsNullOrEmpty(item.Name))
{
return "有商品名称为空,无法导入"; return "有商品名称为空,无法导入";
} }
if ((item.OriginalPrice ?? 0) < 0) { if ((item.OriginalPrice ?? 0) < 0)
{
return "商品原价为空:" + item.Name; return "商品原价为空:" + item.Name;
} }
if ((item.SellingPrice ?? 0) < 0) { if ((item.SellingPrice ?? 0) < 0)
{
return "商品售价为空:" + item.Name; return "商品售价为空:" + item.Name;
} }
if (string.IsNullOrEmpty(item.CoverImage)) { if (string.IsNullOrEmpty(item.CoverImage))
{
return "封面图为空:" + item.Name; return "封面图为空:" + item.Name;
} }
if (string.IsNullOrEmpty(item.CarouselImage)) { if (string.IsNullOrEmpty(item.CarouselImage))
{
return "轮播图为空:" + item.Name; return "轮播图为空:" + item.Name;
} }
if (item.IsCustomSpecification == 1) { if (item.IsCustomSpecification == 1)
if (string.IsNullOrEmpty(item.SpecificationImport)) { {
if (string.IsNullOrEmpty(item.SpecificationImport))
{
return "规格组为空:" + item.Name; return "规格组为空:" + item.Name;
} }
if (string.IsNullOrEmpty(item.SpecificationPriceImport)) { if (string.IsNullOrEmpty(item.SpecificationPriceImport))
{
return "规格详情为空:" + item.Name; return "规格详情为空:" + item.Name;
} }
} }
if (item.IsAreaBuy == 1) { if (item.IsAreaBuy == 1)
if (string.IsNullOrEmpty(item.AreaImport)) { {
if (string.IsNullOrEmpty(item.AreaImport))
{
return "区域购买为空:" + item.Name; return "区域购买为空:" + item.Name;
} }
} }
...@@ -4575,11 +4602,13 @@ namespace Mall.Module.Product ...@@ -4575,11 +4602,13 @@ namespace Mall.Module.Product
try try
{ {
if (item.GoodsId <= 0) { if (item.GoodsId <= 0)
return "商品id不存在:"+ item.Name; {
return "商品id不存在:" + item.Name;
} }
var goodsModel = goodsRepository.GetEntity(item.GoodsId); var goodsModel = goodsRepository.GetEntity(item.GoodsId);
if (goodsModel != null) { if (goodsModel != null)
{
return "商品id已存在:" + item.Name + " ,id:" + item.GoodsId; return "商品id已存在:" + item.Name + " ,id:" + item.GoodsId;
} }
} }
...@@ -4588,7 +4617,8 @@ namespace Mall.Module.Product ...@@ -4588,7 +4617,8 @@ namespace Mall.Module.Product
return "商品id获取出错了"; return "商品id获取出错了";
} }
} }
else { else
{
try try
{ {
//转化轮播图 //转化轮播图
...@@ -4636,8 +4666,9 @@ namespace Mall.Module.Product ...@@ -4636,8 +4666,9 @@ namespace Mall.Module.Product
#region 规格验证 #region 规格验证
if (item.IsCustomSpecification == 1) { if (item.IsCustomSpecification == 1)
{
if (item.SpecificationList.Count() != item.SpecificationList.Select(x => x.Sort).Distinct().Count()) if (item.SpecificationList.Count() != item.SpecificationList.Select(x => x.Sort).Distinct().Count())
{ {
return "商品规格组排序有误:" + item.Name; return "商品规格组排序有误:" + item.Name;
...@@ -4710,7 +4741,8 @@ namespace Mall.Module.Product ...@@ -4710,7 +4741,8 @@ namespace Mall.Module.Product
#region 商品分类 #region 商品分类
item.CategoryList = new List<RB_Goods_Category_Extend>(); item.CategoryList = new List<RB_Goods_Category_Extend>();
foreach (var qitem in categoryIdList) { foreach (var qitem in categoryIdList)
{
item.CategoryList.Add(new RB_Goods_Category_Extend() item.CategoryList.Add(new RB_Goods_Category_Extend()
{ {
CategoryId = qitem CategoryId = qitem
...@@ -4765,14 +4797,17 @@ namespace Mall.Module.Product ...@@ -4765,14 +4797,17 @@ namespace Mall.Module.Product
{ {
foreach (var item in list) foreach (var item in list)
{ {
if (item.IsAreaBuy == 1 && FileType == 1) { if (item.IsAreaBuy == 1 && FileType == 1)
foreach (var qitem in item.AreaList) { {
foreach (var qitem in item.AreaList)
{
qitem.AreaId = destList.Where(x => x.Name == qitem.AreaName).FirstOrDefault()?.ID; qitem.AreaId = destList.Where(x => x.Name == qitem.AreaName).FirstOrDefault()?.ID;
qitem.AreaType = (int)(destList.Where(x => x.Name == qitem.AreaName).FirstOrDefault()?.CodeLevel ?? Common.Enum.AreaRegionEnum.CountryEnum); qitem.AreaType = (int)(destList.Where(x => x.Name == qitem.AreaName).FirstOrDefault()?.CodeLevel ?? Common.Enum.AreaRegionEnum.CountryEnum);
} }
} }
bool flag = SetGoodsImportInfo(item, trans); bool flag = SetGoodsImportInfo(item, trans);
if (flag == false) { if (flag == false)
{
goodsRepository.DBSession.Rollback(); goodsRepository.DBSession.Rollback();
return "请联系管理员,商品导入失败:" + item.Name; return "请联系管理员,商品导入失败:" + item.Name;
} }
...@@ -4893,7 +4928,7 @@ namespace Mall.Module.Product ...@@ -4893,7 +4928,7 @@ namespace Mall.Module.Product
Status = 0, Status = 0,
TenantId = demodel.TenantId TenantId = demodel.TenantId
}, trans); }, trans);
} }
} }
return true; return true;
} }
...@@ -4913,7 +4948,7 @@ namespace Mall.Module.Product ...@@ -4913,7 +4948,7 @@ namespace Mall.Module.Product
{ {
//最直接的方法Regex.Unescape(str); //最直接的方法Regex.Unescape(str);
StringBuilder strResult = new StringBuilder(); StringBuilder strResult = new StringBuilder();
if (!string.IsNullOrEmpty(str)&& str.Contains("\\u")) if (!string.IsNullOrEmpty(str) && str.Contains("\\u"))
{ {
string[] strlist = str.Replace("\\", "").Split('u'); string[] strlist = str.Replace("\\", "").Split('u');
try try
......
...@@ -1383,7 +1383,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1383,7 +1383,8 @@ namespace Mall.WebApi.Controllers.MallBase
model.EnjoyMember, model.EnjoyMember,
model.SeparateSetMember, model.SeparateSetMember,
model.IsQuickBuy, model.IsQuickBuy,
CategoryList= model.CategoryList.Select(x=>new { model.SupplierId,
CategoryList = model.CategoryList.Select(x=>new {
x.Id, x.Id,
x.CategoryId, x.CategoryId,
x.CategoryName x.CategoryName
......
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