TG.WXCRM.V4/WebHelper/DoItems/QiWeDelMessage.cs

103 lines
3.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}
}