隐患整改完成情况
This commit is contained in:
parent
772b5fd3b9
commit
c08d233e51
@ -7,11 +7,14 @@ using APT.Infrastructure.Api.Redis;
|
|||||||
using APT.Infrastructure.Core;
|
using APT.Infrastructure.Core;
|
||||||
using APT.MS.Domain.Entities.BI;
|
using APT.MS.Domain.Entities.BI;
|
||||||
using APT.MS.Domain.Entities.HM;
|
using APT.MS.Domain.Entities.HM;
|
||||||
|
using APT.MS.Domain.Entities.SC.BI;
|
||||||
using APT.MS.Domain.Entities.SK;
|
using APT.MS.Domain.Entities.SK;
|
||||||
using APT.MS.Domain.Enums.SK;
|
using APT.MS.Domain.Enums.SK;
|
||||||
|
using APT.SC.WebApi.Controllers.Api.BIController;
|
||||||
using APT.Utility;
|
using APT.Utility;
|
||||||
using log4net.Core;
|
using log4net.Core;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Org.BouncyCastle.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -546,8 +549,8 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filter">过滤实体</param>
|
/// <param name="filter">过滤实体</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost, Route("GetHomeInfo")]
|
[HttpPost, Route("GetHomeInfoOld")]
|
||||||
public JsonActionResult<HomeResult> GetHomeInfo([FromBody] KeywordFilter filter)
|
public JsonActionResult<HomeResult> GetHomeInfoOld([FromBody] KeywordFilter filter)
|
||||||
{
|
{
|
||||||
return SafeExecute(() =>
|
return SafeExecute(() =>
|
||||||
{
|
{
|
||||||
@ -1232,6 +1235,436 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询所有数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">过滤实体</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost, Route("GetHomeInfo")]
|
||||||
|
public JsonActionResult<HomeResult> GetHomeInfo([FromBody] KeywordFilter filter)
|
||||||
|
{
|
||||||
|
return SafeExecute(() =>
|
||||||
|
{
|
||||||
|
//按生产单元 获取数据
|
||||||
|
HomeResult result = new HomeResult();
|
||||||
|
//if (string.IsNullOrEmpty(filter.Keyword))
|
||||||
|
//{
|
||||||
|
// return result;
|
||||||
|
//}
|
||||||
|
//int MineType = int.Parse(filter.Keyword);
|
||||||
|
|
||||||
|
|
||||||
|
//根据 日期 yyyyMMddHH MineType 获取信息 Redis信息
|
||||||
|
//如果是有效的直接返回 否则更新
|
||||||
|
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
|
||||||
|
var redisCode = string.Format(RedisCacheKey.HomeResult, orgId);
|
||||||
|
DateTime dtNow = DateTime.Now;
|
||||||
|
|
||||||
|
|
||||||
|
#region 判断 从Redis中获取数据 有就直接返回到前端 没有就按原来的进行搜索 最后再判断存入Redis中
|
||||||
|
|
||||||
|
bool isRedisConfig = true;
|
||||||
|
var redisConfig = APT.Infrastructure.Api.ConfigurationManager.AppSettings["RedisFormConfig"];
|
||||||
|
List<HomeResultMineType> listHomeRedis = null;
|
||||||
|
if (!string.IsNullOrEmpty(redisConfig))
|
||||||
|
isRedisConfig = bool.Parse(redisConfig);
|
||||||
|
|
||||||
|
if (isRedisConfig && CsRedisManager.KeyExists(redisCode))
|
||||||
|
listHomeRedis = CsRedisManager.StringGet<List<HomeResultMineType>>(redisCode);
|
||||||
|
|
||||||
|
if (listHomeRedis != null && listHomeRedis.Count() > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in listHomeRedis)
|
||||||
|
{
|
||||||
|
//if (item.MineType == MineType)
|
||||||
|
{
|
||||||
|
if (dtNow.ToString("yyyyMMddHH") == item.yyyyMMddHH)
|
||||||
|
{
|
||||||
|
result = item.result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listHomeRedis.Remove(item);//Key不匹配 过期数据删除
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//redis获取到了数据
|
||||||
|
//if (result != null && (result.ListC != null || result.ListCYear != null || result.ListSafeCheckYearMonth != null))
|
||||||
|
//{
|
||||||
|
// return result;
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Collection was modified, enumeration operation may not execute(foreach) 不要 SelectField 看看结果 如果继续报错 返回来
|
||||||
|
//TODO wyw SelectField
|
||||||
|
|
||||||
|
//BaseFilter filterD = new BaseFilter();
|
||||||
|
//filterD.SelectField = new List<string> { "ID", "NAME", "DEPARTMENT_TYPE", "PARENT_ID", "MineType" };
|
||||||
|
//var listDep1MineType = GetEntities<T_FM_DEPARTMENT>(t => t.MineType.HasValue && t.MineType == MineType && t.DEPARTMENT_TYPE == 10, filterD, null);//部门就可以了 因为都相向 统计了
|
||||||
|
|
||||||
|
var listDep1MineType = GetEntities<T_FM_DEPARTMENT>(t => t.ENABLE_STATUS == 0, null, null);//部门就可以了 因为都相向 统计了
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (listDep1MineType == null || !listDep1MineType.Any())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<T_FM_DEPARTMENT> listDep = new List<T_FM_DEPARTMENT>();
|
||||||
|
listDep = listDep1MineType.ToList();
|
||||||
|
|
||||||
|
|
||||||
|
#region //月度 隐患整改情况
|
||||||
|
string Val = string.Empty;// 0 ,1,2,3
|
||||||
|
//string NameMonth = dtNow.AddMonths(-5).Month.ToString() + "月," + dtNow.AddMonths(-4).Month.ToString() + "月," + dtNow.AddMonths(-3).Month.ToString() + "月," + dtNow.AddMonths(-2).Month.ToString() + "月," + dtNow.AddMonths(-1).Month.ToString() + "月," + dtNow.Month.ToString() + "月";
|
||||||
|
string NameMonth = dtNow.AddMonths(-5).ToString("yyyy-MM") + "," + dtNow.AddMonths(-4).ToString("yyyy-MM") + "," + dtNow.AddMonths(-3).ToString("yyyy-MM") + "," + dtNow.AddMonths(-2).ToString("yyyy-MM") + "," + dtNow.AddMonths(-1).ToString("yyyy-MM") + "," + dtNow.ToString("yyyy-MM");
|
||||||
|
List<HomeCorrect> listC = new List<HomeCorrect>();
|
||||||
|
//HomeCorrect modelC = null;
|
||||||
|
bool isNormal = true;//数据是否正常
|
||||||
|
var newFilter = new BaseFilter(orgId);
|
||||||
|
newFilter.IgnoreDataRule = true;
|
||||||
|
var hiddens = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>(e => e.APPLY_DEPARTMENT_ID.HasValue && e.CREATE_TIME.HasValue && e.CREATE_TIME.Value.Year == dtNow.Year, newFilter);
|
||||||
|
|
||||||
|
var startTime = dtNow.AddMonths(-6);
|
||||||
|
var currentTime = Convert.ToDateTime(startTime.Year + "-" + startTime.Month + "-01 00:00:00");
|
||||||
|
//var groupDepart = hiddens.GroupBy(t => t.APPLY_DEPARTMENT_ID);
|
||||||
|
//if (groupDepart.Any())
|
||||||
|
{
|
||||||
|
//foreach (var item in groupDepart)
|
||||||
|
{
|
||||||
|
for (DateTime i = currentTime; i <= dtNow; i = i.AddMonths(1))
|
||||||
|
{
|
||||||
|
var monthStart = Convert.ToDateTime(i.Year + "-" + i.Month + "-01 00:00:00");
|
||||||
|
var monthEnd = Convert.ToDateTime(monthStart.AddMonths(1).AddDays(-1).ToString().Replace("0:00:00", "23:59:59"));
|
||||||
|
if (i.Date <= startTime.Date)
|
||||||
|
{
|
||||||
|
monthStart = startTime;
|
||||||
|
}
|
||||||
|
if (i.Date >= dtNow.Date)
|
||||||
|
{
|
||||||
|
monthEnd = dtNow;
|
||||||
|
}
|
||||||
|
var alls = hiddens.Where(t => t.CREATE_TIME >= monthStart && t.CREATE_TIME <= monthEnd);
|
||||||
|
var onTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE <= t.RECITIFY_TIME);
|
||||||
|
if (onTimes.Any())
|
||||||
|
{
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = onTimes.Count().ToString();
|
||||||
|
modelC.SOURCENAME = "按时整改隐患";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = "0";
|
||||||
|
modelC.SOURCENAME = "按时整改隐患";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
var overTimes = alls.Where(t => t.STATUS == BaseData.Domain.Enums.PF.PFStandardStatus.Archived && t.COMPLETE_DATE > t.RECITIFY_TIME);
|
||||||
|
if (overTimes.Any())
|
||||||
|
{
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = overTimes.Count().ToString();
|
||||||
|
modelC.SOURCENAME = "超期整改隐患";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = "0";
|
||||||
|
modelC.SOURCENAME = "超期整改隐患";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
var noTimes = alls.Where(t => t.STATUS != BaseData.Domain.Enums.PF.PFStandardStatus.Archived);
|
||||||
|
if (noTimes.Any())
|
||||||
|
{
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = noTimes.Count().ToString();
|
||||||
|
modelC.SOURCENAME = "未整改隐患";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = "0";
|
||||||
|
modelC.SOURCENAME = "未整改隐患";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
if (alls.Any())
|
||||||
|
{
|
||||||
|
var val = onTimes.Count() + overTimes.Count();
|
||||||
|
var count = alls.Count();
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = count == 0 ?"0":((decimal)Math.Round(100.00 * val / count, 2)).ToString();
|
||||||
|
modelC.SOURCENAME = "隐患整改率";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = "0";
|
||||||
|
modelC.SOURCENAME = "隐患整改率";
|
||||||
|
//modelC.DEPARTMENT_ID = (Guid)item.Key;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key)?.NAME;
|
||||||
|
modelC.YEAR = monthStart.Year;
|
||||||
|
modelC.NAME = monthStart.ToString("yyyy-MM");
|
||||||
|
listC.Add(modelC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<HomeCorrect> listC2 = new List<HomeCorrect>();
|
||||||
|
if (listC.Any())
|
||||||
|
{
|
||||||
|
var groupList = listC.GroupBy(t => new { t.SOURCENAME });
|
||||||
|
if (groupList.Any())
|
||||||
|
{
|
||||||
|
foreach (var item in groupList)
|
||||||
|
{
|
||||||
|
var vals = listC.Where(t => t.SOURCENAME == item.Key.SOURCENAME).OrderBy(m => m.NAME).Select(n => n.Val).ToList();
|
||||||
|
var names = listC.Where(t => t.SOURCENAME == item.Key.SOURCENAME).OrderBy(m => m.NAME).Select(n => n.NAME).ToList();
|
||||||
|
HomeCorrect modelC = new HomeCorrect();
|
||||||
|
modelC.Val = string.Join(",", vals);
|
||||||
|
modelC.SOURCENAME = item.Key.SOURCENAME;
|
||||||
|
//modelC.DEPARTMENT_ID = item.Key.DEPARTMENT_ID;
|
||||||
|
//modelC.DEPARTMENTNAME = listDep.FirstOrDefault(t => t.ID == item.Key.DEPARTMENT_ID)?.NAME;
|
||||||
|
modelC.YEAR = dtNow.Year;
|
||||||
|
modelC.NAME = string.Join(",", names);
|
||||||
|
listC2.Add(modelC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ListC = listC2;
|
||||||
|
|
||||||
|
#region 组织合并
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 年度 各下属组织 隐患整改情况
|
||||||
|
|
||||||
|
List<T_BI_HOME_BSRISKREASON> listReasonYearT = BIHomeService.GetHomeCorrectYear(filter.OrgId, listDep).ToList();
|
||||||
|
List<HomeCorrectYear> ListCYear = new List<HomeCorrectYear>();
|
||||||
|
HomeCorrectYear modelCY = null;
|
||||||
|
int CountYearT = listReasonYearT.Count;
|
||||||
|
for (int i = 0; i < CountYearT; i++)
|
||||||
|
{
|
||||||
|
if (i == 0 || listReasonYearT[i].DEPARTMENT_ID != listReasonYearT[i - 1].DEPARTMENT_ID)
|
||||||
|
{
|
||||||
|
modelCY = new HomeCorrectYear();
|
||||||
|
modelCY.DEPARTMENTNAME = listReasonYearT[i].DEPARTMENTNAME;
|
||||||
|
modelCY.DEPARTMENT_ID = listReasonYearT[i].DEPARTMENT_ID;
|
||||||
|
modelCY.YEAR = listReasonYearT[i].YEAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按时整改隐患 5 超期整改隐患 10 未整改隐患 15
|
||||||
|
if (listReasonYearT[i].SOURCEVAL == 5)
|
||||||
|
{
|
||||||
|
modelCY.CountIn += listReasonYearT[i].COUNT;
|
||||||
|
}
|
||||||
|
else if (listReasonYearT[i].SOURCEVAL == 10)
|
||||||
|
{
|
||||||
|
modelCY.CountOut += listReasonYearT[i].COUNT;
|
||||||
|
}
|
||||||
|
else if (listReasonYearT[i].SOURCEVAL == 15)
|
||||||
|
{
|
||||||
|
modelCY.CountNot += listReasonYearT[i].COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == CountYearT - 1 || listReasonYearT[i].DEPARTMENT_ID != listReasonYearT[i + 1].DEPARTMENT_ID)
|
||||||
|
{
|
||||||
|
modelCY.Count = modelCY.CountIn + modelCY.CountOut + modelCY.CountNot;
|
||||||
|
ListCYear.Add(modelCY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ListCYear = ListCYear;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 月度 6 个月 安全检查、检查类型 数量
|
||||||
|
|
||||||
|
//按生产单元 获取
|
||||||
|
|
||||||
|
//if (!string.IsNullOrEmpty(filter.Keyword))
|
||||||
|
{
|
||||||
|
//int MineType = int.Parse(filter.Keyword.ToString());
|
||||||
|
//BaseFilter filterD = new BaseFilter();
|
||||||
|
//filterD.SelectField = new List<string> { "ID", "NAME", "DEPARTMENT_TYPE", "PARENT_ID" };
|
||||||
|
|
||||||
|
//var listDep1MineType = GetEntities<T_FM_DEPARTMENT>(t => t.MineType.HasValue && t.MineType == MineType && t.DEPARTMENT_TYPE == 10, filterD, null);//部门就可以了 因为都相向 统计了
|
||||||
|
if (listDep != null && listDep.Any())
|
||||||
|
{
|
||||||
|
List<HomeSafeCheckCountMonth> ListSafeCheckYearMonth = new List<HomeSafeCheckCountMonth>();
|
||||||
|
int befoMonth = 12;
|
||||||
|
List<T_BI_HOME_BSRISKREASON> ListSafeCheckYearMonthT = BIHomeService.GetHomeCheckCountMonth(filter.OrgId, listDep.ToList(), befoMonth).ToList();
|
||||||
|
//var listCheckTypeIDT = ListSafeCheckYearMonthT.Select(e => e.SOURCEID).Distinct().ToList();
|
||||||
|
|
||||||
|
//var enums = GetEntity<T_FM_ENUMS>(e => e.VALUE == MineType && e.CODE == "BSMineTypeEnum");
|
||||||
|
//if (enums != null)
|
||||||
|
//{
|
||||||
|
// var listTypeMine = GetEntities<MS.Domain.Entities.SK.T_SK_CHECK_TYPE>(e => e.MineType == (SKProductionUnit)MineType, null, null);
|
||||||
|
// if (listTypeMine != null && listTypeMine.Any())
|
||||||
|
// {
|
||||||
|
// var listMineCheckTypeID = listTypeMine.Select(e => e.ID);
|
||||||
|
// for (int i = 0; i < listCheckTypeIDT.Count; i++)
|
||||||
|
// {
|
||||||
|
// if (!listMineCheckTypeID.Contains(listCheckTypeIDT[i]))
|
||||||
|
// {
|
||||||
|
// listCheckTypeIDT.RemoveAt(i);
|
||||||
|
// i--;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
var checkIds = ListSafeCheckYearMonthT.Select(t => t.SOURCEID).Distinct().ToList();
|
||||||
|
var loginDepart = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID);
|
||||||
|
var listCheckType = GetEntities<MS.Domain.Entities.SK.T_SK_CHECK_TYPE>(e => checkIds.Contains(e.ID), null, null).ToList();
|
||||||
|
if (loginDepart != null)
|
||||||
|
{
|
||||||
|
listCheckType = listCheckType.Where(t => t.PRODUCTION_UNIT_ID == loginDepart.PRODUCTION_UNIT_ID).ToList();
|
||||||
|
}
|
||||||
|
List<Guid> listCheckTypeID = new List<Guid>();
|
||||||
|
List<string> listCheckTypeNAME = new List<string>();
|
||||||
|
|
||||||
|
//Guid IDZH = Guid.Empty;//综合检查(只有一个)
|
||||||
|
//List<Guid> listGUID = new List<Guid>();//综合检查子集
|
||||||
|
for (int i = 0; i < listCheckType.Count; i++)
|
||||||
|
{
|
||||||
|
//if (listCheckType[i].PARENT_ID.HasValue || ((IDZH != Guid.Empty && IDZH == listCheckType[i].ID) || listCheckType[i].NAME == "综合检查"))
|
||||||
|
//{
|
||||||
|
// if (IDZH == Guid.Empty)
|
||||||
|
// {
|
||||||
|
// IDZH = listCheckType[i].PARENT_ID.HasValue ? listCheckType[i].PARENT_ID.Value : listCheckType[i].ID;
|
||||||
|
// listCheckTypeID.Add(IDZH);
|
||||||
|
// var checkTypeP = GetEntity<MS.Domain.Entities.BS.T_BS_CHECK_TYPE>(IDZH);
|
||||||
|
// listCheckTypeNAME.Add(checkTypeP.NAME);
|
||||||
|
// }
|
||||||
|
// listGUID.Add(listCheckType[i].ID);
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
{
|
||||||
|
listCheckTypeID.Add(listCheckType[i].ID);
|
||||||
|
listCheckTypeNAME.Add(listCheckType[i].NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int year = DateTime.Now.Year;
|
||||||
|
int Month = DateTime.Now.Month;
|
||||||
|
DateTime dtTemp = DateTime.Now;
|
||||||
|
IEnumerable<T_BI_HOME_BSRISKREASON> listPerChearch = null;
|
||||||
|
IEnumerable<T_BI_HOME_BSRISKREASON> listPerChearchPer = null;
|
||||||
|
|
||||||
|
//List<int> listListCount = null;
|
||||||
|
for (int i = 0; i < befoMonth; i++)
|
||||||
|
{
|
||||||
|
dtTemp = dtNow.AddMonths(-1 * i);
|
||||||
|
year = dtTemp.Year;
|
||||||
|
Month = dtTemp.Month;
|
||||||
|
listPerChearch = ListSafeCheckYearMonthT.Where(e => e.YEAR == year && e.MONTH == Month);
|
||||||
|
HomeSafeCheckCountMonth modelper = new HomeSafeCheckCountMonth();
|
||||||
|
modelper.Total = listPerChearch.Count();
|
||||||
|
modelper.listSOURCENAME = listCheckTypeNAME;
|
||||||
|
modelper.YEAR = year;
|
||||||
|
modelper.MONTH = Month;
|
||||||
|
List<int> listListCount = new List<int>();
|
||||||
|
|
||||||
|
for (int j = 0; j < listCheckTypeID.Count; j++)
|
||||||
|
{
|
||||||
|
//if (listCheckTypeID[j] != IDZH)
|
||||||
|
{
|
||||||
|
listPerChearchPer = listPerChearch.Where(e => e.YEAR == year && e.MONTH == Month && e.SOURCEID == listCheckTypeID[j]);//各个检查
|
||||||
|
}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// listPerChearchPer = listPerChearch.Where(e => e.YEAR == year && e.MONTH == Month && listGUID.Contains(e.SOURCEID));//综合检查
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (listPerChearchPer == null || !listPerChearchPer.Any())
|
||||||
|
{
|
||||||
|
listListCount.Add(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listListCount.Add(listPerChearchPer.Sum(e => e.COUNT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
modelper.listListCount = listListCount;
|
||||||
|
ListSafeCheckYearMonth.Add(modelper);
|
||||||
|
}
|
||||||
|
result.ListSafeCheckYearMonth = ListSafeCheckYearMonth.OrderBy(e => e.YEAR).ThenBy(e => e.MONTH).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 搜索结果 判断存入Redis中
|
||||||
|
|
||||||
|
//if (isRedisConfig)
|
||||||
|
//{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// if (listHomeRedis == null)
|
||||||
|
// listHomeRedis = new List<HomeResultMineType>();
|
||||||
|
|
||||||
|
// listHomeRedis.Add(new HomeResultMineType()
|
||||||
|
// {
|
||||||
|
// //MineType = MineType,
|
||||||
|
// yyyyMMddHH = dtNow.ToString("yyyyMMddHH"),
|
||||||
|
// result = result
|
||||||
|
// });
|
||||||
|
|
||||||
|
// CsRedisManager.StringSet<List<HomeResultMineType>>(redisCode, listHomeRedis);
|
||||||
|
// }
|
||||||
|
// catch { }
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 首页 安全检查次数统计明细(BI054HomeDetail)
|
/// 首页 安全检查次数统计明细(BI054HomeDetail)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user