CorporateProfitDtos.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using FluentValidation;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace OASystem.Domain.Dtos.Statistics
  8. {
  9. /// <summary>
  10. /// 企业利润dtos
  11. /// </summary>
  12. public class CorporateProfitDtos : UserPageFuncDtoBase
  13. {
  14. }
  15. public class CorporateProfitDtosDtoBaseFoalidator : AbstractValidator<CorporateProfitDtos>
  16. {
  17. public CorporateProfitDtosDtoBaseFoalidator()
  18. {
  19. RuleFor(it => it.PortType).InclusiveBetween(1, 3).WithMessage(MsgTips.Port);
  20. RuleFor(it => it.UserId).GreaterThan(1).WithMessage(MsgTips.UserId);
  21. RuleFor(it => it.PageId).GreaterThan(1).WithMessage(MsgTips.PageId);
  22. }
  23. }
  24. /// <summary>
  25. /// item Dto
  26. /// </summary>
  27. public class CorporateProfitItemDto : CorporateProfitDtos
  28. {
  29. public string BeginDt { get; set; }
  30. public string EndDt { get; set; }
  31. }
  32. /// <summary>
  33. /// item Dto
  34. /// 参数验证
  35. /// </summary>
  36. public class CorporateProfitItemDtoFoalidator : AbstractValidator<CorporateProfitItemDto>
  37. {
  38. public CorporateProfitItemDtoFoalidator()
  39. {
  40. Include(new CorporateProfitDtosDtoBaseFoalidator());
  41. RuleFor(it => it.BeginDt)
  42. .Must(dateString => DateTime.TryParse(dateString, out _))
  43. .WithMessage("请输入有效开始的日期");
  44. RuleFor(it => it.EndDt)
  45. .Must(dateString => DateTime.TryParse(dateString, out _))
  46. .WithMessage("请输入有效结束的日期");
  47. }
  48. }
  49. public class CorporateProfitExcelDownloadDto : CorporateProfitItemDto
  50. {
  51. /// <summary>
  52. /// excel类型
  53. /// 1 月报表 2 季度报表 3 年报表 4 导出 5 生成
  54. /// </summary>
  55. public int ExcelType { get; set; }
  56. public string BeginDt { get; set; }
  57. public string EndDt { get; set; }
  58. }
  59. public class CorporateProfitExcelDownloadDtoFoalidator : AbstractValidator<CorporateProfitExcelDownloadDto>
  60. {
  61. public CorporateProfitExcelDownloadDtoFoalidator()
  62. {
  63. Include(new CorporateProfitItemDtoFoalidator());
  64. RuleFor(it => it.ExcelType).InclusiveBetween(1, 5).WithMessage("请输入有效的Excel类型");
  65. }
  66. }
  67. }