作者 陈志颖

feat:增加新增合约消息推送

@@ -430,34 +430,40 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova @@ -430,34 +430,40 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova
430 } 430 }
431 431
432 // 推送消息 432 // 推送消息
  433 + var agreedDataSlices []service.AgreeData
  434 + var rejectedDataSlices []service.RejectData
433 for _, cooperationApplicationApproved := range cooperationApplicationsApproved { 435 for _, cooperationApplicationApproved := range cooperationApplicationsApproved {
434 if cooperationApplicationApproved.CooperationApplicationStatus == 2 { 436 if cooperationApplicationApproved.CooperationApplicationStatus == 2 {
435 - if err1 := agreeContractApplicationService.Agree(  
436 - cooperationApplicationApproved.CooperationProject.CooperationProjectId,  
437 - cooperationApplicationApproved.CooperationProject.CooperationProjectName,  
438 - cooperationApplicationApproved.CooperationProject.CooperationProjectNumber,  
439 - cooperationApplicationApproved.CooperationApplicationApplicant.UserId,  
440 - cooperationApplicationApproved.CooperationApplicationApplicant.UserBaseId,  
441 - cooperationApplicationApproved.CooperationProject.Org.OrgId,  
442 - cooperationApplicationApproved.CooperationProject.Company.CompanyId,  
443 - ); err1 != nil {  
444 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err1.Error())  
445 - } 437 + agreedDataSlices = append(agreedDataSlices, service.AgreeData{
  438 + CreationProjectId: cooperationApplicationApproved.CooperationProject.CooperationProjectId,
  439 + CreationProjectName: cooperationApplicationApproved.CooperationProject.CooperationProjectName,
  440 + CreationProjectNumber: cooperationApplicationApproved.CooperationProject.CooperationProjectNumber,
  441 + UserId: cooperationApplicationApproved.CooperationApplicationApplicant.UserId,
  442 + UserBaseId: cooperationApplicationApproved.CooperationApplicationApplicant.UserBaseId,
  443 + OrgId: cooperationApplicationApproved.CooperationProject.Org.OrgId,
  444 + CompanyId: cooperationApplicationApproved.CooperationProject.Company.CompanyId,
  445 + })
446 } else if cooperationApplicationApproved.CooperationApplicationStatus == 3 { 446 } else if cooperationApplicationApproved.CooperationApplicationStatus == 3 {
447 - if err2 := rejectContractApplicationService.Reject(  
448 - cooperationApplicationApproved.CooperationProject.CooperationProjectId,  
449 - cooperationApplicationApproved.CooperationProject.CooperationProjectName,  
450 - cooperationApplicationApproved.CooperationProject.CooperationProjectNumber,  
451 - cooperationApplicationApproved.CooperationApplicationApplicant.UserId,  
452 - cooperationApplicationApproved.CooperationApplicationApplicant.UserBaseId,  
453 - cooperationApplicationApproved.CooperationProject.Org.OrgId,  
454 - cooperationApplicationApproved.CooperationProject.Company.CompanyId,  
455 - ); err2 != nil {  
456 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err2.Error())  
457 - } 447 + rejectedDataSlices = append(rejectedDataSlices, service.RejectData{
  448 + CreationProjectId: cooperationApplicationApproved.CooperationProject.CooperationProjectId,
  449 + CreationProjectName: cooperationApplicationApproved.CooperationProject.CooperationProjectName,
  450 + CreationProjectNumber: cooperationApplicationApproved.CooperationProject.CooperationProjectNumber,
  451 + UserId: cooperationApplicationApproved.CooperationApplicationApplicant.UserId,
  452 + UserBaseId: cooperationApplicationApproved.CooperationApplicationApplicant.UserBaseId,
  453 + OrgId: cooperationApplicationApproved.CooperationProject.Org.OrgId,
  454 + CompanyId: cooperationApplicationApproved.CooperationProject.Company.CompanyId,
  455 + })
458 } 456 }
459 } 457 }
460 458
  459 + if err1 := agreeContractApplicationService.Agree(agreedDataSlices); err1 != nil {
  460 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err1.Error())
  461 + }
  462 +
  463 + if err2 := rejectContractApplicationService.Reject(rejectedDataSlices); err2 != nil {
  464 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err2.Error())
  465 + }
  466 +
461 return map[string]interface{}{ 467 return map[string]interface{}{
462 "cooperationApplications": cooperationApplicationsApproved, 468 "cooperationApplications": cooperationApplicationsApproved,
463 }, nil 469 }, nil
@@ -10,6 +10,7 @@ import ( @@ -10,6 +10,7 @@ import (
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/command" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/command"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/dto" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/dto"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query"
  13 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/event/subscriber"
13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" 14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
14 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 15 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
15 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" 16 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
@@ -48,6 +49,29 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -48,6 +49,29 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
48 userService = value 49 userService = value
49 } 50 }
50 51
  52 + // 共创项目仓储初始化
  53 + var cooperationProjectRepository domain.CooperationProjectRepository
  54 + if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
  55 + "transactionContext": transactionContext,
  56 + }); err != nil {
  57 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  58 + } else {
  59 + cooperationProjectRepository = value
  60 + }
  61 +
  62 + // 共创确认消息推送领域服务初始化
  63 + var informJoinCreationContractService service.InformJoinCreationContractService
  64 + if value, err := factory.CreateInformJoinCreationContractService(map[string]interface{}{
  65 + //"transactionContext": transactionContext,
  66 + }); err != nil {
  67 + return []interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  68 + } else {
  69 + informJoinCreationContractService = value
  70 + _ = informJoinCreationContractService.Subscribe(&subscriber.MessageServiceSubscriber{
  71 + //TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
  72 + })
  73 + }
  74 +
51 // 获取操作人 75 // 获取操作人
52 var operator *domain.User 76 var operator *domain.User
53 if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, createCooperationContractCommand.UserId); err != nil { 77 if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, createCooperationContractCommand.UserId); err != nil {
@@ -144,6 +168,19 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -144,6 +168,19 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
144 return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创合约异常") 168 return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创合约异常")
145 } 169 }
146 170
  171 + // 获取共创项目
  172 + cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{
  173 + "cooperationProjectNumber": createCooperationContractCommand.CooperationProjectNumber,
  174 + "orgId": organization.OrgId,
  175 + "companyId": company.CompanyId,
  176 + })
  177 + if err != nil {
  178 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创项目不存在")
  179 + }
  180 + if cooperationProject == nil {
  181 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationContractCommand.CooperationProjectNumber))
  182 + }
  183 +
147 // 承接人 184 // 承接人
148 var undertakers []*domain.Undertaker 185 var undertakers []*domain.Undertaker
149 for _, undertaker := range createCooperationContractCommand.Undertakers { 186 for _, undertaker := range createCooperationContractCommand.Undertakers {
@@ -367,6 +404,27 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -367,6 +404,27 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
367 if err := transactionContext.CommitTransaction(); err != nil { 404 if err := transactionContext.CommitTransaction(); err != nil {
368 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 405 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
369 } 406 }
  407 + // 消息推送
  408 + var jointDataSlices []service.JoinData
  409 + for _, undertaker := range cooperationContract.Undertakers {
  410 + jointDataSlices = append(jointDataSlices, service.JoinData{
  411 + CreationContractId: cooperationContract.CooperationContractId,
  412 + CreationContractName: cooperationContract.CooperationContractName,
  413 + CreationContractNumber: cooperationContract.CooperationContractNumber,
  414 + CreationProjectId: cooperationProject.CooperationProjectId,
  415 + CreationProjectNumber: cooperationProject.CooperationProjectNumber,
  416 + CreationProjectName: cooperationProject.CooperationProjectName,
  417 + UserId: undertaker.UserId,
  418 + UserBaseId: undertaker.UserBaseId,
  419 + OrgId: undertaker.Org.OrgId,
  420 + CompanyId: undertaker.Company.CompanyId,
  421 + })
  422 + }
  423 +
  424 + if err3 := informJoinCreationContractService.Join(jointDataSlices); err3 != nil {
  425 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err3.Error())
  426 + }
  427 +
370 return cooperationContract, nil 428 return cooperationContract, nil
371 } 429 }
372 } 430 }
@@ -899,6 +957,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -899,6 +957,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
899 companyService = value 957 companyService = value
900 } 958 }
901 959
  960 + // 共创项目仓储初始化
  961 + var cooperationProjectRepository domain.CooperationProjectRepository
  962 + if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
  963 + "transactionContext": transactionContext,
  964 + }); err != nil {
  965 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  966 + } else {
  967 + cooperationProjectRepository = value
  968 + }
  969 +
902 // 获取公司信息 970 // 获取公司信息
903 var company *domain.Company 971 var company *domain.Company
904 if data, err4 := companyService.CompanyFrom(updateCooperationContractCommand.CompanyId); err4 != nil { 972 if data, err4 := companyService.CompanyFrom(updateCooperationContractCommand.CompanyId); err4 != nil {
@@ -915,6 +983,19 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -915,6 +983,19 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
915 organizationService = value 983 organizationService = value
916 } 984 }
917 985
  986 + // 共创确认消息推送领域服务初始化
  987 + var informJoinCreationContractService service.InformJoinCreationContractService
  988 + if value, err := factory.CreateInformJoinCreationContractService(map[string]interface{}{
  989 + //"transactionContext": transactionContext,
  990 + }); err != nil {
  991 + return []interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  992 + } else {
  993 + informJoinCreationContractService = value
  994 + _ = informJoinCreationContractService.Subscribe(&subscriber.MessageServiceSubscriber{
  995 + //TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
  996 + })
  997 + }
  998 +
918 // 获取组织机构信息 999 // 获取组织机构信息
919 var organization *domain.Org 1000 var organization *domain.Org
920 if data, err6 := organizationService.OrgFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId); err6 != nil { 1001 if data, err6 := organizationService.OrgFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId); err6 != nil {
@@ -974,6 +1055,19 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -974,6 +1055,19 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
974 sponsor = data 1055 sponsor = data
975 } 1056 }
976 1057
  1058 + // 获取共创项目
  1059 + cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{
  1060 + "cooperationProjectNumber": cooperationContractFound.CooperationProjectNumber,
  1061 + "orgId": organization.OrgId,
  1062 + "companyId": company.CompanyId,
  1063 + })
  1064 + if err != nil {
  1065 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创项目不存在")
  1066 + }
  1067 + if cooperationProject == nil {
  1068 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", cooperationContractFound.CooperationProjectNumber))
  1069 + }
  1070 +
977 // 获取操作人 1071 // 获取操作人
978 var operator *domain.User 1072 var operator *domain.User
979 if data, err := userService.OperatorFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, updateCooperationContractCommand.UserId); err != nil { 1073 if data, err := userService.OperatorFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, updateCooperationContractCommand.UserId); err != nil {
@@ -1127,6 +1221,15 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1127,6 +1221,15 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1127 ContractAttachment: contractAttachments, 1221 ContractAttachment: contractAttachments,
1128 }) 1222 })
1129 } 1223 }
  1224 +
  1225 + // 获取待添加的承接人
  1226 + var undertakersToAdd []*domain.Undertaker
  1227 + for _, undertaker := range undertakers {
  1228 + if undertaker.UndertakerId == 0 {
  1229 + undertakersToAdd = append(undertakersToAdd, undertaker)
  1230 + }
  1231 + }
  1232 +
1130 // 更新承接人 1233 // 更新承接人
1131 cooperationContract.Undertakers = undertakers 1234 cooperationContract.Undertakers = undertakers
1132 1235
@@ -1509,6 +1612,29 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1509,6 +1612,29 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1509 if err21 := transactionContext.CommitTransaction(); err21 != nil { 1612 if err21 := transactionContext.CommitTransaction(); err21 != nil {
1510 return nil, application.ThrowError(application.TRANSACTION_ERROR, err21.Error()) 1613 return nil, application.ThrowError(application.TRANSACTION_ERROR, err21.Error())
1511 } 1614 }
  1615 +
  1616 + // 推送消息
  1617 + if len(undertakersToAdd) > 0 {
  1618 + var jointDataSlices []service.JoinData
  1619 + for _, undertakerToAdd := range undertakersToAdd {
  1620 + jointDataSlices = append(jointDataSlices, service.JoinData{
  1621 + CreationContractId: cooperationContract.CooperationContractId,
  1622 + CreationContractName: cooperationContract.CooperationContractName,
  1623 + CreationContractNumber: cooperationContract.CooperationContractNumber,
  1624 + CreationProjectId: cooperationProject.CooperationProjectId,
  1625 + CreationProjectNumber: cooperationProject.CooperationProjectNumber,
  1626 + CreationProjectName: cooperationProject.CooperationProjectName,
  1627 + UserId: undertakerToAdd.UserId,
  1628 + UserBaseId: undertakerToAdd.UserBaseId,
  1629 + OrgId: undertakerToAdd.Org.OrgId,
  1630 + CompanyId: undertakerToAdd.Company.CompanyId,
  1631 + })
  1632 + }
  1633 + if err14 := informJoinCreationContractService.Join(jointDataSlices); err14 != nil {
  1634 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err14.Error())
  1635 + }
  1636 + }
  1637 +
1512 return cooperationContractSaved, nil 1638 return cooperationContractSaved, nil
1513 } 1639 }
1514 } 1640 }
@@ -23,134 +23,150 @@ func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.D @@ -23,134 +23,150 @@ func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.D
23 switch domainEvent.EventType() { 23 switch domainEvent.EventType() {
24 case event.COOPERATION_APPLICATION_AGREED: // 共创申请审核通过 24 case event.COOPERATION_APPLICATION_AGREED: // 共创申请审核通过
25 cooperationApplicationAgreedEvent := domainEvent.(*event.CooperationApplicationAgreed) 25 cooperationApplicationAgreedEvent := domainEvent.(*event.CooperationApplicationAgreed)
26 - data, err1 := messageServiceGateway.AgreeCooperationApplication(  
27 - cooperationApplicationAgreedEvent.CreationProjectId,  
28 - cooperationApplicationAgreedEvent.CreationProjectName,  
29 - cooperationApplicationAgreedEvent.CreationProjectNumber,  
30 - cooperationApplicationAgreedEvent.UserId,  
31 - cooperationApplicationAgreedEvent.UserBaseId,  
32 - cooperationApplicationAgreedEvent.OrgId,  
33 - cooperationApplicationAgreedEvent.CompanyId,  
34 - )  
35 - if err1 != nil {  
36 - log.Logger.Error("推送消息错误", map[string]interface{}{  
37 - "err": err1.Error(),  
38 - })  
39 - return nil  
40 - } else {  
41 - log.Logger.Info("推送数据返回", data) 26 + for _, agreedData := range cooperationApplicationAgreedEvent.CooperationApplicationAgreedData {
  27 + data, err1 := messageServiceGateway.AgreeCooperationApplication(
  28 + agreedData.CreationProjectId,
  29 + agreedData.CreationProjectName,
  30 + agreedData.CreationProjectNumber,
  31 + agreedData.UserId,
  32 + agreedData.UserBaseId,
  33 + agreedData.OrgId,
  34 + agreedData.CompanyId,
  35 + )
  36 + if err1 != nil {
  37 + log.Logger.Error("推送消息错误", map[string]interface{}{
  38 + "err": err1.Error(),
  39 + })
  40 + return nil
  41 + } else {
  42 + log.Logger.Info("推送数据返回", data)
  43 + }
42 } 44 }
43 break 45 break
44 case event.CREATION_CONTRACT_INFORM_JOINT: // 共创确认 46 case event.CREATION_CONTRACT_INFORM_JOINT: // 共创确认
45 creationContractInformJointEvent := domainEvent.(*event.CreationContractInformJoint) 47 creationContractInformJointEvent := domainEvent.(*event.CreationContractInformJoint)
46 - data, err2 := messageServiceGateway.InformJoinCreationContract(  
47 - creationContractInformJointEvent.CreationContractId,  
48 - creationContractInformJointEvent.CreationContractName,  
49 - creationContractInformJointEvent.CreationContractNumber,  
50 - creationContractInformJointEvent.CreationProjectId,  
51 - creationContractInformJointEvent.CreationProjectName,  
52 - creationContractInformJointEvent.UserId,  
53 - creationContractInformJointEvent.UserBaseId,  
54 - creationContractInformJointEvent.OrgId,  
55 - creationContractInformJointEvent.CompanyId,  
56 - )  
57 - if err2 != nil {  
58 - log.Logger.Error("推送消息错误", map[string]interface{}{  
59 - "err": err2.Error(),  
60 - })  
61 - return nil  
62 - } else {  
63 - log.Logger.Info("推送数据返回", data) 48 + for _, jointData := range creationContractInformJointEvent.CreationContractInformJointData {
  49 + data, err2 := messageServiceGateway.InformJoinCreationContract(
  50 + jointData.CreationContractId,
  51 + jointData.CreationContractName,
  52 + jointData.CreationContractNumber,
  53 + jointData.CreationProjectId,
  54 + jointData.CreationProjectNumber,
  55 + jointData.CreationProjectName,
  56 + jointData.UserId,
  57 + jointData.UserBaseId,
  58 + jointData.OrgId,
  59 + jointData.CompanyId,
  60 + )
  61 + if err2 != nil {
  62 + log.Logger.Error("推送消息错误", map[string]interface{}{
  63 + "err": err2.Error(),
  64 + })
  65 + return nil
  66 + } else {
  67 + log.Logger.Info("推送数据返回", data)
  68 + }
64 } 69 }
65 break 70 break
66 case event.COOPERATION_APPLICATION_REJECTED: // 共创申请审核拒绝 71 case event.COOPERATION_APPLICATION_REJECTED: // 共创申请审核拒绝
67 cooperationApplicationRejectedEvent := domainEvent.(*event.CooperationApplicationRejected) 72 cooperationApplicationRejectedEvent := domainEvent.(*event.CooperationApplicationRejected)
68 - data, err3 := messageServiceGateway.RejectCooperationApplication(  
69 - cooperationApplicationRejectedEvent.CreationProjectId,  
70 - cooperationApplicationRejectedEvent.CreationProjectName,  
71 - cooperationApplicationRejectedEvent.CreationProjectNumber,  
72 - cooperationApplicationRejectedEvent.UserId,  
73 - cooperationApplicationRejectedEvent.UserBaseId,  
74 - cooperationApplicationRejectedEvent.OrgId,  
75 - cooperationApplicationRejectedEvent.CompanyId,  
76 - )  
77 - if err3 != nil {  
78 - log.Logger.Error("推送消息错误", map[string]interface{}{  
79 - "err": err3.Error(),  
80 - })  
81 - return nil  
82 - } else {  
83 - log.Logger.Info("推送数据返回", data) 73 + for _, rejectedData := range cooperationApplicationRejectedEvent.CooperationApplicationRejectedData {
  74 + data, err3 := messageServiceGateway.RejectCooperationApplication(
  75 + rejectedData.CreationProjectId,
  76 + rejectedData.CreationProjectName,
  77 + rejectedData.CreationProjectNumber,
  78 + rejectedData.UserId,
  79 + rejectedData.UserBaseId,
  80 + rejectedData.OrgId,
  81 + rejectedData.CompanyId,
  82 + )
  83 + if err3 != nil {
  84 + log.Logger.Error("推送消息错误", map[string]interface{}{
  85 + "err": err3.Error(),
  86 + })
  87 + return nil
  88 + } else {
  89 + log.Logger.Info("推送数据返回", data)
  90 + }
84 } 91 }
  92 +
85 break 93 break
86 case event.CREDIT_ACCOUNT_PAID: // 账期结算支付 94 case event.CREDIT_ACCOUNT_PAID: // 账期结算支付
87 creditAccountPaidEvent := domainEvent.(*event.CreditAccountPaid) 95 creditAccountPaidEvent := domainEvent.(*event.CreditAccountPaid)
88 - data, err4 := messageServiceGateway.PayCreditAccount(  
89 - creditAccountPaidEvent.CreditAccountOrderNum,  
90 - creditAccountPaidEvent.SettlementAmount,  
91 - creditAccountPaidEvent.CreditAccountId,  
92 - creditAccountPaidEvent.DividendsEstimateId,  
93 - creditAccountPaidEvent.DividendsEstimateOrderNumber,  
94 - creditAccountPaidEvent.UserId,  
95 - creditAccountPaidEvent.UserBaseId,  
96 - creditAccountPaidEvent.OrgId,  
97 - creditAccountPaidEvent.CompanyId,  
98 - )  
99 - if err4 != nil {  
100 - log.Logger.Error("推送消息错误", map[string]interface{}{  
101 - "err": err4.Error(),  
102 - })  
103 - return nil  
104 - } else {  
105 - log.Logger.Info("推送数据返回", data) 96 + for _, paidData := range creditAccountPaidEvent.CreditAccountPaidData {
  97 + data, err4 := messageServiceGateway.PayCreditAccount(
  98 + paidData.CreditAccountOrderNum,
  99 + paidData.SettlementAmount,
  100 + paidData.CreditAccountId,
  101 + paidData.DividendsEstimateId,
  102 + paidData.DividendsEstimateOrderNumber,
  103 + paidData.UserId,
  104 + paidData.UserBaseId,
  105 + paidData.OrgId,
  106 + paidData.CompanyId,
  107 + )
  108 + if err4 != nil {
  109 + log.Logger.Error("推送消息错误", map[string]interface{}{
  110 + "err": err4.Error(),
  111 + })
  112 + return nil
  113 + } else {
  114 + log.Logger.Info("推送数据返回", data)
  115 + }
106 } 116 }
  117 +
107 break 118 break
108 case event.DIVIDENDS_ESTIMATED: // 账期结算 119 case event.DIVIDENDS_ESTIMATED: // 账期结算
109 dividendsEstimatedEvent := domainEvent.(*event.DividendsEstimated) 120 dividendsEstimatedEvent := domainEvent.(*event.DividendsEstimated)
110 - data, err5 := messageServiceGateway.DividendsEstimate(  
111 - dividendsEstimatedEvent.CreditAccountOrderNum,  
112 - dividendsEstimatedEvent.SettlementAmount,  
113 - dividendsEstimatedEvent.CreditAccountId,  
114 - dividendsEstimatedEvent.DividendsEstimateId,  
115 - dividendsEstimatedEvent.DividendsEstimateOrderNumber,  
116 - dividendsEstimatedEvent.UserId,  
117 - dividendsEstimatedEvent.UserBaseId,  
118 - dividendsEstimatedEvent.OrgId,  
119 - dividendsEstimatedEvent.CompanyId,  
120 - )  
121 - if err5 != nil {  
122 - log.Logger.Error("推送消息错误", map[string]interface{}{  
123 - "err": err5.Error(),  
124 - })  
125 - return nil  
126 - } else {  
127 - log.Logger.Info("推送数据返回", data) 121 + for _, estimatedData := range dividendsEstimatedEvent.DividendsEstimatedData {
  122 + data, err5 := messageServiceGateway.DividendsEstimate(
  123 + estimatedData.CreditAccountOrderNum,
  124 + estimatedData.SettlementAmount,
  125 + estimatedData.CreditAccountId,
  126 + estimatedData.DividendsEstimateId,
  127 + estimatedData.DividendsEstimateOrderNumber,
  128 + estimatedData.UserId,
  129 + estimatedData.UserBaseId,
  130 + estimatedData.OrgId,
  131 + estimatedData.CompanyId,
  132 + )
  133 + if err5 != nil {
  134 + log.Logger.Error("推送消息错误", map[string]interface{}{
  135 + "err": err5.Error(),
  136 + })
  137 + return nil
  138 + } else {
  139 + log.Logger.Info("推送数据返回", data)
  140 + }
128 } 141 }
129 break 142 break
130 case event.DIVIDENDS_INFORM_EXPECTED: // 分红预算 143 case event.DIVIDENDS_INFORM_EXPECTED: // 分红预算
131 dividendsInformExpectedEvent := domainEvent.(*event.DividendsInformExpected) 144 dividendsInformExpectedEvent := domainEvent.(*event.DividendsInformExpected)
132 - data, err6 := messageServiceGateway.InformExpectedDividends(  
133 - dividendsInformExpectedEvent.CreationContractId,  
134 - dividendsInformExpectedEvent.CreationContractName,  
135 - dividendsInformExpectedEvent.CreationContractNumber,  
136 - dividendsInformExpectedEvent.CreationProjectId,  
137 - dividendsInformExpectedEvent.CreationProjectName,  
138 - dividendsInformExpectedEvent.ProductName,  
139 - dividendsInformExpectedEvent.UserId,  
140 - dividendsInformExpectedEvent.UserBaseId,  
141 - dividendsInformExpectedEvent.OrgId,  
142 - dividendsInformExpectedEvent.CompanyId,  
143 - dividendsInformExpectedEvent.DividendsEstimateId,  
144 - dividendsInformExpectedEvent.DividendsAmount,  
145 - )  
146 - if err6 != nil {  
147 - log.Logger.Error("推送消息错误", map[string]interface{}{  
148 - "err": err6.Error(),  
149 - })  
150 - return nil  
151 - } else {  
152 - log.Logger.Info("推送数据返回", data) 145 + for _, expectedData := range dividendsInformExpectedEvent.DividendsInformExpectedData {
  146 + data, err6 := messageServiceGateway.InformExpectedDividends(
  147 + expectedData.CreationContractId,
  148 + expectedData.CreationContractName,
  149 + expectedData.CreationContractNumber,
  150 + expectedData.CreationProjectId,
  151 + expectedData.CreationProjectName,
  152 + expectedData.ProductName,
  153 + expectedData.UserId,
  154 + expectedData.UserBaseId,
  155 + expectedData.OrgId,
  156 + expectedData.CompanyId,
  157 + expectedData.DividendsEstimateId,
  158 + expectedData.DividendsAmount,
  159 + )
  160 + if err6 != nil {
  161 + log.Logger.Error("推送消息错误", map[string]interface{}{
  162 + "err": err6.Error(),
  163 + })
  164 + return nil
  165 + } else {
  166 + log.Logger.Info("推送数据返回", data)
  167 + }
153 } 168 }
  169 +
154 break 170 break
155 } 171 }
156 return nil 172 return nil
@@ -71,3 +71,7 @@ func CreateRejectContractApplicationService(options map[string]interface{}) (*do @@ -71,3 +71,7 @@ func CreateRejectContractApplicationService(options map[string]interface{}) (*do
71 //return domain_service.NewRejectContractApplicationService(transactionContext) 71 //return domain_service.NewRejectContractApplicationService(transactionContext)
72 return domain_service.NewRejectContractApplicationService(nil) 72 return domain_service.NewRejectContractApplicationService(nil)
73 } 73 }
  74 +
  75 +func CreateInformJoinCreationContractService(options map[string]interface{}) (*domain_service.InformJoinCreationContractService, error) {
  76 + return domain_service.NewInformJoinCreationContractService(nil)
  77 +}
@@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain" @@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
5 const COOPERATION_APPLICATION_AGREED = "=cooperation-application-agreed" 5 const COOPERATION_APPLICATION_AGREED = "=cooperation-application-agreed"
6 6
7 -type CooperationApplicationAgreed struct {  
8 - coreDomain.BaseEvent 7 +type CooperationApplicationAgreedData struct {
9 // 共创项目ID 8 // 共创项目ID
10 CreationProjectId int64 `json:"creationProjectId"` 9 CreationProjectId int64 `json:"creationProjectId"`
11 // 共创项目名称 10 // 共创项目名称
@@ -22,6 +21,11 @@ type CooperationApplicationAgreed struct { @@ -22,6 +21,11 @@ type CooperationApplicationAgreed struct {
22 CompanyId int64 `json:"companyId"` 21 CompanyId int64 `json:"companyId"`
23 } 22 }
24 23
  24 +type CooperationApplicationAgreed struct {
  25 + coreDomain.BaseEvent
  26 + CooperationApplicationAgreedData []CooperationApplicationAgreedData `json:"cooperationApplicationAgreedData"`
  27 +}
  28 +
25 func (event *CooperationApplicationAgreed) EventType() string { 29 func (event *CooperationApplicationAgreed) EventType() string {
26 return COOPERATION_APPLICATION_AGREED 30 return COOPERATION_APPLICATION_AGREED
27 } 31 }
@@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain" @@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
5 const COOPERATION_APPLICATION_REJECTED = "cooperation-application-rejected" 5 const COOPERATION_APPLICATION_REJECTED = "cooperation-application-rejected"
6 6
7 -type CooperationApplicationRejected struct {  
8 - coreDomain.BaseEvent 7 +type CooperationApplicationRejectedData struct {
9 // 共创项目ID 8 // 共创项目ID
10 CreationProjectId int64 `json:"creationProjectId"` 9 CreationProjectId int64 `json:"creationProjectId"`
11 // 共创项目名称 10 // 共创项目名称
@@ -22,6 +21,11 @@ type CooperationApplicationRejected struct { @@ -22,6 +21,11 @@ type CooperationApplicationRejected struct {
22 CompanyId int64 `json:"companyId"` 21 CompanyId int64 `json:"companyId"`
23 } 22 }
24 23
  24 +type CooperationApplicationRejected struct {
  25 + coreDomain.BaseEvent
  26 + CooperationApplicationRejectedData []CooperationApplicationRejectedData `json:"cooperationApplicationRejectedData"`
  27 +}
  28 +
25 func (event *CooperationApplicationRejected) EventType() string { 29 func (event *CooperationApplicationRejected) EventType() string {
26 return COOPERATION_APPLICATION_REJECTED 30 return COOPERATION_APPLICATION_REJECTED
27 } 31 }
@@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain" @@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
5 const CREATION_CONTRACT_INFORM_JOINT = "creation-contract-inform-joint" 5 const CREATION_CONTRACT_INFORM_JOINT = "creation-contract-inform-joint"
6 6
7 -type CreationContractInformJoint struct {  
8 - coreDomain.BaseEvent 7 +type CreationContractInformJointData struct {
9 // 共创合约ID 8 // 共创合约ID
10 CreationContractId int64 `json:"creationContractId"` 9 CreationContractId int64 `json:"creationContractId"`
11 // 共创合约名称 10 // 共创合约名称
@@ -14,6 +13,8 @@ type CreationContractInformJoint struct { @@ -14,6 +13,8 @@ type CreationContractInformJoint struct {
14 CreationContractNumber string `json:"creationContractNumber"` 13 CreationContractNumber string `json:"creationContractNumber"`
15 // 共创项目ID 14 // 共创项目ID
16 CreationProjectId int64 `json:"creationProjectId"` 15 CreationProjectId int64 `json:"creationProjectId"`
  16 + // 共创项目编号
  17 + CreationProjectNumber string `json:"creationProjectNumber"`
17 // 共创项目名称 18 // 共创项目名称
18 CreationProjectName string `json:"creationProjectName"` 19 CreationProjectName string `json:"creationProjectName"`
19 // 申请人ID 20 // 申请人ID
@@ -26,6 +27,11 @@ type CreationContractInformJoint struct { @@ -26,6 +27,11 @@ type CreationContractInformJoint struct {
26 CompanyId int64 `json:"companyId"` 27 CompanyId int64 `json:"companyId"`
27 } 28 }
28 29
  30 +type CreationContractInformJoint struct {
  31 + coreDomain.BaseEvent
  32 + CreationContractInformJointData []CreationContractInformJointData `json:"creationContractInformJointData"`
  33 +}
  34 +
29 func (event *CreationContractInformJoint) EventType() string { 35 func (event *CreationContractInformJoint) EventType() string {
30 return CREATION_CONTRACT_INFORM_JOINT 36 return CREATION_CONTRACT_INFORM_JOINT
31 } 37 }
@@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain" @@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
5 const CREDIT_ACCOUNT_PAID = "credit-account-paid" 5 const CREDIT_ACCOUNT_PAID = "credit-account-paid"
6 6
7 -type CreditAccountPaid struct {  
8 - coreDomain.BaseEvent 7 +type CreditAccountPaidData struct {
9 // 账期结算单编号 8 // 账期结算单编号
10 CreditAccountOrderNum string `json:"creditAccountOrderNum"` 9 CreditAccountOrderNum string `json:"creditAccountOrderNum"`
11 // 结算金额 10 // 结算金额
@@ -26,6 +25,11 @@ type CreditAccountPaid struct { @@ -26,6 +25,11 @@ type CreditAccountPaid struct {
26 CompanyId int64 `json:"companyId"` 25 CompanyId int64 `json:"companyId"`
27 } 26 }
28 27
  28 +type CreditAccountPaid struct {
  29 + coreDomain.BaseEvent
  30 + CreditAccountPaidData []CreditAccountPaidData `json:"creditAccountPaidData"`
  31 +}
  32 +
29 func (event *CreditAccountPaid) EventType() string { 33 func (event *CreditAccountPaid) EventType() string {
30 return CREDIT_ACCOUNT_PAID 34 return CREDIT_ACCOUNT_PAID
31 } 35 }
@@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain" @@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
5 const DIVIDENDS_ESTIMATED = "dividends-estimated" 5 const DIVIDENDS_ESTIMATED = "dividends-estimated"
6 6
7 -type DividendsEstimated struct {  
8 - coreDomain.BaseEvent 7 +type DividendsEstimatedData struct {
9 // 账期结算单编号 8 // 账期结算单编号
10 CreditAccountOrderNum string `json:"creditAccountOrderNum"` 9 CreditAccountOrderNum string `json:"creditAccountOrderNum"`
11 // 结算金额 10 // 结算金额
@@ -26,6 +25,11 @@ type DividendsEstimated struct { @@ -26,6 +25,11 @@ type DividendsEstimated struct {
26 CompanyId int64 `json:"companyId"` 25 CompanyId int64 `json:"companyId"`
27 } 26 }
28 27
  28 +type DividendsEstimated struct {
  29 + coreDomain.BaseEvent
  30 + DividendsEstimatedData []DividendsEstimatedData `json:"dividendsEstimatedData"`
  31 +}
  32 +
29 func (event *DividendsEstimated) EventType() string { 33 func (event *DividendsEstimated) EventType() string {
30 return DIVIDENDS_ESTIMATED 34 return DIVIDENDS_ESTIMATED
31 } 35 }
@@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain" @@ -4,8 +4,7 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
5 const DIVIDENDS_INFORM_EXPECTED = "dividends-inform-expected" 5 const DIVIDENDS_INFORM_EXPECTED = "dividends-inform-expected"
6 6
7 -type DividendsInformExpected struct {  
8 - coreDomain.BaseEvent 7 +type DividendsInformExpectedData struct {
9 // 共创合约ID 8 // 共创合约ID
10 CreationContractId int64 `json:"creationContractId"` 9 CreationContractId int64 `json:"creationContractId"`
11 // 共创合约名称 10 // 共创合约名称
@@ -32,6 +31,11 @@ type DividendsInformExpected struct { @@ -32,6 +31,11 @@ type DividendsInformExpected struct {
32 DividendsAmount string `json:"dividendsAmount"` 31 DividendsAmount string `json:"dividendsAmount"`
33 } 32 }
34 33
  34 +type DividendsInformExpected struct {
  35 + coreDomain.BaseEvent
  36 + DividendsInformExpectedData []DividendsInformExpectedData `json:"dividendsInformExpectedData"`
  37 +}
  38 +
35 func (event *DividendsInformExpected) EventType() string { 39 func (event *DividendsInformExpected) EventType() string {
36 return DIVIDENDS_ESTIMATED 40 return DIVIDENDS_ESTIMATED
37 } 41 }
@@ -2,7 +2,17 @@ package service @@ -2,7 +2,17 @@ package service
2 2
3 import coreDomain "github.com/linmadan/egglib-go/core/domain" 3 import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
  5 +type AgreeData struct {
  6 + CreationProjectId int64
  7 + CreationProjectName string
  8 + CreationProjectNumber string
  9 + UserId int64
  10 + UserBaseId int64
  11 + OrgId int64
  12 + CompanyId int64
  13 +}
  14 +
5 type AgreeContractApplicationService interface { 15 type AgreeContractApplicationService interface {
6 coreDomain.DomainEventPublisher 16 coreDomain.DomainEventPublisher
7 - Agree(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) error 17 + Agree([]AgreeData) error
8 } 18 }
  1 +package service
  2 +
  3 +import coreDomain "github.com/linmadan/egglib-go/core/domain"
  4 +
  5 +type JoinData struct {
  6 + CreationContractId int64
  7 + CreationContractName string
  8 + CreationContractNumber string
  9 + CreationProjectId int64
  10 + CreationProjectNumber string
  11 + CreationProjectName string
  12 + UserId int64
  13 + UserBaseId int64
  14 + OrgId int64
  15 + CompanyId int64
  16 +}
  17 +
  18 +type InformJoinCreationContractService interface {
  19 + coreDomain.DomainEventPublisher
  20 + Join([]JoinData) error
  21 +}
@@ -2,7 +2,17 @@ package service @@ -2,7 +2,17 @@ package service
2 2
3 import coreDomain "github.com/linmadan/egglib-go/core/domain" 3 import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
  5 +type RejectData struct {
  6 + CreationProjectId int64
  7 + CreationProjectName string
  8 + CreationProjectNumber string
  9 + UserId int64
  10 + UserBaseId int64
  11 + OrgId int64
  12 + CompanyId int64
  13 +}
  14 +
5 type RejectContractApplicationService interface { 15 type RejectContractApplicationService interface {
6 coreDomain.DomainEventPublisher 16 coreDomain.DomainEventPublisher
7 - Reject(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) error 17 + Reject([]RejectData) error
8 } 18 }
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 coreDomain "github.com/linmadan/egglib-go/core/domain" 4 coreDomain "github.com/linmadan/egglib-go/core/domain"
5 pgTransaction "github.com/linmadan/egglib-go/transaction/pg" 5 pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
7 ) 8 )
8 9
9 type AgreeContractApplicationService struct { 10 type AgreeContractApplicationService struct {
@@ -11,15 +12,19 @@ type AgreeContractApplicationService struct { @@ -11,15 +12,19 @@ type AgreeContractApplicationService struct {
11 //transactionContext *pgTransaction.TransactionContext 12 //transactionContext *pgTransaction.TransactionContext
12 } 13 }
13 14
14 -func (service *AgreeContractApplicationService) Agree(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) error { 15 +func (service *AgreeContractApplicationService) Agree(data []service.AgreeData) error {
15 cooperationApplicationAgreedEvent := new(event.CooperationApplicationAgreed) 16 cooperationApplicationAgreedEvent := new(event.CooperationApplicationAgreed)
16 - cooperationApplicationAgreedEvent.CreationProjectId = creationProjectId  
17 - cooperationApplicationAgreedEvent.CreationProjectName = creationProjectName  
18 - cooperationApplicationAgreedEvent.CreationProjectNumber = creationProjectNumber  
19 - cooperationApplicationAgreedEvent.UserId = userId  
20 - cooperationApplicationAgreedEvent.UserBaseId = userBaseId  
21 - cooperationApplicationAgreedEvent.OrgId = orgId  
22 - cooperationApplicationAgreedEvent.CompanyId = companyId 17 + for _, cooperationApplicationAgreedData := range data {
  18 + cooperationApplicationAgreedEvent.CooperationApplicationAgreedData = append(cooperationApplicationAgreedEvent.CooperationApplicationAgreedData, event.CooperationApplicationAgreedData{
  19 + CreationProjectId: cooperationApplicationAgreedData.CreationProjectId,
  20 + CreationProjectName: cooperationApplicationAgreedData.CreationProjectName,
  21 + CreationProjectNumber: cooperationApplicationAgreedData.CreationProjectNumber,
  22 + UserId: cooperationApplicationAgreedData.UserId,
  23 + UserBaseId: cooperationApplicationAgreedData.UserBaseId,
  24 + OrgId: cooperationApplicationAgreedData.OrgId,
  25 + CompanyId: cooperationApplicationAgreedData.CompanyId,
  26 + })
  27 + }
23 if err := service.Publish(cooperationApplicationAgreedEvent); err != nil { 28 if err := service.Publish(cooperationApplicationAgreedEvent); err != nil {
24 return err 29 return err
25 } 30 }
  1 +package domain_service
  2 +
  3 +import (
  4 + coreDomain "github.com/linmadan/egglib-go/core/domain"
  5 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
  8 +)
  9 +
  10 +type InformJoinCreationContractService struct {
  11 + coreDomain.BaseEventPublisher
  12 +}
  13 +
  14 +func (service *InformJoinCreationContractService) Join(data []service.JoinData) error {
  15 + creationContractInformJointEvent := new(event.CreationContractInformJoint)
  16 + for _, creationContractInformJointData := range data {
  17 + creationContractInformJointEvent.CreationContractInformJointData = append(creationContractInformJointEvent.CreationContractInformJointData, event.CreationContractInformJointData{
  18 + CreationContractId: creationContractInformJointData.CreationContractId,
  19 + CreationContractName: creationContractInformJointData.CreationContractName,
  20 + CreationContractNumber: creationContractInformJointData.CreationContractNumber,
  21 + CreationProjectId: creationContractInformJointData.CreationProjectId,
  22 + CreationProjectNumber: creationContractInformJointData.CreationProjectNumber,
  23 + CreationProjectName: creationContractInformJointData.CreationProjectName,
  24 + UserId: creationContractInformJointData.UserId,
  25 + UserBaseId: creationContractInformJointData.UserBaseId,
  26 + OrgId: creationContractInformJointData.OrgId,
  27 + CompanyId: creationContractInformJointData.CompanyId,
  28 + })
  29 + }
  30 + if err := service.Publish(creationContractInformJointEvent); err != nil {
  31 + return err
  32 + }
  33 + return nil
  34 +}
  35 +
  36 +func NewInformJoinCreationContractService(transactionContext *pgTransaction.TransactionContext) (*InformJoinCreationContractService, error) {
  37 + return &InformJoinCreationContractService{}, nil
  38 +}
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 coreDomain "github.com/linmadan/egglib-go/core/domain" 4 coreDomain "github.com/linmadan/egglib-go/core/domain"
5 pgTransaction "github.com/linmadan/egglib-go/transaction/pg" 5 pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
7 ) 8 )
8 9
9 type RejectContractApplicationService struct { 10 type RejectContractApplicationService struct {
@@ -11,15 +12,19 @@ type RejectContractApplicationService struct { @@ -11,15 +12,19 @@ type RejectContractApplicationService struct {
11 //transactionContext *pgTransaction.TransactionContext 12 //transactionContext *pgTransaction.TransactionContext
12 } 13 }
13 14
14 -func (service *RejectContractApplicationService) Reject(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) error { 15 +func (service *RejectContractApplicationService) Reject(data []service.RejectData) error {
15 cooperationApplicationRejectedEvent := new(event.CooperationApplicationRejected) 16 cooperationApplicationRejectedEvent := new(event.CooperationApplicationRejected)
16 - cooperationApplicationRejectedEvent.CreationProjectId = creationProjectId  
17 - cooperationApplicationRejectedEvent.CreationProjectName = creationProjectName  
18 - cooperationApplicationRejectedEvent.CreationProjectNumber = creationProjectNumber  
19 - cooperationApplicationRejectedEvent.UserId = userId  
20 - cooperationApplicationRejectedEvent.UserBaseId = userBaseId  
21 - cooperationApplicationRejectedEvent.OrgId = orgId  
22 - cooperationApplicationRejectedEvent.CompanyId = companyId 17 + for _, cooperationApplicationRejectedData := range data {
  18 + cooperationApplicationRejectedEvent.CooperationApplicationRejectedData = append(cooperationApplicationRejectedEvent.CooperationApplicationRejectedData, event.CooperationApplicationRejectedData{
  19 + CreationProjectId: cooperationApplicationRejectedData.CreationProjectId,
  20 + CreationProjectName: cooperationApplicationRejectedData.CreationProjectName,
  21 + CreationProjectNumber: cooperationApplicationRejectedData.CreationProjectNumber,
  22 + UserId: cooperationApplicationRejectedData.UserId,
  23 + UserBaseId: cooperationApplicationRejectedData.UserBaseId,
  24 + OrgId: cooperationApplicationRejectedData.OrgId,
  25 + CompanyId: cooperationApplicationRejectedData.CompanyId,
  26 + })
  27 + }
23 if err := service.Publish(cooperationApplicationRejectedEvent); err != nil { 28 if err := service.Publish(cooperationApplicationRejectedEvent); err != nil {
24 return err 29 return err
25 } 30 }
@@ -125,6 +125,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract( @@ -125,6 +125,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract(
125 creationContractName string, 125 creationContractName string,
126 creationContractNumber string, 126 creationContractNumber string,
127 creationProjectId int64, 127 creationProjectId int64,
  128 + creationProjectNumber string,
128 creationProjectName string, 129 creationProjectName string,
129 userId int64, 130 userId int64,
130 userBaseId int64, 131 userBaseId int64,
@@ -138,6 +139,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract( @@ -138,6 +139,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract(
138 options["creationContractName"] = creationContractName 139 options["creationContractName"] = creationContractName
139 options["creationContractNumber"] = creationContractNumber 140 options["creationContractNumber"] = creationContractNumber
140 options["creationProjectId"] = creationProjectId 141 options["creationProjectId"] = creationProjectId
  142 + options["creationProjectNumber"] = creationProjectNumber
141 options["creationProjectName"] = creationProjectName 143 options["creationProjectName"] = creationProjectName
142 options["userId"] = userId 144 options["userId"] = userId
143 options["userBaseId"] = userBaseId 145 options["userBaseId"] = userBaseId
@@ -16,7 +16,7 @@ type BasicServiceGateway interface { @@ -16,7 +16,7 @@ type BasicServiceGateway interface {
16 AgreeCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) 16 AgreeCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
17 RejectCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) 17 RejectCooperationApplication(creationProjectId int64, creationProjectName string, creationProjectNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
18 InformExpectedDividends(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, productName string, userId int64, userBaseId int64, orgId int64, companyId int64, dividendsEstimateId int64, dividendsAmount string) (map[string]interface{}, error) 18 InformExpectedDividends(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, productName string, userId int64, userBaseId int64, orgId int64, companyId int64, dividendsEstimateId int64, dividendsAmount string) (map[string]interface{}, error)
19 - InformJoinCreationContract(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) 19 + InformJoinCreationContract(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectNumber string, creationProjectName string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
20 PayCreditAccount(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) 20 PayCreditAccount(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
21 DividendsEstimate(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) 21 DividendsEstimate(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
22 } 22 }