12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- 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 GetWorkingUfByCodeLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewGetWorkingUfByCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWorkingUfByCodeLogic {
- return &GetWorkingUfByCodeLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *GetWorkingUfByCodeLogic) GetWorkingUfByCode(in *pb.DcWorkingReq) (*pb.GetWorkingUfByCodeResp, error) {
- offset := (in.Page - 1) * in.PageSize
- res, err := l.svcCtx.WorkingUf.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.WorkingUf, len(res))
- for i, one := range res {
- list[i] = &pb.WorkingUf{
- Id: one.Id,
- ProjectId: one.ProjectId,
- DeviceCode: one.DeviceCode,
- WaterTemperature: one.WaterTemperature,
- FeedFlow: one.FeedFlow,
- ConFlow: one.ConFlow,
- ProductFlow: one.ProductFlow,
- FeedPressure: one.FeedPressure,
- ConPressure: one.ConPressure,
- ProductPressure: one.ProductPressure,
- Tmp: one.Tmp,
- Flux: one.Flux,
- FeedWqTurbidity: one.FeedWqTurbidity,
- FeedWqPh: one.FeedWqPh,
- ProductWqPh: one.ProductWqPh,
- FeedWqAl: one.FeedWqAl,
- ProductWqAl: one.ProductWqAl,
- FeedWqFe: one.FeedWqFe,
- ProductWqFe: one.ProductWqFe,
- FeedWqMn: one.FeedWqMn,
- ProductWqMn: one.ProductWqMn,
- FeedWqSio2: one.FeedWqSio2,
- ProductWqSio2: one.ProductWqSio2,
- FeedWqCod: one.FeedWqCod,
- ProductWqCod: one.ProductWqCod,
- FeedWqP: one.FeedWqP,
- ProductWqP: one.ProductWqP,
- Step: one.Step,
- CTime: one.CTime.Format("2006-01-02 15:04:05"),
- }
- }
- return &pb.GetWorkingUfByCodeResp{
- List: list,
- }, nil
- }
|