Browse Source

添加和修改任务接口支持设置前置任务

pjzs_starttask_update
sanji 1 year ago
parent
commit
bd40ec931f
  1. 23
      BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs

23
BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs

@ -177,11 +177,6 @@ namespace BBWY.Server.Business
if (string.IsNullOrEmpty(request.SimpleTitle)) if (string.IsNullOrEmpty(request.SimpleTitle))
throw new BusinessException("缺少精简标题"); throw new BusinessException("缺少精简标题");
} }
//else if (request.IsNewProduct == 0)
//{
// if (string.IsNullOrEmpty(request.FullTitle))
// throw new BusinessException("缺少完整标题");
//}
if (string.IsNullOrEmpty(request.ActivityName)) if (string.IsNullOrEmpty(request.ActivityName))
throw new BusinessException("缺少任务名称"); throw new BusinessException("缺少任务名称");
@ -204,7 +199,10 @@ namespace BBWY.Server.Business
request.CustomMotherSku = request.CustomMotherSku.Trim(); request.CustomMotherSku = request.CustomMotherSku.Trim();
if (!string.IsNullOrEmpty(request.MainProductGiftSku)) if (!string.IsNullOrEmpty(request.MainProductGiftSku))
request.MainProductGiftSku = request.MainProductGiftSku.Trim(); request.MainProductGiftSku = request.MainProductGiftSku.Trim();
if (request.PreTaskId == null)
request.PreTaskId = -1;
PromotionTask promotionTask = null;
if (request.Id == 0) if (request.Id == 0)
{ {
var relayAPIHost = GetPlatformRelayAPIHost(Enums.Platform.); var relayAPIHost = GetPlatformRelayAPIHost(Enums.Platform.);
@ -225,7 +223,7 @@ namespace BBWY.Server.Business
throw new BusinessException(spuResponse.Msg) { Code = spuResponse.Code }; throw new BusinessException(spuResponse.Msg) { Code = spuResponse.Code };
var sort = fsql.Select<PromotionTask>().Where(pt => pt.ShopId == request.ShopId).ToAggregate(p => p.Max(p.Key.Sort)); var sort = fsql.Select<PromotionTask>().Where(pt => pt.ShopId == request.ShopId).ToAggregate(p => p.Max(p.Key.Sort));
var promotionTask = new PromotionTask() promotionTask = new PromotionTask()
{ {
Id = idGenerator.NewLong(), Id = idGenerator.NewLong(),
ActivityName = request.ActivityName, ActivityName = request.ActivityName,
@ -254,14 +252,13 @@ namespace BBWY.Server.Business
} }
else else
{ {
var dbPromotionTask = fsql.Select<PromotionTask>(request.Id).ToOne(); promotionTask = fsql.Select<PromotionTask>(request.Id).ToOne();
if (dbPromotionTask == null) if (promotionTask == null)
throw new BusinessException("任务不存在"); throw new BusinessException("任务不存在");
if (dbPromotionTask.Status != Enums.PromitionTaskStatus.) if (promotionTask.Status != Enums.PromitionTaskStatus.)
throw new BusinessException("只能在任务处于等待状态时才能修改"); throw new BusinessException("只能在任务处于等待状态时才能修改");
request.Map(promotionTask);
request.Map(dbPromotionTask); fsql.Update<PromotionTask>().SetSource(promotionTask)
fsql.Update<PromotionTask>().SetSource(dbPromotionTask)
.IgnoreColumns(new string[] .IgnoreColumns(new string[]
{ {
"UpdateSortTime", "UpdateSortTime",
@ -276,6 +273,8 @@ namespace BBWY.Server.Business
}) })
.ExecuteAffrows(); .ExecuteAffrows();
} }
if (promotionTask.Status == Enums.PromitionTaskStatus.)
EditPreTask(new EditPreTaskRequest() { TaskId = promotionTask.Id, PreTaskId = request.PreTaskId.Value });
} }
/// <summary> /// <summary>

Loading…
Cancel
Save