103 lines
3.2 KiB
C#
103 lines
3.2 KiB
C#
using Ninject;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using WX.CRM.BLL.Ww;
|
||
using WX.CRM.Common;
|
||
using WX.CRM.IBLL.Ww;
|
||
using WX.CRM.Model.crmModel;
|
||
using WX.CRM.WebHelper.UtilityModel;
|
||
|
||
namespace WX.CRM.WebHelper.DoItems
|
||
{
|
||
/// <summary>
|
||
/// 企微删除提醒
|
||
/// </summary>
|
||
public sealed class QiWeDelMessage : IPopupMessage
|
||
{
|
||
private IWw_huser _WxuserService;
|
||
#region 单例
|
||
private static volatile QiWeDelMessage instance = null;
|
||
private QiWeDelMessage()
|
||
{
|
||
_WxuserService = Infrastructure.NinjectControllerFactory.ninjectKernel.Get<IWw_huser>();
|
||
}
|
||
// Lock对象,线程安全所用
|
||
private static object locked = new Object();
|
||
public static QiWeDelMessage Instance
|
||
{
|
||
get
|
||
{
|
||
if (instance == null)
|
||
{
|
||
lock (locked)
|
||
{
|
||
if (instance == null)
|
||
instance = new QiWeDelMessage();
|
||
}
|
||
}
|
||
return instance;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取数据锁
|
||
/// </summary>
|
||
private static object dataLocked = new object();
|
||
private static List<decimal> userStatus = new List<decimal>();
|
||
#endregion
|
||
|
||
#region 私有数据
|
||
//private Boolean NeedRefresh = true;
|
||
//private DateTime LastLoadTime = DateTime.Now;
|
||
private Dictionary<decimal, int> UserRes = new Dictionary<decimal, int>();
|
||
private void LoadResource(decimal UserId)
|
||
{
|
||
UserRes.Clear();
|
||
var lists = _WxuserService.GetWxStatusNotice(3);
|
||
|
||
UserFilter.AddRange(lists.Select(n => n.UserId).ToList());
|
||
var groupList = lists.GroupBy(n => n.InnerUserId).Select(n => new { n.Key, count = n.Count() });
|
||
foreach (var user in groupList)
|
||
{
|
||
if (!UserRes.ContainsKey(user.Key))
|
||
{
|
||
UserRes.Add(user.Key, user.count);
|
||
}
|
||
else
|
||
{
|
||
UserRes[user.Key] = user.count;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
public string GetUrl()
|
||
{
|
||
if (UserFilter.Count > 0)
|
||
{
|
||
UserFilter = UserFilter.Distinct().ToList();
|
||
var filter = string.Join(";", UserFilter);
|
||
return @"../Ww/MyWork/index?isExe=0&&assignStatus=3&&filteruserId=" + filter;// 高级分配资源提醒
|
||
}
|
||
return @"../Ww/MyWork/index?isExe=0&&assignStatus=3";// 高级分配资源提醒
|
||
}
|
||
private List<string> UserFilter = new List<string>();
|
||
public void SetView(decimal UserId, string pkid)
|
||
{
|
||
if (!UserRes.ContainsKey(UserId))
|
||
return;
|
||
var ResInfo = UserRes[UserId];
|
||
if (ResInfo == null)
|
||
return;
|
||
}
|
||
|
||
public string GetMessage(decimal UserId)
|
||
{
|
||
LoadResource(UserId);
|
||
if (!UserRes.ContainsKey(UserId))
|
||
return string.Empty;
|
||
var ResInfo = UserRes[UserId];
|
||
return string.Format("{0}", ResInfo);
|
||
}
|
||
}
|
||
}
|