作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !87
正在显示 28 个修改的文件 包含 905 行增加220 行删除
@@ -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 }
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "github.com/linmadan/egglib-go/utils/tool_funs" 6 "github.com/linmadan/egglib-go/utils/tool_funs"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/creditAccount/command" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/creditAccount/command"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/creditAccount/query" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/creditAccount/query"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/event/subscriber"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
@@ -103,6 +104,17 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred @@ -103,6 +104,17 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
103 creditAccountDao = value 104 creditAccountDao = value
104 } 105 }
105 106
  107 + // 账期结算消息推送领域服务初始化
  108 + var estimateDividendsService service.EstimateDividendsService
  109 + if value, err := factory.CreateEstimateDividendsService(map[string]interface{}{}); err != nil {
  110 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  111 + } else {
  112 + estimateDividendsService = value
  113 + _ = estimateDividendsService.Subscribe(&subscriber.MessageServiceSubscriber{
  114 + //TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
  115 + })
  116 + }
  117 +
106 // 分红预算单仓储初始化 118 // 分红预算单仓储初始化
107 var dividendsEstimateRepository domain.DividendsEstimateRepository 119 var dividendsEstimateRepository domain.DividendsEstimateRepository
108 if value, err10 := factory.CreateDividendsEstimateRepository(map[string]interface{}{ 120 if value, err10 := factory.CreateDividendsEstimateRepository(map[string]interface{}{
@@ -221,6 +233,26 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred @@ -221,6 +233,26 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
221 if err14 := transactionContext.CommitTransaction(); err14 != nil { 233 if err14 := transactionContext.CommitTransaction(); err14 != nil {
222 return nil, application.ThrowError(application.TRANSACTION_ERROR, err14.Error()) 234 return nil, application.ThrowError(application.TRANSACTION_ERROR, err14.Error())
223 } 235 }
  236 +
  237 + // 消息推送
  238 + var accountData []service.EstimateData
  239 + for _, detail := range creditAccount.AccountDetail {
  240 + accountData = append(accountData, service.EstimateData{
  241 + CreditAccountOrderNum: creditAccount.CreditAccountOrderNum,
  242 + SettlementAmount: fmt.Sprint(creditAccount.SettlementAmount),
  243 + CreditAccountId: creditAccount.CreditAccountId,
  244 + DividendsEstimateId: detail.DividendsEstimateOrderId,
  245 + DividendsEstimateOrderNumber: detail.DividendsEstimateOrderNumber,
  246 + UserId: creditAccount.Participator.UserId,
  247 + UserBaseId: creditAccount.Participator.UserBaseId,
  248 + OrgId: creditAccount.Org.OrgId,
  249 + CompanyId: creditAccount.Company.CompanyId,
  250 + })
  251 + }
  252 + if err15 := estimateDividendsService.Estimate(accountData); err15 != nil {
  253 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err15.Error())
  254 + }
  255 +
224 return creditAccount, nil 256 return creditAccount, nil
225 } 257 }
226 } 258 }
@@ -361,6 +393,17 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco @@ -361,6 +393,17 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco
361 dividendsEstimateRepository = value 393 dividendsEstimateRepository = value
362 } 394 }
363 395
  396 + // 账期支付消息推送领域服务初始化
  397 + var payCreditAccountService service.PayCreditAccountService
  398 + if value, err := factory.CreatePayCreditAccountService(map[string]interface{}{}); err != nil {
  399 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  400 + } else {
  401 + payCreditAccountService = value
  402 + _ = payCreditAccountService.Subscribe(&subscriber.MessageServiceSubscriber{
  403 + //TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
  404 + })
  405 + }
  406 +
364 // 获取待支付的账期结算单 407 // 获取待支付的账期结算单
365 creditAccount, err := creditAccountRepository.FindOne(map[string]interface{}{ 408 creditAccount, err := creditAccountRepository.FindOne(map[string]interface{}{
366 "creditAccountId": creditAccountId, 409 "creditAccountId": creditAccountId,
@@ -406,6 +449,23 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco @@ -406,6 +449,23 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco
406 if err3 := transactionContext.CommitTransaction(); err3 != nil { 449 if err3 := transactionContext.CommitTransaction(); err3 != nil {
407 return nil, application.ThrowError(application.TRANSACTION_ERROR, err3.Error()) 450 return nil, application.ThrowError(application.TRANSACTION_ERROR, err3.Error())
408 } 451 }
  452 +
  453 + // 支付消息推送
  454 + var payData []service.PayData
  455 + payData = append(payData, service.PayData{
  456 + CreditAccountOrderNum: creditAccountSaved.CreditAccountOrderNum,
  457 + SettlementAmount: fmt.Sprint(creditAccountSaved.SettlementAmount),
  458 + ActuallyPaidAmount: fmt.Sprint(creditAccountSaved.ActuallyPaidAmount),
  459 + CreditAccountId: creditAccountSaved.CreditAccountId,
  460 + UserId: creditAccountSaved.Participator.UserId,
  461 + UserBaseId: creditAccountSaved.Participator.UserBaseId,
  462 + OrgId: creditAccountSaved.Org.OrgId,
  463 + CompanyId: creditAccountSaved.Company.CompanyId,
  464 + })
  465 + if err5 := payCreditAccountService.Pay(payData); err5 != nil {
  466 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err5.Error())
  467 + }
  468 +
409 return creditAccountSaved, nil 469 return creditAccountSaved, nil
410 } 470 }
411 } 471 }
@@ -3,7 +3,6 @@ package service @@ -3,7 +3,6 @@ package service
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "github.com/linmadan/egglib-go/core/application" 5 "github.com/linmadan/egglib-go/core/application"
6 - pgTransaction "github.com/linmadan/egglib-go/transaction/pg"  
7 "github.com/linmadan/egglib-go/utils/tool_funs" 6 "github.com/linmadan/egglib-go/utils/tool_funs"
8 "github.com/shopspring/decimal" 7 "github.com/shopspring/decimal"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/command" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/command"
@@ -542,6 +541,17 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -542,6 +541,17 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
542 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 541 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
543 } 542 }
544 543
  544 + // 预算消息推送领域服务初始化
  545 + var informDividendsExpectedService service.InformDividendsExpectedService
  546 + if value, err := factory.CreateInformDividendsExpectedService(map[string]interface{}{}); err != nil {
  547 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  548 + } else {
  549 + informDividendsExpectedService = value
  550 + _ = informDividendsExpectedService.Subscribe(&subscriber.MessageServiceSubscriber{
  551 + //TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
  552 + })
  553 + }
  554 +
545 // 公司REST服务初始化 555 // 公司REST服务初始化
546 var companyService service.CompanyService 556 var companyService service.CompanyService
547 if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil { 557 if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil {
@@ -656,6 +666,16 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -656,6 +666,16 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
656 cooperationContractRepository = value 666 cooperationContractRepository = value
657 } 667 }
658 668
  669 + // 共创项目仓储初始化
  670 + var cooperationProjectRepository domain.CooperationProjectRepository
  671 + if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
  672 + "transactionContext": transactionContext,
  673 + }); err != nil {
  674 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  675 + } else {
  676 + cooperationProjectRepository = value
  677 + }
  678 +
659 // 初始化确认业绩激励分红预算领域服务 679 // 初始化确认业绩激励分红预算领域服务
660 var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService 680 var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService
661 if value, err := factory.CreateConfirmDividendsIncentivesEstimateService(map[string]interface{}{ 681 if value, err := factory.CreateConfirmDividendsIncentivesEstimateService(map[string]interface{}{
@@ -664,9 +684,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -664,9 +684,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
664 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 684 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
665 } else { 685 } else {
666 confirmDividendsIncentivesEstimateService = value 686 confirmDividendsIncentivesEstimateService = value
667 - _ = confirmDividendsIncentivesEstimateService.Subscribe(&subscriber.DividendsEstimateSubscriber{  
668 - TransactionContext: transactionContext.(*pgTransaction.TransactionContext),  
669 - })  
670 } 687 }
671 688
672 // 统计成功预算的分红订单 689 // 统计成功预算的分红订单
@@ -689,14 +706,21 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -689,14 +706,21 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
689 706
690 var cooperationContractNumbers []string 707 var cooperationContractNumbers []string
691 708
  709 + orderGoodsMap := make(map[int64]*domain.OrderGood, 0)
  710 +
692 // 获取订单产品合约编号 711 // 获取订单产品合约编号
693 for _, orderGood := range orderGoods { 712 for _, orderGood := range orderGoods {
694 cooperationContractNumbers = append(cooperationContractNumbers, orderGood.CooperationContractNumber) 713 cooperationContractNumbers = append(cooperationContractNumbers, orderGood.CooperationContractNumber)
  714 + orderGoodsMap[orderGood.OrderGoodId] = orderGood
695 } 715 }
696 716
697 newCooperationContractNumbers := utils.RemoveDuplicationString(cooperationContractNumbers) 717 newCooperationContractNumbers := utils.RemoveDuplicationString(cooperationContractNumbers)
698 718
699 cooperationContractsMap := make(map[string]*domain.CooperationContract, 0) 719 cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)
  720 + cooperationProjectsMap := make(map[string]*domain.CooperationProject, 0)
  721 +
  722 + // 共创项目编号
  723 + var cooperationProjectNumbers []string
700 724
701 // 查询共创合约 725 // 查询共创合约
702 startQueryContracts := time.Now() 726 startQueryContracts := time.Now()
@@ -712,6 +736,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -712,6 +736,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
712 if count > 0 { 736 if count > 0 {
713 for _, cooperationContractFound := range cooperationContractsFound { 737 for _, cooperationContractFound := range cooperationContractsFound {
714 cooperationContractsMap[cooperationContractFound.CooperationContractNumber] = cooperationContractFound 738 cooperationContractsMap[cooperationContractFound.CooperationContractNumber] = cooperationContractFound
  739 + cooperationProjectNumbers = append(cooperationProjectNumbers, cooperationContractFound.CooperationProjectNumber)
715 } 740 }
716 } 741 }
717 } 742 }
@@ -720,6 +745,9 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -720,6 +745,9 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
720 "report": fmt.Sprintf("已完成0单订单分红预算,生成0单分红预算,失败原因:产品未关联合约"), 745 "report": fmt.Sprintf("已完成0单订单分红预算,生成0单分红预算,失败原因:产品未关联合约"),
721 }, nil 746 }, nil
722 } 747 }
  748 +
  749 + newCooperationProjectNumbers := utils.RemoveDuplicationString(cooperationProjectNumbers)
  750 +
723 fmt.Println("查询共创合约耗时:", time.Since(startQueryContracts)) 751 fmt.Println("查询共创合约耗时:", time.Since(startQueryContracts))
724 752
725 // 统计当前企业分红预算单数 753 // 统计当前企业分红预算单数
@@ -996,6 +1024,24 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -996,6 +1024,24 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
996 1024
997 fmt.Println("更新退货单耗时:", time.Since(startUpdateReturnedOrder)) 1025 fmt.Println("更新退货单耗时:", time.Since(startUpdateReturnedOrder))
998 1026
  1027 + // 查询共创项目
  1028 + if len(newCooperationProjectNumbers) > 0 {
  1029 + if countProject, cooperationProjectsFound, errFind := cooperationProjectRepository.Find(map[string]interface{}{
  1030 + "cooperationProjectNumbers": newCooperationProjectNumbers,
  1031 + "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
  1032 + "orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
  1033 + "offsetLimit": false,
  1034 + }); errFind != nil {
  1035 + return nil, errFind
  1036 + } else {
  1037 + if countProject > 0 {
  1038 + for _, cooperationProjectFound := range cooperationProjectsFound {
  1039 + cooperationProjectsMap[cooperationProjectFound.CooperationProjectNumber] = cooperationProjectFound
  1040 + }
  1041 + }
  1042 + }
  1043 + }
  1044 +
999 startCommit := time.Now() 1045 startCommit := time.Now()
1000 if err := transactionContext.CommitTransaction(); err != nil { 1046 if err := transactionContext.CommitTransaction(); err != nil {
1001 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1047 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -1019,6 +1065,31 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -1019,6 +1065,31 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
1019 1065
1020 fmt.Println("函数执行完毕:", time.Since(start)) 1066 fmt.Println("函数执行完毕:", time.Since(start))
1021 1067
  1068 + // 消息通知
  1069 + var expectedData []service.ExpectedData
  1070 + for _, dividendsEstimateSaved := range dividendsEstimatesSaved {
  1071 + if dividendsEstimateSaved.DividendsParticipateType == 1 {
  1072 + expectedData = append(expectedData, service.ExpectedData{
  1073 + CreationContractId: cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationContractId,
  1074 + CreationContractName: cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationContractName,
  1075 + CreationContractNumber: cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationContractNumber,
  1076 + CreationProjectId: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectId,
  1077 + CreationProjectName: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectName,
  1078 + CreationProjectNumber: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectNumber,
  1079 + ProductName: orderGoodsMap[dividendsEstimateSaved.OrderGoodId].OrderGoodName,
  1080 + UserId: dividendsEstimateSaved.DividendsUser.UserId,
  1081 + UserBaseId: dividendsEstimateSaved.DividendsUser.UserBaseId,
  1082 + OrgId: dividendsEstimateSaved.Org.OrgId,
  1083 + CompanyId: dividendsEstimateSaved.Company.CompanyId,
  1084 + DividendsEstimateId: dividendsEstimateSaved.DividendsEstimateId,
  1085 + DividendsAmount: fmt.Sprint(dividendsEstimateSaved.DividendsAmount),
  1086 + })
  1087 + }
  1088 + }
  1089 + if err := informDividendsExpectedService.Expect(expectedData); err != nil {
  1090 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1091 + }
  1092 +
1022 return map[string]interface{}{ 1093 return map[string]interface{}{
1023 "report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr), 1094 "report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr),
1024 }, nil 1095 }, nil
@@ -1050,8 +1121,16 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives @@ -1050,8 +1121,16 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
1050 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1121 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1051 } else { 1122 } else {
1052 confirmMoneyIncentivesEstimateService = value 1123 confirmMoneyIncentivesEstimateService = value
1053 - _ = confirmMoneyIncentivesEstimateService.Subscribe(&subscriber.DividendsEstimateSubscriber{  
1054 - TransactionContext: transactionContext.(*pgTransaction.TransactionContext), 1124 + }
  1125 +
  1126 + // 预算消息推送领域服务初始化
  1127 + var informDividendsExpectedService service.InformDividendsExpectedService
  1128 + if value, err := factory.CreateInformDividendsExpectedService(map[string]interface{}{}); err != nil {
  1129 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1130 + } else {
  1131 + informDividendsExpectedService = value
  1132 + _ = informDividendsExpectedService.Subscribe(&subscriber.MessageServiceSubscriber{
  1133 + //TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
1055 }) 1134 })
1056 } 1135 }
1057 1136
@@ -1065,6 +1144,16 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives @@ -1065,6 +1144,16 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
1065 cooperationContractRepository = value 1144 cooperationContractRepository = value
1066 } 1145 }
1067 1146
  1147 + // 共创项目仓储初始化
  1148 + var cooperationProjectRepository domain.CooperationProjectRepository
  1149 + if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
  1150 + "transactionContext": transactionContext,
  1151 + }); err != nil {
  1152 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1153 + } else {
  1154 + cooperationProjectRepository = value
  1155 + }
  1156 +
1068 // 分红预算单DAO初始化 1157 // 分红预算单DAO初始化
1069 var dividendsEstimateDao *dao.DividendsEstimateDao 1158 var dividendsEstimateDao *dao.DividendsEstimateDao
1070 if value, err := factory.CreateDividendsEstimateDao(map[string]interface{}{ 1159 if value, err := factory.CreateDividendsEstimateDao(map[string]interface{}{
@@ -1138,6 +1227,20 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives @@ -1138,6 +1227,20 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
1138 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationContractId, 10))) 1227 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationContractId, 10)))
1139 } 1228 }
1140 1229
  1230 + // 获取共创项目
  1231 + cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{
  1232 + "cooperationProjectNumber": cooperationContract.CooperationProjectNumber,
  1233 + "orgId": organization.OrgId,
  1234 + "companyId": company.CompanyId,
  1235 + })
  1236 + if err != nil {
  1237 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1238 + }
  1239 + if cooperationProject == nil {
  1240 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", cooperationContract.CooperationProjectNumber))
  1241 + }
  1242 +
  1243 + // 分红预算单
1141 var dividendsEstimates []*domain.DividendsEstimate 1244 var dividendsEstimates []*domain.DividendsEstimate
1142 1245
1143 // 统计当前分红预算单数 1246 // 统计当前分红预算单数
@@ -1203,6 +1306,32 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives @@ -1203,6 +1306,32 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
1203 if err := transactionContext.CommitTransaction(); err != nil { 1306 if err := transactionContext.CommitTransaction(); err != nil {
1204 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1307 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
1205 } 1308 }
  1309 +
  1310 + // 消息通知
  1311 + var expectedData []service.ExpectedData
  1312 + for _, dividendsEstimateSaved := range dividendsEstimatesSaved {
  1313 + if dividendsEstimateSaved.DividendsParticipateType == 1 {
  1314 + expectedData = append(expectedData, service.ExpectedData{
  1315 + CreationContractId: cooperationContract.CooperationContractId,
  1316 + CreationContractName: cooperationContract.CooperationContractName,
  1317 + CreationContractNumber: cooperationContract.CooperationContractNumber,
  1318 + CreationProjectId: cooperationProject.CooperationProjectId,
  1319 + CreationProjectName: cooperationProject.CooperationProjectName,
  1320 + CreationProjectNumber: cooperationProject.CooperationProjectNumber,
  1321 + ProductName: "",
  1322 + UserId: dividendsEstimateSaved.DividendsUser.UserId,
  1323 + UserBaseId: dividendsEstimateSaved.DividendsUser.UserBaseId,
  1324 + OrgId: dividendsEstimateSaved.Org.OrgId,
  1325 + CompanyId: dividendsEstimateSaved.Company.CompanyId,
  1326 + DividendsEstimateId: dividendsEstimateSaved.DividendsEstimateId,
  1327 + DividendsAmount: fmt.Sprint(dividendsEstimateSaved.DividendsAmount),
  1328 + })
  1329 + }
  1330 + }
  1331 + if err := informDividendsExpectedService.Expect(expectedData); err != nil {
  1332 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1333 + }
  1334 +
1206 return dividendsEstimatesSaved, nil 1335 return dividendsEstimatesSaved, nil
1207 } 1336 }
1208 return dividendsEstimatesSaved, nil 1337 return dividendsEstimatesSaved, nil
1 -package subscriber  
2 -  
3 -import (  
4 - coreDomain "github.com/linmadan/egglib-go/core/domain"  
5 - pgTransaction "github.com/linmadan/egglib-go/transaction/pg"  
6 -)  
7 -  
8 -type DividendsEstimateSubscriber struct {  
9 - TransactionContext *pgTransaction.TransactionContext  
10 -}  
11 -  
12 -func (subscriber *DividendsEstimateSubscriber) HandleEvent(domainEvent coreDomain.DomainEvent) error {  
13 - return nil  
14 -}  
15 -  
16 -func (subscriber *DividendsEstimateSubscriber) SubscribedToEventTypes() []string {  
17 - return []string{  
18 - //event.CONFERENCE_MESSAGE, // 日程预约消息通知  
19 - }  
20 -}  
@@ -23,133 +23,148 @@ func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.D @@ -23,133 +23,148 @@ 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.ActuallyPaidAmount,
  101 + paidData.CreditAccountId,
  102 + paidData.UserId,
  103 + paidData.UserBaseId,
  104 + paidData.OrgId,
  105 + paidData.CompanyId,
  106 + )
  107 + if err4 != nil {
  108 + log.Logger.Error("推送消息错误", map[string]interface{}{
  109 + "err": err4.Error(),
  110 + })
  111 + return nil
  112 + } else {
  113 + log.Logger.Info("推送数据返回", data)
  114 + }
106 } 115 }
  116 +
107 break 117 break
108 case event.DIVIDENDS_ESTIMATED: // 账期结算 118 case event.DIVIDENDS_ESTIMATED: // 账期结算
109 dividendsEstimatedEvent := domainEvent.(*event.DividendsEstimated) 119 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) 120 + for _, estimatedData := range dividendsEstimatedEvent.DividendsEstimatedData {
  121 + data, err5 := messageServiceGateway.DividendsEstimate(
  122 + estimatedData.CreditAccountOrderNum,
  123 + estimatedData.SettlementAmount,
  124 + estimatedData.CreditAccountId,
  125 + estimatedData.DividendsEstimateId,
  126 + estimatedData.DividendsEstimateOrderNumber,
  127 + estimatedData.UserId,
  128 + estimatedData.UserBaseId,
  129 + estimatedData.OrgId,
  130 + estimatedData.CompanyId,
  131 + )
  132 + if err5 != nil {
  133 + log.Logger.Error("推送消息错误", map[string]interface{}{
  134 + "err": err5.Error(),
  135 + })
  136 + return nil
  137 + } else {
  138 + log.Logger.Info("推送数据返回", data)
  139 + }
128 } 140 }
129 break 141 break
130 - case event.DIVIDENDS_INFORM_EXPECTED: // 分红预算  
131 - 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) 142 + case event.INFORM_DIVIDENDS_EXPECTED: // 分红预算
  143 + dividendsInformExpectedEvent := domainEvent.(*event.InformDividendsExpected)
  144 + for _, expectedData := range dividendsInformExpectedEvent.DividendsExpectedInformData {
  145 + data, err6 := messageServiceGateway.InformDividendsExpected(
  146 + expectedData.CreationContractId,
  147 + expectedData.CreationContractName,
  148 + expectedData.CreationContractNumber,
  149 + expectedData.CreationProjectId,
  150 + expectedData.CreationProjectName,
  151 + expectedData.CreationProjectNumber,
  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 }
154 break 169 break
155 } 170 }
@@ -163,6 +178,6 @@ func (subscriber *MessageServiceSubscriber) SubscribedToEventTypes() []string { @@ -163,6 +178,6 @@ func (subscriber *MessageServiceSubscriber) SubscribedToEventTypes() []string {
163 event.COOPERATION_APPLICATION_REJECTED, // 拒绝共创申请 178 event.COOPERATION_APPLICATION_REJECTED, // 拒绝共创申请
164 event.CREDIT_ACCOUNT_PAID, // 账期支付 179 event.CREDIT_ACCOUNT_PAID, // 账期支付
165 event.DIVIDENDS_ESTIMATED, // 账期结算 180 event.DIVIDENDS_ESTIMATED, // 账期结算
166 - event.DIVIDENDS_INFORM_EXPECTED, // 分红预算 181 + event.INFORM_DIVIDENDS_EXPECTED, // 分红预算
167 } 182 }
168 } 183 }
@@ -71,3 +71,39 @@ func CreateRejectContractApplicationService(options map[string]interface{}) (*do @@ -71,3 +71,39 @@ 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 + //var transactionContext *pgTransaction.TransactionContext
  77 + //if value, ok := options["transactionContext"]; ok {
  78 + // transactionContext = value.(*pgTransaction.TransactionContext)
  79 + //}
  80 + //return domain_service.NewInformJoinCreationContractService(transactionContext)
  81 + return domain_service.NewInformJoinCreationContractService(nil)
  82 +}
  83 +
  84 +func CreateEstimateDividendsService(options map[string]interface{}) (*domain_service.EstimateDividendsService, error) {
  85 + //var transactionContext *pgTransaction.TransactionContext
  86 + //if value, ok := options["transactionContext"]; ok {
  87 + // transactionContext = value.(*pgTransaction.TransactionContext)
  88 + //}
  89 + //return domain_service.NewEstimateDividendsService(transactionContext)
  90 + return domain_service.NewEstimateDividendsService(nil)
  91 +}
  92 +
  93 +func CreateInformDividendsExpectedService(options map[string]interface{}) (*domain_service.InformDividendsExpectedService, error) {
  94 + //var transactionContext *pgTransaction.TransactionContext
  95 + //if value, ok := options["transactionContext"]; ok {
  96 + // transactionContext = value.(*pgTransaction.TransactionContext)
  97 + //}
  98 + //return domain_service.NewInformDividendsExpectedService(transactionContext)
  99 + return domain_service.NewInformDividendsExpectedService(nil)
  100 +}
  101 +
  102 +func CreatePayCreditAccountService(options map[string]interface{}) (*domain_service.PayCreditAccountService, error) {
  103 + //var transactionContext *pgTransaction.TransactionContext
  104 + //if value, ok := options["transactionContext"]; ok {
  105 + // transactionContext = value.(*pgTransaction.TransactionContext)
  106 + //}
  107 + //return domain_service.NewPayCreditAccountService(transactionContext)
  108 + return domain_service.NewPayCreditAccountService(nil)
  109 +}
@@ -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,18 +4,15 @@ import coreDomain "github.com/linmadan/egglib-go/core/domain" @@ -4,18 +4,15 @@ 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 // 结算金额
12 SettlementAmount string `json:"settlementAmount"` 11 SettlementAmount string `json:"settlementAmount"`
  12 + // 实际支付金额
  13 + ActuallyPaidAmount string `json:"actuallyPaidAmount"`
13 // 账期结算单ID 14 // 账期结算单ID
14 CreditAccountId int64 `json:"creditAccountId"` 15 CreditAccountId int64 `json:"creditAccountId"`
15 - // 分红预算单ID  
16 - DividendsEstimateId int64 `json:"dividendsEstimateId"`  
17 - // 分红预算单编号  
18 - DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`  
19 // 申请人ID 16 // 申请人ID
20 UserId int64 `json:"userId"` 17 UserId int64 `json:"userId"`
21 // 申请人基础ID 18 // 申请人基础ID
@@ -26,6 +23,11 @@ type CreditAccountPaid struct { @@ -26,6 +23,11 @@ type CreditAccountPaid struct {
26 CompanyId int64 `json:"companyId"` 23 CompanyId int64 `json:"companyId"`
27 } 24 }
28 25
  26 +type CreditAccountPaid struct {
  27 + coreDomain.BaseEvent
  28 + CreditAccountPaidData []CreditAccountPaidData `json:"creditAccountPaidData"`
  29 +}
  30 +
29 func (event *CreditAccountPaid) EventType() string { 31 func (event *CreditAccountPaid) EventType() string {
30 return CREDIT_ACCOUNT_PAID 32 return CREDIT_ACCOUNT_PAID
31 } 33 }
@@ -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 }
@@ -2,10 +2,9 @@ package event @@ -2,10 +2,9 @@ package event
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 -const DIVIDENDS_INFORM_EXPECTED = "dividends-inform-expected" 5 +const INFORM_DIVIDENDS_EXPECTED = "inform-dividends-expected"
6 6
7 -type DividendsInformExpected struct {  
8 - coreDomain.BaseEvent 7 +type DividendsExpectedInformData struct {
9 // 共创合约ID 8 // 共创合约ID
10 CreationContractId int64 `json:"creationContractId"` 9 CreationContractId int64 `json:"creationContractId"`
11 // 共创合约名称 10 // 共创合约名称
@@ -16,6 +15,8 @@ type DividendsInformExpected struct { @@ -16,6 +15,8 @@ type DividendsInformExpected struct {
16 CreationProjectId int64 `json:"creationProjectId"` 15 CreationProjectId int64 `json:"creationProjectId"`
17 // 共创项目名称 16 // 共创项目名称
18 CreationProjectName string `json:"creationProjectName"` 17 CreationProjectName string `json:"creationProjectName"`
  18 + // 共创项目编号
  19 + CreationProjectNumber string `json:"creationProjectNumber"`
19 // 产品名称 20 // 产品名称
20 ProductName string `json:"productName"` 21 ProductName string `json:"productName"`
21 // 申请人ID 22 // 申请人ID
@@ -32,6 +33,11 @@ type DividendsInformExpected struct { @@ -32,6 +33,11 @@ type DividendsInformExpected struct {
32 DividendsAmount string `json:"dividendsAmount"` 33 DividendsAmount string `json:"dividendsAmount"`
33 } 34 }
34 35
35 -func (event *DividendsInformExpected) EventType() string {  
36 - return DIVIDENDS_ESTIMATED 36 +type InformDividendsExpected struct {
  37 + coreDomain.BaseEvent
  38 + DividendsExpectedInformData []DividendsExpectedInformData `json:"dividendsExpectedInformData"`
  39 +}
  40 +
  41 +func (event *InformDividendsExpected) EventType() string {
  42 + return INFORM_DIVIDENDS_EXPECTED
37 } 43 }
@@ -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 EstimateData struct {
  6 + CreditAccountOrderNum string
  7 + SettlementAmount string
  8 + CreditAccountId int64
  9 + DividendsEstimateId int64
  10 + DividendsEstimateOrderNumber string
  11 + UserId int64
  12 + UserBaseId int64
  13 + OrgId int64
  14 + CompanyId int64
  15 +}
  16 +
  17 +type EstimateDividendsService interface {
  18 + coreDomain.DomainEventPublisher
  19 + Estimate([]EstimateData) error
  20 +}
  1 +package service
  2 +
  3 +import coreDomain "github.com/linmadan/egglib-go/core/domain"
  4 +
  5 +type ExpectedData struct {
  6 + CreationContractId int64
  7 + CreationContractName string
  8 + CreationContractNumber string
  9 + CreationProjectId int64
  10 + CreationProjectName string
  11 + CreationProjectNumber string
  12 + ProductName string
  13 + UserId int64
  14 + UserBaseId int64
  15 + OrgId int64
  16 + CompanyId int64
  17 + DividendsEstimateId int64
  18 + DividendsAmount string
  19 +}
  20 +
  21 +type InformDividendsExpectedService interface {
  22 + coreDomain.DomainEventPublisher
  23 + Expect([]ExpectedData) error
  24 +}
  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 +}
  1 +package service
  2 +
  3 +import coreDomain "github.com/linmadan/egglib-go/core/domain"
  4 +
  5 +type PayData struct {
  6 + CreditAccountOrderNum string
  7 + SettlementAmount string
  8 + ActuallyPaidAmount string
  9 + CreditAccountId int64
  10 + UserId int64
  11 + UserBaseId int64
  12 + OrgId int64
  13 + CompanyId int64
  14 +}
  15 +
  16 +type PayCreditAccountService interface {
  17 + coreDomain.DomainEventPublisher
  18 + Pay([]PayData) error
  19 +}
@@ -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,20 @@ type AgreeContractApplicationService struct { @@ -11,15 +12,20 @@ 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 +// 同意申请
  16 +func (service *AgreeContractApplicationService) Agree(data []service.AgreeData) error {
15 cooperationApplicationAgreedEvent := new(event.CooperationApplicationAgreed) 17 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 18 + for _, cooperationApplicationAgreedData := range data {
  19 + cooperationApplicationAgreedEvent.CooperationApplicationAgreedData = append(cooperationApplicationAgreedEvent.CooperationApplicationAgreedData, event.CooperationApplicationAgreedData{
  20 + CreationProjectId: cooperationApplicationAgreedData.CreationProjectId,
  21 + CreationProjectName: cooperationApplicationAgreedData.CreationProjectName,
  22 + CreationProjectNumber: cooperationApplicationAgreedData.CreationProjectNumber,
  23 + UserId: cooperationApplicationAgreedData.UserId,
  24 + UserBaseId: cooperationApplicationAgreedData.UserBaseId,
  25 + OrgId: cooperationApplicationAgreedData.OrgId,
  26 + CompanyId: cooperationApplicationAgreedData.CompanyId,
  27 + })
  28 + }
23 if err := service.Publish(cooperationApplicationAgreedEvent); err != nil { 29 if err := service.Publish(cooperationApplicationAgreedEvent); err != nil {
24 return err 30 return err
25 } 31 }
  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 EstimateDividendsService struct {
  11 + coreDomain.BaseEventPublisher
  12 + //transactionContext *pgTransaction.TransactionContext
  13 +}
  14 +
  15 +// 账期结算
  16 +func (service *EstimateDividendsService) Estimate(data []service.EstimateData) error {
  17 + dividendsEstimatedEvent := new(event.DividendsEstimated)
  18 + for _, dividendsEstimatedData := range data {
  19 + dividendsEstimatedEvent.DividendsEstimatedData = append(dividendsEstimatedEvent.DividendsEstimatedData, event.DividendsEstimatedData{
  20 + CreditAccountOrderNum: dividendsEstimatedData.CreditAccountOrderNum,
  21 + SettlementAmount: dividendsEstimatedData.SettlementAmount,
  22 + CreditAccountId: dividendsEstimatedData.CreditAccountId,
  23 + DividendsEstimateId: dividendsEstimatedData.DividendsEstimateId,
  24 + DividendsEstimateOrderNumber: dividendsEstimatedData.DividendsEstimateOrderNumber,
  25 + UserId: dividendsEstimatedData.UserId,
  26 + UserBaseId: dividendsEstimatedData.UserBaseId,
  27 + OrgId: dividendsEstimatedData.OrgId,
  28 + CompanyId: dividendsEstimatedData.CompanyId,
  29 + })
  30 + }
  31 + if err := service.Publish(dividendsEstimatedEvent); err != nil {
  32 + return err
  33 + }
  34 + return nil
  35 +}
  36 +
  37 +func NewEstimateDividendsService(transactionContext *pgTransaction.TransactionContext) (*EstimateDividendsService, error) {
  38 + //if transactionContext == nil {
  39 + // return nil, fmt.Errorf("transactionContext参数不能为nil")
  40 + //} else {
  41 + // return &EstimateDividendsService{
  42 + // transactionContext: transactionContext,
  43 + // }, nil
  44 + //}
  45 + return &EstimateDividendsService{}, nil
  46 +}
  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 InformDividendsExpectedService struct {
  11 + coreDomain.BaseEventPublisher
  12 + //transactionContext *pgTransaction.TransactionContext
  13 +}
  14 +
  15 +// 分红预算
  16 +func (service *InformDividendsExpectedService) Expect(data []service.ExpectedData) error {
  17 + dividendsExpectedInformEvent := new(event.InformDividendsExpected)
  18 + for _, dividendsExpectedInformedData := range data {
  19 + dividendsExpectedInformEvent.DividendsExpectedInformData = append(dividendsExpectedInformEvent.DividendsExpectedInformData, event.DividendsExpectedInformData{
  20 + CreationContractId: dividendsExpectedInformedData.CreationContractId,
  21 + CreationContractName: dividendsExpectedInformedData.CreationContractName,
  22 + CreationContractNumber: dividendsExpectedInformedData.CreationContractNumber,
  23 + CreationProjectId: dividendsExpectedInformedData.CreationProjectId,
  24 + CreationProjectName: dividendsExpectedInformedData.CreationProjectName,
  25 + CreationProjectNumber: dividendsExpectedInformedData.CreationProjectNumber,
  26 + ProductName: dividendsExpectedInformedData.ProductName,
  27 + UserId: dividendsExpectedInformedData.UserId,
  28 + UserBaseId: dividendsExpectedInformedData.UserBaseId,
  29 + OrgId: dividendsExpectedInformedData.OrgId,
  30 + CompanyId: dividendsExpectedInformedData.CompanyId,
  31 + DividendsEstimateId: dividendsExpectedInformedData.DividendsEstimateId,
  32 + DividendsAmount: dividendsExpectedInformedData.DividendsAmount,
  33 + })
  34 + }
  35 + if err := service.Publish(dividendsExpectedInformEvent); err != nil {
  36 + return err
  37 + }
  38 + return nil
  39 +}
  40 +
  41 +func NewInformDividendsExpectedService(transactionContext *pgTransaction.TransactionContext) (*InformDividendsExpectedService, error) {
  42 + //if transactionContext == nil {
  43 + // return nil, fmt.Errorf("transactionContext参数不能为nil")
  44 + //} else {
  45 + // return &InformDividendsExpectedService{
  46 + // transactionContext: transactionContext,
  47 + // }, nil
  48 + //}
  49 + return &InformDividendsExpectedService{}, nil
  50 +}
  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 +// 承接人加入共创
  15 +func (service *InformJoinCreationContractService) Join(data []service.JoinData) error {
  16 + creationContractInformJointEvent := new(event.CreationContractInformJoint)
  17 + for _, creationContractInformJointData := range data {
  18 + creationContractInformJointEvent.CreationContractInformJointData = append(creationContractInformJointEvent.CreationContractInformJointData, event.CreationContractInformJointData{
  19 + CreationContractId: creationContractInformJointData.CreationContractId,
  20 + CreationContractName: creationContractInformJointData.CreationContractName,
  21 + CreationContractNumber: creationContractInformJointData.CreationContractNumber,
  22 + CreationProjectId: creationContractInformJointData.CreationProjectId,
  23 + CreationProjectNumber: creationContractInformJointData.CreationProjectNumber,
  24 + CreationProjectName: creationContractInformJointData.CreationProjectName,
  25 + UserId: creationContractInformJointData.UserId,
  26 + UserBaseId: creationContractInformJointData.UserBaseId,
  27 + OrgId: creationContractInformJointData.OrgId,
  28 + CompanyId: creationContractInformJointData.CompanyId,
  29 + })
  30 + }
  31 + if err := service.Publish(creationContractInformJointEvent); err != nil {
  32 + return err
  33 + }
  34 + return nil
  35 +}
  36 +
  37 +func NewInformJoinCreationContractService(transactionContext *pgTransaction.TransactionContext) (*InformJoinCreationContractService, error) {
  38 + //if transactionContext == nil {
  39 + // return nil, fmt.Errorf("transactionContext参数不能为nil")
  40 + //} else {
  41 + // return &InformJoinCreationContractService{
  42 + // transactionContext: transactionContext,
  43 + // }, nil
  44 + //}
  45 + return &InformJoinCreationContractService{}, nil
  46 +}
  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 PayCreditAccountService struct {
  11 + coreDomain.BaseEventPublisher
  12 + //transactionContext *pgTransaction.TransactionContext
  13 +}
  14 +
  15 +// 账期支付
  16 +func (service *PayCreditAccountService) Pay(data []service.PayData) error {
  17 + creditAccountPaidEvent := new(event.CreditAccountPaid)
  18 + for _, creditAccountPaidData := range data {
  19 + creditAccountPaidEvent.CreditAccountPaidData = append(creditAccountPaidEvent.CreditAccountPaidData, event.CreditAccountPaidData{
  20 + CreditAccountOrderNum: creditAccountPaidData.CreditAccountOrderNum,
  21 + SettlementAmount: creditAccountPaidData.SettlementAmount,
  22 + CreditAccountId: creditAccountPaidData.CreditAccountId,
  23 + UserId: creditAccountPaidData.UserId,
  24 + UserBaseId: creditAccountPaidData.UserBaseId,
  25 + OrgId: creditAccountPaidData.OrgId,
  26 + CompanyId: creditAccountPaidData.CompanyId,
  27 + })
  28 + }
  29 + if err := service.Publish(creditAccountPaidEvent); err != nil {
  30 + return err
  31 + }
  32 + return nil
  33 +}
  34 +
  35 +func NewPayCreditAccountService(transactionContext *pgTransaction.TransactionContext) (*PayCreditAccountService, error) {
  36 + //if transactionContext == nil {
  37 + // return nil, fmt.Errorf("transactionContext参数不能为nil")
  38 + //} else {
  39 + // return &PayCreditAccountService{
  40 + // transactionContext: transactionContext,
  41 + // }, nil
  42 + //}
  43 + return &PayCreditAccountService{}, nil
  44 +}
@@ -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,20 @@ type RejectContractApplicationService struct { @@ -11,15 +12,20 @@ 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 +// 拒绝申请
  16 +func (service *RejectContractApplicationService) Reject(data []service.RejectData) error {
15 cooperationApplicationRejectedEvent := new(event.CooperationApplicationRejected) 17 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 18 + for _, cooperationApplicationRejectedData := range data {
  19 + cooperationApplicationRejectedEvent.CooperationApplicationRejectedData = append(cooperationApplicationRejectedEvent.CooperationApplicationRejectedData, event.CooperationApplicationRejectedData{
  20 + CreationProjectId: cooperationApplicationRejectedData.CreationProjectId,
  21 + CreationProjectName: cooperationApplicationRejectedData.CreationProjectName,
  22 + CreationProjectNumber: cooperationApplicationRejectedData.CreationProjectNumber,
  23 + UserId: cooperationApplicationRejectedData.UserId,
  24 + UserBaseId: cooperationApplicationRejectedData.UserBaseId,
  25 + OrgId: cooperationApplicationRejectedData.OrgId,
  26 + CompanyId: cooperationApplicationRejectedData.CompanyId,
  27 + })
  28 + }
23 if err := service.Publish(cooperationApplicationRejectedEvent); err != nil { 29 if err := service.Publish(cooperationApplicationRejectedEvent); err != nil {
24 return err 30 return err
25 } 31 }
@@ -259,6 +259,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -259,6 +259,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
259 if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" { 259 if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" {
260 query.Where("cooperation_project_number ilike ?", fmt.Sprintf("%%%s%%", cooperationProjectNumber)) 260 query.Where("cooperation_project_number ilike ?", fmt.Sprintf("%%%s%%", cooperationProjectNumber))
261 } 261 }
  262 + if cooperationProjectNumbers, ok := queryOptions["cooperationProjectNumbers"]; ok && len(cooperationProjectNumbers.([]string)) != 0 {
  263 + query.Where("cooperation_project_number in (?)", pg.In(cooperationProjectNumbers))
  264 + }
262 if keyword, ok := queryOptions["keyword"]; ok && keyword != "" { 265 if keyword, ok := queryOptions["keyword"]; ok && keyword != "" {
263 query.Where("cooperation_project_description like ?", fmt.Sprintf("%%%s%%", keyword)) 266 query.Where("cooperation_project_description like ?", fmt.Sprintf("%%%s%%", keyword))
264 } 267 }
@@ -76,36 +76,32 @@ func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication( @@ -76,36 +76,32 @@ func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication(
76 return data, err 76 return data, err
77 } 77 }
78 78
79 -// InformExpectedDividends 分红预算消息  
80 -func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends( 79 +// InformJoinCreationContract 确认共创
  80 +func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract(
81 creationContractId int64, 81 creationContractId int64,
82 creationContractName string, 82 creationContractName string,
83 creationContractNumber string, 83 creationContractNumber string,
84 creationProjectId int64, 84 creationProjectId int64,
  85 + creationProjectNumber string,
85 creationProjectName string, 86 creationProjectName string,
86 - productName string,  
87 userId int64, 87 userId int64,
88 userBaseId int64, 88 userBaseId int64,
89 orgId int64, 89 orgId int64,
90 companyId int64, 90 companyId int64,
91 - dividendsEstimateId int64,  
92 - dividendsAmount string,  
93 ) (map[string]interface{}, error) { 91 ) (map[string]interface{}, error) {
94 - url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/") 92 + url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/")
95 request := serviceGateway.createRequest(url, "post") 93 request := serviceGateway.createRequest(url, "post")
96 options := make(map[string]interface{}) 94 options := make(map[string]interface{})
97 options["creationContractId"] = creationContractId 95 options["creationContractId"] = creationContractId
98 options["creationContractName"] = creationContractName 96 options["creationContractName"] = creationContractName
99 options["creationContractNumber"] = creationContractNumber 97 options["creationContractNumber"] = creationContractNumber
100 options["creationProjectId"] = creationProjectId 98 options["creationProjectId"] = creationProjectId
  99 + options["creationProjectNumber"] = creationProjectNumber
101 options["creationProjectName"] = creationProjectName 100 options["creationProjectName"] = creationProjectName
102 - options["productName"] = productName  
103 options["userId"] = userId 101 options["userId"] = userId
104 options["userBaseId"] = userBaseId 102 options["userBaseId"] = userBaseId
105 options["orgId"] = orgId 103 options["orgId"] = orgId
106 options["companyId"] = companyId 104 options["companyId"] = companyId
107 - options["dividendsEstimateId"] = dividendsEstimateId  
108 - options["dividendsAmount"] = dividendsAmount  
109 _, err2 := request.JSONBody(options) 105 _, err2 := request.JSONBody(options)
110 if err2 != nil { 106 if err2 != nil {
111 return nil, err2 107 return nil, err2
@@ -119,19 +115,23 @@ func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends( @@ -119,19 +115,23 @@ func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends(
119 return data, err 115 return data, err
120 } 116 }
121 117
122 -// InformJoinCreationContract 确认共创  
123 -func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract( 118 +// InformExpectedDividends 分红预算消息
  119 +func (serviceGateway *HttplibBasicServiceGateway) InformDividendsExpected(
124 creationContractId int64, 120 creationContractId int64,
125 creationContractName string, 121 creationContractName string,
126 creationContractNumber string, 122 creationContractNumber string,
127 creationProjectId int64, 123 creationProjectId int64,
128 creationProjectName string, 124 creationProjectName string,
  125 + creationProjectNumber string,
  126 + productName string,
129 userId int64, 127 userId int64,
130 userBaseId int64, 128 userBaseId int64,
131 orgId int64, 129 orgId int64,
132 companyId int64, 130 companyId int64,
  131 + dividendsEstimateId int64,
  132 + dividendsAmount string,
133 ) (map[string]interface{}, error) { 133 ) (map[string]interface{}, error) {
134 - url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/") 134 + url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/")
135 request := serviceGateway.createRequest(url, "post") 135 request := serviceGateway.createRequest(url, "post")
136 options := make(map[string]interface{}) 136 options := make(map[string]interface{})
137 options["creationContractId"] = creationContractId 137 options["creationContractId"] = creationContractId
@@ -139,10 +139,14 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract( @@ -139,10 +139,14 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract(
139 options["creationContractNumber"] = creationContractNumber 139 options["creationContractNumber"] = creationContractNumber
140 options["creationProjectId"] = creationProjectId 140 options["creationProjectId"] = creationProjectId
141 options["creationProjectName"] = creationProjectName 141 options["creationProjectName"] = creationProjectName
  142 + options["creationProjectNumber"] = creationProjectNumber
  143 + options["productName"] = productName
142 options["userId"] = userId 144 options["userId"] = userId
143 options["userBaseId"] = userBaseId 145 options["userBaseId"] = userBaseId
144 options["orgId"] = orgId 146 options["orgId"] = orgId
145 options["companyId"] = companyId 147 options["companyId"] = companyId
  148 + options["dividendsEstimateId"] = dividendsEstimateId
  149 + options["dividendsAmount"] = dividendsAmount
146 _, err2 := request.JSONBody(options) 150 _, err2 := request.JSONBody(options)
147 if err2 != nil { 151 if err2 != nil {
148 return nil, err2 152 return nil, err2
@@ -156,8 +160,8 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract( @@ -156,8 +160,8 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract(
156 return data, err 160 return data, err
157 } 161 }
158 162
159 -// PayCreditAccount 账期支付  
160 -func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount( 163 +// DividendsEstimate 账期结算
  164 +func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate(
161 creditAccountOrderNum string, 165 creditAccountOrderNum string,
162 settlementAmount string, 166 settlementAmount string,
163 creditAccountId int64, 167 creditAccountId int64,
@@ -168,7 +172,7 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount( @@ -168,7 +172,7 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount(
168 orgId int64, 172 orgId int64,
169 companyId int64, 173 companyId int64,
170 ) (map[string]interface{}, error) { 174 ) (map[string]interface{}, error) {
171 - url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/") 175 + url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/")
172 request := serviceGateway.createRequest(url, "post") 176 request := serviceGateway.createRequest(url, "post")
173 options := make(map[string]interface{}) 177 options := make(map[string]interface{})
174 options["creditAccountOrderNum"] = creditAccountOrderNum 178 options["creditAccountOrderNum"] = creditAccountOrderNum
@@ -193,26 +197,24 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount( @@ -193,26 +197,24 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount(
193 return data, err 197 return data, err
194 } 198 }
195 199
196 -// DividendsEstimate 分红预算  
197 -func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate( 200 +// PayCreditAccount 账期支付
  201 +func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount(
198 creditAccountOrderNum string, 202 creditAccountOrderNum string,
199 settlementAmount string, 203 settlementAmount string,
  204 + actuallyPaidAmount string,
200 creditAccountId int64, 205 creditAccountId int64,
201 - dividendsEstimateId int64,  
202 - dividendsEstimateOrderNumber string,  
203 userId int64, 206 userId int64,
204 userBaseId int64, 207 userBaseId int64,
205 orgId int64, 208 orgId int64,
206 companyId int64, 209 companyId int64,
207 ) (map[string]interface{}, error) { 210 ) (map[string]interface{}, error) {
208 - url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/") 211 + url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/")
209 request := serviceGateway.createRequest(url, "post") 212 request := serviceGateway.createRequest(url, "post")
210 options := make(map[string]interface{}) 213 options := make(map[string]interface{})
211 options["creditAccountOrderNum"] = creditAccountOrderNum 214 options["creditAccountOrderNum"] = creditAccountOrderNum
212 options["settlementAmount"] = settlementAmount 215 options["settlementAmount"] = settlementAmount
  216 + options["actuallyPaidAmount"] = actuallyPaidAmount
213 options["creditAccountId"] = creditAccountId 217 options["creditAccountId"] = creditAccountId
214 - options["dividendsEstimateId"] = dividendsEstimateId  
215 - options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber  
216 options["userId"] = userId 218 options["userId"] = userId
217 options["userBaseId"] = userBaseId 219 options["userBaseId"] = userBaseId
218 options["orgId"] = orgId 220 options["orgId"] = orgId
@@ -15,8 +15,8 @@ type UserServiceGateway interface { @@ -15,8 +15,8 @@ type UserServiceGateway interface {
15 type BasicServiceGateway interface { 15 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)  
19 - InformJoinCreationContract(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, 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) 18 + InformDividendsExpected(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, creationProjectNumber 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, creationProjectNumber string, creationProjectName string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
  20 + PayCreditAccount(creditAccountOrderNum string, settlementAmount string, actuallyPaidAmount string, creditAccountId int64, 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 }