1495 lines
67 KiB
C#
1495 lines
67 KiB
C#
using Ninject;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web.Mvc;
|
||
using WX.CRM.BLL.Base;
|
||
using WX.CRM.BLL.Util;
|
||
using WX.CRM.BLL.Wx;
|
||
using WX.CRM.Common;
|
||
using WX.CRM.IBLL.Base;
|
||
using WX.CRM.IBLL.Wx;
|
||
using WX.CRM.Model.Entity;
|
||
using WX.CRM.Model.MAP;
|
||
using WX.CRM.WEB.Handler;
|
||
using WX.CRM.WebHelper;
|
||
|
||
namespace WX.CRM.WEB.Controllers.Res
|
||
{
|
||
public class WXController : BaseController
|
||
{
|
||
ValidationErrors errors = new ValidationErrors();
|
||
|
||
private IWX_GROUPPERCENT wx_GroupPercent_BL { get; set; }
|
||
|
||
private IWX_RCONTACT wx_Rcontack_BL { get; set; }
|
||
|
||
[Inject]
|
||
public IWX_USERPERCENT wx_UserPercent_BL { get; set; }
|
||
|
||
|
||
[Inject]
|
||
public IWX_SETPERCENTLOG wx_SetPercentLog_BL { get; set; }
|
||
|
||
[Inject]
|
||
public IWX_WORKACCOUNT wx_WorkAccount_BL { get; set; }
|
||
|
||
[Inject]
|
||
public IWX_INNERUSERJOBNUM wx_InnerUserJobNum_BL { get; set; }
|
||
|
||
[Inject]
|
||
public IWX_WORKACCOUNT_INIT wx_WorkAccount_Init_BL { get; set; }
|
||
|
||
[Inject]
|
||
public CACHE_BL cache_BL { get; set; }
|
||
|
||
[Inject]
|
||
public IBAS_INNERUSERROLE_Q _inneruserRole { get; set; }
|
||
|
||
[Inject]
|
||
public WX.CRM.IBLL.Base.IBAS_INNERUSER_Q innerUser_BL { get; set; }
|
||
|
||
[Inject]
|
||
public WX.CRM.IBLL.Util.ICACHE_Q cache_q { get; set; }
|
||
|
||
public WXController(WX_GROUPPERCENT_BL wx_GroupPercent_BL, IWX_RCONTACT wx_Rcontack_BL)
|
||
{
|
||
this.wx_GroupPercent_BL = wx_GroupPercent_BL;
|
||
this.wx_Rcontack_BL = wx_Rcontack_BL;
|
||
}
|
||
|
||
#region 客服小组比例设置
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_客服小组比例设置)]
|
||
public ActionResult GroupPercent()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.客服小组比例设置, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "更新客服小组比例", "icon-detail", "UpdateGroupPercent_Click", true);
|
||
//tool.AddOtherButton("Other2", "平均分配", "icon-detail", "GroupAverageAllot_Click", true);
|
||
//tool.AllowButton("Create", "Edit", "Details", "Delete");
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
//Pager pager = new Pager() { page = 1, rows = 20 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
tab.AddHeadCol("GID", "", "组ID");
|
||
tab.AddHeadCol("GNAME", "", "组名称");
|
||
tab.AddHeadCol("EmployeeNum", "", "在职人数");
|
||
tab.AddHeadCol("GroupRate", "", "小组自动分配比例(%)");
|
||
tab.AddHeadCol("GroupRate2", "", "调整后比例(%)");
|
||
tab.AddHeadCol("TotalCommission", "", "成交数量");
|
||
tab.AddHeadCol("Rate3", "", "开单率(%)");
|
||
tab.AddHeadCol("DIV_PERCENT", "", "微调比例。调整后所有客服小组的值之和必须为0");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead();
|
||
return View();
|
||
}
|
||
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_客服小组比例设置)]
|
||
public JsonResult GetGroupPercentHtmlList(string columns)
|
||
{
|
||
var list = wx_GroupPercent_BL.GetGroupPercentList();
|
||
var table = new Table(columns, true);
|
||
var employeeList = wx_GroupPercent_BL.GetSaleGroupEmplyeeNum();
|
||
decimal sum = employeeList.Sum(m => m.Num);
|
||
decimal perRate = 0;
|
||
if (sum > 0)
|
||
{
|
||
perRate = 100 / sum;
|
||
}
|
||
var groupList = new List<WX_UserGroupCount>();
|
||
var dt = wx_Rcontack_BL.CountRcontactByUserGroup();
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
groupList = dt.ToList<WX_UserGroupCount>();
|
||
}
|
||
var groupCommissionList = wx_Rcontack_BL.CountSaleGroupCommission();
|
||
|
||
foreach (var model in list)
|
||
{
|
||
var employee = employeeList.Where(m => m.GID == model.GID).FirstOrDefault();
|
||
var rate = employee != null ? Math.Round(employee.Num * perRate, 4) : 0;
|
||
var commission = groupCommissionList.Where(m => m.Gid == model.GID).FirstOrDefault();
|
||
var group = groupList.Where(m => m.Gid == model.GID).FirstOrDefault();
|
||
|
||
table.AddCol(model.GID);
|
||
table.AddCol(model.GNAME);
|
||
table.AddCol(employee != null ? employee.Num : 0);
|
||
table.AddCol(rate);
|
||
table.AddCol(rate + (model.DIV_PERCENT ?? 0));
|
||
table.AddCol((employee != null && employee.Num > 0 && commission != null) ? commission.TotalCommission : 0);
|
||
table.AddCol((employee != null && employee.Num > 0 && commission != null && group != null && group.CountNum > 0) ? Math.Round(Convert.ToDouble(commission.TotalCommission / group.CountNum * 100), 2) : 0);
|
||
table.AddCol(string.Format("<input type='text' value='{0}' oldvalue='{0}' gID='{1}' rateValue='{2}' style='width:40px;'/>%", model.DIV_PERCENT.HasValue ? model.DIV_PERCENT.ToString() : "0", model.GID, rate.ToString()));
|
||
table.AddRow();
|
||
}
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeToolBar(InitRights.CONST_客服小组比例设置, InitToolBar.CONST_Other1)]
|
||
public JsonResult UpdateGroupPercent(string percents, string gids)
|
||
{
|
||
var result = false;
|
||
var message = "更新失败";
|
||
var value = "系统错误";
|
||
var flag = wx_GroupPercent_BL.UpdateWxGroupPercent(ref errors, percents, gids);
|
||
if (flag == (int)WxUpdatePercentFlag.Success)
|
||
{
|
||
result = true;
|
||
message = "更新成功";
|
||
value = "";
|
||
|
||
#region 同步到推广-组别比率
|
||
SendGroupPercentToPromotion(gids);
|
||
#endregion
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.Overflow)
|
||
{
|
||
value = "客服小组比例之和已经超出100%,不允许更新";
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.Less)
|
||
{
|
||
value = "客服小组比例之和小于100%,不允许更新";
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.NotEqualZero)
|
||
{
|
||
value = "微调的比例之和必须为0,请调整后再更新";
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.ParamsError)
|
||
{
|
||
value = "参数错误";
|
||
}
|
||
wx_SetPercentLog_BL.Add(new WX_SETPERCENTLOG()
|
||
{
|
||
PKID = new SEQUENCES_BL().Seq_base_get(),
|
||
OPUSER = Eid.ToString(),
|
||
OPTIME = DateTime.Now,
|
||
OPDETAIL = JsonHelper.ObjDivertToJson(new
|
||
{
|
||
Result = result,
|
||
DbOperate = Enum.GetName(typeof(WxUpdatePercentFlag), flag),
|
||
OperateType = "GroupPercent",
|
||
Percents = percents,
|
||
Gids = gids,
|
||
Message = message,
|
||
Value = value
|
||
})
|
||
});
|
||
return JsonHandler.ManageMessage(message, result, value);
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeToolBar(InitRights.CONST_客服小组比例设置, InitToolBar.CONST_Other2)]
|
||
public JsonResult GroupAverageAllot()
|
||
{
|
||
var result = false;
|
||
var message = "更新失败";
|
||
var flag = wx_GroupPercent_BL.GroupAverageAllot(ref errors);
|
||
if (flag == (int)WxUpdatePercentFlag.Success)
|
||
{
|
||
result = true;
|
||
message = "更新成功";
|
||
|
||
#region 同步到推广-组别比率
|
||
SendGroupPercentToPromotion("");
|
||
#endregion
|
||
}
|
||
wx_SetPercentLog_BL.Add(new WX_SETPERCENTLOG()
|
||
{
|
||
PKID = new SEQUENCES_BL().Seq_base_get(),
|
||
OPUSER = Eid.ToString(),
|
||
OPTIME = DateTime.Now,
|
||
OPDETAIL = JsonHelper.ObjDivertToJson(new
|
||
{
|
||
Result = result,
|
||
DbOperate = Enum.GetName(typeof(WxUpdatePercentFlag), flag),
|
||
OperateType = "GroupAverageAllot",
|
||
Message = message
|
||
})
|
||
});
|
||
return JsonHandler.ManageMessage(message, result);
|
||
}
|
||
#endregion
|
||
|
||
#region 小组成员比例设置
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_小组成员比例设置)]
|
||
public ActionResult UserPercent()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.小组成员比例设置, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "更新小组成员比例", "icon-detail", "UpdateUserPercent_Click", true);
|
||
tool.AddOtherButton("Other2", "导出", "icon-export", "ExportAllPage_Click1", true);
|
||
//tool.AllowButton("Create", "Edit", "Details", "Delete");
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
//Pager pager = new Pager() { page = 1, rows = 20 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
tab.AddHeadCol("EID", "", "工号");
|
||
tab.AddHeadCol("UNAME", "", "姓名");
|
||
tab.AddHeadCol("TRUENAME", "", "真实姓名");
|
||
tab.AddHeadCol("GNAME", "", "销售组");
|
||
tab.AddHeadCol("ISDISMISS", "", "是否在职");
|
||
tab.AddHeadCol("Rate", "", "自动分配比例(%)");
|
||
tab.AddHeadCol("Rate2", "", "调整后比例(%)");
|
||
tab.AddHeadCol("TotalCommission", "", "成交数量");
|
||
tab.AddHeadCol("Rate3", "", "开单率(%)");
|
||
tab.AddHeadCol("DIV_PERCENT", "", "微调比例(调整后的所有客服的值之和必须为0)");
|
||
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetTable();
|
||
var list = wx_GroupPercent_BL.GetGroupPercentList();
|
||
var selectList = new List<SelectListItem>();
|
||
if (list != null)
|
||
{
|
||
selectList.Add(new SelectListItem { Value = "", Text = "全部" });
|
||
foreach (var item in list)
|
||
{
|
||
selectList.Add(new SelectListItem { Value = item.GID.ToString(), Text = item.GNAME });
|
||
}
|
||
}
|
||
|
||
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);//获取员工角色
|
||
if (roleCodes.IndexOf("[ZJ]") > -1 || roleCodes.IndexOf("[GLY]") > -1 || roleCodes.IndexOf("[ZJZL]") > -1)
|
||
{
|
||
ViewBag.showGroup = "1";
|
||
}
|
||
|
||
ViewBag.groupList = selectList;
|
||
return View();
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_小组成员比例设置)]
|
||
public JsonResult GetUserPercentHtmlList(string columns)
|
||
{
|
||
|
||
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);//获取员工角色
|
||
List<WX_USERPERCENT_Extend> list;
|
||
if (roleCodes.IndexOf("ZJ") < 0 && roleCodes.IndexOf("GLY") < 0 && roleCodes.IndexOf("ZJZL") < 0)
|
||
{
|
||
//非组长时,不返回小组成员数据
|
||
if (userOnGroupId == null)
|
||
{
|
||
list = new List<WX_USERPERCENT_Extend>();
|
||
}
|
||
else
|
||
{
|
||
list = wx_UserPercent_BL.GetList(userOnGroupId);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
var gid = Request["gid"].GetDecimal(0);
|
||
if (gid > 0)
|
||
{
|
||
list = wx_UserPercent_BL.GetList(new decimal[] { gid });
|
||
}
|
||
else
|
||
{
|
||
list = wx_UserPercent_BL.GetList(null);
|
||
}
|
||
}
|
||
var userCommissionList = wx_Rcontack_BL.CountSaleUserCommission();
|
||
var ds = wx_Rcontack_BL.GetWeixinFriendCount(1);
|
||
List<WX_FriendCount> friendCountList = new List<WX_FriendCount>();
|
||
if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
friendCountList = ds.Tables[0].ToList<WX_FriendCount>();
|
||
}
|
||
var employeeList = wx_GroupPercent_BL.GetSaleGroupEmplyeeNum();
|
||
var table = new Table(columns, true);
|
||
foreach (var model in list)
|
||
{
|
||
var innerUserId = InnerUserHelper.Instance.GetUserIdByEid(model.EID);
|
||
var item = employeeList.Where(m => m.GID == model.GID).FirstOrDefault();
|
||
var rate = item != null ? item.Rate : 0;
|
||
|
||
var commission = userCommissionList.Where(m => m.SaleUserId == innerUserId).FirstOrDefault();
|
||
var friend = friendCountList.Where(m => m.InnerUserId == innerUserId).FirstOrDefault();
|
||
table.AddCol(model.EID);
|
||
table.AddCol(model.UNAME);
|
||
table.AddCol(model.TRUENAME);
|
||
table.AddCol(model.GNAME);
|
||
table.AddCol(model.ISDISMISS == 1 ? "离职" : "在职");
|
||
table.AddCol(model.ISDISMISS == 1 ? 0 : rate);
|
||
table.AddCol(model.ISDISMISS == 1 ? 0 : rate + (model.DIV_PERCENT ?? 0));
|
||
table.AddCol(model.ISDISMISS == 1 ? 0 : commission != null ? commission.TotalCommission : 0);
|
||
table.AddCol(model.ISDISMISS == 1 ? 0 : (commission != null && friend != null && friend.Num > 0) ? Math.Round(Convert.ToDouble(commission.TotalCommission / friend.Num * 100), 2) : 0);
|
||
table.AddCol(string.Format("<input type='text' value='{0}' oldvalue='{0}' eID='{1}' gID='{2}' rateValue='{3}' style='width:40px;'/>%", model.DIV_PERCENT.HasValue ? model.DIV_PERCENT.ToString() : "0", model.EID, model.GID, model.ISDISMISS == 1 ? "0" : rate.ToString()));
|
||
table.AddRow();
|
||
}
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeToolBar(InitRights.CONST_小组成员比例设置, InitToolBar.CONST_Other1)]
|
||
public JsonResult UpdateUserPercent(string percents, string gids, string eids)
|
||
{
|
||
var result = false;
|
||
var message = "更新失败";
|
||
var value = "系统错误";
|
||
var flag = wx_UserPercent_BL.UpdateWxUserPercent(ref errors, percents, gids, eids);
|
||
if (flag == (int)WxUpdatePercentFlag.Success)
|
||
{
|
||
result = true;
|
||
message = "更新成功";
|
||
value = "";
|
||
SendUserPercentToPromotion(eids);
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.Overflow)
|
||
{
|
||
value = "客服小组比例之和已经超出100%,不允许更新";
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.Less)
|
||
{
|
||
value = "客服小组比例之和小于100%,不允许更新";
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.NotEqualZero)
|
||
{
|
||
value = "微调的比例之和必须为0,请调整后再更新";
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.ParamsError)
|
||
{
|
||
value = "参数错误";
|
||
}
|
||
wx_SetPercentLog_BL.Add(new WX_SETPERCENTLOG()
|
||
{
|
||
PKID = new SEQUENCES_BL().Seq_base_get(),
|
||
OPUSER = Eid.ToString(),
|
||
OPTIME = DateTime.Now,
|
||
OPDETAIL = JsonHelper.ObjDivertToJson(new
|
||
{
|
||
Result = result,
|
||
DbOperate = Enum.GetName(typeof(WxUpdatePercentFlag), flag),
|
||
OperateType = "UserPercent",
|
||
Percents = percents,
|
||
Gids = gids,
|
||
Eids = eids,
|
||
Message = message,
|
||
Value = value
|
||
})
|
||
});
|
||
return JsonHandler.ManageMessage(message, result, value);
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeToolBar(InitRights.CONST_小组成员比例设置, InitToolBar.CONST_Other2)]
|
||
public JsonResult UserAverageAllot()
|
||
{
|
||
|
||
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);//获取员工角色
|
||
int flag;
|
||
if (roleCodes.IndexOf("[ZJ]") < 0 && roleCodes.IndexOf("[GLY]") < 0 && roleCodes.IndexOf("[ZJZL]") < 0)
|
||
{
|
||
flag = wx_UserPercent_BL.UserAverageAllot(ref errors, userOnGroupId);
|
||
}
|
||
else
|
||
{
|
||
flag = wx_UserPercent_BL.UserAverageAllot(ref errors, null);
|
||
}
|
||
var result = false;
|
||
var message = "更新失败";
|
||
if (flag == (int)WxUpdatePercentFlag.Success)
|
||
{
|
||
result = true;
|
||
message = "更新成功";
|
||
|
||
#region 同步到推广-员工比率
|
||
SendUserPercentToPromotion(userOnGroupId);
|
||
#endregion
|
||
}
|
||
wx_SetPercentLog_BL.Add(new WX_SETPERCENTLOG()
|
||
{
|
||
PKID = new SEQUENCES_BL().Seq_base_get(),
|
||
OPUSER = Eid.ToString(),
|
||
OPTIME = DateTime.Now,
|
||
OPDETAIL = JsonHelper.ObjDivertToJson(new
|
||
{
|
||
Result = result,
|
||
DbOperate = Enum.GetName(typeof(WxUpdatePercentFlag), flag),
|
||
OperateType = "UserAverageAllot",
|
||
Message = message
|
||
})
|
||
});
|
||
return JsonHandler.ManageMessage(message, result);
|
||
}
|
||
|
||
//[AuthorizeRedirect(Roles = InitRights.CONST_小组成员比例设置)]
|
||
public FileResult UserPercentExport()
|
||
{
|
||
string checkedFilds = PageRequest.GetQueryString("checkedFilds");
|
||
string checkedTitles = PageRequest.GetQueryString("checkedTitles");
|
||
Pager pager = new Pager() { page = 1, rows = int.MaxValue };
|
||
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);//获取员工角色
|
||
List<WX_USERPERCENT_Extend> list;
|
||
if (roleCodes.IndexOf("[ZJ]") < 0 && roleCodes.IndexOf("[GLY]") < 0 && roleCodes.IndexOf("[ZJZL]") < 0)
|
||
{
|
||
//非组长时,不返回小组成员数据
|
||
if (userOnGroupId == null)
|
||
{
|
||
list = new List<WX_USERPERCENT_Extend>();
|
||
}
|
||
else
|
||
{
|
||
list = wx_UserPercent_BL.GetList(userOnGroupId);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
var gid = Request["gid"].GetDecimal(0);
|
||
if (gid > 0)
|
||
{
|
||
list = wx_UserPercent_BL.GetList(new decimal[] { gid });
|
||
}
|
||
else
|
||
{
|
||
list = wx_UserPercent_BL.GetList(null);
|
||
}
|
||
}
|
||
var userCommissionList = wx_Rcontack_BL.CountSaleUserCommission();
|
||
var ds = wx_Rcontack_BL.GetWeixinFriendCount(1);
|
||
List<WX_FriendCount> friendCountList = new List<WX_FriendCount>();
|
||
if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
friendCountList = ds.Tables[0].ToList<WX_FriendCount>();
|
||
}
|
||
var employeeList = wx_GroupPercent_BL.GetSaleGroupEmplyeeNum();
|
||
var exportList = new List<WX_USERPERCENT_Extend_Export>();
|
||
foreach (var model in list)
|
||
{
|
||
var innerUserId = InnerUserHelper.Instance.GetUserIdByEid(model.EID);
|
||
var item = employeeList.Where(m => m.GID == model.GID).FirstOrDefault();
|
||
var rate = item != null ? item.Rate : 0;
|
||
var commission = userCommissionList.Where(m => m.SaleUserId == innerUserId).FirstOrDefault();
|
||
var friend = friendCountList.Where(m => m.InnerUserId == innerUserId).FirstOrDefault();
|
||
|
||
var info = new WX_USERPERCENT_Extend_Export
|
||
{
|
||
EID = model.EID,
|
||
UNAME = model.UNAME,
|
||
TRUENAME = model.TRUENAME,
|
||
GNAME = model.GNAME,
|
||
ISDISMISS = model.ISDISMISS == 1 ? "离职" : "在职",
|
||
Rate = model.ISDISMISS == 1 ? 0 : rate,
|
||
Rate2 = model.ISDISMISS == 1 ? 0 : rate + (model.DIV_PERCENT ?? 0),
|
||
TotalCommission = model.ISDISMISS == 1 ? 0 : commission != null ? commission.TotalCommission : 0,
|
||
Rate3 = model.ISDISMISS == 1 ? 0 : (commission != null && friend != null && friend.Num > 0 ? Math.Round(Convert.ToDouble(commission.TotalCommission / friend.Num * 100), 2) : 0),
|
||
DIV_PERCENT = model.DIV_PERCENT.HasValue ? model.DIV_PERCENT.Value : 0
|
||
};
|
||
exportList.Add(info);
|
||
}
|
||
return File(ExcelHelper.ExportListModelToExcel<WX_USERPERCENT_Extend_Export>(exportList, "小组成员比例设置", 10000, checkedFilds, checkedTitles, null), "application/ms-excel", PageRequest.GetDlownLoadName("小组成员比例设置.xls"));
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 微信资源占比
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_客服微信好友排行榜)]
|
||
public ActionResult WeixinFriendList()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.客服微信好友排行榜, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "导出", "icon-detail", "Export_Click", true);
|
||
tool.AddOtherButton("Other2", "保存", "icon-save", "Save_Click", true);
|
||
tool.AddOtherButton("Other3", "设置推广状态", "icon-detail", "Set_Click", true);
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
//Pager pager = new Pager() { page = 1, rows = 20 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
tab.AddHiddenHeadCol("eid", "工号");
|
||
tab.AddHiddenHeadCol("allotrate2", "排序");
|
||
tab.AddHeadCol("EM", "", "客服");
|
||
tab.AddHeadCol("GName", "", "销售组");
|
||
|
||
//tab.AddHeadCol("TotalCommission", "", "成交数");
|
||
tab.AddHeadCol("lastamount", "", "上月业绩(¥)", "sortTable('tablist',5,'float');", "cursor:pointer");//---add
|
||
tab.AddHeadCol("ORDERRATE", "", "开单率(%)", "sortTable('tablist',6,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("ordernum", "", "开单量", "sortTable('tablist',7,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("NUM", "", "资源数", "sortTable('tablist',8,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("actualrate", "", "实际资源数占比", "sortTable('tablist',9,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("allotrate", "", "分配资源设定比例", "sortTable('tablist',2,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("point", "", "点数");//--add
|
||
tab.AddHeadCol("ResourceCount", "", "昨天资源数", "sortTable('tablist',12,'float');", "cursor:pointer");//--add
|
||
tab.AddHeadCol("IsStop", "", "推广状态");
|
||
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead();
|
||
return View();
|
||
}
|
||
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_客服微信好友排行榜_三部)]
|
||
public ActionResult WeixinFriendList3()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.客服微信好友排行榜_三部, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "导出", "icon-detail", "Export_Click", true);
|
||
tool.AddOtherButton("Other2", "保存", "icon-save", "Save_Click", true);
|
||
tool.AddOtherButton("Other3", "设置推广状态", "icon-detail", "Set_Click", true);
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
//Pager pager = new Pager() { page = 1, rows = 20 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
tab.AddHiddenHeadCol("eid", "工号");
|
||
tab.AddHiddenHeadCol("allotrate2", "排序");
|
||
tab.AddHeadCol("EM", "", "客服");
|
||
tab.AddHeadCol("GName", "", "销售组");
|
||
|
||
//tab.AddHeadCol("TotalCommission", "", "成交数");
|
||
tab.AddHeadCol("lastamount", "", "上月业绩(¥)", "sortTable('tablist',5,'float');", "cursor:pointer");//---add
|
||
tab.AddHeadCol("ORDERRATE", "", "开单率(%)", "sortTable('tablist',6,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("ordernum", "", "开单量", "sortTable('tablist',7,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("NUM", "", "资源数", "sortTable('tablist',8,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("actualrate", "", "实际资源数占比", "sortTable('tablist',9,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("allotrate", "", "分配资源设定比例", "sortTable('tablist',2,'float');", "cursor:pointer");
|
||
tab.AddHeadCol("point", "", "点数");//--add
|
||
tab.AddHeadCol("ResourceCount", "", "昨天资源数", "sortTable('tablist',12,'float');", "cursor:pointer");//--add
|
||
tab.AddHeadCol("IsStop", "", "推广状态");
|
||
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead();
|
||
return View();
|
||
}
|
||
|
||
[HttpPost]
|
||
//[AuthorizeRedirect(Roles = InitRights.CONST_客服微信好友排行榜)]
|
||
public JsonResult GetWeixinFriendHtmlList(decimal type, string columns)
|
||
{
|
||
var ds = wx_Rcontack_BL.GetWeixinFriendCount(type);
|
||
var table = new Table(columns, true);
|
||
var pauseNum = 0;
|
||
//先删除缓存
|
||
CacheHelper.Remove("cache_Parameter_getList");
|
||
var s = cache_BL.GetValue_Parameter(WX.CRM.Model.Enum.Parameter.WeiXin_TotalPauseUserNum);
|
||
if (!string.IsNullOrWhiteSpace(s))
|
||
{
|
||
int.TryParse(s, out pauseNum);
|
||
}
|
||
|
||
List<WX_UserCommissionCount> userCommissionList = wx_Rcontack_BL.CountSaleUserCommission();
|
||
|
||
//调用昨日的客服资源数据
|
||
var dt = wx_Rcontack_BL.RcontactByUserAndDay(DateTime.Now.AddDays(-1).Date, DateTime.Now.Date, type);
|
||
List<UserResourceNum> userResourceList = new List<UserResourceNum>();
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
userResourceList = dt.ToList<UserResourceNum>();
|
||
}
|
||
|
||
//获取所有的工作微信状态
|
||
var workAccountList = wx_WorkAccount_Init_BL.GetList();
|
||
|
||
if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
int i = 1;
|
||
int ncount = ds.Tables[0].Rows.Count;
|
||
foreach (DataRow model in ds.Tables[0].Rows)
|
||
{
|
||
decimal? innerUserId = model["inneruserid"] != null ? Convert.ToDecimal(model["inneruserid"]) : new Nullable<decimal>();
|
||
table.AddHiddenCol(model["eid"]);
|
||
table.AddHiddenCol(model["allotrate"]);
|
||
table.AddCol(innerUserId.HasValue ? InnerUserHelper.Instance.GetEidAndTrueName(innerUserId) : "");
|
||
table.AddCol(InnerUserHelper.Instance.GetGroupName(InnerUserHelper.Instance.GetGroupId(innerUserId)));
|
||
|
||
//var commission = userCommissionList.Where(m => m.SaleUserId == innerUserId).FirstOrDefault();
|
||
//if (commission != null)
|
||
//{
|
||
//table.AddCol(commission.TotalCommission);
|
||
table.AddCol(model["lastamount"]);//上月业绩
|
||
table.AddCol(model["ORDERRATE"]);//开单率
|
||
table.AddCol(model["ordernum"]);//开单率
|
||
//}
|
||
//else
|
||
//{
|
||
// table.AddCol(0);
|
||
// table.AddCol(0);
|
||
// table.AddCol(0);
|
||
//}
|
||
table.AddCol(model["num"]);
|
||
table.AddCol(model["actualrate"]);//实际占比
|
||
table.AddCol(string.Format("<span style='color:green'>{0}</span>", model["allotrate"]));//计算占比
|
||
|
||
table.AddCol(string.Format("<input type='text' value='{0}' oldvalue='{0}' eid='{1}' style='width:40px;'/>", model["point"], model["eid"]));//点数
|
||
|
||
// table.AddCol((ncount-i) < pauseNum ? "<span style='color:red'>暂停</span>" : "正常");
|
||
table.AddCol(userResourceList.Where(m => m.InnerUserId == Convert.ToDecimal(model["inneruserid"])).Sum(m => m.ResourceCount));
|
||
var workaccount = workAccountList.Where(m => m.INNERUSERID == Convert.ToDecimal(model["inneruserid"]) && (m.ISVALID == 1 || m.ISVALID == 3)).FirstOrDefault();
|
||
var workaccountPause = workAccountList.Where(m => m.INNERUSERID == Convert.ToDecimal(model["inneruserid"]) && (m.ISVALID == 2 && m.AUDITMEMO.Contains("资源数"))).FirstOrDefault();
|
||
table.AddCol(workaccount != null ? (workaccount.ISVALID == 1 ? "正常" : "系统暂停-" + workaccount.AUDITMEMO) : (workaccountPause != null ? "手工暂停-" + workaccountPause.AUDITMEMO : ""));
|
||
table.AddRow();
|
||
i++;
|
||
}
|
||
}
|
||
var json = new
|
||
{
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
[HttpPost]
|
||
//[AuthorizeToolBar(InitRights.CONST_客服微信好友排行榜, InitToolBar.CONST_Other2)]
|
||
public JsonResult SavePoint(string eids, string points, decimal type)
|
||
{
|
||
var flag = wx_Rcontack_BL.UpadteUserPoint(ref errors, eids, points, type);
|
||
bool result = false;
|
||
string message = string.Empty;
|
||
if (flag == (int)WxUpdatePercentFlag.Success)
|
||
{
|
||
result = true;
|
||
message = "更新成功";
|
||
}
|
||
else if (flag == (int)WxUpdatePercentFlag.ParamsError)
|
||
{
|
||
result = false;
|
||
message = "参数错误";
|
||
}
|
||
else
|
||
{
|
||
result = false;
|
||
message = "系统错误:" + errors.ToString();
|
||
}
|
||
return JsonHandler.ManageMessage(message, result);
|
||
}
|
||
|
||
public FileResult WeixinFriendExport(decimal type)
|
||
{
|
||
string checkedFilds = PageRequest.GetQueryString("checkedFilds");
|
||
checkedFilds = checkedFilds.Replace("[]", "");
|
||
string checkedTitles = PageRequest.GetQueryString("checkedTitles");
|
||
Pager pager = new Pager() { page = 1, rows = int.MaxValue };
|
||
List<WX_FriendCount> list;
|
||
var pauseNum = 0;
|
||
//先删除缓存
|
||
CacheHelper.Remove("cache_Parameter_getList");
|
||
var s = cache_BL.GetValue_Parameter(WX.CRM.Model.Enum.Parameter.WeiXin_TotalPauseUserNum);
|
||
if (!string.IsNullOrWhiteSpace(s))
|
||
{
|
||
int.TryParse(s, out pauseNum);
|
||
}
|
||
List<WX_UserCommissionCount> userCommissionList = wx_Rcontack_BL.CountSaleUserCommission();
|
||
|
||
//调用昨日的客服资源数据
|
||
var dt2 = wx_Rcontack_BL.RcontactByUserAndDay(DateTime.Now.AddDays(-1).Date, DateTime.Now.Date, type);
|
||
List<UserResourceNum> userResourceList = new List<UserResourceNum>();
|
||
if (dt2 != null && dt2.Rows.Count > 0)
|
||
{
|
||
userResourceList = dt2.ToList<UserResourceNum>();
|
||
}
|
||
|
||
//获取所有的工作微信状态
|
||
var workAccountList = wx_WorkAccount_Init_BL.GetList();
|
||
|
||
//tab.AddHiddenHeadCol("eid", "工号");
|
||
//tab.AddHeadCol("EM", "", "客服");
|
||
//tab.AddHeadCol("GName", "", "销售组");
|
||
//tab.AddHeadCol("NUM", "", "资源数");
|
||
//tab.AddHeadCol("actualrate", "", "实际资源数占比");
|
||
//tab.AddHeadCol("allotrate", "", "分配资源设定比例");
|
||
//tab.AddHeadCol("LASTMONTH_YJ", "", "上月业绩(¥)");//---add
|
||
//tab.AddHeadCol("ORDERRATE", "", "开单率(%)");
|
||
//tab.AddHeadCol("POINT", "", "点数");//--add
|
||
//tab.AddHeadCol("IsStop", "", "预估推广状态");
|
||
|
||
|
||
var ds = wx_Rcontack_BL.GetWeixinFriendCount(type);
|
||
var dt = ds.Tables[0];
|
||
//dt.Columns.Add(new DataColumn("TotalCommission"));
|
||
dt.Columns.Add(new DataColumn("Rate"));
|
||
dt.Columns.Add(new DataColumn("IsStop"));
|
||
dt.Columns.Add(new DataColumn("EM"));
|
||
dt.Columns.Add(new DataColumn("Gname"));
|
||
dt.Columns.Add(new DataColumn("ResourceCount"));
|
||
int i = 1;
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
decimal? innerUserId = item["inneruserid"] != null ? Convert.ToDecimal(item["inneruserid"]) : new Nullable<decimal>();
|
||
//var commission = userCommissionList.Where(m => m.SaleUserId == innerUserId).FirstOrDefault();
|
||
//if (commission != null)
|
||
//{
|
||
// //item["TotalCommission"] = commission.TotalCommission;
|
||
// item["Rate"] = Math.Round(Convert.ToDouble(commission.TotalCommission / Convert.ToDecimal(item["num"]) * 100), 2);
|
||
//}
|
||
//else
|
||
//{
|
||
// //item["TotalCommission"] = 0;
|
||
// item["Rate"] = 0;
|
||
//}
|
||
item["EM"] = InnerUserHelper.Instance.GetEidAndTrueName(innerUserId);
|
||
item["Gname"] = InnerUserHelper.Instance.GetGroupName(InnerUserHelper.Instance.GetGroupId(innerUserId));
|
||
item["ResourceCount"] = userResourceList.Where(m => m.InnerUserId == Convert.ToDecimal(item["inneruserid"])).Sum(m => m.ResourceCount);
|
||
|
||
var workaccount = workAccountList.Where(m => m.INNERUSERID == Convert.ToDecimal(item["inneruserid"]) && (m.ISVALID == 1 || m.ISVALID == 3)).FirstOrDefault();
|
||
var workaccountPause = workAccountList.Where(m => m.INNERUSERID == Convert.ToDecimal(item["inneruserid"]) && (m.ISVALID == 2 && m.AUDITMEMO.Contains("资源数"))).FirstOrDefault();
|
||
item["IsStop"] = workaccount != null ? (workaccount.ISVALID == 1 ? "正常" : "系统暂停-" + workaccount.AUDITMEMO) : (workaccountPause != null ? "手工暂停-" + workaccountPause.AUDITMEMO : "");
|
||
|
||
i++;
|
||
|
||
}
|
||
|
||
|
||
return File(ExcelHelper.ExportDataTableToExcel(dt, "客服微信资源占比", checkedFilds, checkedTitles, FriendCountDataFormart), "application/ms-excel", PageRequest.GetDlownLoadName("客服微信资源占比.xls"));
|
||
}
|
||
|
||
//用作委托传递
|
||
public string FriendCountDataFormart(string key, object value)
|
||
{
|
||
string formartValue = string.Empty;
|
||
switch (key)
|
||
{
|
||
case "InnerUserId":
|
||
formartValue = value != null ? InnerUserHelper.Instance.GetEidAndTrueName(Convert.ToDecimal(value)) : ""; break;
|
||
case "Gid":
|
||
formartValue = value != null ? InnerUserHelper.Instance.GetGroupName(Convert.ToDecimal(value)) : ""; break;
|
||
default: formartValue = string.Format("{0}", value); break;
|
||
}
|
||
return formartValue;
|
||
}
|
||
#endregion
|
||
|
||
#region 工作微信管理
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_工作微信管理)]
|
||
public ActionResult WorkAccountIndex()
|
||
{
|
||
ControlResource.JudgeSYQ();
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.工作微信管理, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "微信资源详情", "icon-detail", "ResDetail_Click", true);
|
||
tool.AddOtherButton("Other2", "聊天记录", "icon-detail", "ChatRecord_Click", true);
|
||
tool.AddOtherButton("Other3", "微信好友", "icon-detail", "Rcontack_Click", true);
|
||
tool.AddOtherButton("Other4", "绑定客服", "icon-detail", "Bind_Click", true);
|
||
tool.AddOtherButton("Other5", "微信红包", "icon-detail", "Hongbao_Click", true);
|
||
//tool.AllowButton("Create", "Edit", "Details", "Delete");
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
Pager pager = new Pager() { page = 1, rows = 20 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
tab.AddHiddenHeadCol("PKID", "编号");
|
||
tab.AddHiddenHeadCol("RESID", "客户ID");
|
||
tab.AddHeadCol("USERNAME", "", "微信用户名");
|
||
tab.AddHeadCol("ALIAS", "", "微信号");
|
||
tab.AddHeadCol("NICKNAME", "", "昵称");
|
||
tab.AddHeadCol("VERSION", "", "软件版本");
|
||
tab.AddHeadCol("EID", "", "客服工号");
|
||
tab.AddHeadCol("GroupName", "", "客服所在组");
|
||
tab.AddHeadCol("ISVALID", "", "微信状态");
|
||
tab.AddHeadCol("CTIME", "", "创建时间");
|
||
tab.AddHeadCol("BeforeEID", "", "前一个客服");
|
||
tab.AddHeadCol("DismisTime", "", "离职时间");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead(); //+ Pagination.GetPage(pager, tableId, "5,10,15,20");
|
||
ViewBag.inneruserid = UserId;
|
||
ViewBag.userGroupId = userGroupId;
|
||
ViewBag.saleDeptId = saleDeptId;
|
||
ViewBag.roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
||
return View();
|
||
}
|
||
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_工作微信管理)]
|
||
public ActionResult BindWorkAccount(string id)
|
||
{
|
||
//table
|
||
Pager pager = new Pager() { page = 1, rows = 5 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
tab.AddHeadCol("USERNAME", "15%", "微信用户名");
|
||
tab.AddHeadCol("ALIAS", "15%", "微信号");
|
||
tab.AddHeadCol("inneruserEid", "12%", "员工编号");
|
||
tab.AddHeadCol("inneruserName", "12%", "员工姓名");
|
||
tab.AddHeadCol("STARTDATE", "12%", "开始时间");
|
||
tab.AddHeadCol("ENDDATE", "12%", "结束时间");
|
||
tab.AddHeadCol("CTIME", "18%", "创建时间");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead() + Pagination.GetPage(pager, tableId, "5,10,15,20");
|
||
WX_WORKACCOUNT model = null;
|
||
if (id == null)
|
||
{
|
||
model = new WX_WORKACCOUNT();
|
||
// 数据初始化
|
||
}
|
||
else
|
||
{
|
||
var pkid = Convert.ToDecimal(id);
|
||
model = wx_WorkAccount_BL.Get(m => m.PKID == pkid);
|
||
|
||
}
|
||
ViewBag.WorkAccountEid = InnerUserHelper.Instance.GetEidByUserId(model.INNERUSERID);
|
||
return View(model);
|
||
}
|
||
|
||
|
||
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_我的工作微信)]
|
||
public ActionResult WorkAccountRcontact()
|
||
{
|
||
string isShowAlias = cache_q.GetValue_Parameter("WeiXin_IsShowAlias");//是否显示微信号
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.工作微信好友关系, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "导出", "icon-export", "Export_Click", true);
|
||
ViewBag.ToolBar = tool;
|
||
//table
|
||
Pager pager = new Pager() { page = 1, rows = 20 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
tab.AddHiddenHeadCol("PKID", "编号");
|
||
tab.AddHeadCol("USERNAME", "", "微信用户名");
|
||
if (!string.IsNullOrEmpty(isShowAlias) && isShowAlias == "1")
|
||
{
|
||
tab.AddHeadCol("ALIAS", "", "微信号");
|
||
}
|
||
tab.AddHeadCol("NICKNAME", "", "昵称");
|
||
tab.AddHeadCol("CONREMARK", "", "备注");
|
||
tab.AddHeadCol("RESID", "", "客户ID");
|
||
tab.AddHeadCol("CTIME", "", "创建时间");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead() + Pagination.GetPage(pager, tableId, "5,10,15,20");
|
||
return View();
|
||
}
|
||
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_工作微信管理)]
|
||
public ActionResult GetJobWxChatRecord(string jobWxUserName)
|
||
{
|
||
string url = "?jobWxUserName=" + jobWxUserName;
|
||
Common.Utility.PostData(url, System.Text.Encoding.UTF8);
|
||
return View();
|
||
}
|
||
//[AuthorizeRedirect(Roles = InitRights.CONST_工作微信管理)]
|
||
//public ActionResult GetJobWxChatRecord(string jobWxUserName)
|
||
//{
|
||
// string url = "?jobWxUserName="+jobWxUserName;
|
||
// Common.Utility.PostData(url, System.Text.Encoding.UTF8);
|
||
// return View();
|
||
//}
|
||
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_工作微信管理)]
|
||
public JsonResult GetWorkAccountHtmlList(Pager pager, string userName, string alias, string resID, string nickName, string conRemark, string stime, string etime, string customerUserName, string customerAlias, string customerNickname, string customerRemark, int isDismiss, string columns)
|
||
{
|
||
string groupId = Request.Form["groupId"];
|
||
decimal userId = Request["userId"].GetDecimal(0);
|
||
decimal eId = Request["eId"].GetDecimal(0);
|
||
if (eId > 0)
|
||
{
|
||
userId = InnerUserHelper.Instance.GetUserIdByEid(eId);
|
||
}
|
||
string[] userArrs = null;
|
||
if (!string.IsNullOrWhiteSpace(userName))
|
||
{
|
||
userArrs = new string[] { userName };
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(customerUserName) || !string.IsNullOrWhiteSpace(customerAlias) || !string.IsNullOrWhiteSpace(customerNickname) || !string.IsNullOrWhiteSpace(customerRemark))
|
||
{
|
||
Pager pager2 = new Pager();
|
||
pager2.rows = 1000;
|
||
pager2.page = 1;
|
||
var rcontackList = wx_Rcontack_BL.GetList(ref pager2, null, customerUserName, customerAlias, customerNickname, customerRemark, null, null);
|
||
if (rcontackList != null && rcontackList.Count > 0)
|
||
{
|
||
userArrs = rcontackList.Select(m => m.JOBWXUSERNAME).ToArray();
|
||
}
|
||
|
||
}
|
||
//List<WX_WORKACCOUNT> list = wx_WorkAccount_BL.GetList(ref pager, userName, alias, conRemark, nickName, resID, groupId, userId, null, stime, etime);
|
||
var list = wx_WorkAccount_BL.GetAll(userArrs, alias, conRemark, nickName, resID, groupId, userId, null, stime, etime, isDismiss);
|
||
Table table = new Table(columns, true);
|
||
//table.gridPager = pager;
|
||
foreach (var model in list)
|
||
{
|
||
table.AddHiddenCol(model.WxWorkaccount.PKID);
|
||
table.AddHiddenCol(model.WxWorkaccount.RESID);
|
||
table.AddCol(model.WxWorkaccount.USERNAME);
|
||
var bindList = wx_WorkAccount_BL.GetWorkAccountBindByInnerUserId(model.WxWorkaccount.INNERUSERID.Value).ToList<BindInfo>();
|
||
if (bindList != null && bindList.FindIndex(m => m.wxnumber == model.WxWorkaccount.ALIAS) > 1)
|
||
{
|
||
table.AddCol(string.Format("<span style='color:red'>{0}</span>", model.WxWorkaccount.ALIAS));
|
||
}
|
||
else
|
||
{
|
||
table.AddCol(model.WxWorkaccount.ALIAS);
|
||
}
|
||
|
||
table.AddCol(model.WxWorkaccount.NICKNAME);
|
||
table.AddCol(model.VERSION);
|
||
table.AddCol(InnerUserHelper.Instance.GetEidAndTrueName(model.WxWorkaccount.INNERUSERID));
|
||
table.AddCol(InnerUserHelper.Instance.GetGroupName(InnerUserHelper.Instance.GetGroupId(model.WxWorkaccount.INNERUSERID)));
|
||
table.AddCol(getWeixinValidText(model.WxWorkaccount.ISVALID));
|
||
table.AddCol(model.WxWorkaccount.CTIME);
|
||
|
||
var page2 = new Pager() { page = 1, rows = 5 };
|
||
var beforeList = wx_InnerUserJobNum_BL.GetList(ref page2, model.WxWorkaccount.ALIAS);
|
||
var str = string.Empty;
|
||
if (beforeList != null)
|
||
{
|
||
if (beforeList.Count == 1)
|
||
{
|
||
table.AddCol(beforeList[0].inneruserEid);
|
||
table.AddCol(beforeList[0].DismisTime.ToUnityString(1));
|
||
}
|
||
else if (beforeList.Count > 1)
|
||
{
|
||
table.AddCol(beforeList[1].inneruserEid);
|
||
table.AddCol(beforeList[1].DismisTime.ToUnityString(1));
|
||
}
|
||
else
|
||
{
|
||
table.AddCol(string.Empty);
|
||
table.AddCol(string.Empty);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
table.AddCol(string.Empty);
|
||
table.AddCol(string.Empty);
|
||
}
|
||
//foreach (var item in beforeList)
|
||
//{
|
||
// str += "<p>" + item.inneruserEid + "——" + item.inneruserName + "(" + item.wx_inneruserJobNum.STARTDATE + "至" + item.wx_inneruserJobNum.ENDDATE + ")</p>";
|
||
//}
|
||
//table.AddCol(str);
|
||
|
||
table.AddRow();
|
||
}
|
||
var json = new
|
||
{
|
||
//totalPages = pager.totalPages,
|
||
//totalRows = pager.totalRows,
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_我的工作微信)]
|
||
public JsonResult GetWorkAccountRcontackHtmlList(Pager pager, string jobWxUserName, string userName, string alias, string stime, string etime, string columns)
|
||
{
|
||
|
||
string isShowAlias = cache_q.GetValue_Parameter("WeiXin_IsShowAlias");//是否显示微信号
|
||
List<WX_RCONTACT> list;
|
||
if (string.IsNullOrWhiteSpace(jobWxUserName)) //数据库存在工作微信为空的内容
|
||
{
|
||
list = new List<WX_RCONTACT>();
|
||
}
|
||
else
|
||
{
|
||
list = wx_Rcontack_BL.GetList(ref pager, jobWxUserName, userName, alias, null, null, stime, etime);
|
||
}
|
||
Table table = new Table(columns, true);
|
||
table.gridPager = pager;
|
||
foreach (var model in list)
|
||
{
|
||
table.AddHiddenCol(model.PKID);
|
||
table.AddCol(model.USERNAME);
|
||
if (!string.IsNullOrEmpty(isShowAlias) && isShowAlias == "1")
|
||
{
|
||
table.AddCol(model.ALIAS);
|
||
}
|
||
|
||
table.AddCol(Utility.ReplaceMobile(model.NICKNAME));
|
||
table.AddCol(Utility.ReplaceMobile(model.CONREMARK));
|
||
var linkUrl = string.Format("<a href=\"javascript:parent.ChildAddTab('{0}', '{1}', '')\">{2}</a>"
|
||
, "客户详细"
|
||
, "/Csvr/CustomerInfo/CustomerDetail?resid=" + model.RESID
|
||
, model.RESID);
|
||
table.AddCol(linkUrl);
|
||
table.AddCol(model.CTIME);
|
||
table.AddRow();
|
||
}
|
||
var json = new
|
||
{
|
||
totalPages = pager.totalPages,
|
||
totalRows = pager.totalRows,
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_工作微信管理)]
|
||
public JsonResult GetInnerUserJobNumHtmlList(Pager pager, string alias, string columns)
|
||
{
|
||
List<WX_INNERUSERJOBNUM_Extend> list = wx_InnerUserJobNum_BL.GetList(ref pager, alias);
|
||
Table table = new Table(columns, true);
|
||
table.gridPager = pager;
|
||
foreach (var model in list)
|
||
{
|
||
table.AddCol(model.wx_inneruserJobNum.WXUSERNAME);
|
||
table.AddCol(model.wx_inneruserJobNum.WXNUMBER);
|
||
table.AddCol(model.inneruserEid);
|
||
table.AddCol(model.inneruserName);
|
||
table.AddCol(model.wx_inneruserJobNum.STARTDATE);
|
||
table.AddCol(model.wx_inneruserJobNum.ENDDATE);
|
||
table.AddCol(model.wx_inneruserJobNum.CTIME);
|
||
table.AddRow();
|
||
}
|
||
var json = new
|
||
{
|
||
totalPages = pager.totalPages,
|
||
totalRows = pager.totalRows,
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeToolBar(InitRights.CONST_工作微信管理, InitToolBar.CONST_Other4)]
|
||
public JsonResult BindWorkAccountSave(string eid, string startDate, string ALIAS, decimal PKID)
|
||
{
|
||
var result = false;
|
||
var message = "更新失败";
|
||
decimal decEid;
|
||
if (!decimal.TryParse(eid, out decEid))
|
||
{
|
||
return JsonHandler.ManageMessage("员工工号格式输入有误!", result);
|
||
}
|
||
var user = innerUser_BL.getInnerUserByEid(decEid);
|
||
if (user == null)
|
||
{
|
||
return JsonHandler.ManageMessage("找不到该员工工号记录!", false);
|
||
}
|
||
var innerUserId = user.PKID;
|
||
|
||
if (Convert.ToDateTime(startDate) > DateTime.Now.Date)
|
||
{
|
||
return JsonHandler.ManageMessage("开始日期,不能大于当日日期!", result);
|
||
}
|
||
var workAccount = wx_WorkAccount_BL.Get(m => m.PKID == PKID);
|
||
if (workAccount != null && !workAccount.ISVALID.HasValue)
|
||
{
|
||
return JsonHandler.ManageMessage("只有正常的微信状态,才能执行绑定客服操作。请先开启该工作微信,再执行绑定操作", result);
|
||
}
|
||
var flag = canAddWeixin(decEid);
|
||
if (!flag)
|
||
{
|
||
errors.Add("该用户名下的微信数,已经达到上限!不能再绑定!");
|
||
return JsonHandler.ManageMessage(errors, false);
|
||
}
|
||
flag = canBindWeixin(decEid, workAccount.ISVALID);
|
||
if (!flag)
|
||
{
|
||
//errors.Add("该用户名下的微信已经在推广,不能再次绑定推广的微信。请手工暂停后,再绑定!");
|
||
//return JsonHandler.ManageMessage(errors, false);
|
||
//如果再次绑定的微信是可以推广的状态,那么就修改该微信状态为手工暂停。如果已经是手工暂停或者下线就不做状态修改处理
|
||
if (workAccount.ISVALID == 1 || workAccount.ISVALID == 3)
|
||
{
|
||
flag = wx_WorkAccount_Init_BL.ModifyWorkAccountIsValid(ref errors, workAccount.ALIAS, 2, "2037-1-1", "绑定暂停", UserId, 0);
|
||
if (flag)
|
||
{
|
||
workAccount.ISVALID = 2;//修改状态成功后,设置当前微信状态为手工暂停
|
||
}
|
||
else //状态没改成功,不能执行下面的步骤
|
||
{
|
||
return JsonHandler.ManageMessage(errors, false);
|
||
}
|
||
}
|
||
|
||
}
|
||
var msg = "";
|
||
result = wx_WorkAccount_BL.WxUserBindToInnerUser(innerUserId, PKID, ALIAS, startDate, DateTime.Now, out msg);
|
||
if (result)
|
||
{
|
||
message = "微信用户绑定成功";
|
||
//推送微信工作号
|
||
result = wx_WorkAccount_Init_BL.PushWordAccountData(ref errors, ALIAS, workAccount.ISVALID == 1 ? 1 : 0);
|
||
}
|
||
else
|
||
{
|
||
message = msg;
|
||
}
|
||
|
||
return JsonHandler.ManageMessage(message, result);
|
||
}
|
||
|
||
|
||
public FileResult Export(string jobWxUserName, string userName, string alias, string stime, string etime)
|
||
{
|
||
string checkedFilds = PageRequest.GetQueryString("checkedFilds");
|
||
checkedFilds = checkedFilds.Replace("[]", "");
|
||
string checkedTitles = PageRequest.GetQueryString("checkedTitles");
|
||
Pager pager = new Pager() { page = 1, rows = int.MaxValue };
|
||
List<WX_RCONTACT> list;
|
||
if (string.IsNullOrWhiteSpace(jobWxUserName)) //数据库存在工作微信为空的内容
|
||
{
|
||
list = new List<WX_RCONTACT>();
|
||
}
|
||
else
|
||
{
|
||
list = wx_Rcontack_BL.GetList(ref pager, jobWxUserName, userName, alias, null, null, stime, etime);
|
||
}
|
||
foreach (var m in list)
|
||
{
|
||
m.NICKNAME = Utility.ReplaceMobile(m.NICKNAME);
|
||
m.CONREMARK = Utility.ReplaceMobile(m.CONREMARK);
|
||
}
|
||
return File(ExcelHelper.ExportListModelToExcel<WX.CRM.Model.Entity.WX_RCONTACT>(list, "微信好友列表", 10000, checkedFilds, checkedTitles, null), "application/ms-excel", PageRequest.GetDlownLoadName("微信好友列表.xls"));
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 微信好友统计
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_微信好友数统计)]
|
||
public ActionResult WxJobUserRcontactIndex()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.微信好友数统计, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "微信号好友统计", "icon-check", "WxJobUser_Click", true);
|
||
tool.AddOtherButton("Other2", "员工好友统计", "icon-detail", "InnerUser_Click", true);
|
||
tool.AddOtherButton("Other3", "员工组别好友统计", "icon-detail", "UserGroup_Click", true);
|
||
//tool.AllowButton("Create", "Edit", "Details", "Delete");
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
//Pager pager = new Pager() { page = 1, rows = 100 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
|
||
tab.AddHeadCol("JOBWXUSERNAME", "24%", "微信用户名");
|
||
//tab.AddHeadCol("ALIAS", "24%", "微信号");
|
||
tab.AddHeadCol("NICKNAME", "24%", "昵称");
|
||
tab.AddHeadCol("COUNTNUM", "24%", "好友数");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead();// + Pagination.GetPage(pager, tableId, "5,10,15,20");
|
||
return View();
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_微信好友数统计)]
|
||
public JsonResult GetCountRcontactByWxJobUserHtmlList(string columns)
|
||
{
|
||
DataTable dt = wx_Rcontack_BL.CountRcontactByWxJobUserName();
|
||
Table table = new Table(columns, true);
|
||
//table.gridPager = pager;
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow model in dt.Rows)
|
||
{
|
||
table.AddCol(model[0]);
|
||
//table.AddCol(model[1]);
|
||
table.AddCol(model[2]);
|
||
table.AddCol(model[3]);
|
||
table.AddRow();
|
||
}
|
||
}
|
||
|
||
var json = new
|
||
{
|
||
//totalPages = pager.totalPages,
|
||
//totalRows = pager.totalRows,
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
|
||
|
||
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_微信好友数统计)]
|
||
public ActionResult InnerUserRcontactIndex()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.微信好友数统计, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "微信号好友统计", "icon-detail", "WxJobUser_Click", true);
|
||
tool.AddOtherButton("Other2", "员工好友统计", "icon-check", "InnerUser_Click", true);
|
||
tool.AddOtherButton("Other3", "员工组别好友统计", "icon-detail", "UserGroup_Click", true);
|
||
//tool.AllowButton("Create", "Edit", "Details", "Delete");
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
//Pager pager = new Pager() { page = 1, rows = 100 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
|
||
tab.AddHeadCol("INNERUSERID", "24%", "用户ID");
|
||
tab.AddHeadCol("EID", "24%", "用户编号");
|
||
tab.AddHeadCol("TRUENAME", "24%", "姓名");
|
||
tab.AddHeadCol("COUNTNUM", "24%", "好友数");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead();// + Pagination.GetPage(pager, tableId, "5,10,15,20");
|
||
return View();
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_微信好友数统计)]
|
||
public JsonResult GetCountRcontactByInnerUserHtmlList(string columns)
|
||
{
|
||
DataTable dt = wx_Rcontack_BL.CountRcontactByInnerUserId();
|
||
Table table = new Table(columns, true);
|
||
//table.gridPager = pager;
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow model in dt.Rows)
|
||
{
|
||
table.AddCol(model[0]);
|
||
table.AddCol(model[1]);
|
||
table.AddCol(model[2]);
|
||
table.AddCol(model[3]);
|
||
table.AddRow();
|
||
}
|
||
}
|
||
|
||
var json = new
|
||
{
|
||
//totalPages = pager.totalPages,
|
||
//totalRows = pager.totalRows,
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_微信好友数统计)]
|
||
public ActionResult UserGroupRcontactIndex()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.微信好友数统计, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "微信号好友统计", "icon-detail", "WxJobUser_Click", true);
|
||
tool.AddOtherButton("Other2", "员工好友统计", "icon-detail", "InnerUser_Click", true);
|
||
tool.AddOtherButton("Other3", "员工组别好友统计", "icon-check", "UserGroup_Click", true);
|
||
//tool.AllowButton("Create", "Edit", "Details", "Delete");
|
||
ViewBag.ToolBar = tool;
|
||
|
||
//table
|
||
//Pager pager = new Pager() { page = 1, rows = 100 };
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
|
||
tab.AddHeadCol("GID", "32%", "组ID");
|
||
tab.AddHeadCol("GNAME", "32%", "组名称");
|
||
tab.AddHeadCol("COUNTNUM", "32%", "好友数");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead();// + Pagination.GetPage(pager, tableId, "5,10,15,20");
|
||
return View();
|
||
}
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_微信好友数统计)]
|
||
public JsonResult GetCountRcontactByUserGroupHtmlList(string columns)
|
||
{
|
||
DataTable dt = wx_Rcontack_BL.CountRcontactByUserGroup();
|
||
Table table = new Table(columns, true);
|
||
//table.gridPager = pager;
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow model in dt.Rows)
|
||
{
|
||
table.AddCol(model[0]);
|
||
table.AddCol(model[1]);
|
||
table.AddCol(model[2]);
|
||
table.AddRow();
|
||
}
|
||
}
|
||
|
||
var json = new
|
||
{
|
||
//totalPages = pager.totalPages,
|
||
//totalRows = pager.totalRows,
|
||
rowsList = table.GetRows()
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 同步到推广-组别比率
|
||
/// </summary>
|
||
private void SendGroupPercentToPromotion(string gids)
|
||
{
|
||
try
|
||
{
|
||
List<WX_GROUPPERCENT_Extend> list = wx_GroupPercent_BL.GetGroupPercentListJoinGroup(gids);
|
||
foreach (WX_GROUPPERCENT_Extend item in list)
|
||
{
|
||
//web_push_updateGroup user = new web_push_updateGroup()
|
||
//{
|
||
// GroupId = item.GID.ToString(),
|
||
// Isopen = 1,
|
||
// Name = item.GNAME,
|
||
// Proportion = item.DIV_PERCENT.Value
|
||
//};
|
||
//new PushDataServices().SendData<web_push_updateGroup>(user, "ZQZX", "web_push_updateGroup");
|
||
}
|
||
|
||
}
|
||
catch (Exception e) { LogHelper.Error("组别比率新增推送数据出错:" + e.ToString()); }
|
||
}
|
||
/// <summary>
|
||
/// 同步到推广-员工比率
|
||
/// </summary>
|
||
/// <param name="gids"></param>
|
||
private void SendUserPercentToPromotion(decimal[] groupIds)
|
||
{
|
||
try
|
||
{
|
||
List<WX_USERPERCENT_Extend2> list = wx_UserPercent_BL.GetUserPercentToPush(groupIds);
|
||
foreach (WX_USERPERCENT_Extend2 item in list)
|
||
{
|
||
//web_push_updateEmployee user = new web_push_updateEmployee()
|
||
//{
|
||
// Isopn = 1,
|
||
// EID = item.EID.ToString(),
|
||
// GroupID = item.GID.ToString(),
|
||
// Name = item.UNAME,
|
||
// Proportion = item.DIV_PERCENT,
|
||
// userid = item.UserId.ToString()
|
||
//};
|
||
//new PushDataServices().SendData<web_push_updateEmployee>(user, "ZQZX", "web_push_updateEmployee");
|
||
}
|
||
}
|
||
catch (Exception e) { LogHelper.Error("员工比率新增推送数据出错:" + e.ToString()); }
|
||
}
|
||
/// <summary>
|
||
/// 同步到推广-员工比率
|
||
/// </summary>
|
||
/// <param name="gids"></param>
|
||
private void SendUserPercentToPromotion(string eids)
|
||
{
|
||
if (string.IsNullOrEmpty(eids))
|
||
return;
|
||
try
|
||
{
|
||
List<WX_USERPERCENT_Extend2> list = wx_UserPercent_BL.GetUserPercentByEidsToPush(eids);
|
||
foreach (WX_USERPERCENT_Extend2 item in list)
|
||
{
|
||
//web_push_updateEmployee user = new web_push_updateEmployee()
|
||
//{
|
||
// Isopn = 1,
|
||
// EID = item.EID.ToString(),
|
||
// GroupID = item.GID.ToString(),
|
||
// Name = item.UNAME,
|
||
// Proportion = item.DIV_PERCENT,
|
||
// userid = item.UserId.ToString()
|
||
//};
|
||
//new PushDataServices().SendData<web_push_updateEmployee>(user, "ZQZX", "web_push_updateEmployee");
|
||
}
|
||
}
|
||
catch (Exception e) { LogHelper.Error("员工比率新增推送数据出错:" + e.ToString()); }
|
||
}
|
||
|
||
private string getWeixinValidText(decimal? valid)
|
||
{
|
||
if (!valid.HasValue)
|
||
return "待审";
|
||
if (valid == 0)
|
||
return "下线";
|
||
else if (valid == 1)
|
||
return "正常";
|
||
else if (valid == 2)
|
||
return "手工暂停";
|
||
else if (valid == 3)
|
||
return "系统暂停";
|
||
else
|
||
return "待审";
|
||
}
|
||
|
||
private bool canAddWeixin(decimal? eid)
|
||
{
|
||
if (!eid.HasValue)
|
||
return false;
|
||
|
||
var roleList = _inneruserRole.GetInneruserRoleByUserId(InnerUserHelper.Instance.GetUserIdByEid(eid));
|
||
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(roleList.Select(m => m.ROLEID).ToArray<decimal>());//获取员工角色
|
||
if (roleCodes.IndexOf("SJZL") < 0 && roleCodes.IndexOf("GLY") < 0)
|
||
{
|
||
var weixinCount = 0;
|
||
var myWeiXinList = wx_WorkAccount_Init_BL.GetList(m => m.EID == eid && m.AUDITSTATAUS == 1); //客服审核通过的工作微信号列表
|
||
if (myWeiXinList != null)
|
||
{
|
||
weixinCount = myWeiXinList.Count();
|
||
var list = myWeiXinList.Where(m => m.AUDITSTATAUS == 1 && m.ISVALID == 0); //客服被封号的微信号列表
|
||
if (list != null)
|
||
{
|
||
weixinCount = weixinCount - list.Count(); //客服非封号的微信号数量
|
||
}
|
||
}
|
||
//后台配置的客服添加工作微信号数量
|
||
var setCount = cache_BL.GetValue_Parameter(WX.CRM.Model.Enum.Parameter.WeiXin_WorkAccountInitCount);
|
||
int i = 1;
|
||
int.TryParse(setCount, out i);
|
||
if (weixinCount > (i - 1))
|
||
{
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
|
||
private bool canBindWeixin(decimal? eid, decimal? oriIsValid)
|
||
{
|
||
if (!eid.HasValue || !oriIsValid.HasValue)
|
||
return false;
|
||
var useList = wx_WorkAccount_Init_BL.GetList(m => m.EID == eid && m.ISVALID > 0 && m.ISVALID != 2).ToList();
|
||
if (useList != null && useList.Count > 0 && (oriIsValid == 1 || oriIsValid == 3))
|
||
{
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
public class WX_USERPERCENT_Extend_Export
|
||
{
|
||
public decimal EID { get; set; }
|
||
public string UNAME { get; set; }
|
||
public string TRUENAME { get; set; }
|
||
public string GNAME { get; set; }
|
||
public string ISDISMISS { get; set; }
|
||
public decimal Rate { get; set; }
|
||
public decimal Rate2 { get; set; }
|
||
public decimal? TotalCommission { get; set; }
|
||
public double Rate3 { get; set; }
|
||
public decimal DIV_PERCENT { get; set; }
|
||
}
|
||
|
||
private class UserResourceNum
|
||
{
|
||
public decimal InnerUserId { get; set; }
|
||
|
||
public decimal ResourceCount { get; set; }
|
||
}
|
||
|
||
private class BindInfo
|
||
{
|
||
public string wxnumber { get; set; }
|
||
}
|
||
|
||
}
|
||
}
|