pg_agree_contract_application_service.go 1.6 KB
package domain_service

import (
	coreDomain "github.com/linmadan/egglib-go/core/domain"
	pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event"
)

type AgreeContractApplicationService struct {
	coreDomain.BaseEventPublisher
	//transactionContext *pgTransaction.TransactionContext
}

func (service *AgreeContractApplicationService) Agree(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) error {
	cooperationApplicationAgreedEvent := new(event.CooperationApplicationAgreed)
	cooperationApplicationAgreedEvent.CreationProjectId = creationProjectId
	cooperationApplicationAgreedEvent.CreationProjectName = creationProjectName
	cooperationApplicationAgreedEvent.CreationProjectNumber = creationProjectNumber
	cooperationApplicationAgreedEvent.UserId = userId
	cooperationApplicationAgreedEvent.UserBaseId = userBaseId
	cooperationApplicationAgreedEvent.OrgId = orgId
	cooperationApplicationAgreedEvent.CompanyId = companyId
	if err := service.Publish(cooperationApplicationAgreedEvent); err != nil {
		return err
	}
	return nil
}

func NewAgreeContractApplicationService(transactionContext *pgTransaction.TransactionContext) (*AgreeContractApplicationService, error) {
	//if transactionContext == nil {
	//	return nil, fmt.Errorf("transactionContext参数不能为nil")
	//} else {
	//	return &AgreeContractApplicationService{
	//		transactionContext: transactionContext,
	//	}, nil
	//}
	return &AgreeContractApplicationService{}, nil
}