|
@ -316,24 +316,36 @@ namespace BBWY.Server.Business |
|
|
if (prpt.Status != Enums.PromitionTaskStatus.等待 && prpt.Status != Enums.PromitionTaskStatus.进行中) |
|
|
if (prpt.Status != Enums.PromitionTaskStatus.等待 && prpt.Status != Enums.PromitionTaskStatus.进行中) |
|
|
throw new BusinessException("前置任务状态必须为等待或进行中"); |
|
|
throw new BusinessException("前置任务状态必须为等待或进行中"); |
|
|
|
|
|
|
|
|
|
|
|
var nextPromotionTaskList = fsql.Select<PromotionTask>().Where(pt1 => pt1.PreTaskId == request.PreTaskId).ToList(); |
|
|
|
|
|
if (nextPromotionTaskList.Count() > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
CheckSkuRepeat(pt, nextPromotionTaskList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fsql.Update<PromotionTask>(request.TaskId).Set(pt1 => pt1.PreTaskId, request.PreTaskId).ExecuteAffrows(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void CheckSkuRepeat(PromotionTask pt, IList<PromotionTask> waitCheckList) |
|
|
|
|
|
{ |
|
|
var ptSkuList = new List<string>(); |
|
|
var ptSkuList = new List<string>(); |
|
|
var prptSkuList = new List<string>(); |
|
|
var waitptSkuList = new List<string>(); |
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(pt.MainProductSku)) |
|
|
if (!string.IsNullOrEmpty(pt.MainProductSku)) |
|
|
ptSkuList.AddRange(pt.MainProductSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
ptSkuList.AddRange(pt.MainProductSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
if (!string.IsNullOrEmpty(pt.CustomMotherSku)) |
|
|
if (!string.IsNullOrEmpty(pt.CustomMotherSku)) |
|
|
ptSkuList.AddRange(pt.CustomMotherSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
ptSkuList.AddRange(pt.CustomMotherSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prpt.MainProductSku)) |
|
|
foreach (var waitPt in waitCheckList) |
|
|
prptSkuList.AddRange(prpt.MainProductSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
{ |
|
|
if (!string.IsNullOrEmpty(prpt.CustomMotherSku)) |
|
|
if (!string.IsNullOrEmpty(waitPt.MainProductSku)) |
|
|
prptSkuList.AddRange(prpt.CustomMotherSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
waitptSkuList.AddRange(waitPt.MainProductSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
|
|
|
if (!string.IsNullOrEmpty(waitPt.CustomMotherSku)) |
|
|
|
|
|
waitptSkuList.AddRange(waitPt.CustomMotherSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries)); |
|
|
|
|
|
|
|
|
var intersectSkuList = ptSkuList.Intersect(prptSkuList).ToList(); |
|
|
var intersectSkuList = ptSkuList.Intersect(waitptSkuList).ToList(); |
|
|
if (intersectSkuList != null && intersectSkuList.Count() > 0) |
|
|
if (intersectSkuList != null && intersectSkuList.Count() > 0) |
|
|
throw new BusinessException($"{string.Join(",", intersectSkuList)}存在重复"); |
|
|
throw new BusinessException($"任务1[{pt.ActivityName}]与任务2[{waitPt.ActivityName}]之间存在sku重复,{string.Join(",", intersectSkuList)}"); |
|
|
|
|
|
} |
|
|
fsql.Update<PromotionTask>(request.TaskId).Set(pt1 => pt1.PreTaskId, request.PreTaskId).ExecuteAffrows(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -842,11 +854,27 @@ namespace BBWY.Server.Business |
|
|
#region 开始后续任务
|
|
|
#region 开始后续任务
|
|
|
if (jobDoneTaskIdList.Count() > 0) |
|
|
if (jobDoneTaskIdList.Count() > 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
//var nextPromotionTaskList = fsql.Select<PromotionTask>().Where(pt => pt.ShopId == shopId &&
|
|
|
|
|
|
// pt.Status == Enums.PromitionTaskStatus.等待 &&
|
|
|
|
|
|
// jobDoneTaskIdList.Contains(pt.PreTaskId.Value)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//if (nextPromotionTaskList.Count() > 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// foreach (var task in nextPromotionTaskList)
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void AutoStart(long taskId, string appKey, string appSecret, string appToken) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void LogMonitorError(ShopResponse shop, string loggerName, string step, string error) |
|
|
private void LogMonitorError(ShopResponse shop, string loggerName, string step, string error) |
|
|
{ |
|
|
{ |
|
|
nLogManager.GetLogger(loggerName).Error($"{step},{error}"); |
|
|
nLogManager.GetLogger(loggerName).Error($"{step},{error}"); |
|
|