Commit fd4ccea0 authored by 黄奎's avatar 黄奎

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 906983db c95042c3
......@@ -1737,7 +1737,7 @@ namespace Edu.Module.Course
GoodsNumbers = item.ClassNo,
GoodsWeight = 0,
InventoryNum = item.ClassPersion - item.OrderStudentCount,//暂
SellingPrice = item.SellPrice,
SellingPrice = model.SellPrice,
SpecificationSort = Sort.ToString(),//暂定
AttrList = new object()
};
......@@ -2061,85 +2061,96 @@ namespace Edu.Module.Course
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
if (courseModel.MallGoodsId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Goods.SellingPrice),courseModel.SellPrice },
{nameof(RB_Goods.OriginalPrice),courseModel.OriginalPrice },
};
flag = mallGoodsRepository.Update(fileds, new WhereHelper(nameof(RB_Goods.Id), courseModel.MallGoodsId));
var oldList = MallGoodsPreferentialRepository.GetGoodsPreferentialListRepostory(new RB_Goods_Preferential_Extend() { GoodsId = courseModel.MallGoodsId });
flag = mallGoodsRepository.Update(fileds, new WhereHelper(nameof(RB_Goods.Id), courseModel.MallGoodsId));
var oldList = MallGoodsPreferentialRepository.GetGoodsPreferentialListRepostory(new RB_Goods_Preferential_Extend() { GoodsId = courseModel.MallGoodsId });
List<RB_Goods_Preferential_Extend> goodsPreferentialLsit = new List<RB_Goods_Preferential_Extend>();
foreach (var item in list)
{
RB_Goods_Preferential_Extend goodsPreferential = new RB_Goods_Preferential_Extend()
List<RB_Goods_Preferential_Extend> goodsPreferentialLsit = new List<RB_Goods_Preferential_Extend>();
foreach (var item in list)
{
Id = 0,
GoodsId = courseModel.MallGoodsId,
PreferentialTerms = item.PreferentialTerms,
SaleCommissionType = item.SaleCommissionType,
SaleCommissionMoney = item.SaleCommissionMoney,
B2BCommissionType = item.B2BCommissionType,
B2BCommissionMoney = item.B2BCommissionMoney,
PriceDiscountType = item.PriceDiscountType,
BuyNum = item.BuyNum,
SendNum = item.SendNum,
PriceType = item.PriceType,
PriceMoney = item.PriceMoney,
TenantId = Convert.ToInt32(Config.JHTenantId),
MallBaseId = Convert.ToInt32(Config.JHMallBaseId),
Status = 0,
EduCommissionType = item.EduCommissionType,
EduCommissionMoney = item.EduCommissionMoney
};
goodsPreferentialLsit.Add(goodsPreferential);
}
RB_Goods_Preferential_Extend goodsPreferential = new RB_Goods_Preferential_Extend()
{
Id = 0,
GoodsId = courseModel.MallGoodsId,
PreferentialTerms = item.PreferentialTerms,
SaleCommissionType = item.SaleCommissionType,
SaleCommissionMoney = item.SaleCommissionMoney,
B2BCommissionType = item.B2BCommissionType,
B2BCommissionMoney = item.B2BCommissionMoney,
PriceDiscountType = item.PriceDiscountType,
BuyNum = item.BuyNum,
SendNum = item.SendNum,
PriceType = item.PriceType,
PriceMoney = item.PriceMoney,
TenantId = Convert.ToInt32(Config.JHTenantId),
MallBaseId = Convert.ToInt32(Config.JHMallBaseId),
Status = 0,
EduCommissionType = item.EduCommissionType,
EduCommissionMoney = item.EduCommissionMoney
};
goodsPreferentialLsit.Add(goodsPreferential);
}
if (oldList == null || !oldList.Any())
{
foreach (var item in goodsPreferentialLsit)
{
flag = MallGoodsPreferentialRepository.Insert(item) > 0;
var splist = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsId = courseModel.MallGoodsId, TenantId = Convert.ToInt32(Config.JHTenantId), MallBaseId = Convert.ToInt32(Config.JHMallBaseId) });
if (splist != null && splist.Any())
{
splist.ForEach(x => x.SellingPrice = courseModel.SellPrice);
goods_SpecificationPriceRepository.UpdateBatch(splist);
}
}
//原来有优惠数据
else
{
if (list == null || (list != null && list.Count == 0))
if (oldList == null || !oldList.Any())
{
flag = MallGoodsPreferentialRepository.DeleteGoodsPreferentialRepostory(courseModel.MallGoodsId);
foreach (var item in goodsPreferentialLsit)
{
flag = MallGoodsPreferentialRepository.Insert(item) > 0;
}
}
//原来有优惠数据
else
{
//找出差异的数据
var deleteList = oldList.Where(qitem => !goodsPreferentialLsit.Any(oldItem => qitem.PriceDiscountType == oldItem.PriceDiscountType)).ToList();
foreach (var dItem in deleteList)
if (list == null || (list != null && list.Count == 0))
{
if (dItem.Id > 0)
{
flag = MallGoodsPreferentialRepository.Delete(dItem.Id) > 0;
}
flag = MallGoodsPreferentialRepository.DeleteGoodsPreferentialRepostory(courseModel.MallGoodsId);
}
foreach (var priceItem in goodsPreferentialLsit)
else
{
var nowItem = oldList.Where(x => x.PriceDiscountType == priceItem.PriceDiscountType).FirstOrDefault();
if (nowItem != null && nowItem.Id > 0)
//找出差异的数据
var deleteList = oldList.Where(qitem => !goodsPreferentialLsit.Any(oldItem => qitem.PriceDiscountType == oldItem.PriceDiscountType)).ToList();
foreach (var dItem in deleteList)
{
priceItem.Id = nowItem.Id;
if (dItem.Id > 0)
{
flag = MallGoodsPreferentialRepository.Delete(dItem.Id) > 0;
}
}
if (priceItem.Id == 0)
foreach (var priceItem in goodsPreferentialLsit)
{
flag = MallGoodsPreferentialRepository.Insert(priceItem) > 0;
}
else
{
flag = MallGoodsPreferentialRepository.Update(priceItem);
var nowItem = oldList.Where(x => x.PriceDiscountType == priceItem.PriceDiscountType).FirstOrDefault();
if (nowItem != null && nowItem.Id > 0)
{
priceItem.Id = nowItem.Id;
}
if (priceItem.Id == 0)
{
flag = MallGoodsPreferentialRepository.Insert(priceItem) > 0;
}
else
{
flag = MallGoodsPreferentialRepository.Update(priceItem);
}
}
}
}
}
return flag;
}
......
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