pg_common_statistics_service.go 1.4 KB
package domainService

import (
	"fmt"
	pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
)

const (
	// 时段产能统计
	HourProductiveStatistics = "HourProductiveStatistics"
)

type PGCommonStatisticsService struct {
	transactionContext *pgTransaction.TransactionContext
}

func (ptr *PGCommonStatisticsService) CommonStatistics(actionType, queryOptions map[string]interface{}) (interface{}, error) {
	switch actionType {

	}
	return nil, nil
}

// 时段产能-统计 (传串设备)
func (ptr *PGCommonStatisticsService) HourProductiveStatistics(queryOptions map[string]interface{}) (interface{}, error) {
	var request = &HourProductiveStatisticsRequest{}
	if err := utils.LoadQueryObject(queryOptions, &request); err != nil {
		return nil, err
	}
	return nil, nil
}

type HourProductiveStatisticsRequest struct {
	CompanyId  int `json:"companyId" valid:"Required"`
	OrgId      int `json:"orgId" valid:"Required"`
	WorkshopId int `json:"workshopId" valid:"Required"`
}

func NewPGCommonStatisticsService(transactionContext *pgTransaction.TransactionContext) (*PGCommonStatisticsService, error) {
	if transactionContext == nil {
		return nil, fmt.Errorf("transactionContext参数不能为nil")
	} else {
		return &PGCommonStatisticsService{
			transactionContext: transactionContext,
		}, nil
	}
}