12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Dynamic;
- using System.IO;
- using System.Web;
- using System.Web.Mvc;
- using PMS.BusinessModels;
- using PMS.BusinessModels.Account;
- using PMS.BusinessModels.ComplaintManage;
- using PMS.BusinessModels.Problem;
- using PMS.EntityModels.Product;
- using PMS.Interface;
- using PMS.Interface.PresonManager;
- using PMS.Interface.Problems;
- using PMS.Interface.Product;
- using PMS.Interface.ProManager;
- using PMS.Interface.WorkFlow;
- using QWPlatform.SystemLibrary;
- using QWPlatform.SystemLibrary.LogManager;
- using QWPlatform.SystemLibrary.Utils;
- using PMS.Interface.Support;
- using System.Threading.Tasks;
- using System.Text;
- using System.Web.Services.Description;
- using System.Security.Cryptography;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Xml;
- using Newtonsoft.Json.Linq;
- using Newtonsoft.Json;
- using System.Web.Script.Serialization;
- using PMS.EntityModels.ProManager;
- using PMS.EntityModels.Problem;
- using PMS.Interface.MessageManage;
- using PMS.BusinessModels.SMS;
- using System.Text.RegularExpressions;
- using PMS.Plugins.Common;
- using System.Linq;
- using static System.Net.WebRequestMethods;
- using PMS.Plugins.AliFileUpload;
- using PMS.BusinessModels.MobileProblem;
- namespace PMS.WebUI.Controllers
- {
- /// <summary>
- /// 创 建 人:王海洋
- /// 创建日期:2018-12-24
- /// 功能描述:问题管理控制器
- /// </summary>
- public class ProblemController : BaseController
- {
- #region 接口实例
- ICPWTJLModel CPWTJL_obj = InterfaceFactory.CreateBusinessInstance<ICPWTJLModel>();
- IZDYCXModel ZDYCX_obj = InterfaceFactory.CreateBusinessInstance<IZDYCXModel>();
- IProModule ProModule = InterfaceFactory.CreateBusinessInstance<IProModule>();
- IZDYCXModel ZdycxModel = InterfaceFactory.CreateBusinessInstance<IZDYCXModel>();
- ICPWTGCModel ZpwtgcModel = InterfaceFactory.CreateBusinessInstance<ICPWTGCModel>();
- IPersonModule PersonModule = InterfaceFactory.CreateBusinessInstance<IPersonModule>();
- IWorkFlow WorkFlowModule = InterfaceFactory.CreateBusinessInstance<IWorkFlow>();
- IWTJLGCModel WtJlGcModule = InterfaceFactory.CreateBusinessInstance<IWTJLGCModel>();
- IWTJLModel WTJL_obj = InterfaceFactory.CreateBusinessInstance<IWTJLModel>();
- IWTGTGCModel WTGTG_obj = InterfaceFactory.CreateBusinessInstance<IWTGTGCModel>();
- ISupport support = InterfaceFactory.CreateBusinessInstance<ISupport>();
- IProduct product = InterfaceFactory.CreateBusinessInstance<IProduct>();
- IReport IReport = InterfaceFactory.CreateBusinessInstance<IReport>();
- //项目问题管理
- IProjectProblems projectProblems = InterfaceFactory.CreateBusinessInstance<IProjectProblems>();
- //推送消息
- IMessageManage notice = InterfaceFactory.CreateBusinessInstance<IMessageManage>();
-
- #endregion 公共方法
- #region 公共方法
- //获取基础编码
- public ActionResult GetBaseCode(string type)
- {
- return Content(CPWTJL_obj.GetBaseCode(type), "text/json");
- }
- /// <summary>
- /// 日期计算方法
- /// </summary>
- /// <param type="type">1.一周 2.两周 3.一个月 4.两个月 5.三个月 6.半年</param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetDateRange(int type)
- {
- var jss = new JavaScriptSerializer();
- var Sdate = "";
- var Edate = "";
- try
- {
- switch (type)
- {
- case 1: Sdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); Edate = DateTime.Parse(DateTime.Now.AddDays(7).ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); break;
- case 2: Sdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); Edate = DateTime.Parse(DateTime.Now.AddDays(14).ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); break;
- case 3: Sdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); Edate = DateTime.Parse(DateTime.Now.AddDays(30).ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); break;
- case 4: Sdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); Edate = DateTime.Parse(DateTime.Now.AddDays(60).ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); break;
- case 5: Sdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); Edate = DateTime.Parse(DateTime.Now.AddDays(90).ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); break;
- case 6: Sdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); Edate = DateTime.Parse(DateTime.Now.AddDays(180).ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd"); break;
- }
- var obj = new { state = true, Sdate, Edate };
- return Content(jss.Serialize(obj), "application/json");
- }
- catch (Exception ex)
- {
- Logger.Instance.Error("调用GetDateRange时发生异常错误", ex);
- return Content(jss.Serialize(new { state = false, Sdate, Edate }), "application/json"); ;
- }
- }
- #endregion
- #region 信息查询
- //获取所有迭代
- public ActionResult GetLterationList()
- {
- return Content(CPWTJL_obj.GetLterationList(), "applciation/json");
- }
- //获取所有获取反馈人
- [HttpPost]
- public ActionResult GetFKR(string id)
- {
- var json = CPWTJL_obj.GetFKR(id,base.GetCurrentUser().CompanyID);//渠道ID
- return Content(json, "application/json");
- }
- //根据项目ID获取产品信息
- public string GetProductByID(string id)
- {
- return CPWTJL_obj.GetProductByID(id);
- }
- //获取关注的产品信息
- [HttpPost]
- public ActionResult GetMyConfig(string id)
- {
- var myconfig = base.GetMyConfigInfo()?.ProductID; /*ModuleID*/
- if (myconfig != null)
- {
- return Content(CPWTJL_obj.GetMyConfig(myconfig, id), "application/json");
- }
- return null;
- }
- //获取关注的模块信息
- [HttpPost]
- public ActionResult GetMyConfigModual(string id)
- {
- var myconfig = base.GetMyConfigInfo()?.ModuleID;
- if (myconfig != null)
- {
- return Content(CPWTJL_obj.GetMyConfigModual(myconfig, id), "application/json");
- }
- return null;
- }
- //我的关注产品和模块
- [HttpPost]
- public ActionResult GetMyConfigAll()
- {
- JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
- return base.Content(javaScriptSerializer.Serialize(base.GetMyConfigInfo()), "application/json");
- }
- //根据产品ID获取产品模块
- public ActionResult GetModualByCPID(string id)
- {
- string json = CPWTJL_obj.GetModualByCPID(id);
- return Content(json, "application/json");
- }
- //模块的树形结构
- public string getmk(string id)
- {
- string domDetailObj = Newtonsoft.Json.JsonConvert.DeserializeObject(CPWTJL_obj.getmk(id)).ToString(); //转换为动态JSON类型
- return domDetailObj;
- }
- //项目产品模块信息
- public ActionResult SelectProjectModualInfo(string id)
- {
- string json = CPWTJL_obj.SelectProjectModualInfo(id);
- return Content(json, "application/json");
- }
- //获取权限获取渠道
- public ActionResult GetChannelByAuth()
- {
- string json = ProModule.GetAll_Channel(GetAuthDats().Channel);
- return Content(json, "application/json");
- }
- //根据项目获取对应的渠道
- public ActionResult GetChannelByInfo(string id)
- {
- string json = CPWTJL_obj.GetChannelByInfo(id);
- return Content(json, "application/json");
- }
- //根据登录人员信息获取对应的项目
- public ActionResult GetProjectByInfo()
- {
- var user = GetCurrentUser();
- string json = CPWTJL_obj.GetProjectByInfo(user);
- return Content(json, "application/json");
- }
- //根据项目获取对应的机构
- public ActionResult GetStationByID(string id)
- {
- string json = CPWTJL_obj.GetStationByID(id);
- return Content(json, "application/json");
- }
- //获取问题紧急程度
- public ActionResult GetEmergencylevel()
- {
- string json = CPWTJL_obj.GetEmergencylevel();
- return Content(json, "application/json");
- }
- //根据登录人员获取人员性质
- public int GetFeedbackID()
- {
- var user = GetCurrentUser();
- return user.PersonProperty;
- }
- //获取总部人员
- public ActionResult GetUserInfoByChannelId()
- {
- UserInfo currentUser = base.GetCurrentUser();
- return base.Content(this.CPWTJL_obj.GetUserInfoByChannelId(), "application/json");
- }
- //根据登录人员获取人员信息
- [HttpPost]
- public ActionResult GetUserInfo()
- {
- var user = GetCurrentUser();
- return Content(CPWTJL_obj.GetUserInfo(user), "application/json");
- }
- //根据登录人员ID获取人员信息
- public ActionResult GetPersonInfoByID(string PersonID)
- {
- var user = GetCurrentUser();
- string json = CPWTJL_obj.GetPersonInfoByID(user.PersonID);
- return Content(json, "application/json");
- }
- //获取唯一问题序列编号
- public ActionResult GetSequence()
- {
- string json = CPWTJL_obj.GetSequence();
- return Content(json, "application/json");
- }
- //获取问题来源
- public ActionResult GetProblemSource()
- {
- var user = GetCurrentUser();
- var json = CPWTJL_obj.GetProblemSource(user.PersonProperty);
- return Content(json, "application/json");
- }
- //问题性质
- public ActionResult GetProblemNature()
- {
- var user = GetCurrentUser();
- var json = CPWTJL_obj.GetProblemNature(user.PersonProperty);
- return Content(json, "application/json");
- }
- //根据渠道ID获取项目ID
- public ActionResult GetProjectByChannelID(string id)
- {
- string result = CPWTJL_obj.QdXm(id);
- return Content(result, "application/json");
- }
- //获取所有模块
- public ActionResult GetAllModual()
- {
- return Content(CPWTJL_obj.GetAllModual(), "application/json");
- }
- //获取问题主流程
- public ActionResult GetMainProcess(string id)
- {
- var json = projectProblems.GetMainProcess(id);
- return Content(json, "application/json");
- }
- #endregion
- #region 问题记录得显示及自定义查询
- //GET: 项目问题管理页面
- public ActionResult ProjectIndex(int page = 0, int rows = 0)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.UserID = UserInfo.PersonID;
- ViewBag.RYXZ = UserInfo.PersonProperty;
- return View();
- }
- /// <summary>
- /// 自定义查询方案查询
- /// </summary>
- /// <returns></returns>
- public ActionResult ProjectZdyCx()
- {
- var UserInfo = GetCurrentUser();
- string result = ZDYCX_obj.ProjectZdyCx(UserInfo.ID);
- return Content(result, "application/json");
- }
- /// <summary>
- /// 根据自定义方案得条件查询数据
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ProjectZdyCxInfo(WTJLModel model, int page = 0, int rows = 0)
- {
- string result;
- if (model.satate == true)
- {
- var UserInfo = GetCurrentUser();
- model.DJRID = UserInfo.PersonID;
- }
- ///125(渠道)3客户人员(自己登记的问题)4医院管理员(自己机构(站点信息))
- if (model.RYXZ == 1 || model.RYXZ == 2 || model.RYXZ == 5)
- {
- result = WTJL_obj.ProjectZdyCxInfoQKW(GetAuthDats().Channel, page, rows);
- }
- else if (model.RYXZ == 3)
- {
- var UserInfo = GetCurrentUser();
- model.DJRID = UserInfo.PersonID;
- result = WTJL_obj.ProjectZdyCxInfoKh(model.DJRID, page, rows);
- }
- else if (model.RYXZ == 4)
- {
- var UserInfo = GetCurrentUser();
- model.DJRID = UserInfo.PersonID;
- result = WTJL_obj.ProjectZdyCxZd(model.DJRID, page, rows);
- }
- else
- {
- result = WTJL_obj.ProjectZdyCxInfo(model, page, rows);
- }
- return Content(result, "application/json");
- }
- //查询问题目录
- public ActionResult QueryProblems(QueryModel model, string sort = "编号", string order = "desc", int page = 1, int rows = 20)
- {
- model.page = page;
- model.rows = rows;
- model.sort = sort;
- model.order = order;
- // 选择的字段
- var text = TempData["arry"];
- if (text != null)
- {
- model.text = text.ToString();
- }
- // 是否勾选之查看已解决按钮
- var state = TempData["state"];
- if (state != null)
- {
- model.isend = Convert.ToBoolean(state);
- }
- var userInfo = GetCurrentUser();
- //获取当前登录人员ID
- model.currentUserID = userInfo?.PersonID;
- model.currentUserProperty = userInfo.PersonProperty;
- var json = projectProblems.GetProjectListDataGridJson(model);
- return Content(json, "text/json");
- }
- public ActionResult QueryProblemsV2(QueryModel model, string sort = "编号", string order = "desc", int page = 1, int rows = 20)
- {
- model.page = page;
- model.rows = rows;
- model.sort = sort;
- model.order = order;
- // 选择的字段
- var text = TempData["arry"];
- if (text != null)
- {
- model.text = text.ToString();
- }
- // 是否勾选之查看已解决按钮
- var state = TempData["state"];
- if (state != null)
- {
- model.isend = Convert.ToBoolean(state);
- }
- var userInfo = GetCurrentUser();
- //获取当前登录人员ID
- model.currentUserID = userInfo?.PersonID;
- model.currentUserProperty = userInfo.PersonProperty;
- var json = projectProblems.GetProjectListDataGridJsonV2(model);
- return Content(json, "text/json");
- }
-
- //重复问题列表所用的数据
- public ActionResult AllProList()
- {
- return Content(projectProblems.AllProList(GetCurrentUser()), "text/json");
- }
- /// <summary>
- /// 分布视图
- /// </summary>
- /// <returns></returns>
- public PartialViewResult Partial()
- {
- return base.PartialView();
- }
- /// <summary>
- /// 获取渠道信息
- /// </summary>
- /// <returns></returns>
- public ActionResult QDinfo()
- {
- //string result = WTJL_obj.GETQDinfo(this.GetAuthDats().Channel);
- var user = this.GetCurrentUser();
- string result = WTJL_obj.GetChanels(user.PersonProperty, user.CompanyID);
- return Content(result, "application/json");
- }
- /// <summary>
- /// 获取性质信息
- /// </summary>
- /// <returns></returns>
- public ActionResult XZinfo()
- {
- string result = WTJL_obj.GETXZinfo();
- return Content(result, "application/json");
- }
- /// <summary>
- /// 获取紧急程度信息
- /// </summary>
- /// <returns></returns>
- public ActionResult JJCDinfo()
- {
- string result = WTJL_obj.GETJJCDinfo();
- return Content(result, "application/json");
- }
- /// <summary>
- /// 获取研发人员
- /// </summary>
- /// <returns></returns>
- public ActionResult GetAssignPerson()
- {
- return Content(CPWTJL_obj.GetAssignPerson(), "application/json");
- }
- public ActionResult LCHJ()
- {
- return Content(WTJL_obj.LCHJ(), "application/json");
- }
- /// <summary>
- /// 渠道所属项目查询
- /// </summary>
- /// <param name="QdID"></param>
- /// <returns></returns>
- public ActionResult QdXm(string QdID)
- {
- string result = WTJL_obj.QdXm(QdID);
- return Content(result, "application/json");
- }
- /// <summary>
- /// 获取项目机构
- /// </summary>
- /// <param name="JgID"></param>
- /// <returns></returns>
- public ActionResult XmJg(string JgID)
- {
- string result = CPWTJL_obj.XmJgs(JgID);
- return Content(result, "application/json");
- }
- /// <summary>
- /// 获取项目产品
- /// </summary>
- /// <param name="XmID"></param>
- /// <returns></returns>
- public ActionResult XmCp(string XmID)
- {
- string result = WTJL_obj.XmCp(XmID);
- return Content(result, "application/json");
- }
- /// <summary>
- /// 快速查询
- /// </summary>
- /// <param name="KsCx">快速查询</param>
- /// <returns></returns>
- public ActionResult KsSelect(string KsCx)
- {
- int page = 1, rows = 10, total = 0;
- return Content(WTJL_obj.KsSelect(KsCx, page, rows, total), "application/json");
- }
- /// <summary>
- /// 获取产品问题过程处理流程
- /// </summary>
- /// <returns></returns>
- public ActionResult GetClc(string ID)
- {
- return Content(WtJlGcModule.GetClc(ID), "application/json");
- }
- /// <summary>
- /// 获取产品问题过程沟通需要的信息
- /// </summary>
- /// <param name="ID"></param>
- /// <returns></returns>
- public ActionResult GetCommunicates(string ID)
- {
- return Content(WTGTG_obj.GetCommunicates(ID), "application/json");
- }
- public ActionResult SubmitContent(WTGTGCModel model)
- {
- model.JLSJ = DateTime.Now;
- var UserInfo = GetCurrentUser();
- model.JLRID = UserInfo.PersonID;
- string result = WTGTG_obj.SubmitContent(model);
- string[] results = result.Split('|');
- if (results[0] == "1")
- {
- return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
- }
- return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败");
- }
- /// <summary>
- /// 判断是否卫计委审核可以处理问题(待测试) ///12 5(卫计委管理员 卫计委信息科管理员)3客户人员(自己登记的问题)4医院管理员(自己机构(站点信息))
- /// ?处理问题时 医院管理原 机构内处理 卫计委 卫计委处理 客户只能看不能处理
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public string SfSh(string id)
- {
- var user = GetCurrentUser();
- var UserProperty = user.PersonProperty;
- string result = "1";
- if (UserProperty == 5)
- {
- ///是否卫计委可以处理
- result = CPWTJL_obj.SfShWjW(user.PersonID);
- }
- else if (UserProperty == 4)
- {
- //判断是否机构内审核可以处理问题
- result = CPWTJL_obj.SfSh(user.PersonID);
- }
- else if (UserProperty == 3 || UserProperty == 1)
- {
- //客户,本部人员只能看不能处理
- result = "2";
- }
- return result;
- }
- /// <summary>
- /// 问题确认
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult WtQr(string id)
- {
- // 确认类型1 ,2本部,渠道(3 项目人员确认)
- //4 医院管理员(1机构确认) 5 卫计委管理员(2:卫计委确认)
- //4:技术支持确认 5:研发人员确认
- var user = GetCurrentUser();
- string JlrID = user.PersonID;
- DateTime Jlsj = DateTime.Now;
- int Qrlx = 0;
- if (user.PersonProperty == 2)
- {
- //项目人员确认
- Qrlx = 3;
- }
- else if (user.PersonProperty == 4)
- {
- //机构确认
- Qrlx = 1;
- }
- else if (user.PersonProperty == 5)
- {
- //卫计委确认
- Qrlx = 2;
- }
- string result = CPWTJL_obj.WtQr(id, JlrID, Jlsj, Qrlx);
- string[] results = result.Split('|');
- if (results[0] == "1")
- {
- return this.ResponseJson(System.Net.HttpStatusCode.OK, result[1].ToString());
- }
- else
- {
- return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, result[1].ToString());
- }
- }
- /// <summary>
- /// 查看问题
- /// </summary>
- /// <param name="id"></param>
- /// <param name="BT"></param>
- /// <returns></returns>
- public ActionResult WtCk(string id, string BT)
- {
- ViewBag.Event = BT;
- ViewBag.id = id;
- return View();
- }
- /// <summary>
- ///查看问题详情
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult Wtdetail(string id)
- {
- return Content(CPWTJL_obj.Wtdetail(id), "application/json");
- }
- /// <summary>
- ///当前问题处理状态
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult DealProblem(string WTid)
- {
- var user = GetCurrentUser();
- string result = WTJL_obj.DealProblem(WTid, user.PersonProperty.ToString());
- return Content(result);
- }
- /// <summary>
- /// 判断问题是否被终止或者被解决
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult SfZz(string id)
- {
- string result = CPWTJL_obj.SfZz(id);
- return Content(result);
- }
- /// <summary>
- /// 产品问题处理人
- /// </summary>
- /// <returns></returns>
- public ActionResult ProductionPdealR()
- {
- var UserInfo = GetCurrentUser();
- var t = UserInfo.AuthDats;
- string json = PersonModule.GetPerson(t);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 处理问题弹出层
- /// </summary>
- /// <returns></returns>
- public ActionResult PopWindows()
- {
- return View();
- }
- /// <summary>
- /// 问题验证
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult AcceptanceWindow(string id)
- {
- ViewBag.ID = id;
- return View();
- }
- #endregion
- #region 登记项目问题
- //Get: 登记一个新问题的页面
- public ActionResult NewProjectProblem(string id, int type)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.DJRId = UserInfo.PersonID;
- ViewBag.RYXZ = UserInfo.PersonProperty;
- ViewBag.id = id;
- ViewBag.type = type;
- return View();
- }
- //登记操作(id:问题ID)
- public string RegisterProblem(string text)
- {
- //反编码并转换为一个Model对象
- ProblemBusinessModel model = Strings.JsonToModel<ProblemBusinessModel>(HttpUtility.UrlDecode(text));
-
- //判断项目的审核流程是否允许用户反馈问题
- if (CPWTJL_obj.CheckApprovalProcess(model.QDID, model.XMID, model.JGID))
- {
- return "-1";
- }
- if (model.WTMS.Length >= 3000)
- {
- Logger.Instance.Info("项目问题【"+model.DJR+"】登记的内容过长:" + model.WTMS);
- return "-2";
- }
- string id = Guid.NewGuid().ToString();
- Session["ProblemUID"] = id;
- var user = GetCurrentUser();
- model.QDID = this.CPWTJL_obj.GetChannelByProId(model.XMID).Rows[0]["ID"].ToString();
- //登记问题
- ProblemStateModel state = CPWTJL_obj.RegisterProblem(model, user, id);
- Session["ProblemProcessID"] = state.ProblemProcessID;
- //用户登记问题的流程
- if (user.PersonProperty == 3|| user.PersonProperty == 4)//客户要求调整医院管理员只能提交到渠道
- {
- //根据性质ID返回性质代码
- DataTable dt = CPWTJL_obj.SelectNature(model.WTXZ);
- int Nature = int.Parse(dt.Rows[0]["代码"].ToString());
- //获取下一个流程ID
- string FlowID = WorkFlowModule.GetNewProblemWorkFlowID(state.CatalogID, user.PersonProperty, Nature).ToString();
- //提交问题
- int r = CPWTJL_obj.PostProblem(id, FlowID, user, state.ID);
- if (r == 0)
- {
- id = null;
- }
- return id;
- }
- //其他角色登记问题的流程
- else
- {
- if (state.Count == 0)
- {
- id = null;
- }
- else
- {
- ///解决的问题不需要推送
- if (model.RegisterType != 2)
- {
- RegistNotify(id);
- }
- }
- return id;
- }
- }
- //指定处理人弹窗
- public ActionResult AssignDealWithPerson_Window()
- {
- return View();
- }
- //保存处理人
- public void SaveAssignDealWithPerson(string id)
- {
- TempData["AssignID"] = id;
- }
- #endregion
- #region 登记技术支持问题
- //Get: 登记一个新问题的页面
- public ActionResult NewSupportProblem(string id,string type)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.DJRId = UserInfo.PersonID;
- ViewBag.RYXZ = UserInfo.PersonProperty;
- ViewBag.type = type;
- ViewBag.id = id;
- return View();
- }
- //登记操作(id:问题ID)
- public string RegisterSupportProblem(string text)
- {
- string text2 = Guid.NewGuid().ToString();
- base.Session["ProblemUID"] = text2;
- ProblemBusinessModel problemBusinessModel = Strings.JsonToModel<ProblemBusinessModel>(HttpUtility.UrlDecode(text));
- bool flag = problemBusinessModel.WTMS.Length >= 3000;
- string result;
- if (flag)
- {
- Logger.Instance.Info("技术支持【" + problemBusinessModel.DJR + "】登记的内容过长:" + problemBusinessModel.WTMS);
- result = "-2";
- }
- else
- {
- UserInfo currentUser = base.GetCurrentUser();
- string text3 = (base.TempData["AssignID"] == null) ? null : base.TempData["AssignID"].ToString();
- problemBusinessModel.QDID = this.CPWTJL_obj.GetChannelByProId(problemBusinessModel.XMID).Rows[0]["ID"].ToString();
- ProblemStateModel problemStateModel = this.support.RegisterSupportProblem(problemBusinessModel, currentUser, text2, text3);
- base.Session["ProblemProcessID"] = problemStateModel.ProblemProcessID;
- bool flag2 = problemStateModel.Count == 0;
- if (flag2)
- {
- text2 = null;
- }
- else
- {
- bool flag3 = text3 != null;
- if (flag3)
- {
- this.SitePush(new ProblemProcessModel
- {
- ProblemID = text2,
- SubID = text3,
- IsCommit = true
- });
- }
- else
- {
- bool flag4 = problemBusinessModel.RegisterType != 2;
- if (flag4)
- {
- this.RegistNotify(text2);
- }
- }
- }
- result = text2;
- }
- return result;
- }
- #endregion
- #region 登记产品问题
- //Get: 登记一个新问题的页面
- public ActionResult NewProductProblem(string id, int type)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.DJRId = UserInfo.PersonID;
- ViewBag.RYXZ = UserInfo.PersonProperty;
- ViewBag.type = type;
- ViewBag.id = id;
- return View();
- }
- //登记操作(id:问题ID)
- public string RegisterProductProblem(string text)
- {
- var ID = Guid.NewGuid().ToString();
- Session["ProblemUID"] = ID;
- ProblemBusinessModel problemBusinessModel = Strings.JsonToModel<ProblemBusinessModel>(HttpUtility.UrlDecode(text));
- if (problemBusinessModel.WTMS.Length >= 3000)
- {
- Logger.Instance.Info("产品问题【" + problemBusinessModel.DJR + "】登记的内容过长:" + problemBusinessModel.WTMS);
- ID = "-2";
- }
- else
- {
- UserInfo currentUser = base.GetCurrentUser();
- problemBusinessModel.QDID = this.CPWTJL_obj.GetChannelByProId(problemBusinessModel.XMID).Rows[0]["ID"].ToString();
- ProblemStateModel problemStateModel = this.product.RegisterProductProblem(problemBusinessModel, currentUser, ID);
- Session["ProblemProcessID"] = problemStateModel.ProblemProcessID;
- if (problemStateModel.Count == 0)
- {
- ID = null;
- }
- else
- {
- if (problemBusinessModel.RegisterType != 2)
- {
- this.RegistNotify(ID);
- }
- }
- }
- return ID;
- }
- #endregion
- #region 附件上传
- //上传附件
- [HttpPost]
- public ActionResult FileUpload()
- {
- string ProblemProcessID;
- string Problemid = Session["ProblemUID"].ToString();
- if (Session["ProblemProcessID"] == null)
- {
- ProblemProcessID = CPWTJL_obj.GetNewProcessID(Problemid);
- }
- else
- {
- ProblemProcessID = Session["ProblemProcessID"].ToString();
- }
- var result = "0";
- var files = this.Request.Files;
- if (this.Request.Files.Count > 0)
- {
- using (BinaryReader br = new BinaryReader(files[0].InputStream))
- {
- byte[] byteData = br.ReadBytes((int)files[0].InputStream.Length);
- var uploadFile = files[0];
- var fileName = uploadFile.FileName;
- var fileLen = uploadFile.ContentLength;
- var fileType = uploadFile.ContentType;
- string _tp = System.IO.Path.GetExtension(fileName);
- var r = UploadFile(byteData, fileName, fileType);
- if (r.code == 100)
- {
- ///数据库存储附件ID
- var Complete = CPWTJL_obj.FileUpload(Problemid, r.data, GetCurrentUser().Name, fileType, ProblemProcessID);
- if (Complete)
- {
- result = Problemid;
- }
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, result, null).ToString(), "application/json");
- }
- }
- }
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, result, null).ToString(), "application/json");
- }
- /// <summary>
- /// 智能表单文件上传[旧版本,上传文件到114]
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult FormMakingFileUploadOld()
- {
- var url = "";
- var files = this.Request.Files;
- if (this.Request.Files.Count > 0)
- {
- using (BinaryReader br = new BinaryReader(files[0].InputStream))
- {
- byte[] byteData = br.ReadBytes((int)files[0].InputStream.Length);
- var uploadFile = files[0];
- var fileName = uploadFile.FileName;
- var fileLen = uploadFile.ContentLength;
- var fileType = uploadFile.ContentType;
- string _tp = System.IO.Path.GetExtension(fileName);
- var r = UploadFile(byteData, fileName, fileType);
- if (r.code == 100)
- {
-
- var data = GetFtpUrl(r.data, "");
- if (data.code == 100)
- {
- var GetFileUrl = System.Configuration.ConfigurationManager.AppSettings["GetFileUrl"];
- url= GetFileUrl + data.data.FirstOrDefault().filepath;
- }
-
- }
- }
- }
- return Content(new PmsJsonResoult(url).ToString(), "application/json");
- }
- /// <summary>
- /// 上传文件到阿里云
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult FormMakingFileUpload()
- {
- var url = "";
- var files = this.Request.Files;
- if (this.Request.Files.Count > 0)
- {
- url= AliFileUpload.PutObjectFileStream(files);
-
- }
- return Content(new PmsJsonResoult(url).ToString(), "application/json");
- }
- #endregion
- #region 修改问题
- //Get: 修改问题的页面
- public ActionResult UpdateProjectProblem(string id)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.DJRId = UserInfo.PersonID;
- ViewBag.RYXZ = UserInfo.PersonProperty;
- ViewBag.id = id;
- return View();
- }
- //根据问题编号获取问题信息
- public ActionResult GetInfolByBH(int id)
- {
- DataTable dt = CPWTJL_obj.GetInfolByBH(id);
- Session["ProblemUID"] = dt.Rows[0]["ID"];
- var json = dt.ToJson();
- return Content(json, "application/json");
- }
- //修改问题操作
- public string UpdateProblem(string text)
- {
- ProblemBusinessModel problemBusinessModel = Strings.JsonToModel<ProblemBusinessModel>(HttpUtility.UrlDecode(text));
- UserInfo currentUser = base.GetCurrentUser();
- problemBusinessModel.QDID = this.CPWTJL_obj.GetChannelByProId(problemBusinessModel.XMID).Rows[0]["ID"].ToString();
- int num = this.CPWTJL_obj.UpdateProblem(problemBusinessModel, currentUser);
- bool flag = num != 0 && num != -1;
- string result;
- if (flag)
- {
- base.Session["ProblemUID"] = this.CPWTJL_obj.GetProblemID(problemBusinessModel.BH.ToInt32());
- result = problemBusinessModel.BH.ToString();
- }
- else
- {
- result = null;
- }
- return result;
- }
- //加载产品
- public ActionResult GetCpwtjlByID(string xmid, string cpid)
- {
- var json = CPWTJL_obj.GetCpwtjlByID(xmid, cpid);
- return Content(json, "application/json");
- }
- //获取项目id
- public ActionResult GetXMID(string xmid)
- {
- var json = CPWTJL_obj.GetXMID(xmid);
- return Content(json, "application/json");
- }
- //获取问题附件
- [HttpPost]
- public ActionResult Attachment(string id)
- {
- DataTable dt = CPWTJL_obj.GetAttachment(id);
- List<FTPFileModel> list = new List<FTPFileModel>();
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- var type = dt.Rows[i]["类型"].ToInt32();
- var ID = dt.Rows[i]["附件ID"].ToString();
- FtpDownloadResult model = DownloadFileBase64(ID, "o");
- FTPFileModel ftpmodel = new FTPFileModel();
- if (model != null)
- {
- ftpmodel.id = ID;
- ftpmodel.format = model.format;
- ftpmodel.fileName = model.fileName;
- ftpmodel.base64 = model.base64;
- ftpmodel.type = type;
- list.Add(ftpmodel);
- }
- }
- return Content(Strings.ObjectToJson(list), "application/json");
- }
- //删除附件
- [HttpPost]
- public int Delete_Img(string id)
- {
- return CPWTJL_obj.Delete_Img(id);
- }
- #endregion
- #region 删除问题
- //删除操作
- public int Delete_Problem(string id)
- {
- return CPWTJL_obj.Delete_Problem(id);
- }
- //判断是否可以删除或修改
- public ActionResult CheckState(string id, int type)
- {
- var user = GetCurrentUser();
- var dt = CPWTJL_obj.CheckState(id);
- //所有人都不允许修改他人登记的问题 2020-9-17
- if ((type == 1 && user.PersonID != dt.Rows[0]["登记人ID"].ToString()) || type == 2 && (user.PersonID != dt.Rows[0]["登记人ID"].ToString()))
- {
- return null;
- }
- return Content(dt.ToJson(), "application/json");
- }
- //得到问题状态判断
- public ActionResult GetProblemState(string id)
- {
- var user = GetCurrentUser();
- var s = CPWTJL_obj.GetProblemState(id, user);
- return Content(s ? "1" : "0", "application/json");
- }
- #endregion
- #region 查看问题
- //查看问题弹窗
- public ActionResult CheckProblemWindow(string id)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.DJRId = UserInfo.PersonID;
- ViewBag.RYXZ = UserInfo.PersonProperty;
- ViewBag.id = id;
- return View();
- }
- //查看问题
- public ActionResult CheckProblem(string id)
- {
- var json = CPWTJL_obj.CheckProblem(id);
- return Content(json, "application/json");
- }
- //查看附件图像(id:附件id,type:缩略图o原图,s缩略图,m大图)
- public ActionResult ViewProblemImage(string id, string type)
- {
- if (string.IsNullOrEmpty(type))
- {//文件流传输
- var obj = DownloadFileBase64(id, string.Empty);
- if (obj != null)
- {
- //将base64转bytes
- var data = Convert.FromBase64String(obj.base64);
- return File(data, "application/octet-stream", obj.fileName);
- }
- else
- {
- Logger.Instance.Warn("未获取到文件对象:" + id);
- return View();
- }
- }
- else
- {//图像传输
- var data = base.DownloadFileBytes(id, type);
- if (data == null)
- {
- return null;
- }
- return File(data, "image/jpeg");
- }
- }
- //查看处理过程信息
- public ActionResult ViewProcessInfo(string id)
- {
- ViewBag.id = id;
- //返回查询对象
- var obj = projectProblems.QueryProcessInfo(id);
- return View(obj);
- }
- //图片查看弹窗
- public ActionResult ViewImg(string src)
- {
- ViewBag.src = src;
- return View();
- }
- //获取问题记录
- public ActionResult GetProblemById(string id)
- {
- var json = projectProblems.GetProblemById(id);
- return Content(json, "application/json");
- }
- #endregion
- #region 处理问题
- public ActionResult CancelReceiveProblem(string id)
- {
- //数据库取消执行
- var r = projectProblems.CancelReceiveProblem(id, GetCurrentUser().PersonID);
- var json = new PmsJsonResoult(r).ToString();
- return Content(json, "text/json");
- }
- /// <summary>
- /// 产品问题处理弹框
- /// </summary>
- /// <returns></returns>
- public ActionResult ProductionPdeal(string id, string cpId, int showatt = 0, int workflowid = 1, int IsSupport = 0)
- {
- ViewBag.id = id;
- ViewBag.showAtt = showatt;
- ViewBag.IsSupport = IsSupport;
- ViewBag.cpId = cpId;
- var userInfo = GetCurrentUser();
- var uid = userInfo.PersonID;
- var name = userInfo.Name;
- //设置当前人员性质
- ViewBag.userProp = userInfo.PersonProperty;
- ViewBag.workflowid = workflowid;//流程ID
- //projectProblems.TryReceiveProblem(id, uid, name);
- //获取最近的处理说明
- var model = projectProblems.GetRecentlyDetail(id);
- ViewBag.DealDetail = model.DealDetail;
- ViewBag.SolveDetail = model.SolveDetail;
- return View();
- }
- /// <summary>
- /// 执行处理(确定处理问题)
- /// </summary>
- /// <param name="model">处理信息</param>
- /// <returns></returns>
- public ActionResult ExecuteProcessData(ProblemProcessModel model)
- {
- model.ProcessRemark = HttpUtility.UrlDecode(model.ProcessRemark);
- model.AlterRemark = HttpUtility.UrlDecode(model.AlterRemark);
- var userInfo = GetCurrentUser();
- var uid = userInfo.PersonID;
- //当前操作人
- model.CurrentUserID = uid;
- model.CurrentUserProp = userInfo.PersonProperty;
- model.CurrentUserJob = userInfo.JobCode;
- model.CurrentUserName = userInfo.Name;
- var msg = string.Empty;
- //返回处理结果
- bool r = projectProblems.ExecuteProcessData(model, out msg,GetCurrentUser());
- Session["ProblemUID"] = model.ProblemID;
- Session["ProblemProcessID"] = model.ProcesssID;
- //站点推送
- if (r)
- {
- SitePush(model);
- }
- //刷新推送
- if (r && (model.IsBack || (model.IsCommit && string.IsNullOrEmpty(model.SubID))))
- {
- DealNotify(model.ProblemID, model.IsBack ? 1 : 2);
- }
- return Content(new PmsJsonResoult(r, msg).ToString(), "text/json");
- }
- /// <summary>
- /// 向客户端发送更新操作
- /// </summary>
- /// <param name="id"></param>
- private void RefreshProblem(string id)
- {
- var WTJLModel = projectProblems.GetWTJLModel(id);
- if (WTJLModel.HJID <= 3)
- {//更新项目问题管理列表
- App_Start.ClientManager.RefreshProblem("1");
- }
- else if (WTJLModel.HJID == 4)
- {//更新技术支持
- App_Start.ClientManager.RefreshProblem("2");
- }
- else
- {//研发
- App_Start.ClientManager.RefreshProblem("3");
- }
- }
- //登记问题获取推送人
- private List<string> GetPushPerson(string ProblemId)
- {
- var PersonId = GetCurrentUser().PersonID;
- var list = projectProblems.GetPushPerson(ProblemId);
- //去除自己
- list.Remove(PersonId);
- return list;
- }
- /// <summary>
- /// 登记推送
- /// </summary>
- /// <param name="id"></param>
- private void RegistNotify(string id)
- {
- var PushPerson = GetPushPerson(id);
- var PushPersonTask = Task.Factory.StartNew(() => Parallel.ForEach<string>(PushPerson, item => this.RefreshProblemAndSendMessage(item, "有新的问题登记,请注意查收!", id)));
- Task.WaitAll(PushPersonTask);
- return;
- }
- /// <summary>
- /// 回退和向上提交的问题推送
- /// </summary>
- /// <param name="id"></param>
- private void DealNotify(string id, int type)
- {
- string Message;
- if (type == 1)
- {
- //回退
- Message = "有新的问题回退,请注意查收!";
- }
- else
- {//提交
- Message = "有新的问题向上提交,请注意查收!";
- }
- var PushPerson = GetPushPerson(id);
- var PushPersonTask = Task.Factory.StartNew(() => Parallel.ForEach<string>(PushPerson, item => this.RefreshProblemAndSendMessage(item, Message, id)));
- Task.WaitAll(PushPersonTask);
- return;
- }
- //站点推送
- private void SitePush(ProblemProcessModel model)
- {
- var userInfo = GetCurrentUser();
- try
- {
- var str = "您有新的消息通知";
- var AssignID = model.AssignID;//默认推送给指派人员
- if (model.IsAssign)
- {//处理成功与指派人员时需要向该被指派人员推送消息
- str = "有新的问题指派给您,请注意查收!";
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(model.AssignID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.Assign.SendSite)
- {
- this.SendDealMessage(model.ProblemID, model.AssignID, str, 1);
- }
-
- }
- else if (model.IsSolve)
- {
- var WTJLModel = projectProblems.GetWTJLModel(model.ProblemID);
- str = "您的编号为【" + WTJLModel.BH.ToString() + "】的问题已被解决,处理人:" + WTJLModel.SLR;
- AssignID = WTJLModel.DJRID;
- //推送本地消息
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(WTJLModel.DJRID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.SolveTime.SendSite)
- {
- this.SendDealMessage(model.ProblemID, WTJLModel.DJRID, str, 2);
- }
-
- }
- else if (model.IsBack)
- {
- var WTJLModel = projectProblems.GetWTJLModel(model.ProblemID);
- str = "您的编号为【" + WTJLModel.BH.ToString() + "】的问题已被回退,处理人:" + userInfo.Name;
- AssignID = WTJLModel.DJRID;
- //推送本地消息
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(WTJLModel.DJRID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.BackTime.SendSite)
- {
- this.SendDealMessage(model.ProblemID, WTJLModel.DJRID, str, 3);
- }
- }
- else if (model.IsStop)
- {
- var WTJLModel = projectProblems.GetWTJLModel(model.ProblemID);
- str = "您的编号为【" + WTJLModel.BH.ToString() + "】的问题已被终止,处理人:" + userInfo.Name;
- AssignID = WTJLModel.DJRID;
- //推送本地消息
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(WTJLModel.DJRID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.StopTime.SendSite)
- {
- this.SendDealMessage(model.ProblemID, WTJLModel.DJRID, str, 4);
- }
- }
- else if (model.IsCommit && !string.IsNullOrEmpty(model.SubID))
- {
- str = "有新的问题提交给您,请注意查收!";
- AssignID = model.SubID;
- //推送本地消息
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(model.SubID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.Assign.SendSite)
- {
-
- this.SendDealMessage(model.ProblemID, model.SubID,str , 5);
-
- }
-
- }
- //if(model.ProblemID== "fa750062-79d8-4975-b901-6e0395e3cc80")//测试代码
- if(AssignID.IsNullOrEmpty())//推送人id为空,根据问题id找到登记人id
- {
- DataTable dt = CPWTJL_obj.GetProblemInfo(model.ProblemID);
- if(dt.Rows.Count>0)
- {
- AssignID = dt.GetValueByName<string>("登记人ID");
- }
- dt = null;
- }
- WeChartPush(str,model.ProblemID,model.ProcessRemark, AssignID);
- }
- catch (Exception ex)
- {
- Logger.Instance.Error("站点推送失败,原因:" + ex);
- }
- }
- /// <summary>
- /// 微信推送
- /// </summary>
- /// <param name="str">标题</param>
- /// <param name="ProblemID">问题id</param>
- /// <param name="ProcessRemark">内容</param>
- /// <param name="AssignID">推送人id</param>
- private void WeChartPush(string str,string ProblemID,string ProcessRemark,string AssignID) {
- if (!ProcessRemark.IsNullOrEmpty())
- {
- try
- {
- ProcessRemark = Tools.RemoveHTML(ProcessRemark);
- }
- catch (Exception ex)
- {
- Logger.Instance.Error("微信推送失败[转换内容出错],原因:" + ex);
-
- }
-
- }
- else
- {
- ProcessRemark = str;
- }
-
- NotificationDto no = new NotificationDto();
- no.style = "3";
- no.template_code = "OIE51OsXeECnoPxGgPTQ7acXybc7t1plgAbdlH-mMWE";
- no.template_value = "{\"first\":{\"value\":\"" + str+ "\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + DateTime.Now+ "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + ProcessRemark + "\",\"color\":\"#173177\"},\"remark\":{\"value\":\"点击【查看详情】立即查阅您的问题记录\",\"color\":\"#173177\"}}";
- no.url = "https://zlpms.zlsoft.com:8078/MobileProblem/ProblemDetail/"+ProblemID;
-
- List<MessageDetailsDto> list = new List<MessageDetailsDto>();
- MessageDetailsDto mdd = new MessageDetailsDto();
- var dt = account_obj.GetAccountInfo(AssignID);
- if (dt != null && dt.Rows.Count > 0)
- {
- mdd.接收人id = dt.GetValueByName<string>("微信id");
- }
- mdd.接收人 = "李艳春";
- //mdd.接收人id = "oR2TM1RJcCi4E93BWPgz8i42vRcY";
- mdd.接收人电话 = "李艳春";
- list.Add(mdd);
- no.record_items = list;
- if (mdd.接收人id!=null)
- {
- notice.SendWeChartTempletMessge(no);
- }
- }
-
- // 根据问题id获取对应产品版本
- public ActionResult GetVersionById(string id, int type)
- {
- return Content(CPWTJL_obj.GetVersionById(id, type), "application/json");
- }
- #endregion
- #region 撤消问题
- //撤消已关闭或解决的问题
- public ActionResult UndoProblem(string id)
- {
- var cnt = WorkFlowModule.UndoProblem(id, GetCurrentUser().PersonID);
- return Content(cnt ? "1" : "", "text/plan");
- }
- #endregion
- #region 新处理版本
- public ActionResult NewversionWindow(string id)
- {
- ViewBag.id = id;
- return View();
- }
- public ActionResult GetVersion(string pid)
- {
- return Content(product.GetVersion(pid), "application/json");
- }
- public int SaveVersion(string pid, string version, string productid)
- {
- return product.SaveVersion(pid, version, productid, GetCurrentUser());
- }
- [HttpPost]
- public ActionResult ShowConnect(string id)
- {
- return Content(product.ShowConnect(id), "application/json");
- }
- #endregion
- #region 获取APP
- [Route("GetAppPC/{Type}")]
- public ActionResult GetAppforPC(string Type)
- {
- var pathbase = this.HttpContext.Server.MapPath("/AppDownLoad/");
- var AppType = string.Empty;
- var AppName = string.Empty;
- if (Type == "Android")
- {
- pathbase += "ZLPMS.apk";
- AppName = "ZLPMS.apk";
- AppType = ".apk";
- }
- else
- {
- pathbase += "ZLPMS.ipa";
- AppName = "ZLPMS.ipa";
- AppType = ".ipa";
- }
- if (System.IO.File.Exists(pathbase))
- {
- try
- {
- var data = System.IO.File.ReadAllBytes(pathbase);
- return File(data, "application/octet-stream", AppName);
- }
- catch (Exception ex)
- {
- Logger.Instance.Error("读取文件失败", ex);
- return View();
- }
- }
- else
- {
- Logger.Instance.Warn("未获取到APP对象");
- return View();
- }
- }
- #endregion
- #region 修改问题过程
- //修改问题过程弹窗
- public ActionResult UpdateViewProcessInfo(string id)
- {
- ViewBag.id = id;
- //返回查询对象
- var obj = projectProblems.QueryProcessInfo(id);
- return View(obj);
- }
- //问题过程的附件上传
- [HttpPost]
- public int ProcessFileUpload(string problemID, string processID)
- {
- var result = 0;
- var files = this.Request.Files;
- if (this.Request.Files.Count > 0)
- {
- using (BinaryReader br = new BinaryReader(files[0].InputStream))
- {
- byte[] byteData = br.ReadBytes((int)files[0].InputStream.Length);
- var uploadFile = files[0];
- var fileName = uploadFile.FileName;
- var fileLen = uploadFile.ContentLength;
- var fileType = uploadFile.ContentType;
- string _tp = System.IO.Path.GetExtension(fileName);
- var r = UploadFile(byteData, fileName, fileType);
- if (r.code == 100)
- {
- ///数据库存储附件ID
- var Complete = CPWTJL_obj.ProcessFileUpload(problemID, r.data, GetCurrentUser().Name, fileType, processID);
- if (Complete)
- {
- result = 1;
- }
- }
- }
- }
- return result;
- }
- /// <summary>
- /// 判断是否允许修改问题过程
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult CheckUpdateProcess(string id)
- {
- var userInfo = GetCurrentUser();
- var t = projectProblems.CheckUpdateProcess(id, userInfo.PersonID);
- return Content(t, "text/json");
- }
- public ActionResult UpdateProblemProcess(string text)
- {
- WTJLGCModel model = Strings.JsonToModel<WTJLGCModel>(HttpUtility.UrlDecode(text));
- var r = projectProblems.UpdateProblemProcess(model);
- if (r)
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, "成功", null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "失败", null).ToString(), "application/json");
- }
- }
- #endregion
- #region 导出excel文件
- [HttpPost]
- public int ProcessRequest(string text)
- {
- var x = HttpUtility.UrlDecode(text);
- string fn = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xls";
- System.IO.File.WriteAllText(@"d:\\" + fn, x, Encoding.UTF8);
- TempData["path"] = fn;
- TempData["bytes"] = HttpUtility.UrlDecode(text);
- TempData["name"] = fn;
- return 1;
- }
- //导出excel
- public ActionResult Excel()
- {
- return File(@"d:\\" + TempData["name"].ToString(), "application/octet-stream", TempData["name"].ToString());
- //return File(System.Text.Encoding.Default.GetBytes(TempData["bytes"].ToString()), "application/octet-stream", TempData["name"].ToString());
- }
- //删除
- public void DeleteExcel()
- {
- System.IO.File.Delete(@"d:\\" + TempData["path"].ToString());
- }
- //导出设置的弹窗
- public ActionResult ExcelSet_Window()
- {
- return View();
- }
- //接受设置字段
- [HttpPost]
- public void GetFiledList(string text, string state)
- {
- TempData["arry"] = text;
- TempData["state"] = state;
- }
- #endregion
- #region 其他操作
- /// <summary>
- /// 判断是否有权限对问题进行归类
- /// </summary>
- /// <returns></returns>
- public ActionResult IsDealed(string id)
- {
- bool res = this.projectProblems.IsDealed(id, base.GetCurrentUser().PersonID);
- bool flag2 = false;
- foreach (string current in GetCurrentUser().Roles)
- {
- if (current == "369")
- {
- flag2 = true;
- break;
- }
- }
- if (res | flag2)
- {
- return Content("1");
- }
- else
- {
- return Content("0");
- }
- }
- /// <summary>
- /// 判断问题是否完结并处理推送评价
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult IsConfirmClosing(string id)
- {
- bool res = this.projectProblems.IsConfirmClosing(id, base.GetCurrentUser().PersonID);
- bool flag2 = false;
- foreach (string current in GetCurrentUser().Roles)
- {
- if (current == "369")
- {
- flag2 = true;
- break;
- }
- }
- if (res | flag2)
- {
- return Content("1");
- }
- else
- {
- return Content("0");
- }
- }
- /// <summary>
- /// 问题验证
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public ActionResult AcceptancProblem(ProblemProcessModel model)
- {
- model.ProcessRemark = HttpUtility.UrlDecode(model.ProcessRemark);
- model.CurrentUserID = GetCurrentUser().PersonID;
- var r = WorkFlowModule.AcceptancProblem(model);
- return Content(r ? "1" : "0", "text/plan");
- }
- /// <summary>
- /// 归类问题窗体
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult DoClassifiWindow(string id,int nature)
- {
- ViewBag.ID = id;
- ViewBag.nature = nature;
- return View();
- }
- /// <summary>
- /// 解决版本
- /// </summary>
- /// <param name="id">问题id</param>
- /// <param name="probID">产品id</param>
- /// <returns></returns>
- public ActionResult ResolveVersion(string id,string probID)
- {
- ViewBag.ID = id;
- ViewBag.probID = probID;
- return View();
- }
- /// <summary>
- /// 更新问题版本
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public ActionResult UpdateVersion(VersionManageModel model)
- {
- model.操作人 = GetCurrentUser().Name;
- var r = WorkFlowModule.UpdateVersion(model);
- return Content(r ? "1" : "0", "text/plan");
- }
- /// <summary>
- /// 问题归类
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DoClassifi(string id, string ClssID, int nature)
- {
- var r = projectProblems.DoClassifi(id, ClssID, nature, GetCurrentUser());
- return Content(r ? "1" : "0");
- }
- [HttpPost]
- public int ChangeVersionState(string id, int state)
- {
- return this.CPWTJL_obj.ChangeVersionState(id, state);
- }
- /// <summary>
- /// 标准底线问题
- /// </summary>
- /// <param name="id"></param>
- /// <param name="state"></param>
- /// <returns></returns>
- [HttpPost]
- public int Bottomlineissues(string id, int state)
- {
- return this.CPWTJL_obj.Bottomlineissues(id, state);
- }
- [HttpPost]
- public int Identify(int id)
- {
- Identify_Model identify_Model = new Identify_Model();
- DataTable infolByBH = this.CPWTJL_obj.GetInfolByBH(id);
- identify_Model.XMID = infolByBH.Rows[0]["项目ID"].ToString();
- identify_Model.CPID = this.CPWTJL_obj.GetProjectProducct(infolByBH.Rows[0]["产品ID"].ToString()).Rows[0]["产品ID"].ToString();
- identify_Model.XGSJ = new DateTime?(this.CPWTJL_obj.GetDatabaseTime());
- identify_Model.XGR = base.GetCurrentUser().Name;
- identify_Model.MC = infolByBH.Rows[0]["问题标题"].ToString();
- identify_Model.LYWT = infolByBH.Rows[0]["编号"].ToString();
- bool flag = this.CPWTJL_obj.CheckRepeat(identify_Model.LYWT);
- int result;
- if (flag)
- {
- result = 2;
- }
- else
- {
- bool flag2 = base.GetCurrentUser().JobCode.ToInt32() == 10 || base.GetCurrentUser().JobCode.ToInt32() == 11;
- if (flag2)
- {
- identify_Model.XGXZ = new int?(1);
- }
- else
- {
- bool flag3 = base.GetCurrentUser().JobCode.ToInt32() == 12 || base.GetCurrentUser().JobCode.ToInt32() == 13 || base.GetCurrentUser().JobCode.ToInt32() == 7;
- if (flag3)
- {
- identify_Model.XGXZ = new int?(2);
- }
- else
- {
- identify_Model.XGXZ = new int?(3);
- }
- }
- result = ((this.ProModule.Add_Identify(identify_Model).Length == 36) ? 1 : 0);
- }
- return result;
- }
- #endregion
- #region 超时推送
- /// <summary>
- /// 获取超时推送是否开启
- /// </summary>
- /// <returns></returns>
- public ActionResult GetIsOverTime()
- {
- var r = projectProblems.GetIsOverTime(GetCurrentUser());
- return Content(r ? "1" : "0", "application/json");
- }
- /// <summary>
- /// 获取受理超时的问题ID
- /// </summary>
- /// <returns></returns>
- public ActionResult GetAcceptOverTime()
- {
- var json = projectProblems.GetAcceptOverTime(GetCurrentUser());
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取处理超时的问题ID
- /// </summary>
- /// <param name="user"></param>
- /// <returns></returns>
- public ActionResult GetDealOverTime(UserInfo user)
- {
- var json = projectProblems.GetDealOverTime(GetCurrentUser());
- return Content(json, "application/json");
- }
- #endregion
- #region 统计查询
- public ActionResult Statistics()
- {
- return View();
- }
- /// <summary>
- /// 获取统计报表
- /// </summary>
- /// <returns></returns>
- public string GetList()
- {
- return Newtonsoft.Json.JsonConvert.DeserializeObject(IReport.GetList(GetCurrentUser())).ToString(); //转换为动态JSON类型
- }
- #endregion
- #region 版本问题查询
- public ActionResult GetVersionProblem(string SearchText, string ProductId, string VersionId, string projectId, string AcceptedId, string sort, string order ,int page, int rows)
- {
- var json = projectProblems.GetVersionProblem(SearchText, ProductId, VersionId, projectId, AcceptedId, sort, order, page, rows);
- return Content(json, "text/json");
- }
- public ActionResult AddNotes(string id, string probID)
- {
- ViewBag.ID = id;
- ViewBag.probID = probID;
- return View();
- }
- /// <summary>
- /// 添加备注
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public ActionResult AddNotesContent(SubmitProblemFormModel model)
- {
- model.registrantID = GetCurrentUser().PersonID;
- model.DealDetail = HttpUtility.UrlDecode(model.DealDetail);
- model.Status = 12;
- var r = projectProblems.AddNotes(model);
- return Content(r.IsNullOrEmpty() ? "0" : "1", "text/plan");
- }
- #endregion
- #region 变更研发/测试处理人
- public ActionResult DevTestWindow(string id,string devID,string testID)
- {
- ViewBag.id = id;
- ViewBag.dev = devID;
- ViewBag.test = testID;
- return View();
- }
- //保存研发/测试处理人
- public int SaveDevTest(string id, string dev, string test)
- {
- var res= this.CPWTJL_obj.SaveDevTest(id, dev, test);
- return res;
- }
- #endregion
- #region 资源信息
- //问题资源弹窗
- public ActionResult ResourceWindow(string type, string version)
- {
- ViewBag.type = type;
- ViewBag.version = version;
- return View();
- }
- //编辑资源信息
- [HttpPost]
- public int SaveResource(ResourceBusinessModels model)
- {
- model.TJRID = GetCurrentUser().PersonID;
- var res = CPWTJL_obj.SaveResource(model);
- return res;
- }
- //问题资源的列表数据
- public ActionResult ResourceData(string proid)
- {
- return Content(CPWTJL_obj.ResourceData(proid), "text/json");
- }
- //问题资源的列表数据(layui用)
- public ActionResult ResourceData_Layui(string proid)
- {
- var obj = new
- {
- code = 0,
- msg = "",
- count = 1000,
- data = CPWTJL_obj.ResourceData_Layui(proid)
- };
- var jss = new JavaScriptSerializer();
- return Content(jss.Serialize(obj));
- }
- //删除资源
- public int DelResource(string id)
- {
- return CPWTJL_obj.DelResource(id);
- }
- //获取序号
- public int GetNumber(string id)
- {
- return CPWTJL_obj.GetNumber(id);
- }
- public string GetBhMethod(string id)
- {
- var obj = new
- {
- resquest = new
- {
- 资源ID = id,
- }
- };
- var jsonstr = JsonConvert.SerializeObject(obj);
- string url = "http://192.168.0.106:8801/bizdomain/03/Basis/生成资源路径?Input=" + jsonstr.ToString();
- //string url = "http://192.168.31.206:8083/bizdomain/03/Basis/生成资源路径?Input=" + jsonstr.ToString();
- return CPWTJL_obj.DoBHGet(url, "CZ", "123");
- }
- #endregion
- }
- }
|