/// <summary> /// 获取项目动态 提交情况 /// </summary> /// <param name="projectId"></param> /// <returns></returns> public Dictionary <string, object> getTaskRecordByProjectId(QueryTaskRecordRequest request) { var dateQuery = Db.Queryable <TaskRecord, Task, Project>((tr, t, p) => new object[] { JoinType.Left, tr.TaskId == t.Id, JoinType.Left, t.ProjectId == p.Id }).Where((tr, t, p) => t.ProjectId == request.projectOrTaskId && tr.Status == 1); if (!string.IsNullOrEmpty(request.startTime) && !string.IsNullOrEmpty(request.endTime)) { dateQuery = dateQuery.Where((tr, t, p) => SqlFunc.Between(tr.CreateTime, request.startTime, request.endTime)); } var dateList = dateQuery.GroupBy((tr, t, p) => SqlFunc.DateValue(tr.CreateTime, DateType.Year) + "-" + SqlFunc.DateValue(tr.CreateTime, DateType.Month) + "-" + SqlFunc.DateValue(tr.CreateTime, DateType.Day)) .OrderBy((tr, t, p) => tr.CreateTime) .Select((tr, t, p) => tr.CreateTime).ToList(); var dict = new Dictionary <string, object>(); foreach (var date in dateList) { var taskRecordList = Db.Queryable <TaskRecord>().Where(u => SqlFunc.DateIsSame(date, u.CreateTime)) .ToList(); dict.Add(date.ToString("yyyy-MM-dd"), taskRecordList); } return(dict); }
public Response <Dictionary <string, object> > getTaskRecordByProjectId(QueryTaskRecordRequest request) { var result = new Response <Dictionary <string, object> >(); try { result.Result = _service.getTaskRecordByProjectId(request); } catch (Exception ex) { result.Code = 500; result.Message = ex.Message; } return(result); }