コード例 #1
0
        public JsonResult QueryComplaintStatistics(QF_Report filter)
        {
            var list      = ReportBigService.ComplaintStatisticsList(filter);
            var chartList = ReportBigService.ComplaintStatisticsChart(filter);

            return(Json(new AjaxResult()
            {
                Success = true,
                Data = new
                {
                    chartList,
                    list
                }
            }));
        }
コード例 #2
0
        public ActionResult SearchExportComplaintStatistics()
        {
            var filter = SerializeHelper.JsonDeserializeFixed <QF_Report>(Request.Form["queryString"]);
            var list   = ReportBigService.ComplaintStatisticsList(filter);

            list.ForEach(p => { p.SerialNumber = list.IndexOf(p) + 1; });
            var tables = new List <DataTable>
            {
                DataMapper.ListToDataTable(list)
            };
            var columns = new List <List <ColumnData> >
            {
                new List <ColumnData>
                {
                    new ColumnData {
                        FieldName = "SerialNumber", Width = 10, Title = "序号", HorizontalAlignment = HorizAlignments.Centered
                    },
                    new ColumnData {
                        FieldName = "DepartmentName", Width = 20, Title = "公司名称", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "ComplaintCount", Width = 10, Title = "	投诉量", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastYearComplaintCount", Width = 20, Title = "去年同期投诉量", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastYearComplaintCountProportion", Width = 10, Title = "同比", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastMonthComplaintCount", Width = 20, Title = "上月同期投诉量", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "LastMonthComplaintCountProportion", Width = 10, Title = "环比", HorizontalAlignment = HorizAlignments.Left
                    },
                }
            };
            var excelExport = new ExcelFileExporter();
            var fileName    = string.Empty;
            var excelByte   = excelExport.CreateFile(tables, new List <string>()
            {
                "投诉量统计"
            }, columns, null, out fileName, "投诉量统计");

            fileName = "投诉量统计.xls";
            return(File(new MemoryStream(excelByte), "application/ms-excel", fileName));
        }