pg_reject_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 RejectContractApplicationService struct {
	coreDomain.BaseEventPublisher
	//transactionContext *pgTransaction.TransactionContext
}

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

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