package logic

import (
	"context"
	"jyBXCore/rpc/service"

	"jyBXCore/rpc/internal/svc"
	"jyBXCore/rpc/type/bxcore"

	"github.com/zeromicro/go-zero/core/logx"
)

type PushStatisticsLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewPushStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PushStatisticsLogic {
	return &PushStatisticsLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 推送参标统计
func (l *PushStatisticsLogic) PushStatistics(in *bxcore.StatisticsListReq) (*bxcore.PushStatisticsDataRes, error) {
	// todo: add your logic here and delete this line
	participateService := service.ParticipateStatistics{
		PositionId: in.PositionId,
		EntId:      in.EntId,
		DeptId:     in.EntId,
		EntUserId:  in.EntUserId,
	}
	data := participateService.PushStatistics(in.EntUserIdArr, in.StartTime, in.EndTime)
	return &bxcore.PushStatisticsDataRes{
		ErrCode: 0,
		ErrMsg:  "",
		Data:    data,
	}, nil
}
