|
|
@ -1,6 +1,8 @@ |
|
|
|
using Coldairarrow.Entity.DTO; |
|
|
|
using Coldairarrow.Business.MDS; |
|
|
|
using Coldairarrow.Entity.DTO; |
|
|
|
using Coldairarrow.Entity.Enum; |
|
|
|
using Coldairarrow.Entity.HuiYan; |
|
|
|
using Coldairarrow.Entity.MDS; |
|
|
|
using Coldairarrow.IBusiness; |
|
|
|
using Coldairarrow.Util; |
|
|
|
using EFCore.Sharding; |
|
|
@ -19,10 +21,14 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
public class teamitemsBusiness : BaseBusiness<teamitems>, IteamitemsBusiness, ITransientDependency |
|
|
|
{ |
|
|
|
readonly IOperator _operator; |
|
|
|
public teamitemsBusiness(IDbAccessor db, IOperator @operator) |
|
|
|
IuserdepartmentBusiness _iuserdepartmentBusiness; |
|
|
|
IuserBusiness _iuserBusiness; |
|
|
|
public teamitemsBusiness(IDbAccessor db, IOperator @operator, IuserdepartmentBusiness iuserdepartmentBusiness, IuserBusiness iuserBusiness) |
|
|
|
: base(db) |
|
|
|
{ |
|
|
|
_operator = @operator; |
|
|
|
_iuserdepartmentBusiness = iuserdepartmentBusiness; |
|
|
|
_iuserBusiness = iuserBusiness; |
|
|
|
} |
|
|
|
|
|
|
|
#region 外部接口
|
|
|
@ -349,6 +355,153 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AjaxResult GetTjInfo(DateTime start, DateTime end) |
|
|
|
{ |
|
|
|
Expression<Func<pricetasklog, teamitems, TaskInfoDto>> select = (a, b) => new TaskInfoDto |
|
|
|
{ |
|
|
|
IsPass = b.IsQualified, |
|
|
|
TeamId = b.TeamId, |
|
|
|
TeamUserId = b.UserId, |
|
|
|
TeamDate = b.CreateTime, |
|
|
|
TeamOverDate = b.UpdateDate, |
|
|
|
PriceTaskUserId = b.PriceTaskUserId, |
|
|
|
TeamItemState = (TeamItemState?)b.State |
|
|
|
}; |
|
|
|
|
|
|
|
select = select.BuildExtendSelectExpre(); |
|
|
|
|
|
|
|
var q_titem = Db.GetIQueryable<teamitems>(); |
|
|
|
var q = from a in q_titem.AsExpandable() |
|
|
|
join b in Db.GetIQueryable<pricetasklog>() on a.Id equals b.TeamItemId into ab |
|
|
|
from b in ab.DefaultIfEmpty() |
|
|
|
select @select.Invoke(b, a); |
|
|
|
|
|
|
|
var where = LinqHelper.True<TaskInfoDto>(); |
|
|
|
where = where.And(c => c.CreateTime >= start && c.CreateTime <= end); |
|
|
|
var list = q.Where(where).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
Expression<Func<TaskInfoDto, userdepartment, TaskInfoDto>> select2 = (a, b) => new TaskInfoDto |
|
|
|
{ |
|
|
|
|
|
|
|
TeamName =b==null?"未知" :b.DepartmentName |
|
|
|
}; |
|
|
|
|
|
|
|
select2 = select2.BuildExtendSelectExpre(); |
|
|
|
|
|
|
|
var q2 = from a in list |
|
|
|
join b in _iuserdepartmentBusiness.GetDepQueryable() on a.TeamId equals b.Id into ab |
|
|
|
from b in ab.DefaultIfEmpty() |
|
|
|
select @select2.Invoke(a, b); |
|
|
|
|
|
|
|
list = q2.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
Expression<Func<TaskInfoDto, user, TaskInfoDto>> select3 = (a, b) => new TaskInfoDto |
|
|
|
{ |
|
|
|
|
|
|
|
UserName = b == null ? "未知" : b.UserNick |
|
|
|
}; |
|
|
|
|
|
|
|
select3 = select3.BuildExtendSelectExpre(); |
|
|
|
|
|
|
|
var q3 = from a in list |
|
|
|
join b in _iuserBusiness.GetUserQueryable() on a.UserId equals b.Id into ab |
|
|
|
from b in ab.DefaultIfEmpty() |
|
|
|
select @select3.Invoke(a, b); |
|
|
|
|
|
|
|
list = q3.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var jtInfo = new PriceTaskInfo() |
|
|
|
{ |
|
|
|
AuditCount = list.Count(c => c.State == PriceTaskState.已比价), |
|
|
|
OverCount = list.Count(c => c.State == PriceTaskState.比价完成), |
|
|
|
PassCount = list.Count(c => c.IsPass == true), |
|
|
|
PublishCount = list.Count, |
|
|
|
FailedCount = list.Count(c => c.IsPass == false), |
|
|
|
NeedWorkCount = list.Count(c => c.State != PriceTaskState.比价完成) |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (list.Count > 0) |
|
|
|
{ |
|
|
|
jtInfo.PassRate = Math.Round(((decimal)jtInfo.PassCount / list.Count) * 100, 2); |
|
|
|
} |
|
|
|
|
|
|
|
var fbList= new List<PriceTaskInfo>(); |
|
|
|
|
|
|
|
var groups= list.GroupBy(c => c.TeamName).ToList(); |
|
|
|
|
|
|
|
foreach (var group in groups) |
|
|
|
{ |
|
|
|
var sonList = group.ToList(); |
|
|
|
var price = new PriceTaskInfo() |
|
|
|
{ |
|
|
|
Title = group.Key, |
|
|
|
AuditCount = sonList.Count(c => c.State == PriceTaskState.已比价), |
|
|
|
OverCount = sonList.Count(c => c.State == PriceTaskState.比价完成), |
|
|
|
PassCount = sonList.Count(c => c.IsPass == true), |
|
|
|
PublishCount = sonList.Count, |
|
|
|
FailedCount = sonList.Count(c => c.IsPass == false), |
|
|
|
NeedWorkCount = sonList.Count(c => c.State != PriceTaskState.比价完成) |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sonList.Count > 0) |
|
|
|
{ |
|
|
|
price.PassRate = Math.Round(((decimal)price.PassCount / sonList.Count) * 100, 2); |
|
|
|
} |
|
|
|
|
|
|
|
fbList.Add(price); |
|
|
|
} |
|
|
|
|
|
|
|
var bjList = new List<PriceTaskInfo>(); |
|
|
|
|
|
|
|
var bjGroup = list.GroupBy(c => c.UserName).ToList(); |
|
|
|
|
|
|
|
foreach (var group in bjGroup) |
|
|
|
{ |
|
|
|
var sonList = group.ToList(); |
|
|
|
var price = new PriceTaskInfo() |
|
|
|
{ |
|
|
|
Title = group.Key, |
|
|
|
AuditCount = sonList.Count(c => c.State == PriceTaskState.已比价), |
|
|
|
OverCount = sonList.Count(c => c.State == PriceTaskState.比价完成), |
|
|
|
PassCount = sonList.Count(c => c.IsPass == true), |
|
|
|
PublishCount = sonList.Count, |
|
|
|
FailedCount = sonList.Count(c => c.IsPass == false), |
|
|
|
NeedWorkCount = sonList.Count(c => c.State != PriceTaskState.比价完成) |
|
|
|
}; |
|
|
|
|
|
|
|
if (sonList.Count > 0) |
|
|
|
{ |
|
|
|
price.PassRate = Math.Round(((decimal)price.PassCount / sonList.Count) * 100, 2); |
|
|
|
} |
|
|
|
bjList.Add(price); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var result = new |
|
|
|
{ |
|
|
|
//待完成
|
|
|
|
WaitOver = list.Count(c => c.TeamItemState == TeamItemState.已发布比价 &&!string.IsNullOrEmpty( c.PriceTaskUserId)&& c.State != PriceTaskState.比价完成), |
|
|
|
//待接入
|
|
|
|
WaitCheck= list.Count(c => c.TeamItemState == TeamItemState.已发布比价 && string.IsNullOrEmpty(c.PriceTaskUserId) ), |
|
|
|
JT=new List<PriceTaskInfo>() { jtInfo }, |
|
|
|
FB=fbList, |
|
|
|
BJ=bjList |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return Success(result) ; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public AjaxResult SetState(string id, int state) |
|
|
|
{ |
|
|
|
//删除
|
|
|
|