event_inform_dividends_expected_service.go
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
)
type InformDividendsExpectedService struct {
coreDomain.BaseEventPublisher
//transactionContext *pgTransaction.TransactionContext
}
// 分红预算
func (service *InformDividendsExpectedService) Expect(data []service.ExpectedData) error {
dividendsExpectedInformEvent := new(event.InformDividendsExpected)
for _, dividendsExpectedInformedData := range data {
dividendsExpectedInformEvent.DividendsExpectedInformData = append(dividendsExpectedInformEvent.DividendsExpectedInformData, event.DividendsExpectedInformData{
CreationContractId: dividendsExpectedInformedData.CreationContractId,
CreationContractName: dividendsExpectedInformedData.CreationContractName,
CreationContractNumber: dividendsExpectedInformedData.CreationContractNumber,
CreationProjectId: dividendsExpectedInformedData.CreationProjectId,
CreationProjectName: dividendsExpectedInformedData.CreationProjectName,
CreationProjectNumber: dividendsExpectedInformedData.CreationProjectNumber,
ProductName: dividendsExpectedInformedData.ProductName,
UserId: dividendsExpectedInformedData.UserId,
UserBaseId: dividendsExpectedInformedData.UserBaseId,
OrgId: dividendsExpectedInformedData.OrgId,
CompanyId: dividendsExpectedInformedData.CompanyId,
DividendsEstimateId: dividendsExpectedInformedData.DividendsEstimateId,
DividendsAmount: dividendsExpectedInformedData.DividendsAmount,
})
}
if err := service.Publish(dividendsExpectedInformEvent); err != nil {
return err
}
return nil
}
func NewInformDividendsExpectedService(transactionContext *pgTransaction.TransactionContext) (*InformDividendsExpectedService, error) {
//if transactionContext == nil {
// return nil, fmt.Errorf("transactionContext参数不能为nil")
//} else {
// return &InformDividendsExpectedService{
// transactionContext: transactionContext,
// }, nil
//}
return &InformDividendsExpectedService{}, nil
}