30 changed files with 1719 additions and 1 deletions
-
19src/Shentun.Peis.Application.Contracts/GetReportInFilterDto.cs
-
43src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/CreateReportFormatTemplateDto.cs
-
59src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/ReportFormatTemplateDto.cs
-
24src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs
-
26src/Shentun.Peis.Application.Contracts/ReportFormats/CreateReportFormatDto.cs
-
37src/Shentun.Peis.Application.Contracts/ReportFormats/ReportFormatDto.cs
-
24src/Shentun.Peis.Application.Contracts/ReportFormats/UpdateReportFormatDto.cs
-
26src/Shentun.Peis.Application.Contracts/ReportPrinters/CreateReportPrinterDto.cs
-
35src/Shentun.Peis.Application.Contracts/ReportPrinters/ReportPrinterDto.cs
-
23src/Shentun.Peis.Application.Contracts/ReportPrinters/UpdateReportPrinterDto.cs
-
15src/Shentun.Peis.Application.Contracts/Reports/CreateReportDto.cs
-
11src/Shentun.Peis.Application.Contracts/Reports/PrintParameterDto.cs
-
35src/Shentun.Peis.Application.Contracts/Reports/ReportDto.cs
-
13src/Shentun.Peis.Application.Contracts/Reports/ReportFileDto.cs
-
13src/Shentun.Peis.Application.Contracts/Reports/ReportParameterDto.cs
-
13src/Shentun.Peis.Application.Contracts/Reports/UpdateReportDto.cs
-
2src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
-
197src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs
-
182src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs
-
162src/Shentun.Peis.Application/ReportPrinters/ReportPrinterAppService.cs
-
208src/Shentun.Peis.Application/Reports/ReportAppService.cs
-
37src/Shentun.Peis.Domain/EntityHelper.cs
-
44src/Shentun.Peis.Domain/Models/Report.cs
-
52src/Shentun.Peis.Domain/Models/ReportFormat.cs
-
69src/Shentun.Peis.Domain/Models/ReportFormatTemplate.cs
-
43src/Shentun.Peis.Domain/Models/ReportPrinter.cs
-
104src/Shentun.Peis.Domain/ReportFormatTemplates/ReportFormatTemplateManager.cs
-
82src/Shentun.Peis.Domain/ReportFormats/ReportFormatManager.cs
-
67src/Shentun.Peis.Domain/ReportPrinters/ReportPrinterManager.cs
-
55src/Shentun.Peis.Domain/Reports/ReportManager.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; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表格式ID
|
||||
|
/// </summary>
|
||||
|
public string ReportFormatId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 格式名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 模板文件类型 0:fastereport 1:Grid++Report
|
||||
|
/// </summary>
|
||||
|
public char TemplateFileType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 模板文件
|
||||
|
/// </summary>
|
||||
|
public string TemplateFile { get; set; } |
||||
|
|
||||
|
public string DataSetJson { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否系统自定义(Y:是,N:否)
|
||||
|
/// </summary>
|
||||
|
public char IsSystem { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否默认(Y:是,N:否)
|
||||
|
/// </summary>
|
||||
|
public char IsDefault { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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<string> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 报表格式ID
|
||||
|
/// </summary>
|
||||
|
public string ReportFormatId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 格式名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 模板文件类型 0:fastereport 1:Grid++Report
|
||||
|
/// </summary>
|
||||
|
public char TemplateFileType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 模板文件
|
||||
|
/// </summary>
|
||||
|
public string TemplateFile { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 数据集Json
|
||||
|
/// </summary>
|
||||
|
public string DataSetJson { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否系统自定义(Y:是,N:否)
|
||||
|
/// </summary>
|
||||
|
public char IsSystem { get; set; } |
||||
|
|
||||
|
public bool IsSystemed { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否默认(Y:是,N:否)
|
||||
|
/// </summary>
|
||||
|
public char IsDefault { get; set; } |
||||
|
|
||||
|
public bool IsDefaulted { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建者
|
||||
|
/// </summary>
|
||||
|
public string CreatorName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 最后修改者
|
||||
|
/// </summary>
|
||||
|
public string LastModifierName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表名称
|
||||
|
/// </summary>
|
||||
|
public char IsDefault { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表ID
|
||||
|
/// </summary>
|
||||
|
public string ReportId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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<string> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 报表名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表名称
|
||||
|
/// </summary>
|
||||
|
public char IsDefault { get; set; } |
||||
|
|
||||
|
public bool IsDefaulted { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表ID
|
||||
|
/// </summary>
|
||||
|
public string ReportId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建者
|
||||
|
/// </summary>
|
||||
|
public string CreatorName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 最后修改者
|
||||
|
/// </summary>
|
||||
|
public string LastModifierName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.ReportFormats |
||||
|
{ |
||||
|
public class UpdateReportFormatDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 报表名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表名称
|
||||
|
/// </summary>
|
||||
|
public char IsDefault { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表ID
|
||||
|
/// </summary>
|
||||
|
public string ReportId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表ID
|
||||
|
/// </summary>
|
||||
|
public string ReportId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计算机名称
|
||||
|
/// </summary>
|
||||
|
public string ComputerName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打印机名称
|
||||
|
/// </summary>
|
||||
|
public string PrinterName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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<string> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 计算机名称
|
||||
|
/// </summary>
|
||||
|
public string ComputerName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打印机名称
|
||||
|
/// </summary>
|
||||
|
public string PrinterName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报表ID
|
||||
|
/// </summary>
|
||||
|
public string ReportId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建者
|
||||
|
/// </summary>
|
||||
|
public string CreatorName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 最后修改者
|
||||
|
/// </summary>
|
||||
|
public string LastModifierName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.ReportPrinters |
||||
|
{ |
||||
|
public class UpdateReportPrinterDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 报表ID
|
||||
|
/// </summary>
|
||||
|
public string ReportId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 计算机名称
|
||||
|
/// </summary>
|
||||
|
public string ComputerName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打印机名称
|
||||
|
/// </summary>
|
||||
|
public string PrinterName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Reports |
||||
|
{ |
||||
|
public class PrintParameterDto |
||||
|
{ |
||||
|
public List<ReportParameterDto> Parameters { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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<string> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 报表名称
|
||||
|
/// </summary>
|
||||
|
public string DisplayName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 启用
|
||||
|
/// </summary>
|
||||
|
public char IsActive { get; set; } |
||||
|
|
||||
|
|
||||
|
public bool IsActived { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建者
|
||||
|
/// </summary>
|
||||
|
public string CreatorName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 最后修改者
|
||||
|
/// </summary>
|
||||
|
public string LastModifierName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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<IdentityUser, Guid> _userRepository; |
||||
|
private readonly ReportFormatTemplateManager _manager; |
||||
|
public ReportFormatTemplateAppService( |
||||
|
IRepository<ReportFormatTemplate, string> repository, |
||||
|
IRepository<IdentityUser, Guid> userRepository, |
||||
|
ReportFormatTemplateManager manager) |
||||
|
: base(repository) |
||||
|
{ |
||||
|
_userRepository = userRepository; |
||||
|
_manager = manager; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取通过主键
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportFormatTemplateDto> 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<ReportFormatTemplateDto> 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<ReportFormatTemplateDto> 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; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 项目
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<PagedResultDto<ReportFormatTemplateDto>> GetListAsync(PagedAndSortedResultRequestDto input) |
||||
|
{ |
||||
|
return await base.GetListAsync(input); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 项目 可以带格式ID搜索
|
||||
|
/// </summary>
|
||||
|
/// <param name="reportFormatId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task<PagedResultDto<ReportFormatTemplateDto>> 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<ReportFormatTemplateDto>(totalCount, entdto); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportFormatTemplateDto> CreateAsync(CreateReportFormatTemplateDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateReportFormatTemplateDto, ReportFormatTemplate>(input); |
||||
|
var entity = await _manager.CreateAsync(createEntity); |
||||
|
entity = await Repository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<ReportFormatTemplate, ReportFormatTemplateDto>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
public async Task<ReportFormatTemplateDto> CopyCreateAsync(string id,string newId) |
||||
|
{ |
||||
|
var entity = await _manager.CopyCreateAsync(id,newId); |
||||
|
entity = await Repository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<ReportFormatTemplate, ReportFormatTemplateDto>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportFormatTemplateDto> UpdateAsync(string id, UpdateReportFormatTemplateDto input) |
||||
|
{ |
||||
|
var entity = await Repository.GetAsync(id); |
||||
|
var sourceEntity = ObjectMapper.Map<UpdateReportFormatTemplateDto, ReportFormatTemplate>(input); |
||||
|
await _manager.UpdateAsync(sourceEntity, entity); |
||||
|
entity = await Repository.UpdateAsync(entity); |
||||
|
var dto= ObjectMapper.Map<ReportFormatTemplate, ReportFormatTemplateDto>(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; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<IdentityUser, Guid> _userRepository; |
||||
|
private readonly ReportFormatManager _manager; |
||||
|
public ReportFormatAppService( |
||||
|
IRepository<ReportFormat, string> repository, |
||||
|
IRepository<IdentityUser, Guid> userRepository, |
||||
|
ReportFormatManager manager) |
||||
|
: base(repository) |
||||
|
{ |
||||
|
_userRepository = userRepository; |
||||
|
_manager = manager; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取通过主键
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportFormatDto> 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<ReportFormatDto> 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<ReportFormatDto> 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; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 项目
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<PagedResultDto<ReportFormatDto>> GetListAsync(PagedAndSortedResultRequestDto input) |
||||
|
{ |
||||
|
return await base.GetListAsync(input); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 项目 可以带报表ID搜索
|
||||
|
/// </summary>
|
||||
|
/// <param name="reportId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task<PagedResultDto<ReportFormatDto>> 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<ReportFormatDto>(totalCount, entdto); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportFormatDto> CreateAsync(CreateReportFormatDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateReportFormatDto, ReportFormat>(input); |
||||
|
var entity = await _manager.CreateAsync(createEntity); |
||||
|
entity = await Repository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<ReportFormat, ReportFormatDto>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportFormatDto> UpdateAsync(string id, UpdateReportFormatDto input) |
||||
|
{ |
||||
|
var entity = await Repository.GetAsync(id); |
||||
|
var sourceEntity = ObjectMapper.Map<UpdateReportFormatDto, ReportFormat>(input); |
||||
|
await _manager.UpdateAsync(sourceEntity, entity); |
||||
|
entity = await Repository.UpdateAsync(entity); |
||||
|
var dto= ObjectMapper.Map<ReportFormat, ReportFormatDto>(entity); |
||||
|
dto.IsDefaulted= entity.IsDefault.Equals('Y'); |
||||
|
dto.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId); |
||||
|
dto.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId); |
||||
|
return dto; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<IdentityUser, Guid> _userRepository; |
||||
|
private readonly ReportPrinterManager _manager; |
||||
|
public ReportPrinterAppService( |
||||
|
IRepository<ReportPrinter, string> repository, |
||||
|
IRepository<IdentityUser, Guid> userRepository, |
||||
|
ReportPrinterManager manager) |
||||
|
: base(repository) |
||||
|
{ |
||||
|
_userRepository = userRepository; |
||||
|
_manager = manager; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取通过主键
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportPrinterDto> GetAsync(string id) |
||||
|
{ |
||||
|
return await base.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
public async Task<ReportPrinterDto> 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<ReportPrinterDto> 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; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 项目
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<PagedResultDto<ReportPrinterDto>> GetListAsync(PagedAndSortedResultRequestDto input) |
||||
|
{ |
||||
|
return await base.GetListAsync(input); |
||||
|
} |
||||
|
|
||||
|
public async Task<PagedResultDto<ReportPrinterDto>> 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<ReportPrinterDto>(totalCount, entdto); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportPrinterDto> CreateAsync(CreateReportPrinterDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateReportPrinterDto, ReportPrinter>(input); |
||||
|
var entity = await _manager.CreateAsync(createEntity); |
||||
|
entity = await Repository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<ReportPrinter, ReportPrinterDto>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportPrinterDto> 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<ReportPrinter, ReportPrinterDto>(entity); |
||||
|
dto.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId); |
||||
|
dto.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId); |
||||
|
return dto; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override Task DeleteAsync(string id) |
||||
|
{ |
||||
|
return base.DeleteAsync(id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<IdentityUser, Guid> _userRepository; |
||||
|
private readonly IRepository<ReportFormat, string> _reportFormatRepository; |
||||
|
private readonly IRepository<ReportFormatTemplate,string> _reportFormatTemplateRepository; |
||||
|
private readonly ReportManager _manager; |
||||
|
public ReportAppService( |
||||
|
IRepository<Report,string> repository, |
||||
|
IRepository<IdentityUser, Guid> userRepository, |
||||
|
ReportManager manager, |
||||
|
IRepository<ReportFormat, string> reportFormatRepository, |
||||
|
IRepository<ReportFormatTemplate, string> reportFormatTemplateRepository) |
||||
|
: base(repository) |
||||
|
{ |
||||
|
_userRepository = userRepository; |
||||
|
_manager = manager; |
||||
|
_reportFormatRepository = reportFormatRepository; |
||||
|
_reportFormatTemplateRepository = reportFormatTemplateRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取通过主键
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportDto> 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; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 项目
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<PagedResultDto<ReportDto>> GetListAsync(PagedAndSortedResultRequestDto input) |
||||
|
{ |
||||
|
return await base.GetListAsync(input); |
||||
|
} |
||||
|
|
||||
|
public async Task<ReportDto> 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<ReportFileDto> 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<DataSet>(input.DataSetJson); |
||||
|
report.RegisterData(ds); |
||||
|
|
||||
|
PrintParameterDto para = JsonConvert.DeserializeObject<PrintParameterDto>(input.ParameterJson); |
||||
|
Dictionary<string, string> dict = new Dictionary<string, string>(); |
||||
|
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; |
||||
|
} |
||||
|
*/ |
||||
|
/// <summary>
|
||||
|
/// 获取列表 项目 可以带名称搜索
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public async Task<PagedResultDto<ReportDto>> 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<ReportDto>(totalCount, entdto); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportDto> CreateAsync(CreateReportDto input) |
||||
|
{ |
||||
|
var createEntity = ObjectMapper.Map<CreateReportDto, Report>(input); |
||||
|
var entity = await _manager.CreateAsync(createEntity); |
||||
|
entity = await Repository.InsertAsync(entity); |
||||
|
var dto = ObjectMapper.Map<Report, ReportDto>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override async Task<ReportDto> UpdateAsync(string id, UpdateReportDto input) |
||||
|
{ |
||||
|
var entity = await Repository.GetAsync(id); |
||||
|
var sourceEntity = ObjectMapper.Map<UpdateReportDto, Report>(input); |
||||
|
await _manager.UpdateAsync(sourceEntity, entity); |
||||
|
entity = await Repository.UpdateAsync(entity); |
||||
|
var dto = ObjectMapper.Map<Report, ReportDto>(entity); |
||||
|
dto.IsActived = entity.IsActive.Equals('Y'); |
||||
|
dto.CreatorName = EntityHelper.GetUserName(_userRepository, entity.CreatorId); |
||||
|
dto.LastModifierName = EntityHelper.GetUserName(_userRepository, entity.LastModifierId); |
||||
|
return dto; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public override Task DeleteAsync(string id) |
||||
|
{ |
||||
|
return base.DeleteAsync(id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<string>, 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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<string>, 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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<string>, 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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<string> |
||||
|
{ |
||||
|
[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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<ReportFormatTemplate, string> _repository; |
||||
|
public ReportFormatTemplateManager(IRepository<ReportFormatTemplate, string> repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
public async Task<ReportFormatTemplate> GetDefaultAsync(string formatId) |
||||
|
{ |
||||
|
var ent = (await _repository.GetListAsync()).Where(m => m.ReportFormatId == formatId && m.IsDefault.Equals('Y')).FirstOrDefault(); |
||||
|
|
||||
|
return ent; |
||||
|
} |
||||
|
|
||||
|
public async Task<ReportFormatTemplate> CreateAsync( |
||||
|
ReportFormatTemplate entity |
||||
|
) |
||||
|
{ |
||||
|
Check.NotNullOrWhiteSpace(entity.DisplayName, nameof(entity.DisplayName)); |
||||
|
await EntityHelper.CheckEqualsId<ReportFormatTemplate, string>(_repository, entity.Id); |
||||
|
await EntityHelper.CheckEqualsName<ReportFormatTemplate, string>(_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<ReportFormatTemplate> 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<ReportFormatTemplate, string>(_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<ReportFormatTemplate> UptList = new List<ReportFormatTemplate>(); |
||||
|
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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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<ReportFormat, string> _repository; |
||||
|
public ReportFormatManager(IRepository<ReportFormat, string> repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
public async Task<ReportFormat> GetDefaultAsync(string reportId) |
||||
|
{ |
||||
|
var ent = (await _repository.GetListAsync()).Where(m => m.ReportId == reportId && m.IsDefault.Equals('Y')).FirstOrDefault(); |
||||
|
|
||||
|
return ent; |
||||
|
} |
||||
|
|
||||
|
public async Task<ReportFormat> CreateAsync( |
||||
|
ReportFormat entity |
||||
|
) |
||||
|
{ |
||||
|
Check.NotNullOrWhiteSpace(entity.DisplayName, nameof(entity.DisplayName)); |
||||
|
await EntityHelper.CheckEqualsId<ReportFormat, string>(_repository, entity.Id); |
||||
|
await EntityHelper.CheckEqualsName<ReportFormat, string>(_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<ReportFormat, string>(_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<ReportFormat> UptList = new List<ReportFormat>(); |
||||
|
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); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -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<ReportPrinter, string> _repository; |
||||
|
public ReportPrinterManager(IRepository<ReportPrinter, string> 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<ReportPrinter> CreateAsync(ReportPrinter entity) |
||||
|
{ |
||||
|
Check.NotNullOrWhiteSpace(entity.ComputerName, nameof(entity.ComputerName)); |
||||
|
Check.NotNullOrWhiteSpace(entity.PrinterName, nameof(entity.PrinterName)); |
||||
|
await EntityHelper.CheckEqualsId<ReportPrinter, string>(_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; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -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<Report, string> _repository; |
||||
|
public ReportManager(IRepository<Report, string> repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
public async Task<Report> CreateAsync( |
||||
|
Report entity |
||||
|
) |
||||
|
{ |
||||
|
Check.NotNullOrWhiteSpace(entity.DisplayName, nameof(entity.DisplayName)); |
||||
|
await EntityHelper.CheckEqualsId<Report, string>(_repository, entity.Id); |
||||
|
|
||||
|
await EntityHelper.CheckEqualsName<Report,string>(_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<Report, string>(_repository, sourceEntity.DisplayName, targetEntity); |
||||
|
targetEntity.DisplayName = sourceEntity.DisplayName; |
||||
|
} |
||||
|
targetEntity.IsActive = sourceEntity.IsActive; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue