findWorkingUfByCycleLogic.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. FeedWqTurbidity: one.FeedWqTurbidity,
  41. FeedWqPh: one.FeedWqPh,
  42. ProductWqPh: one.ProductWqPh,
  43. FeedWqAl: one.FeedWqAl,
  44. ProductWqAl: one.ProductWqAl,
  45. FeedWqFe: one.FeedWqFe,
  46. ProductWqFe: one.ProductWqFe,
  47. FeedWqMn: one.FeedWqMn,
  48. ProductWqMn: one.ProductWqMn,
  49. FeedWqSio2: one.FeedWqSio2,
  50. ProductWqSio2: one.ProductWqSio2,
  51. FeedWqCod: one.FeedWqCod,
  52. ProductWqCod: one.ProductWqCod,
  53. FeedWqP: one.FeedWqP,
  54. ProductWqP: one.ProductWqP,
  55. Step: one.Step,
  56. FilterCycle: one.FilterCycle,
  57. FilterTime: one.FilterTime,
  58. CTime: one.CTime.Format("2006-01-02 15:04:05"),
  59. }
  60. }
  61. return &pb.FindWorkingUfByCycleResp{List: list}, nil
  62. }