service.go 1.3 KB
package service

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/dto"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)

type ContractChangeLogService struct{}

func NewContractChangeLogService(options map[string]interface{}) *ContractChangeLogService {
	newContractChangeLogService := &ContractChangeLogService{}
	return newContractChangeLogService
}

func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (int, interface{}, error) {
	creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
	result, err := creationCooperationGateway.CooperationContractChangeLogsSearch(allied_creation_cooperation.ReqContractChangeLogsSearch{
		PageNumber:                queryParam.PageNumber,
		PageSize:                  queryParam.PageSize,
		CooperationContractNumber: queryParam.CooperationContractNumber,
		OperationType:             queryParam.OperationType,
	})
	listData := dto.ToContractChangeLogList(result)
	return result.Grid.Total, listData, err
}