package logic

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

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

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

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

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

// 参标项目统计
func (l *ProjectStatisticsLogic) ProjectStatistics(in *bxcore.StatisticsListReq) (*bxcore.ProjectStatisticsDataRes, 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.ProjectStatistics(in.EntUserIdArr, in.StartTime, in.EndTime)
	return &bxcore.ProjectStatisticsDataRes{
		ErrCode: 0,
		ErrMsg:  "",
		Data:    data,
	}, nil
}
