作者 陈志颖

fix:修复消息推送参数

@@ -249,6 +249,9 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred @@ -249,6 +249,9 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
249 CompanyId: creditAccount.Company.CompanyId, 249 CompanyId: creditAccount.Company.CompanyId,
250 }) 250 })
251 } 251 }
  252 + if err15 := estimateDividendsService.Estimate(accountData); err15 != nil {
  253 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err15.Error())
  254 + }
252 255
253 return creditAccount, nil 256 return creditAccount, nil
254 } 257 }
@@ -450,16 +453,18 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco @@ -450,16 +453,18 @@ func (creditAccountService *CreditAccountService) PayCreditAccount(payCreditAcco
450 // 支付消息推送 453 // 支付消息推送
451 var payData []service.PayData 454 var payData []service.PayData
452 payData = append(payData, service.PayData{ 455 payData = append(payData, service.PayData{
453 - CreditAccountOrderNum: creditAccountSaved.CreditAccountOrderNum,  
454 - SettlementAmount: fmt.Sprint(creditAccountSaved.SettlementAmount),  
455 - CreditAccountId: creditAccountSaved.CreditAccountId,  
456 - DividendsEstimateId: 0,  
457 - DividendsEstimateOrderNumber: "",  
458 - UserId: creditAccountSaved.Participator.UserId,  
459 - UserBaseId: creditAccountSaved.Participator.UserBaseId,  
460 - OrgId: creditAccountSaved.Org.OrgId,  
461 - CompanyId: creditAccountSaved.Company.CompanyId, 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,
462 }) 464 })
  465 + if err5 := payCreditAccountService.Pay(payData); err5 != nil {
  466 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err5.Error())
  467 + }
463 468
464 return creditAccountSaved, nil 469 return creditAccountSaved, nil
465 } 470 }
@@ -1075,6 +1075,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -1075,6 +1075,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
1075 CreationContractNumber: cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationContractNumber, 1075 CreationContractNumber: cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationContractNumber,
1076 CreationProjectId: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectId, 1076 CreationProjectId: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectId,
1077 CreationProjectName: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectName, 1077 CreationProjectName: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectName,
  1078 + CreationProjectNumber: cooperationProjectsMap[cooperationContractsMap[dividendsEstimateSaved.CooperationContractNumber].CooperationProjectNumber].CooperationProjectNumber,
1078 ProductName: orderGoodsMap[dividendsEstimateSaved.OrderGoodId].OrderGoodName, 1079 ProductName: orderGoodsMap[dividendsEstimateSaved.OrderGoodId].OrderGoodName,
1079 UserId: dividendsEstimateSaved.DividendsUser.UserId, 1080 UserId: dividendsEstimateSaved.DividendsUser.UserId,
1080 UserBaseId: dividendsEstimateSaved.DividendsUser.UserBaseId, 1081 UserBaseId: dividendsEstimateSaved.DividendsUser.UserBaseId,
@@ -1316,6 +1317,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives @@ -1316,6 +1317,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives
1316 CreationContractNumber: cooperationContract.CooperationContractNumber, 1317 CreationContractNumber: cooperationContract.CooperationContractNumber,
1317 CreationProjectId: cooperationProject.CooperationProjectId, 1318 CreationProjectId: cooperationProject.CooperationProjectId,
1318 CreationProjectName: cooperationProject.CooperationProjectName, 1319 CreationProjectName: cooperationProject.CooperationProjectName,
  1320 + CreationProjectNumber: cooperationProject.CooperationProjectNumber,
1319 ProductName: "", 1321 ProductName: "",
1320 UserId: dividendsEstimateSaved.DividendsUser.UserId, 1322 UserId: dividendsEstimateSaved.DividendsUser.UserId,
1321 UserBaseId: dividendsEstimateSaved.DividendsUser.UserBaseId, 1323 UserBaseId: dividendsEstimateSaved.DividendsUser.UserBaseId,
@@ -97,9 +97,8 @@ func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.D @@ -97,9 +97,8 @@ func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.D
97 data, err4 := messageServiceGateway.PayCreditAccount( 97 data, err4 := messageServiceGateway.PayCreditAccount(
98 paidData.CreditAccountOrderNum, 98 paidData.CreditAccountOrderNum,
99 paidData.SettlementAmount, 99 paidData.SettlementAmount,
  100 + paidData.ActuallyPaidAmount,
100 paidData.CreditAccountId, 101 paidData.CreditAccountId,
101 - paidData.DividendsEstimateId,  
102 - paidData.DividendsEstimateOrderNumber,  
103 paidData.UserId, 102 paidData.UserId,
104 paidData.UserBaseId, 103 paidData.UserBaseId,
105 paidData.OrgId, 104 paidData.OrgId,
@@ -149,6 +148,7 @@ func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.D @@ -149,6 +148,7 @@ func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.D
149 expectedData.CreationContractNumber, 148 expectedData.CreationContractNumber,
150 expectedData.CreationProjectId, 149 expectedData.CreationProjectId,
151 expectedData.CreationProjectName, 150 expectedData.CreationProjectName,
  151 + expectedData.CreationProjectNumber,
152 expectedData.ProductName, 152 expectedData.ProductName,
153 expectedData.UserId, 153 expectedData.UserId,
154 expectedData.UserBaseId, 154 expectedData.UserBaseId,
@@ -9,12 +9,10 @@ type CreditAccountPaidData struct { @@ -9,12 +9,10 @@ type CreditAccountPaidData struct {
9 CreditAccountOrderNum string `json:"creditAccountOrderNum"` 9 CreditAccountOrderNum string `json:"creditAccountOrderNum"`
10 // 结算金额 10 // 结算金额
11 SettlementAmount string `json:"settlementAmount"` 11 SettlementAmount string `json:"settlementAmount"`
  12 + // 实际支付金额
  13 + ActuallyPaidAmount string `json:"actuallyPaidAmount"`
12 // 账期结算单ID 14 // 账期结算单ID
13 CreditAccountId int64 `json:"creditAccountId"` 15 CreditAccountId int64 `json:"creditAccountId"`
14 - // 分红预算单ID  
15 - DividendsEstimateId int64 `json:"dividendsEstimateId"`  
16 - // 分红预算单编号  
17 - DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`  
18 // 申请人ID 16 // 申请人ID
19 UserId int64 `json:"userId"` 17 UserId int64 `json:"userId"`
20 // 申请人基础ID 18 // 申请人基础ID
@@ -15,6 +15,8 @@ type DividendsExpectedInformData struct { @@ -15,6 +15,8 @@ type DividendsExpectedInformData struct {
15 CreationProjectId int64 `json:"creationProjectId"` 15 CreationProjectId int64 `json:"creationProjectId"`
16 // 共创项目名称 16 // 共创项目名称
17 CreationProjectName string `json:"creationProjectName"` 17 CreationProjectName string `json:"creationProjectName"`
  18 + // 共创项目编号
  19 + CreationProjectNumber string `json:"creationProjectNumber"`
18 // 产品名称 20 // 产品名称
19 ProductName string `json:"productName"` 21 ProductName string `json:"productName"`
20 // 申请人ID 22 // 申请人ID
@@ -8,6 +8,7 @@ type ExpectedData struct { @@ -8,6 +8,7 @@ type ExpectedData struct {
8 CreationContractNumber string 8 CreationContractNumber string
9 CreationProjectId int64 9 CreationProjectId int64
10 CreationProjectName string 10 CreationProjectName string
  11 + CreationProjectNumber string
11 ProductName string 12 ProductName string
12 UserId int64 13 UserId int64
13 UserBaseId int64 14 UserBaseId int64
@@ -3,15 +3,14 @@ package service @@ -3,15 +3,14 @@ package service
3 import coreDomain "github.com/linmadan/egglib-go/core/domain" 3 import coreDomain "github.com/linmadan/egglib-go/core/domain"
4 4
5 type PayData struct { 5 type PayData 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 6 + CreditAccountOrderNum string
  7 + SettlementAmount string
  8 + ActuallyPaidAmount string
  9 + CreditAccountId int64
  10 + UserId int64
  11 + UserBaseId int64
  12 + OrgId int64
  13 + CompanyId int64
15 } 14 }
16 15
17 type PayCreditAccountService interface { 16 type PayCreditAccountService interface {
@@ -22,6 +22,7 @@ func (service *InformDividendsExpectedService) Expect(data []service.ExpectedDat @@ -22,6 +22,7 @@ func (service *InformDividendsExpectedService) Expect(data []service.ExpectedDat
22 CreationContractNumber: dividendsExpectedInformedData.CreationContractNumber, 22 CreationContractNumber: dividendsExpectedInformedData.CreationContractNumber,
23 CreationProjectId: dividendsExpectedInformedData.CreationProjectId, 23 CreationProjectId: dividendsExpectedInformedData.CreationProjectId,
24 CreationProjectName: dividendsExpectedInformedData.CreationProjectName, 24 CreationProjectName: dividendsExpectedInformedData.CreationProjectName,
  25 + CreationProjectNumber: dividendsExpectedInformedData.CreationProjectNumber,
25 ProductName: dividendsExpectedInformedData.ProductName, 26 ProductName: dividendsExpectedInformedData.ProductName,
26 UserId: dividendsExpectedInformedData.UserId, 27 UserId: dividendsExpectedInformedData.UserId,
27 UserBaseId: dividendsExpectedInformedData.UserBaseId, 28 UserBaseId: dividendsExpectedInformedData.UserBaseId,
@@ -17,15 +17,13 @@ func (service *PayCreditAccountService) Pay(data []service.PayData) error { @@ -17,15 +17,13 @@ func (service *PayCreditAccountService) Pay(data []service.PayData) error {
17 creditAccountPaidEvent := new(event.CreditAccountPaid) 17 creditAccountPaidEvent := new(event.CreditAccountPaid)
18 for _, creditAccountPaidData := range data { 18 for _, creditAccountPaidData := range data {
19 creditAccountPaidEvent.CreditAccountPaidData = append(creditAccountPaidEvent.CreditAccountPaidData, event.CreditAccountPaidData{ 19 creditAccountPaidEvent.CreditAccountPaidData = append(creditAccountPaidEvent.CreditAccountPaidData, event.CreditAccountPaidData{
20 - CreditAccountOrderNum: creditAccountPaidData.CreditAccountOrderNum,  
21 - SettlementAmount: creditAccountPaidData.SettlementAmount,  
22 - CreditAccountId: creditAccountPaidData.CreditAccountId,  
23 - DividendsEstimateId: creditAccountPaidData.DividendsEstimateId,  
24 - DividendsEstimateOrderNumber: creditAccountPaidData.DividendsEstimateOrderNumber,  
25 - UserId: creditAccountPaidData.UserId,  
26 - UserBaseId: creditAccountPaidData.UserBaseId,  
27 - OrgId: creditAccountPaidData.OrgId,  
28 - CompanyId: creditAccountPaidData.CompanyId, 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,
29 }) 27 })
30 } 28 }
31 if err := service.Publish(creditAccountPaidEvent); err != nil { 29 if err := service.Publish(creditAccountPaidEvent); err != nil {
@@ -122,6 +122,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformDividendsExpected( @@ -122,6 +122,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformDividendsExpected(
122 creationContractNumber string, 122 creationContractNumber string,
123 creationProjectId int64, 123 creationProjectId int64,
124 creationProjectName string, 124 creationProjectName string,
  125 + creationProjectNumber string,
125 productName string, 126 productName string,
126 userId int64, 127 userId int64,
127 userBaseId int64, 128 userBaseId int64,
@@ -138,6 +139,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformDividendsExpected( @@ -138,6 +139,7 @@ func (serviceGateway *HttplibBasicServiceGateway) InformDividendsExpected(
138 options["creationContractNumber"] = creationContractNumber 139 options["creationContractNumber"] = creationContractNumber
139 options["creationProjectId"] = creationProjectId 140 options["creationProjectId"] = creationProjectId
140 options["creationProjectName"] = creationProjectName 141 options["creationProjectName"] = creationProjectName
  142 + options["creationProjectNumber"] = creationProjectNumber
141 options["productName"] = productName 143 options["productName"] = productName
142 options["userId"] = userId 144 options["userId"] = userId
143 options["userBaseId"] = userBaseId 145 options["userBaseId"] = userBaseId
@@ -199,9 +201,8 @@ func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate( @@ -199,9 +201,8 @@ func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate(
199 func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount( 201 func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount(
200 creditAccountOrderNum string, 202 creditAccountOrderNum string,
201 settlementAmount string, 203 settlementAmount string,
  204 + actuallyPaidAmount string,
202 creditAccountId int64, 205 creditAccountId int64,
203 - dividendsEstimateId int64,  
204 - dividendsEstimateOrderNumber string,  
205 userId int64, 206 userId int64,
206 userBaseId int64, 207 userBaseId int64,
207 orgId int64, 208 orgId int64,
@@ -212,9 +213,8 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount( @@ -212,9 +213,8 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount(
212 options := make(map[string]interface{}) 213 options := make(map[string]interface{})
213 options["creditAccountOrderNum"] = creditAccountOrderNum 214 options["creditAccountOrderNum"] = creditAccountOrderNum
214 options["settlementAmount"] = settlementAmount 215 options["settlementAmount"] = settlementAmount
  216 + options["actuallyPaidAmount"] = actuallyPaidAmount
215 options["creditAccountId"] = creditAccountId 217 options["creditAccountId"] = creditAccountId
216 - options["dividendsEstimateId"] = dividendsEstimateId  
217 - options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber  
218 options["userId"] = userId 218 options["userId"] = userId
219 options["userBaseId"] = userBaseId 219 options["userBaseId"] = userBaseId
220 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 - InformDividendsExpected(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectName string, productName string, userId int64, userBaseId int64, orgId int64, companyId int64, dividendsEstimateId int64, dividendsAmount string) (map[string]interface{}, error) 18 + 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) 19 InformJoinCreationContract(creationContractId int64, creationContractName string, creationContractNumber string, creationProjectId int64, creationProjectNumber string, creationProjectName string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error)
20 - PayCreditAccount(creditAccountOrderNum string, settlementAmount string, creditAccountId int64, dividendsEstimateId int64, dividendsEstimateOrderNumber string, userId int64, userBaseId int64, orgId int64, companyId int64) (map[string]interface{}, error) 20 + PayCreditAccount(creditAccountOrderNum string, settlementAmount string, 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 }