/// <summary> /// 导出评审详情 /// </summary> /// <param name="reviewRoundId"></param> /// <returns></returns> public virtual async Task <dynamic> ExportReviewRound(int reviewRoundId) { var manager = Manager as ReviewManager; var reviewdetail = await ReviewRoundRepository.GetAsync(reviewRoundId); var review = reviewdetail.Review; var sourceprojectids = reviewdetail.SourceProjectIDs; //对应项目的打分情况 var projectreviewsummarys = (await manager.GetProjectRanks(reviewdetail)).Where(o => reviewdetail.SourceProjectIDs.Split(',').ToList().Contains(o.Id.ToString())).ToList(); for (var i = 0; i < projectreviewsummarys.Count; i++) { var obj = projectreviewsummarys[i]; obj.Rank = i + 1; } var dt = await BuildProjectTable(reviewdetail); await BuildTableData(dt, reviewdetail, projectreviewsummarys); var now = DateTime.Now; var dic = $"{Directory.GetCurrentDirectory()}\\wwwroot\\files\\{now.ToString("yyyyMMdd")}"; if (!System.IO.Directory.Exists(dic)) { System.IO.Directory.CreateDirectory(dic); } var filename = $"{review.ReviewName}-{reviewdetail.Round}-{reviewdetail.Turn}-评审结果-{now.ToString("yyyyMMddHHmmss")}.xlsx"; var filePath = System.IO.Path.Combine(dic, filename); Common.ExcelHelper.DataTableToExcel(dt, filePath, filename, true); return(new { filePath = $"/files/{now.ToString("yyyyMMdd")}/{filename}", fileName = filename }); }
/// <summary> /// 项目的专家打分明细 /// </summary> /// <param name="reviewRoundId"></param> /// <param name="projectId"></param> /// <returns></returns> public async Task <IActionResult> ProjectReviewDetail(int reviewRoundId, int projectId) { var reviewDetail = await ReviewRoundRepository.GetAsync(reviewRoundId); var expertIds = reviewDetail.Review.ReviewExperts.Select(o => o.Id); var experts = await UserRepository.GetAll().Include(o => o.Organization).Where(o => expertIds.Contains(o.Id)).ToListAsync(); ViewData["Experts"] = experts; var reviewProject = reviewDetail.Review.ReviewProjects.Single(o => o.Id == projectId); var projectDetails = reviewDetail.ExpertReviewDetails.SelectMany(o => o.ProjectReviewDetails).Where(o => o.ProjectId == projectId).ToList(); //如果是第一轮则加上基础分 if (reviewProject.BaseScore != null && reviewDetail.Round == 1 && reviewDetail.Turn == 1 && reviewDetail.ReviewMethod != ReviewMethod.Vote) { ViewData["basescore"] = reviewProject.BaseScore; } else { ViewData["basescore"] = ""; } ViewData["reviewDetail"] = reviewDetail; ViewData["projectId"] = projectId; return(View(projectDetails)); }
public virtual async Task <object> GetReviewRoundDetail(int reviewRoundId) { var manager = Manager as ReviewManager; var reviewdetail = await ReviewRoundRepository.GetAsync(reviewRoundId); var sourceprojectids = reviewdetail.SourceProjectIDs; var data = (await manager.GetProjectRanks(reviewdetail)).Where(o => reviewdetail.SourceProjectIDs.Split(',').ToList().Contains(o.Id.ToString())).ToList(); //进行同分判定 var linescore = data[reviewdetail.TargetNumber - 1].TotalScore;//界限分 for (var i = 0; i < data.Count; i++) { var obj = data[i]; obj.Rank = i + 1; } if (data.Count(o => o.TotalScore == linescore) > 1 && data.Count(o => o.TotalScore >= linescore) > reviewdetail.TargetNumber) { foreach (var obj in data.Where(o => o.TotalScore == linescore)) { obj.NeedConfirm = true; } } var result = new ResultPageDto() { code = 0, count = data.Count, data = data }; return(result); }
/// <summary> /// 全屏公示 /// </summary> /// <param name="reviewRoundId"></param> /// <returns></returns> public async Task <IActionResult> FullView(int reviewRoundId) { var matchInstance = await GetCurrentMatchInstance(); ViewData["matchInstance"] = matchInstance; var reviewDetail = await ReviewRoundRepository.GetAllIncluding(o => o.Review).Where(o => o.Id == reviewRoundId).SingleAsync(); return(View(reviewDetail)); }
/// <summary> /// 已结束评审查看 /// </summary> /// <param name="data"></param> /// <returns></returns> public async Task <IActionResult> ReviewRoundViewFinish(int data) { var matchInstance = await GetCurrentMatchInstance(); ViewData["matchInstance"] = matchInstance; var reviewRound = await ReviewRoundRepository.GetAll().Include(o => o.Review).ThenInclude(o => o.ReviewRounds).Where(o => o.Id == data).SingleAsync(); return(View(reviewRound)); }
/// <summary> /// 撤回评审轮次 /// </summary> /// <param name="id"></param> /// <returns></returns> public virtual async Task WithDraw(int id) { var manager = Manager as ReviewManager; var reviewdetail = await ReviewRoundRepository.GetAsync(id); if (reviewdetail.ReviewStatus == ReviewStatus.Reviewed) { throw new UserFriendlyException("此次评审已经全部结束,无法撤回"); } //撤回 await manager.WithDraw(reviewdetail); }
/// <summary> /// 评审中页面 /// </summary> /// <param name="data"></param> /// <returns></returns> public async Task <IActionResult> ReviewRoundViewing(int data) { var matchInstance = await GetCurrentMatchInstance(); ViewData["matchInstance"] = matchInstance; var reviewRound = await ReviewRoundRepository.GetAllIncluding(o => o.Review).Where(o => o.Id == data).SingleAsync(); var expertIds = reviewRound.Review.ReviewExperts.Select(o => o.Id); var experts = await UserRepository.GetAll().Where(o => expertIds.Contains(o.Id)).OrderBy(o => o.Name).ToListAsync(); ViewData["Experts"] = experts; return(View(reviewRound)); }
/// <summary> /// 获取评审轮次数据 /// </summary> /// <param name="id"></param> /// <returns></returns> public virtual async Task <ReviewRoundDto> GetReviewRound(int id) { var manager = Manager as ReviewManager; var reviewRound = await ReviewRoundRepository.GetAsync(id); var reviewRoundDto = reviewRound.MapTo <ReviewRoundDto>(); reviewRoundDto.ReviewName = reviewRound.Review.ReviewName; //获取对应打分 var rateTable = await manager.GetRateTable(reviewRound.Review); reviewRoundDto.HasRateTable = rateTable != null; reviewRoundDto.HasRateTable = false; return(reviewRoundDto); }
public async Task <IActionResult> RateTableView(int reviewRoundId, int projectId, long expertId) { var reviewDetail = await ReviewRoundRepository.GetAsync(reviewRoundId); var review = reviewDetail.Review; var rateTable = await ReviewManager.GetRateTable(review); var projectReviewDetail = reviewDetail.ExpertReviewDetails.Single(o => o.ExpertID == expertId).ProjectReviewDetails.Single(o => o.ProjectId == projectId); //打分详情 ViewData["projectReviewDetail"] = projectReviewDetail; return(View(rateTable)); }
/// <summary> /// 提交评审活动 /// </summary> /// <returns></returns> public virtual async Task SubmitReviewRound(ReviewRoundDto reviewRoundDto) { var manager = Manager as ReviewManager; var review = await Manager.GetByIdAsync(reviewRoundDto.ReviewId); ReviewRound reviewRound = null; await Repository.EnsureCollectionLoadedAsync(review, o => o.ReviewRounds); if (reviewRoundDto.Id == 0) { //新的评审 if (review.ReviewRounds.Count(o => o.Round == reviewRoundDto.Round && o.Turn == reviewRoundDto.Turn) > 0) { throw new UserFriendlyException("相同轮次的评审已存在"); } else { reviewRound = reviewRoundDto.MapTo <ReviewRound>(); //设置源项目id if (review.ReviewRounds.Count == 0) { //如果是第一次评审,则取评选活动的参选项目做为本次评选的来源项目 reviewRound.SourceProjectIDs = string.Join(',', review.ReviewProjects.Select(o => o.Id)); } else { //非第一次评审,则取选择的项目作为来源项目 //reviewRound.SourceProjectIDs = review.ReviewRounds.Last().ResultProjectIDs; } review.ReviewRounds.Add(reviewRound); //如果有专家回避了所有项目,则直接设置此专家为已提交状态 var reviewProjects = review.ReviewProjects.Where(o => reviewRound.SourceProjectIDs.Split(',').Contains(o.Id.ToString())); var excludeExpertIdsAll = reviewProjects.SelectMany(o => { var excludeExpertIdsStr = string.IsNullOrEmpty(o.ExcludeExpertIDs) ? "" : o.ExcludeExpertIDs; return(excludeExpertIdsStr.Split(',')); }).ToList(); foreach (var expert in review.ReviewExperts) { if (excludeExpertIdsAll.Count(o => o == expert.Id.ToString()) == reviewProjects.Count()) { reviewRound.ExpertReviewDetails = new List <ExpertReviewDetail>() { new ExpertReviewDetail() { ExpertID = expert.Id, FinishTime = DateTime.Now, ProjectReviewDetails = new List <ProjectReviewDetail>() } }; } } } } else { //修改 reviewRound = await ReviewRoundRepository.GetAsync(reviewRoundDto.Id); reviewRoundDto.MapTo(reviewRound); } //如果使用评分表,则将评分表的总分作为评审活动的分制上限 if (reviewRound.ReviewMethodSetting.RateType == RateType.RateTable) { var rateTables = await manager.GetRateTable(review); var reviewMethodSetting = reviewRound.ReviewMethodSetting; reviewMethodSetting.MaxScore = rateTables[0].TotalScore; reviewRound.ReviewMethodSetting = reviewMethodSetting; } //根据评审轮次的状态更新评选活动的状态 review.ReviewStatus = reviewRoundDto.ReviewStatus; if (review.ReviewStatus == ReviewStatus.Reviewing) { review.StartTime = DateTime.Now; } }