diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateRuleController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateRuleController.cs index f135f276..b4d1afea 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateRuleController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_CertificateRuleController.cs @@ -11,4 +11,16 @@ public class Ghre_CertificateRuleController : BaseController + /// 证书预览 + /// + /// + [HttpPost, Route("Preview/{id}")] + public virtual async Task> Preview(long id) + { + return await _service.Preview(id); + } + #endregion } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 8ad11a2a..3203ee68 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -764,6 +764,12 @@ 培训证书规则(Controller) + + + 预览 + + + 参数配置(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs index 8c7d66b9..1b47036c 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_CertificateRuleServices.cs @@ -1,5 +1,4 @@ -using Tiobon.Core.IServices.BASE; -using Tiobon.Core.Model.Models; +using Tiobon.Core.Model; namespace Tiobon.Core.IServices; @@ -8,4 +7,5 @@ namespace Tiobon.Core.IServices; /// public interface IGhre_CertificateRuleServices : IBaseServices { + Task> Preview(long id); } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs index 25048d60..1af37ca6 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CertificateRuleServices.cs @@ -1,9 +1,4 @@ -using static Tiobon.Core.Model.Consts; -using Tiobon.Core.Common.DB.Dapper.Extensions; -using System.Collections.Generic; -using NPOI.XWPF.UserModel; - -namespace Tiobon.Core.Services; +namespace Tiobon.Core.Services; /// /// 培训证书规则 (服务) @@ -169,6 +164,7 @@ public class Ghre_CertificateRuleServices : BaseServices> QueryForm(QueryForm body) { var result = await base.QueryForm(body); @@ -201,4 +197,35 @@ public class Ghre_CertificateRuleServices : BaseServices> Preview(long id) + { + var result = await base.QueryById(id); + string CourseId1 = result.CourseId1; + if (!string.IsNullOrWhiteSpace(CourseId1)) + result.CourseIds = JsonConvert.DeserializeObject>(CourseId1); + string CourseSceneId1 = result.CourseSceneId1; + if (!string.IsNullOrWhiteSpace(CourseSceneId1)) + result.CourseSceneIds = JsonConvert.DeserializeObject>(CourseSceneId1); + + var design = await Db.Queryable().Where(x => x.CertificateRuleId == id).FirstAsync(); + if (design != null) + { + var design1 = Mapper.Map(design).ToANew(); + var items = new List(); + var designItems = await Db.Queryable().Where(x => x.CertificateRuleId == id).ToListAsync(); + designItems.ForEach(x => + { + var item = Mapper.Map(x).ToANew(); + item.id = x.id1; + items.Add(item); + }); + + design1.containerItems = items; + result.CertificateDesignerData = design1; + + } + return ServiceResult.OprateSuccess("查询成功!", result); + + } } \ No newline at end of file