From 730addabedbe85bb4e57a899023fc21ab98ee9e8 Mon Sep 17 00:00:00 2001
From: vaining01 <276653425@qq.com>
Date: Thu, 17 Aug 2023 16:29:49 +0800
Subject: [PATCH] 0817
---
.../GetReportInFilterDto.cs | 19 ++
.../CreateReportFormatTemplateDto.cs | 43 ++++
.../ReportFormatTemplateDto.cs | 59 +++++
.../UpdateReportFormatTemplateDto.cs | 24 ++
.../ReportFormats/CreateReportFormatDto.cs | 26 +++
.../ReportFormats/ReportFormatDto.cs | 37 ++++
.../ReportFormats/UpdateReportFormatDto.cs | 24 ++
.../ReportPrinters/CreateReportPrinterDto.cs | 26 +++
.../ReportPrinters/ReportPrinterDto.cs | 35 +++
.../ReportPrinters/UpdateReportPrinterDto.cs | 23 ++
.../Reports/CreateReportDto.cs | 15 ++
.../Reports/PrintParameterDto.cs | 11 +
.../Reports/ReportDto.cs | 35 +++
.../Reports/ReportFileDto.cs | 13 ++
.../Reports/ReportParameterDto.cs | 13 ++
.../Reports/UpdateReportDto.cs | 13 ++
src/Shentun.Peis.Application/PageHelper.cs | 21 ++
.../PeisApplicationAutoMapperProfile.cs | 21 ++
.../ReportFormatTemplateAppService.cs | 197 +++++++++++++++++
.../ReportFormats/ReportFormatAppService.cs | 182 +++++++++++++++
.../ReportPrinters/ReportPrinterAppService.cs | 162 ++++++++++++++
.../Reports/ReportAppService.cs | 208 ++++++++++++++++++
src/Shentun.Peis.Domain/EntityHelper.cs | 37 ++++
src/Shentun.Peis.Domain/Models/Report.cs | 44 ++++
.../Models/ReportFormat.cs | 52 +++++
.../Models/ReportFormatTemplate.cs | 69 ++++++
.../Models/ReportPrinter.cs | 43 ++++
.../ReportFormatTemplateManager.cs | 104 +++++++++
.../ReportFormats/ReportFormatManager.cs | 82 +++++++
.../ReportPrinters/ReportPrinterManager.cs | 67 ++++++
.../Reports/ReportManager.cs | 55 +++++
.../EntityFrameworkCore/PeisDbContext.cs | 57 ++++-
32 files changed, 1816 insertions(+), 1 deletion(-)
create mode 100644 src/Shentun.Peis.Application.Contracts/GetReportInFilterDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/CreateReportFormatTemplateDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/ReportFormatTemplateDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportFormats/CreateReportFormatDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportFormats/ReportFormatDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportFormats/UpdateReportFormatDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportPrinters/CreateReportPrinterDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportPrinters/ReportPrinterDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/ReportPrinters/UpdateReportPrinterDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/Reports/CreateReportDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/Reports/PrintParameterDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/Reports/ReportDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/Reports/ReportFileDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/Reports/ReportParameterDto.cs
create mode 100644 src/Shentun.Peis.Application.Contracts/Reports/UpdateReportDto.cs
create mode 100644 src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs
create mode 100644 src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs
create mode 100644 src/Shentun.Peis.Application/ReportPrinters/ReportPrinterAppService.cs
create mode 100644 src/Shentun.Peis.Application/Reports/ReportAppService.cs
create mode 100644 src/Shentun.Peis.Domain/Models/Report.cs
create mode 100644 src/Shentun.Peis.Domain/Models/ReportFormat.cs
create mode 100644 src/Shentun.Peis.Domain/Models/ReportFormatTemplate.cs
create mode 100644 src/Shentun.Peis.Domain/Models/ReportPrinter.cs
create mode 100644 src/Shentun.Peis.Domain/ReportFormatTemplates/ReportFormatTemplateManager.cs
create mode 100644 src/Shentun.Peis.Domain/ReportFormats/ReportFormatManager.cs
create mode 100644 src/Shentun.Peis.Domain/ReportPrinters/ReportPrinterManager.cs
create mode 100644 src/Shentun.Peis.Domain/Reports/ReportManager.cs
diff --git a/src/Shentun.Peis.Application.Contracts/GetReportInFilterDto.cs b/src/Shentun.Peis.Application.Contracts/GetReportInFilterDto.cs
new file mode 100644
index 0000000..184614f
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/GetReportInFilterDto.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+using Volo.Abp.Application.Dtos;
+
+namespace Shentun.Peis
+{
+ public class GetReportInFilterDto : PagedAndSortedResultRequestDto
+ {
+ [Required]
+ public string ReportId { get; set; }
+
+ [Required]
+ public string DataSetJson { get; set; }
+
+ public string ParameterJson { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/CreateReportFormatTemplateDto.cs b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/CreateReportFormatTemplateDto.cs
new file mode 100644
index 0000000..74da0ec
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/CreateReportFormatTemplateDto.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ReportFormatTemplates
+{
+ public class CreateReportFormatTemplateDto
+ {
+ public string Id { get; set; }
+
+ ///
+ /// 报表格式ID
+ ///
+ public string ReportFormatId { get; set; }
+
+ ///
+ /// 格式名称
+ ///
+ public string DisplayName { get; set; }
+
+ ///
+ /// 模板文件类型 0:fastereport 1:Grid++Report
+ ///
+ public char TemplateFileType { get; set; }
+
+ ///
+ /// 模板文件
+ ///
+ public string TemplateFile { get; set; }
+
+ public string DataSetJson { get; set; }
+
+ ///
+ /// 是否系统自定义(Y:是,N:否)
+ ///
+ public char IsSystem { get; set; }
+
+ ///
+ /// 是否默认(Y:是,N:否)
+ ///
+ public char IsDefault { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/ReportFormatTemplateDto.cs b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/ReportFormatTemplateDto.cs
new file mode 100644
index 0000000..247c0ad
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/ReportFormatTemplateDto.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Volo.Abp.Application.Dtos;
+
+namespace Shentun.Peis.ReportFormatTemplates
+{
+ public class ReportFormatTemplateDto : AuditedEntityDto
+ {
+ ///
+ /// 报表格式ID
+ ///
+ public string ReportFormatId { get; set; }
+
+ ///
+ /// 格式名称
+ ///
+ public string DisplayName { get; set; }
+
+ ///
+ /// 模板文件类型 0:fastereport 1:Grid++Report
+ ///
+ public char TemplateFileType { get; set; }
+
+ ///
+ /// 模板文件
+ ///
+ public string TemplateFile { get; set; }
+
+ ///
+ /// 数据集Json
+ ///
+ public string DataSetJson { get; set; }
+
+ ///
+ /// 是否系统自定义(Y:是,N:否)
+ ///
+ public char IsSystem { get; set; }
+
+ public bool IsSystemed { get; set; }
+
+ ///
+ /// 是否默认(Y:是,N:否)
+ ///
+ public char IsDefault { get; set; }
+
+ public bool IsDefaulted { get; set; }
+
+ ///
+ /// 创建者
+ ///
+ public string CreatorName { get; set; }
+
+ ///
+ /// 最后修改者
+ ///
+ public string LastModifierName { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs
new file mode 100644
index 0000000..33dfdc4
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ReportFormatTemplates
+{
+ public class UpdateReportFormatTemplateDto
+ {
+
+ public string ReportFormatId { get; set; }
+
+ public string DisplayName { get; set; }
+
+ public char TemplateFileType { get; set; }
+
+ public string TemplateFile { get; set; }
+
+ public string DataSetJson { get; set; }
+
+ public char IsSystem { get; set; }
+
+ public char IsDefault { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportFormats/CreateReportFormatDto.cs b/src/Shentun.Peis.Application.Contracts/ReportFormats/CreateReportFormatDto.cs
new file mode 100644
index 0000000..fc05ccb
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportFormats/CreateReportFormatDto.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ReportFormats
+{
+ public class CreateReportFormatDto
+ {
+ public string Id { get; set; }
+
+ ///
+ /// 报表名称
+ ///
+ public string DisplayName { get; set; }
+
+ ///
+ /// 报表名称
+ ///
+ public char IsDefault { get; set; }
+
+ ///
+ /// 报表ID
+ ///
+ public string ReportId { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportFormats/ReportFormatDto.cs b/src/Shentun.Peis.Application.Contracts/ReportFormats/ReportFormatDto.cs
new file mode 100644
index 0000000..6ea1f02
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportFormats/ReportFormatDto.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Volo.Abp.Application.Dtos;
+
+namespace Shentun.Peis.ReportFormats
+{
+ public class ReportFormatDto : AuditedEntityDto
+ {
+ ///
+ /// 报表名称
+ ///
+ public string DisplayName { get; set; }
+
+ ///
+ /// 报表名称
+ ///
+ public char IsDefault { get; set; }
+
+ public bool IsDefaulted { get; set; }
+
+ ///
+ /// 报表ID
+ ///
+ public string ReportId { get; set; }
+
+ ///
+ /// 创建者
+ ///
+ public string CreatorName { get; set; }
+
+ ///
+ /// 最后修改者
+ ///
+ public string LastModifierName { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportFormats/UpdateReportFormatDto.cs b/src/Shentun.Peis.Application.Contracts/ReportFormats/UpdateReportFormatDto.cs
new file mode 100644
index 0000000..c2f7251
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportFormats/UpdateReportFormatDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ReportFormats
+{
+ public class UpdateReportFormatDto
+ {
+ ///
+ /// 报表名称
+ ///
+ public string DisplayName { get; set; }
+
+ ///
+ /// 报表名称
+ ///
+ public char IsDefault { get; set; }
+
+ ///
+ /// 报表ID
+ ///
+ public string ReportId { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportPrinters/CreateReportPrinterDto.cs b/src/Shentun.Peis.Application.Contracts/ReportPrinters/CreateReportPrinterDto.cs
new file mode 100644
index 0000000..a5ad8ac
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportPrinters/CreateReportPrinterDto.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ReportPrinters
+{
+ public class CreateReportPrinterDto
+ {
+ public string Id { get; set; }
+
+ ///
+ /// 报表ID
+ ///
+ public string ReportId { get; set; }
+
+ ///
+ /// 计算机名称
+ ///
+ public string ComputerName { get; set; }
+
+ ///
+ /// 打印机名称
+ ///
+ public string PrinterName { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportPrinters/ReportPrinterDto.cs b/src/Shentun.Peis.Application.Contracts/ReportPrinters/ReportPrinterDto.cs
new file mode 100644
index 0000000..ee68e17
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportPrinters/ReportPrinterDto.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Volo.Abp.Application.Dtos;
+
+namespace Shentun.Peis.ReportPrinters
+{
+ public class ReportPrinterDto:AuditedEntityDto
+ {
+ ///
+ /// 计算机名称
+ ///
+ public string ComputerName { get; set; }
+
+ ///
+ /// 打印机名称
+ ///
+ public string PrinterName { get; set; }
+
+ ///
+ /// 报表ID
+ ///
+ public string ReportId { get; set; }
+
+ ///
+ /// 创建者
+ ///
+ public string CreatorName { get; set; }
+
+ ///
+ /// 最后修改者
+ ///
+ public string LastModifierName { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ReportPrinters/UpdateReportPrinterDto.cs b/src/Shentun.Peis.Application.Contracts/ReportPrinters/UpdateReportPrinterDto.cs
new file mode 100644
index 0000000..6812c09
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ReportPrinters/UpdateReportPrinterDto.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ReportPrinters
+{
+ public class UpdateReportPrinterDto
+ {
+ ///
+ /// 报表ID
+ ///
+ public string ReportId { get; set; }
+ ///
+ /// 计算机名称
+ ///
+ public string ComputerName { get; set; }
+
+ ///
+ /// 打印机名称
+ ///
+ public string PrinterName { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/Reports/CreateReportDto.cs b/src/Shentun.Peis.Application.Contracts/Reports/CreateReportDto.cs
new file mode 100644
index 0000000..46ac46c
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Reports/CreateReportDto.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.Reports
+{
+ public class CreateReportDto
+ {
+ public string Id { get; set; }
+
+ public string DisplayName { get; set; }
+
+ public char IsActive { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/Reports/PrintParameterDto.cs b/src/Shentun.Peis.Application.Contracts/Reports/PrintParameterDto.cs
new file mode 100644
index 0000000..9a3a2a1
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Reports/PrintParameterDto.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.Reports
+{
+ public class PrintParameterDto
+ {
+ public List Parameters { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/Reports/ReportDto.cs b/src/Shentun.Peis.Application.Contracts/Reports/ReportDto.cs
new file mode 100644
index 0000000..c9aebea
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Reports/ReportDto.cs
@@ -0,0 +1,35 @@
+using JetBrains.Annotations;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+using Volo.Abp.Application.Dtos;
+
+namespace Shentun.Peis.Reports
+{
+ public class ReportDto:AuditedEntityDto
+ {
+ ///
+ /// 报表名称
+ ///
+ public string DisplayName { get; set; }
+
+ ///
+ /// 启用
+ ///
+ public char IsActive { get; set; }
+
+
+ public bool IsActived { get; set; }
+
+ ///
+ /// 创建者
+ ///
+ public string CreatorName { get; set; }
+
+ ///
+ /// 最后修改者
+ ///
+ public string LastModifierName { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/Reports/ReportFileDto.cs b/src/Shentun.Peis.Application.Contracts/Reports/ReportFileDto.cs
new file mode 100644
index 0000000..10c45d6
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Reports/ReportFileDto.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace Shentun.Peis.Reports
+{
+ public class ReportFileDto
+ {
+ public string FilePath { get; set; }
+ public byte[] Bytes { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/Reports/ReportParameterDto.cs b/src/Shentun.Peis.Application.Contracts/Reports/ReportParameterDto.cs
new file mode 100644
index 0000000..4618299
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Reports/ReportParameterDto.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.Reports
+{
+ public class ReportParameterDto
+ {
+ public string Name { get; set; }
+
+ public string Value { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/Reports/UpdateReportDto.cs b/src/Shentun.Peis.Application.Contracts/Reports/UpdateReportDto.cs
new file mode 100644
index 0000000..e00f3d5
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Reports/UpdateReportDto.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.Reports
+{
+ public class UpdateReportDto
+ {
+ public string DisplayName { get; set; }
+
+ public char IsActive { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application/PageHelper.cs b/src/Shentun.Peis.Application/PageHelper.cs
index 19455e6..a8b8667 100644
--- a/src/Shentun.Peis.Application/PageHelper.cs
+++ b/src/Shentun.Peis.Application/PageHelper.cs
@@ -49,6 +49,27 @@ namespace Shentun.Peis
entlist = entlist.OrderByDescending(m => m.DisplayOrder).Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList();
+ return entlist;
+
+ }
+
+ public static async Task> GetPageListInFitlerNotOrder
+ (IRepository repository,
+ IRepository userrepository,
+ GetListInFilterDto input)
+ where TEntity : class, IEntity, IDisplayName
+ {
+ List entlist = new List();
+
+ if (!string.IsNullOrEmpty(input.Filter))
+ entlist = (await repository.GetListAsync()).Where(m => m.DisplayName.Contains(input.Filter)).ToList();
+ else
+ entlist = await repository.GetListAsync();
+
+ //分页
+ entlist = entlist.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList();
+
+
return entlist;
}
diff --git a/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs b/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
index 4b42d93..1a9800e 100644
--- a/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
+++ b/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
@@ -35,6 +35,10 @@ using Shentun.Peis.OrganizationUnits;
using Shentun.Peis.PayModes;
using Shentun.Peis.PersonnelTypes;
using Shentun.Peis.ReferenceRanges;
+using Shentun.Peis.ReportFormats;
+using Shentun.Peis.ReportFormatTemplates;
+using Shentun.Peis.ReportPrinters;
+using Shentun.Peis.Reports;
using Shentun.Peis.ResultStatuses;
using Shentun.Peis.SampleContainers;
using Shentun.Peis.SampleGroupDetails;
@@ -253,6 +257,23 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap();
CreateMap();
CreateMap();
+
+
+ CreateMap();
+ CreateMap();
+ CreateMap();
+
+ CreateMap();
+ CreateMap();
+ CreateMap();
+
+ CreateMap();
+ CreateMap();
+ CreateMap();
+
+ CreateMap();
+ CreateMap();
+ CreateMap();
}
}
diff --git a/src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs b/src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs
new file mode 100644
index 0000000..f81c880
--- /dev/null
+++ b/src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs
@@ -0,0 +1,197 @@
+using Microsoft.AspNetCore.Mvc;
+using Shentun.Peis.Models;
+using Shentun.Peis.ReportFormats;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Identity;
+using Volo.Abp.ObjectMapping;
+using static Org.BouncyCastle.Bcpg.Attr.ImageAttrib;
+
+namespace Shentun.Peis.ReportFormatTemplates
+{
+ public class ReportFormatTemplateAppService : CrudAppService<
+ ReportFormatTemplate, //The Book entity
+ ReportFormatTemplateDto, //Used to show books
+ string, //Primary key of the book entity
+ PagedAndSortedResultRequestDto, //Used for paging/sorting
+ CreateReportFormatTemplateDto,
+ UpdateReportFormatTemplateDto>
+ {
+ private readonly IRepository _userRepository;
+ private readonly ReportFormatTemplateManager _manager;
+ public ReportFormatTemplateAppService(
+ IRepository repository,
+ IRepository userRepository,
+ ReportFormatTemplateManager manager)
+ : base(repository)
+ {
+ _userRepository = userRepository;
+ _manager = manager;
+ }
+
+ ///
+ /// 获取通过主键
+ ///
+ ///
+ ///
+ public override async Task GetAsync(string id)
+ {
+ var entity= await base.GetAsync(id);
+ entity.IsDefaulted = entity.IsDefault.Equals('Y');
+ entity.IsSystemed = entity.IsSystem.Equals('Y');
+ entity.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId);
+ entity.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId);
+ return entity;
+ }
+
+ public async Task GetMaxByIdAsync()
+ {
+ var ent = (await Repository.GetListAsync()).Max(x => x.Id);
+ var entdto = new ReportFormatTemplateDto
+ {
+ Id = !string.IsNullOrEmpty(ent)?ent:"0001"
+ };
+ return entdto;
+ }
+
+ public async Task GetDefaultAsync(string formatId)
+ {
+ var ent = await _manager.GetDefaultAsync(formatId);
+
+ if (ent != null)
+ {
+ var entdto = new ReportFormatTemplateDto
+ {
+ CreationTime = ent.CreationTime,
+ CreatorId = ent.CreatorId,
+ DisplayName = ent.DisplayName,
+ Id = ent.Id,
+ ReportFormatId = ent.ReportFormatId,
+ LastModificationTime = ent.LastModificationTime,
+ LastModifierId = ent.LastModifierId,
+ IsDefault = ent.IsDefault,
+ IsSystem = ent.IsSystem,
+ IsDefaulted = ent.IsDefault.Equals('Y'),
+ IsSystemed = ent.IsSystem.Equals('Y'),
+ TemplateFile=ent.TemplateFile,
+ DataSetJson = ent.DataSetJson,
+ CreatorName = EntityHelper.GetUserName(_userRepository, ent.CreatorId),
+ LastModifierName = EntityHelper.GetUserName(_userRepository, ent.LastModifierId)
+ };
+
+ return entdto;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// 获取列表 项目
+ ///
+ ///
+ ///
+ public override async Task> GetListAsync(PagedAndSortedResultRequestDto input)
+ {
+ return await base.GetListAsync(input);
+ }
+
+ ///
+ /// 获取列表 项目 可以带格式ID搜索
+ ///
+ ///
+ ///
+ public async Task> GetListInReportFormatAsync(string reportFormatId)
+ {
+ int totalCount = 0;
+ var entlist = (await Repository.GetListAsync()).Where(m => m.ReportFormatId == reportFormatId);
+
+ totalCount = entlist.Count();
+
+ var entdto = entlist.Select(s => new ReportFormatTemplateDto
+ {
+ CreationTime = s.CreationTime,
+ CreatorId = s.CreatorId,
+ DisplayName = s.DisplayName,
+ Id = s.Id,
+ ReportFormatId = s.ReportFormatId,
+ LastModificationTime = s.LastModificationTime,
+ LastModifierId = s.LastModifierId,
+ IsDefault = s.IsDefault,
+ IsSystem=s.IsSystem,
+ IsDefaulted=s.IsDefault.Equals('Y'),
+ IsSystemed=s.IsSystem.Equals('Y'),
+ CreatorName = EntityHelper.GetUserName(_userRepository, s.CreatorId),
+ LastModifierName = EntityHelper.GetUserName(_userRepository, s.LastModifierId)
+ }).ToList();
+
+ return new PagedResultDto(totalCount, entdto);
+
+
+ }
+
+ ///
+ /// 创建
+ ///
+ ///
+ ///
+ public override async Task CreateAsync(CreateReportFormatTemplateDto input)
+ {
+ var createEntity = ObjectMapper.Map(input);
+ var entity = await _manager.CreateAsync(createEntity);
+ entity = await Repository.InsertAsync(entity);
+ var dto = ObjectMapper.Map(entity);
+ return dto;
+ }
+
+ public async Task CopyCreateAsync(string id,string newId)
+ {
+ var entity = await _manager.CopyCreateAsync(id,newId);
+ entity = await Repository.InsertAsync(entity);
+ var dto = ObjectMapper.Map(entity);
+ return dto;
+ }
+
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ ///
+ public override async Task UpdateAsync(string id, UpdateReportFormatTemplateDto input)
+ {
+ var entity = await Repository.GetAsync(id);
+ var sourceEntity = ObjectMapper.Map(input);
+ await _manager.UpdateAsync(sourceEntity, entity);
+ entity = await Repository.UpdateAsync(entity);
+ var dto= ObjectMapper.Map(entity);
+ dto.IsDefaulted = entity.IsDefault.Equals('Y');
+ dto.IsSystemed= entity.IsSystem.Equals('Y');
+ dto.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId);
+ dto.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId);
+ return dto;
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ public override Task DeleteAsync(string id)
+ {
+ return base.DeleteAsync(id);
+ }
+
+ [HttpPut("api/app/reportfomattemplate/updatedefault")]
+ public async Task UpdateDefaultAsync(string id)
+ {
+ await _manager.UpdateDefaultAsync(id);
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs b/src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs
new file mode 100644
index 0000000..b5bb307
--- /dev/null
+++ b/src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs
@@ -0,0 +1,182 @@
+using Microsoft.AspNetCore.Mvc;
+using Shentun.Peis.Models;
+using Shentun.Peis.ReportPrinters;
+using Shentun.Peis.Reports;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Identity;
+using Volo.Abp.ObjectMapping;
+
+namespace Shentun.Peis.ReportFormats
+{
+ public class ReportFormatAppService : CrudAppService<
+ ReportFormat, //The Book entity
+ ReportFormatDto, //Used to show books
+ string, //Primary key of the book entity
+ PagedAndSortedResultRequestDto, //Used for paging/sorting
+ CreateReportFormatDto,
+ UpdateReportFormatDto>
+ {
+ private readonly IRepository _userRepository;
+ private readonly ReportFormatManager _manager;
+ public ReportFormatAppService(
+ IRepository repository,
+ IRepository userRepository,
+ ReportFormatManager manager)
+ : base(repository)
+ {
+ _userRepository = userRepository;
+ _manager = manager;
+ }
+
+ ///
+ /// 获取通过主键
+ ///
+ ///
+ ///
+ public override async Task GetAsync(string id)
+ {
+ var entity = await base.GetAsync(id);
+ entity.IsDefaulted = entity.IsDefault.Equals('Y');
+ entity.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId);
+ entity.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId);
+ return entity;
+ }
+
+ public async Task GetMaxByIdAsync()
+ {
+ var ent = (await Repository.GetListAsync()).Max(x => x.Id);
+ var entdto = new ReportFormatDto
+ {
+ Id = !string.IsNullOrEmpty(ent) ? ent : "0001"
+ };
+ return entdto;
+ }
+
+ public async Task GetDefaultAsync(string reportId)
+ {
+ var ent = await _manager.GetDefaultAsync(reportId);
+
+ if (ent!=null)
+ {
+ var entdto = new ReportFormatDto
+ {
+ CreationTime = ent.CreationTime,
+ CreatorId = ent.CreatorId,
+ DisplayName = ent.DisplayName,
+ Id = ent.Id,
+ ReportId = ent.ReportId,
+ LastModificationTime = ent.LastModificationTime,
+ LastModifierId = ent.LastModifierId,
+ IsDefault = ent.IsDefault,
+ IsDefaulted = ent.IsDefault.Equals('Y'),
+ CreatorName = EntityHelper.GetUserName(_userRepository, ent.CreatorId),
+ LastModifierName = EntityHelper.GetUserName(_userRepository, ent.LastModifierId)
+ };
+
+ return entdto;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// 获取列表 项目
+ ///
+ ///
+ ///
+ public override async Task> GetListAsync(PagedAndSortedResultRequestDto input)
+ {
+ return await base.GetListAsync(input);
+ }
+
+ ///
+ /// 获取列表 项目 可以带报表ID搜索
+ ///
+ ///
+ ///
+ public async Task> GetListInReportAsync(string reportId)
+ {
+ int totalCount = 0;
+
+ var entlist = (await Repository.GetListAsync()).Where(m => m.ReportId == reportId);
+
+ totalCount = entlist.Count();
+
+ var entdto = entlist.Select(s => new ReportFormatDto
+ {
+ CreationTime = s.CreationTime,
+ CreatorId = s.CreatorId,
+ DisplayName = s.DisplayName,
+ Id = s.Id,
+ ReportId=s.ReportId,
+ LastModificationTime = s.LastModificationTime,
+ LastModifierId = s.LastModifierId,
+ IsDefault = s.IsDefault,
+ IsDefaulted=s.IsDefault.Equals('Y'),
+ CreatorName = EntityHelper.GetUserName(_userRepository, s.CreatorId),
+ LastModifierName = EntityHelper.GetUserName(_userRepository, s.LastModifierId)
+ }).ToList();
+
+ return new PagedResultDto(totalCount, entdto);
+
+
+ }
+
+ ///
+ /// 创建
+ ///
+ ///
+ ///
+ public override async Task CreateAsync(CreateReportFormatDto input)
+ {
+ var createEntity = ObjectMapper.Map(input);
+ var entity = await _manager.CreateAsync(createEntity);
+ entity = await Repository.InsertAsync(entity);
+ var dto = ObjectMapper.Map(entity);
+ return dto;
+ }
+
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ ///
+ public override async Task UpdateAsync(string id, UpdateReportFormatDto input)
+ {
+ var entity = await Repository.GetAsync(id);
+ var sourceEntity = ObjectMapper.Map(input);
+ await _manager.UpdateAsync(sourceEntity, entity);
+ entity = await Repository.UpdateAsync(entity);
+ var dto= ObjectMapper.Map(entity);
+ dto.IsDefaulted= entity.IsDefault.Equals('Y');
+ dto.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId);
+ dto.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId);
+ return dto;
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ public override Task DeleteAsync(string id)
+ {
+ return base.DeleteAsync(id);
+ }
+
+ [HttpPut("api/app/reportfomat/updatedefault")]
+ public async Task UpdateDefaultAsync(string id)
+ {
+ await _manager.UpdateDefaultAsync(id);
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Application/ReportPrinters/ReportPrinterAppService.cs b/src/Shentun.Peis.Application/ReportPrinters/ReportPrinterAppService.cs
new file mode 100644
index 0000000..0ffb484
--- /dev/null
+++ b/src/Shentun.Peis.Application/ReportPrinters/ReportPrinterAppService.cs
@@ -0,0 +1,162 @@
+using Shentun.Peis.Models;
+using Shentun.Peis.ReportFormats;
+using Shentun.Peis.ReportFormatTemplates;
+using Shentun.Peis.Reports;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Identity;
+using Volo.Abp.ObjectMapping;
+
+namespace Shentun.Peis.ReportPrinters
+{
+ public class ReportPrinterAppService : CrudAppService<
+ ReportPrinter, //The Book entity
+ ReportPrinterDto, //Used to show books
+ string, //Primary key of the book entity
+ PagedAndSortedResultRequestDto, //Used for paging/sorting
+ CreateReportPrinterDto,
+ UpdateReportPrinterDto>
+ {
+ private readonly IRepository _userRepository;
+ private readonly ReportPrinterManager _manager;
+ public ReportPrinterAppService(
+ IRepository repository,
+ IRepository userRepository,
+ ReportPrinterManager manager)
+ : base(repository)
+ {
+ _userRepository = userRepository;
+ _manager = manager;
+ }
+
+ ///
+ /// 获取通过主键
+ ///
+ ///
+ ///
+ public override async Task GetAsync(string id)
+ {
+ return await base.GetAsync(id);
+ }
+
+ public async Task GetMaxByIdAsync()
+ {
+ var ent = (await Repository.GetListAsync()).Max(x => x.Id);
+ var entdto = new ReportPrinterDto
+ {
+ Id = !string.IsNullOrEmpty(ent) ? ent : "0001"
+ };
+ return entdto;
+ }
+
+ public async Task GetLocalPrinter(string reportId,string computerName)
+ {
+ var ent = (await Repository.GetListAsync()).Where(m => m.ReportId == reportId && m.ComputerName.Equals(computerName)).FirstOrDefault();
+ if (ent != null)
+ {
+ var dto = new ReportPrinterDto
+ {
+ CreationTime = ent.CreationTime,
+ CreatorId = ent.CreatorId,
+ ComputerName = ent.ComputerName,
+ Id = ent.Id,
+ ReportId = ent.ReportId,
+ LastModificationTime = ent.LastModificationTime,
+ LastModifierId = ent.LastModifierId,
+ PrinterName = ent.PrinterName,
+ CreatorName = EntityHelper.GetUserName(_userRepository, ent.CreatorId),
+ LastModifierName = EntityHelper.GetUserName(_userRepository, ent.LastModifierId)
+ };
+ return dto;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// 获取列表 项目
+ ///
+ ///
+ ///
+ public override async Task> GetListAsync(PagedAndSortedResultRequestDto input)
+ {
+ return await base.GetListAsync(input);
+ }
+
+ public async Task> GetListInReportAsync(string reportId)
+ {
+ int totalCount = 0;
+
+ var entlist = (await Repository.GetListAsync()).Where(m => m.ReportId == reportId);
+
+ totalCount = entlist.Count();
+
+ var entdto = entlist.Select(s => new ReportPrinterDto
+ {
+ CreationTime = s.CreationTime,
+ CreatorId = s.CreatorId,
+ ComputerName = s.ComputerName,
+ Id = s.Id,
+ ReportId = s.ReportId,
+ LastModificationTime = s.LastModificationTime,
+ LastModifierId = s.LastModifierId,
+ PrinterName = s.PrinterName,
+ CreatorName = EntityHelper.GetUserName(_userRepository, s.CreatorId),
+ LastModifierName = EntityHelper.GetUserName(_userRepository, s.LastModifierId)
+ }).ToList();
+
+ return new PagedResultDto(totalCount, entdto);
+
+
+ }
+
+ ///
+ /// 创建
+ ///
+ ///
+ ///
+ public override async Task CreateAsync(CreateReportPrinterDto input)
+ {
+ var createEntity = ObjectMapper.Map(input);
+ var entity = await _manager.CreateAsync(createEntity);
+ entity = await Repository.InsertAsync(entity);
+ var dto = ObjectMapper.Map(entity);
+ return dto;
+ }
+
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ ///
+ public override async Task UpdateAsync(string id, UpdateReportPrinterDto input)
+ {
+ var entity = await Repository.GetAsync(id);
+ var sourceEntity = ObjectMapper.Map< UpdateReportPrinterDto, ReportPrinter>(input);
+ await _manager.UpdateAsync(sourceEntity, entity);
+ entity = await Repository.UpdateAsync(entity);
+ var dto= ObjectMapper.Map(entity);
+ dto.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId);
+ dto.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId);
+ return dto;
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ public override Task DeleteAsync(string id)
+ {
+ return base.DeleteAsync(id);
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Application/Reports/ReportAppService.cs b/src/Shentun.Peis.Application/Reports/ReportAppService.cs
new file mode 100644
index 0000000..8d7d1f1
--- /dev/null
+++ b/src/Shentun.Peis.Application/Reports/ReportAppService.cs
@@ -0,0 +1,208 @@
+using Shentun.Peis.Items;
+using Shentun.Peis.Models;
+using Shentun.Peis.ReportFormatTemplates;
+using Shentun.Peis.SampleTypes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Identity;
+//using FastReport.Web;
+using Newtonsoft.Json;
+using System.Data;
+using TencentCloud.Mrs.V20200910.Models;
+//using FastReport.Export;
+//using FastReport.Export.PdfSimple;
+using System.IO;
+
+namespace Shentun.Peis.Reports
+{
+ public class ReportAppService : CrudAppService<
+ Report, //The Book entity
+ ReportDto, //Used to show books
+ string, //Primary key of the book entity
+ PagedAndSortedResultRequestDto, //Used for paging/sorting
+ CreateReportDto,
+ UpdateReportDto>
+ {
+ private readonly IRepository _userRepository;
+ private readonly IRepository _reportFormatRepository;
+ private readonly IRepository _reportFormatTemplateRepository;
+ private readonly ReportManager _manager;
+ public ReportAppService(
+ IRepository repository,
+ IRepository userRepository,
+ ReportManager manager,
+ IRepository reportFormatRepository,
+ IRepository reportFormatTemplateRepository)
+ : base(repository)
+ {
+ _userRepository = userRepository;
+ _manager = manager;
+ _reportFormatRepository = reportFormatRepository;
+ _reportFormatTemplateRepository = reportFormatTemplateRepository;
+ }
+
+ ///
+ /// 获取通过主键
+ ///
+ ///
+ ///
+ public override async Task GetAsync(string id)
+ {
+ //return await base.GetAsync(id);
+ var entity= await base.GetAsync(id);
+ entity.IsActived = entity.IsActive.Equals('Y');
+ entity.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId);
+
+ entity.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId);
+ return entity;
+ }
+
+ ///
+ /// 获取列表 项目
+ ///
+ ///
+ ///
+ public override async Task> GetListAsync(PagedAndSortedResultRequestDto input)
+ {
+ return await base.GetListAsync(input);
+ }
+
+ public async Task GetMaxByIdAsync()
+ {
+ var ent = (await Repository.GetListAsync()).Max(x => x.Id);
+ var entdto = new ReportDto
+ {
+ Id = !string.IsNullOrEmpty(ent) ? ent : "0001"
+ };
+ return entdto;
+ }
+ /*
+ public async Task GetPrintReport(GetReportInFilterDto input)
+ {
+ var entity = await base.GetAsync(input.ReportId);
+ if (entity == null) return null;
+ if (!entity.IsActive.Equals('Y'))
+ throw new Volo.Abp.UserFriendlyException($"报表:'{entity.DisplayName}'未启用,请启用后再操作");
+
+ var dtoformat = await _reportFormatRepository.GetAsync(p => p.ReportId.Equals(entity.Id) && p.IsDefault.Equals('Y'));
+ if (dtoformat == null)
+ throw new Volo.Abp.UserFriendlyException($"报表:'{entity.DisplayName}'的格式中未找到默认格式,请设置默认后再操作");
+
+ var dtotmp = await _reportFormatTemplateRepository.GetAsync(p => p.ReportFormatId.Equals(dtoformat.Id) && p.IsDefault.Equals('Y'));
+ if (dtotmp == null)
+ throw new Volo.Abp.UserFriendlyException($"报表:'{entity.DisplayName}'的模板中未找到默认模板,请设置默认后再操作");
+
+ if (string.IsNullOrEmpty(dtotmp.TemplateFile))
+ throw new Volo.Abp.UserFriendlyException($"模板:'{dtotmp.DisplayName}'的报表模板未设置,请设置后再操作");
+
+ if (string.IsNullOrEmpty(dtotmp.DataSetJson))
+ throw new Volo.Abp.UserFriendlyException($"模板:'{dtotmp.DisplayName}'的数据集未设置,请设置后再操作");
+
+ FastReport.Report report = new FastReport.Report();
+ report.LoadFromString(dtotmp.TemplateFile);
+
+ DataSet ds = JsonConvert.DeserializeObject(input.DataSetJson);
+ report.RegisterData(ds);
+
+ PrintParameterDto para = JsonConvert.DeserializeObject(input.ParameterJson);
+ Dictionary dict = new Dictionary();
+ foreach (var item in para.Parameters)
+ {
+ report.SetParameterValue(item.Name, item.Value);
+ }
+
+ report.Prepare();
+
+ MemoryStream ms = new MemoryStream();
+ PDFSimpleExport pdfExport = new PDFSimpleExport();
+ pdfExport.Export(report, ms);
+ ms.Flush();
+
+ return null;
+ }
+ */
+ ///
+ /// 获取列表 项目 可以带名称搜索
+ ///
+ ///
+ ///
+ public async Task> GetListInFilterNotOrderAsync(GetListInFilterDto input)
+ {
+ int totalCount = 0;
+
+ if (!string.IsNullOrEmpty(input.Filter))
+ totalCount = (await Repository.GetListAsync()).Where(m => m.DisplayName.Contains(input.Filter)).Count();
+ else
+ totalCount = await Repository.CountAsync();
+
+
+ var entlist = await PageHelper.GetPageListInFitlerNotOrder(Repository, _userRepository, input);
+
+ var entdto = entlist.Select(s => new ReportDto
+ {
+ CreationTime = s.CreationTime,
+ CreatorId = s.CreatorId,
+ DisplayName = s.DisplayName,
+ Id = s.Id,
+ LastModificationTime = s.LastModificationTime,
+ LastModifierId = s.LastModifierId,
+ IsActive = s.IsActive,
+ IsActived=s.IsActive.Equals('Y'),
+ CreatorName = EntityHelper.GetUserName(_userRepository, s.CreatorId),
+ LastModifierName = EntityHelper.GetUserName(_userRepository, s.LastModifierId)
+ }).ToList();
+
+ return new PagedResultDto(totalCount, entdto);
+
+
+ }
+
+ ///
+ /// 创建
+ ///
+ ///
+ ///
+ public override async Task CreateAsync(CreateReportDto input)
+ {
+ var createEntity = ObjectMapper.Map(input);
+ var entity = await _manager.CreateAsync(createEntity);
+ entity = await Repository.InsertAsync(entity);
+ var dto = ObjectMapper.Map(entity);
+ return dto;
+ }
+
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ ///
+ public override async Task UpdateAsync(string id, UpdateReportDto input)
+ {
+ var entity = await Repository.GetAsync(id);
+ var sourceEntity = ObjectMapper.Map(input);
+ await _manager.UpdateAsync(sourceEntity, entity);
+ entity = await Repository.UpdateAsync(entity);
+ var dto = ObjectMapper.Map(entity);
+ dto.IsActived = entity.IsActive.Equals('Y');
+ dto.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId);
+ dto.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId);
+ return dto;
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ public override Task DeleteAsync(string id)
+ {
+ return base.DeleteAsync(id);
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Domain/EntityHelper.cs b/src/Shentun.Peis.Domain/EntityHelper.cs
index 52c8915..d911726 100644
--- a/src/Shentun.Peis.Domain/EntityHelper.cs
+++ b/src/Shentun.Peis.Domain/EntityHelper.cs
@@ -178,6 +178,43 @@ namespace Shentun.Peis
}
}
+ public static async Task CheckEqualsId(IRepository repository, string Id)
+ where TEntity : class, IEntity
+ {
+ Check.NotNullOrWhiteSpace(Id, nameof(Id));
+
+ TEntity existEntity;
+
+ existEntity = await repository.FindAsync(o => o.Id.Equals(Id));
+
+ if (existEntity != null)
+ {
+ throw new UserFriendlyException($"主键冲突:'{Id}'已存在,请核对本地起始号是否重复");
+ }
+ }
+
+ public static async Task CheckEqualsName(IRepository repository, string name, TEntity updatedEntity = null)
+ where TEntity : class, IEntity, IDisplayName
+ {
+ Check.NotNullOrWhiteSpace(name, nameof(name));
+ TEntity existEntity;
+
+ if (updatedEntity == null)
+ {
+ existEntity = await repository.FindAsync(o => o.DisplayName == name);
+ }
+ else
+ {
+ existEntity = await repository.FindAsync(o => !(o.Id.Equals(updatedEntity.Id)) && o.DisplayName == name);
+ }
+
+
+ if (existEntity != null)
+ {
+ throw new UserFriendlyException($"名称:'{name}'已存在");
+ }
+ }
+
///
/// 检查国家标准码同名
diff --git a/src/Shentun.Peis.Domain/Models/Report.cs b/src/Shentun.Peis.Domain/Models/Report.cs
new file mode 100644
index 0000000..0e830a8
--- /dev/null
+++ b/src/Shentun.Peis.Domain/Models/Report.cs
@@ -0,0 +1,44 @@
+using Microsoft.EntityFrameworkCore;
+using NPOI.SS.Formula.Functions;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Entities.Auditing;
+
+namespace Shentun.Peis.Models
+{
+ [Table("report")]
+ public class Report:AuditedEntity, IDisplayName
+ {
+ public Report() {
+
+ }
+
+ [Column("Id")]
+ [Comment("主键Id")]
+ [StringLength(16)]
+ public override string Id { get => base.Id; protected set => base.Id = value; }
+
+ [Column("display_name")]
+ [Comment("报表名称")]
+ [StringLength(64)]
+ public string DisplayName { get; set; } = null!;
+
+ [Column("isActive")]
+ [Comment("启用标志(N:禁用,Y:启用)")]
+ [Required]
+ [MaxLength(1)]
+ [DefaultValue('N')]
+ public char IsActive { get; set; }
+
+ public void SetId(string id)
+ {
+ Id = id;
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Domain/Models/ReportFormat.cs b/src/Shentun.Peis.Domain/Models/ReportFormat.cs
new file mode 100644
index 0000000..1493035
--- /dev/null
+++ b/src/Shentun.Peis.Domain/Models/ReportFormat.cs
@@ -0,0 +1,52 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Entities.Auditing;
+
+namespace Shentun.Peis.Models
+{
+ [Table("report_format")]
+ public class ReportFormat:AuditedEntity, IDisplayName
+ {
+
+ public ReportFormat() {
+
+ }
+
+ [Column("Id")]
+ [Comment("主键Id")]
+ [StringLength(16)]
+ public override string Id { get => base.Id; protected set => base.Id = value; }
+
+ [Column("display_name")]
+ [Comment("格式名称")]
+ [StringLength(64)]
+ public string DisplayName { get; set; } = null!;
+
+ [Column("isDefault")]
+ [Comment("默认标志(N:不默认,Y:默认)")]
+ [Required]
+ [MaxLength(1)]
+ [DefaultValue('N')]
+ public char IsDefault { get; set; }
+
+ [ForeignKey("ReportId")]
+ public Report Report { get; set; }
+
+ [Column("report_id")]
+ [Comment("报表ID")]
+ public string ReportId { get; set; }
+
+
+ public void SetId(string id)
+ {
+ Id = id;
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Domain/Models/ReportFormatTemplate.cs b/src/Shentun.Peis.Domain/Models/ReportFormatTemplate.cs
new file mode 100644
index 0000000..60d14a9
--- /dev/null
+++ b/src/Shentun.Peis.Domain/Models/ReportFormatTemplate.cs
@@ -0,0 +1,69 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Entities.Auditing;
+
+namespace Shentun.Peis.Models
+{
+ [Table("report_format_template")]
+ public class ReportFormatTemplate:AuditedEntity, IDisplayName
+ {
+
+ [Column("Id")]
+ [Comment("主键Id")]
+ [StringLength(16)]
+ public override string Id { get => base.Id; protected set => base.Id = value; }
+
+ [ForeignKey("ReportFormatId")]
+ public ReportFormat ReportFormat { get; set; }
+
+ [Column("report_format_id")]
+ [Comment("报表格式ID")]
+ public string ReportFormatId { get; set; }
+
+ [Column("display_name")]
+ [Comment("模板名称")]
+ [MaxLength(128)]
+ public string DisplayName { get; set; }
+
+ [Column("template_file_type")]
+ [Comment("模板文件类型(0:FastReport,1:Grid++Report)")]
+ [Required]
+ [MaxLength(1)]
+ [DefaultValue('0')]
+ public char TemplateFileType { get; set; }
+
+ [Column("template_file")]
+ [Comment("模板文件")]
+ public string TemplateFile { get; set; }
+
+ [Column("data_set_json")]
+ [Comment("模板文件")]
+ public string DataSetJson { get; set; }
+
+ [Column("isSystem")]
+ [Comment("是否系统自定义(N:停用,Y:启用)")]
+ [Required]
+ [MaxLength(1)]
+ [DefaultValue('N')]
+ public char IsSystem { get; set; }
+
+ [Column("isDefault")]
+ [Comment("是否默认(N:不默认,Y:默认)")]
+ [Required]
+ [MaxLength(1)]
+ [DefaultValue('N')]
+ public char IsDefault { get; set; }
+
+ public void SetId(string id)
+ {
+ Id = id;
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Domain/Models/ReportPrinter.cs b/src/Shentun.Peis.Domain/Models/ReportPrinter.cs
new file mode 100644
index 0000000..2dc8604
--- /dev/null
+++ b/src/Shentun.Peis.Domain/Models/ReportPrinter.cs
@@ -0,0 +1,43 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Entities.Auditing;
+
+namespace Shentun.Peis.Models
+{
+ [Table("report_printer")]
+ public class ReportPrinter:AuditedEntity
+ {
+ [Column("Id")]
+ [Comment("主键Id")]
+ [StringLength(16)]
+ public override string Id { get => base.Id; protected set => base.Id = value; }
+
+ [Column("pc_name")]
+ [Comment("计算机名称")]
+ [StringLength(64)]
+ public string ComputerName { get; set; } = null!;
+
+ [Column("printer_name")]
+ [Comment("打印机名称")]
+ [StringLength(64)]
+ public string PrinterName { get; set; } = null!;
+
+ [ForeignKey("ReportId")]
+ public Report Report { get; set; }
+
+ [Column("report_id")]
+ [Comment("报表ID")]
+ public string ReportId { get; set; }
+
+ public void SetId(string id)
+ {
+ Id= id;
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Domain/ReportFormatTemplates/ReportFormatTemplateManager.cs b/src/Shentun.Peis.Domain/ReportFormatTemplates/ReportFormatTemplateManager.cs
new file mode 100644
index 0000000..ddffb93
--- /dev/null
+++ b/src/Shentun.Peis.Domain/ReportFormatTemplates/ReportFormatTemplateManager.cs
@@ -0,0 +1,104 @@
+using Shentun.Peis.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Domain.Services;
+
+namespace Shentun.Peis.ReportFormatTemplates
+{
+ public class ReportFormatTemplateManager : DomainService
+ {
+ private readonly IRepository _repository;
+ public ReportFormatTemplateManager(IRepository repository)
+ {
+ _repository = repository;
+ }
+
+ public async Task GetDefaultAsync(string formatId)
+ {
+ var ent = (await _repository.GetListAsync()).Where(m => m.ReportFormatId == formatId && m.IsDefault.Equals('Y')).FirstOrDefault();
+
+ return ent;
+ }
+
+ public async Task CreateAsync(
+ ReportFormatTemplate entity
+ )
+ {
+ Check.NotNullOrWhiteSpace(entity.DisplayName, nameof(entity.DisplayName));
+ await EntityHelper.CheckEqualsId(_repository, entity.Id);
+ await EntityHelper.CheckEqualsName(_repository, entity.DisplayName);
+ var var = new ReportFormatTemplate()
+ {
+ DisplayName = entity.DisplayName,
+ IsDefault = entity.IsDefault,
+ ReportFormatId = entity.ReportFormatId,
+ TemplateFileType = entity.TemplateFileType,
+ TemplateFile=entity.TemplateFile,
+ IsSystem=entity.IsSystem,
+ DataSetJson=entity.DataSetJson,
+ };
+ var.SetId(entity.Id);
+ return var;
+ }
+
+ public async Task CopyCreateAsync(string id,string newId)
+ {
+ var ent = (await _repository.GetListAsync()).Where(m => m.Id == id).First();
+
+ var var = new ReportFormatTemplate()
+ {
+ DisplayName = ent.DisplayName+"复制",
+ IsDefault = 'N',
+ ReportFormatId = ent.ReportFormatId,
+ TemplateFileType = ent.TemplateFileType,
+ TemplateFile = ent.TemplateFile,
+ IsSystem = 'N',
+ DataSetJson = ent.DataSetJson,
+ };
+ var.SetId(newId);
+ return var;
+ }
+
+ public async Task UpdateAsync(
+ ReportFormatTemplate sourceEntity,
+ ReportFormatTemplate targetEntity
+ )
+ {
+ Check.NotNullOrWhiteSpace(sourceEntity.DisplayName, nameof(sourceEntity.DisplayName));
+ if (sourceEntity.DisplayName != targetEntity.DisplayName)
+ {
+ await EntityHelper.CheckEqualsName(_repository, sourceEntity.DisplayName, targetEntity);
+ targetEntity.DisplayName = sourceEntity.DisplayName;
+ }
+ targetEntity.TemplateFileType = sourceEntity.TemplateFileType;
+ targetEntity.TemplateFile = sourceEntity.TemplateFile;
+ targetEntity.DataSetJson=sourceEntity.DataSetJson;
+ }
+
+ public async Task UpdateDefaultAsync(string id)
+ {
+ var entity = await _repository.GetAsync(id);
+ if (entity != null)
+ {
+ entity.IsDefault = 'Y';
+
+ List UptList = new List();
+ UptList = await _repository.GetListAsync(o => o.ReportFormatId == entity.ReportFormatId && o.Id != id && o.IsDefault == 'Y');
+ foreach (var upt in UptList)
+ {
+ upt.IsDefault = 'N';
+ }
+
+ UptList.Add(entity);
+
+
+ await _repository.UpdateManyAsync(UptList);
+ }
+ }
+ }
+}
diff --git a/src/Shentun.Peis.Domain/ReportFormats/ReportFormatManager.cs b/src/Shentun.Peis.Domain/ReportFormats/ReportFormatManager.cs
new file mode 100644
index 0000000..92e2e02
--- /dev/null
+++ b/src/Shentun.Peis.Domain/ReportFormats/ReportFormatManager.cs
@@ -0,0 +1,82 @@
+using Shentun.Peis.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Domain.Services;
+
+namespace Shentun.Peis.ReportFormats
+{
+ public class ReportFormatManager : DomainService
+ {
+ private readonly IRepository _repository;
+ public ReportFormatManager(IRepository repository)
+ {
+ _repository = repository;
+ }
+
+ public async Task GetDefaultAsync(string reportId)
+ {
+ var ent = (await _repository.GetListAsync()).Where(m => m.ReportId == reportId && m.IsDefault.Equals('Y')).FirstOrDefault();
+
+ return ent;
+ }
+
+ public async Task CreateAsync(
+ ReportFormat entity
+ )
+ {
+ Check.NotNullOrWhiteSpace(entity.DisplayName, nameof(entity.DisplayName));
+ await EntityHelper.CheckEqualsId(_repository, entity.Id);
+ await EntityHelper.CheckEqualsName(_repository, entity.DisplayName);
+ var var = new ReportFormat()
+ {
+ DisplayName = entity.DisplayName,
+ IsDefault= entity.IsDefault,
+ ReportId= entity.ReportId
+ };
+ var.SetId(entity.Id);
+ return var;
+ }
+
+ public async Task UpdateAsync(
+ ReportFormat sourceEntity,
+ ReportFormat targetEntity
+ )
+ {
+ Check.NotNullOrWhiteSpace(sourceEntity.DisplayName, nameof(sourceEntity.DisplayName));
+ if (sourceEntity.DisplayName != targetEntity.DisplayName)
+ {
+ await EntityHelper.CheckEqualsName(_repository, sourceEntity.DisplayName, targetEntity);
+ targetEntity.DisplayName = sourceEntity.DisplayName;
+ }
+ }
+
+ public async Task UpdateDefaultAsync(string id)
+ {
+ var entity = await _repository.GetAsync(id);
+ if (entity != null)
+ {
+ entity.IsDefault = 'Y';
+
+ List UptList = new List();
+ UptList = await _repository.GetListAsync(o => o.ReportId == entity.ReportId && o.Id != id && o.IsDefault == 'Y');
+ foreach (var upt in UptList)
+ {
+ upt.IsDefault = 'N';
+ }
+
+ UptList.Add(entity);
+
+
+ await _repository.UpdateManyAsync(UptList);
+ }
+ }
+
+
+
+ }
+}
diff --git a/src/Shentun.Peis.Domain/ReportPrinters/ReportPrinterManager.cs b/src/Shentun.Peis.Domain/ReportPrinters/ReportPrinterManager.cs
new file mode 100644
index 0000000..4310f86
--- /dev/null
+++ b/src/Shentun.Peis.Domain/ReportPrinters/ReportPrinterManager.cs
@@ -0,0 +1,67 @@
+using Shentun.Peis.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Domain.Services;
+
+namespace Shentun.Peis.ReportPrinters
+{
+ public class ReportPrinterManager : DomainService
+ {
+ private readonly IRepository _repository;
+ public ReportPrinterManager(IRepository repository)
+ {
+ _repository = repository;
+ }
+
+
+ private async Task ExistsAsync(ReportPrinter entity)
+ {
+ var cnt = await _repository.CountAsync(p => p.ReportId == entity.ReportId && p.ComputerName.Equals(entity.ComputerName) && p.PrinterName.Equals(entity.PrinterName));
+ if (cnt > 0)
+ throw new UserFriendlyException($"打印机名称:'{entity.PrinterName}'在计算机:'{entity.ComputerName}'中已存在");
+
+ cnt = await _repository.CountAsync(p => p.ReportId == entity.ReportId && p.ComputerName.Equals(entity.ComputerName));
+ if (cnt > 0)
+ throw new UserFriendlyException($"本地打印机限制一台打印机对应一张报表");
+ }
+
+ public async Task CreateAsync(ReportPrinter entity)
+ {
+ Check.NotNullOrWhiteSpace(entity.ComputerName, nameof(entity.ComputerName));
+ Check.NotNullOrWhiteSpace(entity.PrinterName, nameof(entity.PrinterName));
+ await EntityHelper.CheckEqualsId(_repository, entity.Id);
+
+ await ExistsAsync(entity);
+
+ var var = new ReportPrinter()
+ {
+ ComputerName = entity.ComputerName,
+ PrinterName = entity.PrinterName,
+ ReportId= entity.ReportId
+ };
+ var.SetId(entity.Id);
+ return var;
+ }
+
+ public async Task UpdateAsync(
+ ReportPrinter sourceEntity,
+ ReportPrinter targetEntity
+ )
+ {
+ Check.NotNullOrWhiteSpace(sourceEntity.ComputerName, nameof(sourceEntity.ComputerName));
+ Check.NotNullOrWhiteSpace(sourceEntity.PrinterName, nameof(sourceEntity.PrinterName));
+
+ if (sourceEntity.PrinterName != targetEntity.PrinterName)
+ {
+ await ExistsAsync(sourceEntity);
+ targetEntity.PrinterName = sourceEntity.PrinterName;
+ }
+ }
+
+ }
+}
diff --git a/src/Shentun.Peis.Domain/Reports/ReportManager.cs b/src/Shentun.Peis.Domain/Reports/ReportManager.cs
new file mode 100644
index 0000000..49ef57a
--- /dev/null
+++ b/src/Shentun.Peis.Domain/Reports/ReportManager.cs
@@ -0,0 +1,55 @@
+using Shentun.Peis.Models;
+using Shentun.Utilities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading.Tasks;
+using TencentCloud.Sts.V20180813.Models;
+using Volo.Abp;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Domain.Services;
+
+namespace Shentun.Peis.Reports
+{
+ public class ReportManager:DomainService
+ {
+ private readonly IRepository _repository;
+ public ReportManager(IRepository repository)
+ {
+ _repository = repository;
+ }
+
+ public async Task CreateAsync(
+ Report entity
+ )
+ {
+ Check.NotNullOrWhiteSpace(entity.DisplayName, nameof(entity.DisplayName));
+ await EntityHelper.CheckEqualsId(_repository, entity.Id);
+
+ await EntityHelper.CheckEqualsName(_repository, entity.DisplayName);
+ var report = new Report()
+ {
+ DisplayName = entity.DisplayName,
+ IsActive = entity.IsActive
+ };
+ report.SetId(entity.Id);
+ return report;
+ }
+
+ public async Task UpdateAsync(
+ Report sourceEntity,
+ Report targetEntity
+ )
+ {
+ Check.NotNullOrWhiteSpace(sourceEntity.DisplayName, nameof(sourceEntity.DisplayName));
+ if (sourceEntity.DisplayName != targetEntity.DisplayName)
+ {
+ await EntityHelper.CheckEqualsName(_repository, sourceEntity.DisplayName, targetEntity);
+ targetEntity.DisplayName = sourceEntity.DisplayName;
+ }
+ targetEntity.IsActive = sourceEntity.IsActive;
+ }
+ }
+}
diff --git a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
index 97278d5..b3ec790 100644
--- a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
+++ b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
@@ -210,7 +210,10 @@ public class PeisDbContext :
public DbSet UserGroupings { get; set; } = null!;
public DbSet UserItemTypes { get; set; } = null!;
public DbSet UserRights { get; set; } = null!;
-
+ public DbSet Reports { get; set; } = null!;
+ public DbSet ReportFormats { get; set; } = null!;
+ public DbSet ReportFormatTemplates { get; set; } = null!;
+ public DbSet ReportPrinters { get; set; } = null!;
#endregion
@@ -3228,5 +3231,57 @@ public class PeisDbContext :
#endregion
+
+ #region 自定义报表
+ builder.Entity(entity =>
+ {
+ entity.HasComment("自定义报表主表");
+
+
+ entity.Property(e => e.IsActive).HasDefaultValueSql("N");
+
+ entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
+
+ entity.ConfigureByConvention();
+ });
+
+ builder.Entity(entity =>
+ {
+ entity.HasComment("自定义报表格式表");
+
+ entity.Property(e => e.IsDefault).HasDefaultValueSql("N");
+
+ entity.Property(e => e.ReportId).IsFixedLength();
+
+ entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
+
+
+ entity.ConfigureByConvention();
+ });
+
+ builder.Entity(entity =>
+ {
+ entity.HasComment("自定义报表格式模板表");
+
+ entity.Property(e => e.IsDefault).HasDefaultValueSql("N");
+ entity.Property(e => e.IsSystem).HasDefaultValueSql("N");
+ entity.Property(e => e.TemplateFileType).HasDefaultValueSql("1");
+
+ entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
+
+
+ entity.ConfigureByConvention();
+ });
+
+ builder.Entity(entity =>
+ {
+ entity.HasComment("自定义报表客户端打印机设置表");
+
+ entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
+
+
+ entity.ConfigureByConvention();
+ });
+ #endregion
}
}