619 lines
25 KiB
C#
619 lines
25 KiB
C#
using Newtonsoft.Json;
|
||
using Ninject;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.Mvc;
|
||
using WX.CRM.BLL.Base;
|
||
using WX.CRM.BLL.Util;
|
||
using WX.CRM.Common;
|
||
using WX.CRM.IBLL.Base;
|
||
using WX.CRM.IBLL.Csvr;
|
||
using WX.CRM.IBLL.Util;
|
||
using WX.CRM.IBLL.weapp;
|
||
using WX.CRM.IBLL.Wx;
|
||
using WX.CRM.Model.Entity;
|
||
using WX.CRM.Model.Enum;
|
||
using WX.CRM.Model.MAP;
|
||
using WX.CRM.Model.QueryMap;
|
||
using WX.CRM.WebHelper;
|
||
|
||
namespace WX.CRM.WEB.Controllers
|
||
{
|
||
public class HomeController : BaseController
|
||
{
|
||
private IBAS_LEFTMEMU leftMemuBiz;
|
||
private IBAS_LEFTMEMU_Q leftMemuBiz_Q;
|
||
private IBAS_MODULEMENU moduleMenuBiz;
|
||
private IBAS_MODULEMENU_Q moduleMenuBiz_Q;
|
||
private IBAS_DAILYMEMU_Q dailymemu_Q;
|
||
private ICACHE_Q cache_Q;
|
||
private readonly IWX_RCONTACT _rcontact;
|
||
private readonly IWX_RESOURCECHECK_NOTE _resourcecheckNote;
|
||
|
||
[Inject]
|
||
public IBAS_PARAMETER_Q BAS_PARAMETER_BL { get; set; }
|
||
[Inject]
|
||
public ICSVR_CALLRECORD_Q _CSVR_CALLRECORD_Q { get; set; }
|
||
|
||
|
||
[Inject]
|
||
public IWX_WORKACCOUNT wx_WorkAccount_BL { get; set; }
|
||
|
||
[Inject]
|
||
public IBAS_NOTICE bas_Notice_BL { get; set; }
|
||
|
||
[Inject]
|
||
public IWX_UserInfo weappUserInfo { get; set; }
|
||
|
||
public HomeController(IBAS_LEFTMEMU _leftMemuBiz, IBAS_LEFTMEMU_Q _leftMemuBiz_Q, IBAS_MODULEMENU _moduleMenuBiz, IBAS_MODULEMENU_Q _moduleMenuBiz_Q, IBAS_DAILYMEMU_Q _dailymemu_Q, ICACHE_Q _cache_Q, IWX_RCONTACT rcontact, IWX_RESOURCECHECK_NOTE resourcecheckNote)
|
||
{
|
||
this.leftMemuBiz = _leftMemuBiz;
|
||
this.leftMemuBiz_Q = _leftMemuBiz_Q;
|
||
this.moduleMenuBiz = _moduleMenuBiz;
|
||
this.moduleMenuBiz_Q = _moduleMenuBiz_Q;
|
||
this.dailymemu_Q = _dailymemu_Q;
|
||
this.cache_Q = _cache_Q;
|
||
_rcontact = rcontact;
|
||
_resourcecheckNote = resourcecheckNote;
|
||
}
|
||
|
||
[Authorize]
|
||
public ActionResult Index()
|
||
{
|
||
//return Redirect("/Level2/Leve2Order/CheckLevel2OrderList");
|
||
List<WX.CRM.Model.Entity.BAS_MODULEMENU> modelist = new List<WX.CRM.Model.Entity.BAS_MODULEMENU>();
|
||
string[] rightid = userRightId;
|
||
decimal modulId = 0;
|
||
string title = "";
|
||
if (rightid != null)
|
||
{
|
||
modelist = DataCacheHelper.GetCache().GetList_ModuleMenu();// moduleMenuBiz_Q.GeList_ModuleMenu();//获取一级菜单
|
||
modelist = modelist.Where(p => rightid.Contains(p.RIGHTID)).ToList();
|
||
if (modelist.Count == 0)
|
||
{
|
||
modelist = new List<WX.CRM.Model.Entity.BAS_MODULEMENU>();
|
||
}
|
||
else
|
||
{
|
||
modulId = modelist[0].MODULEMENUID;
|
||
title = modelist[0].MNAME;
|
||
}
|
||
}
|
||
ViewBag.MainMenu = modelist;
|
||
SetMainChildMenu(modelist);
|
||
ViewBag.ChooseID = modulId;
|
||
ViewBag.Title = title;
|
||
ViewBag.Eid = Eid;
|
||
ViewBag.Name = UserName;
|
||
var cti = _CSVR_CALLRECORD_Q.Sys_Environment_CTI_VER();
|
||
if (null != cti)
|
||
{
|
||
ViewBag.CTI_VER = Convert.ToInt32(cti);
|
||
}
|
||
ViewBag.CtiInterface = Utility.GetSettingByKey("shj");
|
||
ViewBag.isMiniCustomerInfo = cache_Q.GetValue_Parameter(Model.Enum.Parameter.Sys_IsMiniCustomerInfo);
|
||
ViewBag.Fjh = FJH;
|
||
string IsFreeze_wdzm = cache_Q.GetValue_Parameter(WX.CRM.Model.Enum.Parameter.Sys_IsFreeze_Wdzm);//参数中获取是否冻结我的桌面
|
||
ViewBag.IsFreeze_wdzm = string.IsNullOrEmpty(IsFreeze_wdzm) ? "false" : IsFreeze_wdzm;//默认不冻结
|
||
var setting = new CACHE_BL().GetValue_Parameter("CrmCompanySetting");
|
||
if (!string.IsNullOrWhiteSpace(setting))
|
||
{
|
||
var signConfig = JsonConvert.DeserializeObject<CrmCompanySetting>(setting);
|
||
ViewBag.CompanyName = signConfig.CompanyName;
|
||
}
|
||
ViewBag.MainMenu = modelist;
|
||
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
||
if (roleCodes.IndexOf("[GLY]") > -1 || roleCodes.IndexOf("[ZJ]") > -1 || roleCodes.IndexOf("[ZJZL]") > -1 || roleCodes.IndexOf("[GJSGJKF]") > -1 || roleCodes.IndexOf("[GJSKFJL]") > -1 || roleCodes.IndexOf("[ZJZG]") > -1 || roleCodes.IndexOf("[BMZG]") > -1)
|
||
{
|
||
ViewBag.IsAdmin = true;
|
||
}
|
||
else
|
||
{
|
||
ViewBag.IsAdmin = false;
|
||
}
|
||
//--电话自动接听助理
|
||
string rolecode = "[DHZDJTZL";
|
||
int zdindex = roleCodes.IndexOf(rolecode);
|
||
if (zdindex > -1)
|
||
{
|
||
string confignum = roleCodes.Substring(zdindex + rolecode.Length, 2);
|
||
BAS_PARAMETER nm = BAS_PARAMETER_BL.GetModel_Patameter("Sys_AutoDialNum" + confignum);
|
||
string autodialnum = nm != null ? nm.PARAVALUE : "";
|
||
var _num_encypt = BAS_PARAMETER_BL.GetModel_Patameter("SYS_CALLOUT_NUM_ENCYPTDES");
|
||
var _bol_encypt = false;
|
||
if (_num_encypt != null && _num_encypt.PARAVALUE.ToLower() == "true")
|
||
{
|
||
_bol_encypt = true;
|
||
}
|
||
if (_bol_encypt)
|
||
{
|
||
SecurityHelper sHelper = new SecurityHelper();
|
||
ViewBag.Sys_AutoDialNum = sHelper.encyptCtiNumStr(autodialnum.Trim());
|
||
}
|
||
else
|
||
{
|
||
ViewBag.Sys_AutoDialNum = autodialnum.Trim();
|
||
}
|
||
|
||
ViewBag.IsZdjt = true;
|
||
}
|
||
else
|
||
{
|
||
ViewBag.IsZdjt = false;
|
||
}
|
||
int isWXAccountKF = 0;
|
||
if (roleCodes.IndexOf("[GZHLS]") > -1)
|
||
isWXAccountKF = 1;
|
||
ViewBag.isWXAccountKF = isWXAccountKF;
|
||
//ViewBag.IsAdmin = DataCacheHelper.GetCache().GetList_Role().Exists(model => userRoleId.Contains(model.ROLEID) && userRoleNames.Contains(model.RNAME));
|
||
ViewBag.Logo = BAS_PARAMETER_BL.GetModel_Patameter("Sys_Logo").PARAVALUE;
|
||
ViewBag.isBC = BAS_PARAMETER_BL.GetModel_Patameter("Sys_Environment_DeptCode").PARAVALUE == Sys_Environment_DeptCode.BCCF01.ToString();//
|
||
|
||
WX.CRM.Model.Entity.BAS_PARAMETER parameter = BAS_PARAMETER_BL.GetModel_Patameter("Sys_Environment_IsLiteHead");
|
||
string isLiteHeadParameter = parameter == null ? "false" : parameter.PARAVALUE;
|
||
ViewBag.isLiteHeadParameter = isLiteHeadParameter;
|
||
if (Request.Cookies["Sys_Environment_IsLiteHead"] != null)//如果cookie有数据就从cookie读取,没有就从配置表读取默认的是否显示为精简版
|
||
{
|
||
string IsLiteHeadCookie = Request.Cookies["Sys_Environment_IsLiteHead"].Value;
|
||
if (IsLiteHeadCookie != "true" && IsLiteHeadCookie != "false")
|
||
IsLiteHeadCookie = "false";
|
||
ViewBag.IsLiteHead = IsLiteHeadCookie;
|
||
}
|
||
else
|
||
{
|
||
ViewBag.IsLiteHead = isLiteHeadParameter;
|
||
}
|
||
Dictionary<string, string> waeppAccount = new Dictionary<string, string>();
|
||
try
|
||
{
|
||
DataTable table = weappUserInfo.GetUserAccount(Eid);
|
||
|
||
if (table != null && table.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in table.Rows)
|
||
{
|
||
string accountNum = item["accountnum"].ToString();
|
||
string accountName = item["accountname"].ToString();
|
||
if (!waeppAccount.ContainsKey(accountNum))
|
||
{
|
||
waeppAccount.Add(accountNum, accountName);
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
catch (Exception ex) { LogHelper.Error(ex.ToString()); }
|
||
BAS_PARAMETER webchatassistant = BAS_PARAMETER_BL.GetModel_Patameter("WeiXin_WebChatAssistant");
|
||
if (webchatassistant != null && webchatassistant.PARAVALUE == "show")
|
||
{
|
||
ViewBag.WeiXin_WebChatAssistant = "true";
|
||
}
|
||
else
|
||
{
|
||
ViewBag.WeiXin_WebChatAssistant = "false";
|
||
}
|
||
|
||
|
||
ViewBag.WaeppAccount = waeppAccount;
|
||
|
||
|
||
ViewBag.companycode = companyCode;
|
||
ViewBag.Userid = UserId;
|
||
|
||
var webapi = cache_Q.GetValue_Parameter(Parameter.CRM_CORE_WEBAPI);
|
||
ViewBag.webapi = webapi;
|
||
var appid = System.Configuration.ConfigurationManager.AppSettings["appid"];
|
||
ViewBag.appid = appid;
|
||
|
||
ViewBag.User = new
|
||
{
|
||
Eid = Eid,
|
||
UserId = UserId,
|
||
UserName = UserName,
|
||
Appid = appid,
|
||
url = webapi + "/hub",
|
||
Ip = Utility.GetIp(),
|
||
Freelogin = !string.IsNullOrEmpty(Request.QueryString["freelogin"])
|
||
}.ToJson();
|
||
|
||
return View();
|
||
}
|
||
|
||
public void SetMainChildMenu(List<BAS_MODULEMENU> modelist)
|
||
{
|
||
List<object> list = new List<object>();
|
||
string[] getrightid = userRightId;
|
||
foreach (var item in modelist)
|
||
{
|
||
list.Add(new { ModuleId = item.MODULEMENUID, Data = leftMemuBiz_Q.GetRree_leftMenuByModuleId(item.MODULEMENUID, getrightid) });
|
||
}
|
||
|
||
ViewBag.AllMenuList = Newtonsoft.Json.JsonConvert.SerializeObject(list);
|
||
}
|
||
/// <summary>
|
||
/// 详细地址
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public ActionResult Module(decimal moduleId)
|
||
{
|
||
string[] getrightid = userRightId;
|
||
var modelist = leftMemuBiz_Q.GetRree_leftMenuByModuleId(moduleId, getrightid);
|
||
//BAS_LEFTMEMU leftmemu = leftMemuBiz_Q.GetDefaultMenu(moduleId, getrightid);
|
||
//ViewBag.DefaultMenu = leftmemu;
|
||
ViewBag.LeftMenu = Newtonsoft.Json.JsonConvert.SerializeObject(modelist);
|
||
string companycode = "";
|
||
if (userRoleCodes.IndexOf("[GLY]") == -1)
|
||
companycode = companyCode;
|
||
ViewBag.companyCode = companycode;
|
||
return View();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 风控
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public ActionResult FengKun()
|
||
{
|
||
return View();
|
||
}
|
||
public ActionResult Switchlayouts(string IsLiteHead)
|
||
{
|
||
HttpCookie aCookie = new HttpCookie("Sys_Environment_IsLiteHead");
|
||
aCookie.Value = IsLiteHead;
|
||
aCookie.Expires = DateTime.Now.AddDays(1);
|
||
Response.Cookies.Add(aCookie);
|
||
return this.RedirectToAction("Index", "Home");
|
||
}
|
||
public ActionResult YouHaveRight()
|
||
{
|
||
return View();
|
||
}
|
||
|
||
public ActionResult WelCome()
|
||
{
|
||
List<WX.CRM.Model.Entity.BAS_DAILYMEMU> memuList = dailymemu_Q.GetList(UserId);
|
||
//List<WX.CRM.Model.Entity.CSVR_MSGOPENACCOUNT> ms = cache_Q.GetNewOpenAccountList(UserId);
|
||
List<WX_WORKACCOUNT_ALIVE> workAccountList = getWxWorkAccountAliveList("nocache");
|
||
//List<WX.CRM.Model.Entity.CSVR_TODAYRECORD> callInLog = cache_Q.GetCallLogList(Eid);
|
||
Pager pager = new Pager() { page = 1, rows = 10 };
|
||
List<WX.CRM.Model.Entity.BAS_NOTICE> noticeList = bas_Notice_BL.GetList(ref pager, "", "", "");
|
||
|
||
var roleCode = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
||
ViewBag.roleCode = roleCode;
|
||
Table tab3 = new Table("tablist3");
|
||
tab3.AddHeadCol("eid", "80px", "员工");
|
||
tab3.AddHeadCol("InneruserId", "40px", "组别");
|
||
tab3.AddHiddenHeadCol("jobusername", "工作微信号ID");
|
||
tab3.AddHeadCol("alias", "", "工作微信号");
|
||
tab3.AddHeadCol("username", "", "客户用户ID");
|
||
tab3.AddHeadCol("nickname", "", "昵称");
|
||
tab3.AddHeadCol("remark", "", "备注");
|
||
tab3.AddHeadRow();
|
||
ViewBag.table3 = tab3.GetTable();
|
||
|
||
ViewBag.memuList = memuList;
|
||
//ViewBag.msgOpenAccount = ms;
|
||
//ViewBag.callInLog = callInLog;
|
||
ViewBag.wxWorkAccount = workAccountList;
|
||
ViewBag.noticeList = noticeList;
|
||
//ViewBag.wxResourceCheck = wxResourceCheck;
|
||
ViewBag.HideCommonPayInfo = cache_Q.GetValue_Parameter("CRM:HideCommonPayInfo");
|
||
ViewBag.HideCommonPayInfo2 = cache_Q.GetValue_Parameter("CRM:HideCommonPayInfo2");
|
||
ViewBag.HideCommonPayInfo3 = cache_Q.GetValue_Parameter("CRM:HideCommonPayInfo3");
|
||
return View();
|
||
}
|
||
|
||
private List<WX_WORKACCOUNT_ALIVE> getWxWorkAccountAliveList(string type)
|
||
{
|
||
List<WX_WORKACCOUNT_ALIVE> list = new List<WX_WORKACCOUNT_ALIVE>();
|
||
if (type == "nocahe")
|
||
{
|
||
wx_WorkAccount_BL.GetAliveList(null);
|
||
}
|
||
else
|
||
{
|
||
list = getAliveList();
|
||
}
|
||
|
||
return list.Where(m => m.InnerUserId == UserId).ToList();
|
||
}
|
||
private List<WX_WORKACCOUNT_ALIVE> getAliveList()
|
||
{
|
||
var cacheKey = "cache_WxAlive";
|
||
if (CacheHelper.Exists(cacheKey))
|
||
{
|
||
return CacheHelper.Get<List<WX_WORKACCOUNT_ALIVE>>(cacheKey);
|
||
}
|
||
List<WX_WORKACCOUNT_ALIVE> list = wx_WorkAccount_BL.GetAliveList(null);
|
||
if (list != null)
|
||
{
|
||
CacheHelper.Set<List<WX_WORKACCOUNT_ALIVE>>(cacheKey, list, DateTime.Now.AddMinutes(1));
|
||
}
|
||
return list;
|
||
}
|
||
|
||
|
||
public JsonResult GetCallInLogList()
|
||
{
|
||
List<WX.CRM.Model.Entity.CSVR_CALLINLOG> log = cache_Q.GetCallInLogList(Eid);
|
||
Table table = new Table(",,,,", true);
|
||
foreach (WX.CRM.Model.Entity.CSVR_CALLINLOG model in log)
|
||
{
|
||
table.AddCol(model.RESID);
|
||
table.AddCol(model.CALLEDNUMBER);
|
||
table.AddCol(model.CTIME.ToUnityString(1));
|
||
table.AddCol("<img title='" + (model.CALLSTATE == 1 ? "呼出" : "呼入") + "' src='/Content/Images/icon/" + (model.CALLSTATE == 1 ? "callout.png" : "callin.png") + "' />");
|
||
table.AddCol("<a href=\"javascript:ShowResDetial('/Csvr/CustomerInfo/CustomerDetail?resid=" + model.RESID + "')\">查看</a>");
|
||
table.AddRow();
|
||
}
|
||
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
public JsonResult GetWorkAccountList(string type)
|
||
{
|
||
List<WX_WORKACCOUNT_ALIVE> list = getWxWorkAccountAliveList(type);
|
||
Table table = new Table(",,,,", true);
|
||
foreach (WX_WORKACCOUNT_ALIVE model in list)
|
||
{
|
||
table.AddCol(model.UserName);
|
||
table.AddCol(model.Alias);
|
||
table.AddCol(model.NickName);
|
||
string str = string.Empty;
|
||
if (model.OnLine == 1 && !string.IsNullOrEmpty(model.Uin) && model.Uin != "0")
|
||
str = "<font style=\"color:blue\">在线</span>";
|
||
else if (model.OnLine == 0)
|
||
str = "<font style=\"color:#AAAAAA\">离线</span>";
|
||
else
|
||
str = "<font style=\"color:red\">微信离线</span>";
|
||
//微信状态不可用,并且不在线的情况显示
|
||
table.AddCol(str);
|
||
table.AddCol(model.LastTime);
|
||
table.AddRow();
|
||
}
|
||
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
public JsonResult GetNewAccountList()
|
||
{
|
||
List<WX.CRM.Model.Entity.CSVR_MSGOPENACCOUNT> ms = cache_Q.GetNewOpenAccountList(UserId);
|
||
Table table = new Table(",,,", true);
|
||
foreach (WX.CRM.Model.Entity.CSVR_MSGOPENACCOUNT model in ms)
|
||
{
|
||
table.AddCol(model.RESID);
|
||
table.AddCol(model.CTIME.ToUnityString(1));
|
||
table.AddCol("<img src='/Content/Images/icon/" + (model.ISVIEWED == 1 ? "emopen.gif" : "email.gif") + "' />");
|
||
table.AddCol("<a href=\"javascript:ShowResDetial('/Csvr/MsgOpenAccount/RedirectToCustomerDetial?resid=" + model.RESID + "&isView=" + model.ISVIEWED + "')\">查看</a>");
|
||
table.AddRow();
|
||
}
|
||
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
public JsonResult GetNoticeList()
|
||
{
|
||
Pager pager = new Pager() { page = 1, rows = 10 };
|
||
List<WX.CRM.Model.Entity.BAS_NOTICE> noticeList = bas_Notice_BL.GetList(ref pager, "", "", "");
|
||
Table table = new Table(",,,", true);
|
||
foreach (WX.CRM.Model.Entity.BAS_NOTICE model in noticeList)
|
||
{
|
||
table.AddCol(model.TITLE);
|
||
table.AddCol(model.CTIME);
|
||
table.AddCol(string.Format("<a href = \"javascript:window.parent.ChildAddTab('公告详情', '/Content/NoticeDetail.html?id={0}', '');\" > 查看 </a>", model.PKID));
|
||
table.AddRow();
|
||
}
|
||
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取导航菜单
|
||
/// </summary>
|
||
/// <param name="id">所属</param>
|
||
/// <returns>树</returns>
|
||
public JsonResult GetTree(string id)
|
||
{
|
||
decimal fid = -1;
|
||
if (!string.IsNullOrWhiteSpace(id))
|
||
fid = Convert.ToDecimal(id);
|
||
string[] getrightid = userRightId;
|
||
var modelist = leftMemuBiz_Q.GetTree_leftMenu(fid, getrightid);
|
||
return Json(modelist, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 根据moduleId获取导航菜单
|
||
/// </summary>
|
||
/// <param name="id">所属</param>
|
||
/// <returns>树</returns>
|
||
public JsonResult GetTreeByModuleId(string id)
|
||
{
|
||
decimal fid = -1;
|
||
if (!string.IsNullOrWhiteSpace(id))
|
||
fid = Convert.ToDecimal(id);
|
||
string[] getrightid = userRightId;
|
||
var modelist = leftMemuBiz_Q.GetRree_leftMenuByModuleId(fid, getrightid);
|
||
return Json(modelist, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
/// <summary>s
|
||
/// 获取第一级树形,根据 moduleMenuId 查找
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
public JsonResult GetTopTree(string id)
|
||
{
|
||
decimal moduleMenuId = -1;
|
||
if (!string.IsNullOrWhiteSpace(id))
|
||
moduleMenuId = Convert.ToDecimal(id);
|
||
return Json(leftMemuBiz_Q.GetTopTree_leftMenu(moduleMenuId), JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
public JsonResult GetRecourceCheck(string columns)
|
||
{
|
||
var table = new Table(columns, true);
|
||
decimal? groupId = null;
|
||
decimal? userId = null;
|
||
var roleCode = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
||
if (!(roleCode.Contains("[GLY]") || roleCode.Contains("[ZJZL]") || roleCode.Contains("[ZJ]")))
|
||
{
|
||
if (roleCode.Contains("[GJSGJKF]"))
|
||
{
|
||
groupId = userGroupId;
|
||
}
|
||
else
|
||
{
|
||
userId = UserId;
|
||
}
|
||
}
|
||
var wxResourceCheck = _rcontact.GetWxResourceCheck(groupId, userId);
|
||
string isShowMobileOfContent = cache_Q.GetValue_Parameter(Model.Enum.Parameter.Sys_IsShowMobileOfContent);
|
||
foreach (var item in wxResourceCheck)
|
||
{
|
||
table.AddCol(InnerUserHelper.Instance.GetEidAndTrueName(item.Eid));
|
||
table.AddCol(InnerUserHelper.Instance.GetGroupName(InnerUserHelper.Instance.GetGroupId(item.Eid)));
|
||
table.AddHiddenCol(item.JobUserName);
|
||
table.AddCol(item.alias);
|
||
table.AddCol(item.UserName);
|
||
if (!string.IsNullOrEmpty(isShowMobileOfContent) && isShowMobileOfContent == "1")
|
||
{
|
||
table.AddCol(item.NickName);
|
||
table.AddCol(item.ReMark);
|
||
}
|
||
else
|
||
{
|
||
table.AddCol(Utility.ReplaceMobile(item.NickName));
|
||
table.AddCol(Utility.ReplaceMobile(item.ReMark));
|
||
}
|
||
|
||
table.AddRow();
|
||
}
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
public JsonResult SaveRecourceCheck(decimal eid, string username, string jobusername)
|
||
{
|
||
if (eid <= 0 || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(jobusername))
|
||
{
|
||
return JsonHandler.ManageMessage("参数错误!", false);
|
||
}
|
||
try
|
||
{
|
||
var roleCode = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
||
if (!(roleCode.Contains("[GLY]") || roleCode.Contains("[ZJZL]") || roleCode.Contains("[ZJ]") || roleCode.Contains("[GJSGJKF]")))
|
||
{
|
||
return JsonHandler.ManageMessage("您没有权限执行该操作,请确认!", false);
|
||
}
|
||
var info = new WX_RESOURCECHECK_NOTE()
|
||
{
|
||
PKID = new SEQUENCES_BL().Seq_base_get(),
|
||
USERNAME = username,
|
||
JOBUSERNAME = jobusername,
|
||
CTIME = DateTime.Now,
|
||
EID = eid
|
||
};
|
||
_resourcecheckNote.Add(info);
|
||
return Json(new { msg = "ok" }, JsonRequestBehavior.AllowGet);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Error(ex.ToString());
|
||
return Json(new { msg = "err" }, JsonRequestBehavior.AllowGet);
|
||
}
|
||
}
|
||
|
||
public FileResult Export()
|
||
{
|
||
string checkedFilds = PageRequest.GetQueryString("checkedFilds");
|
||
checkedFilds = checkedFilds.Replace("[]", "");
|
||
string checkedTitles = PageRequest.GetQueryString("checkedTitles");
|
||
Pager pager = new Pager() { page = 1, rows = int.MaxValue };
|
||
|
||
decimal? groupId = null;
|
||
decimal? userId = null;
|
||
var roleCode = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
||
if (!(roleCode.Contains("[GLY]") || roleCode.Contains("[ZJZL]") || roleCode.Contains("[ZJ]")))
|
||
{
|
||
if (roleCode.Contains("[GJSGJKF]"))
|
||
{
|
||
groupId = userGroupId;
|
||
}
|
||
else
|
||
{
|
||
userId = UserId;
|
||
}
|
||
}
|
||
var wxResourceCheck = _rcontact.GetWxResourceCheck(groupId, userId);
|
||
|
||
return File(ExcelHelper.ExportListModelToExcel<WxResourceCheckView>(wxResourceCheck.ToList(), "重复进入的已成交资源", 10000, checkedFilds, checkedTitles, DataFormart), "application/ms-excel", PageRequest.GetDlownLoadName("重复进入的已成交资源.xls"));
|
||
}
|
||
|
||
//用作委托传递
|
||
public string DataFormart(string key, object value)
|
||
{
|
||
string formartValue = string.Empty;
|
||
switch (key)
|
||
{
|
||
case "Eid":
|
||
formartValue = value != null ? InnerUserHelper.Instance.GetEidAndTrueName(Convert.ToDecimal(value)) : ""; break;
|
||
case "InneruserId":
|
||
formartValue = value != null ? InnerUserHelper.Instance.GetGroupName(InnerUserHelper.Instance.GetGroupId(Convert.ToDecimal(value))) : ""; break;
|
||
default: formartValue = string.Format("{0}", value); break;
|
||
}
|
||
return formartValue;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 小程序聊天
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public ViewResult AppletChat()
|
||
{
|
||
|
||
ViewBag.eid = Eid;
|
||
ViewBag.name = UserName;
|
||
ViewBag.deptName = "售后部";
|
||
ViewBag.deptid = deptId;
|
||
return View();
|
||
}
|
||
}
|
||
public class CrmCompanySetting
|
||
{
|
||
public string CompanyName { get; set; }
|
||
public List<PayInfo> PayInfo { get; set; }
|
||
}
|
||
public class PayInfo
|
||
{
|
||
public string CH { get; set; }
|
||
public string ZFBUrl { get; set; }
|
||
public string WXUrl { get; set; }
|
||
}
|
||
}
|
||
|