|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
using DSWeb.SoftMng.BLL;
|
|
|
|
|
using DSWeb.SoftMng.DBUtility;
|
|
|
|
|
using DSWeb.SoftMng.Model;
|
|
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
using DSWeb.Areas.SoftMng.DB;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using DSWeb.Areas.Dispatch.Helper;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
|
namespace DSWeb.SoftMng.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class CustomerController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly FeedbackBLL _bll = new FeedbackBLL();
|
|
|
|
|
private readonly FeedbackInfoBLL _fbll = new FeedbackInfoBLL();
|
|
|
|
|
private DsDataContext dsData = new DsDataContext();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region View
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 首页
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ActionResult Index(string projectId = "")
|
|
|
|
|
{
|
|
|
|
|
Session["FilterCustomerProjectId"] = projectId;
|
|
|
|
|
|
|
|
|
|
if (Session["CODENAME"] == null)
|
|
|
|
|
Response.Redirect("/login.aspx");
|
|
|
|
|
ViewData["CODENAME"] = Session["CODENAME"];
|
|
|
|
|
ViewData["SHOWNAME"] = Session["SHOWNAME"];
|
|
|
|
|
|
|
|
|
|
//查询用户(并安客户名称拼音排序)
|
|
|
|
|
userBLL ibll = new userBLL();
|
|
|
|
|
StringBuilder where = new StringBuilder();
|
|
|
|
|
where.Append("ISDELETED = 0 and isdisable=0");
|
|
|
|
|
where.Append(" and (select value from user_userattribute where userid=[user].gid and attributeid='D4BF2204-F0AC-4F12-B02C-6520D57BF806')='true'"); //是客服
|
|
|
|
|
where.Append(" and (select value from user_userattribute where userid=[user].gid and attributeid='D4BF2204-F0AC-4F12-B02C-6520D57BF800')='false'"); //未停用
|
|
|
|
|
where.Append(" order by SHOWNAME collate Chinese_PRC_CS_AS_KS_WS");
|
|
|
|
|
var list = ibll.GetModelList(where.ToString());
|
|
|
|
|
Dictionary<string, string> dict = new Dictionary<string, string>();
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
dict.Add(item.SHOWNAME, item.SHOWNAME);
|
|
|
|
|
ViewData["proMasterOption"] = dict;
|
|
|
|
|
|
|
|
|
|
tSysEnumValueBLL tbll = new tSysEnumValueBLL();
|
|
|
|
|
StringBuilder where1 = new StringBuilder();
|
|
|
|
|
where1.Append("EnumtypeID = 99990 order by EnumValueID");
|
|
|
|
|
var list1 = tbll.GetModelList(where1.ToString());
|
|
|
|
|
Dictionary<string, string> dict1 = new Dictionary<string, string>();
|
|
|
|
|
foreach (var item in list1)
|
|
|
|
|
dict1.Add(item.EnumValueID, item.EnumValueName);
|
|
|
|
|
ViewData["feedbackTypeOption"] = dict1;
|
|
|
|
|
|
|
|
|
|
var listActOpts = tbll.GetModelList("EnumtypeID = 99991 order by EnumValueID");
|
|
|
|
|
Dictionary<string, string> dicActOpts = new Dictionary<string, string>();
|
|
|
|
|
foreach (var item in listActOpts)
|
|
|
|
|
dicActOpts.Add(item.EnumValueID, item.EnumValueName);
|
|
|
|
|
ViewData["actionOption"] = dicActOpts;
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Handler
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 懒加载客户信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pageIndex"></param>
|
|
|
|
|
/// <param name="pageSize"></param>
|
|
|
|
|
/// <param name="query"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult GetInfoClientList(int pageIndex, int pageSize, string query)
|
|
|
|
|
{
|
|
|
|
|
info_clientBLL ibll = new info_clientBLL();
|
|
|
|
|
StringBuilder where = new StringBuilder();
|
|
|
|
|
if (!String.IsNullOrEmpty(query))
|
|
|
|
|
where.Append(string.Format("CODENAME LIKE '%{0}%' OR SHORTNAME LIKE '%{0}%' OR DESCRIPTION LIKE '%{0}%'", query));
|
|
|
|
|
var list = ibll.GetModelList(pageIndex, pageSize, where.ToString(), "SHORTNAME collate Chinese_PRC_CS_AS_KS_WS");
|
|
|
|
|
var total = ibll.GetRecordCount(where.ToString());
|
|
|
|
|
var result = from p in list
|
|
|
|
|
select new
|
|
|
|
|
{
|
|
|
|
|
id = "{Key:'" + p.GID + "', Value:'" + p.SHORTNAME + "'}",
|
|
|
|
|
text = p.SHORTNAME
|
|
|
|
|
};
|
|
|
|
|
return Json(new { data = result, total }, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
public JsonResult GetInfoClientListEasy(int pageIndex, int pageSize, string query)
|
|
|
|
|
{
|
|
|
|
|
info_clientBLL ibll = new info_clientBLL();
|
|
|
|
|
StringBuilder where = new StringBuilder();
|
|
|
|
|
if (!String.IsNullOrEmpty(query))
|
|
|
|
|
where.Append(string.Format("CODENAME LIKE '%{0}%' OR SHORTNAME LIKE '%{0}%' OR DESCRIPTION LIKE '%{0}%'", query));
|
|
|
|
|
var list = ibll.GetModelList(pageIndex, pageSize, where.ToString(), "SHORTNAME collate Chinese_PRC_CS_AS_KS_WS");
|
|
|
|
|
var total = ibll.GetRecordCount(where.ToString());
|
|
|
|
|
var result = from p in list
|
|
|
|
|
select new
|
|
|
|
|
{
|
|
|
|
|
id = p.SHORTNAME,
|
|
|
|
|
text = p.SHORTNAME
|
|
|
|
|
};
|
|
|
|
|
return Json(new { data = result, total }, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 懒加载项目信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pageIndex"></param>
|
|
|
|
|
/// <param name="pageSize"></param>
|
|
|
|
|
/// <param name="query"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult GetInfoProjectList(int pageIndex, int pageSize, string query)
|
|
|
|
|
{
|
|
|
|
|
op_softprojectBLL ibll = new op_softprojectBLL();
|
|
|
|
|
StringBuilder where = new StringBuilder();
|
|
|
|
|
if (!String.IsNullOrEmpty(query))
|
|
|
|
|
where.Append(string.Format("BSNO LIKE '%{0}%' OR PROJECTNAME LIKE '%{0}%'", query));
|
|
|
|
|
var list = ibll.GetModelList(pageIndex, pageSize, where.ToString(), "PROJECTNAME collate Chinese_PRC_CS_AS_KS_WS");
|
|
|
|
|
var total = ibll.GetRecordCount(where.ToString());
|
|
|
|
|
var result = from p in list
|
|
|
|
|
select new
|
|
|
|
|
{
|
|
|
|
|
id = "{Key:'" + p.GID + "', Value:'" + p.PROJECTNAME + "'}",
|
|
|
|
|
text = p.PROJECTNAME
|
|
|
|
|
};
|
|
|
|
|
return Json(new { data = result, total }, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="startIndex">开始索引</param>
|
|
|
|
|
/// <param name="limit">分页大小</param>
|
|
|
|
|
/// <param name="search">搜索框的值</param>
|
|
|
|
|
/// <param name="sortName">排序字段</param>
|
|
|
|
|
/// <param name="sortOrder">排序方式</param>
|
|
|
|
|
/// <param name="status">处理情况</param>
|
|
|
|
|
/// <param name="character">当前角色</param>
|
|
|
|
|
/// <param name="feedbackId">反馈编号</param>
|
|
|
|
|
/// <param name="companyId">客户</param>
|
|
|
|
|
/// <param name="project">项目编号</param>
|
|
|
|
|
/// <param name="proMaster">处理客服</param>
|
|
|
|
|
/// <param name="question">问题描述</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
public JsonResult GetList(int startIndex, int limit, string search, string sortName, string sortOrder, string status, string character, string feedbackId, string companyId, string project, string proMaster, string question)
|
|
|
|
|
{
|
|
|
|
|
if (Session["FilterCustomerProjectId"] != null && !string.IsNullOrWhiteSpace(Session["FilterCustomerProjectId"].ToString()))
|
|
|
|
|
{
|
|
|
|
|
project = Session["FilterCustomerProjectId"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder where = new StringBuilder();
|
|
|
|
|
where.Append("isDelete = 0");
|
|
|
|
|
if (!(String.IsNullOrEmpty(search) || String.IsNullOrWhiteSpace(search)))
|
|
|
|
|
where.Append(" And (question like '%" + search + "%' Or companyID like '{%Value:''%" + search + "%''}' Or createUser like '%" + search + "%')");//客户要正则匹配
|
|
|
|
|
if (!String.IsNullOrEmpty(character))
|
|
|
|
|
where.Append(string.Format(" And proMaster = '{0}'", character));
|
|
|
|
|
//高级查询
|
|
|
|
|
if (!(String.IsNullOrEmpty(companyId) || String.IsNullOrWhiteSpace(companyId)))
|
|
|
|
|
where.Append(" And companyID like '{%Value:''%" + companyId + "%''}'");//正则匹配
|
|
|
|
|
if (!(String.IsNullOrEmpty(feedbackId) || String.IsNullOrWhiteSpace(feedbackId)))
|
|
|
|
|
where.Append(string.Format(" And feedbackID like '%{0}%'", feedbackId));
|
|
|
|
|
if (!(String.IsNullOrEmpty(project) || String.IsNullOrWhiteSpace(project)))
|
|
|
|
|
where.Append(string.Format(" And project like '%{0}%'", project));
|
|
|
|
|
if (!(String.IsNullOrEmpty(proMaster) || String.IsNullOrWhiteSpace(proMaster)))
|
|
|
|
|
where.Append(string.Format(" And proMaster like '%{0}%'", proMaster));
|
|
|
|
|
if (!(String.IsNullOrEmpty(question) || String.IsNullOrWhiteSpace(question)))
|
|
|
|
|
where.Append(string.Format(" And question like '%{0}%'", question));
|
|
|
|
|
if (!String.IsNullOrEmpty(Request["beginDate_1"]))
|
|
|
|
|
where.Append(string.Format(" And beginDate >= '{0}'", Request["beginDate_1"] + " 00:00"));
|
|
|
|
|
if (!String.IsNullOrEmpty(Request["beginDate_2"]))
|
|
|
|
|
where.Append(string.Format(" And beginDate <= '{0}'", Request["beginDate_2"] + " 23:59"));
|
|
|
|
|
//单独查询 各类别数量
|
|
|
|
|
Dictionary<string, int> dict = new Dictionary<string, int>();
|
|
|
|
|
string[] arr = { "", "-1", "0", "1", "2", "3" };
|
|
|
|
|
for (int i = 0; i < arr.Length; i++)
|
|
|
|
|
dict.Add(i.ToString(), _bll.GetRecordCount(where + (arr[i] == "" ? "" : string.Format(" And status = {0}", arr[i]))));
|
|
|
|
|
if (!String.IsNullOrEmpty(status))
|
|
|
|
|
where.Append(string.Format(" And status = {0}", status));
|
|
|
|
|
var list = _bll.GetModelList(startIndex, limit, where.ToString(), String.Format("{0} {1}", sortName, sortOrder));
|
|
|
|
|
var count = _bll.GetRecordCount(where.ToString());//总数
|
|
|
|
|
|
|
|
|
|
return Json(new { total = count, groupTotal = dict, rows = list });
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 详细列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult GetDetailList(string parentId, string search)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder where = new StringBuilder();
|
|
|
|
|
where.Append(string.Format("isDelete = 0 And feedbackID='{0}'", parentId));
|
|
|
|
|
if (!(String.IsNullOrEmpty(search) || String.IsNullOrWhiteSpace(search)))
|
|
|
|
|
where.Append(string.Format(" And (replyMsg like '%{0}%' Or replyUser like '%{0}%')", search));
|
|
|
|
|
var list = _fbll.GetModelList(where.ToString());
|
|
|
|
|
return Json(new { total = list.Count, rows = list });
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存主实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult Save(Model.Feedback model)
|
|
|
|
|
{
|
|
|
|
|
bool result;
|
|
|
|
|
var nowDate = DateTime.Now;
|
|
|
|
|
var compObj = JsonConvert.DeserializeAnonymousType(model.companyID, new { Key = "", Value = "" });
|
|
|
|
|
if (model.id == 0)
|
|
|
|
|
{
|
|
|
|
|
int num = _bll.GetRecordCount("") + 1; //编号
|
|
|
|
|
model.feedbackID = "WH" + nowDate.ToString("yy") + num.ToString().PadLeft(6, '0');
|
|
|
|
|
model.createUser = Session["SHOWNAME"].ToString();
|
|
|
|
|
model.createDate = nowDate;
|
|
|
|
|
model.modifyUser = Session["SHOWNAME"].ToString();
|
|
|
|
|
model.modifyDate = nowDate;
|
|
|
|
|
model.isDelete = false;
|
|
|
|
|
if (model.status==null) model.status = 0;
|
|
|
|
|
model.COMPANY_NAME = compObj.Value;
|
|
|
|
|
result = _bll.Add(model) > 0;
|
|
|
|
|
} //新增
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//获取原数据
|
|
|
|
|
var oldModel = _bll.GetModel(model.id);
|
|
|
|
|
//类反射
|
|
|
|
|
Type type = typeof(Model.Feedback);
|
|
|
|
|
PropertyInfo[] piArr = type.GetProperties();
|
|
|
|
|
foreach (var pi in piArr)
|
|
|
|
|
{
|
|
|
|
|
if (Array.IndexOf(Request.Params.AllKeys, pi.Name) < 0)
|
|
|
|
|
pi.SetValue(model, pi.GetValue(oldModel, null), null);
|
|
|
|
|
}
|
|
|
|
|
model.modifyUser = Session["SHOWNAME"].ToString();
|
|
|
|
|
model.modifyDate = nowDate;
|
|
|
|
|
model.COMPANY_NAME = compObj.Value;
|
|
|
|
|
if (model.status == -1) //待接入的变为处理中
|
|
|
|
|
{
|
|
|
|
|
model.status = 0;
|
|
|
|
|
}
|
|
|
|
|
result = _bll.Update(model) > 0;
|
|
|
|
|
} //修改
|
|
|
|
|
|
|
|
|
|
//反写网站用户的客户简称
|
|
|
|
|
var wsUser = dsData.WebsiteUsers.FirstOrDefault(u => u.MOBILE == model.CUST_MOBILE);
|
|
|
|
|
if (wsUser != null && string.IsNullOrEmpty(wsUser.CUST_JSON))
|
|
|
|
|
{
|
|
|
|
|
wsUser.CUST_JSON = model.companyID;
|
|
|
|
|
wsUser.CUST_NAME = JsonConvert.DeserializeAnonymousType(wsUser.CUST_JSON, new { Key = "", Value = "" }).Value;
|
|
|
|
|
dsData.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//处理消息
|
|
|
|
|
if (dsData.FeedbackMessages.Count(f => f.Type == FeedbackMessage.FeedbackMessageTypeProcess && f.FeedbackId == model.feedbackID) == 0)
|
|
|
|
|
{
|
|
|
|
|
tSysEnumValueBLL tbll = new tSysEnumValueBLL();
|
|
|
|
|
var listTypes = tbll.GetModelList("EnumtypeID = 99990");
|
|
|
|
|
tSysEnumValue tp = null;
|
|
|
|
|
if (model.feedbackType.HasValue)
|
|
|
|
|
{
|
|
|
|
|
string strType = model.feedbackType.Value.ToString();
|
|
|
|
|
tp = listTypes.FirstOrDefault(t => t.EnumValueID == strType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FeedbackMessage feedbackMessage = new FeedbackMessage()
|
|
|
|
|
{
|
|
|
|
|
Type = FeedbackMessage.FeedbackMessageTypeProcess,
|
|
|
|
|
Title = "售后工程师:尊敬的用户您好,根据您的反馈,我们将问题类型定义如下:",
|
|
|
|
|
Body = $"问题类型:{(tp == null ? "" : tp.EnumValueName)}\r\n接下来,我们将对上述问题进行分析排查,请客户耐心等待,如下为处理过程:\r\n{model.PROCESS_RESULT}",
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
FeedbackId = model.feedbackID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (wsUser != null && !string.IsNullOrEmpty(wsUser.OPENID2))
|
|
|
|
|
{
|
|
|
|
|
List<Tuple<string, string, string>> valList = new List<Tuple<string, string, string>>();
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("first", "您的工单有最新进展:", "#FF0000"));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword1", model.feedbackID, ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword2", GetFeedbackQuestionType(model.feedbackType), ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword3", GetFeedbackStatus(model.status.Value), ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword4", model.proMaster, ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("remark", "详情请登录网站查看", ""));
|
|
|
|
|
string mess = string.Empty;
|
|
|
|
|
bool succ = false;
|
|
|
|
|
succ = TemplateMessageHelper.SendTemplateMessage(ConfigurationManager.AppSettings["DSServiceAppId"], "6vXDozXvYveyuRKwr16mH-4atzCWHhYaV2yDPMUaRpE", valList, wsUser.OPENID2, "", out mess);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dsData.FeedbackMessages.Add(feedbackMessage);
|
|
|
|
|
dsData.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Json(new { success = result, message = result ? "操作成功" : "操作失败" });
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存从实例
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult SaveDetail(Model.FeedbackInfo model)
|
|
|
|
|
{
|
|
|
|
|
bool result;
|
|
|
|
|
var nowDate = DateTime.Now;
|
|
|
|
|
if (model.id == 0)
|
|
|
|
|
{
|
|
|
|
|
model.replyUser = Session["SHOWNAME"].ToString();
|
|
|
|
|
model.replyUserID = Session["CODENAME"].ToString();
|
|
|
|
|
model.replyDate = nowDate;
|
|
|
|
|
model.isDelete = false;
|
|
|
|
|
result = _fbll.Add(model) > 0;
|
|
|
|
|
} //新增
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//获取原数据
|
|
|
|
|
var oldModel = _fbll.GetModel(model.id);
|
|
|
|
|
//类反射
|
|
|
|
|
Type type = typeof(Model.FeedbackInfo);
|
|
|
|
|
PropertyInfo[] piArr = type.GetProperties();
|
|
|
|
|
foreach (var pi in piArr)
|
|
|
|
|
{
|
|
|
|
|
if (Array.IndexOf(Request.Params.AllKeys, pi.Name) < 0)
|
|
|
|
|
pi.SetValue(model, pi.GetValue(oldModel, null), null);
|
|
|
|
|
}
|
|
|
|
|
model.replyUser = Session["SHOWNAME"].ToString();
|
|
|
|
|
model.replyUserID = Session["CODENAME"].ToString();
|
|
|
|
|
model.replyDate = nowDate;
|
|
|
|
|
|
|
|
|
|
result = _fbll.Update(model) > 0;
|
|
|
|
|
} //修改
|
|
|
|
|
return Json(new { success = result, message = result ? "操作成功" : "操作失败" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除主表(isDelete = 1)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult Delete(string ids)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
strSql.Append(string.Format("Update Feedback Set isDelete = 1 Where id in({0})", ids));
|
|
|
|
|
bool result = DbHelperSQL.ExecuteSql(strSql.ToString()) > 0;
|
|
|
|
|
return Json(new { success = result, message = result ? "操作成功" : "操作失败" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除子表(isDelete = 1)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult DeleteDetail(string ids)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
strSql.Append(string.Format("Update FeedbackInfo Set isDelete = 1 Where id in({0})", ids));
|
|
|
|
|
bool result = DbHelperSQL.ExecuteSql(strSql.ToString()) > 0;
|
|
|
|
|
return Json(new { success = result, message = result ? "操作成功" : "操作失败" });
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据客户gid获取关联信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="gid">客户gid</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult GetInfoClient(string gid)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder where = new StringBuilder();
|
|
|
|
|
where.Append(string.Format("LINKGID='{0}'", gid));
|
|
|
|
|
user_baseinfo dirModel = new user_baseinfo();
|
|
|
|
|
info_clientBLL ibll = new info_clientBLL();
|
|
|
|
|
var obj = ibll.GetModel(gid);
|
|
|
|
|
string dirMaster = obj == null ? "" : obj.DOC;//直属客服
|
|
|
|
|
if (!String.IsNullOrEmpty(dirMaster))
|
|
|
|
|
{
|
|
|
|
|
StringBuilder where1 = new StringBuilder();
|
|
|
|
|
where1.Append(string.Format("SHOWNAME='{0}'", dirMaster));
|
|
|
|
|
userBLL ubll = new userBLL();
|
|
|
|
|
user_baseinfoBLL ubbll = new user_baseinfoBLL();
|
|
|
|
|
var umodel = ubll.GetModelList(where1.ToString()).FirstOrDefault();
|
|
|
|
|
if (umodel != null)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder where2 = new StringBuilder();
|
|
|
|
|
where2.Append(string.Format("USERID='{0}'", umodel.GID));
|
|
|
|
|
dirModel = ubbll.GetModelList(where2.ToString()).FirstOrDefault() ?? new user_baseinfo();//客服信息
|
|
|
|
|
}
|
|
|
|
|
dirModel.USERID = dirMaster;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Json(new
|
|
|
|
|
{
|
|
|
|
|
actionType = obj == null ? "无匹配项" : obj.STLNAME,
|
|
|
|
|
dirModel,
|
|
|
|
|
proModel = dirModel
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据前端客户选择验收
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sFeedBackID">反馈ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult Checked(string sFeedBackID)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
strSql.Append(string.Format("update feedback set status = '3' where feedbackid ='" + sFeedBackID + "'"));
|
|
|
|
|
bool result = DbHelperSQL.ExecuteSql(strSql.ToString()) > 0;
|
|
|
|
|
|
|
|
|
|
var feedback = dsData.Feedbacks.AsNoTracking().FirstOrDefault(f => f.feedbackID == sFeedBackID);
|
|
|
|
|
tSysEnumValueBLL tbll = new tSysEnumValueBLL();
|
|
|
|
|
var listTypes = tbll.GetModelList("EnumtypeID = 99990");
|
|
|
|
|
tSysEnumValue tp = null;
|
|
|
|
|
if (feedback.feedbackType.HasValue)
|
|
|
|
|
{
|
|
|
|
|
string strType = feedback.feedbackType.Value.ToString();
|
|
|
|
|
tp = listTypes.FirstOrDefault(t => t.EnumValueID == strType);
|
|
|
|
|
}
|
|
|
|
|
FeedbackMessage feedbackMessage = new FeedbackMessage()
|
|
|
|
|
{
|
|
|
|
|
Type = FeedbackMessage.FeedbackMessageTypeFinish,
|
|
|
|
|
Title = $"售后工程师:尊敬的用户您好,上述问题“{(tp == null ? "" : tp.EnumValueName)}”已为您处理完成,请核实。",
|
|
|
|
|
Body = "",
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
FeedbackId = feedback.feedbackID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dsData.FeedbackMessages.Add(feedbackMessage);
|
|
|
|
|
dsData.SaveChanges();
|
|
|
|
|
|
|
|
|
|
WS_USER wsUser = dsData.WebsiteUsers.FirstOrDefault(u => u.MOBILE == feedback.CUST_MOBILE);
|
|
|
|
|
if (wsUser != null && !string.IsNullOrEmpty(wsUser.OPENID2))
|
|
|
|
|
{
|
|
|
|
|
List<Tuple<string, string, string>> valList = new List<Tuple<string, string, string>>();
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("first", "您的工单有最新进展:", "#FF0000"));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword1", feedback.feedbackID, ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword2", GetFeedbackQuestionType(feedback.feedbackType), ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword3", GetFeedbackStatus(feedback.status.Value), ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword4", feedback.proMaster, ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("remark", "详情请登录网站查看", ""));
|
|
|
|
|
string mess = string.Empty;
|
|
|
|
|
bool succ = false;
|
|
|
|
|
succ = TemplateMessageHelper.SendTemplateMessage(ConfigurationManager.AppSettings["DSServiceAppId"], "6vXDozXvYveyuRKwr16mH-4atzCWHhYaV2yDPMUaRpE", valList, wsUser.OPENID2, "", out mess);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Json(new { success = result, message = result ? "验收成功" : "验收失败" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工单接入
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sFeedBackID">反馈ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult Accept(string sFeedBackID)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//StringBuilder strSql = new StringBuilder();
|
|
|
|
|
//strSql.Append(string.Format("update feedback set status = '0',ACCEPT_TIME=getdate() where feedbackid ='" + sFeedBackID + "'"));
|
|
|
|
|
//bool result = DbHelperSQL.ExecuteSql(strSql.ToString()) > 0;
|
|
|
|
|
|
|
|
|
|
var feedback = dsData.Feedbacks.FirstOrDefault(f => f.feedbackID == sFeedBackID);
|
|
|
|
|
feedback.status = 0;
|
|
|
|
|
FeedbackMessage feedbackMessage = new FeedbackMessage()
|
|
|
|
|
{
|
|
|
|
|
Type = FeedbackMessage.FeedbackMessageTypeAccept,
|
|
|
|
|
Title = "售后工程师:您好,我们已经收到您提交的问题,正在为您查看,请稍等",
|
|
|
|
|
Body = "",
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
FeedbackId = sFeedBackID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dsData.FeedbackMessages.Add(feedbackMessage);
|
|
|
|
|
dsData.SaveChanges();
|
|
|
|
|
|
|
|
|
|
WS_USER wsUser = dsData.WebsiteUsers.FirstOrDefault(u => u.MOBILE == feedback.CUST_MOBILE);
|
|
|
|
|
if (wsUser != null && !string.IsNullOrEmpty(wsUser.OPENID2))
|
|
|
|
|
{
|
|
|
|
|
List<Tuple<string, string, string>> valList = new List<Tuple<string, string, string>>();
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("first", "您的工单有最新进展:", "#FF0000"));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword1", feedback.feedbackID, ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword2", GetFeedbackQuestionType(feedback.feedbackType), ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword3", GetFeedbackStatus(feedback.status.Value), ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("keyword4", feedback.proMaster, ""));
|
|
|
|
|
valList.Add(new Tuple<string, string, string>("remark", "详情请登录网站查看", ""));
|
|
|
|
|
string mess = string.Empty;
|
|
|
|
|
bool succ = false;
|
|
|
|
|
succ = TemplateMessageHelper.SendTemplateMessage(ConfigurationManager.AppSettings["DSServiceAppId"], "6vXDozXvYveyuRKwr16mH-4atzCWHhYaV2yDPMUaRpE", valList, wsUser.OPENID2, "", out mess);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Json(new { success = true, message = "接入成功" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetFeedbackStatus(int status)
|
|
|
|
|
{
|
|
|
|
|
switch (status)
|
|
|
|
|
{
|
|
|
|
|
case -1:
|
|
|
|
|
return "待接入";
|
|
|
|
|
case 0:
|
|
|
|
|
return "处理中";
|
|
|
|
|
case 1:
|
|
|
|
|
return "待验收";
|
|
|
|
|
case 2:
|
|
|
|
|
return "客户取消";
|
|
|
|
|
case 3:
|
|
|
|
|
return "已验收";
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetFeedbackQuestionType(int? type)
|
|
|
|
|
{
|
|
|
|
|
if (!type.HasValue)
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tSysEnumValueBLL tbll = new tSysEnumValueBLL();
|
|
|
|
|
var list = tbll.GetModelList($"EnumtypeID = 99990 and enumvalueid={type.Value}");
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return list[0].EnumValueName;
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 追加问题
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult GetFeedbackSubList(string feedbackId)
|
|
|
|
|
{
|
|
|
|
|
var list = dsData.FeedbackSubs.Where(s => s.feedbackID == feedbackId).ToList();
|
|
|
|
|
return Json(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult SaveFeedbackSub(FeedbackSubSaveModel model)
|
|
|
|
|
{
|
|
|
|
|
FeedbackSub feedbackSub = new FeedbackSub()
|
|
|
|
|
{
|
|
|
|
|
feedbackID = model.feedbackID,
|
|
|
|
|
description = model.description,
|
|
|
|
|
attachMent = model.attachMent,
|
|
|
|
|
createDate = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
dsData.FeedbackSubs.Add(feedbackSub);
|
|
|
|
|
dsData.SaveChanges();
|
|
|
|
|
return Json(new { success = true, message = "保存成功" });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 网站用户绑定公司
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ActionResult WSUserList()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult WSUserData(string keyword, int offset, int limit)
|
|
|
|
|
{
|
|
|
|
|
var query = dsData.WebsiteUsers.AsNoTracking().Where(u => true);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(keyword))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(u => u.NAME.IndexOf(keyword) > -1 || u.COMPANY_NAME.IndexOf(keyword) > -1);
|
|
|
|
|
}
|
|
|
|
|
int count = query.Count();
|
|
|
|
|
var list = query.OrderByDescending(u => u.CREATE_TIME).Skip(offset).Take(limit).ToList();
|
|
|
|
|
|
|
|
|
|
return Json(new { Total = count, Data = list });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ActionResult BindCompany(string uid, string cid)
|
|
|
|
|
{
|
|
|
|
|
var user = dsData.WebsiteUsers.FirstOrDefault(u => u.GID == uid);
|
|
|
|
|
var infoClient = dsData.InfoClients.FirstOrDefault(c => c.GID == cid);
|
|
|
|
|
user.CUST_JSON = JsonConvert.SerializeObject(new { Key = infoClient.GID, Value = infoClient.SHORTNAME });
|
|
|
|
|
user.CUST_NAME = infoClient.SHORTNAME;
|
|
|
|
|
dsData.SaveChanges();
|
|
|
|
|
|
|
|
|
|
return Json(new { Success = true, Message = "操作成功" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public ActionResult GetBindCompanyList(string keyword)
|
|
|
|
|
{
|
|
|
|
|
var query = dsData.InfoClients.AsNoTracking().Where(c => true);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(keyword))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(c => c.CODENAME.IndexOf(keyword) > -1 || c.SHORTNAME.IndexOf(keyword) > -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = query.ToList().Select(c => new
|
|
|
|
|
{
|
|
|
|
|
c.GID,
|
|
|
|
|
c.CODENAME,
|
|
|
|
|
c.SHORTNAME
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Json(new { value = list }, JsonRequestBehavior.AllowGet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|