较大隐患整改汇总数指标推送集团
This commit is contained in:
@@ -103,6 +103,8 @@ namespace BLL
|
||||
LicensesCloseNum = newtable.LicensesCloseNum,
|
||||
GeneralClosedNum = newtable.GeneralClosedNum,
|
||||
GeneralNotClosedNum = newtable.GeneralNotClosedNum,
|
||||
LargerClosedNum = newtable.LargerClosedNum,
|
||||
LargerNotClosedNum = newtable.LargerNotClosedNum,
|
||||
MajorClosedNum = newtable.MajorClosedNum,
|
||||
MajorNotClosedNum = newtable.MajorNotClosedNum,
|
||||
GeneralRiskNum = newtable.GeneralRiskNum,
|
||||
@@ -194,6 +196,9 @@ namespace BLL
|
||||
item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum;
|
||||
item.GeneralRate = "";
|
||||
item.GeneralRiskNum = dataHsse.GeneralRiskNum;
|
||||
item.LargerClosedNum = dataHsse.LargerClosedNum;
|
||||
item.LargerNotClosedNum = dataHsse.LargerNotClosedNum;
|
||||
item.LargerRate = "";
|
||||
item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum;
|
||||
item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum;
|
||||
item.HighRiskNum = dataHsse.HighRiskNum;
|
||||
@@ -315,6 +320,9 @@ namespace BLL
|
||||
item.GeneralNotClosedNum = dataHsse.GeneralNotClosedNum;
|
||||
item.GeneralRate = "";
|
||||
item.GeneralRiskNum = dataHsse.GeneralRiskNum;
|
||||
item.LargerClosedNum = dataHsse.LargerClosedNum;
|
||||
item.LargerNotClosedNum = dataHsse.LargerNotClosedNum;
|
||||
item.LargerRate = "";
|
||||
item.HeadOfficeFullTimeNum = dataHsse.HeadOfficeFullTimeNum;
|
||||
item.HeadOfficeInspectorGeneralNum = dataHsse.HeadOfficeInspectorGeneralNum;
|
||||
item.HighRiskNum = dataHsse.HighRiskNum;
|
||||
@@ -527,6 +535,8 @@ namespace BLL
|
||||
LicensesCloseNum = projectData.Sum(x => x.LicensesCloseNum),
|
||||
GeneralClosedNum = projectData.Sum(x => x.GeneralClosedNum),
|
||||
GeneralNotClosedNum = projectData.Sum(x => x.GeneralNotClosedNum),
|
||||
LargerClosedNum = projectData.Sum(x => x.LargerClosedNum),
|
||||
LargerNotClosedNum = projectData.Sum(x => x.LargerNotClosedNum),
|
||||
MajorClosedNum = projectData.Sum(x => x.MajorClosedNum),
|
||||
MajorNotClosedNum = projectData.Sum(x => x.MajorNotClosedNum),
|
||||
GeneralRiskNum = projectData.Sum(x => x.GeneralRiskNum),
|
||||
@@ -630,6 +640,7 @@ namespace BLL
|
||||
var licensesTask = HSSEData_HSSEService.GetLicensesAsync();
|
||||
var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync();
|
||||
var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync();
|
||||
var largerHiddenRectificationOutputsTask = HSSEData_HSSEService.GetLargerHiddenRectificationOutputsAsync();
|
||||
var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync();
|
||||
|
||||
// 等待所有异步方法执行完成
|
||||
@@ -767,6 +778,7 @@ namespace BLL
|
||||
var licensesList = await licensesTask;
|
||||
var licensesCloseList = await licensesCloseTask;
|
||||
var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask;
|
||||
var largerHiddenRectificationOutputsList = await largerHiddenRectificationOutputsTask;
|
||||
var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask;
|
||||
|
||||
// 构造结果对象
|
||||
@@ -848,6 +860,8 @@ namespace BLL
|
||||
LicensesCloseNum = licensesCloseList.Count(),
|
||||
GeneralClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.RecNum),
|
||||
GeneralNotClosedNum = generalHiddenRectificationOutputsList.Sum(x => x.NoRecNum),
|
||||
LargerClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.RecNum),
|
||||
LargerNotClosedNum = largerHiddenRectificationOutputsList.Sum(x => x.NoRecNum),
|
||||
MajorClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.RecNum),
|
||||
MajorNotClosedNum = majorHiddenRectificationOutputsList.Sum(x => x.NoRecNum),
|
||||
LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum),
|
||||
@@ -878,6 +892,12 @@ namespace BLL
|
||||
g => g.Key,
|
||||
g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) }
|
||||
);
|
||||
var largerHiddenRectificationOutputsDict = largerHiddenRectificationOutputsList
|
||||
.GroupBy(x => x.ProjectId)
|
||||
.ToDictionary(
|
||||
g => g.Key,
|
||||
g => new { ClosedNum = g.Sum(x => x.RecNum), NotClosedNum = g.Sum(x => x.NoRecNum) }
|
||||
);
|
||||
var majorHiddenRectificationOutputsDict = majorHiddenRectificationOutputsList
|
||||
.GroupBy(x => x.ProjectId)
|
||||
.ToDictionary(
|
||||
@@ -921,6 +941,7 @@ namespace BLL
|
||||
foreach (var projectid in BeUnderConstructionList)
|
||||
{
|
||||
generalHiddenRectificationOutputsDict.TryGetValue(projectid, out var generalHiddenRectificationOutputs);
|
||||
largerHiddenRectificationOutputsDict.TryGetValue(projectid, out var largerHiddenRectificationOutputs);
|
||||
majorHiddenRectificationOutputsDict.TryGetValue(projectid, out var majorHiddenRectificationOutputs);
|
||||
securityRiskOutputDict.TryGetValue(projectid, out var securityRiskOutputs);
|
||||
largeEngineeringOutputsDict.TryGetValue(projectid, out var largeEngineeringOutputs);
|
||||
@@ -1000,6 +1021,8 @@ namespace BLL
|
||||
LicensesCloseNum = licensesCloseList.Count(x => x.ProjectId == projectid),
|
||||
GeneralClosedNum = generalHiddenRectificationOutputs?.ClosedNum ?? 0,
|
||||
GeneralNotClosedNum = generalHiddenRectificationOutputs?.NotClosedNum ?? 0,
|
||||
LargerClosedNum = largerHiddenRectificationOutputs?.ClosedNum ?? 0,
|
||||
LargerNotClosedNum = largerHiddenRectificationOutputs?.NotClosedNum ?? 0,
|
||||
MajorClosedNum = majorHiddenRectificationOutputs?.ClosedNum ?? 0,
|
||||
MajorNotClosedNum = majorHiddenRectificationOutputs?.NotClosedNum ?? 0,
|
||||
LowRiskNum = securityRiskOutputs?.LowRiskNum ?? 0,
|
||||
@@ -1124,6 +1147,8 @@ namespace BLL
|
||||
table.LicensesCloseNum = newtable.LicensesCloseNum;
|
||||
table.GeneralClosedNum = newtable.GeneralClosedNum;
|
||||
table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
|
||||
table.LargerClosedNum = newtable.LargerClosedNum;
|
||||
table.LargerNotClosedNum = newtable.LargerNotClosedNum;
|
||||
table.MajorClosedNum = newtable.MajorClosedNum;
|
||||
table.MajorNotClosedNum = newtable.MajorNotClosedNum;
|
||||
table.GeneralRiskNum = newtable.GeneralRiskNum;
|
||||
@@ -3949,7 +3974,6 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static List<Model.HiddenRectificationOutput> GetGeneralHiddenRectificationOutputs()
|
||||
{
|
||||
|
||||
var query = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup
|
||||
from y in yGroup.DefaultIfEmpty()
|
||||
@@ -3979,6 +4003,41 @@ namespace BLL
|
||||
return await Task.Run(GetGeneralHiddenRectificationOutputs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取较大隐患数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.HiddenRectificationOutput> GetLargerHiddenRectificationOutputs()
|
||||
{
|
||||
var query = (from x in Funs.DB.Base_Project
|
||||
join y in Funs.DB.HSSE_Hazard_HazardRegister on x.ProjectId equals y.ProjectId into yGroup
|
||||
from y in yGroup.DefaultIfEmpty()
|
||||
where BeUnderConstructionList.Contains(x.ProjectId) && y.ProblemTypes == "1" && y.Risk_Level == "较大事故隐患" && y.CheckTime > Const.DtmarkTime
|
||||
group y by new { x.ProjectId, x.ProjectName, x.ProjectCode } into gg
|
||||
select new HiddenRectificationOutput
|
||||
{
|
||||
ProjectId = gg.Key.ProjectId,
|
||||
ProjectName = gg.Key.ProjectName,
|
||||
ProjectCode = gg.Key.ProjectCode,
|
||||
ProNum = gg.Count(y => y.States != "4" && y.States != "-1"),
|
||||
RecNum = gg.Count(y => y.States == "3"),
|
||||
NoRecNum = gg.Count(y => y.States != "3" && y.States != "4" && y.States != "-1"),
|
||||
RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" :
|
||||
Math.Round(Convert.ToDecimal(gg.Count(y => y.States == "3") /
|
||||
gg.Count(y => y.States != "4" && y.States != "-1") * 100), 2, MidpointRounding.AwayFromZero).ToString()
|
||||
}).ToList();
|
||||
|
||||
foreach (var item in query)
|
||||
{
|
||||
item.RecRate = Math.Round(Convert.ToDecimal(item.RecRate), 2).ToString(); // 转换为字符串并格式化为两位小数
|
||||
}
|
||||
return query;
|
||||
}
|
||||
public static async Task<List<Model.HiddenRectificationOutput>> GetLargerHiddenRectificationOutputsAsync()
|
||||
{
|
||||
return await Task.Run(GetLargerHiddenRectificationOutputs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取重大隐患数据
|
||||
/// </summary>
|
||||
@@ -3997,7 +4056,7 @@ namespace BLL
|
||||
ProjectCode = gg.Key.ProjectCode,
|
||||
ProNum = gg.Count(y => y.States != "4" && y.States != "-1"),
|
||||
RecNum = gg.Count(y => y.States == "3"),
|
||||
NoRecNum = gg.Count(y => y.States != "3" && y.States != "-1"),
|
||||
NoRecNum = gg.Count(y => y.States != "3" && y.States != "4" && y.States != "-1"),
|
||||
RecRate = gg.Count(y => y.States != "4" && y.States != "-1") == 0 ? "0" :
|
||||
Math.Round((decimal)gg.Count(y => y.States == "3") /
|
||||
gg.Count(y => y.States != "4" && y.States != "-1") * 100, 2, MidpointRounding.AwayFromZero).ToString()
|
||||
@@ -4298,6 +4357,8 @@ namespace BLL
|
||||
x.LicensesCloseNum,
|
||||
x.GeneralClosedNum,
|
||||
x.GeneralNotClosedNum,
|
||||
x.LargerClosedNum,
|
||||
x.LargerNotClosedNum,
|
||||
x.MajorClosedNum,
|
||||
x.MajorNotClosedNum,
|
||||
x.GeneralRiskNum,
|
||||
|
||||
Reference in New Issue
Block a user