package logic

import (
	"app.yhyue.com/moapp/jybase/encrypt"
	"context"
	"jyBXCore/rpc/type/bxcore"

	"jyBXCore/api/internal/svc"
	"jyBXCore/api/internal/types"

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

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

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

func (l *StatisticsProjectDetailsLogic) StatisticsProjectDetails(req *types.ProjectDetailReq) (resp *types.CommonResp, err error) {
	// todo: add your logic here and delete this line
	for k, v := range req.EntUserIdArr {
		req.EntUserIdArr[k] = encrypt.SE.Decode4Hex(v)
	}
	res, err := l.svcCtx.BxCore.ProjectDetails(l.ctx, &bxcore.ProjectDetailsReq{
		EntId:              req.EntId,
		EntUserId:          req.EntUserId,
		PositionId:         req.PositionId,
		EntUserIdArr:       req.EntUserIdArr,
		DeptId:             req.DeptId,
		StartTime:          req.StartTime,
		EndTime:            req.EndTime,
		BidWay:             req.BidWay,
		Source:             req.Source,
		IsParticipate:      req.Isparticipate,
		BidUpdateEndTime:   req.UpdateEndTime,
		BidUpdateStartTime: req.UpdateStartTime,
		PageNum:            req.PageNum,
		PageSize:           req.PageSize,
		PositionType:       req.PositionType,
	})
	if err != nil {
		return nil, err
	}
	return &types.CommonResp{
		Data: res.Data,
	}, nil
	return
}
