CorporateProfitDtos.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 : CorporateProfitExcelDownloadDto
  28. {
  29. }
  30. /// <summary>
  31. /// item Dto
  32. /// 参数验证
  33. /// </summary>
  34. public class CorporateProfitItemDtoFoalidator : AbstractValidator<CorporateProfitItemDto>
  35. {
  36. public CorporateProfitItemDtoFoalidator()
  37. {
  38. Include(new CorporateProfitExcelDownloadDtoFoalidator());
  39. }
  40. }
  41. public class CorporateProfitExcelDownloadDto : CorporateProfitDtos
  42. {
  43. /// <summary>
  44. /// excel类型
  45. /// 1 月报表 2 季度报表 3 年报表 4 导出 5 生成
  46. /// </summary>
  47. public int ExcelType { get; set; }
  48. public string BeginDt { get; set; }
  49. public string EndDt { get; set; }
  50. }
  51. public class CorporateProfitExcelDownloadDtoFoalidator : AbstractValidator<CorporateProfitExcelDownloadDto>
  52. {
  53. public CorporateProfitExcelDownloadDtoFoalidator()
  54. {
  55. Include(new CorporateProfitDtosDtoBaseFoalidator());
  56. RuleFor(it => it.ExcelType).InclusiveBetween(1, 5).WithMessage("请输入有效的Excel类型");
  57. RuleFor(it => it.BeginDt)
  58. .Must(dateString => DateTime.TryParse(dateString, out _))
  59. .WithMessage("请输入有效开始的日期");
  60. RuleFor(it => it.EndDt)
  61. .Must(dateString => DateTime.TryParse(dateString, out _))
  62. .WithMessage("请输入有效结束的日期");
  63. }
  64. }
  65. }