findWorkingUfByCycleLogic.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package logic
  2. import (
  3. "context"
  4. "GtDataStore/app/cmd/organization/internal/svc"
  5. "GtDataStore/app/cmd/organization/pb"
  6. "github.com/zeromicro/go-zero/core/logx"
  7. )
  8. type FindWorkingUfByCycleLogic struct {
  9. ctx context.Context
  10. svcCtx *svc.ServiceContext
  11. logx.Logger
  12. }
  13. func NewFindWorkingUfByCycleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FindWorkingUfByCycleLogic {
  14. return &FindWorkingUfByCycleLogic{
  15. ctx: ctx,
  16. svcCtx: svcCtx,
  17. Logger: logx.WithContext(ctx),
  18. }
  19. }
  20. func (l *FindWorkingUfByCycleLogic) FindWorkingUfByCycle(in *pb.FindWorkingUfByCycleReq) (*pb.FindWorkingUfByCycleResp, error) {
  21. res, err := l.svcCtx.WorkingUf.FindForCycleAndStep(l.ctx, in.ProjectId, in.DeviceCode, in.FilterCycle, in.Step, in.FilterTimeStart, in.FilterTimeEnd, in.Limit)
  22. if err != nil {
  23. return nil, err
  24. }
  25. list := make([]*pb.WorkingUf, len(res))
  26. for i, one := range res {
  27. list[i] = &pb.WorkingUf{
  28. Id: one.Id,
  29. ProjectId: one.ProjectId,
  30. DeviceCode: one.DeviceCode,
  31. WaterTemperature: one.WaterTemperature,
  32. FeedFlow: one.FeedFlow,
  33. ConFlow: one.ConFlow,
  34. ProductFlow: one.ProductFlow,
  35. FeedPressure: one.FeedPressure,
  36. ConPressure: one.ConPressure,
  37. ProductPressure: one.ProductPressure,
  38. Tmp: one.Tmp,
  39. Flux: one.Flux,
  40. Permeability: one.Permeability,
  41. FeedWqTurbidity: one.FeedWqTurbidity,
  42. FeedWqPh: one.FeedWqPh,
  43. ProductWqPh: one.ProductWqPh,
  44. FeedWqAl: one.FeedWqAl,
  45. ProductWqAl: one.ProductWqAl,
  46. FeedWqFe: one.FeedWqFe,
  47. ProductWqFe: one.ProductWqFe,
  48. FeedWqMn: one.FeedWqMn,
  49. ProductWqMn: one.ProductWqMn,
  50. FeedWqSio2: one.FeedWqSio2,
  51. ProductWqSio2: one.ProductWqSio2,
  52. FeedWqCod: one.FeedWqCod,
  53. ProductWqCod: one.ProductWqCod,
  54. FeedWqP: one.FeedWqP,
  55. ProductWqP: one.ProductWqP,
  56. Step: one.Step,
  57. FilterCycle: one.FilterCycle,
  58. FilterTime: one.FilterTime,
  59. CTime: one.CTime.Format("2006-01-02 15:04:05"),
  60. }
  61. }
  62. return &pb.FindWorkingUfByCycleResp{List: list}, nil
  63. }