364 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			364 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using System.Threading.Tasks;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace BLL
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								   public static class DataStatisticsService
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 安全检查统计
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        ///  安全检查统计
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="projectId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="unitId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="startTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="endTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static List<Model.ChartAnalysisItem> GetCheckStatistics(string projectId, string unitId, DateTime? startTime, DateTime? endTime)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<Model.ChartAnalysisItem> GetCheckStatistics = new List<Model.ChartAnalysisItem>();
							 | 
						|||
| 
								 | 
							
								            var getProjects = ProjectService.GetProjectWorkList();
							 | 
						|||
| 
								 | 
							
								            if (projectId != Const._Null && !string.IsNullOrEmpty(projectId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                getProjects = getProjects.Where(x => x.ProjectId == projectId).ToList();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            foreach (var pitem in getProjects)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var getUnits = UnitService.GetUnitByProjectIdList(pitem.ProjectId);
							 | 
						|||
| 
								 | 
							
								                if (unitId != Const._Null && !string.IsNullOrEmpty(unitId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    getUnits = getUnits.Where(x => x.UnitId == unitId).ToList();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (var item in getUnits)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var getHazardRegister = from x in Funs.DB.HSSE_Hazard_HazardRegister
							 | 
						|||
| 
								 | 
							
								                                            where x.ProjectId == pitem.ProjectId && x.ResponsibleUnit == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                            && (x.States == "1" || x.States == "2" || x.States == "3")
							 | 
						|||
| 
								 | 
							
								                                            select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckTime >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckTime <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Model.ChartAnalysisItem newItem = new Model.ChartAnalysisItem
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        DataId = SQLHelper.GetNewID(),
							 | 
						|||
| 
								 | 
							
								                        DataAllName = pitem.ProjectName,
							 | 
						|||
| 
								 | 
							
								                        DataName = item.UnitName,
							 | 
						|||
| 
								 | 
							
								                    };
							 | 
						|||
| 
								 | 
							
								                    newItem.DataSumCount = getHazardRegister.Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount1 = getHazardRegister.Where(x => x.States == "1").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount2 = getHazardRegister.Where(x => x.States == "2").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount3 = getHazardRegister.Where(x => x.States == "3").Count();
							 | 
						|||
| 
								 | 
							
								                    GetCheckStatistics.Add(newItem);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return GetCheckStatistics;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 隐患整改单统计
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        ///  隐患整改单统计
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="projectId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="unitId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="startTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="endTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static List<Model.ChartAnalysisItem> RectifyNoticesStatistics(string projectId, string unitId, DateTime? startTime, DateTime? endTime)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<Model.ChartAnalysisItem> GetCheckStatistics = new List<Model.ChartAnalysisItem>();
							 | 
						|||
| 
								 | 
							
								            var getProjects = ProjectService.GetProjectWorkList();
							 | 
						|||
| 
								 | 
							
								            if (projectId != Const._Null && !string.IsNullOrEmpty(projectId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                getProjects = getProjects.Where(x => x.ProjectId == projectId).ToList();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            foreach (var pitem in getProjects)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var getUnits = UnitService.GetUnitByProjectIdList(pitem.ProjectId);
							 | 
						|||
| 
								 | 
							
								                if (unitId != Const._Null && !string.IsNullOrEmpty(unitId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    getUnits = getUnits.Where(x => x.UnitId == unitId).ToList();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (var item in getUnits)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var getHazardRegister = from x in Funs.DB.Check_RectifyNotices
							 | 
						|||
| 
								 | 
							
								                                            where x.ProjectId == pitem.ProjectId && x.UnitId == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                            && x.States != "0"
							 | 
						|||
| 
								 | 
							
								                                            select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckedDate >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckedDate <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Model.ChartAnalysisItem newItem = new Model.ChartAnalysisItem
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        DataId = SQLHelper.GetNewID(),
							 | 
						|||
| 
								 | 
							
								                        DataAllName = pitem.ProjectName,
							 | 
						|||
| 
								 | 
							
								                        DataName = item.UnitName,
							 | 
						|||
| 
								 | 
							
								                    };
							 | 
						|||
| 
								 | 
							
								                    newItem.DataSumCount = getHazardRegister.Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount1 = getHazardRegister.Where(x => x.States == "1").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount2 = getHazardRegister.Where(x => x.States == "2").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount3 = getHazardRegister.Where(x => x.States == "3").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount4 = getHazardRegister.Where(x => x.States == "4").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount5 = getHazardRegister.Where(x => x.States == "5").Count();
							 | 
						|||
| 
								 | 
							
								                    if (newItem.DataSumCount > 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        newItem.DataCountRate = (float)newItem.DataCount5 / (float)newItem.DataSumCount * 100;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        newItem.DataCountRate = 0;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    GetCheckStatistics.Add(newItem);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return GetCheckStatistics;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								    
							 | 
						|||
| 
								 | 
							
								        #region 隐患整改单统计
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        ///  隐患整改单统计
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="projectId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="unitId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="startTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="endTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static List<Model.ChartAnalysisItem> HazardRegisterStatistics(string projectId, string unitId, DateTime? startTime, DateTime? endTime)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<Model.ChartAnalysisItem> GetCheckStatistics = new List<Model.ChartAnalysisItem>();
							 | 
						|||
| 
								 | 
							
								            var getProjects = ProjectService.GetProjectWorkList();
							 | 
						|||
| 
								 | 
							
								            if (projectId != Const._Null && !string.IsNullOrEmpty(projectId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                getProjects = getProjects.Where(x => x.ProjectId == projectId).ToList();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            foreach (var pitem in getProjects)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var getUnits = UnitService.GetUnitByProjectIdUnitTypeList(pitem.ProjectId,Const.ProjectUnitType_2);
							 | 
						|||
| 
								 | 
							
								                if (unitId != Const._Null && !string.IsNullOrEmpty(unitId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    getUnits = getUnits.Where(x => x.UnitId == unitId).ToList();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (var item in getUnits)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var getHazardRegister = from x in Funs.DB.HSSE_Hazard_HazardRegister
							 | 
						|||
| 
								 | 
							
								                                            where x.States != "4" && x.ProblemTypes == "1"
							 | 
						|||
| 
								 | 
							
								                                            where x.ProjectId == pitem.ProjectId && x.ResponsibleUnit == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                            
							 | 
						|||
| 
								 | 
							
								                                            select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckTime >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckTime <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Model.ChartAnalysisItem newItem = new Model.ChartAnalysisItem
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        DataId = SQLHelper.GetNewID(),
							 | 
						|||
| 
								 | 
							
								                        DataAllName = pitem.ProjectName,
							 | 
						|||
| 
								 | 
							
								                        DataName = item.UnitName,
							 | 
						|||
| 
								 | 
							
								                    };
							 | 
						|||
| 
								 | 
							
								                    newItem.DataSumCount = getHazardRegister.Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount1 = getHazardRegister.Where(x => x.States == "1").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount2 = getHazardRegister.Where(x => x.States == "2").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount3 = getHazardRegister.Where(x => x.States == "3").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataSumCount = newItem.DataCount1 + newItem.DataCount2 + newItem.DataCount3;
							 | 
						|||
| 
								 | 
							
								                    if (newItem.DataSumCount > 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        newItem.DataCountRate = (float)newItem.DataCount3 / (float)newItem.DataSumCount * 100;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        newItem.DataCountRate = 0;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    GetCheckStatistics.Add(newItem);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return GetCheckStatistics;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								        #region 隐患整改单统计
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        ///  隐患整改单统计
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="projectId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="unitId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="startTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="endTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static List<Model.ChartAnalysisItem> JoinCheckStatistics(string projectId, string unitId, DateTime? startTime, DateTime? endTime)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<Model.ChartAnalysisItem> GetCheckStatistics = new List<Model.ChartAnalysisItem>();
							 | 
						|||
| 
								 | 
							
								            var getProjects = ProjectService.GetProjectWorkList();
							 | 
						|||
| 
								 | 
							
								            if (projectId != Const._Null && !string.IsNullOrEmpty(projectId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                getProjects = getProjects.Where(x => x.ProjectId == projectId).ToList();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            foreach (var pitem in getProjects)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var getUnits = UnitService.GetUnitByProjectIdList(pitem.ProjectId);
							 | 
						|||
| 
								 | 
							
								                if (unitId != Const._Null && !string.IsNullOrEmpty(unitId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    getUnits = getUnits.Where(x => x.UnitId == unitId).ToList();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (var item in getUnits)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var getHazardRegister = from x in Funs.DB.View_Check_JointCheckDetail
							 | 
						|||
| 
								 | 
							
								                                            where x.ProjectId == pitem.ProjectId && x.UnitId == item.UnitId
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                                            select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckDate >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getHazardRegister = getHazardRegister.Where(x => x.CheckDate <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Model.ChartAnalysisItem newItem = new Model.ChartAnalysisItem
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        DataId = SQLHelper.GetNewID(),
							 | 
						|||
| 
								 | 
							
								                        DataAllName = pitem.ProjectName,
							 | 
						|||
| 
								 | 
							
								                        DataName = item.UnitName,
							 | 
						|||
| 
								 | 
							
								                    };
							 | 
						|||
| 
								 | 
							
								                    newItem.DataSumCount = getHazardRegister.Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount1 = getHazardRegister.Where(x =>( x.State == "3" &&x.CheckTypeStr== "质量巡检") || (x.State=="Z"&&x.CheckTypeStr!= "质量巡检")).Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount2 = getHazardRegister.Where(x => (x.State == "5" && x.CheckTypeStr == "质量巡检") || (x.State == "1" && x.CheckTypeStr != "质量巡检")).Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount3 = getHazardRegister.Where(x => (x.State == "7" && x.CheckTypeStr == "质量巡检") || (x.State == "6" && x.CheckTypeStr != "质量巡检")).Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataSumCount = newItem.DataCount1 + newItem.DataCount2 + newItem.DataCount3;
							 | 
						|||
| 
								 | 
							
								                    if (newItem.DataSumCount > 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        newItem.DataCountRate = (float)newItem.DataCount3 / (float)newItem.DataSumCount * 100;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        newItem.DataCountRate = 0;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    GetCheckStatistics.Add(newItem);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return GetCheckStatistics;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 安全会议统计
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        ///  安全会议统计
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="projectId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="unitId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="startTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="endTime"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static List<Model.ChartAnalysisItem> MeetStatistics(string projectId, string unitId, DateTime? startTime, DateTime? endTime)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<Model.ChartAnalysisItem> GetCheckStatistics = new List<Model.ChartAnalysisItem>();
							 | 
						|||
| 
								 | 
							
								            var getProjects = ProjectService.GetProjectWorkList();
							 | 
						|||
| 
								 | 
							
								            if (projectId != Const._Null && !string.IsNullOrEmpty(projectId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                getProjects = getProjects.Where(x => x.ProjectId == projectId).ToList();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            foreach (var pitem in getProjects)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var getUnits = UnitService.GetUnitByProjectIdList(pitem.ProjectId);
							 | 
						|||
| 
								 | 
							
								                if (unitId != Const._Null && !string.IsNullOrEmpty(unitId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    getUnits = getUnits.Where(x => x.UnitId == unitId).ToList();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (var item in getUnits)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.ChartAnalysisItem newItem = new Model.ChartAnalysisItem
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        DataId = SQLHelper.GetNewID(),
							 | 
						|||
| 
								 | 
							
								                        DataAllName = pitem.ProjectName,
							 | 
						|||
| 
								 | 
							
								                        DataName = item.UnitName,
							 | 
						|||
| 
								 | 
							
								                    };
							 | 
						|||
| 
								 | 
							
								                    ///班前会
							 | 
						|||
| 
								 | 
							
								                    var getClassMeeting = from x in Funs.DB.Meeting_ClassMeeting
							 | 
						|||
| 
								 | 
							
								                                          where x.ProjectId == pitem.ProjectId && x.UnitId == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                          select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getClassMeeting = getClassMeeting.Where(x => x.ClassMeetingDate >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getClassMeeting = getClassMeeting.Where(x => x.ClassMeetingDate <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    ////周例会
							 | 
						|||
| 
								 | 
							
								                    var getWeekMeeting = from x in Funs.DB.Meeting_WeekMeeting
							 | 
						|||
| 
								 | 
							
								                                         where x.ProjectId == pitem.ProjectId && x.UnitId == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                         select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getWeekMeeting = getWeekMeeting.Where(x => x.WeekMeetingDate >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getWeekMeeting = getWeekMeeting.Where(x => x.WeekMeetingDate <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    ////月例会
							 | 
						|||
| 
								 | 
							
								                    var getMonthMeeting = from x in Funs.DB.Meeting_MonthMeeting
							 | 
						|||
| 
								 | 
							
								                                          where x.ProjectId == pitem.ProjectId && x.UnitId == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                          select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getMonthMeeting = getMonthMeeting.Where(x => x.MonthMeetingDate >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getMonthMeeting = getMonthMeeting.Where(x => x.MonthMeetingDate <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    ////专题会
							 | 
						|||
| 
								 | 
							
								                    var getSpecialMeeting = from x in Funs.DB.Meeting_SpecialMeeting
							 | 
						|||
| 
								 | 
							
								                                            where x.ProjectId == pitem.ProjectId && x.UnitId == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                            select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getSpecialMeeting = getSpecialMeeting.Where(x => x.SpecialMeetingDate >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getSpecialMeeting = getSpecialMeeting.Where(x => x.SpecialMeetingDate <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    ////其他会议
							 | 
						|||
| 
								 | 
							
								                    var getAttendMeeting = from x in Funs.DB.Meeting_AttendMeeting
							 | 
						|||
| 
								 | 
							
								                                           where x.ProjectId == pitem.ProjectId && x.UnitId == item.UnitId
							 | 
						|||
| 
								 | 
							
								                                           select x;
							 | 
						|||
| 
								 | 
							
								                    if (startTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getAttendMeeting = getAttendMeeting.Where(x => x.AttendMeetingDate >= startTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (endTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        getAttendMeeting = getAttendMeeting.Where(x => x.AttendMeetingDate <= endTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount1 = getClassMeeting.Where(x => x.States == "1").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount2 = getWeekMeeting.Where(x => x.States == "2").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount3 = getMonthMeeting.Where(x => x.States == "3").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount4 = getSpecialMeeting.Where(x => x.States == "4").Count();
							 | 
						|||
| 
								 | 
							
								                    newItem.DataCount5 = getAttendMeeting.Where(x => x.States == "5").Count();
							 | 
						|||
| 
								 | 
							
								                    GetCheckStatistics.Add(newItem);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return GetCheckStatistics;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |