service.go 1.4 KB
package service

import (
	"github.com/linmadan/egglib-go/core/application"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/undertakerFeedback/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)

// UndertakerFeedbackService 承接反馈服务
type UndertakerFeedbackService struct {
}

// CreateCooperationProject  承接反馈列表
func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackCommand) (interface{}, error) {
	gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
		cmd.Operator)
	result, err := gateway.ContractUndertakerFeedbackSearch(allied_creation_cooperation.ReqContractUndertakerFeedbackSearch{
		PageNumber:              cmd.PageNumber,
		PageSize:                cmd.PageSize,
		CooperationContractName: cmd.ContractName,
		UndertakerName:          cmd.UndertakerName,
	})
	if err != nil {
		return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
	}
	for i, v := range result.Grid.List {
		result.Grid.List[i].ContractUndertaker.UserCode = v.ContractUndertaker.UserInfo.UserCode
		result.Grid.List[i].ContractUndertaker.UserName = v.ContractUndertaker.UserInfo.UserName
		result.Grid.List[i].ContractUndertaker.UserPhone = v.ContractUndertaker.UserInfo.UserPhone
		result.Grid.List[i].CooperationMode.CooperationModeName = v.CooperationModeName
	}
	return result, nil
}