修改 外部人员系统文档签署问题解决

IRC_NewDev
hang 2024-10-24 14:11:56 +08:00
parent 5ceb5e790a
commit 2c37765969
10 changed files with 49 additions and 65 deletions

View File

@ -22,6 +22,8 @@ namespace IRaCIS.Core.Application.Auth
public bool IsTestUser { get; set; }
public bool IsZhiZhun { get; set; }
public string Phone { get; set; } = String.Empty;
public static IRaCISClaims Create(UserBasicInfo user)
@ -36,9 +38,9 @@ namespace IRaCIS.Core.Application.Auth
IsTestUser = user.IsTestUser,
Code = user.Code,
PermissionStr = user.PermissionStr,
IsZhiZhun = user.IsZhiZhun,
UserTypeShortName = user.UserTypeShortName
};
}
}
}
}

View File

@ -36,7 +36,7 @@ namespace IRaCIS.Core.Application.Auth
new Claim(JwtIRaCISClaimType.UserTypeEnumInt,((int)user.UserTypeEnum).ToString()),
new Claim(JwtIRaCISClaimType.UserTypeShortName,user.UserTypeShortName),
new Claim(JwtIRaCISClaimType.PermissionStr,user.PermissionStr),
new Claim(JwtIRaCISClaimType.IsZhiZhun,user.IsZhiZhun.ToString()),
new Claim(JwtIRaCISClaimType.IsTestUser,user.IsTestUser.ToString())
};

View File

@ -2305,20 +2305,22 @@
<param name="password"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService">
<member name="T:IRaCIS.Core.Application.Service.MinimalApiService.FileToPDFService">
<summary>
minimal api 测试
学习参考文档http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
组件参考文档https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
上传文件转PDF 或者给url 这边下载然后转PDF
</summary>
<param name="_hostEnvironment"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo)">
<member name="M:IRaCIS.Core.Application.Service.MinimalApiService.FileToPDFService.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment)">
<summary>
minimal api 测试
学习参考文档http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
组件参考文档https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
上传文件转PDF 或者给url 这边下载然后转PDF
</summary>
<param name="_hostEnvironment"></param>
</member>
<!-- Badly formed XML comment ignored for member "T:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService" -->
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo)" -->
<member name="M:IRaCIS.Core.Application.Service.QCCommon.VerifyIsCRCSubmmitAsync(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Domain.Share.IUserInfo,System.Nullable{System.Guid})">
<summary>
验证CRC 是否已提交 已提交 就不允许进行任何操作如果是IQC 那么还验证是否是当前任务领取人

View File

@ -18,7 +18,6 @@ namespace IRaCIS.Core.Application.Service
Task SendEmailVerification(string emailAddress, int verificationCode);
Task SiteSurveyRejectEmail(MimeMessage messageToSend, TrialSiteSurvey trialSiteSurvey, string routeUrl, User? user = null);
Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode, UserMFAType mfaType = UserMFAType.Login);
@ -334,49 +333,6 @@ namespace IRaCIS.Core.Application.Service
}
public async Task SiteSurveyRejectEmail(MimeMessage messageToSend, TrialSiteSurvey trialSiteSurvey, string routeUrl, User? user)
{
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurvey.TrialId);
var siteInfo = await _trialSiteRepository.FirstOrDefaultAsync(t => t.TrialId == trialSiteSurvey.TrialId && t.Id == trialSiteSurvey.TrialSiteId, true);
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
(user == null ? trialSiteSurvey.UserName : user.LastName + "/ " + user.FirstName),
trialInfo.TrialCode,
trialInfo.ResearchProgramNo,
trialInfo.ExperimentName,
siteInfo.TrialSiteCode,
siteInfo.TrialSiteAliasName,
trialSiteSurvey.LatestBackReason,
routeUrl,
(trialSiteSurvey.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none")
);
return (topicStr, htmlBodyStr);
};
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurveyReject, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
//添加用户发送邮件
public async Task AddUserSendEmailAsync(Guid userId, string baseUrl, string routeUrl)

View File

@ -143,8 +143,13 @@ namespace IRaCIS.Core.Application.Services
[HttpPost]
public async Task<PageOutput<UnionDocumentWithConfirmInfoView>> getWaitSignSysDocList(SystemDocumentQuery inQuery)
{
var isInternal = _userInfo.IsZhiZhun;
var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
//外部人员 只签署 文档类型枚举值有值的
.WhereIf(isInternal == false, t => t.FileType.Code.Length == 0)
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = _userInfo.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
from confirm in cc.DefaultIfEmpty()

View File

@ -65,6 +65,8 @@ namespace IRaCIS.Application.Contracts
public string EMail { get; set; } = string.Empty;
public bool IsFirstAdd { get; set; }
public bool IsZhiZhun { get; set; }
public bool IsReviewer { get; set; } = false;
public int LoginState { get; set; } = 0;

View File

@ -16,6 +16,11 @@ using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.MinimalApiService
{
/// <summary>
/// 上传文件转PDF 或者给url 这边下载然后转PDF
///
/// </summary>
/// <param name="_hostEnvironment"></param>
[ApiExplorerSettings(GroupName = "Institution")]
public class FileToPDFService(IWebHostEnvironment _hostEnvironment) : ServiceBase
{

View File

@ -14,6 +14,9 @@ namespace IRaCIS.Core.Application.Service.MinimalApiService
/// minimal api 测试
/// 学习参考文档http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
/// 组件参考文档https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
/// 升级只用改一个地方 搜索关键词: 统一使用 Directory.Build.props 管理项目
//https://www.toutiao.com/article/7407615998343348787/?app=news_article&timestamp=1724760241&use_new_style=1&req_id=20240827200400D600951D2F54551B5ACF&group_id=7407615998343348787&share_token=03C009BA-571C-47AB-86E5-87DA93F08975&tt_from=weixin&utm_source=weixin&utm_medium=toutiao_ios&utm_campaign=client_share&wxshare_count=1&source=m_redirect&wid=1729739417949
/// </summary>
[ApiExplorerSettings(GroupName = "Institution")]

View File

@ -5,25 +5,18 @@
/// </summary>
public interface IUserInfo
{
/// <summary>
/// 主键
/// </summary>
Guid Id { get; }
/// <summary>
/// 用户名
/// </summary>
string UserName { get; }
/// <summary>
/// 昵称
/// </summary>
string RealName { get; }
string ReviewerCode { get; }
bool IsAdmin { get; }
bool IsTestUser { get; }
public bool IsZhiZhun { get; }
string UserTypeShortName { get; }

View File

@ -151,7 +151,21 @@ namespace IRaCIS.Core.Domain.Share
}
}
public bool IsTestUser
public bool IsZhiZhun
{
get
{
var isZhizhunClaime = _accessor?.HttpContext?.User?.FindFirst(JwtIRaCISClaimType.IsZhiZhun);
if (isZhizhunClaime != null && !string.IsNullOrEmpty(isZhizhunClaime.Value))
{
return bool.Parse(isZhizhunClaime.Value);
}
return false;
}
}
public bool IsTestUser
{
get
{
@ -341,6 +355,8 @@ namespace IRaCIS.Core.Domain.Share
public const string IsTestUser = "isTestUser";
public const string IsZhiZhun = "isZhiZhun";
public const string PermissionStr = "permissionStr";