12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559 |
- using PMS.BusinessModels.Account;
- using PMS.BusinessModels.ComplaintManage;
- using PMS.BusinessModels.MobileProblem;
- using PMS.BusinessModels.Problem;
- using PMS.BusinessModels.SMS;
- using PMS.EntityModels.Product;
- using PMS.EntityModels.WorkFlow;
- using PMS.Interface;
- using PMS.Interface.BaseCode;
- using PMS.Interface.Channel;
- using PMS.Interface.ComplaintManage;
- using PMS.Interface.MessageManage;
- using PMS.Interface.MoblieProblemRegist;
- using PMS.Interface.PresonManager;
- using PMS.Interface.Problems;
- using PMS.Interface.Product;
- using PMS.Interface.ProManager;
- using PMS.Interface.WorkFlow;
- using PMS.Plugins.Common;
- using PMS.Plugins.SMS;
- using QWPlatform.SystemLibrary;
- using QWPlatform.SystemLibrary.LogManager;
- using QWPlatform.SystemLibrary.Utils;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Web;
- using System.Web.Mvc;
- namespace PMS.WebUI.Controllers
- {
- /// <summary>
- /// 创建人:伍莲魁
- /// 创建日期:2019/1/2
- /// 模块功能:问题登记移动端控制器
- /// </summary>
- [CheckLogin("/MobileAccount/MobileProblemLogin")]
- public class MobileProblemController : BaseController
- {
- IProductModule Product_obj = InterfaceFactory.CreateBusinessInstance<IProductModule>();
- IBaseCode BaseCode_obj = InterfaceFactory.CreateBusinessInstance<IBaseCode>();
- IPersonModule Iperson_obj = InterfaceFactory.CreateBusinessInstance<IPersonModule>();
- IMoblieProblem MoblieProblem_obj = InterfaceFactory.CreateBusinessInstance<IMoblieProblem>();
- IProModule Pro_obj = InterfaceFactory.CreateBusinessInstance<IProModule>();
- ICPWTGCModel ZpwtgcModel = InterfaceFactory.CreateBusinessInstance<ICPWTGCModel>();
- IWorkFlow IWorkFlowModel = InterfaceFactory.CreateBusinessInstance<IWorkFlow>();
- IComplaintList Complaint_List = InterfaceFactory.CreateBusinessInstance<IComplaintList>();
- IChannel IChannel = InterfaceFactory.CreateBusinessInstance<IChannel>();
- //项目问题管理
- IProjectProblems projectProblems = InterfaceFactory.CreateBusinessInstance<IProjectProblems>();
- //推送消息
- IMessageManage notice = InterfaceFactory.CreateBusinessInstance<IMessageManage>();
- // GET: MobileProblem
- #region 视图
- public ActionResult Home()
- {
-
- return View();
- }
- public ActionResult NewProblem()
- {
- var UserInfo = GetCurrentUser();
- var UserType = Convert.ToString(UserInfo.PersonProperty);
- ViewBag.CurrentProject = UserInfo.DefaultProjectID;
- ViewBag.UserType = "true";
- if (UserType == "3")
- {
- ViewBag.UserType = "false";
- }
- else
- {
- var proId = Pro_obj.GetProjectByUserId(UserInfo.PersonID);
- if (!String.IsNullOrEmpty(proId))
- {
- ViewBag.CurrentProject = proId;
- }
- }
- return View();
- }
- /// <summary>
- /// 判断用户性质进入不同的问题登记页面
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult NewProblems(string id)
- {
- var UserInfo = GetCurrentUser();
- var UserType = UserInfo.PersonProperty;
- var url = "NewProblemForCustom/";
- if (UserType != 3)
- {
- url = "NewProblemForProject/";
- }
- return RedirectToAction(url + id);
- }
- public ActionResult NewProblemForProject(string id)
- {
- ViewBag.PersonProperty = GetCurrentUser().PersonProperty;
- ViewBag.ProjectId = GetCurrentUser().DefaultProjectID;
- ViewBag.OrgID = GetCurrentUser().OrgID;
- ViewBag.ProductCode = id;
- return View();
- }
- public ActionResult NewProblemForCustom(string id)
- {
- ViewBag.ProductCode = id;
- return View();
- }
- public ActionResult My()
- {
- ViewBag.PersonProperty = GetCurrentUser().PersonProperty;
- return View();
- }
- public ActionResult PersonalSetting()
- {
- return View();
- }
- public ActionResult UserDefualtSet()
- {
- ViewBag.Property = GetCurrentUser().PersonProperty;
- return View();
- }
- public ActionResult QueryProblem()
- {
- var UserInfo = GetCurrentUser();
- if (UserInfo.PersonProperty != 3)
- {
- return RedirectToAction("QueryProblemProject");
- }
- else
- {
- return RedirectToAction("QueryProblemCustom");
- }
- }
- /// <summary>
- /// 用户查询
- /// </summary>
- /// <returns></returns>
- public ActionResult QueryProblemCustom()
- {
- return View();
- }
- /// <summary>
- /// 项目人员查询
- /// </summary>
- /// <returns></returns>
- public ActionResult QueryProblemProject()
- {
- ViewBag.PersonPropert = GetCurrentUser().PersonProperty;
- return View();
- }
- public ActionResult ProblemQuickSearch()
- {
- return View();
- }
- /// <summary>
- /// 问题详细
- /// </summary>
- /// <returns></returns>
- public ActionResult ProblemDetail(string id)
- {
- var UserInfo = GetCurrentUser();
- ///如果是客户则跳转到客户的详细界面
- if (UserInfo.PersonProperty == 3)
- {
- return RedirectToAction("ProblemDetailCutom/" + id);
- }
- else
- {
- var json = MoblieProblem_obj.ProblemDetailByProject(id, UserInfo.PersonProperty, UserInfo.JobCode, UserInfo.PersonID);
- var Model = Strings.JsonToModel<ProblemDetailModel>(json);
- ViewBag.ID = id;
- ViewBag.PersonProperty = UserInfo.PersonProperty;
- return View(Model);
- }
- }
- /// <summary>
- /// 问题详细客户界面
- /// </summary>
- /// <returns></returns>
- public ActionResult ProblemDetailCutom(string id)
- {
- var UserInfo = GetCurrentUser();
- var json = MoblieProblem_obj.ProblemDetail(id, UserInfo.PersonID);
- var Model = Strings.JsonToModel<ProblemDetailModel>(json);
- ViewBag.ID = id;
- ViewBag.PersonProperty = UserInfo.PersonProperty;
- return View(Model);
- }
- public ActionResult ModifyProblem(string id)
- {
- ViewBag.PersonProperty = GetCurrentUser().PersonProperty;
- ViewBag.ID = id;
- return View();
- }
- /// <summary>
- /// 问题回退或终止填写界面
- /// </summary>
- /// <returns></returns>
- public ActionResult ProblemBack(string id, string type)
- {
- ViewBag.ID = id;
- ViewBag.type = type;
- return View();
- }
- public ActionResult ProblemDistribution(string id)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.ID = id;
- ViewBag.PersonProperty = UserInfo.PersonProperty;
- ViewBag.CompanyID = UserInfo.CompanyID;
- ViewBag.DefaultProjectID = UserInfo.DefaultProjectID;
- return View();
- }
- public ActionResult ProblemDeal(string id)
- {
- ViewBag.ID = id;
- return View();
- }
- /// <summary>
- /// 根据ID获取登陆人详细信息
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetCUserInfo()
- {
- var UserInfo = GetCurrentUser();
- var json = Complaint_List.GetComplaintPerson(UserInfo.PersonID);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取我的问题统计信息
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetCount()
- {
- var UserInfo = GetCurrentUser();
- string json;
- ///如果为客户
- if (UserInfo.PersonProperty == 3)
- {
- json = MoblieProblem_obj.GetCountForCustom(UserInfo.PersonID);
- }
- else
- {
- json = MoblieProblem_obj.GetCount(UserInfo.PersonID);
- }
- return Content(json, "application/json");
- }
- /// <summary>
- /// 公告列表页面
- /// </summary>
- /// <returns></returns>
- public ActionResult NoticeList()
- {
- return View();
- }
- /// <summary>
- /// 公告详细
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult NoticesDetail(string id)
- {
- ViewBag.ID = id;
- return View();
- }
- #endregion
- #region 问题登记相关业务
- /// <summary>
- /// 获取产品编码
- /// </summary>
- /// <returns></returns>
- public ActionResult GetProductCode(string DeafualtProjectId)
- {
- string json;
- //if (!String.IsNullOrEmpty(DeafualtProjectId))
- //{
- // json = Product_obj.GetProductCodeBycustom(DeafualtProjectId);
- // return Content(json, "application/json");
- //}
- var userinfo = GetCurrentUser();
- if (userinfo.PersonProperty == 3 || userinfo.PersonProperty == 4)
- {
- json = Product_obj.GetProductCodeBycustom(userinfo.DefaultProjectID);
- }
- else
- {
- json = Product_obj.GetProductCode();
- }
- return Content(json, "application/json");
- }
- /// <summary>
- /// 客户获取所在项目的产品编码
- /// </summary>
- /// <returns></returns>
- public ActionResult GetProductCodeBycustom()
- {
- var userinfo = GetCurrentUser();
- var json = Product_obj.GetProductCodeBycustom(userinfo.DefaultProjectID);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取当前登录帐户项目的产品
- /// </summary>
- /// <returns></returns>
- public ActionResult GetProduct(string id)
- {
- var json = Product_obj.GetProductByProjectId(id);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 根据分类ID获取基础编码
- /// </summary>
- /// <param name="ClassificationID"></param>
- /// <returns></returns>
- public ActionResult GetCodeCombobox(string ClassificationID)
- {
- var json = BaseCode_obj.GetCodeComboboxs(ClassificationID);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取当前用户渠道的项目信息
- /// </summary>
- /// <returns></returns>
- public ActionResult GetProductCombobox()
- {
- var UserInfo = GetCurrentUser();
- var json = Iperson_obj.GetProjectCobo(UserInfo.CompanyID, GetAuthDats().Project);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取项目下的机构信息
- /// </summary>
- /// <returns></returns>
- public ActionResult GetInstitution(string id)
- {
- var json = Pro_obj.GetInstitutionByProjectId(id);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 登记产品问题
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public ActionResult SubmitProblem(SubmitProblemFormModel model)
- {
- var UserInfo = GetCurrentUser();
- var status = Convert.ToString(UserInfo.PersonProperty);
- model.registrant = UserInfo.Name;
- model.registrantID = UserInfo.PersonID;
- model.registrantProperty = UserInfo.PersonProperty;
- model.CompanyID = UserInfo.CompanyID;
- /// 获取登记流程ID和进入流程ID
- var sub = GetProceessID(UserInfo, model.InstitutionID, model.ProblemNature, model.ProjectID);
- model.ProcessID = sub.ProcessID;
- model.NextProcessID = sub.NextProcessID;
- var r = MoblieProblem_obj.SubmitProblem(status, model);
- if (!String.IsNullOrEmpty(r))
- {
- if (model.DealStatus != "1")
- {
- var ProblemID = projectProblems.GetWTID(r);
- RegistNotify(ProblemID);
- var str = "您有新的问题需要处理!";
- var ProcessRemark = "有新的问题登记,请注意查收!";
- Logger.Instance.Info("登记问题推送1" + model.ProjectID);
- if (model.ProjectID.IsNullOrEmpty())
- {
- model.ProjectID = UserInfo.DefaultProjectID;
- }
- Logger.Instance.Info("登记问题推送2" + model.ProjectID);
- var dt = Iperson_obj.GetCurrentProjectInfo(model.ProjectID);
- if (dt.Rows.Count > 0)
- {
- ProcessRemark ="【"+ dt.Rows[0].GetValueByName<string>("名称")+"】"+ "登记了新问题,请注意查收!";
- }
- WeChartPush(str, ProblemID, ProcessRemark, model.CompanyID);
- dt = null;
- }
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, r, null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "登记失败!请联系管理员查看日志", null).ToString(), "application/json");
- }
- }
- /// <summary>
- /// 微信推送
- /// </summary>
- /// <param name="str">标题</param>
- /// <param name="ProblemID">问题id</param>
- /// <param name="ProcessRemark">内容</param>
- /// <param name="ChannelID">渠道id</param>
- private void WeChartPush(string str, string ProblemID, string ProcessRemark, string ChannelID)
- {
- //ProcessRemark = Tools.RemoveHTML(ProcessRemark);
- 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>();
- var dt = MoblieProblem_obj.GetChannelExtend(ChannelID);
- if (dt != null && dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- MessageDetailsDto mdd = new MessageDetailsDto();
- mdd.接收人id = dt.Rows[i].GetValueByName<string>("微信id");
- list.Add(mdd);
- }
- no.record_items = list;
- notice.SendWeChartTempletMessge(no);
- }
- }
- /// <summary>
- /// 获取登记流程ID和进入流程ID
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- private SubmitProblemFormModel GetProceessID(UserInfo UserInfo, string Institution, int? ProblemProperty, string ProjectID)
- {
- SubmitProblemFormModel model = new SubmitProblemFormModel();
- WorkFlowModel workmodel = new WorkFlowModel();
- ///如果是用户或者是机构管理员
- if (UserInfo.PersonProperty == 3 || UserInfo.PersonProperty == 4)
- {
- workmodel = MoblieProblem_obj.GetNewProblemWorkId(UserInfo.OrgID, UserInfo.DefaultProjectID);
- }
- ///如果是中联人员或者卫计委
- else
- {
- workmodel = MoblieProblem_obj.GetNewProblemWorkId(Institution, ProjectID);
- }
- ///登记流程ID
- model.ProcessID = workmodel.ID;
- ///目录ID
- model.Catalog = workmodel.CategoryID ?? 1;
- ///获取进入流程ID
- model.NextProcessID = IWorkFlowModel.GetNewProblemWorkFlowID(model.Catalog, UserInfo.PersonProperty, (ProblemProperty ?? 1));
- return model;
- }
- /// <summary>
- /// 上传图片到FTP
- /// </summary>
- /// <param name="ProblemID"></param>
- /// <returns></returns>
- public ActionResult ImageUploadFTP(string ProblemID)
- {
- 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;
- string _tp = System.IO.Path.GetExtension(fileName);
- //判断附件类型
- string fileType = "2";
- if (_tp == ".jpg" || _tp == ".png" || _tp == ".jpeg" || _tp == ".bmp")
- {
- fileType = "1";
- }
- var UplodResult = UploadFile(byteData, fileName, _tp);
- if (UplodResult.code == 100)
- {
- ///数据库存储ID
- var Complete = MoblieProblem_obj.ImageUpload(ProblemID, UplodResult.data, GetCurrentUser().Name, fileType);
- if (Complete)
- {
- result = "1";
- }
- }
- }
- }
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, result, null).ToString(), "application/json");
- }
- /// <summary>
- /// 获取项目机构树(权限)
- /// </summary>
- /// <returns></returns>
- public ActionResult GetProjectTree()
- {
- var json = Iperson_obj.GetProjectTree(GetAuthDats().Project);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 通过产品Code获取项目机构树(权限)
- /// </summary>
- /// <param name="Code"></param>
- /// <returns></returns>
- public ActionResult GetProjectTreeByCode(string id)
- {
- var json = Iperson_obj.GetProjectTreeByCode(GetAuthDats().Project, id);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 通过分类编码获取基础编码的Combobox(代码,显示名)
- /// </summary>
- /// <returns></returns>
- public ActionResult GetComboboxByCode(string id)
- {
- var json = BaseCode_obj.GetComboboxByCode(id);
- return Content(json, "application/json");
- }
- #endregion
- #region 问题查询业务
- /// <summary>
- /// 客户查询问题
- /// </summary>
- /// <param name="Model"></param>
- /// <returns></returns>
- public ActionResult QueryMyProblemByCustom(QueryMyProblemModel Model)
- {
- var UserInfo = GetCurrentUser();
- Model.CurrentUserId = UserInfo.PersonID;
- var dt = MoblieProblem_obj.QueryMyProblem(Model);
- return Content(dt.ToJson(), "application/json");
- }
- /// <summary>
- /// 获取项目数据权限combobox
- /// </summary>
- /// <returns></returns>
- public ActionResult GetAllProject()
- {
- var json = Iperson_obj.GetAllProject(GetAuthDats().Project);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取机构索引
- /// </summary>
- /// <param name=""></param>
- /// <returns></returns>
- public ActionResult GetInstitutionIndex(string id)
- {
- var json = Pro_obj.GetInstitutionIndex(id);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 根据权限和产品编码获取项目列表索引
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult GetProjectIndexByCode(string id)
- {
- var json = Pro_obj.GetProjectIndexByCode(GetAuthDats().Project, id);
- return Content(json, "application/json");
- }
- public ActionResult SelectProblemItem()
- {
- ViewBag.PersonProperty = GetCurrentUser().PersonProperty;
- ViewBag.ProjectId = GetCurrentUser().DefaultProjectID;
- ViewBag.OrgID = GetCurrentUser().OrgID;
- return View();
- }
- /// <summary>
- /// 根据渠道获取项目索引
- /// </summary>
- /// <returns></returns>
- public ActionResult GetChannelProjectIndexByCode()
- {
- var json = Pro_obj.GetChannelProjectIndexByCode(GetCurrentUser().CompanyID);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 项目人员问题查询
- /// </summary>
- /// <returns></returns>
- public ActionResult QueryProblemByProject(QueryProblemByProjectModel model)
- {
- var UserInfo = GetCurrentUser();
- model.CurrentUserId = UserInfo.PersonID;
- //如果选择所有项目,则取所有权限项目
- if (model.Project == "all")
- {
- model.Project = GetAuthDats().Project;
- }
- var dt = MoblieProblem_obj.QueryProblemByProject(model);
- if (dt != null && dt.Rows.Count > 0)
- {
- //获取当前登陆人应在的处理环节
- var CurrentLink = MoblieProblem_obj.GetUserLinkId(UserInfo.PersonProperty, UserInfo.JobCode);
- foreach (DataRow dr in dt.Rows)
- {
- //判断当前处理人是否为自己 以及 按钮权限
- if (UserInfo.PersonID != dr.GetValueByName<string>("受理人id"))
- {
- dr["是否为当前处理人"] = '0';
- }
- //判断是否解决或是否终止
- if (dr.GetValueByName<int>("是否解决") == 1 || dr.GetValueByName<int>("是否终止") == 1)
- {
- dr["按钮权限"] = '0';
- }
- ///判断是否越级
- if (CurrentLink < dr.GetValueByName<int>("环节id"))
- {
- dr["按钮权限"] = '0';
- }
- }
- }
- return Content(dt.ToJson(), "application/json");
- }
- /// <summary>
- /// 获取医院管理员所属项目和机构
- /// </summary>
- /// <returns></returns>
- public ActionResult GetPerson()
- {
- var json = MoblieProblem_obj.GetPerson(GetCurrentUser().PersonID);
- return Content(json, "application/json");
- }
- #endregion
- #region 问题详细相关业务
- /// <summary>
- /// 获取产品问题过程处理流程
- /// </summary>
- /// <returns></returns>
- public ActionResult GetClc(string id)
- {
- return Content(ZpwtgcModel.GetClc(id), "application/json");
- }
- /// <summary>
- /// 获取产品问题过程沟通需要的信息
- /// </summary>
- /// <param name="ID"></param>
- /// <returns></returns>
- public ActionResult GetCommunicates(string id)
- {
- return Content(ZpwtgcModel.GetCommunicates(id), "application/json");
- }
- /// <summary>
- /// 保存问题沟通
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public ActionResult SubmitContent(CPWTGCModel model)
- {
- model.JLSJ = DateTime.Now;
- var UserInfo = GetCurrentUser();
- model.JLRID = UserInfo.PersonID;
- string result = ZpwtgcModel.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>
- /// 获取问题的图片
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult GetFileFormFTP(string id)
- {
- var dt = MoblieProblem_obj.GetFileFormFTP(id);
- return Content(dt.ToJson(), "application/json");
- }
- public ActionResult QuerckSearch(QueryMyProblemModel model)
- {
- model.CurrentUserId = GetCurrentUser().PersonID;
- var json = MoblieProblem_obj.QuerckSearch(model);
- return Content(json, "application/json");
- }
- #endregion
- #region 问题操作相关业务
- /// <summary>
- /// 受理问题
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult AcceptProblem(string id)
- {
- ///判断用户权限
- var UserInfo = GetCurrentUser();
- var PersonProperty = UserInfo.PersonProperty;
- var jude = CrossJud(id, PersonProperty, UserInfo.JobCode);
- if (!jude)
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "您的权限不足,不能受理该问题", null).ToString(), "application/json");
- }
- //获取进入流程ID
- var WorkId = IWorkFlowModel.GetDealWorkId(id, UserInfo.PersonProperty, UserInfo.JobCode);
- //受理问题
- var DealModel = new ProblemDealModel();
- DealModel.ProblemId = id;
- DealModel.NextWorkId = WorkId;
- DealModel.DealPeronName = UserInfo.Name;
- DealModel.DealPeronId = UserInfo.PersonID;
- var re = IWorkFlowModel.ProblemAccept(DealModel);
- if (re)
- {
- 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");
- }
- }
- /// <summary>
- /// 越级判断
- /// </summary>
- /// <param name="ProblemId"></param>
- /// <param name="PersonProperty"></param>
- /// <returns></returns>
- private bool CrossJud(string ProblemId, int PersonProperty, string JobCode)
- {
- return MoblieProblem_obj.CrossJud(ProblemId, PersonProperty, JobCode);
- }
- /// <summary>
- /// 判断是否为自己处理的问题
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult IsMyProblem(string id)
- {
- var json = MoblieProblem_obj.IsMyProblem(id, GetCurrentUser().PersonID);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 问题回退,终止
- /// </summary>
- /// <param name="id"></param>
- /// <param name="type"></param>
- /// <param name="Deatil"></param>
- /// <returns></returns>
- public ActionResult ProblemBackSubmit(string id, string type, string Deatil)
- {
- var UserInfo = GetCurrentUser();
- var DealModel = new ProblemDealModel();
- DealModel.ProblemId = id;
- DealModel.DealPeronName = UserInfo.Name;
- DealModel.DealPeronId = UserInfo.PersonID;
- DealModel.Describe = Deatil;
- bool re = false;
- string ProcessId = string.Empty;
- ///回退问题
- if (type == "1")
- {
- DealModel.NextWorkId = IWorkFlowModel.GetBackProblemWorkFlowID(id);
- ///如果回退的下个流程不存在
- if (DealModel.NextWorkId < 1)
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "问题已在最初始状态,无法回退!", null).ToString(), "application/json");
- }
- re = IWorkFlowModel.ProblemRollBack(DealModel, out ProcessId);
- }
- ///终止问题
- else
- {
- re = IWorkFlowModel.ProblemBreak(DealModel, out ProcessId);
- }
- //返回
- if (re)
- {
- if (type == "1")
- {
- DealNotify(DealModel.ProblemId, 1 );
- }
- var ProblemProcessModel = new ProblemProcessModel()
- {
- IsBack = (type=="1"),
- IsStop= (type != "1"),
- ProblemID = DealModel.ProblemId
- };
- SitePush(ProblemProcessModel);
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, ProcessId, null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "操作失败!", null).ToString(), "application/json");
- }
- }
- /// <summary>
- /// 获取渠道Combobox
- /// </summary>
- /// <returns></returns>
- public ActionResult GetChannel()
- {
- var json = IChannel.GetChannelCombo();
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取项目Combobox
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult GetProject(string id)
- {
- var json = IChannel.GetProjectCombobox(id);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取分配人员
- /// </summary>
- /// <returns></returns>
- public ActionResult GetDistribuPerson(string search, string problemId)
- {
- var UserInfo = GetCurrentUser();
- var json = MoblieProblem_obj.GetPerson(search, UserInfo.PersonProperty, problemId);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 问题分配
- /// </summary>
- /// <param name="id"></param>
- /// <param name="PersonID"></param>
- /// <param name="PersonName"></param>
- /// <param name="Deatil"></param>
- /// <returns></returns>
- public ActionResult ProblemDistributeSubmit(string id, string PersonID, string PersonName, string Deatil)
- {
- var UserInfo = GetCurrentUser();
- ///获取分配人的人员性质和职务
- var User = MoblieProblem_obj.GetPersonProperty(PersonID);
- ///判断分配人是否有处理环节
- var IsDealProcess = MoblieProblem_obj.IsDealProcess(id, User.PersonProperty);
- if (!IsDealProcess)
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "分配失败,分配人未配置环节,请联系管理员!", null).ToString(), "application/json");
- }
- //获取进入流程ID
- var WorkId = IWorkFlowModel.GetDealWorkId(id, User.PersonProperty, User.JobCode);
- //分配人员
- var DealModel = new ProblemDealModel();
- DealModel.ProblemId = id;
- DealModel.Describe = Deatil;
- DealModel.NextWorkId = WorkId;
- DealModel.DealPeronId = UserInfo.PersonID;
- DealModel.AssignPersonName = PersonName;
- DealModel.AssignPersonId = PersonID;
- string ProcessId = string.Empty;
- var re = IWorkFlowModel.ProblemAssgin(DealModel, out ProcessId);
- if (re)
- {
- var ProblemProcessModel = new ProblemProcessModel()
- {
- IsAssign=true,
- AssignID= DealModel.AssignPersonId,
- ProblemID= id
- };
- SitePush(ProblemProcessModel);
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, ProcessId, null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "分配失败!", null).ToString(), "application/json");
- }
- }
- /// <summary>
- /// 获取存在产品问题的产品所有版本
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult GetProblemVison(string id)
- {
- var json = MoblieProblem_obj.GetProblemVison(id);
- return Content(json, "application/json");
- }
- public ActionResult ProblemDealSubmit(ProblemDealForm Model)
- {
- var UserInfo = GetCurrentUser();
- var DealModel = new ProblemDealModel();
- DealModel.ProblemId = Model.ProblemID;
- DealModel.Describe = Model.DealDescribe;
- DealModel.DealPeronId = UserInfo.PersonID;
- DealModel.DealPeronName = UserInfo.Name;
- //获取进入流程ID
- DealModel.NextWorkId = IWorkFlowModel.GetDealWorkId(Model.ProblemID, UserInfo.PersonProperty, UserInfo.JobCode);
- bool re;
- string ProcessId = string.Empty;
- ///如果处理完成
- if (Model.Iscomplete)
- {
- DealModel.Solution = Model.DealDescribe;
- DealModel.Version = Model.Vision;
- re = IWorkFlowModel.ProblemSolution(DealModel, out ProcessId, UserInfo);
- }
- //如果未完成
- else
- {
- re = IWorkFlowModel.ProblemDeal(DealModel, out ProcessId);
- }
- //判断执行状态
- if (re)
- {
- if (Model.Iscomplete)
- {
- var ProblemProcessModel = new ProblemProcessModel()
- {
- IsSolve=true,
- ProblemID= DealModel.ProblemId
- };
- SitePush(ProblemProcessModel);
- }
-
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, ProcessId, null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "处理失败!", null).ToString(), "application/json");
- }
- }
- /// <summary>
- /// 问题向上提交
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult ProblemPutSubmit(string id)
- {
- var UserInfo = GetCurrentUser();
- var DealModel = new ProblemDealModel();
- DealModel.ProblemId = id;
- DealModel.DealPeronId = UserInfo.PersonID;
- //获取提交问题进入流程ID
- DealModel.NextWorkId = IWorkFlowModel.GetSubmitProblemWorkFlowID(UserInfo.PersonProperty, id);
- var re = IWorkFlowModel.ProblemSubmit(DealModel);
- //判断执行状态
- if (re)
- {
- DealNotify(DealModel.ProblemId, 2);
- 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");
- }
- }
- /// <summary>
- /// 上传附件到FTP并保存到问题附件
- /// </summary>
- /// <param name="file"></param>
- /// <param name="Model"></param>
- /// <returns></returns>
- public ActionResult FlieUploadAndSave(string ProcessId)
- {
- var files = this.Request.Files;
- var rs = false;
- var Model = new ProcessFileModel();
- Model.Name = GetCurrentUser().Name;
- Model.ProcessId = ProcessId;
- if (files.Count > 0)
- {
- for (int i = 0; i < files.Count; i++)
- {
- using (BinaryReader br = new BinaryReader(files[i].InputStream))
- {
- byte[] byteData = br.ReadBytes((int)files[i].InputStream.Length);
- var uploadFile = files[i];
- var fileName = uploadFile.FileName;
- string _tp = System.IO.Path.GetExtension(fileName);
- //判断附件类型
- string fileType = "2";
- if (_tp == ".jpg" || _tp == ".png" || _tp == ".jpeg" || _tp == ".bmp")
- {
- fileType = "1";
- }
- Model.Type = fileType;
- //上传
- var UplodResult = UploadFile(byteData, fileName, _tp);
- ///是否上传成功
- if (UplodResult.code == 100)
- {
- ///保存到问题附件表
- Model.FileId = UplodResult.data;
- rs = IWorkFlowModel.SaveProcessFile(Model);
- }
- }
- }
- }
- if (rs)
- {
- 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");
- }
- }
- /// <summary>
- /// 上传附件到FTP并保存到问题附件(base64)
- /// </summary>
- /// <param name="ProcessId"></param>
- /// <returns></returns>
- public ActionResult Base64UploadAndSave(string ProcessId, string dataURL, string name)
- {
- var rs = false;
- var Model = new ProcessFileModel();
- Model.Name = GetCurrentUser().Name;
- Model.ProcessId = ProcessId;
- Model.Type = "1";
- name += ".jpeg";
- if (!string.IsNullOrEmpty(dataURL))
- {
- String base64 = dataURL.Substring(dataURL.IndexOf(",") + 1);
- byte[] byteData = Convert.FromBase64String(base64);
- //上传
- var UplodResult = UploadFile(byteData, name, ".jpeg");
- ///是否上传成功
- if (UplodResult.code == 100)
- {
- ///保存到问题附件表
- Model.FileId = UplodResult.data;
- rs = IWorkFlowModel.SaveProcessFile(Model);
- }
- }
- if (rs)
- {
- 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");
- }
- }
- //查看附件图像(id:附件id,type:缩略图o原图,s缩略图,m大图)
- public ActionResult ViewProblemImage(string id, string type)
- {
- try
- {
- 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);
- return File(data, "image/jpeg");
- }
- }
- catch (Exception ex)
- {
- Logger.Instance.Warn("问题件服务器出现了异常:" + ex.Message);
- return View();
- }
- }
- /// <summary>
- /// 获取图片Base64
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult GetBase64(string id)
- {
- var obj = DownloadFileBase64(id, string.Empty);
- FTPFileModel model = new FTPFileModel
- {
- base64 = obj.base64,
- fileName = obj.fileName,
- format = obj.format
- };
- return Content(model.base64ToImage, "application/json");
- }
- /// <summary>
- /// 获取问题信息
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult GetProblemInfomation(string id)
- {
- var json = MoblieProblem_obj.GetProblemInfomation(id);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 修改问题
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public ActionResult ModifySubmit(SubmitProblemFormModel model)
- {
- var UserInfo = GetCurrentUser();
- model.registrantID = UserInfo.PersonID;
- string r;
- //判断是否为自己登记的问题(管理员可以修改他人的问题)
- var s = MoblieProblem_obj.IsModifyMyProblem(UserInfo.PersonID, model.ProblemId);
- if (!s && UserInfo.PersonProperty==3)
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "不能修改他人登记的问题!", null).ToString(), "application/json");
- }
- if (UserInfo.PersonProperty == 3)
- {
- r = MoblieProblem_obj.ModifySubmitForCustom(model);
- }
- else
- {
- r = MoblieProblem_obj.ModifySubmit(model);
- }
- if (!String.IsNullOrEmpty(r))
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, r, null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "修改失败!请联系管理员查看日志", null).ToString(), "application/json");
- }
- }
- /// <summary>
- /// 获取问题登记的附件
- /// </summary>
- public ActionResult GetProblemFlie(string id)
- {
- var json = MoblieProblem_obj.GetProblemFlie(id);
- return Content(json, "application/json");
- }
- #endregion
- #region 获取验证码
- public ActionResult GetSMSCodeCurrent()
- {
- bool r = false;
- ///发送短信
- var tele = GetCurrentUser().Account;
- //var smsSend = SysCom.Instance.ZlsoftAppSms(tele);
- var dt = account_obj.GetTelAccountInfo(tele);
- if (dt != null && dt.Rows.Count > 0)
- {
- }
- else
- {
- Logger.Instance.Info("手机号未注册,就在进行发验证码"+tele);
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "当前手机号未生成账号,请点击右上角先进行注册", null).ToString(), "application/json");
- }
- var code = "";
- var smsSend = SendSMS.SendKuaiZiSMS(tele,ref code);
- if (!string.IsNullOrEmpty(code))
- {
- r = MoblieProblem_obj.GetSMSCode(tele, code);
- }
- if (r)
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, "发送成功,10分钟内有效!", null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, "短信发送失败,请联系管理员", null).ToString(), "application/json");
- }
- }
- /// <summary>
- /// 修改密码
- /// </summary>
- /// <param name="telephone"></param>
- /// <param name="Code"></param>
- /// <param name="password"></param>
- /// <returns></returns>
- public ActionResult PasswordModifySubmit(string Code, string password)
- {
- var r = MoblieProblem_obj.PasswordModifySubmit(GetCurrentUser().Account, Code, password);
- if (r == "1")
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.OK, "修改成功", null).ToString(), "application/json");
- }
- else
- {
- return Content(new PmsJsonResoult(System.Net.HttpStatusCode.Forbidden, r, null).ToString(), "application/json");
- }
- }
- #endregion
- #region 向客户端发送更新操作
- /// <summary>
- /// 向客户端发送更新操作
- /// </summary>
- /// <param name="Processid">问题流程ID</param>
- private void RefreshProblem(string id)
- {
- var HJID = MoblieProblem_obj.GetProblemByProcssId(id);
- if (HJID <= 3)
- {//更新项目问题管理列表
- App_Start.ClientManager.RefreshProblem("1");
- }
- else if (HJID == 4)
- {//更新技术支持
- App_Start.ClientManager.RefreshProblem("2");
- }
- else
- {//研发
- App_Start.ClientManager.RefreshProblem("3");
- }
- }
- /// <summary>
- /// 向客户端发送更新操作
- /// </summary>
- /// <param name="id">工作流ID</param>
- private void RefreshProblemByWorkId(int id)
- {
- try
- {
- var HJID = MoblieProblem_obj.GetProblemByWorkId(id);
- if (HJID <= 3)
- {//更新项目问题管理列表
- App_Start.ClientManager.RefreshProblem("1");
- }
- else if (HJID == 4)
- {//更新技术支持
- App_Start.ClientManager.RefreshProblem("2");
- }
- else
- {//研发
- App_Start.ClientManager.RefreshProblem("3");
- }
- }
- catch(Exception ex)
- {
- Logger.Instance.Error("更新客户端出错", ex);
- }
- }
- //站点推送
- private void SitePush(ProblemProcessModel model)
- {
- var userInfo = GetCurrentUser();
- try
- {
- if (model.IsAssign)
- {//处理成功与指派人员时需要向该被指派人员推送消息
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(model.AssignID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.Assign.SendSite)
- this.SendDealMessage(model.ProblemID,model.AssignID, "有新的问题指派给您,请注意查收!",1);
- }
- else if (model.IsSolve)
- {
- var WTJLModel = projectProblems.GetWTJLModel(model.ProblemID);
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(WTJLModel.DJRID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.SolveTime.SendSite)
- {
- var str = "您的编号为【" + WTJLModel.BH.ToString() + "】的问题已被解决,处理人:" + WTJLModel.SLR;
- this.SendDealMessage(model.ProblemID,WTJLModel.DJRID, str,2);
- }
- }
- else if (model.IsBack)
- {
- var WTJLModel = projectProblems.GetWTJLModel(model.ProblemID);
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(WTJLModel.DJRID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.BackTime.SendSite)
- {
- var str = "您的编号为【" + WTJLModel.BH.ToString() + "】的问题已被回退,处理人:" + userInfo.Name;
- this.SendDealMessage(model.ProblemID,WTJLModel.DJRID, str,3);
- }
- }
- else if (model.IsStop)
- {
- var WTJLModel = projectProblems.GetWTJLModel(model.ProblemID);
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(WTJLModel.DJRID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.StopTime.SendSite)
- {
- var str = "您的编号为【" + WTJLModel.BH.ToString() + "】的问题已被终止,处理人:" + userInfo.Name;
- this.SendDealMessage(model.ProblemID,WTJLModel.DJRID, str,4);
- }
- }
- else if (model.IsCommit && !string.IsNullOrEmpty(model.SubID))
- {
- var NotefiyConfigInfo = projectProblems.GetNotifyConfigInfoByUserId(model.SubID);
- if (NotefiyConfigInfo != null && NotefiyConfigInfo.Assign.SendSite)
- this.SendDealMessage(model.ProblemID,model.SubID, "有新的问题提交给您,请注意查收!",5);
- }
- }
- catch (Exception ex)
- {
- Logger.Instance.Error("站点推送失败,原因:" + ex);
- }
- }
- //登记问题获取推送人
- private List<string> GetPushPerson(string ProblemId)
- {
- ///通过问题流程Id获取问题Id
-
- 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;
- }
- #endregion
- #region 版本问题查询
- public ActionResult VersionProblem()
- {
- return View();
- }
- public ActionResult VersionProblemDeatil(string id,string vpid)
- {
- var UserInfo = GetCurrentUser();
- var json = MoblieProblem_obj.ProblemDetail(id, UserInfo.PersonID);
- var Model = Strings.JsonToModel<ProblemDetailModel>(json);
- ViewBag.ID = id;
- ViewBag.vpid = vpid;
- ViewBag.PersonProperty = UserInfo.PersonProperty;
- return View(Model);
- }
- /// <summary>
- /// 获取版本问题说明及其补丁
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult getVersionPoblemExplain(string id)
- {
- var json = MoblieProblem_obj.getVersionPoblemExplain(id);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 下载版本附件
- /// </summary>
- /// <param name="id"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- public ActionResult DownLoadVersionFile(string id, string type,string flieVersionId)
- {
- if (string.IsNullOrEmpty(type))
- {//文件流传输
- var obj = DownloadFileBase64(id, string.Empty);
- if (obj != null)
- {
- //将base64转bytes
- var data = Convert.FromBase64String(obj.base64);
- MoblieProblem_obj.SaveLogger(id, flieVersionId, GetCurrentUser().PersonID);
- return File(data, "application/octet-stream", obj.fileName);
- }
- else
- {
- Logger.Instance.Warn("未获取到文件对象:" + id);
- return View();
- }
- }
- else
- {//图像传输
- var data = base.DownloadFileBytes(id, type);
- return File(data, "image/jpeg");
- }
- }
- #endregion
- #region 我的评价
- /// <summary>
- /// 我的评价-首页
- /// </summary>
- /// <returns></returns>
- public ActionResult MyComments()
- {
- ViewBag.PersonPropert = GetCurrentUser().PersonProperty;
- return View();
- }
-
- /// <summary>
- ///获取待评价已评价的问题列表
- /// </summary>
- /// <param name="model"></param>
- /// <param name="ID"></param>
- /// <returns></returns>
- public ActionResult GetQuestionList(MyCommModel model)
- {
- int total = 0;
- var user = GetCurrentUser();
- model.PersonId = user.PersonID;
- var result = MoblieProblem_obj.GetQuestionList(model.PersonId, model.pageindex, model.pagesize,model.Tab, out total);
- return Content(result, "application/json");
- }
- /// <summary>
- /// 获取已评价后的内容
- /// </summary>
- /// <param name="ProblemID">问题id</param>
- /// <returns></returns>
- public ActionResult GetEvaluationContent(string ProblemID)
- {
- var user = GetCurrentUser();
- var result = MoblieProblem_obj.GetEvaluationContent(user.PersonID, ProblemID);
- return Content(result, "application/json");
- }
- /// <summary>
- /// 问题评价
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public ActionResult ProblemReamrk(string id)
- {
- var UserInfo = GetCurrentUser();
- ViewBag.ID = id;
- var json = MoblieProblem_obj.ProblemDetail(id, UserInfo.PersonID);
- var Model = Strings.JsonToModel<ProblemDetailModel>(json);
- ViewBag.PersonProperty = UserInfo.PersonProperty;
- return View(Model);
- }/// <summary>
- /// 提交评论
- /// </summary>
- /// <returns></returns>
- public ActionResult ProblemReamrkSubmit(commentsModel model)
- {
- string CommentsId = string.Empty;
- var user = GetCurrentUser();
- model.CommitPerson = user.Name;
- model.CommitPersonId = user.PersonID;
- var r = MoblieProblem_obj.ProblemReamrkSubmit(model, out CommentsId);
- var json = new
- {
- Code = r ? "200" : "0",
- CommentsId = CommentsId
- };
- return Content(Strings.ObjectToJson(json), "application/json");
- }
- public ActionResult CommitUpload(CommitFlie model, string ID)
- {
- var files = this.Request.Files;
- var rs = false;
- model.CommitId = ID;
- model.Name = GetCurrentUser().Name;
- if (files.Count > 0)
- {
- for (int i = 0; i < files.Count; i++)
- {
- using (BinaryReader br = new BinaryReader(files[i].InputStream))
- {
- byte[] byteData = br.ReadBytes((int)files[i].InputStream.Length);
- var uploadFile = files[i];
- var fileName = uploadFile.FileName;
- string _tp = System.IO.Path.GetExtension(fileName);
- //判断附件类型
- string fileType = "2";
- if (_tp == ".jpg" || _tp == ".png" || _tp == ".jpeg" || _tp == ".bmp")
- {
- fileType = "1";
- }
- model.FlieType = fileType;
- //上传
- var UplodResult = UploadFile(byteData, fileName, _tp);
- ///是否上传成功
- if (UplodResult.code == 100)
- {
- ///保存到评价附件表
- model.FlieID = UplodResult.data;
- rs = MoblieProblem_obj.CommitFlieUplod(model);
- }
- }
- }
- }
- if (rs)
- {
- 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");
- }
- }
- /// <summary>
- /// 判断是否能够评价
- /// </summary>
- /// <param name="ProblemId"></param>
- /// <returns></returns>
- public ActionResult IsCommit(string id)
- {
- var r = MoblieProblem_obj.IsCommit(id, GetCurrentUser().PersonID);
- return Content(r ? "1" : "0");
- }
- /// <summary>
- /// 获取文件图片
- /// </summary>
- /// <param name="id">评价id</param>
- /// <returns></returns>
- public ActionResult GetEvaluationFile(string id)
- {
- var r = MoblieProblem_obj.GetEvaluationFile(id);
- return Content(r, "application/json");
- }
- #endregion
- }
- }
|