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
{
///
/// 创 建 人:王海洋
/// 创建日期:2018-12-24
/// 功能描述:问题管理控制器
///
public class ProblemController : BaseController
{
#region 接口实例
ICPWTJLModel CPWTJL_obj = InterfaceFactory.CreateBusinessInstance();
IZDYCXModel ZDYCX_obj = InterfaceFactory.CreateBusinessInstance();
IProModule ProModule = InterfaceFactory.CreateBusinessInstance();
IZDYCXModel ZdycxModel = InterfaceFactory.CreateBusinessInstance();
ICPWTGCModel ZpwtgcModel = InterfaceFactory.CreateBusinessInstance();
IPersonModule PersonModule = InterfaceFactory.CreateBusinessInstance();
IWorkFlow WorkFlowModule = InterfaceFactory.CreateBusinessInstance();
IWTJLGCModel WtJlGcModule = InterfaceFactory.CreateBusinessInstance();
IWTJLModel WTJL_obj = InterfaceFactory.CreateBusinessInstance();
IWTGTGCModel WTGTG_obj = InterfaceFactory.CreateBusinessInstance();
ISupport support = InterfaceFactory.CreateBusinessInstance();
IProduct product = InterfaceFactory.CreateBusinessInstance();
IReport IReport = InterfaceFactory.CreateBusinessInstance();
//项目问题管理
IProjectProblems projectProblems = InterfaceFactory.CreateBusinessInstance();
//推送消息
IMessageManage notice = InterfaceFactory.CreateBusinessInstance();
#endregion 公共方法
#region 公共方法
//获取基础编码
public ActionResult GetBaseCode(string type)
{
return Content(CPWTJL_obj.GetBaseCode(type), "text/json");
}
///
/// 日期计算方法
///
/// 1.一周 2.两周 3.一个月 4.两个月 5.三个月 6.半年
///
[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();
}
///
/// 自定义查询方案查询
///
///
public ActionResult ProjectZdyCx()
{
var UserInfo = GetCurrentUser();
string result = ZDYCX_obj.ProjectZdyCx(UserInfo.ID);
return Content(result, "application/json");
}
///
/// 根据自定义方案得条件查询数据
///
///
[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");
}
///
/// 分布视图
///
///
public PartialViewResult Partial()
{
return base.PartialView();
}
///
/// 获取渠道信息
///
///
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");
}
///
/// 获取性质信息
///
///
public ActionResult XZinfo()
{
string result = WTJL_obj.GETXZinfo();
return Content(result, "application/json");
}
///
/// 获取紧急程度信息
///
///
public ActionResult JJCDinfo()
{
string result = WTJL_obj.GETJJCDinfo();
return Content(result, "application/json");
}
///
/// 获取研发人员
///
///
public ActionResult GetAssignPerson()
{
return Content(CPWTJL_obj.GetAssignPerson(), "application/json");
}
public ActionResult LCHJ()
{
return Content(WTJL_obj.LCHJ(), "application/json");
}
///
/// 渠道所属项目查询
///
///
///
public ActionResult QdXm(string QdID)
{
string result = WTJL_obj.QdXm(QdID);
return Content(result, "application/json");
}
///
/// 获取项目机构
///
///
///
public ActionResult XmJg(string JgID)
{
string result = CPWTJL_obj.XmJgs(JgID);
return Content(result, "application/json");
}
///
/// 获取项目产品
///
///
///
public ActionResult XmCp(string XmID)
{
string result = WTJL_obj.XmCp(XmID);
return Content(result, "application/json");
}
///
/// 快速查询
///
/// 快速查询
///
public ActionResult KsSelect(string KsCx)
{
int page = 1, rows = 10, total = 0;
return Content(WTJL_obj.KsSelect(KsCx, page, rows, total), "application/json");
}
///
/// 获取产品问题过程处理流程
///
///
public ActionResult GetClc(string ID)
{
return Content(WtJlGcModule.GetClc(ID), "application/json");
}
///
/// 获取产品问题过程沟通需要的信息
///
///
///
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, "保存失败");
}
///
/// 判断是否卫计委审核可以处理问题(待测试) ///12 5(卫计委管理员 卫计委信息科管理员)3客户人员(自己登记的问题)4医院管理员(自己机构(站点信息))
/// ?处理问题时 医院管理原 机构内处理 卫计委 卫计委处理 客户只能看不能处理
///
///
///
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;
}
///
/// 问题确认
///
///
///
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());
}
}
///
/// 查看问题
///
///
///
///
public ActionResult WtCk(string id, string BT)
{
ViewBag.Event = BT;
ViewBag.id = id;
return View();
}
///
///查看问题详情
///
///
///
public ActionResult Wtdetail(string id)
{
return Content(CPWTJL_obj.Wtdetail(id), "application/json");
}
///
///当前问题处理状态
///
///
///
public ActionResult DealProblem(string WTid)
{
var user = GetCurrentUser();
string result = WTJL_obj.DealProblem(WTid, user.PersonProperty.ToString());
return Content(result);
}
///
/// 判断问题是否被终止或者被解决
///
///
///
public ActionResult SfZz(string id)
{
string result = CPWTJL_obj.SfZz(id);
return Content(result);
}
///
/// 产品问题处理人
///
///
public ActionResult ProductionPdealR()
{
var UserInfo = GetCurrentUser();
var t = UserInfo.AuthDats;
string json = PersonModule.GetPerson(t);
return Content(json, "application/json");
}
///
/// 处理问题弹出层
///
///
public ActionResult PopWindows()
{
return View();
}
///
/// 问题验证
///
///
///
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(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(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(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");
}
///
/// 智能表单文件上传[旧版本,上传文件到114]
///
///
[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");
}
///
/// 上传文件到阿里云
///
///
[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(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 list = new List();
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");
}
///
/// 产品问题处理弹框
///
///
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();
}
///
/// 执行处理(确定处理问题)
///
/// 处理信息
///
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");
}
///
/// 向客户端发送更新操作
///
///
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 GetPushPerson(string ProblemId)
{
var PersonId = GetCurrentUser().PersonID;
var list = projectProblems.GetPushPerson(ProblemId);
//去除自己
list.Remove(PersonId);
return list;
}
///
/// 登记推送
///
///
private void RegistNotify(string id)
{
var PushPerson = GetPushPerson(id);
var PushPersonTask = Task.Factory.StartNew(() => Parallel.ForEach(PushPerson, item => this.RefreshProblemAndSendMessage(item, "有新的问题登记,请注意查收!", id)));
Task.WaitAll(PushPersonTask);
return;
}
///
/// 回退和向上提交的问题推送
///
///
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(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("登记人ID");
}
dt = null;
}
WeChartPush(str,model.ProblemID,model.ProcessRemark, AssignID);
}
catch (Exception ex)
{
Logger.Instance.Error("站点推送失败,原因:" + ex);
}
}
///
/// 微信推送
///
/// 标题
/// 问题id
/// 内容
/// 推送人id
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 list = new List();
MessageDetailsDto mdd = new MessageDetailsDto();
var dt = account_obj.GetAccountInfo(AssignID);
if (dt != null && dt.Rows.Count > 0)
{
mdd.接收人id = dt.GetValueByName("微信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;
}
///
/// 判断是否允许修改问题过程
///
///
///
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(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 其他操作
///
/// 判断是否有权限对问题进行归类
///
///
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");
}
}
///
/// 判断问题是否完结并处理推送评价
///
///
///
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");
}
}
///
/// 问题验证
///
///
///
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");
}
///
/// 归类问题窗体
///
///
///
public ActionResult DoClassifiWindow(string id,int nature)
{
ViewBag.ID = id;
ViewBag.nature = nature;
return View();
}
///
/// 解决版本
///
/// 问题id
/// 产品id
///
public ActionResult ResolveVersion(string id,string probID)
{
ViewBag.ID = id;
ViewBag.probID = probID;
return View();
}
///
/// 更新问题版本
///
///
///
public ActionResult UpdateVersion(VersionManageModel model)
{
model.操作人 = GetCurrentUser().Name;
var r = WorkFlowModule.UpdateVersion(model);
return Content(r ? "1" : "0", "text/plan");
}
///
/// 问题归类
///
///
///
[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);
}
///
/// 标准底线问题
///
///
///
///
[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 超时推送
///
/// 获取超时推送是否开启
///
///
public ActionResult GetIsOverTime()
{
var r = projectProblems.GetIsOverTime(GetCurrentUser());
return Content(r ? "1" : "0", "application/json");
}
///
/// 获取受理超时的问题ID
///
///
public ActionResult GetAcceptOverTime()
{
var json = projectProblems.GetAcceptOverTime(GetCurrentUser());
return Content(json, "application/json");
}
///
/// 获取处理超时的问题ID
///
///
///
public ActionResult GetDealOverTime(UserInfo user)
{
var json = projectProblems.GetDealOverTime(GetCurrentUser());
return Content(json, "application/json");
}
#endregion
#region 统计查询
public ActionResult Statistics()
{
return View();
}
///
/// 获取统计报表
///
///
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();
}
///
/// 添加备注
///
///
///
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
}
}