Commit c29729bc authored by 吴春's avatar 吴春

Merge branch 'sdzq-ld' of http://gitlab.oytour.com/Kui2/mall.oytour.com into sdzq

parents 310608fe c5d21b23
......@@ -3838,7 +3838,7 @@ namespace Mall.Module.Product
return ApiResult.Failed("商品服务类型不一致");
}
int uday = Convert.ToInt32((gmodel.UseDay ?? 0).Equals(0.5) ? 1 : (gmodel.UseDay ?? 0));
if (demodel.TripSTime.Value.AddDays(uday - 1) != demodel.TripETime)
if (demodel.TripSTime.Value.AddDays(uday - 1).ToString("yyyy-MM-dd") != demodel.TripETime.Value.ToString("yyyy-MM-dd"))
{
return ApiResult.Failed("预定日期与商品使用天数不一致");
}
......@@ -3854,6 +3854,8 @@ namespace Mall.Module.Product
item.CarColorId = gmodel.CarColorId;
item.CarNumber = gmodel.CarNumber;
item.LineName = gmodel.LineName;
item.Specification = "[]";
item.SpecificationSort = "0";
var tdlist = goods_TargetDateRepository.GetList(new RB_Goods_TargetDate_Extend() { GoodsId = item.GoodsId ?? 0, StartTime = item.TripSTime.Value.ToString("yyyy-MM-dd"), EndTime = item.TripETime.Value.ToString("yyyy-MM-dd") });
var targetList = tdlist.Where(x => x.IsReserve == 1 && x.Date == Convert.ToDateTime(demodel.TripSTime.Value.ToString("yyyy-MM-dd"))).ToList();
......@@ -5991,7 +5993,8 @@ namespace Mall.Module.Product
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_TargetDate.Id),
FiledValue=qitem
FiledValue=qitem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_TargetDateRepository.Update(keyValues1, wheres1, trans);
......@@ -6792,7 +6795,7 @@ namespace Mall.Module.Product
{
//剑鱼兄需求 2020=07-30 再查询一次商品表
string GoodsIds = string.Join(",", dlist.Select(x => x.GoodsId).Distinct());
var GList = goodsRepository.GetSingleListForGoodsSubName(new RB_Goods_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, GoodsIds = GoodsIds });
var GList = goodsRepository.GetSingleListForGoodsSubName(new RB_Goods_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, GoodsIds = GoodsIds }, true);
foreach (var item in dlist)
{
item.CoverImagePath = item.CoverImage;
......
......@@ -305,9 +305,12 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Extend> GetSingleListForGoodsSubName(RB_Goods_Extend dmodel)
public List<RB_Goods_Extend> GetSingleListForGoodsSubName(RB_Goods_Extend dmodel, bool IsSelectAll = false)
{
string where = $" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 and g.GoodsClassify=0";
string where = $" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 ";
if (IsSelectAll == false) {
where += $@" and g.GoodsClassify=0 ";
}
if (dmodel.TenantId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
......
......@@ -363,6 +363,95 @@ namespace Mall.WebApi.Controllers.MallBase
});
}
/// <summary>
/// 获取可预定日期列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsTargetDateList() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int DayType = parms.GetInt("DayType", 1);//类型 1时间范围 2按周 3按月份
string StartDate = parms.GetStringValue("StartDate");
string EndDate = parms.GetStringValue("EndDate");
string Year = parms.GetStringValue("Year");//年
string Month = parms.GetStringValue("Month");//月
int Week = parms.GetInt("Week", 1);//周几
List<string> DateList = new List<string>();
if (DayType == 1)
{
if (string.IsNullOrWhiteSpace(StartDate) || string.IsNullOrWhiteSpace(EndDate))
{
return ApiResult.Failed("请选完善时间段");
}
else
{
DateTime endDate = Convert.ToDateTime(EndDate);
for (DateTime dt = Convert.ToDateTime(StartDate); dt <= endDate;)
{
if (!DateList.Contains(dt.ToString("yyyy-MM-dd")))
{
DateList.Add(dt.ToString("yyyy-MM-dd"));
}
dt = dt.AddDays(1);
}
}
}
else if (DayType == 2)
{
if (string.IsNullOrWhiteSpace(Month))
{
return ApiResult.ParamIsNull("请选择月份");
}
DateTime StartTime = Convert.ToDateTime(Month + "-01");
DateTime EndTime = StartTime.AddMonths(1).AddDays(-1);
for (DateTime dt = StartTime; dt <= EndTime;)
{
if (!DateList.Contains(dt.ToString("yyyy-MM-dd")))
{
DateList.Add(dt.ToString("yyyy-MM-dd"));
}
dt = dt.AddDays(1);
}
}
else if (DayType == 3)
{
DateTime StartTime = DateTime.Now;
DateTime EndTime = DateTime.Now;
if (string.IsNullOrWhiteSpace(Year))
{
return ApiResult.ParamIsNull("请选择年份");
}
if (!string.IsNullOrWhiteSpace(Month))
{
StartTime = Convert.ToDateTime(Year + "-" + Month + "-01");
EndTime = StartTime.AddMonths(1).AddDays(-1);
}
else
{
StartTime = Convert.ToDateTime(Year + "-01" + "-01");
EndTime = StartTime.AddYears(1).AddDays(-1);
}
for (DateTime dt = StartTime; dt <= EndTime;)
{
//将日期转换为周几
DayOfWeek week = dt.DayOfWeek;
if (week == (DayOfWeek)Week)
{
if (!DateList.Contains(dt.ToString("yyyy-MM-dd")))
{
DateList.Add(dt.ToString("yyyy-MM-dd"));
}
}
dt = dt.AddDays(1);
}
}
return ApiResult.Success("", DateList);
}
/// <summary>
/// 获取服务类型枚举
/// </summary>
......@@ -462,6 +551,12 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.IsSpell ??= 1;
demodel.AdvanceDay ??= 0;
if (demodel.TargetDateList != null && demodel.TargetDateList.Any()) {
//去除重复
if (demodel.TargetDateList.Count() != demodel.TargetDateList.Select(x => x.Date).Distinct().Count()) {
return ApiResult.ParamIsNull("可预定日期有重复");
}
}
if (demodel.Id > 0)
{
string vmsg = guideCarModule.ValidateGoodsTargetDate(demodel.Id, demodel.TargetDateList);
......
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