Commit 776bbbed authored by 黄奎's avatar 黄奎

页面修改

parent 05403aa7
...@@ -588,34 +588,36 @@ namespace Edu.Module.Course ...@@ -588,34 +588,36 @@ namespace Edu.Module.Course
//默认上课时间 //默认上课时间
var defaultPlanTimeList = new List<ClassTimeItem>(); var defaultPlanTimeList = new List<ClassTimeItem>();
var BasicMinutes = class_ConfigRepository.GetBasicMinutesRepository(model.Group_Id); var BasicMinutes = class_ConfigRepository.GetBasicMinutesRepository(model.Group_Id);
foreach (var tItem in model.DefaultTimeList) if (model.DefaultTimeList != null && model.DefaultTimeList.Count > 0)
{ {
ClassTimeItem tModel = new ClassTimeItem() foreach (var tItem in model.DefaultTimeList)
{ {
DateList = new List<string>(), ClassTimeItem tModel = new ClassTimeItem()
TimeList = new List<TimeItem>()
};
tModel.DateList = tItem.DateList;
foreach (var subItem in tItem.TimeList)
{
var startDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + subItem.StartTime + ":00");
var endDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + subItem.EndTime + ":00");
TimeSpan span = endDate.Subtract(startDate);
var timeModel = new TimeItem()
{ {
StartTime = subItem.StartTime, DateList = new List<string>(),
EndTime = subItem.EndTime, TimeList = new List<TimeItem>()
TimeHour = subItem.TimeHour,
}; };
if (timeModel.TimeHour <= 0) tModel.DateList = tItem.DateList;
foreach (var subItem in tItem.TimeList)
{ {
timeModel.TimeHour = Convert.ToDecimal(span.TotalMinutes / BasicMinutes); var startDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + subItem.StartTime + ":00");
var endDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + subItem.EndTime + ":00");
TimeSpan span = endDate.Subtract(startDate);
var timeModel = new TimeItem()
{
StartTime = subItem.StartTime,
EndTime = subItem.EndTime,
TimeHour = subItem.TimeHour,
};
if (timeModel.TimeHour <= 0)
{
timeModel.TimeHour = Convert.ToDecimal(span.TotalMinutes / BasicMinutes);
}
tModel.TimeList.Add(timeModel);
defaultPlanTimeList.Add(tModel);
} }
tModel.TimeList.Add(timeModel);
defaultPlanTimeList.Add(tModel);
} }
} }
#endregion #endregion
if (model.Teacher_Id > 0 && model.ClassRoomId > 0) if (model.Teacher_Id > 0 && model.ClassRoomId > 0)
{ {
......
...@@ -118,34 +118,6 @@ namespace Edu.Module.Course ...@@ -118,34 +118,6 @@ namespace Edu.Module.Course
/// </summary> /// </summary>
private readonly RB_Class_Time_UnKnowRepository unKnowRepository = new RB_Class_Time_UnKnowRepository(); private readonly RB_Class_Time_UnKnowRepository unKnowRepository = new RB_Class_Time_UnKnowRepository();
/// <summary>
/// 小程序对应的商品仓储对象
/// </summary>
private readonly Repository.Mall.RB_GoodsRepository mallGoodsRepository = new Repository.Mall.RB_GoodsRepository();
/// <summary>
/// 小程序对应的商品分类仓储对象
/// </summary>
private readonly Repository.Mall.RB_Goods_CategoryRepository MallGoodsCategoryRepository = new Repository.Mall.RB_Goods_CategoryRepository();
/// <summary>
/// 小程序对应的商品优惠仓储对象
/// </summary>
private readonly Repository.Mall.RB_Goods_PreferentialRepository MallGoodsPreferentialRepository = new Repository.Mall.RB_Goods_PreferentialRepository();
/// <summary>
/// 商品规格
/// </summary>
private readonly Repository.Mall.RB_Goods_SpecificationRepository goods_SpecificationRepository = new Repository.Mall.RB_Goods_SpecificationRepository();
/// <summary>
/// 商品规格值
/// </summary>
private readonly Repository.Mall.RB_Goods_SpecificationValueRepository goods_SpecificationValueRepository = new Repository.Mall.RB_Goods_SpecificationValueRepository();
/// <summary>
/// 商品规格价格
/// </summary>
private readonly Repository.Mall.RB_Goods_SpecificationPriceRepository goods_SpecificationPriceRepository = new Repository.Mall.RB_Goods_SpecificationPriceRepository();
/// <summary> /// <summary>
/// 课程单词仓储层对象 /// 课程单词仓储层对象
/// </summary> /// </summary>
...@@ -277,7 +249,13 @@ namespace Edu.Module.Course ...@@ -277,7 +249,13 @@ namespace Edu.Module.Course
if (extModel.MallGoodsId > 0)//小程序端查询出当前商品对应的分类 if (extModel.MallGoodsId > 0)//小程序端查询出当前商品对应的分类
{ {
extModel.CategoryList = new List<RB_Goods_Category_Extend>(); extModel.CategoryList = new List<RB_Goods_Category_Extend>();
var clist = MallGoodsCategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsId = extModel.MallGoodsId, TenantId = Convert.ToInt32(Config.JHTenantId), MallBaseId = Convert.ToInt32(Config.JHMallBaseId) }); var query = new RB_Goods_Category_Extend()
{
GoodsId = extModel.MallGoodsId,
TenantId = Convert.ToInt32(Config.JHTenantId),
MallBaseId = Convert.ToInt32(Config.JHMallBaseId)
};
var clist = courseRepository.GetGoodsCategoryListRepository(query);
extModel.CategoryList = clist; extModel.CategoryList = clist;
} }
if (!string.IsNullOrEmpty(extModel.OpenBankLevel)) if (!string.IsNullOrEmpty(extModel.OpenBankLevel))
...@@ -294,69 +272,7 @@ namespace Edu.Module.Course ...@@ -294,69 +272,7 @@ namespace Edu.Module.Course
/// <returns></returns> /// <returns></returns>
public virtual bool SetCourseModule(RB_Course_ViewModel model, out int courseId) public virtual bool SetCourseModule(RB_Course_ViewModel model, out int courseId)
{ {
bool flag; bool flag = courseRepository.SetCourseRepository(model, out courseId);
if (model.IsRenew == 0)
{
model.RenewOgPrice = 0;
model.RenewSlPrice = 0;
}
if (model.CourseId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_ViewModel.CoverImg),model.CoverImg },
{nameof(RB_Course_ViewModel.CourseName),model.CourseName },
{nameof(RB_Course_ViewModel.CourseIntro),model.CourseIntro },
{nameof(RB_Course_ViewModel.CateId),model.CateId },
{nameof(RB_Course_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Course_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Course_ViewModel.Teacher_Ids),model.Teacher_Ids },
{nameof(RB_Course_ViewModel.CourseFeature),model.CourseFeature },
{nameof(RB_Course_ViewModel.IsOpenStepPrice),model.IsOpenStepPrice },
{nameof(RB_Course_ViewModel.IsRenew),model.IsRenew },
{nameof(RB_Course_ViewModel.RenewOgPrice),model.RenewOgPrice },
{nameof(RB_Course_ViewModel.RenewSlPrice),model.RenewSlPrice },
{nameof(RB_Course_ViewModel.Saleplat),model.Saleplat },
{nameof(RB_Course_ViewModel.IsKCourse),model.IsKCourse },
{nameof(RB_Course_ViewModel.ClassHours),model.ClassHours },
{nameof(RB_Course_ViewModel.CourseRate),model.CourseRate },
{nameof(RB_Course_ViewModel.CourseSubject),model.CourseSubject },
{nameof(RB_Course_ViewModel.B2BIcon),model.B2BIcon },
{nameof(RB_Course_ViewModel.B2BBackground),model.B2BBackground },
{nameof(RB_Course_ViewModel.CourseEmphasis),model.CourseEmphasis },
{nameof(RB_Course_ViewModel.ContractInfo),model.ContractInfo },
{nameof(RB_Course_ViewModel.IsScrollClass),model.IsScrollClass },
{nameof(RB_Course_ViewModel.ScrollMinNum),model.ScrollMinNum },
{nameof(RB_Course_ViewModel.ScrollMaxNum),model.ScrollMaxNum },
{nameof(RB_Course_ViewModel.CourseTimeId),model.CourseTimeId },
{nameof(RB_Course_ViewModel.OpenBankLevel),model.OpenBankLevel },
};
flag = courseRepository.Update(fileds, new WhereHelper(nameof(RB_Course_ViewModel.CourseId), model.CourseId));
}
else
{
var newId = courseRepository.Insert(model);
model.CourseId = newId;
flag = newId > 0;
}
courseId = model.CourseId;
if (model.SalePlatList != null && model.SalePlatList.Any(x => x == 4))//上架小程序端,则要同步到小程序
{
int GoodsId = SetMallGoods(model);//新增字段保存返回电商商品ID
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_ViewModel.MallGoodsId),GoodsId },
};
flag = courseRepository.Update(fileds, new WhereHelper(nameof(RB_Course_ViewModel.CourseId), model.CourseId));
}
if (model.MallGoodsId > 0 && !model.SalePlatList.Any(x => x == 4))//之前上架了小程序端,现在取消了则下架商品
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Goods.GoodsStatus),2 },
};
mallGoodsRepository.Update(fileds, new WhereHelper(nameof(RB_Goods.Id), model.MallGoodsId));
}
return flag; return flag;
} }
...@@ -2020,455 +1936,7 @@ namespace Edu.Module.Course ...@@ -2020,455 +1936,7 @@ namespace Edu.Module.Course
#endregion #endregion
#region 小程序商品 #region 小程序商品
public int SetMallGoods(RB_Course_ViewModel model)
{
int goodsId = 0;
Model.ViewModel.Mall.RB_Goods_Extend demodel = new Model.ViewModel.Mall.RB_Goods_Extend();
if (model.MallGoodsId > 0)
{
demodel = mallGoodsRepository.GetGoodsList(new Model.ViewModel.Mall.RB_Goods_Extend { Id = model.MallGoodsId }).FirstOrDefault();
if (demodel == null || demodel.Id == 0)//不存在
{
demodel = new Model.ViewModel.Mall.RB_Goods_Extend();
}
}
demodel.CarouselImageList = new List<Model.ViewModel.Mall.RB_ImageCommonModel>();
if (!string.IsNullOrWhiteSpace(model.CoverImg))
{
demodel.CarouselImageList.Add(new Model.ViewModel.Mall.RB_ImageCommonModel
{
Id = 0,
Name = "",
Path = model.CoverImg,
Type = 0
});
demodel.CarouselImage = JsonHelper.Serialize(demodel.CarouselImageList.Select(x => x.Path));
}
demodel.Name = model.CourseName;
demodel.Remark ??= model.CourseFeature;
demodel.VideoAddress = "";
demodel.CustomShareTitles = "";
demodel.CustomShareImage = "";
demodel.GoodsStatus = 1;
demodel.InventoryNum = 100;//
demodel.DefaultSpecificationName = "";
demodel.SellingPrice = model.SellPrice;
demodel.OriginalPrice = model.OriginalPrice;
demodel.Unit = "课";//
demodel.CostPrice = 0;//
demodel.IsGoodsNegotiable = 0;
demodel.SalesNum = 0;
demodel.GoodsNumbers = "";
demodel.IsCustomSpecification = 1;//
demodel.GoodsWeight = 0;
demodel.IsDefaultService = 1;
demodel.FreightId = -1;
demodel.FormsId = 1;
demodel.LimitBuyGoodsNum = -1;
demodel.LimitBuyOrderNum = -1;
demodel.IsAreaBuy = 0;
demodel.IntegralPresent = 0;
demodel.IntegralPresentType = 2;
demodel.PointsDeduction = 0;
demodel.PointsDeductionType = 2;
demodel.IsMultipleDeduction = 2;
demodel.GoodsDetails = model.CourseIntro;
demodel.SeparateDistribution = 0;//
demodel.SeparateDistributionType = 1;
demodel.SeparateDistributionMoneyType = 2;
demodel.EnjoyMember = 1;
demodel.SeparateSetMember = 0;
demodel.IsQuickBuy = 1;
demodel.FullNumPinkage = 0;
demodel.FullMoneyPinkage = 0;
demodel.SupplierId = 0;
demodel.Sort = 1;
demodel.Commission = 0;
demodel.SendArea = "";
demodel.VideoType = 1;
demodel.GoodsPageType = 0;
demodel.IsNoTax = 0;
demodel.GoodsCountry = "";
demodel.FatCode = "";
demodel.GoodsUrl = "";
demodel.goodsLogo = "";
demodel.SeparateDistributionMoneyType ??= 1;
demodel.EnjoyMember ??= 2;
demodel.SeparateSetMember ??= 2;
demodel.IsQuickBuy ??= 2;
demodel.IsSellWell ??= 2;
demodel.GoodsType ??= OrderTypeEnum.Mall;
demodel.GoodsStatus ??= 2;
demodel.IsProxy ??= 2;
demodel.ProxyType ??= 1;
demodel.ProxyRises ??= 0;
demodel.ProxyMoney ??= 0;
demodel.IsProcurement = 2;//新增时
demodel.PresentFXGrade ??= 0;//赠送粉象等级
demodel.PresentFXMonth ??= 0;
demodel.Advertising ??= "";//广告词
demodel.SubName ??= "";//副标题
demodel.IsLiveGoods ??= 2;//是否直播商品 1是 2否
demodel.SendArea ??= "";//发货地
demodel.GoodsClassify = 0;
demodel.IntegralComment ??= 0;//评论反积分
demodel.IntegralCommentType ??= 1;
demodel.GoodsPageType ??= GoodsPageTypeEnum.All;
demodel.TenantId = Convert.ToInt32(Config.JHTenantId);
demodel.MallBaseId = Convert.ToInt32(Config.JHMallBaseId);
#region 商品规格信息
demodel.SpecificationList = new List<RB_Goods_Specification_Extend>();
demodel.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
RB_Goods_Specification_Extend modelSpecification = new RB_Goods_Specification_Extend
{
Id = 0,//暂定
EnabledImage = 2,
Name = "开班日期",
Sort = 1,
SpecificationValueList = new List<RB_Goods_SpecificationValue_Extend>()
};
//查询课程对应班级开课时间大于今天的班级
var classList = classRepository.GetClassAndCourseListRepository(new RB_Class_ViewModel { CouseId = model.CourseId, StartTime = System.DateTime.Now.ToString("yyyy-MM-dd") }).Where(x => x.ClassStatus == Common.Enum.Course.ClassStatusEnum.NonOpenClass && x.OpenTime > System.DateTime.Now).ToList();
if (classList != null && classList.Any())
{
int Sort = 1;
foreach (var item in classList)
{
RB_Goods_SpecificationValue_Extend modelSpecificationValue = new RB_Goods_SpecificationValue_Extend
{
Id = 0,
Image = "",
ImagePath = "",
Name = item.OpenTime.ToString("MM月dd日"),
Sort = Sort,///暂定1
ClassId = item.ClassId
};
modelSpecification.SpecificationValueList.Add(modelSpecificationValue);
RB_Goods_SpecificationPrice_Extend pModel = new RB_Goods_SpecificationPrice_Extend()
{
Commission = 0,
CostMoney = 0,
GoodsNumbers = item.ClassNo,
GoodsWeight = 0,
InventoryNum = item.ClassPersion - item.OrderStudentCount,//暂
SellingPrice = model.SellPrice,
SpecificationSort = Sort.ToString(),//暂定
AttrList = new object()
};
demodel.SpecificationPriceList.Add(pModel);
Sort += 1;
}
}
demodel.SpecificationList.Add(modelSpecification);
#endregion
if (demodel.Id == 0)//已存在,更新
{
demodel.Status = 0;
demodel.CreateDate = System.DateTime.Now;
demodel.UpdateDate = System.DateTime.Now;
goodsId = mallGoodsRepository.Insert(demodel);
if (goodsId > 0)
{
//插入分类
foreach (var item in model.CategoryList)
{
MallGoodsCategoryRepository.Insert(new RB_Goods_Category()
{
CategoryId = item.CategoryId,
CreateDate = demodel.CreateDate,
GoodsId = goodsId,
Id = 0,
MallBaseId = demodel.MallBaseId,
Status = 0,
TenantId = demodel.TenantId
});
}
}
}
else
{
//修改
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Goods.Name),demodel.Name},
{ nameof(RB_Goods.CarouselImage),demodel.CarouselImage},
{ nameof(RB_Goods.VideoAddress),demodel.VideoAddress},
{ nameof(RB_Goods.CustomShareTitles),demodel.CustomShareTitles},
{ nameof(RB_Goods.CustomShareImage),demodel.CustomShareImage},
{ nameof(RB_Goods.GoodsStatus),demodel.GoodsStatus},
{ nameof(RB_Goods.InventoryNum),demodel.InventoryNum},
{ nameof(RB_Goods.DefaultSpecificationName),demodel.DefaultSpecificationName},
{ nameof(RB_Goods.IsCustomSpecification),demodel.IsCustomSpecification},
{ nameof(RB_Goods.Sort),demodel.Sort},
{ nameof(RB_Goods.SellingPrice),demodel.SellingPrice},
{ nameof(RB_Goods.OriginalPrice),demodel.OriginalPrice},
{ nameof(RB_Goods.Unit),demodel.Unit},
{ nameof(RB_Goods.CostPrice),demodel.CostPrice},
{ nameof(RB_Goods.IsGoodsNegotiable),demodel.IsGoodsNegotiable},
{ nameof(RB_Goods.SalesNum),demodel.SalesNum},
{ nameof(RB_Goods.GoodsNumbers),demodel.GoodsNumbers},
{ nameof(RB_Goods.GoodsWeight),demodel.GoodsWeight},
{ nameof(RB_Goods.IsDefaultService),demodel.IsDefaultService},
{ nameof(RB_Goods.GoodsService),demodel.GoodsService},
{ nameof(RB_Goods.FreightId),demodel.FreightId},
{ nameof(RB_Goods.FormsId),demodel.FormsId},
{ nameof(RB_Goods.LimitBuyGoodsNum),demodel.LimitBuyGoodsNum},
{ nameof(RB_Goods.LimitBuyOrderNum),demodel.LimitBuyOrderNum},
{ nameof(RB_Goods.FullNumPinkage),demodel.FullNumPinkage},
{ nameof(RB_Goods.FullMoneyPinkage),demodel.FullMoneyPinkage},
{ nameof(RB_Goods.IsAreaBuy),demodel.IsAreaBuy},
{ nameof(RB_Goods.IntegralPresent),demodel.IntegralPresent},
{ nameof(RB_Goods.IntegralPresentType),demodel.IntegralPresentType},
{ nameof(RB_Goods.PointsDeduction),demodel.PointsDeduction},
{ nameof(RB_Goods.PointsDeductionType),demodel.PointsDeductionType},
{ nameof(RB_Goods.IsMultipleDeduction),demodel.IsMultipleDeduction},
{ nameof(RB_Goods.GoodsDetails),demodel.GoodsDetails},
{ nameof(RB_Goods.UpdateDate),demodel.UpdateDate},
{ nameof(RB_Goods.SeparateDistribution),demodel.SeparateDistribution},
{ nameof(RB_Goods.SeparateDistributionType),demodel.SeparateDistributionType},
{ nameof(RB_Goods.SeparateDistributionMoneyType),demodel.SeparateDistributionMoneyType},
{ nameof(RB_Goods.EnjoyMember),demodel.EnjoyMember},
{ nameof(RB_Goods.SeparateSetMember),demodel.SeparateSetMember},
{ nameof(RB_Goods.IsQuickBuy),demodel.IsQuickBuy},
{ nameof(RB_Goods.SupplierId),demodel.SupplierId},
{ nameof(RB_Goods.IsProxy),demodel.IsProxy},
{ nameof(RB_Goods.ProxyType),demodel.ProxyType},
{ nameof(RB_Goods.ProxyRises),demodel.ProxyRises},
{ nameof(RB_Goods.ProxyMoney),demodel.ProxyMoney},
{ nameof(RB_Goods.Commission),demodel.Commission},
{ nameof(RB_Goods.PresentFXGrade),demodel.PresentFXGrade},
{ nameof(RB_Goods.PresentFXMonth),demodel.PresentFXMonth},
{ nameof(RB_Goods.Advertising),demodel.Advertising},
{ nameof(RB_Goods.SubName),demodel.SubName},
{ nameof(RB_Goods.MarketingLogo),demodel.MarketingLogo},
{ nameof(RB_Goods.IsLiveGoods),demodel.IsLiveGoods},
{ nameof(RB_Goods.ShelvesDate),demodel.ShelvesDate },
{ nameof(RB_Goods.DownDate),demodel.DownDate },
{ nameof(RB_Goods.SendArea),demodel.SendArea },
{ nameof(RB_Goods.VideoType),demodel.VideoType },
{ nameof(RB_Goods.IntegralComment),demodel.IntegralComment },
{ nameof(RB_Goods.IntegralCommentType),demodel.IntegralCommentType },
{ nameof(RB_Goods.Remark),demodel.Remark },
{ nameof(RB_Goods.GoodsPageType),demodel.GoodsPageType },
{ nameof(RB_Goods.IsNoTax),demodel.IsNoTax },
{ nameof(RB_Goods.MinProfitRate),demodel.MinProfitRate },
{ nameof(RB_Goods.GoodsCountry),demodel.GoodsCountry },
{ nameof(RB_Goods.FatCode),demodel.FatCode },
{ nameof(RB_Goods.GoodsUrl),demodel.GoodsUrl },
{ nameof(RB_Goods.goodsLogo),demodel.goodsLogo },
};
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(RB_Goods.Id),
FiledValue=demodel.Id,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper()
{
FiledName=nameof(RB_Goods.TenantId),
FiledValue=demodel.TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper()
{
FiledName=nameof(RB_Goods.MallBaseId),
FiledValue=demodel.MallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = mallGoodsRepository.Update(keyValues, wheres);
if (flag)
{
#region 删除规格
var slist = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var svlist = goods_SpecificationValueRepository.GetList(new RB_Goods_SpecificationValue_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var splist = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
if (slist != null && slist.Any())
{
//删除后新增
goods_SpecificationRepository.DeleteBatch(slist);
}
if (svlist != null && svlist.Any())
{
goods_SpecificationValueRepository.DeleteBatch(svlist);
}
if (splist != null && splist.Any())
{
goods_SpecificationPriceRepository.DeleteBatch(splist);
}
#endregion
#region 修改分类
var clist = MallGoodsCategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var insertList = model.CategoryList.Where(x => !clist.Select(y => y.CategoryId).Contains(x.CategoryId)).ToList();
var deleteList = clist.Where(x => !model.CategoryList.Select(y => y.CategoryId).Contains(x.CategoryId)).ToList();
foreach (var item in insertList)
{
MallGoodsCategoryRepository.Insert(new RB_Goods_Category()
{
CategoryId = item.CategoryId,
CreateDate = demodel.CreateDate,
GoodsId = demodel.Id,
Id = 0,
MallBaseId = demodel.MallBaseId,
Status = 0,
TenantId = demodel.TenantId
});
}
foreach (var item in deleteList)
{
MallGoodsCategoryRepository.Delete(item.Id);
}
#endregion
}
goodsId = demodel.Id;
}
//插入规格
if (demodel.IsCustomSpecification == 1)
{
foreach (var item in demodel.SpecificationList)
{
int sid = goods_SpecificationRepository.Insert(new RB_Goods_Specification()
{
CreateDate = demodel.CreateDate,
EnabledImage = item.EnabledImage,
GoodsId = goodsId,
Id = 0,
MallBaseId = demodel.MallBaseId,
Name = item.Name,
Sort = item.Sort,
Status = 0,
TenantId = demodel.TenantId
});
if (sid > 0)
{
foreach (var qitem in item.SpecificationValueList)
{
goods_SpecificationValueRepository.Insert(new RB_Goods_SpecificationValue()
{
CreateDate = demodel.CreateDate,
GoodsId = goodsId,
Id = 0,
Image = qitem.Image,
MallBaseId = demodel.MallBaseId,
Name = qitem.Name,
Sort = qitem.Sort,
Status = 0,
TenantId = demodel.TenantId,
SpecificationId = sid,
ClassId = qitem.ClassId
});
}
}
}
foreach (var item in demodel.SpecificationPriceList)
{
goods_SpecificationPriceRepository.Insert(new RB_Goods_SpecificationPrice()
{
CreateDate = demodel.CreateDate,
GoodsId = goodsId,
Id = 0,
GoodsNumbers = item.GoodsNumbers,
GoodsWeight = item.GoodsWeight,
InventoryNum = item.InventoryNum,
MallBaseId = demodel.MallBaseId,
SellingPrice = item.SellingPrice,
SpecificationSort = item.SpecificationSort,
Status = 0,
TenantId = demodel.TenantId,
UpdateDate = System.DateTime.Now,
Commission = item.Commission,
CostMoney = item.CostMoney
});
}
}
#region 商品优惠价格
var oldList = MallGoodsPreferentialRepository.GetGoodsPreferentialListRepostory(new RB_Goods_Preferential_Extend() { GoodsId = goodsId });
List<RB_Goods_Preferential_Extend> goodsPreferentialLsit = new List<RB_Goods_Preferential_Extend>();
if (model.PreferentialList != null && model.PreferentialList.Any())
{
foreach (var item in model.PreferentialList)
{
RB_Goods_Preferential_Extend goodsPreferential = new RB_Goods_Preferential_Extend()
{
Id = 0,
GoodsId = goodsId,
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)
{
MallGoodsPreferentialRepository.Insert(item);
}
}
//原来有优惠数据
else
{
if (model.PreferentialList == null || (model.PreferentialList != null && model.PreferentialList.Count == 0))
{
MallGoodsPreferentialRepository.DeleteGoodsPreferentialRepostory(goodsId);
}
else
{
//找出差异的数据
var deleteList = oldList.Where(qitem => !goodsPreferentialLsit.Any(oldItem => qitem.PriceDiscountType == oldItem.PriceDiscountType)).ToList();
foreach (var dItem in deleteList)
{
if (dItem.Id > 0)
{
MallGoodsPreferentialRepository.Delete(dItem.Id);
}
}
foreach (var priceItem in goodsPreferentialLsit)
{
var nowItem = oldList.Where(x => x.PriceDiscountType == priceItem.PriceDiscountType).FirstOrDefault();
if (nowItem != null && nowItem.Id > 0)
{
priceItem.Id = nowItem.Id;
}
if (priceItem.Id == 0)
{
MallGoodsPreferentialRepository.Insert(priceItem);
}
else
{
MallGoodsPreferentialRepository.Update(priceItem);
}
}
}
}
#endregion
return goodsId;
}
/// <summary> /// <summary>
/// 更新商品的售价-卖价;原价-基础收费以及优惠政策 /// 更新商品的售价-卖价;原价-基础收费以及优惠政策
...@@ -2478,99 +1946,9 @@ namespace Edu.Module.Course ...@@ -2478,99 +1946,9 @@ namespace Edu.Module.Course
/// <returns></returns> /// <returns></returns>
public bool UpdateMallGoodsPrice(RB_Course_ViewModel courseModel, List<RB_Course_Preferential_Extend> list) public bool UpdateMallGoodsPrice(RB_Course_ViewModel courseModel, List<RB_Course_Preferential_Extend> list)
{ {
bool flag = false; bool flag = courseRepository.UpdateMallGoodsPriceRepository(courseModel, list);
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 });
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()
{
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);
}
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);
}
if (oldList == null || !oldList.Any())
{
foreach (var item in goodsPreferentialLsit)
{
flag = MallGoodsPreferentialRepository.Insert(item) > 0;
}
}
//原来有优惠数据
else
{
if (list == null || (list != null && list.Count == 0))
{
flag = MallGoodsPreferentialRepository.DeleteGoodsPreferentialRepostory(courseModel.MallGoodsId);
}
else
{
//找出差异的数据
var deleteList = oldList.Where(qitem => !goodsPreferentialLsit.Any(oldItem => qitem.PriceDiscountType == oldItem.PriceDiscountType)).ToList();
foreach (var dItem in deleteList)
{
if (dItem.Id > 0)
{
flag = MallGoodsPreferentialRepository.Delete(dItem.Id) > 0;
}
}
foreach (var priceItem in goodsPreferentialLsit)
{
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; return flag;
} }
#endregion #endregion
} }
} }
\ No newline at end of file
...@@ -401,7 +401,8 @@ namespace Edu.Module.Course ...@@ -401,7 +401,8 @@ namespace Edu.Module.Course
DeductionMoney = DeductionMoney, DeductionMoney = DeductionMoney,
OpenBonus = IsOpenOrder > 0 ? item.OpenBonus : 0, OpenBonus = IsOpenOrder > 0 ? item.OpenBonus : 0,
ClueNum = ClueCount, ClueNum = ClueCount,
ClueNumSalary = ClueCount > 5 ? item.ClueNumSalary : 0, //HK 03-21注释掉线索奖金
//ClueNumSalary = ClueCount > 5 ? item.ClueNumSalary : 0,
IsIssue = 0 IsIssue = 0
}; };
pModel.IsReach = pModel.CurOrderMoney > item.MonthGoalMoney ? 1 : 0; pModel.IsReach = pModel.CurOrderMoney > item.MonthGoalMoney ? 1 : 0;
......
...@@ -1615,81 +1615,6 @@ namespace Edu.Module.Course ...@@ -1615,81 +1615,6 @@ namespace Edu.Module.Course
return flag; return flag;
} }
/// <summary>
/// 更新订单提成比例
/// </summary>
/// <returns></returns>
public bool UpdateClassOrderCommissionRate()
{
var orderList = orderRepository.GetOrderListRepository(new RB_Order_ViewModel() { Group_Id = 100000, OrderType = OrderTypeEnum.CourseOrder, Q_OrderState = 1 });
foreach (var item in orderList)
{
//根据班级查询课程
var classModel = classRepository.GetEntity(item.ClassId);
#region 计算订单优惠信息
//获取课程优惠
var coursePreferentialList = course_PreferentialRepository.GetCoursePreferentialListRepostory(new RB_Course_Preferential_Extend()
{
CourseId = classModel.CouseId
});
//课程优惠信息
RB_Course_Preferential_Extend coursePreferentialModel = null;
if (coursePreferentialList != null && coursePreferentialList.Count > 0)
{
if (item.RenewOrderId > 0 && coursePreferentialList.Where(x => x.PriceDiscountType == CoursePriceDiscountEnum.Renewal).Any())
{
coursePreferentialModel = coursePreferentialList?.Where(qitem => qitem.PriceDiscountType == CoursePriceDiscountEnum.Renewal)?.FirstOrDefault();
}
if (coursePreferentialModel == null)
{
if (item.GuestNum == 1)
{
coursePreferentialModel = coursePreferentialList?.Where(qitem => qitem.PriceDiscountType == CoursePriceDiscountEnum.SingleJoin)?.FirstOrDefault();
}
if (item.GuestNum >= 2)
{
coursePreferentialModel = coursePreferentialList?.Where(qitem => qitem.PriceDiscountType == CoursePriceDiscountEnum.DoubleJoin)?.FirstOrDefault();
}
}
if (coursePreferentialModel == null)
{
//随便取一个了
coursePreferentialModel = coursePreferentialList.FirstOrDefault();
}
#region 记录提成信息
item.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0;
item.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0;
item.CommissionTypeTH = coursePreferentialModel?.B2BCommissionType ?? 0;
item.CommissionRateTH = coursePreferentialModel?.B2BCommissionMoney ?? 0;
if (coursePreferentialModel != null)
{
item.CommissionRemark = "初始化使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + item.CommissionType + " 返佣比例/金额:" + item.CommissionRate + " 同行返佣类型:" + item.CommissionTypeTH + " 同行返佣比例/金额:" + item.CommissionRateTH;
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Order_ViewModel.CommissionType),item.CommissionType},
{ nameof(RB_Order_ViewModel.CommissionRate),item.CommissionRate},
{ nameof(RB_Order_ViewModel.CommissionTypeTH),item.CommissionTypeTH},
{ nameof(RB_Order_ViewModel.CommissionRateTH),item.CommissionRateTH},
{ nameof(RB_Order_ViewModel.CommissionRemark),item.CommissionRemark},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Order_ViewModel.OrderId),
FiledValue=item.OrderId,
OperatorEnum=OperatorEnum.Equal
}
};
orderRepository.Update(keyValues, wheres);
#endregion
}
#endregion
}
return true;
}
/// <summary> /// <summary>
/// 留学就业下单 /// 留学就业下单
/// </summary> /// </summary>
...@@ -1883,8 +1808,6 @@ namespace Edu.Module.Course ...@@ -1883,8 +1808,6 @@ namespace Edu.Module.Course
}); });
} }
#endregion #endregion
//flag = false;
return flag; return flag;
} }
......
using Edu.AOP.CustomerAttribute; using Edu.AOP.CustomerAttribute;
using Edu.Common.Enum.Course;
using Edu.Common.Enum.Sale;
using Edu.Common.Plugin;
using Edu.Model.CacheModel;
using Edu.Model.Entity.Course;
using Edu.Model.Entity.EduTask; using Edu.Model.Entity.EduTask;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.Sell;
using Edu.Module.Course;
using Edu.Repository.Course; using Edu.Repository.Course;
using Edu.Repository.EduTask; using Edu.Repository.EduTask;
using Edu.Repository.Grade;
using Edu.Repository.Scroll;
using Edu.Repository.Sell;
using Edu.Repository.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB; using VT.FW.DB;
...@@ -22,6 +36,33 @@ namespace Edu.Module.EduTask ...@@ -22,6 +36,33 @@ namespace Edu.Module.EduTask
/// </summary> /// </summary>
private readonly RB_Education_ReceiptRepository education_ReceiptRepository = new RB_Education_ReceiptRepository(); private readonly RB_Education_ReceiptRepository education_ReceiptRepository = new RB_Education_ReceiptRepository();
/// <summary>
/// 课程仓储层对象
/// </summary>
public readonly RB_CourseRepository courseRepository = new RB_CourseRepository();
/// <summary>
/// 课程章节对象
/// </summary>
public readonly RB_Course_ChapterRepository course_ChapterRepository = new RB_Course_ChapterRepository();
/// <summary>
/// 上课时段
/// </summary>
private readonly RB_Scroll_CourseTimeRepository scroll_CourseTimeRepository = new RB_Scroll_CourseTimeRepository();
/// <summary>
/// 班级处理类对象
/// </summary>
private readonly ClassModule classModule = new ClassModule();
/// <summary>
/// 学生
/// </summary>
private readonly RB_StudentRepository studentRepository = new RB_StudentRepository();
private readonly OrderModule orderModule = new OrderModule();
/// <summary> /// <summary>
/// 新增修改停课申请 /// 新增修改停课申请
/// </summary> /// </summary>
...@@ -68,5 +109,251 @@ namespace Edu.Module.EduTask ...@@ -68,5 +109,251 @@ namespace Edu.Module.EduTask
} }
return flag; return flag;
} }
/// <summary>
/// Vip课程申请转订单
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public virtual bool SetCourseVipToOrderModule(RB_Course_Vip model, UserInfo userInfo)
{
bool flag = false;
if (model != null)
{
var courseModel = new RB_Course_ViewModel()
{
CourseId = 0,
CoverImg = "",
CourseName = model.CourseName,
CourseIntro = "",
CateId = 12,//日语VIP订制系列
OriginalPrice = model.CoursePrice,
SellPrice = model.CoursePrice,
ClassHours = model.TotalHour,
CourseTimeId = model.CourseTimeId,
};
courseModel.CreateBy = model.CreateBy;
courseModel.CreateTime = DateTime.Now;
courseModel.UpdateBy = model.CreateBy;
courseModel.UpdateTime = DateTime.Now;
courseModel.Group_Id = model.Group_Id;
courseModel.School_Id = 0;
courseModel.Status = Common.Enum.DateStateEnum.Normal;
courseModel.Teacher_Ids = "";
courseModel.IsShowChapterNo = 0;
courseModel.CourseFeature = "";
courseModel.IsOpenStepPrice = 0;
courseModel.IsRenew = 0;
courseModel.RenewOgPrice = 0;
courseModel.RenewSlPrice = 0;
courseModel.Saleplat = "1,2,3";
courseModel.IsKCourse = 0;
courseModel.CourseRate = CourseRateEnum.Advanced;
courseModel.CourseSubject = 1;
courseModel.B2BIcon = "";
courseModel.B2BBackground = "";
courseModel.CourseEmphasis = "";
courseModel.ContractInfo = "";
courseModel.IsScrollClass = 1;
courseModel.ScrollMinNum = 1;
courseModel.ScrollMaxNum = 1;
courseModel.OpenBankLevel = "[1,2,3,4,5,6]";
//价格设置
courseModel.CommissionReType = 2;
//直客首次和续费默认成0
courseModel.B2CRatio = 0;
courseModel.B2CReNewRatio = 0;
//首次 25%(同行) 15%(校代) 500(学员转介绍) 15%(内推) 0(直客)
//续费 5 %(同行) 5 %(校代) 0 (学员转介绍) 5% (内推) 0(直客)
courseModel.B2BRebateRatio = model.CoursePrice * Convert.ToDecimal(0.05);
courseModel.B2BRebateRatioType = CourseRebateSetEnum.NextMonth;
courseModel.B2BReNewRatio = model.CoursePrice * Convert.ToDecimal(0.05);
courseModel.B2BReNewRatioType = CourseRebateSetEnum.NextMonth;
courseModel.SchoolRebateRatio = model.CoursePrice * Convert.ToDecimal(0.15);
courseModel.SchoolRebateRatioType = CourseRebateSetEnum.NextMonth;
courseModel.SchoolReNewRatio = model.CoursePrice * Convert.ToDecimal(0.05);
courseModel.SchoolReNewRatioType = CourseRebateSetEnum.NextMonth;
courseModel.TransIntroductceRatio = 500;
courseModel.TransIntroductceRatioType = CourseRebateSetEnum.NextMonth;
courseModel.TransIntroductceReNewRatio = 0;
courseModel.TransIntroductceReNewRatioType = CourseRebateSetEnum.NextMonth;
courseModel.InnerRecommendRatio = model.CoursePrice * Convert.ToDecimal(0.15);
courseModel.InnerRecommendRatioType = CourseRebateSetEnum.NextMonth;
courseModel.InnerRecommendReNewRatio = model.CoursePrice * Convert.ToDecimal(0.05);
courseModel.InnerRecommendReNewRatioType = CourseRebateSetEnum.NextMonth;
courseModel.B2CRbRatio = 0;
courseModel.B2CRbRatioType = CourseRebateSetEnum.NextMonth;
courseModel.B2CRNRatio = 0;
courseModel.B2CRNRatioType = CourseRebateSetEnum.NextMonth;
flag = courseRepository.SetCourseRepository(courseModel, out int newCourseId);
//添加课程章节
if (flag)
{
var timeModel = scroll_CourseTimeRepository.GetList(new RB_Scroll_CourseTime_ViewModel()
{
CourseTimeIds = model.CourseTimeId.ToString()
})?.FirstOrDefault();
List<CourseTimeModel> timeList = new List<CourseTimeModel>();
decimal ClassHours = 0;
decimal StudyMinutes = 0;
if (timeModel != null && !string.IsNullOrEmpty(timeModel.Content))
{
timeList = JsonHelper.DeserializeObject<List<CourseTimeModel>>(timeModel.Content);
ClassHours = timeList?.FirstOrDefault()?.ClassHours ?? 2;
StudyMinutes = timeList?.FirstOrDefault()?.Minutes ?? 90;
}
decimal times = 0;
if (Convert.ToDecimal(model.TotalHour) % ClassHours == 0)
{
times = Convert.ToDecimal(model.TotalHour) % ClassHours;
}
else
{
times = Convert.ToDecimal(model.TotalHour) % ClassHours + 1;
}
var courseChapterList = new List<RB_Course_Chapter_ViewModel>();
for (var i = 0; i < times; i++)
{
int Num = Convert.ToInt32(i) + 1;
courseChapterList.Add(new RB_Course_Chapter_ViewModel()
{
ChapterId = 0,
CourseId = newCourseId,
ChapterNo = (Num).ToString(),
ChapterName = string.Format("第{0}次课", Num),
ChapterContent = "",
ParentId = 0,
OpenStatus = 1,
Progress = 0,
CreateBy = model.CreateBy,
CreateTime = DateTime.Now,
UpdateBy = model.CreateBy,
UpdateTime = DateTime.Now,
Status = Common.Enum.DateStateEnum.Normal,
OpenStart = DateTime.Now,
OpenEnd = DateTime.Now,
School_Id = 0,
Group_Id = model.Group_Id,
SortNum = Num,
StudyHours = Convert.ToDouble(ClassHours),
StudyMinutes = Convert.ToDouble(StudyMinutes),
Objectives = "",
Requirement = "",
CourseRate = CourseRateEnum.Advanced,
CurrentHours = 0,
ChapterGradeNo = 1,
});
}
if (courseChapterList != null && courseChapterList.Count > 0)
{
flag = course_ChapterRepository.SetBatchInsertCourseChapterRepository(courseChapterList);
}
}
RB_Class_ViewModel classModel = new RB_Class_ViewModel();
//添加班级
if (flag)
{
classModel.CreateBy = userInfo.Id;
classModel.CreateTime = DateTime.Now;
classModel.UpdateBy = userInfo.Id;
classModel.UpdateTime = DateTime.Now;
classModel.Group_Id = userInfo.Group_Id;
classModel.ClassName = model.CourseName;
classModel.CouseId = newCourseId;
classModel.ClassPersion = 9999;
classModel.OpenTime = DateTime.Now;
classModel.EndOrderTime = DateTime.Now;
classModel.OriginalPrice = 0;
classModel.SellPrice = model.CoursePrice;
classModel.IsStepPrice = 0;
classModel.ClassRoomId = 0;
classModel.IsOpenCommission = 0;
classModel.CommissionType = 0;
classModel.CommissionValue = 0;
classModel.ClassHours = model.TotalHour;
classModel.ClassStyle = 0;
classModel.ClassStatus = ClassStatusEnum.StudyIng;
classModel.InnerRemark = "";
classModel.OutRemark = "";
classModel.School_Id = 0;
classModel.ClassType = 0;
classModel.IsSubscribe = 0;
classModel.IsDeduction = 0;
classModel.Point = 0;
classModel.CourseClassType = 0;
classModel.StudentNumType = 0;
classModel.ClassHourMinute = 0;
classModel.ClassScrollType = 2;
classModel.ScrollMonth = DateTime.Now.ToString("yyyy-MM");
flag = classModule.SetClassModule(classModel);
}
//添加订单
if (flag)
{
var stuModel = studentRepository.GetEntity(model.StuId);
RB_Order_ViewModel demodel = new RB_Order_ViewModel()
{
OrderId = 0,
ClassId = classModel.ClassId,
GuestNum = 1,
OrderSource = 0,
OrderType = OrderTypeEnum.CourseOrder,
PreferPrice = model.CoursePrice,
SaleRemark = model.Remarks,
SourceId = 0,
Unit_Price = model.CoursePrice,
HelpEnterId = 0,
GeneralOccupation = "",
EduOccupation = "",
OrderNature = 0,
OldPreferPrice = 0,
CourseId = newCourseId,
StartClassHours = 0,
JoinType = OrderJoinTypeEnum.Normal,
TargetJoinType = OrderJoinTypeEnum.Normal,
StuIds = model.StuId.ToString(),
OrderIdentify = 2,
EnterID = model.CreateBy,
ScrollSchoolId = 0
};
if (stuModel != null && stuModel.CreateType == Common.Enum.User.StuCreateTypeEnum.CustomerInput)
{
demodel.CustomerId = stuModel.StuSourceId;
}
demodel.Group_Id = userInfo.Group_Id;
demodel.School_Id = userInfo.School_Id;
demodel.Dept_Id = userInfo.DeptId;
demodel.OrderForm = OrderFormEnum.Computer;
if (demodel.OrderType == OrderTypeEnum.CourseOrder && demodel.OrderIdentify != 2)
{
demodel.EnterID = userInfo.Id; //由前端传递了, 可能会不存在 (此字段为市场人员)
}
demodel.OrderState = OrderStateEnum.Normal;
demodel.TradeWay = TradeWayEnum.OnLine;
demodel.CreateBy = userInfo.Id;
demodel.CreateTime = DateTime.Now;
demodel.UpdateBy = userInfo.Id;
demodel.UpdateTime = DateTime.Now;
//userInfo, false, out message
flag = orderModule.SetClassOrderModule(demodel, userInfo, false, out string message);
}
}
return flag;
}
} }
} }
...@@ -822,6 +822,14 @@ namespace Edu.Module.EduTask ...@@ -822,6 +822,14 @@ namespace Edu.Module.EduTask
}; };
flag = contribute_InfoRepository.Update(fileds1, new WhereHelper(nameof(RB_Contribute_Info_ViewModel.Id), model.RelationId)); flag = contribute_InfoRepository.Update(fileds1, new WhereHelper(nameof(RB_Contribute_Info_ViewModel.Id), model.RelationId));
} }
if (model != null && model.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.VipCourse)
{
Dictionary<string, object> fileds1 = new Dictionary<string, object>()
{
{nameof(RB_Course_Vip_Extend.AuditStatus),(int)Common.Enum.WeChat.ContributeInfoStateEnum.Reject}
};
flag = course_VipRepository.Update(fileds1, new WhereHelper(nameof(RB_Course_Vip_Extend.Id), model.RelationId));
}
} }
return flag; return flag;
} }
...@@ -1084,8 +1092,6 @@ namespace Edu.Module.EduTask ...@@ -1084,8 +1092,6 @@ namespace Edu.Module.EduTask
}; };
flag = education_ReceiptRepository.Update(fileds, new WhereHelper(nameof(RB_Education_Receipt_ViewModel.Id), receipt.Id)); flag = education_ReceiptRepository.Update(fileds, new WhereHelper(nameof(RB_Education_Receipt_ViewModel.Id), receipt.Id));
flag = UpdateOtherModule(receipt, auditModel, user); flag = UpdateOtherModule(receipt, auditModel, user);
} }
//审核通过 //审核通过
else else
...@@ -1512,6 +1518,7 @@ namespace Edu.Module.EduTask ...@@ -1512,6 +1518,7 @@ namespace Edu.Module.EduTask
} }
} }
//订单转班
if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.OrderTransClass) if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.OrderTransClass)
{ {
if (auditModel.AuditStatus == 2) if (auditModel.AuditStatus == 2)
...@@ -1523,6 +1530,7 @@ namespace Edu.Module.EduTask ...@@ -1523,6 +1530,7 @@ namespace Edu.Module.EduTask
student_BackClassRepository.UpdateGuestStateRepository(receiptModel, auditModel); student_BackClassRepository.UpdateGuestStateRepository(receiptModel, auditModel);
} }
} }
//订单分拆
if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.OrderSplitClass) if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.OrderSplitClass)
{ {
if (auditModel.AuditStatus == 2) if (auditModel.AuditStatus == 2)
...@@ -1534,6 +1542,7 @@ namespace Edu.Module.EduTask ...@@ -1534,6 +1542,7 @@ namespace Edu.Module.EduTask
//student_BackClassRepository.UpdateGuestStateRepository(receiptModel, auditModel); //student_BackClassRepository.UpdateGuestStateRepository(receiptModel, auditModel);
} }
} }
//学生请假
if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.LeaveClass) if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.LeaveClass)
{ {
if (auditModel.AuditStatus == 2) if (auditModel.AuditStatus == 2)
...@@ -1541,6 +1550,7 @@ namespace Edu.Module.EduTask ...@@ -1541,6 +1550,7 @@ namespace Edu.Module.EduTask
studentLeaveRepository.UpdateStundetLeave(receiptModel.Id, user.Id); studentLeaveRepository.UpdateStundetLeave(receiptModel.Id, user.Id);
} }
} }
//组卷
if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.ZuJuan) if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.ZuJuan)
{ {
if (auditModel.AuditStatus == 2) if (auditModel.AuditStatus == 2)
...@@ -1562,6 +1572,7 @@ namespace Edu.Module.EduTask ...@@ -1562,6 +1572,7 @@ namespace Edu.Module.EduTask
flag = examination_PaperRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), receiptModel.RelationId)); flag = examination_PaperRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), receiptModel.RelationId));
} }
} }
//考试申请
if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.ExamApply) if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.ExamApply)
{ {
if (auditModel.AuditStatus == 2) if (auditModel.AuditStatus == 2)
...@@ -1583,6 +1594,7 @@ namespace Edu.Module.EduTask ...@@ -1583,6 +1594,7 @@ namespace Edu.Module.EduTask
} }
} }
//投稿
if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.Contribute) if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.Contribute)
{ {
if (auditModel.AuditStatus == 2) if (auditModel.AuditStatus == 2)
...@@ -1608,6 +1620,30 @@ namespace Edu.Module.EduTask ...@@ -1608,6 +1620,30 @@ namespace Edu.Module.EduTask
} }
} }
//vip课程申请
if (receiptModel.ReceiptType == Common.Enum.Finance.ReceiptTypeEnum.VipCourse)
{
if (auditModel.AuditStatus == 2)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_Vip_Extend.AuditStatus),(int)EduTaskRrocessStatus.AuditThrough},
};
flag = course_VipRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Vip_Extend.Id), receiptModel.RelationId));
var model = course_VipRepository.GetEntity(receiptModel.RelationId);
UserInfo userInfo = UserReidsCache.GetUserLoginInfo(model.CreateBy);
//申请转订单
new CourseVipModule().SetCourseVipToOrderModule(model, userInfo);
}
if (auditModel.AuditStatus == 3)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_Vip_Extend.AuditStatus),(int)EduTaskRrocessStatus.Rejected}
};
flag = course_VipRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Vip_Extend.Id), receiptModel.RelationId));
}
}
return flag; return flag;
} }
......
...@@ -5,6 +5,15 @@ using System.Linq; ...@@ -5,6 +5,15 @@ using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB.Dapper; using VT.FW.DB.Dapper;
using System; using System;
using VT.FW.DB;
using Edu.Model.Entity.Goods;
using Edu.Common.Plugin;
using Edu.Common.Enum.Mall;
using Edu.Common;
using Edu.Model.ViewModel.Mall;
using Edu.Model.ViewModel.Grade;
using Edu.Repository.Grade;
using Edu.Model.Entity.Mall;
namespace Edu.Repository.Course namespace Edu.Repository.Course
{ {
...@@ -13,6 +22,40 @@ namespace Edu.Repository.Course ...@@ -13,6 +22,40 @@ namespace Edu.Repository.Course
/// </summary> /// </summary>
public class RB_CourseRepository : BaseRepository<Model.Entity.Course.RB_Course> public class RB_CourseRepository : BaseRepository<Model.Entity.Course.RB_Course>
{ {
/// <summary>
/// 小程序对应的商品仓储对象
/// </summary>
private readonly Mall.RB_GoodsRepository mallGoodsRepository = new Mall.RB_GoodsRepository();
/// <summary>
/// 小程序对应的商品分类仓储对象
/// </summary>
private readonly Mall.RB_Goods_CategoryRepository MallGoodsCategoryRepository = new Mall.RB_Goods_CategoryRepository();
/// <summary>
/// 小程序对应的商品优惠仓储对象
/// </summary>
private readonly Mall.RB_Goods_PreferentialRepository MallGoodsPreferentialRepository = new Mall.RB_Goods_PreferentialRepository();
/// <summary>
/// 商品规格
/// </summary>
private readonly Mall.RB_Goods_SpecificationRepository goods_SpecificationRepository = new Mall.RB_Goods_SpecificationRepository();
/// <summary>
/// 商品规格值
/// </summary>
private readonly Mall.RB_Goods_SpecificationValueRepository goods_SpecificationValueRepository = new Mall.RB_Goods_SpecificationValueRepository();
/// <summary>
/// 商品规格价格
/// </summary>
private readonly Mall.RB_Goods_SpecificationPriceRepository goods_SpecificationPriceRepository = new Mall.RB_Goods_SpecificationPriceRepository();
/// <summary>
/// 班级仓储层对象
/// </summary>
private readonly RB_ClassRepository classRepository = new RB_ClassRepository();
/// <summary> /// <summary>
/// 获取课程列表 /// 获取课程列表
/// </summary> /// </summary>
...@@ -213,5 +256,641 @@ WHERE 1=1 ...@@ -213,5 +256,641 @@ WHERE 1=1
var obj = ExecuteScalar(sql); var obj = ExecuteScalar(sql);
return obj != null ? Convert.ToInt32(obj) : 0; return obj != null ? Convert.ToInt32(obj) : 0;
} }
/// <summary>
/// 新增修改课程
/// </summary>
/// <param name="model"></param>
/// <param name="courseId"></param>
/// <returns></returns>
public bool SetCourseRepository(RB_Course_ViewModel model, out int courseId)
{
bool flag;
if (model.IsRenew == 0)
{
model.RenewOgPrice = 0;
model.RenewSlPrice = 0;
}
if (model.CourseId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_ViewModel.CoverImg),model.CoverImg },
{nameof(RB_Course_ViewModel.CourseName),model.CourseName },
{nameof(RB_Course_ViewModel.CourseIntro),model.CourseIntro },
{nameof(RB_Course_ViewModel.CateId),model.CateId },
{nameof(RB_Course_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Course_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Course_ViewModel.Teacher_Ids),model.Teacher_Ids },
{nameof(RB_Course_ViewModel.CourseFeature),model.CourseFeature },
{nameof(RB_Course_ViewModel.IsOpenStepPrice),model.IsOpenStepPrice },
{nameof(RB_Course_ViewModel.IsRenew),model.IsRenew },
{nameof(RB_Course_ViewModel.RenewOgPrice),model.RenewOgPrice },
{nameof(RB_Course_ViewModel.RenewSlPrice),model.RenewSlPrice },
{nameof(RB_Course_ViewModel.Saleplat),model.Saleplat },
{nameof(RB_Course_ViewModel.IsKCourse),model.IsKCourse },
{nameof(RB_Course_ViewModel.ClassHours),model.ClassHours },
{nameof(RB_Course_ViewModel.CourseRate),model.CourseRate },
{nameof(RB_Course_ViewModel.CourseSubject),model.CourseSubject },
{nameof(RB_Course_ViewModel.B2BIcon),model.B2BIcon },
{nameof(RB_Course_ViewModel.B2BBackground),model.B2BBackground },
{nameof(RB_Course_ViewModel.CourseEmphasis),model.CourseEmphasis },
{nameof(RB_Course_ViewModel.ContractInfo),model.ContractInfo },
{nameof(RB_Course_ViewModel.IsScrollClass),model.IsScrollClass },
{nameof(RB_Course_ViewModel.ScrollMinNum),model.ScrollMinNum },
{nameof(RB_Course_ViewModel.ScrollMaxNum),model.ScrollMaxNum },
{nameof(RB_Course_ViewModel.CourseTimeId),model.CourseTimeId },
{nameof(RB_Course_ViewModel.OpenBankLevel),model.OpenBankLevel },
};
flag = base.Update(fileds, new WhereHelper(nameof(RB_Course_ViewModel.CourseId), model.CourseId));
}
else
{
var newId = base.Insert(model);
model.CourseId = newId;
flag = newId > 0;
}
courseId = model.CourseId;
if (model.SalePlatList != null && model.SalePlatList.Any(x => x == 4))//上架小程序端,则要同步到小程序
{
int GoodsId = SetMallGoodsRepository(model);//新增字段保存返回电商商品ID
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_ViewModel.MallGoodsId),GoodsId },
};
flag = base.Update(fileds, new WhereHelper(nameof(RB_Course_ViewModel.CourseId), model.CourseId));
}
if (model.MallGoodsId > 0 && !model.SalePlatList.Any(x => x == 4))//之前上架了小程序端,现在取消了则下架商品
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(Model.Entity.Mall.RB_Goods.GoodsStatus),2 },
};
mallGoodsRepository.Update(fileds, new WhereHelper(nameof(Model.Entity.Mall.RB_Goods.Id), model.MallGoodsId));
}
return flag;
}
/// <summary>
/// 新增商城商品
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int SetMallGoodsRepository(RB_Course_ViewModel model)
{
int goodsId = 0;
RB_Goods_Extend demodel = new RB_Goods_Extend();
if (model.MallGoodsId > 0)
{
demodel = mallGoodsRepository.GetGoodsList(new RB_Goods_Extend { Id = model.MallGoodsId }).FirstOrDefault();
if (demodel == null || demodel.Id == 0)//不存在
{
demodel = new RB_Goods_Extend();
}
}
demodel.CarouselImageList = new List<RB_ImageCommonModel>();
if (!string.IsNullOrWhiteSpace(model.CoverImg))
{
demodel.CarouselImageList.Add(new RB_ImageCommonModel
{
Id = 0,
Name = "",
Path = model.CoverImg,
Type = 0
});
demodel.CarouselImage = JsonHelper.Serialize(demodel.CarouselImageList.Select(x => x.Path));
}
demodel.Name = model.CourseName;
demodel.Remark ??= model.CourseFeature;
demodel.VideoAddress = "";
demodel.CustomShareTitles = "";
demodel.CustomShareImage = "";
demodel.GoodsStatus = 1;
demodel.InventoryNum = 100;//
demodel.DefaultSpecificationName = "";
demodel.SellingPrice = model.SellPrice;
demodel.OriginalPrice = model.OriginalPrice;
demodel.Unit = "课";//
demodel.CostPrice = 0;//
demodel.IsGoodsNegotiable = 0;
demodel.SalesNum = 0;
demodel.GoodsNumbers = "";
demodel.IsCustomSpecification = 1;//
demodel.GoodsWeight = 0;
demodel.IsDefaultService = 1;
demodel.FreightId = -1;
demodel.FormsId = 1;
demodel.LimitBuyGoodsNum = -1;
demodel.LimitBuyOrderNum = -1;
demodel.IsAreaBuy = 0;
demodel.IntegralPresent = 0;
demodel.IntegralPresentType = 2;
demodel.PointsDeduction = 0;
demodel.PointsDeductionType = 2;
demodel.IsMultipleDeduction = 2;
demodel.GoodsDetails = model.CourseIntro;
demodel.SeparateDistribution = 0;//
demodel.SeparateDistributionType = 1;
demodel.SeparateDistributionMoneyType = 2;
demodel.EnjoyMember = 1;
demodel.SeparateSetMember = 0;
demodel.IsQuickBuy = 1;
demodel.FullNumPinkage = 0;
demodel.FullMoneyPinkage = 0;
demodel.SupplierId = 0;
demodel.Sort = 1;
demodel.Commission = 0;
demodel.SendArea = "";
demodel.VideoType = 1;
demodel.GoodsPageType = 0;
demodel.IsNoTax = 0;
demodel.GoodsCountry = "";
demodel.FatCode = "";
demodel.GoodsUrl = "";
demodel.goodsLogo = "";
demodel.SeparateDistributionMoneyType ??= 1;
demodel.EnjoyMember ??= 2;
demodel.SeparateSetMember ??= 2;
demodel.IsQuickBuy ??= 2;
demodel.IsSellWell ??= 2;
demodel.GoodsType ??= OrderTypeEnum.Mall;
demodel.GoodsStatus ??= 2;
demodel.IsProxy ??= 2;
demodel.ProxyType ??= 1;
demodel.ProxyRises ??= 0;
demodel.ProxyMoney ??= 0;
demodel.IsProcurement = 2;//新增时
demodel.PresentFXGrade ??= 0;//赠送粉象等级
demodel.PresentFXMonth ??= 0;
demodel.Advertising ??= "";//广告词
demodel.SubName ??= "";//副标题
demodel.IsLiveGoods ??= 2;//是否直播商品 1是 2否
demodel.SendArea ??= "";//发货地
demodel.GoodsClassify = 0;
demodel.IntegralComment ??= 0;//评论反积分
demodel.IntegralCommentType ??= 1;
demodel.GoodsPageType ??= GoodsPageTypeEnum.All;
demodel.TenantId = Convert.ToInt32(Config.JHTenantId);
demodel.MallBaseId = Convert.ToInt32(Config.JHMallBaseId);
#region 商品规格信息
demodel.SpecificationList = new List<RB_Goods_Specification_Extend>();
demodel.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
RB_Goods_Specification_Extend modelSpecification = new RB_Goods_Specification_Extend
{
Id = 0,//暂定
EnabledImage = 2,
Name = "开班日期",
Sort = 1,
SpecificationValueList = new List<RB_Goods_SpecificationValue_Extend>()
};
//查询课程对应班级开课时间大于今天的班级
var classList = classRepository.GetClassAndCourseListRepository(new RB_Class_ViewModel { CouseId = model.CourseId, StartTime = DateTime.Now.ToString("yyyy-MM-dd") }).Where(x => x.ClassStatus == Common.Enum.Course.ClassStatusEnum.NonOpenClass && x.OpenTime > DateTime.Now).ToList();
if (classList != null && classList.Any())
{
int Sort = 1;
foreach (var item in classList)
{
RB_Goods_SpecificationValue_Extend modelSpecificationValue = new RB_Goods_SpecificationValue_Extend
{
Id = 0,
Image = "",
ImagePath = "",
Name = item.OpenTime.ToString("MM月dd日"),
Sort = Sort,///暂定1
ClassId = item.ClassId
};
modelSpecification.SpecificationValueList.Add(modelSpecificationValue);
RB_Goods_SpecificationPrice_Extend pModel = new RB_Goods_SpecificationPrice_Extend()
{
Commission = 0,
CostMoney = 0,
GoodsNumbers = item.ClassNo,
GoodsWeight = 0,
InventoryNum = item.ClassPersion - item.OrderStudentCount,//暂
SellingPrice = model.SellPrice,
SpecificationSort = Sort.ToString(),//暂定
AttrList = new object()
};
demodel.SpecificationPriceList.Add(pModel);
Sort += 1;
}
}
demodel.SpecificationList.Add(modelSpecification);
#endregion
if (demodel.Id == 0)//已存在,更新
{
demodel.Status = 0;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
goodsId = mallGoodsRepository.Insert(demodel);
if (goodsId > 0)
{
//插入分类
foreach (var item in model.CategoryList)
{
MallGoodsCategoryRepository.Insert(new RB_Goods_Category()
{
CategoryId = item.CategoryId,
CreateDate = demodel.CreateDate,
GoodsId = goodsId,
Id = 0,
MallBaseId = demodel.MallBaseId,
Status = 0,
TenantId = demodel.TenantId
});
}
}
}
else
{
//修改
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(Model.Entity.Mall.RB_Goods.Name),demodel.Name},
{ nameof(Model.Entity.Mall.RB_Goods.CarouselImage),demodel.CarouselImage},
{ nameof(Model.Entity.Mall.RB_Goods.VideoAddress),demodel.VideoAddress},
{ nameof(Model.Entity.Mall.RB_Goods.CustomShareTitles),demodel.CustomShareTitles},
{ nameof(Model.Entity.Mall.RB_Goods.CustomShareImage),demodel.CustomShareImage},
{ nameof(Model.Entity.Mall.RB_Goods.GoodsStatus),demodel.GoodsStatus},
{ nameof(Model.Entity.Mall.RB_Goods.InventoryNum),demodel.InventoryNum},
{ nameof(Model.Entity.Mall.RB_Goods.DefaultSpecificationName),demodel.DefaultSpecificationName},
{ nameof(Model.Entity.Mall.RB_Goods.IsCustomSpecification),demodel.IsCustomSpecification},
{ nameof(Model.Entity.Mall.RB_Goods.Sort),demodel.Sort},
{ nameof(Model.Entity.Mall.RB_Goods.SellingPrice),demodel.SellingPrice},
{ nameof(Model.Entity.Mall.RB_Goods.OriginalPrice),demodel.OriginalPrice},
{ nameof(Model.Entity.Mall.RB_Goods.Unit),demodel.Unit},
{ nameof(Model.Entity.Mall.RB_Goods.CostPrice),demodel.CostPrice},
{ nameof(Model.Entity.Mall.RB_Goods.IsGoodsNegotiable),demodel.IsGoodsNegotiable},
{ nameof(Model.Entity.Mall.RB_Goods.SalesNum),demodel.SalesNum},
{ nameof(Model.Entity.Mall.RB_Goods.GoodsNumbers),demodel.GoodsNumbers},
{ nameof(Model.Entity.Mall.RB_Goods.GoodsWeight),demodel.GoodsWeight},
{ nameof(Model.Entity.Mall.RB_Goods.IsDefaultService),demodel.IsDefaultService},
{ nameof(Model.Entity.Mall.RB_Goods.GoodsService),demodel.GoodsService},
{ nameof(Model.Entity.Mall.RB_Goods.FreightId),demodel.FreightId},
{ nameof(Model.Entity.Mall.RB_Goods.FormsId),demodel.FormsId},
{ nameof(Model.Entity.Mall.RB_Goods.LimitBuyGoodsNum),demodel.LimitBuyGoodsNum},
{ nameof(Model.Entity.Mall.RB_Goods.LimitBuyOrderNum),demodel.LimitBuyOrderNum},
{ nameof(Model.Entity.Mall.RB_Goods.FullNumPinkage),demodel.FullNumPinkage},
{ nameof(Model.Entity.Mall.RB_Goods.FullMoneyPinkage),demodel.FullMoneyPinkage},
{ nameof(Model.Entity.Mall.RB_Goods.IsAreaBuy),demodel.IsAreaBuy},
{ nameof(Model.Entity.Mall.RB_Goods.IntegralPresent),demodel.IntegralPresent},
{ nameof(Model.Entity.Mall.RB_Goods.IntegralPresentType),demodel.IntegralPresentType},
{ nameof(Model.Entity.Mall.RB_Goods.PointsDeduction),demodel.PointsDeduction},
{ nameof(Model.Entity.Mall.RB_Goods.PointsDeductionType),demodel.PointsDeductionType},
{ nameof(Model.Entity.Mall.RB_Goods.IsMultipleDeduction),demodel.IsMultipleDeduction},
{ nameof(Model.Entity.Mall.RB_Goods.GoodsDetails),demodel.GoodsDetails},
{ nameof(Model.Entity.Mall.RB_Goods.UpdateDate),demodel.UpdateDate},
{ nameof(Model.Entity.Mall.RB_Goods.SeparateDistribution),demodel.SeparateDistribution},
{ nameof(Model.Entity.Mall.RB_Goods.SeparateDistributionType),demodel.SeparateDistributionType},
{ nameof(Model.Entity.Mall.RB_Goods.SeparateDistributionMoneyType),demodel.SeparateDistributionMoneyType},
{ nameof(Model.Entity.Mall.RB_Goods.EnjoyMember),demodel.EnjoyMember},
{ nameof(Model.Entity.Mall.RB_Goods.SeparateSetMember),demodel.SeparateSetMember},
{ nameof(Model.Entity.Mall.RB_Goods.IsQuickBuy),demodel.IsQuickBuy},
{ nameof(Model.Entity.Mall.RB_Goods.SupplierId),demodel.SupplierId},
{ nameof(Model.Entity.Mall.RB_Goods.IsProxy),demodel.IsProxy},
{ nameof(Model.Entity.Mall.RB_Goods.ProxyType),demodel.ProxyType},
{ nameof(Model.Entity.Mall.RB_Goods.ProxyRises),demodel.ProxyRises},
{ nameof(Model.Entity.Mall.RB_Goods.ProxyMoney),demodel.ProxyMoney},
{ nameof(Model.Entity.Mall.RB_Goods.Commission),demodel.Commission},
{ nameof(Model.Entity.Mall.RB_Goods.PresentFXGrade),demodel.PresentFXGrade},
{ nameof(Model.Entity.Mall.RB_Goods.PresentFXMonth),demodel.PresentFXMonth},
{ nameof(Model.Entity.Mall.RB_Goods.Advertising),demodel.Advertising},
{ nameof(Model.Entity.Mall.RB_Goods.SubName),demodel.SubName},
{ nameof(Model.Entity.Mall.RB_Goods.MarketingLogo),demodel.MarketingLogo},
{ nameof(Model.Entity.Mall.RB_Goods.IsLiveGoods),demodel.IsLiveGoods},
{ nameof(Model.Entity.Mall.RB_Goods.ShelvesDate),demodel.ShelvesDate },
{ nameof(Model.Entity.Mall.RB_Goods.DownDate),demodel.DownDate },
{ nameof(Model.Entity.Mall.RB_Goods.SendArea),demodel.SendArea },
{ nameof(Model.Entity.Mall.RB_Goods.VideoType),demodel.VideoType },
{ nameof(Model.Entity.Mall.RB_Goods.IntegralComment),demodel.IntegralComment },
{ nameof(Model.Entity.Mall.RB_Goods.IntegralCommentType),demodel.IntegralCommentType },
{ nameof(Model.Entity.Mall.RB_Goods.Remark),demodel.Remark },
{ nameof(Model.Entity.Mall.RB_Goods.GoodsPageType),demodel.GoodsPageType },
{ nameof(Model.Entity.Mall.RB_Goods.IsNoTax),demodel.IsNoTax },
{ nameof(Model.Entity.Mall.RB_Goods.MinProfitRate),demodel.MinProfitRate },
{ nameof(Model.Entity.Mall.RB_Goods.GoodsCountry),demodel.GoodsCountry },
{ nameof(Model.Entity.Mall.RB_Goods.FatCode),demodel.FatCode },
{ nameof(Model.Entity.Mall.RB_Goods.GoodsUrl),demodel.GoodsUrl },
{ nameof(Model.Entity.Mall.RB_Goods.goodsLogo),demodel.goodsLogo },
};
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
FiledName=nameof(Model.Entity.Mall.RB_Goods.Id),
FiledValue=demodel.Id,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper()
{
FiledName=nameof(Model.Entity.Mall.RB_Goods.TenantId),
FiledValue=demodel.TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper()
{
FiledName=nameof(Model.Entity.Mall.RB_Goods.MallBaseId),
FiledValue=demodel.MallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = mallGoodsRepository.Update(keyValues, wheres);
if (flag)
{
#region 删除规格
var slist = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var svlist = goods_SpecificationValueRepository.GetList(new RB_Goods_SpecificationValue_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var splist = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
if (slist != null && slist.Any())
{
//删除后新增
goods_SpecificationRepository.DeleteBatch(slist);
}
if (svlist != null && svlist.Any())
{
goods_SpecificationValueRepository.DeleteBatch(svlist);
}
if (splist != null && splist.Any())
{
goods_SpecificationPriceRepository.DeleteBatch(splist);
}
#endregion
#region 修改分类
var clist = MallGoodsCategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsId = demodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var insertList = model.CategoryList.Where(x => !clist.Select(y => y.CategoryId).Contains(x.CategoryId)).ToList();
var deleteList = clist.Where(x => !model.CategoryList.Select(y => y.CategoryId).Contains(x.CategoryId)).ToList();
foreach (var item in insertList)
{
MallGoodsCategoryRepository.Insert(new RB_Goods_Category()
{
CategoryId = item.CategoryId,
CreateDate = demodel.CreateDate,
GoodsId = demodel.Id,
Id = 0,
MallBaseId = demodel.MallBaseId,
Status = 0,
TenantId = demodel.TenantId
});
}
foreach (var item in deleteList)
{
MallGoodsCategoryRepository.Delete(item.Id);
}
#endregion
}
goodsId = demodel.Id;
}
//插入规格
if (demodel.IsCustomSpecification == 1)
{
foreach (var item in demodel.SpecificationList)
{
int sid = goods_SpecificationRepository.Insert(new RB_Goods_Specification()
{
CreateDate = demodel.CreateDate,
EnabledImage = item.EnabledImage,
GoodsId = goodsId,
Id = 0,
MallBaseId = demodel.MallBaseId,
Name = item.Name,
Sort = item.Sort,
Status = 0,
TenantId = demodel.TenantId
});
if (sid > 0)
{
foreach (var qitem in item.SpecificationValueList)
{
goods_SpecificationValueRepository.Insert(new RB_Goods_SpecificationValue()
{
CreateDate = demodel.CreateDate,
GoodsId = goodsId,
Id = 0,
Image = qitem.Image,
MallBaseId = demodel.MallBaseId,
Name = qitem.Name,
Sort = qitem.Sort,
Status = 0,
TenantId = demodel.TenantId,
SpecificationId = sid,
ClassId = qitem.ClassId
});
}
}
}
foreach (var item in demodel.SpecificationPriceList)
{
goods_SpecificationPriceRepository.Insert(new RB_Goods_SpecificationPrice()
{
CreateDate = demodel.CreateDate,
GoodsId = goodsId,
Id = 0,
GoodsNumbers = item.GoodsNumbers,
GoodsWeight = item.GoodsWeight,
InventoryNum = item.InventoryNum,
MallBaseId = demodel.MallBaseId,
SellingPrice = item.SellingPrice,
SpecificationSort = item.SpecificationSort,
Status = 0,
TenantId = demodel.TenantId,
UpdateDate = DateTime.Now,
Commission = item.Commission,
CostMoney = item.CostMoney
});
}
}
#region 商品优惠价格
var oldList = MallGoodsPreferentialRepository.GetGoodsPreferentialListRepostory(new RB_Goods_Preferential_Extend() { GoodsId = goodsId });
List<RB_Goods_Preferential_Extend> goodsPreferentialLsit = new List<RB_Goods_Preferential_Extend>();
if (model.PreferentialList != null && model.PreferentialList.Any())
{
foreach (var item in model.PreferentialList)
{
RB_Goods_Preferential_Extend goodsPreferential = new RB_Goods_Preferential_Extend()
{
Id = 0,
GoodsId = goodsId,
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)
{
MallGoodsPreferentialRepository.Insert(item);
}
}
//原来有优惠数据
else
{
if (model.PreferentialList == null || (model.PreferentialList != null && model.PreferentialList.Count == 0))
{
MallGoodsPreferentialRepository.DeleteGoodsPreferentialRepostory(goodsId);
}
else
{
//找出差异的数据
var deleteList = oldList.Where(qitem => !goodsPreferentialLsit.Any(oldItem => qitem.PriceDiscountType == oldItem.PriceDiscountType)).ToList();
foreach (var dItem in deleteList)
{
if (dItem.Id > 0)
{
MallGoodsPreferentialRepository.Delete(dItem.Id);
}
}
foreach (var priceItem in goodsPreferentialLsit)
{
var nowItem = oldList.Where(x => x.PriceDiscountType == priceItem.PriceDiscountType).FirstOrDefault();
if (nowItem != null && nowItem.Id > 0)
{
priceItem.Id = nowItem.Id;
}
if (priceItem.Id == 0)
{
MallGoodsPreferentialRepository.Insert(priceItem);
}
else
{
MallGoodsPreferentialRepository.Update(priceItem);
}
}
}
}
#endregion
return goodsId;
}
/// <summary>
/// 更新商品的售价-卖价;原价-基础收费以及优惠政策
/// </summary>
/// <param name="courseModel"></param>
/// <param name="list"></param>
/// <returns></returns>
public bool UpdateMallGoodsPriceRepository(RB_Course_ViewModel courseModel, List<RB_Course_Preferential_Extend> list)
{
bool flag = false;
if (courseModel.MallGoodsId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(Model.Entity.Mall.RB_Goods.SellingPrice),courseModel.SellPrice },
{nameof(Model.Entity.Mall.RB_Goods.OriginalPrice),courseModel.OriginalPrice },
};
flag = mallGoodsRepository.Update(fileds, new WhereHelper(nameof(Model.Entity.Mall.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()
{
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);
}
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);
}
if (oldList == null || !oldList.Any())
{
foreach (var item in goodsPreferentialLsit)
{
flag = MallGoodsPreferentialRepository.Insert(item) > 0;
}
}
//原来有优惠数据
else
{
if (list == null || (list != null && list.Count == 0))
{
flag = MallGoodsPreferentialRepository.DeleteGoodsPreferentialRepostory(courseModel.MallGoodsId);
}
else
{
//找出差异的数据
var deleteList = oldList.Where(qitem => !goodsPreferentialLsit.Any(oldItem => qitem.PriceDiscountType == oldItem.PriceDiscountType)).ToList();
foreach (var dItem in deleteList)
{
if (dItem.Id > 0)
{
flag = MallGoodsPreferentialRepository.Delete(dItem.Id) > 0;
}
}
foreach (var priceItem in goodsPreferentialLsit)
{
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;
}
public List<RB_Goods_Category_Extend> GetGoodsCategoryListRepository(RB_Goods_Category_Extend query)
{
return MallGoodsCategoryRepository.GetList( query);
}
} }
} }
using Edu.Model.Entity.Course; using Edu.Common.Enum.Course;
using Edu.Common.Enum.Sale;
using Edu.Common.Plugin;
using Edu.Model.CacheModel;
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.Sell;
using Edu.Repository.Scroll;
using Edu.Repository.Sell;
using Edu.Repository.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
......
...@@ -13,6 +13,9 @@ using VT.FW.DB.Dapper; ...@@ -13,6 +13,9 @@ using VT.FW.DB.Dapper;
namespace Edu.Repository.Sell namespace Edu.Repository.Sell
{ {
/// <summary>
/// 订单返佣记录仓储层
/// </summary>
public class RB_Order_ReturnComissionRepository : BaseRepository<RB_Order_ReturnComission> public class RB_Order_ReturnComissionRepository : BaseRepository<RB_Order_ReturnComission>
{ {
/// <summary> /// <summary>
......
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