public ActionResult GetWorkloadList(WorkloadQuery query)
        {
            IRoleAuthorFacadeService roleAuthorService = ServiceContainer.Instance.Container.Resolve <IRoleAuthorFacadeService>();
            RoleAuthorQuery          roleAuthorQuery   = new RoleAuthorQuery();

            roleAuthorQuery.JournalID = JournalID;
            roleAuthorQuery.GroupID   = query.GroupID;
            roleAuthorQuery.OrderStr  = " AI.AuthorID ASC";
            roleAuthorQuery.RealName  = query.RealName;
            if (query.RoleID > 0)
            {
                roleAuthorQuery.RoleID = query.RoleID;
            }
            int pageIndex = TypeParse.ToInt(Request.Params["page"], 1);
            IList <RoleAuthorEntity> listRoleAuthor;

            if (query.isStatByGroup == true)
            {
                listRoleAuthor = roleAuthorService.GetRoleAuthorDetailList(roleAuthorQuery);
            }
            else
            {
                listRoleAuthor = roleAuthorService.GetRoleAuthorDetailList(roleAuthorQuery).Distinct(new Compare <RoleAuthorEntity>((x, y) => (null != x && null != y) && (x.AuthorID == y.AuthorID))).ToList();
            }
            //去除固定的不需统计的人员ID
            listRoleAuthor.Where(p => p.AuthorID != 84381 && p.AuthorID != 84386 && p.AuthorID != 84388 && p.AuthorID != 95844);
            return(Json(new { Rows = listRoleAuthor.Skip((pageIndex - 1) * 50).Take(50), Total = listRoleAuthor.Count }));
        }
        public ActionResult WorkloadListToExcel(WorkloadQuery query)
        {
            IRoleAuthorFacadeService roleAuthorService = ServiceContainer.Instance.Container.Resolve <IRoleAuthorFacadeService>();
            RoleAuthorQuery          roleAuthorQuery   = new RoleAuthorQuery();

            roleAuthorQuery.JournalID = JournalID;
            roleAuthorQuery.GroupID   = 1;
            roleAuthorQuery.OrderStr  = " AI.AuthorID ASC";
            roleAuthorQuery.RealName  = query.RealName;
            if (query.RoleID > 0)
            {
                roleAuthorQuery.RoleID = query.RoleID;
            }
            int pageIndex = TypeParse.ToInt(Request.Params["page"], 1);
            IList <RoleAuthorEntity> listRoleAuthor = roleAuthorService.GetRoleAuthorDetailList(roleAuthorQuery);
            List <WorkloadEntity>    list           = new List <WorkloadEntity> ();

            for (int i = 0; i < listRoleAuthor.Count; i++)
            {
                WorkloadEntity  workloadEntity = new WorkloadEntity();
                FlowStatusQuery fquery         = new FlowStatusQuery();
                JsonExecResult <FlowStatusEntity> jsonResult0 = new JsonExecResult <FlowStatusEntity>();
                JsonExecResult <FlowStatusEntity> jsonResult1 = new JsonExecResult <FlowStatusEntity>();
                IFlowFacadeService fservice = ServiceContainer.Instance.Container.Resolve <IFlowFacadeService>();
                fquery.JournalID   = JournalID;
                fquery.CurAuthorID = listRoleAuthor[i].AuthorID;
                fquery.RoleID      = listRoleAuthor[i].RoleID;
                fquery.StartDate   = query.StartDate;
                fquery.EndDate     = query.EndDate;
                #region 待处理
                try
                {
                    fquery.IsHandled     = 0;//0=待处理
                    jsonResult0.ItemList = fservice.GetHaveRightFlowStatusForStat(fquery);
                    if (jsonResult0.ItemList != null && jsonResult0.ItemList.Count > 0)
                    {
                        jsonResult0.ItemList = jsonResult0.ItemList.Where(p => p.ContributionCount > 0).ToList <FlowStatusEntity>();
                        for (int m = 0; m < jsonResult0.ItemList.Count; m++)
                        {
                            workloadEntity.WaitCount += jsonResult0.ItemList[m].ContributionCount;
                        }
                    }
                }
                catch (Exception ex)
                {
                    jsonResult0.result = EnumJsonResult.error.ToString();
                    jsonResult0.msg    = "获取当前人可以处理的稿件状态出现异常:" + ex.Message;
                }
                #endregion

                #region 已处理
                try
                {
                    fquery.IsHandled     = 1;//1=已处理
                    jsonResult1.ItemList = fservice.GetHaveRightFlowStatusForStat(fquery);
                    if (jsonResult1.ItemList != null && jsonResult1.ItemList.Count > 0)
                    {
                        jsonResult1.ItemList = jsonResult1.ItemList.Where(p => p.ContributionCount > 0).ToList <FlowStatusEntity>();
                        for (int n = 0; n < jsonResult1.ItemList.Count; n++)
                        {
                            workloadEntity.WorkCount += jsonResult1.ItemList[n].ContributionCount;
                        }
                    }
                }
                catch (Exception ex)
                {
                    jsonResult1.result = EnumJsonResult.error.ToString();
                    jsonResult1.msg    = "获取当前人可以处理的稿件状态出现异常:" + ex.Message;
                }
                #endregion

                workloadEntity.AuthorID = listRoleAuthor[i].AuthorID;
                workloadEntity.RealName = listRoleAuthor[i].RealName;
                if (workloadEntity.WorkCount > 0)
                {
                    list.Add(workloadEntity);
                }
            }
            //去除固定的不需统计的人员ID
            list.Where(p => p.AuthorID != 84381 && p.AuthorID != 84386 && p.AuthorID != 84388 && p.AuthorID != 95844);
            //去除List中的重复项
            List <WorkloadEntity> WorkloadList = list.Distinct(new Compare <WorkloadEntity>((x, y) => (null != x && null != y) && (x.AuthorID == y.AuthorID))).ToList();

            string[] titleFiles  = new string[] { "编辑姓名", "已处理", "待处理" };
            int[]    titleWidth  = new int[] { 80, 80, 80 };
            string[] dataFiles   = new string[] { "RealName", "WorkCount", "WaitCount" };
            string[] fomateFiles = new string[] { "", "", "" };
            string   strTempPath = "/UploadFile/TempFile/" + "WorkloadListAll.xls";
            ExcelHelperEx.CreateExcel <WorkloadEntity>("编辑部工作量统计", titleFiles, titleWidth, dataFiles, fomateFiles, WorkloadList, strTempPath);
            return(Json(new { flag = 1, ExcelPath = strTempPath }));
        }