From afadc5e2be90bebd1785a47f71cba3d1524b0034 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 4 Sep 2024 13:47:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?oss=20=20=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=BD=AC=E4=B8=BA=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=8C=E6=9C=8D=E5=8A=A1=E5=99=A8=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E8=BD=AC=E4=B8=BA=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=97=B6=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ExtraController.cs | 4 +++- IRaCIS.Core.Application/Helper/OSSService.cs | 2 +- .../IRaCIS.Core.Application.csproj | 4 ++-- .../TrialSiteUser/PersonalWorkstation.cs | 23 +++++++++++-------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index baa34b64f..bb8be2517 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -331,7 +331,9 @@ namespace IRaCIS.Api.Controllers { AccessKeyId = credentials.AccessKeyId, AccessKeySecret = credentials.AccessKeySecret, - Expiration = credentials.Expiration, + + //转为服务器时区,最后统一转为客户端时区 + Expiration = TimeZoneInfo.ConvertTimeFromUtc(DateTime.Parse(credentials.Expiration), TimeZoneInfo.Local), SecurityToken = credentials.SecurityToken, diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 061150189..7a472d690 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -117,7 +117,7 @@ namespace IRaCIS.Core.Application.Helper public string SecurityToken { get; set; } - public string Expiration { get; set; } + public DateTime Expiration { get; set; } } diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index c1eb5c0a7..d4e5708b8 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -71,8 +71,8 @@ - - + + diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index b23a1c3eb..91a92a85b 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -44,6 +44,7 @@ namespace IRaCIS.Core.Application _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM) { return await _trialRepository + .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) @@ -105,6 +106,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository + .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new CheckToBeDoneDto() { @@ -192,6 +194,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ReviewerSelectToBeDoneDto() { @@ -227,6 +230,7 @@ namespace IRaCIS.Core.Application { var query = _trialRepository + .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { @@ -247,6 +251,7 @@ namespace IRaCIS.Core.Application var all = await _trialRepository + .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { @@ -275,7 +280,7 @@ namespace IRaCIS.Core.Application , [FromServices] IRepository _enrollRepository, [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ReviewerSelectToBeDoneDto() { @@ -362,7 +367,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) //.Where(t => t.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Select(t => new ImageClinicalDataToBeDoneDto() @@ -404,7 +409,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) //.Where(t => t.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Select(t => new ImageClinicalDataToBeDoneDto() @@ -465,7 +470,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageQuestionToBeDoneDto() { @@ -513,7 +518,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageCheckQuestionToBeDoneDto() { @@ -559,7 +564,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageReUploadToBeDoneDto() { @@ -606,7 +611,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView)) .Select(t => new ImageSubmittedToBeDoneDto() { @@ -662,7 +667,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit) .Select(t => new ImageQualityToBeDoneDto() @@ -719,7 +724,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _trialRepository + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageQuestionToBeDoneDto() { From 640ebdb8353e08ac68d9124d4600cdc4307f701a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 4 Sep 2024 14:06:31 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrialSiteUser/PersonalWorkstation.cs | 67 ++++++++++--------- .../Allocation/VisitTaskReReading.cs | 3 + 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 91a92a85b..bb39473e5 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -75,7 +75,7 @@ namespace IRaCIS.Core.Application } else { - var trialDocStat = await _trialRepository/*.AsQueryable(true)*/.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) + var trialDocStat = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) .Count() > 0) @@ -127,10 +127,12 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var totalToBeCheckedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var totalToBeCheckedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(u => u.CheckState == CheckStateEnum.ToCheck).CountAsync(); - var totalToBeRepliedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var totalToBeRepliedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).CountAsync(); @@ -151,7 +153,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _visitTaskReReadingRepository + var query = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) @@ -172,7 +174,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeApprovalCount = _visitTaskReReadingRepository + var toBeApprovalCount = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed).Count(); @@ -193,8 +195,7 @@ namespace IRaCIS.Core.Application , [FromServices] IRepository _enrollRepository, [FromServices] IRepository _trialRepository) { - var query = _trialRepository - .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ReviewerSelectToBeDoneDto() { @@ -212,7 +213,8 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).CountAsync(); return ResponseOutput.Ok(result, new { ToBeApprovalCount = toBeApprovalCount }); ; @@ -229,8 +231,7 @@ namespace IRaCIS.Core.Application public async Task>> GetPMClinicalDataToBeDoneList(ReviewerSelectToBeDoneQuery inQuery) { - var query = _trialRepository - .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) + var query = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { @@ -250,8 +251,7 @@ namespace IRaCIS.Core.Application - var all = await _trialRepository - .Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) + var all = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new GetPMClinicalDataToBeDoneListOutDto() { @@ -299,7 +299,8 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).CountAsync(); return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); ; @@ -319,7 +320,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _trialRepository) { - var query = _visitTaskReReadingRepository + var query = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) @@ -340,7 +341,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeApprovalCount = _visitTaskReReadingRepository + var toBeApprovalCount = _visitTaskReReadingRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed).Count(); @@ -387,7 +388,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeDealedCount = _subjectVisitRepository + var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) //.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.Trial.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Where(u => u.IsBaseLine && u.SubmitState != SubmitStateEnum.Submitted).Count(); @@ -445,7 +446,7 @@ namespace IRaCIS.Core.Application result.CurrentPageData = result.CurrentPageData.Where(x => x.ReadModuleCount != 0).ToList(); - var toBeDealedCount = _subjectVisitRepository + var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) //.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.Trial.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Where(u => u.IsBaseLine && u.SubmitState != SubmitStateEnum.Submitted).Count(); @@ -495,7 +496,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeDealedCount = _subjectVisitRepository + var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) .SelectMany(c => c.QCChallengeList) @@ -541,7 +542,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeDealedCount = _subjectVisitRepository + var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count(); @@ -587,7 +588,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeDealedCount = _subjectVisitRepository + var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count(); @@ -637,7 +638,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeDealedCount = _subjectVisitRepository + var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(); @@ -697,12 +698,13 @@ namespace IRaCIS.Core.Application - var toBeClaimedCount = _subjectVisitRepository + var toBeClaimedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed && t.AuditState != AuditStateEnum.QCFailed) .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(); - var toBeReviwedCount = _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var toBeReviwedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(u => u.CurrentActionUserId == _userInfo.Id).Count(); @@ -745,7 +747,7 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery, defalutSortArray); - var toBeDealedCount = _subjectVisitRepository + var toBeDealedCount = _subjectVisitRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .SelectMany(c => c.QCChallengeList) .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(); @@ -888,7 +890,7 @@ namespace IRaCIS.Core.Application var result = await newQuery.ToPagedListAsync(inQuery, defalutSortArray); - var toBeDealedCount = _trialRepository + var toBeDealedCount = _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .SelectMany(t => t.VisitTaskList) .Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect && t.TrialReadingCriterion.IsSigned == true && t.TrialReadingCriterion.IsConfirm == true) @@ -916,7 +918,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _taskMedicalReviewRepository) { - var query = _taskMedicalReviewRepository + var query = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.VisitTask.DoctorUserId == _userInfo.Id) .GroupBy(t => new @@ -960,7 +962,7 @@ namespace IRaCIS.Core.Application - var toBeDealedCount = _taskMedicalReviewRepository + var toBeDealedCount = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false && t.VisitTask.DoctorUserId == _userInfo.Id) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM) @@ -993,7 +995,7 @@ namespace IRaCIS.Core.Application #region 废弃不能对包含聚合或子查询的表达式执行聚合函数 - var query = _taskMedicalReviewRepository + var query = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) .GroupBy(t => new @@ -1031,7 +1033,7 @@ namespace IRaCIS.Core.Application - var toBeReplyedQuery = _taskMedicalReviewRepository + var toBeReplyedQuery = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) .Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing); @@ -1039,7 +1041,7 @@ namespace IRaCIS.Core.Application var toBeReplyedCount = toBeReplyedQuery.Count(); - var tobeReviewedCount = _taskMedicalReviewRepository + var tobeReviewedCount = _taskMedicalReviewRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id) .Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count(); @@ -1116,7 +1118,8 @@ namespace IRaCIS.Core.Application var isSPMOrCPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM; var isIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer; - var needSignTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped).Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + var needSignTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0).CountAsync(); @@ -1136,7 +1139,7 @@ namespace IRaCIS.Core.Application .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); - var siteSurveyCount = await _trialRepository + var siteSurveyCount = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) diff --git a/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs b/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs index 5998b6817..0adc8f6e1 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs @@ -35,6 +35,9 @@ namespace IRaCIS.Core.Domain.Models [JsonIgnore] public User CreateUser { get; set; } + [JsonIgnore] + public Trial Trial { get; set; } + #endregion public Guid TrialId { get; set; } From 48ea90ce970da71e465b57326063791924e670b9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 4 Sep 2024 14:13:29 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/PersonalWorkstation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index bb39473e5..8c2b58a6e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -75,7 +75,7 @@ namespace IRaCIS.Core.Application } else { - var trialDocStat = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped) + var trialDocStat = await _trialRepository.Where(t => t.TrialStatusStr == StaticData.TrialState.TrialOngoing) .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) .Count() > 0) From 245060222765e4346fa15248e8b38fc4fa13b15d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 4 Sep 2024 14:44:47 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=88=A0=E9=99=A4T4=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=BA=9F=E5=BC=83=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Test/DbHelper.ttinclude | 40 +++--- IRaCIS.Core.Test/IRaCIS.Core.Test.csproj | 40 +----- .../Dto_New/UserFeedBackViewModel.cs | 88 +++++++++++++ .../TT_Template/IRaCIS.Core.Entity.tt | 1 + .../TT_Template/IRaCIS.Core.IRepository.cs | 16 --- .../TT_Template/IRaCIS.Core.IRepository.tt | 67 ---------- .../TT_Template/IRaCIS.Core.IServices.cs | 10 -- .../TT_Template/IRaCIS.Core.IServices.tt | 78 ----------- .../TT_Template/IRaCIS.Core.Repository.cs | 9 -- .../TT_Template/IRaCIS.Core.Repository.tt | 64 --------- .../TT_Template/IRaCIS.Core.Services.cs | 9 -- .../TT_Template/IRaCIS.Core.Services.tt | 123 ------------------ .../Services_New/UserFeedBackService.cs | 60 +++++++++ IRaCIS.Core.Test/UnitTest1.cs | 18 --- 14 files changed, 171 insertions(+), 452 deletions(-) create mode 100644 IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.cs delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.tt delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.cs delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.cs delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.tt delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.cs delete mode 100644 IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.tt create mode 100644 IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs delete mode 100644 IRaCIS.Core.Test/UnitTest1.cs diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude index d33e52c37..cc5fddb73 100644 --- a/IRaCIS.Core.Test/DbHelper.ttinclude +++ b/IRaCIS.Core.Test/DbHelper.ttinclude @@ -3,9 +3,9 @@ { public static readonly string ConnectionString = "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true"; public static readonly string DbDatabase = "Test_IRC"; - //表名称用字符串,拼接 + //ַ,ƴ public static readonly string TableName = "UserFeedBack"; - //具体文件里面 例如service 可以配置是否分页 + //ļ service Ƿҳ } #> <#+ @@ -21,12 +21,12 @@ } string sql = string.Format(@"SELECT obj.name tablename - from sys.objects obj - inner join dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1 - INNER JOIN sys.schemas schem ON obj.schema_id=schem.schema_id - left join sys.extended_properties g ON (obj.object_id = g.major_id AND g.minor_id = 0 AND g.name= 'MS_Description') - where type='U' {0} - order by obj.name",tables); + from {0}.sys.objects obj + inner join {0}.dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1 + INNER JOIN {0}.sys.schemas schem ON obj.schema_id=schem.schema_id + left join {0}.sys.extended_properties g ON (obj.object_id = g.major_id AND g.minor_id = 0 AND g.name= 'MS_Description') + where type='U' {1} + order by obj.name", database,tables); DataTable dt = GetDataTable(connectionString, sql); return dt.Rows.Cast().Select(row =>row.Field("tablename")).ToList(); } @@ -50,11 +50,11 @@ ELSE 0 END AS BIT) HasPrimaryKey - from sys.objects obj - inner join dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1 - INNER JOIN sys.schemas schem ON obj.schema_id=schem.schema_id - where type='U' {0} - order by obj.name", tables); + from {0}.sys.objects obj + inner join {0}.dbo.sysindexes idx on obj.object_id=idx.id and idx.indid<=1 + INNER JOIN {0}.sys.schemas schem ON obj.schema_id=schem.schema_id + where type='U' {1} + order by obj.name", database, tables); #endregion DataTable dt = GetDataTable(connectionString, sql); return dt.Rows.Cast().Select(row => new DbTable @@ -79,8 +79,8 @@ ic.column_id, ic.index_column_id, ic.object_id - FROM sys.indexes idx - INNER JOIN sys.index_columns ic ON idx.index_id = ic.index_id AND idx.object_id = ic.object_id + FROM {0}.sys.indexes idx + INNER JOIN {0}.sys.index_columns ic ON idx.index_id = ic.index_id AND idx.object_id = ic.object_id WHERE idx.object_id =OBJECT_ID(@tableName) AND idx.is_primary_key=1 ) select @@ -102,14 +102,14 @@ cast(colm.precision as int) Precision, cast(colm.scale as int) Scale, prop.value Remark - from sys.columns colm - inner join sys.types systype on colm.system_type_id=systype.system_type_id and colm.user_type_id=systype.user_type_id - left join sys.extended_properties prop on colm.object_id=prop.major_id and colm.column_id=prop.minor_id + from {0}.sys.columns colm + inner join {0}.sys.types systype on colm.system_type_id=systype.system_type_id and colm.user_type_id=systype.user_type_id + left join {0}.sys.extended_properties prop on colm.object_id=prop.major_id and colm.column_id=prop.minor_id LEFT JOIN indexCTE ON colm.column_id=indexCTE.column_id AND colm.object_id=indexCTE.object_id where colm.object_id=OBJECT_ID(@tableName) - order by colm.column_id"); + order by colm.column_id", database); #endregion - SqlParameter param = new SqlParameter("@tableName", SqlDbType.NVarChar, 100) { Value = string.Format("{0}.{1}", schema, tableName) }; + SqlParameter param = new SqlParameter("@tableName", SqlDbType.NVarChar, 100) { Value = string.Format("{0}.{1}.{2}", database, schema, tableName) }; DataTable dt = GetDataTable(connectionString, sql, param); return dt.Rows.Cast().Select(row => new DbColumn() { diff --git a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj index 0be844e14..a43f6707d 100644 --- a/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj +++ b/IRaCIS.Core.Test/IRaCIS.Core.Test.csproj @@ -12,6 +12,8 @@ ..\bin + + IRaCIS .Core.ServiceAsync.cs @@ -25,22 +27,6 @@ TextTemplatingFileGenerator IRaCIS.Core.Dto.cs - - TextTemplatingFileGenerator - IRaCIS.Core.Services.cs - - - TextTemplatingFileGenerator - IRaCIS.Core.IServices.cs - - - TextTemplatingFileGenerator - IRaCIS.Core.Repository.cs - - - TextTemplatingFileGenerator - IRaCIS.Core.IRepository.cs - TextTemplatingFileGenerator IRaCIS.Core.Entity.cs @@ -67,26 +53,6 @@ True IRaCIS.Core.Dto.tt - - True - True - IRaCIS.Core.IRepository.tt - - - True - True - IRaCIS.Core.IServices.tt - - - True - True - IRaCIS.Core.Repository.tt - - - True - True - IRaCIS.Core.Services.tt - True True @@ -95,11 +61,9 @@ - - diff --git a/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs b/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs new file mode 100644 index 000000000..4c2f68b3a --- /dev/null +++ b/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs @@ -0,0 +1,88 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2024-09-04 14:40:49 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Domain.Share; +using System.Collections.Generic; +namespace IRaCIS.Core.Application.ViewModel +{ + + /// UserFeedBackView 列表视图 + public class UserFeedBackView : UserFeedBackAddOrEdit + { + + + + + + + public Guid CreateUserId { get; set; } + + + public DateTime CreateTime { get; set; } + + + public Guid UpdateUserId { get; set; } + + + public DateTime UpdateTime { get; set; } + + + + + + + } + + ///UserFeedBackQuery 列表查询参数 + public class UserFeedBackQuery + { + public string QuestionDescription { get; set; } + public string ScreenshotListStr { get; set; } + } + + /// UserFeedBackAddOrEdit 添加编辑 + public class UserFeedBackAddOrEdit + { + + public Guid Id { get; set; } + + + public Guid? SubjectId { get; set; } + + + public Guid? SubjectVisitId { get; set; } + + + public int QuestionType { get; set; } + + + public string QuestionDescription { get; set; } + + + + + + + public int State { get; set; } + + + public Guid? TrialSiteId { get; set; } + + + public Guid? TrialId { get; set; } + + + public string ScreenshotListStr { get; set; } + + + public Guid? VisitTaskId { get; set; } + + } + + +} + + diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt index cdca2030c..99090292f 100644 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt +++ b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Entity.tt @@ -38,6 +38,7 @@ using System; using IRaCIS.Core.Domain.Share; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel; namespace IRaCIS.Core.Domain.Models { diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.cs deleted file mode 100644 index aaed97b3f..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.cs +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.tt deleted file mode 100644 index f3285219b..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IRepository.tt +++ /dev/null @@ -1,67 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"IRepositories_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock("I"+tableName+"Repository"+".cs",OutputPath1);//文件名 -#> -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// 使用泛型仓储注册,现在不需要这个文件了,作为学习例子 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using IRaCIS.Core.Domain.IRepository; -using IRaCIS.Core.Domain.Models; -namespace IRaCIS.Core.Domain.IRepository -{ - /// - /// I<#=tableName#>Repository - /// - public interface I<#=tableName#>Repository : IRepository<<#=tableName#>> - { - - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> - - - - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.cs deleted file mode 100644 index fe5554c90..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.cs +++ /dev/null @@ -1,10 +0,0 @@ - - -//在这里设置 isPage 是否生成分页的还是不分页 - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt deleted file mode 100644 index 4c91654a8..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.IServices.tt +++ /dev/null @@ -1,78 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - -//在这里设置 isPage 是否生成分页的还是不分页 - -<# - var isPage=false; - #> - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"IServices_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock("I"+tableName+"Service"+".cs",OutputPath1);//文件名 -#> -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using IRaCIS.Core.Application.Contracts; -using IRaCIS.Core.Domain.Models; -using IRaCIS.Core.Infrastructure.Extention; -namespace IRaCIS.Core.Application.Contracts -{ - /// - /// I<#=tableName#>Service - /// - public interface I<#=tableName#>Service - { - - <# if(isPage){#> - PageOutput<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>); - <# } else {#> - - List<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>); - <# }#> - - IResponseOutput AddOrUpdate<#=tableName#>(<#=tableName#>AddOrEdit addOrEdit<#=tableName#>); - - IResponseOutput Delete<#=tableName#>(Guid <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id); - - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.cs deleted file mode 100644 index b26f15449..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.cs +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.tt deleted file mode 100644 index 0ba20925a..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Repository.tt +++ /dev/null @@ -1,64 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - - - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"Repositories_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock(tableName+"Repository"+".cs",OutputPath1);//文件名 -#> -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// 使用泛型仓储注册,现在不需要这个文件了,作为学习例子 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using IRaCIS.Core.Domain.IRepository; -using IRaCIS.Core.Domain.Models; -namespace IRaCIS.Core.Domain.Repository; -{ - /// - /// <#=tableName#>Repository - /// - public class <#=tableName#>Repository : Repository<<#=tableName#>>, IRepository<<#=tableName#>> - { - public <#=tableName#>Repository( IRaCISDBContext db) : base( db) - { - - } - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.cs b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.cs deleted file mode 100644 index 2faa758b0..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.cs +++ /dev/null @@ -1,9 +0,0 @@ - - - - -//在这里设置 isPage 是否生成分页的还是不分页 - - - - diff --git a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.tt b/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.tt deleted file mode 100644 index 7b76254a2..000000000 --- a/IRaCIS.Core.Test/TT_Template/IRaCIS.Core.Services.tt +++ /dev/null @@ -1,123 +0,0 @@ -<#@ template debug="false" hostspecific="true" language="C#" #> -<#@ output extension=".cs" #> -<#@ assembly name="System.Core.dll" #> -<#@ assembly name="System.Data.dll" #> -<#@ assembly name="System.Data.DataSetExtensions.dll" #> -<#@ assembly name="System.Xml.dll" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Xml" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="System.Data.SqlClient" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> - -<#@ include file="$(ProjectDir)DbHelper.ttinclude" #> -<#@ include file="$(ProjectDir)ModelAuto.ttinclude" #> -<# var manager = new Manager(Host, GenerationEnvironment, true); #> - - -//在这里设置 isPage 是否生成分页的还是不分页 - -<# - var isPage=false; - #> - -<# - var OutputPath1 =Path.GetDirectoryName(Host.TemplateFile+".."); - OutputPath1=Path.Combine(OutputPath1,"Services_New"); - if (!Directory.Exists(OutputPath1)) - { - Directory.CreateDirectory(OutputPath1); - } -#> - - -<# foreach (var item in DbHelper.GetDbTablesNew(config.ConnectionString, config.DbDatabase,config.TableName)) - { - var tableName=item.ToString(); - manager.StartBlock(tableName+"Service"+".cs",OutputPath1);//文件名 -#> -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Domain.Models; -using Microsoft.AspNetCore.Mvc; -using IRaCIS.Core.Infra.EFCore; -using IRaCIS.Core.Infrastructure.Extention; -namespace IRaCIS.Core.Application.Contracts -{ - /// - /// <#=tableName#>Service - /// - [ ApiExplorerSettings(GroupName = "Test")] - public class <#=tableName#>Service: BaseService, I<#=tableName#>Service - { - - private readonly IRepository<<#=tableName#>> _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository; - - public <#=tableName#>Service(IRepository<<#=tableName#>> <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository) - { - _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository = <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository; - } - - <# if(isPage){#> - public PageOutput<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>) - { - - var <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable = - - _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.AsQueryable() - .ProjectTo<<#=tableName#>View>(_mapper.ConfigurationProvider); - - var pageList=<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable. - .ToPagedList(query<#=tableName#>.PageIndex, query<#=tableName#>.PageSize, string.IsNullOrWhiteSpace(query<#=tableName#>.SortField) ? "Id" : query<#=tableName#>.SortField, - hospitalSearchModel.Asc); - - return pageList; - } - <# } else {#> - - public List<<#=tableName#>View> Get<#=tableName#>List(<#=tableName#>Query query<#=tableName#>) - { - - - var <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable = _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository - .Where(<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Lambda).ProjectTo<<#=tableName#>View>(_mapper.ConfigurationProvider); - - return <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Queryable.ToList(); - } - <# }#> - - - public IResponseOutput AddOrUpdate<#=tableName#>(<#=tableName#>AddOrEdit addOrEdit<#=tableName#>) - { - // 在此处拷贝automapper 映射 - // CreateMap<<#=tableName#>AddOrEdit, <#=tableName#>>(); - // CreateMap< <#=tableName#>,<#=tableName#>AddOrEdit>(); - - var entity = _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.UseMapper(_mapper).InsertOrUpdate(addOrEdit<#=tableName#>, true); - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - - - [HttpDelete("{<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id:guid}")] - public IResponseOutput Delete<#=tableName#>(Guid <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id) - { - var success = _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.Delete(t => t.Id == <#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Id); - return ResponseOutput.Result(success); - } - - - } -} -<# - manager.EndBlock(); - } - manager.Process(true); - #> diff --git a/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs b/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs new file mode 100644 index 000000000..6acb33c57 --- /dev/null +++ b/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs @@ -0,0 +1,60 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2024-09-04 14:41:20 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- + +using IRaCIS.Core.Domain.Models; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +namespace IRaCIS.Core.Application.Service +{ + /// + /// UserFeedBackService + /// + [ ApiExplorerSettings(GroupName = "Test")] + public class UserFeedBackService(IRepository _userFeedBackRepository): BaseService, IUserFeedBackService + { + + [HttpPost] + public async Task> GetUserFeedBackList(UserFeedBackQuery inQuery) + { + + var userFeedBackQueryable = + + _userFeedBackRepository + .ProjectTo(_mapper.ConfigurationProvider); + + var pageList= await userFeedBackQueryable.ToPagedListAsync(inQuery); + + return pageList; + } + + + public async Task AddOrUpdateUserFeedBack(UserFeedBackAddOrEdit addOrEditUserFeedBack) + { + // 在此处拷贝automapper 映射 + + + CreateMap(); + // CreateMap< UserFeedBack,UserFeedBackAddOrEdit>().ReverseMap(); + + + var entity = await _userFeedBackRepository.InsertOrUpdateAsync(addOrEditUserFeedBack, true); + + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + [HttpDelete("{userFeedBackId:guid}")] + public async Task DeleteUserFeedBack(Guid userFeedBackId) + { + var success = await _userFeedBackRepository.DeleteFromQueryAsync(t => t.Id == userFeedBackId,true); + return ResponseOutput.Ok(); + } + + + } +} diff --git a/IRaCIS.Core.Test/UnitTest1.cs b/IRaCIS.Core.Test/UnitTest1.cs deleted file mode 100644 index 1084bdf89..000000000 --- a/IRaCIS.Core.Test/UnitTest1.cs +++ /dev/null @@ -1,18 +0,0 @@ -//using NUnit.Framework; - -//namespace IRaCIS.Core.Test -//{ -// public class Tests -// { -// [SetUp] -// public void Setup() -// { -// } - -// [Test] -// public void Test1() -// { -// Assert.Pass(); -// } -// } -//} \ No newline at end of file From fd0d91faa4fab725521030fea54a053793ed6ffb Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 4 Sep 2024 14:53:18 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto_New/UserFeedBackViewModel.cs | 88 ------------------- .../Services_New/UserFeedBackService.cs | 60 ------------- 2 files changed, 148 deletions(-) delete mode 100644 IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs delete mode 100644 IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs diff --git a/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs b/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs deleted file mode 100644 index 4c2f68b3a..000000000 --- a/IRaCIS.Core.Test/TT_Template/Dto_New/UserFeedBackViewModel.cs +++ /dev/null @@ -1,88 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2024-09-04 14:40:49 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- -using System; -using IRaCIS.Core.Domain.Share; -using System.Collections.Generic; -namespace IRaCIS.Core.Application.ViewModel -{ - - /// UserFeedBackView 列表视图 - public class UserFeedBackView : UserFeedBackAddOrEdit - { - - - - - - - public Guid CreateUserId { get; set; } - - - public DateTime CreateTime { get; set; } - - - public Guid UpdateUserId { get; set; } - - - public DateTime UpdateTime { get; set; } - - - - - - - } - - ///UserFeedBackQuery 列表查询参数 - public class UserFeedBackQuery - { - public string QuestionDescription { get; set; } - public string ScreenshotListStr { get; set; } - } - - /// UserFeedBackAddOrEdit 添加编辑 - public class UserFeedBackAddOrEdit - { - - public Guid Id { get; set; } - - - public Guid? SubjectId { get; set; } - - - public Guid? SubjectVisitId { get; set; } - - - public int QuestionType { get; set; } - - - public string QuestionDescription { get; set; } - - - - - - - public int State { get; set; } - - - public Guid? TrialSiteId { get; set; } - - - public Guid? TrialId { get; set; } - - - public string ScreenshotListStr { get; set; } - - - public Guid? VisitTaskId { get; set; } - - } - - -} - - diff --git a/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs b/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs deleted file mode 100644 index 6acb33c57..000000000 --- a/IRaCIS.Core.Test/TT_Template/Services_New/UserFeedBackService.cs +++ /dev/null @@ -1,60 +0,0 @@ -//-------------------------------------------------------------------- -// 此代码由T4模板自动生成 byzhouhang 20210918 -// 生成时间 2024-09-04 14:41:20 -// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 -//-------------------------------------------------------------------- - -using IRaCIS.Core.Domain.Models; -using Microsoft.AspNetCore.Mvc; -using IRaCIS.Core.Application.Interfaces; -using IRaCIS.Core.Application.ViewModel; -namespace IRaCIS.Core.Application.Service -{ - /// - /// UserFeedBackService - /// - [ ApiExplorerSettings(GroupName = "Test")] - public class UserFeedBackService(IRepository _userFeedBackRepository): BaseService, IUserFeedBackService - { - - [HttpPost] - public async Task> GetUserFeedBackList(UserFeedBackQuery inQuery) - { - - var userFeedBackQueryable = - - _userFeedBackRepository - .ProjectTo(_mapper.ConfigurationProvider); - - var pageList= await userFeedBackQueryable.ToPagedListAsync(inQuery); - - return pageList; - } - - - public async Task AddOrUpdateUserFeedBack(UserFeedBackAddOrEdit addOrEditUserFeedBack) - { - // 在此处拷贝automapper 映射 - - - CreateMap(); - // CreateMap< UserFeedBack,UserFeedBackAddOrEdit>().ReverseMap(); - - - var entity = await _userFeedBackRepository.InsertOrUpdateAsync(addOrEditUserFeedBack, true); - - return ResponseOutput.Ok(entity.Id.ToString()); - - } - - - [HttpDelete("{userFeedBackId:guid}")] - public async Task DeleteUserFeedBack(Guid userFeedBackId) - { - var success = await _userFeedBackRepository.DeleteFromQueryAsync(t => t.Id == userFeedBackId,true); - return ResponseOutput.Ok(); - } - - - } -}