package logic import ( "GtDataStore/app/cmd/organization/internal/svc" "GtDataStore/app/cmd/organization/pb" "GtDataStore/app/model" "context" "github.com/zeromicro/go-zero/core/logx" ) type GetWorkingRoByCodeLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewGetWorkingRoByCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWorkingRoByCodeLogic { return &GetWorkingRoByCodeLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *GetWorkingRoByCodeLogic) GetWorkingRoByCode(in *pb.DcWorkingReq) (*pb.GetWorkingRoByCodeResp, error) { offset := (in.Page - 1) * in.PageSize res, err := l.svcCtx.WorkingRo.Search(l.ctx, in.ProjectId, in.DeviceCode, in.Stime, in.Etime, offset, in.PageSize, in.Order) if err != nil && err != model.ErrNotFound { return nil, err } list := make([]*pb.WorkingRo, len(res)) for i, one := range res { list[i] = &pb.WorkingRo{ Id: one.Id, ProjectId: one.ProjectId, DeviceCode: one.DeviceCode, WaterTemperature: one.WaterTemperature, FeedFlow_1St: one.FeedFlow1St, ConFlow_1St: one.ConFlow1St, ProductFlow_1St: one.ProductFlow1St, FeedPressure_1St: one.FeedPressure1St, ConPressure_1St: one.ConPressure1St, ProductPressure_1St: one.ProductPressure1St, Tmp_1St: one.Tmp1St, Flux_1St: one.Flux1St, Permeability_1St: one.Permeability1St, FeedFlow_2Nd: one.FeedFlow2Nd, ConFlow_2Nd: one.ConFlow2Nd, ProductFlow_2Nd: one.ProductFlow2Nd, FeedPressure_2Nd: one.FeedPressure2Nd, ConPressure_2Nd: one.ConPressure2Nd, ProductPressure_2Nd: one.ProductPressure2Nd, Tmp_2Nd: one.Tmp2Nd, Flux_2Nd: one.Flux2Nd, Permeability_2Nd: one.Permeability2Nd, FeedFlow_3Th: one.FeedFlow3Th, ConFlow_3Th: one.ConFlow3Th, ProductFlow_3Th: one.ProductFlow3Th, FeedPressure_3Th: one.FeedPressure3Th, ConPressure_3Th: one.ConPressure3Th, ProductPressure_3Th: one.ProductPressure3Th, Tmp_3Th: one.Tmp3Th, Flux_3Th: one.Flux3Th, Permeability_3Th: one.Permeability3Th, // 以下数据并未采集 //FeedWqTurbidity: 0, //FeedWqPh: 0, //ProductWqPh: 0, //FeedWqAl: 0, //ProductWqAl: 0, //FeedWqFe: 0, //ProductWqFe: 0, //FeedWqMn: 0, //ProductWqMn: 0, //FeedWqSio2: 0, //ProductWqSio2: 0, //FeedWqCod: 0, //ProductWqCod: 0, //FeedWqP: 0, //ProductWqP: 0, Step: one.Step, CTime: one.CTime.Format("2006-01-02 15:04:05"), } } return &pb.GetWorkingRoByCodeResp{ List: list, }, nil }