| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.DB;
- using CallCenterApi.Interface.Controllers.Base;
- using CallCenterApi.Interface.Controllers.workorder;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Transactions;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers
- {
- public class WebController : BaseController
- {
- private BLL.T_Web_Link linkBLL = new BLL.T_Web_Link();
- private BLL.T_Web_News newsBLL = new BLL.T_Web_News();
- private BLL.T_Web_SurveyResult resBLL = new BLL.T_Web_SurveyResult();
- private BLL.T_Web_WorkRelease fbBLL = new BLL.T_Web_WorkRelease();
- #region 链接地址
- /// <summary>
- /// 获取链接列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetLinkList()
- {
- string name = RequestString.GetQueryString("name");
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- var sql = " and 1=1 ";
- if (!string.IsNullOrEmpty(name))
- {
- sql += " and LinkName like '%" + name + "%'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- var recordCount = 0;
- var dt = BLL.PagerBLL.GetListPager(
- "T_Web_Link",
- "Id",
- "*",
- sql,
- "ORDER BY Id ",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取链接
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- [Authority]
- public ActionResult GetLink()
- {
- int id = RequestString.GetInt("id", 0);
- Model.T_Web_Link baseModel = linkBLL.GetModel(id);
- if (baseModel != null)
- return Success("加载成功", baseModel);
- else
- return Error("加载失败");
- }
- /// <summary>
- /// 添加/编辑链接
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult AddLink()
- {
- int id = RequestString.GetInt("id", 0);
- string name = RequestString.GetFormString("name");
- string url = RequestString.GetFormString("url");
- Model.T_Web_Link orderModel = new Model.T_Web_Link();
- if (id == 0)
- {
- var list = linkBLL.GetModelList("LinkName='" + name + "' ");
- if (list.Count > 0)
- {
- return Error("此链接名称已经存在");
- }
- else
- {
- orderModel.LinkName = name;
- orderModel.LinkUrl = url;
- if (linkBLL.Add(orderModel) > 0)
- return Success("链接添加成功");
- else
- return Error("链接添加失败");
- }
- }
- else
- {
- orderModel = linkBLL.GetModel(id);
- if (orderModel != null)
- {
- var list = linkBLL.GetModelList("LinkName='" + name + "' and Id!='" + id + "' ");
- if (list.Count > 0)
- {
- return Error("此链接名称已经存在");
- }
- else
- {
- orderModel.LinkName = name;
- orderModel.LinkUrl = url;
- if (linkBLL.Update(orderModel))
- return Success("链接修改成功");
- else
- return Error("链接修改失败");
- }
- }
- else
- {
- return Success("链接修改成功");
- }
- }
- }
- /// <summary>
- /// 删除链接
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult DelLink(string[] ids)
- {
- if (ids == null || ids.Length <= 0)
- return Error("获取参数失败");
- StringBuilder sb = new StringBuilder();
- foreach (var item in ids)
- {
- sb.Append("'" + item + "',");
- }
- if (linkBLL.DeleteList(sb.ToString().Trim(',')))
- return Success("删除成功");
- else
- return Error("删除失败");
- }
- #endregion
- #region 新闻
- /// <summary>
- /// 上传图片
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult UploadImage()
- {
- string path = string.Empty;
- //HttpPostedFile _upfile = RequestString.GetFile("upFile");
- string dataurl = HttpUtility.UrlDecode(RequestString.GetFormString("dataurl"));
- if (!string.IsNullOrEmpty(dataurl))
- {
- path = "/Upload/News/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
- ImageUpload iu = new ImageUpload();
- iu.SavePath = path;
- iu.DataUrl = dataurl;
- iu.Upload64();
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- int n = iu.Error;
- if (n == 0)
- {
- var obj = new
- {
- ym = configfj != null ? configfj.F_ParamValue : "",
- imgurl = path + iu.OutFileName,
- smallimgurl = path + iu.OutThumbFileName
- };
- return Success("成功", obj);
- }
- else
- {
- string msg = string.Empty;
- switch (n)
- {
- case 1: msg = "请选择要上传的文件"; break;
- case 2: msg = "上传的文件类型不支持"; break;
- case 3: msg = "上传的文件过大"; break;
- case 4: msg = "未知错误"; break;
- }
- return Error(msg);
- }
- }
- else
- {
- return Error("请选择要上传的文件");
- }
- }
- /// <summary>
- /// 获取新闻列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetNewsList()
- {
- int type = RequestString.GetInt("type", 0);
- string name = RequestString.GetQueryString("name");
- int iszd = RequestString.GetInt("iszd", -1);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- var sql = " and 1=1 ";
- if (type != 0)
- {
- sql += " and ClassId = '" + type + "'";
- }
- if (!string.IsNullOrEmpty(name))
- {
- sql += " and bt like '%" + name + "%'";
- }
- if (iszd != -1)
- {
- sql += " and isnull(iszd,0) = '" + iszd + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- var recordCount = 0;
- var dt = BLL.PagerBLL.GetListPager(
- "T_Web_News",
- "id",
- "*",
- sql,
- "ORDER BY ordernum asc,sj desc ",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- dt.Columns.Add("UserCode", typeof(string));
- foreach (DataRow dr in dt.Rows)
- {
- string id = (dr["zxbh"] == null ? "" : dr["zxbh"].ToString());
- if (id != "")
- {
- var u = new BLL.T_Sys_UserAccount().GetModel(Int32.Parse(id));
- if (u != null)
- {
- dr["UserCode"] = u.F_UserCode;
- }
- }
- string url = (dr["img"] == null ? "" : dr["img"].ToString());
- string smallurl = (dr["urlname"] == null ? "" : dr["urlname"].ToString());
- if (!string.IsNullOrEmpty(url) && configfj != null)
- {
- dr["img"] = configfj.F_ParamValue + url;
- }
- if (!string.IsNullOrEmpty(smallurl) && configfj != null)
- {
- dr["urlname"] = configfj.F_ParamValue + smallurl;
- }
- }
- var obj = new
- {
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取新闻
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- [Authority]
- public ActionResult GetNews()
- {
- int id = RequestString.GetInt("id", 0);
- Model.T_Web_News baseModel = newsBLL.GetModel(id);
- if (baseModel != null)
- {
- string ym = "";
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- if (configfj != null)
- {
- ym = configfj.F_ParamValue;
- }
- var obj = new
- {
- bt = baseModel.bt,
- ClassId = baseModel.ClassId,
- id = baseModel.id,
- img = baseModel.img,
- iszd = baseModel.iszd,
- nr = baseModel.nr,
- ordernum = baseModel.ordernum,
- sj = baseModel.sj,
- urlname = baseModel.urlname,
- zxbh = baseModel.zxbh,
- ym = ym
- };
- return Success("加载成功", obj);
- }
- else
- {
- return Error("加载失败");
- }
- }
- /// <summary>
- /// 添加/编辑新闻
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult AddNews()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
- int id = RequestString.GetInt("id", 0);
- int type = RequestString.GetInt("type", 0);
- int sort = RequestString.GetInt("sort", 0);
- int iszd = RequestString.GetInt("iszd", 0);
- string title = RequestString.GetFormString("title");
- string cont = WebHelper.UrlDecode(RequestString.GetFormString("cont"));
- string img = RequestString.GetFormString("img");
- string smallimg = RequestString.GetFormString("smallimg");
- Model.T_Web_News orderModel = new Model.T_Web_News();
- if (id == 0)
- {
- orderModel.ClassId = type;
- orderModel.bt = title;
- orderModel.img = img;
- orderModel.urlname = smallimg;
- orderModel.nr = cont;
- orderModel.ordernum = sort;
- orderModel.iszd = iszd;
- orderModel.zxbh = userModel.F_UserId;
- if (newsBLL.Add(orderModel) > 0)
- {
- if (iszd > 0)
- //CacheHelper.Remove($"ImgNewsList{type}1");
- RedisHelper.KeyDelete($"ImgNewsList{type}1");
- else
- //CacheHelper.Remove($"NewsList{type}");
- RedisHelper.KeyDelete($"NewsList{type}");
- return Success("新闻添加成功");
- }
- else
- return Error("新闻添加失败");
- }
- else
- {
- orderModel = newsBLL.GetModel(id);
- if (orderModel != null)
- {
- orderModel.ClassId = type;
- orderModel.bt = title;
- orderModel.img = img;
- orderModel.urlname = smallimg;
- orderModel.nr = cont;
- orderModel.ordernum = sort;
- orderModel.iszd = iszd;
- if (newsBLL.Update(orderModel))
- {
- if (iszd > 0)
- //CacheHelper.Remove($"ImgNewsList{type}1");
- RedisHelper.KeyDelete($"ImgNewsList{type}1");
- else
- //CacheHelper.Remove($"NewsList{type}");
- RedisHelper.KeyDelete($"NewsList{type}");
- //CacheHelper.Remove($"WebNews{orderModel.id}");
- RedisHelper.KeyDelete($"WebNews{orderModel.id}");
- return Success("新闻修改成功");
- }
- else
- return Error("新闻修改失败");
- }
- else
- {
- return Error("新闻修改失败");
- }
- }
- }
- /// <summary>
- /// 删除新闻
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult DelNews(string[] ids)
- {
- if (ids == null || ids.Length <= 0)
- return Error("获取参数失败");
- StringBuilder sb = new StringBuilder();
- foreach (var item in ids)
- {
- sb.Append("'" + item + "',");
- }
- if (newsBLL.DeleteList(sb.ToString().Trim(',')))
- {
- foreach (var id in ids)
- {
- //CacheHelper.Remove($"WebNews{id}");
- RedisHelper.KeyDelete($"WebNews{id}");
- }
- //System.Web.Caching.Cache cache = HttpRuntime.Cache;
- //IDictionaryEnumerator cacheEnum = cache.GetEnumerator();
- //List<string> keys = new List<string>();
- //while (cacheEnum.MoveNext())
- //{
- // keys.Add(cacheEnum.Key.ToString());
- //}
- //var query = keys.Where(x => x.Contains("ImgNewsList") || x.Contains("NewsList")).ToList();
- //foreach (var key in query)
- //{
- // CacheHelper.Remove(key);
- //}
- RedisHelper.KeysDelete(RedisHelper.GetKeyList("ImgNewsList"));
- RedisHelper.KeysDelete(RedisHelper.GetKeyList("NewsList"));
- return Success("删除成功");
- }
- else
- return Error("删除失败");
- }
- #endregion
- #region 发布
- /// <summary>
- /// 获取发布工单列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetReleaseList()
- {
- string title = RequestString.GetQueryString("title");
- string cont = RequestString.GetQueryString("cont");
- string workorderid = RequestString.GetQueryString("workorderid");
- string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- int efftstate = RequestString.GetInt("efftstate", 0);
- string starttime1 = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime1"));
- string endtime1 = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime1"));
- int state = RequestString.GetInt("state", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- var sql = " and 1=1 ";
- if (!string.IsNullOrEmpty(title))
- {
- sql += " and F_Title like '%" + title + "%' ";
- }
- if (!string.IsNullOrEmpty(cont))
- {
- sql += " and F_Content like '%" + cont + "%' ";
- }
- if (!string.IsNullOrEmpty(workorderid))
- {
- sql += " and F_WorkOrderId like '%" + workorderid + "%' ";
- }
- if (!string.IsNullOrEmpty(starttime))
- {
- sql += " and datediff(d,F_AcceptTime,'" + starttime + "')<=0 ";
- }
- if (!string.IsNullOrEmpty(endtime))
- {
- sql += " and datediff(d,F_AcceptTime,'" + endtime + "')>=0 ";
- }
- if (efftstate != 0)
- {
- sql += " and F_EffectiveState=" + efftstate;
- if (efftstate == 2)
- {
- if (!string.IsNullOrEmpty(starttime1))
- {
- sql += " and datediff(d,F_EffectiveTime,'" + starttime1 + "')<=0 ";
- }
- if (!string.IsNullOrEmpty(endtime1))
- {
- sql += " and datediff(d,F_EffectiveTime,'" + endtime1 + "'>=0 ";
- }
- }
- }
- if (state != 0)
- {
- sql += " and F_ReleaseState=" + state;
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- var recordCount = 0;
- var dt = BLL.PagerBLL.GetListPager(
- "T_Web_WorkRelease",
- "F_WorkOrderId",
- "*,dbo.GetDeptName(F_Department) as F_DeptName,dbo.GetDictionaryName(F_WorkSort) as F_Value",
- sql,
- "order by F_WorkOrderId desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取发布工单
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- [Authority]
- public ActionResult GetRelease()
- {
- string workorderid = RequestString.GetQueryString("workorderid");
- Model.T_Web_WorkRelease baseModel = fbBLL.GetModel(workorderid);
- if (baseModel != null)
- return Success("加载成功", baseModel);
- else
- return Error("加载失败");
- }
- /// <summary>
- /// 发布
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult EditRelease()
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int state = RequestString.GetInt("state", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string acceptime = RequestString.GetFormString("acceptime");
- string backtime = RequestString.GetFormString("backtime");
- string result = RequestString.GetFormString("result");
- string fbtime = RequestString.GetFormString("fbtime");
- string opinion = RequestString.GetFormString("opinion");
- Model.T_Web_WorkRelease orderModel = new Model.T_Web_WorkRelease();
- orderModel = fbBLL.GetModel(workorderid);
- if (orderModel != null)
- {
- orderModel.F_ReleaseState = state;
- if (!string.IsNullOrEmpty(fbtime))
- {
- orderModel.F_ReleaseTime = DateTime.Parse(fbtime);
- }
- orderModel.F_Department = deptid;
- orderModel.F_WorkSort = smalltype;
- if (!string.IsNullOrEmpty(acceptime))
- {
- orderModel.F_AcceptTime = DateTime.Parse(acceptime);
- }
- if (!string.IsNullOrEmpty(backtime))
- {
- orderModel.F_BackDate = DateTime.Parse(backtime);
- }
- orderModel.F_Result = result;
- orderModel.F_Opinion = opinion;
- if (fbBLL.Update(orderModel))
- return Success("成功");
- else
- return Error("失败");
- }
- else
- {
- return Success("成功");
- }
- }
- /// <summary>
- /// 更新状态
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult UpdateReleaseState()
- {
- string workid = RequestString.GetFormString("workid");
- int ste = RequestString.GetInt("state", 0);
- var model = new BLL.T_Web_WorkRelease().GetModel(workid);
- if (model != null && ste != 0)
- {
- model.F_ReleaseState = ste;
- if (new BLL.T_Web_WorkRelease().Update(model))
- {
- return Success("成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- /// <summary>
- /// 删除发布
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult DelRelease(string[] ids)
- {
- if (ids == null || ids.Length <= 0)
- return Error("获取参数失败");
- StringBuilder sb = new StringBuilder();
- foreach (var item in ids)
- {
- sb.Append("'" + item + "',");
- }
- if (new BLL.T_Web_WorkRelease().DeleteList(sb.ToString().Trim(',')))
- return Success("删除成功");
- else
- return Error("删除失败");
- }
- #endregion
- #region 官网
- /// <summary>
- /// 获取最新新闻列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetTopImgNewsList()
- {
- int type = RequestString.GetInt("type", 0);
- int num = RequestString.GetInt("num", 6);
- //var dtCache = CacheHelper.Get<DataTable>($"ImgNewsList{type}1");
- var dtCache = RedisHelper.StringGet($"ImgNewsList{type}1");
- if (dtCache != null)
- {
- return Success("成功", dtCache.ToString().ToObject<DataTable>());
- }
- var sql = " select top " + num + " * from T_Web_News where iszd=1 ";
- Dictionary<string, string> paras = new Dictionary<string, string>();
- if (type != 0)
- {
- sql += " and ClassId = @ClassId";
- paras.Add("@ClassId", type.ToString());
- }
- sql += " order by ordernum asc,sj desc";
- var dt = DbHelperSQL.Query(sql, paras).Tables[0];
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- string url = (dr["img"] == null ? "" : dr["img"].ToString());
- string smallurl = (dr["urlname"] == null ? "" : dr["urlname"].ToString());
- if (!string.IsNullOrEmpty(url) && configfj != null)
- {
- dr["img"] = configfj.F_ParamValue + url;
- }
- if (!string.IsNullOrEmpty(smallurl) && configfj != null)
- {
- dr["urlname"] = configfj.F_ParamValue + smallurl;
- }
- }
- //// key=ImgNewsList+type+iszd
- //CacheHelper.Insert($"ImgNewsList{type}1", dt, 10);
- RedisHelper.StringSet($"ImgNewsList{type}1", dt.ToJson(), new TimeSpan(0, 10, 0));
- return Success("成功", dt);
- }
- /// <summary>
- /// 获取最新新闻列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetTopNewsList()
- {
- int type = RequestString.GetInt("type", 0);
- int num = RequestString.GetInt("num", 8);
- //var dtCache = CacheHelper.Get<DataTable>($"NewsList{type}");
- var dtCache = RedisHelper.StringGet($"NewsList{type}");
- if (dtCache != null)
- {
- return Success("成功", dtCache.ToString().ToObject<DataTable>());
- }
- var sql = " select top " + num + " * from T_Web_News where 1=1 ";
- Dictionary<string, string> paras = new Dictionary<string, string>();
- if (type != 0)
- {
- sql += " and ClassId = @ClassId";
- paras.Add("@ClassId", type.ToString());
- }
- sql += " order by ordernum asc,sj desc";
- var dt = DbHelperSQL.Query(sql, paras).Tables[0];
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- string url = (dr["img"] == null ? "" : dr["img"].ToString());
- string smallurl = (dr["urlname"] == null ? "" : dr["urlname"].ToString());
- if (!string.IsNullOrEmpty(url) && configfj != null)
- {
- dr["img"] = configfj.F_ParamValue + url;
- }
- if (!string.IsNullOrEmpty(smallurl) && configfj != null)
- {
- dr["urlname"] = configfj.F_ParamValue + smallurl;
- }
- }
- //// key=NewsList+type
- //CacheHelper.Insert($"NewsList{type}", dt, 10);
- RedisHelper.StringSet($"NewsList{type}",dt.ToJson(), new TimeSpan(0, 10, 0));
- return Success("成功", dt);
- }
- /// <summary>
- /// 获取新闻
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- public ActionResult GetWebNews()
- {
- int id = RequestString.GetInt("id", 0);
- //var newsCache = CacheHelper.Get<Model.T_Web_News>($"WebNews{id}");
- var newsCache = RedisHelper.StringGet($"WebNews{id}");
- if (newsCache != null)
- {
- return Success("成功", newsCache.ToString().ToObject<Model.T_Web_News>());
- }
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- var configfjedit = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='EditFilePath' ").FirstOrDefault();
- Model.T_Web_News baseModel = newsBLL.GetModel(id);
- if (baseModel != null)
- {
- if (!string.IsNullOrEmpty(baseModel.img) && configfj != null)
- {
- baseModel.img = configfj.F_ParamValue + baseModel.img;
- }
- if (!string.IsNullOrEmpty(baseModel.urlname) && configfj != null)
- {
- baseModel.urlname = configfj.F_ParamValue + baseModel.urlname;
- }
- if (!string.IsNullOrEmpty(baseModel.nr) && configfjedit != null)
- {
- Uri uri = new Uri(configfjedit.F_ParamValue);
- baseModel.nr = baseModel.nr.Replace("\"/js/kindeditor", "\"" + uri.Scheme + "://" + uri.Authority + "/js/kindeditor");
- }
- //// key=action+id
- //CacheHelper.Insert($"WebNews{id}", baseModel, 10);
- RedisHelper.StringSet($"WebNews{id}",baseModel.ToJson(), new TimeSpan(0, 10, 0));
- return Success("加载成功", baseModel);
- }
- else
- {
- return Error("加载失败");
- }
- }
- /// <summary>
- /// 获取新闻列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebNewsList()
- {
- int type = RequestString.GetInt("type", 0);
- string name = RequestString.GetQueryString("name");
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- var sql = " and 1=1 ";
- if (type != 0)
- {
- sql += " and ClassId = '" + type + "'";
- }
- if (!string.IsNullOrEmpty(name))
- {
- sql += " and bt like '%" + name + "%'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- var recordCount = 0;
- var dt = BLL.PagerBLL.GetListPager(
- "T_Web_News",
- "id",
- "*",
- sql,
- "ORDER BY ordernum asc,sj desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- dt.Columns.Add("UserCode", typeof(string));
- foreach (DataRow dr in dt.Rows)
- {
- string id = (dr["zxbh"] == null ? "" : dr["zxbh"].ToString());
- if (id != "")
- {
- var u = new BLL.T_Sys_UserAccount().GetModel(Int32.Parse(id));
- if (u != null)
- {
- dr["UserCode"] = u.F_UserCode;
- }
- }
- string url = (dr["img"] == null ? "" : dr["img"].ToString());
- string smallurl = (dr["urlname"] == null ? "" : dr["urlname"].ToString());
- if (!string.IsNullOrEmpty(url) && configfj != null)
- {
- dr["img"] = configfj.F_ParamValue + url;
- }
- if (!string.IsNullOrEmpty(smallurl) && configfj != null)
- {
- dr["urlname"] = configfj.F_ParamValue + smallurl;
- }
- }
- var obj = new
- {
- state = ResultTypes.success.ToString(),
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取新闻列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetAllWebNews()
- {
- int type = RequestString.GetInt("type", 0);
- string name = RequestString.GetQueryString("name");
- var sql = " 1=1 ";
- if (type != 0)
- {
- sql += " and ClassId = '" + type + "'";
- }
- if (!string.IsNullOrEmpty(name))
- {
- sql += " and bt like '%" + name + "%'";
- }
- var dt = new BLL.T_Web_News().GetList(0, sql, " ordernum asc,sj desc ").Tables[0];
- var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- dt.Columns.Add("UserCode", typeof(string));
- foreach (DataRow dr in dt.Rows)
- {
- string id = (dr["zxbh"] == null ? "" : dr["zxbh"].ToString());
- if (id != "")
- {
- var u = new BLL.T_Sys_UserAccount().GetModel(Int32.Parse(id));
- if (u != null)
- {
- dr["UserCode"] = u.F_UserCode;
- }
- }
- string url = (dr["img"] == null ? "" : dr["img"].ToString());
- string smallurl = (dr["urlname"] == null ? "" : dr["urlname"].ToString());
- if (!string.IsNullOrEmpty(url) && configfj != null)
- {
- dr["img"] = configfj.F_ParamValue + url;
- }
- if (!string.IsNullOrEmpty(smallurl) && configfj != null)
- {
- dr["urlname"] = configfj.F_ParamValue + smallurl;
- }
- }
- return Success("成功",dt);
- }
- /// <summary>
- /// 获取发布工单列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebReleaseList()
- {
- string title = RequestString.GetQueryString("title");
- string cont = RequestString.GetQueryString("cont");
- string workorderid = RequestString.GetQueryString("workorderid");
- string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- int type = RequestString.GetInt("type", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- var sql = " and isnull(F_IsRelease,0) = 1 and F_IsDelete=0 ";
- if (!string.IsNullOrEmpty(title))
- {
- sql += " and F_Title like '%" + title + "%' ";
- }
- if (!string.IsNullOrEmpty(cont))
- {
- sql += " and F_Content like '%" + cont + "%' ";
- }
- if (!string.IsNullOrEmpty(workorderid))
- {
- sql += " and F_WorkOrderId like '%" + workorderid + "%' ";
- }
- if (!string.IsNullOrEmpty(starttime))
- {
- sql += " and datediff(d,F_CreateTime,'" + starttime + "')<=0 ";
- }
- if (!string.IsNullOrEmpty(endtime))
- {
- sql += " and datediff(d,F_CreateTime,'" + endtime + "')>=0 ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (deptid != 0)
- {
- sql += " and F_Department=" + deptid;
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (deptid != 0)
- {
- string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
- sql += " and F_WorkOrderID in(" + sqlwhere + ")";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- var recordCount = 0;
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetOverState(F_WorkOrderId) as OverState,"
- + "dbo.GetDictionaryName(F_InfoSource) as SourceName,dbo.GetWorkOrderAssign(F_WorkOrderId) as DeptName ,dbo.GetLimitTime(F_WorkOrderId) as LimitTime";
- var dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = ResultTypes.success.ToString(),
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取发布工单详情
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- public ActionResult GetWebRelease()
- {
- string workorderid = RequestString.GetQueryString("workorderid");
- Model.T_Web_WorkRelease baseModel = fbBLL.GetModel(workorderid);
- if (baseModel != null)
- {
- string where = " F_WorkOrderId=@F_WorkOrderId";
- Dictionary<string, string> paras = new Dictionary<string, string>();
- paras.Add("@F_WorkOrderId", workorderid);
- DbHelperSQL.ExecuteSql("update T_Web_WorkRelease set F_ViewCount=F_ViewCount+1 where " + where, paras);
- var obj = new
- {
- data = baseModel,
- deptname = DbHelperSQL.GetSingle(" select dbo.GetDeptName(" + baseModel.F_Department + ")"),
- classname = DbHelperSQL.GetSingle(" select dbo.GetDictionaryName(" + baseModel.F_WorkSort + ")")
- };
- return Success("加载成功", obj);
- }
- else
- {
- return Success("加载失败");
- }
- }
- /// <summary>
- /// 获取链接列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebLinkList()
- {
- string name = RequestString.GetQueryString("name");
- string where = " select * from T_Web_Link where 1=1 ";
- Dictionary<string, string> paras = new Dictionary<string, string>();
- if (!string.IsNullOrEmpty(name))
- {
- where += " and LinkName like @LinkName";
- paras.Add("@LinkName", "%" + name + "%");
- }
- var dt = DbHelperSQL.Query(where, paras).Tables[0];
- return Success("列表加载成功", dt);
- }
- /// <summary>
- /// 获取工单类型列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebTypeList()
- {
- string sql = "select * from T_Sys_DictionaryValue where F_ItemId=2 and F_State=0 ";
- var dt = DbHelperSQL.Query(sql).Tables[0];
- return Success("列表加载成功", dt);
- }
- /// <summary>
- /// 获取事发地域列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebAreaList()
- {
- string sql = "select * from T_Sys_Area where isnull(F_PrentId,0)=0 and F_State=0 ";
- var dt = DbHelperSQL.Query(sql).Tables[0];
- return Success("列表加载成功", dt);
- }
- /// <summary>
- /// 获取事发地域列表
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult GetWebAreaListById(int id = 0)
- {
- Dictionary<string, string> paras = new Dictionary<string, string>();
- paras.Add("@Id", id.ToString());
- DataTable dt = DbHelperSQL.Query(" select * from T_Sys_Area where isnull(F_PrentId,0)=@id and F_State=0 ", paras).Tables[0];
- return Success("列表加载成功", dt);
- }
- /// <summary>
- /// 获取工单类型列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebKeyList()
- {
- string sql = "select * from T_Sys_DictionaryValue where F_ItemId=3 and F_State=0 ";
- var dt = DbHelperSQL.Query(sql).Tables[0];
- return Success("列表加载成功", dt);
- }
- /// <summary>
- /// 获取部门列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebDeptList()
- {
- DataTable dt = new DataTable();
- dt = new BLL.T_Sys_Department().GetList(0, "F_State=0", " F_Sort").Tables[0];
- return Success("加载成功", dt);
- }
- /// <summary>
- /// 上传附件
- /// </summary>
- /// <returns></returns>
- public ActionResult UploadFile()
- {
- #region no use
- //string path = string.Empty;
- //HttpPostedFile _upfile = RequestString.GetFile("upFile");
- //if (_upfile != null)
- //{
- // //byte[] buffer = new Byte[(int)_upfile.InputStream.Length]; //声明文件长度的二进制类型
- // //_upfile.InputStream.Read(buffer, 0, buffer.Length); //将文件转成二进制
- // string name = string.Empty;
- // FileUp fu = new FileUp();
- // var model = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FilePath' ").FirstOrDefault();
- // if (model != null)
- // {
- // name = fu.Upload(_upfile, model.F_ParamValue);
- // return Success("成功", name);
- // }
- // else
- // {
- // return Error("上传失败");
- // }
- //}
- //else
- //{
- // return Error("请选择要上传的文件");
- //}
- #endregion
- #region 多个上传
- HttpFileCollection files = RequestString.GetFiles();
- if (files.Count > 0)
- {
- List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
- string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
- for (int i = 0; i < files.Count; i++)
- {
- HttpPostedFile file = files[i];
- FileUp fu = new FileUp();
- string name = fu.Upload(file, path);
- Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
- model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
- model_T_Sys_Accessories.F_FileName = name;//附件名称
- model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
- model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
- model_T_Sys_Accessories.F_Size = file.ContentLength;
- //model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
- int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
- model_T_Sys_Accessories.F_FileId = id;
- acs.Add(model_T_Sys_Accessories);
- }
- return Success("成功", acs);
- }
- else
- {
- return Error("请选择要上传的文件");
- }
- #endregion
- }
- /// <summary>
- /// 上传base64图片
- /// </summary>
- /// <returns></returns>
- public ActionResult Upload64()
- {
- //string dataurl = HttpUtility.UrlDecode(RequestString.GetFormString("dataurl"));
- string dataurl = RequestString.GetFormString("dataurl");
- string filename = RequestString.GetFormString("filename");
- if (!string.IsNullOrEmpty(dataurl))
- {
- string path = "/Upload/APP/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
- ImageUpload iu = new ImageUpload();
- iu.SavePath = path;
- iu.DataUrl = dataurl;
- if (!string.IsNullOrEmpty(filename))
- {
- iu.SaveType = 1;
- iu.InFileName = filename;
- }
- iu.Upload64();
- int n = iu.Error;
- if (n == 0)
- {
- path = path + iu.OutFileName;
- Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
- model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
- model_T_Sys_Accessories.F_FileName = iu.OutFileName;//附件名称
- model_T_Sys_Accessories.F_FileType = ".jpg";//附件类型
- model_T_Sys_Accessories.F_FileUrl = path;//附件地址
- model_T_Sys_Accessories.F_Size = iu.FileSize;
- //model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
- int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
- model_T_Sys_Accessories.F_FileId = id;
- return Success("成功", model_T_Sys_Accessories);
- }
- else
- {
- string msg = string.Empty;
- switch (n)
- {
- case 1: msg = "请选择要上传的文件"; break;
- case 2: msg = "上传的文件类型不支持"; break;
- case 3: msg = "上传的文件过大"; break;
- case 4: msg = "未知错误"; break;
- }
- return Error(msg);
- }
- }
- else
- {
- return Error("请选择要上传的文件");
- }
- }
- /// <summary>
- /// 添加工单信息(网上受理)
- /// </summary>
- /// <returns></returns>
- public ActionResult AddWebWorkOrder()
- {
- int source = RequestString.GetInt("source", 4);
- string cusname = RequestString.GetFormString("cusname");
- string cussex = RequestString.GetFormString("cussex");
- string cusphone = RequestString.GetFormString("cusphone");
- string cusaddress = RequestString.GetFormString("cusaddress");
- string email = RequestString.GetFormString("email");
- string zipcode = RequestString.GetFormString("zipcode");
- string conname = RequestString.GetFormString("conname");
- string conphone = RequestString.GetFormString("conphone");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- string sourceaddress = RequestString.GetFormString("sourceaddress");
- string keys = RequestString.GetFormString("keys");
- string splituser = RequestString.GetFormString("splituser");
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int isprotect = RequestString.GetInt("isprotect", 0);
- int level = RequestString.GetInt("level", 0);
- string workid = string.Empty;
- string pwd = string.Empty; ;
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- WorkOrderController wo = new WorkOrderController();
- string workorderid = wo.AddWorkOrderBySource(source, cusname, cussex, cusphone, cusaddress, email, zipcode, conname, conphone, title,
- content, sourcearea, sourceaddress, keys, splituser, type, bigtype, smalltype, isprotect, level, files);
- #endregion
- if (source == 4)
- {
- #region 保存密码
- BLL.T_Web_WorkAccountSearch WorkAccount = new BLL.T_Web_WorkAccountSearch();
- Model.T_Web_WorkAccountSearch WorkAccountInfo = new Model.T_Web_WorkAccountSearch();
- WorkAccountInfo.F_WorkOrderId = workorderid;
- pwd = Utils.Number(4);
- WorkAccountInfo.F_SearchPassword = pwd;
- WorkAccountInfo.F_AddTime = DateTime.Now;
- WorkAccount.Add(WorkAccountInfo);
- #endregion
- }
- workid = workorderid;
- trans.Complete();
- }
- var obj = new
- {
- workorderid = workid,
- password = pwd
- };
- return Success("成功", obj);
- }
- /// <summary>
- /// 检查密码
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- public ActionResult CheckWebPassword()
- {
- string workorderid = RequestString.GetQueryString("workorderid");
- string password = RequestString.GetQueryString("password");
- string sql = " select * from T_Web_WorkAccountSearch where F_WorkOrderId=@F_WorkOrderId and F_SearchPassword=@F_SearchPassword";
- Dictionary<string, string> paras = new Dictionary<string, string>();
- paras.Add("@F_WorkOrderId", workorderid);
- paras.Add("@F_SearchPassword", password);
- var dt = DbHelperSQL.Query(sql, paras).Tables[0];
- if (dt.Rows.Count > 0)
- {
- string sqlwork = "select top 1 *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName1,"
- //+ "dbo.GetDictionaryName(F_InfoConBigType) as TypeName2,dbo.GetDictionaryName(F_InfoConSmallType) as TypeName3,"
- + "dbo.GetWorkOrderAssign(F_WorkOrderId) as DeptName,dbo.GetDictionaryName(F_InfoSource) as SourceName ,"
- + "dbo.GetAreaName(F_SourceArea) as AreaName "
- + " from T_Bus_WorkOrder where F_WorkOrderId =@F_WorkOrderId ";
- Dictionary<string, string> paraswork = new Dictionary<string, string>();
- paraswork.Add("@F_WorkOrderId", workorderid);
- var dtwork = DbHelperSQL.Query(sqlwork, paraswork).Tables[0];
- if (dtwork.Rows.Count > 0)
- {
- dtwork.Columns.Add("StateName", typeof(string));
- if (dtwork.Rows[0]["F_IsEnabled"] != null)
- {
- if (dtwork.Rows[0]["F_IsDelete"].ToString() == "1" && dtwork.Rows[0]["F_IsEnabled"].ToString() == "0")
- {
- dtwork.Rows[0]["StateName"] = "受理中";
- }
- else if (dtwork.Rows[0]["F_WorkState"].ToString() != "9")
- {
- dtwork.Rows[0]["StateName"] = "办理中";
- }
- else if (dtwork.Rows[0]["F_WorkState"].ToString() == "9")
- {
- dtwork.Rows[0]["StateName"] = "已结案";
- }
- }
- }
- return Success("加载成功", dtwork);
- }
- else
- {
- return Error("受理编号或密码错误");
- }
- }
- /// <summary>
- /// 获取来源受理数
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebSourceCount()
- {
- string sql = " select F_Value Source,(select COUNT(1) from T_Bus_WorkOrder where F_IsDelete=0 "
- + " and F_InfoSource=F_ValueId) Count from dbo.T_Sys_DictionaryValue where F_ItemId=1 and F_State=0 ";
- DataTable dt = DbHelperSQL.Query(sql).Tables[0];
- string sqlday = " select F_Value Source,(select COUNT(1) from T_Bus_WorkOrder where datediff(day,F_CreateTime,getdate())=0 and F_IsDelete=0 "
- + " and F_InfoSource=F_ValueId) Count from dbo.T_Sys_DictionaryValue where F_ItemId=1 and F_State=0 ";
- DataTable dtday = DbHelperSQL.Query(sqlday).Tables[0];
- var obj = new
- {
- total = dt,
- day = dtday,
- dayaccept = DbHelperSQL.GetSingle("select COUNT(1) from T_Bus_WorkOrder where datediff(day,F_CreateTime,getdate())=0 and F_IsDelete=0").ToString(),
- dayassign= DbHelperSQL.GetSingle("select COUNT(1) from T_Bus_WorkOrder where datediff(day,F_CreateTime,getdate())=0 and F_IsDelete=0 and isnull(F_IsResult,0)=0 and F_WorkState>1").ToString()
- };
- return Success("加载成功", obj);
- }
- /// <summary>
- /// 获取类型比例
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebTypePercent()
- {
- var typelist = new BLL.T_Sys_DictionaryValue().GetModelList(" F_ItemId=2 ");
- string sql = " select count(1) from dbo.T_Bus_WorkOrder where F_IsDelete = 0 ";
- var tl = Int32.Parse(DbHelperSQL.GetSingle(sql).ToString());
- var obj = typelist.Select(p =>
- {
- string sqltype = " select count(1) from dbo.T_Bus_WorkOrder where F_IsDelete = 0 and F_InfoType=" + p.F_ValueId;
- var cl = Int32.Parse(DbHelperSQL.GetSingle(sqltype).ToString());
- return new
- {
- typename = p.F_Value,
- percent = tl > 0 ? Math.Round(((double)cl * 100 / tl), 2) : 0
- };
- });
- return Success("加载成功", obj);
- }
- /// <summary>
- /// 获取类型比例
- /// </summary>
- /// <returns></returns>
- public ActionResult GetWebKeyCount(int isscqt = 0)
- {
- string strwhere = " F_ItemId=3 ";
- if (isscqt > 0)
- {
- strwhere += " and F_Value != '其他' ";
- }
- var typelist = new BLL.T_Sys_DictionaryValue().GetModelList(strwhere);
- var obj = typelist.Select(p =>
- {
- string sqltype = " select count(1) from dbo.T_Bus_WorkOrder where F_IsDelete = 0 and ','+F_Key+',' like '%," + p.F_ValueId + ",%'";
- var cl = Int32.Parse(DbHelperSQL.GetSingle(sqltype).ToString());
- return new
- {
- keyname = p.F_Value,
- count = cl
- };
- }).OrderByDescending(p => p.count).Take(7);
- return Success("加载成功", obj);
- }
- #endregion
- }
- }
|