|
@ -109,6 +109,8 @@ namespace Coldairarrow.Business.HuiYan |
|
|
return Success(list.GroupBy(c => c).Select(c => new { Id = c.Key, Count = c.Count() })); |
|
|
return Success(list.GroupBy(c => c).Select(c => new { Id = c.Key, Count = c.Count() })); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input,string keyWord) |
|
|
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input,string keyWord) |
|
|
{ |
|
|
{ |
|
@ -271,6 +273,41 @@ namespace Coldairarrow.Business.HuiYan |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CheckIsMaxTaskCount() |
|
|
|
|
|
{ |
|
|
|
|
|
Expression<Func<teamitems, items, pricetasklog, TeamitemDto>> select = (a, b, c) => new TeamitemDto |
|
|
|
|
|
{ |
|
|
|
|
|
GoodsId = b.GoodsId, |
|
|
|
|
|
HasFilter = b.HasFilter, |
|
|
|
|
|
Platform = b.Platform, |
|
|
|
|
|
GoodsUrl = b.GoodsUrl, |
|
|
|
|
|
PriceTaskId = c.Id, |
|
|
|
|
|
PriceTaskState = (int)c.State, |
|
|
|
|
|
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson) |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
select = select.BuildExtendSelectExpre(); |
|
|
|
|
|
|
|
|
|
|
|
var q_titem = Db.GetIQueryable<teamitems>(); |
|
|
|
|
|
var q = from a in q_titem.AsExpandable() |
|
|
|
|
|
join b in Db.GetIQueryable<items>() on a.ItemId equals b.Id into ab |
|
|
|
|
|
from ba in ab.DefaultIfEmpty() |
|
|
|
|
|
join c in Db.GetIQueryable<pricetasklog>() on a.Id equals c.TeamItemId into ac |
|
|
|
|
|
from bb in ac.DefaultIfEmpty() |
|
|
|
|
|
select @select.Invoke(a, ba, bb); |
|
|
|
|
|
|
|
|
|
|
|
//查询对应状态
|
|
|
|
|
|
var where = LinqHelper.True<TeamitemDto>().And(c => c.PriceTaskUserId == _operator.UserId); |
|
|
|
|
|
|
|
|
|
|
|
where = where.And(c => c.PriceTaskState != null); |
|
|
|
|
|
|
|
|
|
|
|
var list = q.Where(where).Select(c => c.PriceTaskState).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
int? hasTaskCount = list.GroupBy(c => c).Select(c => new { Id = c.Key, Count = c.Count() }).Where(c => c.Id == 0).FirstOrDefault()?.Count; |
|
|
|
|
|
|
|
|
|
|
|
return hasTaskCount > 10; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public AjaxResult AcceptTask(string teamItemId) |
|
|
public AjaxResult AcceptTask(string teamItemId) |
|
|
{ |
|
|
{ |
|
|
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId); |
|
|
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId); |
|
@ -280,10 +317,7 @@ namespace Coldairarrow.Business.HuiYan |
|
|
return Error("任务不存在!"); |
|
|
return Error("任务不存在!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (CheckIsMaxTaskCount()) |
|
|
|
|
|
|
|
|
var nowCount = Db.GetIQueryable<pricetasklog>().Count(c => c.State== PriceTaskState.待比价 && c.UserId == _operator.UserId); |
|
|
|
|
|
if (nowCount >= 10) |
|
|
|
|
|
{ |
|
|
{ |
|
|
return Error("任务接取已达上限!"); |
|
|
return Error("任务接取已达上限!"); |
|
|
} |
|
|
} |
|
|