Esempio n. 1
0
        //
        // GET: /StatisticsManage/Department/
        public override ActionResult Index()
        {
            string  organizeId = Common.GetString("organizeid");
            string  startDT    = Common.GetString("startdt"); // Request["StartDT"];
            string  endDT      = Common.GetString("enddt");   // Request["EndDT"];
            UserApp userApp    = new UserApp();

            organizeId = string.IsNullOrEmpty(organizeId) ? NFine.Code.OperatorProvider.Provider.GetCurrent().CompanyId : organizeId;//获取到当前的组织结构id
            //todo 找出该组织的下级
            OrganizeApp   organizeApp    = new OrganizeApp();
            var           organizeData   = organizeApp.GetList(organizeId);
            List <string> listOrganizeId = organizeData.Select(x => x.F_Id).ToList();// new List<string>() { organizeId };

            //var userData = userApp.GetList(listOrganizeId);
            ViewBag.OrganizeList = organizeData.Select(x => x.F_FullName).ToJson();
            //todo 找出每个员工的完成情况 放入内存中 执行逻辑操作
            TaskApp taskApp = new TaskApp();
            //var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
            List <Report>  listReports    = new List <Report>();
            ItemsDetailApp itemsDetailApp = new ItemsDetailApp();
            var            itemsData      = itemsDetailApp.GetItemList(schedule);

            foreach (var item in itemsData)
            {
                Report report = new Report();
                report.name = item.F_ItemName;
                List <int> listCount = new List <int>();
                foreach (var organizeItem in organizeData)
                {
                    //todo 获取组织下的所有员工
                    //获取组织下的组织
                    var           data             = organizeApp.GetAllList(organizeItem.F_Id);
                    List <string> listOrganizeNext = new List <string>();
                    foreach (var organizeItemNext in data)
                    {
                        listOrganizeNext.Add(organizeItemNext);
                    }
                    //获取下级下的所有员工
                    var userData = userApp.GetList(listOrganizeNext);
                    //获取下级下的所有员工的任务
                    var taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
                    if (!string.IsNullOrEmpty(startDT))
                    {
                        var time = Utils.ObjectToDateTime(startDT);
                        taskData = taskData.Where(d => d.F_CreatorTime > time).ToList();
                    }
                    if (!string.IsNullOrEmpty(endDT))
                    {
                        var time = Utils.ObjectToDateTime(endDT);
                        taskData = taskData.Where(d => d.F_CreatorTime <= time).ToList();
                    }
                    listCount.Add(taskData.Count(d => d.F_Status == item.F_Id));
                }
                report.data = listCount;
                listReports.Add(report);
            }
            ViewBag.Series = listReports.ToJson();
            return(View());
        }
Esempio n. 2
0
        public ActionResult Default()
        {
            var           organizeId       = NFine.Code.OperatorProvider.Provider.GetCurrent().CompanyId;//获取到当前的组织结构id
            UserApp       userApp          = new UserApp();
            TaskApp       taskApp          = new TaskApp();
            OrganizeApp   organizeApp      = new OrganizeApp();
            var           organizeData     = organizeApp.GetAllList(organizeId);
            List <string> listOrganizeNext = new List <string>();

            foreach (var item in organizeData)
            {
                listOrganizeNext.Add(item);
            }
            var      userData = userApp.GetList(listOrganizeNext);
            var      taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
            DateTime dt       = DateTime.Now; //当前时间

            //当天待处理任务
            ViewBag.DayTaskDoing = taskData.Count(d => d.F_Status == Doing && d.F_CreatorTime > dt.AddDays(-1) && d.F_CreatorTime <= dt);
            //本周待处理任务
            DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))); //本周周一
            DateTime endWeek   = startWeek.AddDays(6);                                        //本周周日

            ViewBag.WeekTaskDoing = taskData.Count(d => d.F_Status == Doing && d.F_CreatorTime > startWeek && d.F_CreatorTime <= endWeek);
            //本周已处理任务
            ViewBag.WeekTaskDone = taskData.Count(d => d.F_Status == Done && d.F_CreatorTime > startWeek && d.F_CreatorTime <= endWeek);
            //本月待处理任务
            DateTime startMonth = dt.AddDays(1 - dt.Day);              //本月月初
            DateTime endMonth   = startMonth.AddMonths(1).AddDays(-1); //本月月末
            //本月任务
            var tempTask = taskData.Where(d => d.F_CreatorTime > startMonth && d.F_CreatorTime <= endMonth).ToList();

            //本月待处理
            ViewBag.MonthTaskDoing = tempTask.Count(d => d.F_Status == Doing);

            //本月已处理任务
            ViewBag.MonthTaskDone = tempTask.Count(d => d.F_Status == Done);
            //本月未完成
            ViewBag.MonthTaskNone = tempTask.Count(d => d.F_Status != Done && d.F_Status != Doing);
            //最近6个月的完成情况
            List <int>    listLineChartData = new List <int>();
            List <string> listLineChartName = new List <string>();

            for (int i = 6; i > 0; i--)
            {
                startMonth = dt.AddMonths(-i).AddDays(1 - dt.Day); //当月月初
                endMonth   = startMonth.AddMonths(1).AddDays(-1);  //当月月末
                var tempCount = taskData.Count(d => d.F_Status == Done && d.F_CreatorTime > startMonth && d.F_CreatorTime <= endMonth);
                listLineChartData.Add(tempCount);
                listLineChartName.Add(dt.AddMonths(-i).Year + "年" + dt.AddMonths(-i).Month + "月");
            }
            ViewBag.LineChartData = listLineChartData.ToJson();
            ViewBag.LineChartName = listLineChartName.ToJson();
            return(View());
        }
Esempio n. 3
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            string organizeId = Common.GetString("organizeid"); //组织id
            string startTime  = Common.GetString("startdt");    // 开始时间
            string endTime    = Common.GetString("enddt");      // 结束时间
            string schedule   = Common.GetString("schedule");   //进度
            //TODO 找出该组织下的员工
            UserApp userApp  = new UserApp();
            var     userData = userApp.GetList(pagination, keyword, organizeId);
            //ViewBag.UserList = userData.Select(x => x.F_RealName).ToJson();

            //todo 找出每个员工的完成情况 放入内存中 执行逻辑操作
            TaskApp       taskApp  = new TaskApp();
            var           taskData = taskApp.GetList(userData.Select(x => x.F_Id).ToList());
            List <Series> list     = new List <Series>();

            foreach (var item in userData)
            {
                Series series = new Series();
                series.id   = item.F_Id;
                series.name = item.F_RealName;
                series.tel  = item.F_MobilePhone;
                var tempTask = taskData.Where(d => d.F_UserId == item.F_Id);
                if (!string.IsNullOrEmpty(schedule))
                {
                    tempTask = tempTask.Where(d => d.F_Status == schedule);
                }
                if (!string.IsNullOrEmpty(startTime))
                {
                    tempTask = tempTask.Where(d => d.F_CreatorTime > Utils.ObjectToDateTime(startTime));
                }
                if (!string.IsNullOrEmpty(endTime))
                {
                    tempTask = tempTask.Where(d => d.F_CreatorTime <= Utils.ObjectToDateTime(endTime));
                }
                series.count    = tempTask.Count();
                series.schedule = schedule;
                list.Add(series);
            }
            var data = new
            {
                rows    = list,
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Esempio n. 4
0
        /// <summary>
        /// 任务列表
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">数量</param>
        /// <param name="bank">银行</param>
        /// <param name="schedule">进度</param>
        /// <param name="keyword">关键字</param>
        /// <param name="startdt">开始时间</param>
        /// <param name="enddt">结束时间</param>
        /// <param name="userid">用户id</param>
        /// <returns></returns>
        public ApiResult <dynamic> PostTaskList()
        {
            ApiResult <dynamic> api = new ApiResult <dynamic>();

            try
            {
                int        pageindex  = Common.GetInt("pageIndex", 0); // jsondata.pageIndex ?? 0;
                int        pagesize   = Common.GetInt("pageSize", 0);  // jsondata.pageSize ?? 0;
                string     userid     = Common.GetString("userid");
                string     bank       = Common.GetString("bank");
                string     schedule   = Common.GetString("schedule");
                string     keyword    = Common.GetString("keyword");
                string     startdt    = Common.GetString("startdt");
                string     enddt      = Common.GetString("enddt");
                TaskApp    taskApp    = new TaskApp();
                Pagination pagination = new Pagination();
                pagination.page = pageindex;
                pagination.rows = pagesize;
                pagination.sidx = "F_CreatorTime";
                pagination.sord = "desc";
                var            result      = taskApp.GetList(pagination, keyword, schedule, startdt, enddt, userid, bank);
                CustomerApp    customerApp = new CustomerApp();
                List <dynamic> list        = new List <dynamic>();
                foreach (var item in result)
                {
                    var entity = customerApp.GetForm(item.F_CustomerId);
                    list.Add(entity);
                }
                api.Message = "获取成功";
                api.Status  = true;
                api.Result  = list;
                return(api);
            }
            catch (Exception e)
            {
                api.Message = e.Message;
                return(api);
            }
        }
Esempio n. 5
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            string         schedule    = Common.GetString("schedule");
            string         startTime   = Common.GetString("startdt");
            string         endTime     = Common.GetString("enddt");
            string         user        = Common.GetString("user");
            string         bank        = Common.GetString("bank");
            CustomerApp    customerApp = new CustomerApp();
            List <dynamic> list        = new List <dynamic>();
            var            result      = taskApp.GetList(pagination, keyword, schedule, startTime, endTime, user, bank);

            foreach (var item in result)
            {
                var entity = customerApp.GetForm(item.F_CustomerId);
                var temp   = new
                {
                    F_Customer_Name  = entity.F_Name,
                    F_Customer_Phone = entity.F_Tel,
                    F_UserId         = item.F_UserId,
                    F_CreatorUserId  = item.F_CreatorUserId,
                    F_CreatorTime    = item.F_CreatorTime,
                    F_Status         = item.F_Status,
                    F_Id             = item.F_Id,
                    F_Customer_Id    = entity.F_Id
                };
                list.Add(temp);
            }
            var data = new
            {
                rows    = list,
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Esempio n. 6
0
        public ActionResult GetGridJson(Pagination page, string status)
        {
            var data = taskApp.GetList(page, status);

            return(Content(data.ToJson()));
        }