20231110优化安全巡检、作业票列表速度优化

This commit is contained in:
2023-11-10 10:54:55 +08:00
parent 6409a865b0
commit f68955d921
6 changed files with 878 additions and 119 deletions
+121 -1
View File
@@ -1,4 +1,10 @@
using System;
using FineUIPro;
using Model;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace BLL
@@ -10,6 +16,120 @@ namespace BLL
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.License_LicenseManager> getDataLists = from x in db.License_LicenseManager
select x;
/// <summary>
///
/// </summary>
/// <param name="projetcId"></param>
/// <param name="checkMan"></param>
/// <param name="type"></param>
/// <param name="workAreaName"></param>
/// <param name="responsibilityUnitName"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="startRectificationTime"></param>
/// <param name="endRectificationTime"></param>
/// <param name="states"></param>
/// <param name="personId"></param>
/// <param name="unitId"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string unitId, DateTime? startTime, DateTime? endTime, string licenseType, string unitId2, Grid Grid1)
{
IQueryable<Model.License_LicenseManager> getDataList = getDataLists;
if (!string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
}
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(projectId, unitId))
{
getDataList = getDataList.Where(e => e.UnitId == unitId);
}
if (startTime.HasValue)
{
getDataList = getDataList.Where(e => e.StartDate >= startTime);
}
if (endTime.HasValue)
{
getDataList = getDataList.Where(e => e.EndDate <= endTime);
}
if (!string.IsNullOrEmpty(licenseType))
{
getDataList = getDataList.Where(e => e.LicenseTypeId == licenseType);
}
if (!string.IsNullOrEmpty(unitId2) && unitId2 != Const._Null)
{
getDataList = getDataList.Where(e => e.UnitId == unitId2 );
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.LicenseManagerId,
x.LicenseManagerCode,
LicenseTypeName = db.Base_LicenseType.First(t => t.LicenseTypeId == x.LicenseTypeId).LicenseTypeName,
UnitName = db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
WorkAreaName = UnitWorkService.GetUnitWorkName(x.WorkAreaId),
x.CompileDate,
x.StartDate,
x.EndDate,
FlowOperateName = getFlow(x.LicenseManagerId, x.States),
};
}
public static string getFlow(string id,string states)
{
string strrValue = string.Empty;
string name = string.Empty;
var getFlow = Funs.DB.Sys_FlowOperate.FirstOrDefault(x => x.DataId == id && x.IsClosed != true);
if (getFlow != null)
{
var getPerson = Funs.DB.Person_Persons.FirstOrDefault(x => x.PersonId == getFlow.OperaterId);
if (getPerson != null)
{
name = getPerson.PersonName;
}
}
if (states == BLL.Const.State_0 || string.IsNullOrEmpty(states))
{
strrValue = "待[" + name + "]提交";
}
else if (states == BLL.Const.State_1)
{
strrValue = "审核/审批完成";
} else
{
strrValue = "待[" + name + "]办理";
}
return strrValue;
}
#endregion
/// <summary>
/// 根据主键获取安全许可证
/// </summary>