| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834 |
-
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Script.Serialization;
- using CallCenterApi.Common;
- using CallCenterApi.DB;
- using CallCenterApi.Interface.Controllers.Base;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- namespace CallCenterApi.Interface.Controllers.County
- {
- //[Authority]
- public class CountyBusinessController : BaseController
- {
- // GET: CountyBusiness
- /// <summary>
- /// 获取工单列表
- /// </summary>
- /// <param name="phone"></param>
- /// <param name="usercode"></param>
- /// <returns></returns>
- public ActionResult GetAreaOrderList(string branchcode)
- {
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- else
- {
- return Error("请选择区县");
- }
- //ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- if (list.Count == 0)
- {
- return Error("查询失败");
- }
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- int dealtype = RequestString.GetInt("dealtype", -1);
- #region 新增筛选项
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- string strddusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("ddusercode"));//调度员
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- int issend = RequestString.GetInt("issend", -1);
- int deptlevel = RequestString.GetInt("deptlevel", 0);
- #endregion
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (!string.IsNullOrEmpty(strpageindex) && strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (!string.IsNullOrEmpty(strpagesize) && strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- if (!string.IsNullOrEmpty(list[0].F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, list[0].F_Sign);
- string strparams = "?state=" + strstate + "&name=" + strname + "&tel=" + strtel + "&key=" + strkey
- + "&usercode="+ strusercode+ "&ddusercode="+ strddusercode+ "&source="+ source+ "&keyid="+ keyid
- + "&type="+ type+ "&bigtype="+ bigtype+ "&smalltype="+ smalltype+ "&sourcearea="+ sourcearea
- + "&deptid="+ deptid+ "&issend="+ issend+ "&deptlevel="+ deptlevel+ "&workid="+ strworkid
- + "&starttime=" + strstarttime + "&endtime=" + strendtime + "&page=" + pageindex + "&pagesize=" + pagesize + "&signcode=" + signcode;
- string result = HttpMethods.HttpGet(list[0].F_Url + "/" + controllername + "/" + actionname + strparams);
- return Content(result);
- }
- else
- {
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = new DataTable(),
- total = 0
- };
- return Content(obj.ToJson());
- }
- }
- /// <summary>
- /// 获取工单列表
- /// </summary>
- /// <param name="phone"></param>
- /// <param name="usercode"></param>
- /// <returns></returns>
- public ActionResult GetAreaWorkOrder(string branchcode, string workorderid)
- {
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- else
- {
- return Error("请选择区县");
- }
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- if (list.Count == 0)
- {
- return Error("查询失败");
- }
- if (string.IsNullOrEmpty(workorderid))
- {
- return Error("查询失败");
- }
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- if (!string.IsNullOrEmpty(list[0].F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, list[0].F_Sign);
- string strparams = "?workorderid=" + workorderid + "&signcode=" + signcode;
- string result = HttpMethods.HttpGet(list[0].F_Url + "/" + controllername + "/" + actionname + strparams);
- return Content(result);
- }
- else
- {
- return Error("查询失败");
- }
- }
- /// <summary>
- /// 绩效考核
- /// </summary>
- /// <param name="start"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public ActionResult GetAreaAssessment(string branchcode,DateTime? start, DateTime? end, int isdc = 0)
- {
- if (start == null)
- {
- start = DateTime.Now;
- start = new DateTime(start.Value.Year, start.Value.Month, 1);
- }
- if (end == null)
- {
- end = DateTime.Now;
- }
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- foreach (var l in list)
- {
- if (!string.IsNullOrEmpty(l.F_Sign) && !string.IsNullOrEmpty(l.F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
- string strparams = "?start=" + start.Value.ToString("yyyy-MM-dd") + "&end=" + end.Value.ToString("yyyy-MM-dd") + "&signcode=" + signcode;
- AjaxResult ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams).ToObject<AjaxResult>();
- if (ar.state.ToString() == ResultTypes.success.ToString())
- {
- var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
- result.AddRange(rtlist);
- }
- }
- }
- if (isdc > 0)
- {
- string[] cols = new string[] { "区县名称", "受理量", "交办量", "已办量", "重办量", "及时量", "超时量", "延时量", "回访量", "市民满意", "市民不满意" };
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.ExportToExcel("绩效考核报表", result, cols) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Success("成功", result);
- }
- //2019-8-21
- /// <summary>
- /// 绩效考核--添加获取市县总和
- /// </summary>
- /// <param name="start"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public ActionResult GetAreaAssessmentNew(string branchcode, DateTime? start, DateTime? end, int isdc = 0)
- {
- start = DateTime.Now.AddDays(-100);
-
- #region 定义新表
- DataTable dtnew = new DataTable();
- dtnew.Columns.Add("areaname");
- dtnew.Columns.Add("acceptcount");
- dtnew.Columns.Add("assigncount");
- dtnew.Columns.Add("dealcount");
- dtnew.Columns.Add("reloadcount");
- dtnew.Columns.Add("timelycount");
- dtnew.Columns.Add("timeoutcount");
- dtnew.Columns.Add("delaycount");
- dtnew.Columns.Add("visitcount");
- dtnew.Columns.Add("satisfiedcount");
- dtnew.Columns.Add("notsatisfiedcount");
- int first = 1;
- //Int64 totalcount = 0;
- #endregion
- if (start == null)
- {
- start = DateTime.Now;
- start = new DateTime(start.Value.Year, start.Value.Month, 1);
- }
- if (end == null)
- {
- end = DateTime.Now;
- }
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- //string areaid = "";
- ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = "GetAreaAssessment";//RouteData.Values["action"].ToString();
- foreach (var l in list)
- {
- if (!string.IsNullOrEmpty(l.F_Sign) && !string.IsNullOrEmpty(l.F_Url))
- {
- //if (!string.IsNullOrEmpty(l.F_AreaId))
- //{
- // areaid = l.F_AreaId;
- //}
- string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
- string strparams = "?start=" + start.Value.ToString("yyyy-MM-dd") + "&end=" + end.Value.ToString("yyyy-MM-dd") + "&signcode=" + signcode;
- string ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams);//.ToObject<AjaxResult>();
- //if (!string.IsNullOrEmpty(branchcode))
- //{
- // return Content(ar);//查询单个时直接返回
- //}
- JObject jo0 = (JObject)JsonConvert.DeserializeObject(ar);
- if (jo0 != null && jo0["state"].ToString() == ResultTypes.success.ToString())
- {
- if (first == 1)
- {
- DataTable dt = HeadToDataTable(jo0["data"].ToString(), "Item");
- dtnew = dt;
- first = 0;
- if (!string.IsNullOrEmpty(branchcode))
- {
- break;
- }
- }
- else
- {
- int isbh = 0;
- //前部分相加
- DataTable dt1 = HeadToDataTable(jo0["data"].ToString(), "Item");
- for (int m = 0; m < dt1 .Rows .Count ; m++)
- {
- for (int i = 0; i < dtnew.Rows.Count; i++)
- {
- if (dtnew.Rows[i]["areaname"].ToString() == dt1.Rows[m]["areaname"].ToString())
- {
- for (int j = 1; j < 11; j++)
- {
- string cols = dtnew.Columns[j].ColumnName;
- decimal t = decimal.Parse(dtnew.Rows[i][cols].ToString()) + decimal.Parse(dt1.Rows[m][cols].ToString());
- dtnew.Rows[i][cols] = t;
- isbh = 1;
- }
- //totalcount += Int64.Parse(dtnew.Rows[i]["TotalCount"].ToString());
- }
- }
- if (isbh == 0)
- {
-
- DataRow dr = dt1.Rows[m];
- dtnew.ImportRow(dr);
-
- }
- }
- }
- //var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
- //result.AddRange(rtlist);
- }
- }
- }
- if (isdc > 0)
- {
- string[] cols = new string[] { "区县名称", "受理量", "交办量", "已办量", "重办量", "及时量", "超时量", "延时量", "回访量", "市民满意", "市民不满意" };
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.ExportToExcel("绩效考核报表", dtnew, cols) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Success("成功", dtnew);
- }
- public static DataTable HeadToDataTable(string json, string dicstr)//Item
- {
- DataTable dataTable = new DataTable(); //实例化
- DataTable result;
- try
- {
- JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
- javaScriptSerializer.MaxJsonLength = Int32.MaxValue; //取得最大数值
- ArrayList arrayList = javaScriptSerializer.Deserialize<ArrayList>(json);
- if (arrayList.Count > 0)
- {
- foreach (Dictionary<string, object> dictionary in arrayList)
- {
- if (dictionary.Keys.Count<string>() == 0)
- {
- result = dataTable;
- return result;
- }
- //Columns
- if (dataTable.Columns.Count == 0)
- {
- foreach (string current in dictionary.Keys)
- {
- if (current != dicstr)
- dataTable.Columns.Add(current, dictionary[current].GetType());
-
- }
- }
- //Rows
- //string root = "";
- List<string> cname = new List<string>();
- DataRow dataRow = dataTable.NewRow();
- foreach (string current in dictionary.Keys)
- {
- if (current != dicstr)
- {
- //root = current;
- //dataRow[root] = dictionary[root];
- cname.Add(current);
- }
- foreach (var li in cname)
- {
- if (dictionary[li] == null)
- {
- dataRow[li] = -1;
- }
- else
- {
- dataRow[li] = dictionary[li];
- }
- }
-
- }
- dataTable.Rows.Add(dataRow);
- }
- }
- }
- catch
- {
- }
- result = dataTable;
- return result;
- }
- /// <summary>
- /// 县区受理
- /// </summary>
- /// <param name="start"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public ActionResult GetAreaAccept(string branchcode, DateTime? date, int isdc = 0)
- {
- if (date == null)
- {
- date = DateTime.Now;
- }
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- foreach (var l in list)
- {
- if (!string.IsNullOrEmpty(l.F_Sign) && !string.IsNullOrEmpty(l.F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
- string strparams = "?date=" + date.Value.ToString("yyyy-MM-dd") + "&signcode=" + signcode;
- AjaxResult ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams).ToObject<AjaxResult>();
- if (ar.state.ToString() == ResultTypes.success.ToString())
- {
- var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
- result.AddRange(rtlist);
- }
- }
- }
- if (isdc > 0)
- {
- string[] cols = new string[] { "区县名称", "受理量", "同比", "环比" };
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.ExportToExcel("县区受理报表", result, cols) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Success("成功", result);
- }
- /// <summary>
- /// 县区办理
- /// </summary>
- /// <param name="start"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public ActionResult GetAreaDeal(string branchcode, DateTime? date, int isdc = 0)
- {
- if (date == null)
- {
- date = DateTime.Now;
- }
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- foreach (var l in list)
- {
- if (!string.IsNullOrEmpty(l.F_Sign) && !string.IsNullOrEmpty(l.F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
- string strparams = "?date=" + date.Value.ToString("yyyy-MM-dd") + "&signcode=" + signcode;
- AjaxResult ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams).ToObject<AjaxResult>();
- if (ar.state.ToString() == ResultTypes.success.ToString())
- {
- var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
- result.AddRange(rtlist);
- }
- }
- }
- if (isdc > 0)
- {
- string[] cols = new string[] { "区县名称", "办理量", "同比", "环比" };
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.ExportToExcel("县区办理报表", result, cols) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Success("成功", result);
- }
- /// <summary>
- /// 县区各类型统计
- /// </summary>
- /// <param name="start"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public ActionResult GetAreaCount(string branchcode, DateTime? start, DateTime? end, int type, int isdc = 0)
- {
- if (start == null)
- {
- start = DateTime.Now;
- start = new DateTime(start.Value.Year, start.Value.Month, 1);
- }
- if (end == null)
- {
- end = DateTime.Now;
- }
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- foreach (var l in list)
- {
- if (!string.IsNullOrEmpty(l.F_Sign) && !string.IsNullOrEmpty(l.F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
- string strparams = "?start=" + start.Value.ToString("yyyy-MM-dd") + "&end=" + end.Value.ToString("yyyy-MM-dd") + "&type=" + type + "&signcode=" + signcode;
- AjaxResult ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams).ToObject<AjaxResult>();
- if (ar.state.ToString() == ResultTypes.success.ToString())
- {
- var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
- result.AddRange(rtlist);
- }
- }
- }
- if (isdc > 0)
- {
- string[] cols = new string[] { "区县名称", "类型", "数量" };
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.ExportToExcel("统计报表", result, cols) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Success("成功", result);
- }
- /// <summary>
- /// 县区来源统计
- /// </summary>
- /// <param name="start"></param>
- /// <param name="end"></param>
- /// <returns></returns>
- public ActionResult GetAreaSourceCount(string branchcode, DateTime? start, DateTime? end, int isdc = 0)
- {
- if (start == null)
- {
- start = DateTime.Now;
- start = new DateTime(start.Value.Year, start.Value.Month, 1);
- }
- if (end == null)
- {
- end = DateTime.Now;
- }
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = "GetAreaCount";// RouteData.Values["action"].ToString();
- foreach (var l in list)
- {
- if (!string.IsNullOrEmpty(l.F_Sign) && !string.IsNullOrEmpty(l.F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
- string strparams = "?start=" + start.Value.ToString("yyyy-MM-dd") + "&end=" + end.Value.ToString("yyyy-MM-dd") + "&type=1&signcode=" + signcode;
- AjaxResult ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams).ToObject<AjaxResult>();
- if (ar.state.ToString() == ResultTypes.success.ToString())
- {
- var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
- result.AddRange(rtlist);
- }
- }
- }
- ArrayList areas = new ArrayList();
- string[] sources = new string[] { "电话", "12345信箱", "微博", "网站", "微信", "手机APP", "政务服务网" };
- DataTable dt = new DataTable();
- dt.Columns.Add("县区/渠道");
- foreach (var source in sources)
- {
- dt.Columns.Add(source,typeof(int));
- }
- dt.Columns.Add("合计", typeof(int));
- DataRow dr = dt.NewRow();
- int i = 0;
- int sum = 0;
- foreach (Dictionary<string, object> l in result)
- {
- string area= l["areaname"].ToString();
- string source = l["source"].ToString();
- if (!areas.Contains(area))
- {
- areas.Add(area);
- if (i != 0)
- {
- dr["合计"] = sum;
- dt.Rows.Add(dr);
- sum = 0;
- dr = dt.NewRow();
- }
- dr["县区/渠道"] = area;
- i++;
- }
- if (sources.Contains(source))
- {
- dr[source] = l["count"].ToString();
- sum += Int32.Parse(l["count"].ToString());
- }
- }
- dr["合计"] = sum;
- dt.Rows.Add(dr);
- dr = dt.NewRow();
- dr["县区/渠道"] = "合计";
- dr["电话"] = dt.Compute("sum([电话])", "true").ToString();
- dr["12345信箱"] = dt.Compute("sum([12345信箱])", "true").ToString();
- dr["微博"] = dt.Compute("sum([微博])", "true").ToString();
- dr["网站"] = dt.Compute("sum([网站])", "true").ToString();
- dr["微信"] = dt.Compute("sum([微信])", "true").ToString();
- dr["手机APP"] = dt.Compute("sum([手机APP])", "true").ToString();
- dr["政务服务网"] = dt.Compute("sum([政务服务网])", "true").ToString();
- dr["合计"] = dt.Compute("sum([合计])", "true").ToString();
- dt.Rows.Add(dr);
- if (isdc > 0)
- {
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.ExportToExcel("来源统计报表", dt) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Success("成功", dt);
- }
- /// <summary>
- /// 办理率统计
- /// </summary>
- /// <param name="branchcode"></param>
- /// <param name="month"></param>
- /// <param name="isdc"></param>
- /// <returns></returns>
- public ActionResult GetAreaEndRate(string branchcode, string month, int isdc = 0)
- {
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- foreach (var l in list)
- {
- if (!string.IsNullOrEmpty(l.F_Sign) && !string.IsNullOrEmpty(l.F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, l.F_Sign);
- string strparams = "?month=" + month + "&signcode=" + signcode;
- AjaxResult ar = HttpMethods.HttpGet(l.F_Url + "/" + controllername + "/" + actionname + strparams).ToObject<AjaxResult>();
- if (ar.state.ToString() == ResultTypes.success.ToString())
- {
- var rtlist = ar.data.ToJson().ToList<Dictionary<string, object>>();
- result.AddRange(rtlist);
- }
- }
- }
- if (isdc > 0)
- {
- string[] cols = new string[] { "区县名称", "受理量", "办理量", "结案量", "结案率" };
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.ExportToExcel("县区结案率报表", result, cols) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Success("成功", result);
- }
- /// <summary>
- /// 获取简报月
- /// </summary>
- /// <param name="branchcode"></param>
- /// <param name="month"></param>
- /// <param name="isdc"></param>
- /// <returns></returns>
- public ActionResult GetSimpleReport(string branchcode, string month, int isdc = 0)
- {
- string sqlwhere = " F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(branchcode))
- {
- sqlwhere += " and F_Code='" + branchcode + "'";
- }
- else
- {
- return Error("请选择区县");
- }
- //ArrayList result = new ArrayList();
- var list = new BLL.T_Branch_List().GetModelList(sqlwhere);
- if (list.Count == 0)
- {
- return Error("查询失败");
- }
- string controllername = RouteData.Values["controller"].ToString();
- string actionname = RouteData.Values["action"].ToString();
- if (!string.IsNullOrEmpty(list[0].F_Url))
- {
- string signcode = CommonHelper.getsigncode(controllername, actionname, list[0].F_Sign);
- string strparams = "?month=" + month + "&signcode=" + signcode;
- string result = HttpMethods.HttpGet(list[0].F_Url + "/" + controllername + "/" + actionname + strparams);
- if (isdc > 0)
- {
- AjaxResult ar = result.ToObject<AjaxResult>();
- NPOIHelper npoi = new NPOIHelper();
- if (npoi.SimpleExportToExcel(ar.data.ToJson().ToObject<DataSet>()) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return Content(result);
- }
- else
- {
- var obj = new
- {
- state = "error",
- message = "查询失败"
- };
- return Content(obj.ToJson());
- }
- }
- }
- }
|