1、系统菜单调整;
2、系统看板UI调整; 3、事故事件功能 4、其他
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Runtime.Caching;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class CacheHelper
|
||||
{
|
||||
private static readonly ObjectCache Cache = MemoryCache.Default;
|
||||
|
||||
/// <summary>
|
||||
/// 添加缓存项
|
||||
/// </summary>
|
||||
/// <param name="key">缓存键</param>
|
||||
/// <param name="value">缓存值</param>
|
||||
/// <param name="absoluteExpiration">绝对过期时间</param>
|
||||
public static void Add(string key, object value, DateTimeOffset absoluteExpiration)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
Cache.Set(key, value, absoluteExpiration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存项(泛型)
|
||||
/// </summary>
|
||||
/// <typeparam name="T">返回类型</typeparam>
|
||||
/// <param name="key">缓存键</param>
|
||||
/// <returns>缓存值</returns>
|
||||
public static T Get<T>(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
object value = Cache[key];
|
||||
if (value is T tValue)
|
||||
{
|
||||
return tValue;
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存项
|
||||
/// </summary>
|
||||
/// <param name="key">缓存键</param>
|
||||
/// <returns>缓存值</returns>
|
||||
public static object Get(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
return Cache[key];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除缓存项
|
||||
/// </summary>
|
||||
/// <param name="key">缓存键</param>
|
||||
public static void Remove(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
Cache.Remove(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有缓存
|
||||
/// </summary>
|
||||
public static void Clear()
|
||||
{
|
||||
foreach (var item in Cache)
|
||||
{
|
||||
Cache.Remove(item.Key);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查缓存项是否存在
|
||||
/// </summary>
|
||||
/// <param name="key">缓存键</param>
|
||||
/// <returns>是否存在</returns>
|
||||
public static bool Exists(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
return Cache.Contains(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +132,32 @@ namespace BLL
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///根据userid获取当前人的单位类型(0总公司,1分公司,2其他)
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetUnitTypeByUserId(string userId)
|
||||
{
|
||||
int result = 0;
|
||||
var user = UserService.GetUserByUserId(userId);
|
||||
|
||||
|
||||
if ((userId == Const.hfnbdId || userId == Const.sysglyId) || (!string.IsNullOrEmpty(user.UnitId) && user.UnitId == CommonService.GetThisUnitId()))//公司级别
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(user.UnitId) && UnitService.GetUnitByUnitId(user.UnitId).IsBranch == true && user.IsOffice == true) //子公司级数据
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
else //外来账户
|
||||
{
|
||||
result = 2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#region 根据登陆id菜单id判断是否有权限
|
||||
/// <summary>
|
||||
/// 根据登陆id菜单id判断是否有权限
|
||||
|
||||
@@ -2527,6 +2527,15 @@ namespace BLL
|
||||
public const string ProjectEmergencyProcessMenuId = "A5D0287B-2410-4DB1-8BD4-E0534EBAE308";
|
||||
#endregion
|
||||
|
||||
#region 事故警示
|
||||
|
||||
/// <summary>
|
||||
/// 事故警示
|
||||
/// </summary>
|
||||
public const string AccidentWarningMenuId = "05B1C636-75F0-4F58-ABBF-B79604E2F11C";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 施工方案/方案审查
|
||||
/// <summary>
|
||||
/// 施工方案及审查
|
||||
@@ -6334,9 +6343,24 @@ namespace BLL
|
||||
/// 实业数据
|
||||
/// </summary>
|
||||
public const string SYHSEData_SYHSEMenuId = "64EE5EC2-F725-4656-9110-5AF83C18FB6C";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 定时任务
|
||||
|
||||
/// <summary>
|
||||
/// 接口设置
|
||||
/// </summary>
|
||||
public const string InterFaceSetMenuId = "FFD221D7-AE05-447F-8727-80058A04F401";
|
||||
/// <summary>
|
||||
/// 任务清单
|
||||
/// </summary>
|
||||
public const string InterFaceTaskMenuId = "FFD221D7-AE05-447F-8727-80058A04F402";
|
||||
/// <summary>
|
||||
/// 请求日志
|
||||
/// </summary>
|
||||
public const string IFLogListMenuId = "FFD221D7-AE05-447F-8727-80058A04F404";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据同步状态
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 时间操作辅助类
|
||||
/// </summary>
|
||||
public class DateHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 计算两个日期之间相差多少天
|
||||
/// </summary>
|
||||
/// <param name="date1">先</param>
|
||||
/// <param name="date2">后</param>
|
||||
/// <returns></returns>
|
||||
public static int DaysDifference(DateTime date1, DateTime date2)
|
||||
{
|
||||
int result = 0;
|
||||
// 计算两个日期之间的天数差
|
||||
TimeSpan difference = date2.Subtract(date1);
|
||||
result = Math.Abs(difference.Days); //使用绝对值获取正数差值
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user