Beispiel #1
0
        public int Add(StartProcessInput <AddRecordInput> input)
        {
            NullableHelper.SetNull(input.Data);
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}-{input.Data.RecordName}",
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }
            var record = input.Data.MapTo <Record>();

            record.ProcessInstanceId = processInstanceId;
            record.DataState         = DataState.Creating;
            record.Mid = null;
            _recordRepository.Add(record);
            var task = tasks[0];

            if (!input.PreventCommit)
            {
                _taskProvider.Complete(task.Id);
            }
            return(record.Id);
        }
Beispiel #2
0
        public int Add(StartProcessInput <AddProjectInput> input)
        {
            NullableHelper.SetNull(input.Data);
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}-{input.Data.Name}",
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }
            var project = input.Data.MapTo <Project>();
            var count   = ProjectContext.Instance.GetProjectBaseInfoNoCount(() => _projectRepository.Count(u => u.CreateTime.Value.Year == DateTime.Now.Year && (u.DataState == DataState.Stable || u.DataState == DataState.Creating)));

            project.ProcessInstanceId = processInstanceId;
            project.DataState         = DataState.Creating;
            project.No  = $"{DateTime.Now.Year}{count.ToString("0000")}";
            project.Mid = null;
            _projectRepository.Add(project);
            var task = tasks[0];

            if (!input.PreventCommit)
            {
                _taskProvider.Complete(task.Id);
            }
            return(project.Id);
        }
Beispiel #3
0
        public int Add(StartProcessInput <AddConstructionUnitInput> input)
        {
            if (input.Data.Name == null)
            {
                throw new AppCoreException("单位名称不能为空");
            }
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}-{input.Data.Name}",
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }
            var constructionUnit = input.Data.MapTo <ConstructionUnit>();

            // var count = AppSampleContext.Instance.GetSupplierNoCount(() => _supplierRepository.Count(u => u.CreateTime.Value.Year == DateTime.Now.Year && (u.State == DataState.Stable || u.State == DataState.Creating)));
            constructionUnit.ProcessInstanceId = processInstanceId;
            constructionUnit.State             = DataState.Creating;
            // constructionUnit.SupplierNo = $"{DateTime.Now.Year}{count.ToString("000000")}";
            constructionUnit.Mid = null;
            _constructionUnitRepository.Add(constructionUnit);
            var task = tasks[0];

            _taskProvider.Complete(task.Id);
            return(constructionUnit.Id);
        }
Beispiel #4
0
        public int Add(AddSafetyStandardInput input)
        {
            var standard = input.MapTo <SafetyStandard>();

            _standardRepository.Add(standard);
            return(standard.Id);
        }
Beispiel #5
0
        public int Add(AddMonthlyPlanInput input)
        {
            var userId = _authInfoProvider.GetCurrent().User.Id;

            if (!_projectHelper.HasPermission("项目计划负责人", input.ProjectId))//权限设置
            {
                throw new AppCoreException("月计划发布没有权限");
            }
            var plan = input.MapTo <MonthlyPlan>();

            if (plan.RecordDate == null)
            {
                throw new AppCoreException("传入数据的RecordTime不能为空");
            }
            if (plan.ProjectId == 0)
            {
                throw new AppCoreException("传入数据的ProjectId不能为空");
            }
            if (_planRepository.Count(u => u.ProjectId == plan.ProjectId && u.RecordDate == plan.RecordDate) > 0)
            {
                throw new EntityException("RecordDate", plan.RecordDate.ToString("y"), "InvestmentMonthlyPlan", "已存在");
            }
            _planRepository.Add(plan);
            return(plan.Id);
        }
Beispiel #6
0
        public int AddRectification(int problemId, AddQualityProblemRectificationInput input)
        {
            var existing      = _problemRepository.Get().Where(u => u.Id == problemId).FirstOrDefault();
            var rectification = input.MapTo <QualityProblemRectification>();

            rectification.QualityProblemId = problemId;
            using (var transaction = _dbContextProvider.BeginTransaction())
            {
                _problemRepository.Update(
                    new QualityProblem
                {
                    Id = problemId,
                    RectificationState = RectificationState.Underway,
                    CompletionTime     = null
                },
                    new System.Linq.Expressions.Expression <Func <QualityProblem, object> >[] {
                    u => u.RectificationState,
                    u => u.CompletionTime
                });
                _rectificationRepository.Add(rectification);
                transaction.Commit();
            }
            AppBaseContext.Instance.Produce("add-project-briefing", JsonConvert.SerializeObject(new
            {
                TenantId  = _op.TenantId,
                ProjectId = existing.ProjectId
            }));
            return(rectification.Id);
        }
Beispiel #7
0
        public int Add(AddCalendarInput input)
        {
            var calendar = input.MapTo <Calendar>();

            _calendarRepository.Add(calendar);
            return(calendar.Id);
        }
Beispiel #8
0
        public int AddDisposal(int accidentId, AddQualityAccidentDisposalInput disposalInput)
        {
            var existing = _accidentRepository.Get().Where(u => u.Id == accidentId).FirstOrDefault();
            var disposal = disposalInput.MapTo <QualityAccidentDisposal>();

            disposal.QualityAccidentId = accidentId;
            using (var transaction = _dbContextProvider.BeginTransaction())
            {
                _accidentRepository.Update(new QualityAccident
                {
                    Id             = accidentId,
                    DisposalState  = DisposalState.Underway,
                    SettlementTime = null
                },
                                           new System.Linq.Expressions.Expression <Func <QualityAccident, object> >[] {
                    u => u.DisposalState,
                    u => u.SettlementTime
                });
                _disposalRepository.Add(disposal);
                transaction.Commit();
            }
            AppBaseContext.Instance.Produce("add-project-briefing", JsonConvert.SerializeObject(new
            {
                TenantId  = _op.TenantId,
                ProjectId = existing.ProjectId
            }));
            return(disposal.Id);
        }
Beispiel #9
0
        public int AddByProject(int projectId)
        {
            var gantt = new ProjectGantt {
                ProjectId = projectId
            };

            _taskRepository.Add(gantt);
            return(gantt.Id);
        }
Beispiel #10
0
        public int Add(StartProcessInput <AddWeeklyProgressInput> input)
        {
            NullableHelper.SetNull(input.Data);
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            if (!_projectHelper.HasPermission("进度填报负责人", input.Data.ProjectId))
            {
                throw new AppCoreException("进度填报没有权限");
            }

            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}-{input.Data.AddDate}",
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }
            var progress = input.Data.MapTo <WeeklyProgress>();

            if (progress.ProjectId == 0)
            {
                throw new AppCoreException("传入数据的ProjectId不能为空");
            }
            //if(_progressRepository.Count(u=>u.ProjectId == progress.ProjectId && u.Week == progress.Week && u.Year == progress.Year) > 0)
            //{
            //    throw new EntityException("Week", progress.Week, "PmWeeklyReport", "已存在");
            //}
            progress.ProcessInstanceId = processInstanceId;
            progress.DataState         = DataState.Creating;
            progress.Mid = null;
            _progressRepository.Add(progress);
            var task = tasks[0];

            if (!input.PreventCommit)
            {
                _taskProvider.Complete(task.Id);
            }
            return(progress.Id);
        }
Beispiel #11
0
        public int Add(StartProcessInput <AddHousekeepingProblemInput> input)
        {
            if (input.Data.ProjectId == 0)
            {
                throw new AppCoreException("文明施工所在项目不能为0");
            }
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            // var list = _projectRepository.Get().Where(u => u.Id == input.Data.ProjectId).SelectMany(u => u.Members).Where(u => u.ProjectRole == "文明施工负责人").Select(u => u.UserId).ToList();
            if (!_projectHelper.HasPermission("文明施工负责人", input.Data.ProjectId))//权限设置
            {
                throw new AppCoreException("文明施工发布没有权限");
            }
            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}-{input.Data.Content}",
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }
            var problem = input.Data.MapTo <HousekeepingProblem>();

            // var count = AppSampleContext.Instance.GetSupplierNoCount(() => _supplierRepository.Count(u => u.CreateTime.Value.Year == DateTime.Now.Year && (u.State == DataState.Stable || u.State == DataState.Creating)));
            problem.ProcessInstanceId = processInstanceId;
            problem.State             = DataState.Creating;
            // memorabiliaRecord.SupplierNo = $"{DateTime.Now.Year}{count.ToString("000000")}";
            problem.Mid = null;
            _problemRepository.Add(problem);
            var task = tasks[0];

            if (!input.PreventCommit)
            {
                _taskProvider.Complete(task.Id);
            }
            return(problem.Id);
        }
Beispiel #12
0
        public int Add(StartProcessInput <AddContractPaymentInput> input)
        {
            if (input.Data.ContractId == 0)
            {
                throw new AppCoreException("合同id不能为0");
            }
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}",//-{input.Data.Title}
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }

            var contractPayment = input.Data.MapTo <ContractPayment>();

            // var count = AppSampleContext.Instance.GetSupplierNoCount(() => _supplierRepository.Count(u => u.CreateTime.Value.Year == DateTime.Now.Year && (u.State == DataState.Stable || u.State == DataState.Creating)));
            contractPayment.ProcessInstanceId = processInstanceId;
            contractPayment.State             = DataState.Creating;
            // memorabiliaRecord.SupplierNo = $"{DateTime.Now.Year}{count.ToString("000000")}";
            var paymentNumberPrefix = $"CP{DateTime.Now.ToString("yyyyMMdd")}";
            var count = _contractPaymentRepository.Count(u => u.PaymentNumber.Contains(paymentNumberPrefix) && (u.State == DataState.Stable || u.State == DataState.Creating));

            contractPayment.PaymentNumber = $"{paymentNumberPrefix}{count.ToString("00")}";
            contractPayment.Mid           = null;
            _contractPaymentRepository.Add(contractPayment);
            var task = tasks[0];

            if (!input.PreventCommit)
            {
                _taskProvider.Complete(task.Id);
            }
            return(contractPayment.Id);
        }
Beispiel #13
0
        public int Add(StartProcessInput <AddQualityProblemInput> input)
        {
            if (input.Data.Source == null)
            {
                throw new AppCoreException("质量问题来源不能为空");
            }
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            if (!_projectHelper.HasPermission("质量信息负责人", input.Data.ProjectId))//权限设置
            {
                throw new AppCoreException("质量问题发布没有权限");
            }
            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}-{input.Data.Source}",
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }
            var qualityProblem = input.Data.MapTo <QualityProblem>();

            // var count = AppSampleContext.Instance.GetSupplierNoCount(() => _supplierRepository.Count(u => u.CreateTime.Value.Year == DateTime.Now.Year && (u.State == DataState.Stable || u.State == DataState.Creating)));
            qualityProblem.ProcessInstanceId = processInstanceId;
            qualityProblem.State             = DataState.Creating;
            // memorabiliaRecord.SupplierNo = $"{DateTime.Now.Year}{count.ToString("000000")}";
            qualityProblem.Mid = null;
            _problemRepository.Add(qualityProblem);
            var task = tasks[0];

            if (!input.PreventCommit)
            {
                _taskProvider.Complete(task.Id);
            }
            return(qualityProblem.Id);
        }
Beispiel #14
0
        public int Add(AddProjectLinkInput input)
        {
            var projectId = _ganttRepository.Get().Where(u => u.Id == input.GanttId).Select(u => u.ProjectId).FirstOrDefault();
            var list      = _projectRepository.Get().Where(u => u.Id == projectId).SelectMany(u => u.Members).Where(u => u.ProjectRole == "项目进度负责人").Select(u => u.UserId).ToList();

            if (_projectHelper.HasPermission("项目进度负责人", projectId))
            {
                throw new AppCoreException("项目进度没有权限");
            }
            var link = input.MapTo <ProjectLink>();

            _linkRepository.Add(link);
            return(link.Id);
        }
Beispiel #15
0
        public int Add(StartProcessInput <AddEarlyStageInput> input)
        {
            if (input.Data.ReplyNumber == null)
            {
                throw new AppCoreException("批复文号不能为空");
            }
            var variables = new Dictionary <string, object>();
            var userId    = _authInfoProvider.GetCurrent().User.Id;

            variables.Add("starter", userId.ToString());
            int processInstanceId = _runtimeProvider.StartProcessInstanceByName(
                input.ProcessDefinitionName,
                $"{input.ProcessDefinitionName}-{input.Data.ReplyNumber}",
                variables);
            var tasks = _taskProvider.GetByProcessInstance(processInstanceId);

            if (tasks.Count == 0)
            {
                throw new AppCoreException("任务未创建成功!");
            }
            var earlyStage = input.Data.MapTo <EarlyStage>();

            // var count = AppSampleContext.Instance.GetSupplierNoCount(() => _supplierRepository.Count(u => u.CreateTime.Value.Year == DateTime.Now.Year && (u.State == DataState.Stable || u.State == DataState.Creating)));
            earlyStage.ProcessInstanceId = processInstanceId;
            earlyStage.State             = DataState.Creating;
            // memorabiliaRecord.SupplierNo = $"{DateTime.Now.Year}{count.ToString("000000")}";
            earlyStage.Mid = null;
            _earlyStageRepository.Add(earlyStage);
            var task = tasks[0];

            if (!input.PreventCommit)
            {
                _taskProvider.Complete(task.Id);
            }
            return(earlyStage.Id);
        }
Beispiel #16
0
        public int Add(AddProjectTaskInput input)
        {
            var projectId = _ganttRepository.Get().Where(u => u.Id == input.GanttId).Select(u => u.ProjectId).FirstOrDefault();

            if (!_projectHelper.HasPermission("项目进度负责人", projectId))
            {
                throw new AppCoreException("项目进度没有权限");
            }

            var task      = input.MapTo <ProjectTask>();
            int maxSortId = _projectTaskRepository.Get().Where(u => u.GanttId == task.GanttId).Select(u => u.SortNo).DefaultIfEmpty().Max();

            task.SortNo = maxSortId + 1;
            _projectTaskRepository.Add(task);
            return(task.Id);
        }
Beispiel #17
0
        public int AddCoordination(int problemId, AddProblemCoordinationInput input)
        {
            var rectification = input.MapTo <ProblemCoordination>();

            rectification.ProblemId = problemId;
            using (var transaction = _dbContextProvider.BeginTransaction())
            {
                _problemRepository.Update(
                    new Problem
                {
                    Id = problemId,
                    CoordinationState    = CoordinationState.Underway,
                    ActualCompletionTime = null
                },
                    new System.Linq.Expressions.Expression <Func <Problem, object> >[] { u => u.CoordinationState, u => u.ActualCompletionTime });
                _coordinationRepository.Add(rectification);
                transaction.Commit();
            }
            return(rectification.Id);
        }
Beispiel #18
0
        public int AddRectification(int problemId, AddHousekeepingProblemRectificationInput input)
        {
            var rectification = input.MapTo <HousekeepingProblemRectification>();

            rectification.HousekeepingProblemId = problemId;

            using (var transaction = _dbContextProvider.BeginTransaction())
            {
                _problemRepository.Update(
                    new HousekeepingProblem
                {
                    Id = problemId,
                    RectificationState = RectificationState.Underway,
                    CompletionTime     = null
                },
                    new System.Linq.Expressions.Expression <Func <HousekeepingProblem, object> >[] { u => u.RectificationState, u => u.CompletionTime });
                _rectificationRepository.Add(rectification);
                transaction.Commit();
            }
            return(rectification.Id);
        }
Beispiel #19
0
        public void CompleteProcess(int processInstanceId)
        {
            var project = _projectRepository.Get()
                          .Include(u => u.Location)
                          .Include(u => u.Members)
                          .Include(u => u.Units).ThenInclude(u => u.Members)
                          .Include(u => u.Attachments)
                          .Where(u => u.ProcessInstanceId == processInstanceId).FirstOrDefault();

            if (project == null)
            {
                throw new EntityException("ProjectInstanceId", processInstanceId, "Project", "不存在");
            }
            if (project.DataState == DataState.Creating)
            {
                //project.State = DataState.Stable;
                //_projectBaseInfoRepository.Update(project, new System.Linq.Expressions.Expression<Func<ProjectBaseInfo, object>>[] {
                //    u => u.State
                //}, true);
                //using (var transaction = _dbContextProvider.BeginTransaction())
                //{

                var temp = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project));
                temp.DataState         = DataState.Stable;
                temp.ProcessInstanceId = null;
                _projectRepository.Update(temp, new System.Linq.Expressions.Expression <Func <Project, object> >[] {
                    u => u.DataState,
                    u => u.ProcessInstanceId
                }, true);

                temp = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project));
                temp.Attachments.ForEach(u => u.Id = 0);
                temp.Members.ForEach(u => u.Id     = 0);
                temp.Units.ForEach(u =>
                {
                    u.Id = 0;
                    u.Members.ForEach(v => v.Id = 0);
                });
                if (temp.Location != null)
                {
                    temp.Location.Id        = 0;
                    temp.Location.ProjectId = 0;
                }
                temp.DataState = DataState.Created;
                temp.Id        = 0;
                temp.Mid       = project.Id;
                _projectRepository.Add(temp);
                //    transaction.Commit();
                //}
            }
            else if (project.Mid != null && project.DataState == DataState.Updating)
            {
                using (var transaction = _dbContextProvider.BeginTransaction())
                {
                    var temp = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project));
                    temp.DataState = DataState.Updated;
                    _projectRepository.Update(temp, new System.Linq.Expressions.Expression <Func <Project, object> >[] {
                        u => u.DataState
                    }, true);
                    temp     = JsonConvert.DeserializeObject <Project>(JsonConvert.SerializeObject(project));
                    temp.Id  = project.Mid.Value;
                    temp.Mid = null;
                    temp.Attachments.ForEach(u => u.Id = 0);
                    temp.Members.ForEach(u => u.Id     = 0);
                    if (temp.Location != null)
                    {
                        temp.Location.Id = 0;
                    }
                    temp.Units.ForEach(u => {
                        u.Id = 0;
                        u.Members.ForEach(v => v.Id = 0);
                    });
                    var existing = _projectRepository.Get()
                                   .Include(u => u.Location)
                                   .Include(u => u.Members)
                                   .Include(u => u.Attachments)
                                   .Include(u => u.Units).ThenInclude(u => u.Members)
                                   .Where(u => u.Id == temp.Id).FirstOrDefault();
                    _projectRepository.Update(temp, existing, new System.Linq.Expressions.Expression <Func <Project, object> >[] {
                        u => u.ProcessInstanceId,
                        u => u.DataState,
                        u => u.No,
                        u => u.Units
                    }, false);
                    var addedUnits   = temp.Units.Except(existing.Units, u => u.Id).ToList();
                    var deletedUnits = existing.Units.Except(temp.Units, u => u.Id).ToList();
                    var updatedUnits = temp.Units.Intersect(existing.Units, u => u.Id).ToList();
                    foreach (var added in addedUnits)
                    {
                        _projectUnitRepository.Add(added);
                    }
                    foreach (var deleted in deletedUnits)
                    {
                        _projectUnitRepository.Delete(deleted);
                    }
                    foreach (var updated in updatedUnits)
                    {
                        var existed = existing.Units.Where(u => u.Id == updated.Id).FirstOrDefault();
                        _projectUnitRepository.Update(updated, existed, new Expression <Func <ProjectUnit, object> >[] { }, false);
                    }
                    transaction.Commit();
                }
            }
            else
            {
                throw new AppCoreException("当前数据不再更新状态");
            }
        }
Beispiel #20
0
        public int AddNew(int tenantId, int projectId)
        {
            if (projectId == 0)
            {
                throw new EntityException("Id", projectId, "Project", "不存在");
            }
            var             count          = _briefingRepository.Count(u => u.ProjectId == projectId);
            ProjectBriefing briefing       = new ProjectBriefing();
            var             weeklyProgress = _progressRepository.Get().Where(u => u.ProjectId == projectId && u.DataState == DataState.Stable).OrderByDescending(u => u.CreateTime).FirstOrDefault();

            if (weeklyProgress != null)
            {
                briefing.CumulativeImageProgress = weeklyProgress.AccumulatedImageProgress;
                briefing.NextWeekProgressPlan    = weeklyProgress.NextMonthPlannedImageProgress;
                briefing.Supervision             = weeklyProgress.Supervision;
                briefing.ThisWeekProgress        = weeklyProgress.ImageProgress;
                briefing.Information             = weeklyProgress.Information;
                briefing.ProgressLimitDate       = $"{weeklyProgress.AddDate}";
            }
            //存在问题统计
            var problems = _problemRepository.Get()
                           .Where(u => u.ProjectId == projectId && u.State == DataState.Stable && u.CoordinationState != CoordinationState.Completed)
                           .OrderBy(u => u.CreateTime).ToList();
            var list = problems.Select(u => new { problem = u.Content, Solution = u.ProposalSolution }).ToList();

            briefing.ProblemAndSolution = JsonConvert.SerializeObject(list);
            //质量问题统计
            var qualityProblem = _qualityProblemRepository.Get()
                                 .Include(u => u.Rectifications)
                                 .Where(u => u.ProjectId == projectId && u.State == DataState.Stable)// && u.RectificationState != RectificationState.Completed
                                 .OrderBy(u => u.CreateTime).ToList();
            var listProblem = qualityProblem.Select(u => new { QualityId = u.Id, Source = u.Source, RectificationState = u.RectificationState.GetDesc(), Description = u.Description, Scheme = u.Rectifications.Count == 0?null: u.Rectifications.Select(s => s.Description).ToList() }).ToList();

            briefing.QualitySourceAndDescription = JsonConvert.SerializeObject(listProblem);
            //质量事故统计
            var qualityAccident = _qualityAccidentRepository.Get()
                                  .Include(u => u.Disposals)
                                  .Where(u => u.ProjectId == projectId && u.State == DataState.Stable)// && u.RectificationState != RectificationState.Completed
                                  .OrderBy(u => u.CreateTime).ToList();
            var listAccident = qualityAccident.Select(u => new { AccidentId = u.Id, Title = u.Title, DisposalState = u.DisposalState.GetDesc(), Content = u.Content, Scheme = u.Disposals.Count == 0 ? null : u.Disposals.Select(s => s.Plan).ToList() }).ToList();

            briefing.QualityAccidentAndDescription = JsonConvert.SerializeObject(listAccident);
            //安全问题统计
            var safetyProblem = _safetyProblemRepository.Get()
                                .Include(u => u.Source)
                                .Include(u => u.Rectifications)
                                .Where(u => u.ProjectId == projectId && u.State == DataState.Stable)// && u.RectificationState != Safety.SafetyProblemRectifications.RectificationState.Completed
                                .OrderBy(u => u.CreateTime).ToList();
            var listSafety = safetyProblem.Select(u => new { SafetyId = u.Id, Sources = u.Source?.Name, RectificationStates = u.RectificationState.GetDesc(), Descriptions = u.Description, Scheme = u.Rectifications.Count == 0 ? null : u.Rectifications.Select(s => s.Description).ToList() }).ToList();

            briefing.SafetySourceAndDescription = JsonConvert.SerializeObject(listSafety);
            //安全事故统计
            var safetyAccident = _safetyAccidentRepository.Get()
                                 .Include(u => u.Source)
                                 .Include(u => u.Disposals)
                                 .Where(u => u.ProjectId == projectId && u.State == DataState.Stable)// && u.RectificationState != Safety.SafetyProblemRectifications.RectificationState.Completed
                                 .OrderBy(u => u.CreateTime).ToList();
            var listSafetyAccident = safetyAccident.Select(u => new { SafetyAccidentId = u.Id, Titles = u.Title, DisposalStates = u.DisposalState.GetDesc(), Contents = u.Content, Scheme = u.Disposals.Count == 0 ? null : u.Disposals.Select(s => s.Solution).ToList() }).ToList();

            briefing.SafetyAccidentAndDescription = JsonConvert.SerializeObject(listSafetyAccident);
            //文明施工问题统计

            var housekeeping = _housekeepingRepository.Get()
                               .Where(u => u.ProjectId == projectId && u.State == DataState.Stable && u.RectificationState != Housekeeping.HousekeepingProblemRectifications.RectificationState.Completed)
                               .OrderBy(u => u.CreateTime).ToList();
            var listHousekeeping = housekeeping.Select(u => new { Content = u.Content }).ToList();

            briefing.HousekeepingConetent = JsonConvert.SerializeObject(listHousekeeping);
            briefing.Version   = ++count;
            briefing.ProjectId = projectId;
            briefing.TenantId  = tenantId;
            _briefingRepository.Add(briefing);
            return(briefing.Id);
        }