瀏覽代碼

二级单位督办数据统计

duhongyu 4 年之前
父節點
當前提交
8d5e552a57

+ 72 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Assessment/DataAssessmentController.cs

@@ -314,6 +314,78 @@ namespace CallCenterApi.Interface.Controllers.Assessment
314 314
             };
315 315
             return Content(obj.ToJson());
316 316
         }
317
+
318
+
319
+        [Authority]
320
+        public ActionResult GetDBDataList_2(DateTime? starttime, DateTime? endtime, int deptid3 = 0, bool isdc = false, int source = 0)
321
+        {
322
+            if (User == null)
323
+                return Error("权限不足!");
324
+            int deptid = 0;
325
+            string strdate = ""; string edate = "";
326
+            if (User.F_RoleCode == "WLDW")
327
+                deptid = User.F_DeptId;
328
+            #region 
329
+            string month = "";
330
+            if (starttime == null)
331
+            {
332
+                strdate = DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-21 00:00:00";
333
+            }
334
+            else
335
+            {
336
+                strdate = starttime.Value.ToString("yyyy-MM-dd HH:mm:ss");
337
+
338
+            }
339
+            if (endtime == null)
340
+            {
341
+                edate = DateTime.Now.ToString("yyyy-MM") + "-20 23:59:59";
342
+                month = DateTime.Now.Month.ToString();
343
+            }
344
+            else
345
+            {
346
+                edate = endtime.Value.ToString("yyyy-MM-dd") + " 23:59:59";
347
+                month = endtime.Value.Month.ToString();
348
+            }
349
+            string sourcesql = "";
350
+            if (source > 0)
351
+            {
352
+                sourcesql = source.ToString();
353
+            }
354
+            #endregion
355
+            Dictionary<string, string> paras = new Dictionary<string, string>();
356
+            paras.Add("@deptid", deptid.ToString());
357
+            paras.Add("@sdate", strdate);
358
+            paras.Add("@edate", edate);
359
+            paras.Add("@source", sourcesql);
360
+            paras.Add("@deptid3", deptid3.ToString ());
361
+           
362
+            var list = DbHelperSQL.RunProcedure("P_EJDeptDBData", paras, "EJDeptDBData").Tables[0];
363
+            //var list = DbHelperSQL.Query(sqlass).Tables[0];
364
+            if (isdc)
365
+            {
366
+                NPOIHelper npoi = new NPOIHelper();
367
+                if (npoi.DBEJExportToExcel(list, "督办数据统计", month, Convert.ToDateTime(strdate).ToString("yyyy-MM-dd"),
368
+                    Convert.ToDateTime(edate).ToString("yyyy-MM-dd")
369
+                   ) == "")
370
+                {
371
+                    return Success("导出成功");
372
+                }
373
+                else
374
+                {
375
+                    return Error("导出失败");
376
+                }
377
+            }
378
+            var obj = new
379
+            {
380
+                state = "success",
381
+                message = "成功",
382
+                rows = list,
383
+                month,
384
+                strdate = Convert.ToDateTime(strdate).ToString("yyyy-MM-dd"),
385
+                edate = Convert.ToDateTime(edate).ToString("yyyy-MM-dd")
386
+            };
387
+            return Content(obj.ToJson());
388
+        }
317 389
         [Authority]
318 390
         public ActionResult ExptDBDataList(string date, int deptid = 0)
319 391
         {

+ 0 - 5
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/information/NoticeController.cs

@@ -334,10 +334,6 @@ namespace CallCenterApi.Interface.Controllers.information
334 334
         //编辑公告
335 335
         public ActionResult EditNotice(string nid, string title, string content, string stime, string etime, string userid, string roleid,string file)
336 336
         {
337
-            //int userId = 0, roleId = 0;
338
-            //int.TryParse(userid, out userId);
339
-            //int.TryParse(roleid, out roleId);
340
-
341 337
             if (nid != null && nid.Trim() != "")
342 338
             {
343 339
                 Model.T_Msg_NoticeInfo dModel = dBLL.GetModel(int.Parse(nid.Trim()));
@@ -358,7 +354,6 @@ namespace CallCenterApi.Interface.Controllers.information
358 354
                     dModel.F_UserId = "," + userid.Trim() + ",";//= userid
359 355
                     dModel.F_ModifyDate = DateTime.Now;
360 356
                     dModel.F_ModifyBy = User.F_UserId;
361
-
362 357
                     bool b = dBLL.Update(dModel);
363 358
                     if (b)
364 359
                     {

+ 1 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/APPSController.cs

@@ -2815,7 +2815,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2815 2815
                 dc = dt.Columns.Add("atchmList", Type.GetType("System.String"));
2816 2816
                 newRow["atchmList"] = res.ToJson();
2817 2817
                 dt.Rows.Add(newRow);
2818
-            }
2818
+            } 
2819 2819
 
2820 2820
             #region 声音文件和交办超时
2821 2821
             #endregion

File diff suppressed because it is too large
+ 62 - 9
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs


+ 103 - 0
CallCenterCommon/CallCenter.Utility/NPOI/NPOIHelper.cs

@@ -783,6 +783,109 @@ namespace CallCenter.Utility
783 783
                 return "导出失败!";
784 784
             }
785 785
         }
786
+
787
+        /// <summary>
788
+        /// 督办数据报表导出
789
+        /// </summary>
790
+        /// <param name="ds"></param>
791
+        /// <returns></returns>
792
+        public string DBEJExportToExcel(DataTable dt, string Name, string month, string starttime, string endtime)
793
+        {
794
+            try
795
+            {
796
+                HSSFWorkbook workbook = new HSSFWorkbook();
797
+                ISheet sheet = workbook.CreateSheet(Name);
798
+                ICellStyle cellStyle = workbook.CreateCellStyle();
799
+                NPOI.SS.UserModel.IFont cellfont = workbook.CreateFont();
800
+                cellfont.Boldweight = (short)FontBoldWeight.Normal;
801
+                cellStyle.SetFont(cellfont);
802
+                ICellStyle cellStylebt = workbook.CreateCellStyle();
803
+                NPOI.SS.UserModel.IFont cellfontbt = workbook.CreateFont();
804
+                cellfontbt.Boldweight = (short)FontBoldWeight.Bold;
805
+                cellStylebt.SetFont(cellfontbt);
806
+                cellStylebt.VerticalAlignment = VerticalAlignment.Center;
807
+                cellStylebt.Alignment = HorizontalAlignment.Center;
808
+                IRow irow1 = sheet.CreateRow(0);
809
+                ICell cell1 = irow1.CreateCell(0);
810
+                cell1.SetCellValue("12345联动服务工作" + month + "月份办理情况通报表");
811
+                cell1.CellStyle = cellStylebt;
812
+                sheet.AddMergedRegion(new CellRangeAddress(0, 1, 0, 19));
813
+                IRow irow2 = sheet.CreateRow(2);
814
+                ICell cell2 = irow2.CreateCell(0);
815
+                cell2.SetCellValue("统计周期:" + starttime + "至" + endtime + "                统计时间:" + DateTime.Now.ToString("yyyy年MM月dd日"));
816
+                cell2.CellStyle = cellStylebt;
817
+                sheet.AddMergedRegion(new CellRangeAddress(2, 2, 0, 19));
818
+                IRow irow3 = sheet.CreateRow(3);
819
+                ICell cell3 = irow3.CreateCell(0);
820
+                cell3.SetCellValue("一、县(市、区)联动单位");
821
+                cell3.CellStyle = cellStylebt;
822
+                sheet.AddMergedRegion(new CellRangeAddress(3, 3, 0, 19));
823
+                string[] cols = {"序号","联动单位","承办件",
824
+                "承办率","得分(5分)","超期件","按时反馈率","得分(20分)",
825
+                "未果件","办结率","得分(10分)","退单件","有效回复率",
826
+                "得分(15分)","群众评议总数","一次不满意件","不满意件","满意率","得分(50分)","总分","排名"};
827
+                IRow irow4 = sheet.CreateRow(4);
828
+                int icolIndex = 0;
829
+                foreach (string dc in cols)
830
+                {
831
+                    ICell cell = irow4.CreateCell(icolIndex);
832
+                    cell.SetCellValue(dc);
833
+                    cell.CellStyle = cellStylebt;
834
+                    icolIndex++;
835
+                }
836
+                int iRowIndex = 5;
837
+               // DataRow[] rows = dt.Select("category=1");
838
+                int index = 0;
839
+                foreach (DataRow dr in dt.Rows )
840
+                {
841
+                    index++;
842
+                    int iCellIndex = 0;
843
+                    IRow irow = sheet.CreateRow(iRowIndex);
844
+                    for (int i = 0; i < 20; i++)
845
+                    {
846
+                        ICell cell = irow.CreateCell(iCellIndex);
847
+                        cell.SetCellValue(GetCellValue(dr, index, i));
848
+                        cell.CellStyle = cellStyle;
849
+                        iCellIndex++;
850
+                    }
851
+                    iRowIndex++;
852
+                }
853
+                //自适应列宽度
854
+                for (int i = 0; i < 20; i++)
855
+                {
856
+                    sheet.AutoSizeColumn(i);
857
+                    // sheet.SetColumnWidth(i, 20 * 256);
858
+                }
859
+
860
+                using (MemoryStream ms = new MemoryStream())
861
+                {
862
+                    workbook.Write(ms);
863
+
864
+                    HttpContext curContext = HttpContext.Current;
865
+
866
+
867
+                    // 设置编码和附件格式
868
+                    curContext.Response.ContentType = "application/vnd.ms-excel";
869
+                    curContext.Response.ContentEncoding = Encoding.UTF8;
870
+                    curContext.Response.Charset = "";
871
+                    curContext.Response.AppendHeader("Content-Disposition",
872
+                        "attachment;filename=" + HttpUtility.UrlEncode(Name + ".xls", Encoding.UTF8));
873
+
874
+                    curContext.Response.BinaryWrite(ms.GetBuffer());
875
+
876
+                    workbook = null;
877
+                    ms.Close();
878
+                    ms.Dispose();
879
+
880
+                    curContext.Response.End();
881
+                }
882
+                return "";
883
+            }
884
+            catch
885
+            {
886
+                return "导出失败!";
887
+            }
888
+        }
786 889
         /// <summary>
787 890
         /// 弹出下载框导出excel
788 891
         /// </summary>