正在显示
14 个修改的文件
包含
495 行增加
和
37 行删除
| @@ -295,7 +295,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | @@ -295,7 +295,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | ||
| 295 | 295 | ||
| 296 | // 校验共创申请是否已经审核过 | 296 | // 校验共创申请是否已经审核过 |
| 297 | if cooperationApplication.CooperationApplicationStatus != 1 { | 297 | if cooperationApplication.CooperationApplicationStatus != 1 { |
| 298 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "改申请已经审核过") | 298 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "该申请已经审核过") |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | if approvalCooperationApplicationCommand.Action == 1 { | 301 | if approvalCooperationApplicationCommand.Action == 1 { |
| @@ -464,7 +464,7 @@ func (cooperationApplicationService *CooperationApplicationService) OneClickAppr | @@ -464,7 +464,7 @@ func (cooperationApplicationService *CooperationApplicationService) OneClickAppr | ||
| 464 | for i, cooperationApplication := range cooperationApplications { | 464 | for i, cooperationApplication := range cooperationApplications { |
| 465 | // 校验共创申请是否已经审核过 | 465 | // 校验共创申请是否已经审核过 |
| 466 | if cooperationApplication.CooperationApplicationStatus != 1 { | 466 | if cooperationApplication.CooperationApplicationStatus != 1 { |
| 467 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "改申请已经审核过") | 467 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "该申请已经审核过") |
| 468 | } | 468 | } |
| 469 | // 更新共创申请 | 469 | // 更新共创申请 |
| 470 | if oneClickApprovalCooperationApplicationCommand.Action == 1 { | 470 | if oneClickApprovalCooperationApplicationCommand.Action == 1 { |
| @@ -3,6 +3,9 @@ package subscriber | @@ -3,6 +3,9 @@ package subscriber | ||
| 3 | import ( | 3 | 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/application/factory" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/event" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log" | ||
| 6 | ) | 9 | ) |
| 7 | 10 | ||
| 8 | type MessageServiceSubscriber struct { | 11 | type MessageServiceSubscriber struct { |
| @@ -10,11 +13,157 @@ type MessageServiceSubscriber struct { | @@ -10,11 +13,157 @@ type MessageServiceSubscriber struct { | ||
| 10 | } | 13 | } |
| 11 | 14 | ||
| 12 | func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.DomainEvent) error { | 15 | func (subscriber *MessageServiceSubscriber) HandleEvent(domainEvent coreDomain.DomainEvent) error { |
| 16 | + // 消息推送服务 | ||
| 17 | + messageServiceGateway, err := factory.CreateMessageServiceGateway(nil) | ||
| 18 | + if err != nil { | ||
| 19 | + log.Logger.Error("消息推送服务初始化", map[string]interface{}{ | ||
| 20 | + "err": err.Error(), | ||
| 21 | + }) | ||
| 22 | + return nil | ||
| 23 | + } | ||
| 24 | + switch domainEvent.EventType() { | ||
| 25 | + case event.COOPERATION_APPLICATION_AGREED: // 共创申请审核通过 | ||
| 26 | + cooperationApplicationAgreedEvent := domainEvent.(*event.CooperationApplicationAgreed) | ||
| 27 | + data, err1 := messageServiceGateway.AgreeCooperationApplication( | ||
| 28 | + cooperationApplicationAgreedEvent.CreationProjectId, | ||
| 29 | + cooperationApplicationAgreedEvent.CreationProjectName, | ||
| 30 | + cooperationApplicationAgreedEvent.CreationProjectNumber, | ||
| 31 | + cooperationApplicationAgreedEvent.UserId, | ||
| 32 | + cooperationApplicationAgreedEvent.UserBaseId, | ||
| 33 | + cooperationApplicationAgreedEvent.OrgId, | ||
| 34 | + cooperationApplicationAgreedEvent.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 | + } | ||
| 44 | + break | ||
| 45 | + case event.CREATION_CONTRACT_INFORM_JOINT: // 共创确认 | ||
| 46 | + creationContractInformJointEvent := domainEvent.(*event.CreationContractInformJoint) | ||
| 47 | + data, err2 := messageServiceGateway.InformJoinCreationContract( | ||
| 48 | + creationContractInformJointEvent.CreationContractId, | ||
| 49 | + creationContractInformJointEvent.CreationContractName, | ||
| 50 | + creationContractInformJointEvent.CreationContractNumber, | ||
| 51 | + creationContractInformJointEvent.CreationProjectId, | ||
| 52 | + creationContractInformJointEvent.CreationProjectName, | ||
| 53 | + creationContractInformJointEvent.UserId, | ||
| 54 | + creationContractInformJointEvent.UserBaseId, | ||
| 55 | + creationContractInformJointEvent.OrgId, | ||
| 56 | + creationContractInformJointEvent.CompanyId, | ||
| 57 | + ) | ||
| 58 | + if err2 != nil { | ||
| 59 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
| 60 | + "err": err2.Error(), | ||
| 61 | + }) | ||
| 62 | + return nil | ||
| 63 | + } else { | ||
| 64 | + log.Logger.Info("推送数据返回", data) | ||
| 65 | + } | ||
| 66 | + break | ||
| 67 | + case event.COOPERATION_APPLICATION_REJECTED: // 共创申请审核拒绝 | ||
| 68 | + cooperationApplicationRejectedEvent := domainEvent.(*event.CooperationApplicationRejected) | ||
| 69 | + data, err3 := messageServiceGateway.RejectCooperationApplication( | ||
| 70 | + cooperationApplicationRejectedEvent.CreationProjectId, | ||
| 71 | + cooperationApplicationRejectedEvent.CreationProjectName, | ||
| 72 | + cooperationApplicationRejectedEvent.CreationProjectNumber, | ||
| 73 | + cooperationApplicationRejectedEvent.UserId, | ||
| 74 | + cooperationApplicationRejectedEvent.UserBaseId, | ||
| 75 | + cooperationApplicationRejectedEvent.OrgId, | ||
| 76 | + cooperationApplicationRejectedEvent.CompanyId, | ||
| 77 | + ) | ||
| 78 | + if err3 != nil { | ||
| 79 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
| 80 | + "err": err3.Error(), | ||
| 81 | + }) | ||
| 82 | + return nil | ||
| 83 | + } else { | ||
| 84 | + log.Logger.Info("推送数据返回", data) | ||
| 85 | + } | ||
| 86 | + break | ||
| 87 | + case event.CREDIT_ACCOUNT_PAID: // 账期结算支付 | ||
| 88 | + creditAccountPaidEvent := domainEvent.(*event.CreditAccountPaid) | ||
| 89 | + data, err4 := messageServiceGateway.PayCreditAccount( | ||
| 90 | + creditAccountPaidEvent.CreditAccountOrderNum, | ||
| 91 | + creditAccountPaidEvent.SettlementAmount, | ||
| 92 | + creditAccountPaidEvent.CreditAccountId, | ||
| 93 | + creditAccountPaidEvent.DividendsEstimateId, | ||
| 94 | + creditAccountPaidEvent.DividendsEstimateOrderNumber, | ||
| 95 | + creditAccountPaidEvent.UserId, | ||
| 96 | + creditAccountPaidEvent.UserBaseId, | ||
| 97 | + creditAccountPaidEvent.OrgId, | ||
| 98 | + creditAccountPaidEvent.CompanyId, | ||
| 99 | + ) | ||
| 100 | + if err4 != nil { | ||
| 101 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
| 102 | + "err": err4.Error(), | ||
| 103 | + }) | ||
| 104 | + return nil | ||
| 105 | + } else { | ||
| 106 | + log.Logger.Info("推送数据返回", data) | ||
| 107 | + } | ||
| 108 | + break | ||
| 109 | + case event.DIVIDENDS_ESTIMATED: // 账期结算 | ||
| 110 | + dividendsEstimatedEvent := domainEvent.(*event.DividendsEstimated) | ||
| 111 | + data, err5 := messageServiceGateway.DividendsEstimate( | ||
| 112 | + dividendsEstimatedEvent.CreditAccountOrderNum, | ||
| 113 | + dividendsEstimatedEvent.SettlementAmount, | ||
| 114 | + dividendsEstimatedEvent.CreditAccountId, | ||
| 115 | + dividendsEstimatedEvent.DividendsEstimateId, | ||
| 116 | + dividendsEstimatedEvent.DividendsEstimateOrderNumber, | ||
| 117 | + dividendsEstimatedEvent.UserId, | ||
| 118 | + dividendsEstimatedEvent.UserBaseId, | ||
| 119 | + dividendsEstimatedEvent.OrgId, | ||
| 120 | + dividendsEstimatedEvent.CompanyId, | ||
| 121 | + ) | ||
| 122 | + if err5 != nil { | ||
| 123 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
| 124 | + "err": err5.Error(), | ||
| 125 | + }) | ||
| 126 | + return nil | ||
| 127 | + } else { | ||
| 128 | + log.Logger.Info("推送数据返回", data) | ||
| 129 | + } | ||
| 130 | + break | ||
| 131 | + case event.DIVIDENDS_INFORM_EXPECTED: // 分红预算 | ||
| 132 | + dividendsInformExpectedEvent := domainEvent.(*event.DividendsInformExpected) | ||
| 133 | + data, err6 := messageServiceGateway.InformExpectedDividends( | ||
| 134 | + dividendsInformExpectedEvent.CreationContractId, | ||
| 135 | + dividendsInformExpectedEvent.CreationContractName, | ||
| 136 | + dividendsInformExpectedEvent.CreationContractNumber, | ||
| 137 | + dividendsInformExpectedEvent.CreationProjectId, | ||
| 138 | + dividendsInformExpectedEvent.CreationProjectName, | ||
| 139 | + dividendsInformExpectedEvent.ProductName, | ||
| 140 | + dividendsInformExpectedEvent.UserId, | ||
| 141 | + dividendsInformExpectedEvent.UserBaseId, | ||
| 142 | + dividendsInformExpectedEvent.OrgId, | ||
| 143 | + dividendsInformExpectedEvent.CompanyId, | ||
| 144 | + dividendsInformExpectedEvent.DividendsEstimateId, | ||
| 145 | + dividendsInformExpectedEvent.DividendsAmount, | ||
| 146 | + ) | ||
| 147 | + if err6 != nil { | ||
| 148 | + log.Logger.Error("推送消息错误", map[string]interface{}{ | ||
| 149 | + "err": err6.Error(), | ||
| 150 | + }) | ||
| 151 | + return nil | ||
| 152 | + } else { | ||
| 153 | + log.Logger.Info("推送数据返回", data) | ||
| 154 | + } | ||
| 155 | + break | ||
| 156 | + } | ||
| 13 | return nil | 157 | return nil |
| 14 | } | 158 | } |
| 15 | 159 | ||
| 16 | func (subscriber *MessageServiceSubscriber) SubscribedToEventTypes() []string { | 160 | func (subscriber *MessageServiceSubscriber) SubscribedToEventTypes() []string { |
| 17 | return []string{ | 161 | return []string{ |
| 18 | - //event.CONFERENCE_MESSAGE, // 日程预约消息通知 | 162 | + event.COOPERATION_APPLICATION_AGREED, // 同意共创申请 |
| 163 | + event.CREATION_CONTRACT_INFORM_JOINT, // 确认共创 | ||
| 164 | + event.COOPERATION_APPLICATION_REJECTED, // 拒绝共创申请 | ||
| 165 | + event.CREDIT_ACCOUNT_PAID, // 账期支付 | ||
| 166 | + event.DIVIDENDS_ESTIMATED, // 账期结算 | ||
| 167 | + event.DIVIDENDS_INFORM_EXPECTED, // 分红预算 | ||
| 19 | } | 168 | } |
| 20 | } | 169 | } |
| 1 | +package event | ||
| 2 | + | ||
| 3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
| 4 | + | ||
| 5 | +const COOPERATION_APPLICATION_AGREED = "=cooperation-application-agreed" | ||
| 6 | + | ||
| 7 | +type CooperationApplicationAgreed struct { | ||
| 8 | + coreDomain.BaseEvent | ||
| 9 | + // 共创项目ID | ||
| 10 | + CreationProjectId int64 `json:"creationProjectId"` | ||
| 11 | + // 共创项目名称 | ||
| 12 | + CreationProjectName string `json:"creationProjectName"` | ||
| 13 | + // 共创项目编号 | ||
| 14 | + CreationProjectNumber string `json:"creationProjectNumber"` | ||
| 15 | + // 申请人ID | ||
| 16 | + UserId int64 `json:"userId"` | ||
| 17 | + // 申请人基础ID | ||
| 18 | + UserBaseId int64 `json:"userBaseId"` | ||
| 19 | + // 组织机构ID | ||
| 20 | + OrgId int64 `json:"orgId"` | ||
| 21 | + // 公司ID | ||
| 22 | + CompanyId int64 `json:"companyId"` | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func (event *CooperationApplicationAgreed) EventType() string { | ||
| 26 | + return COOPERATION_APPLICATION_AGREED | ||
| 27 | +} |
| 1 | +package event | ||
| 2 | + | ||
| 3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
| 4 | + | ||
| 5 | +const COOPERATION_APPLICATION_REJECTED = "cooperation-application-rejected" | ||
| 6 | + | ||
| 7 | +type CooperationApplicationRejected struct { | ||
| 8 | + coreDomain.BaseEvent | ||
| 9 | + // 共创项目ID | ||
| 10 | + CreationProjectId int64 `json:"creationProjectId"` | ||
| 11 | + // 共创项目名称 | ||
| 12 | + CreationProjectName string `json:"creationProjectName"` | ||
| 13 | + // 共创项目编号 | ||
| 14 | + CreationProjectNumber string `json:"creationProjectNumber"` | ||
| 15 | + // 申请人ID | ||
| 16 | + UserId int64 `json:"userId"` | ||
| 17 | + // 申请人基础ID | ||
| 18 | + UserBaseId int64 `json:"userBaseId"` | ||
| 19 | + // 组织机构ID | ||
| 20 | + OrgId int64 `json:"orgId"` | ||
| 21 | + // 公司ID | ||
| 22 | + CompanyId int64 `json:"companyId"` | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func (event *CooperationApplicationRejected) EventType() string { | ||
| 26 | + return COOPERATION_APPLICATION_REJECTED | ||
| 27 | +} |
| 1 | +package event | ||
| 2 | + | ||
| 3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
| 4 | + | ||
| 5 | +const CREATION_CONTRACT_INFORM_JOINT = "creation-contract-inform-joint" | ||
| 6 | + | ||
| 7 | +type CreationContractInformJoint struct { | ||
| 8 | + coreDomain.BaseEvent | ||
| 9 | + // 共创合约ID | ||
| 10 | + CreationContractId int64 `json:"creationContractId"` | ||
| 11 | + // 共创合约名称 | ||
| 12 | + CreationContractName string `json:"creationContractName"` | ||
| 13 | + // 共创合约编号 | ||
| 14 | + CreationContractNumber string `json:"creationContractNumber"` | ||
| 15 | + // 共创项目ID | ||
| 16 | + CreationProjectId int64 `json:"creationProjectId"` | ||
| 17 | + // 共创项目名称 | ||
| 18 | + CreationProjectName string `json:"creationProjectName"` | ||
| 19 | + // 申请人ID | ||
| 20 | + UserId int64 `json:"userId"` | ||
| 21 | + // 申请人基础ID | ||
| 22 | + UserBaseId int64 `json:"userBaseId"` | ||
| 23 | + // 组织机构ID | ||
| 24 | + OrgId int64 `json:"orgId"` | ||
| 25 | + // 公司ID | ||
| 26 | + CompanyId int64 `json:"companyId"` | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (event *CreationContractInformJoint) EventType() string { | ||
| 30 | + return CREATION_CONTRACT_INFORM_JOINT | ||
| 31 | +} |
pkg/domain/event/creditAccountPaid.go
0 → 100644
| 1 | +package event | ||
| 2 | + | ||
| 3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
| 4 | + | ||
| 5 | +const CREDIT_ACCOUNT_PAID = "credit-account-paid" | ||
| 6 | + | ||
| 7 | +type CreditAccountPaid struct { | ||
| 8 | + coreDomain.BaseEvent | ||
| 9 | + // 账期结算单编号 | ||
| 10 | + CreditAccountOrderNum string `json:"creditAccountOrderNum"` | ||
| 11 | + // 结算金额 | ||
| 12 | + SettlementAmount string `json:"settlementAmount"` | ||
| 13 | + // 账期结算单ID | ||
| 14 | + CreditAccountId int64 `json:"creditAccountId"` | ||
| 15 | + // 分红预算单ID | ||
| 16 | + DividendsEstimateId int64 `json:"dividendsEstimateId"` | ||
| 17 | + // 分红预算单编号 | ||
| 18 | + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` | ||
| 19 | + // 申请人ID | ||
| 20 | + UserId int64 `json:"userId"` | ||
| 21 | + // 申请人基础ID | ||
| 22 | + UserBaseId int64 `json:"userBaseId"` | ||
| 23 | + // 组织机构ID | ||
| 24 | + OrgId int64 `json:"orgId"` | ||
| 25 | + // 公司ID | ||
| 26 | + CompanyId int64 `json:"companyId"` | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (event *CreditAccountPaid) EventType() string { | ||
| 30 | + return CREDIT_ACCOUNT_PAID | ||
| 31 | +} |
pkg/domain/event/dividendsEstimated.go
0 → 100644
| 1 | +package event | ||
| 2 | + | ||
| 3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
| 4 | + | ||
| 5 | +const DIVIDENDS_ESTIMATED = "dividends-estimated" | ||
| 6 | + | ||
| 7 | +type DividendsEstimated struct { | ||
| 8 | + coreDomain.BaseEvent | ||
| 9 | + // 账期结算单编号 | ||
| 10 | + CreditAccountOrderNum string `json:"creditAccountOrderNum"` | ||
| 11 | + // 结算金额 | ||
| 12 | + SettlementAmount string `json:"settlementAmount"` | ||
| 13 | + // 账期结算单ID | ||
| 14 | + CreditAccountId int64 `json:"creditAccountId"` | ||
| 15 | + // 分红预算单ID | ||
| 16 | + DividendsEstimateId int64 `json:"dividendsEstimateId"` | ||
| 17 | + // 分红预算单编号 | ||
| 18 | + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` | ||
| 19 | + // 申请人ID | ||
| 20 | + UserId int64 `json:"userId"` | ||
| 21 | + // 申请人基础ID | ||
| 22 | + UserBaseId int64 `json:"userBaseId"` | ||
| 23 | + // 组织机构ID | ||
| 24 | + OrgId int64 `json:"orgId"` | ||
| 25 | + // 公司ID | ||
| 26 | + CompanyId int64 `json:"companyId"` | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (event *DividendsEstimated) EventType() string { | ||
| 30 | + return DIVIDENDS_ESTIMATED | ||
| 31 | +} |
pkg/domain/event/dividendsInformExpected.go
0 → 100644
| 1 | +package event | ||
| 2 | + | ||
| 3 | +import coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
| 4 | + | ||
| 5 | +const DIVIDENDS_INFORM_EXPECTED = "dividends-inform-expected" | ||
| 6 | + | ||
| 7 | +type DividendsInformExpected struct { | ||
| 8 | + coreDomain.BaseEvent | ||
| 9 | + // 共创合约ID | ||
| 10 | + CreationContractId int64 `json:"creationContractId"` | ||
| 11 | + // 共创合约名称 | ||
| 12 | + CreationContractName string `json:"creationContractName"` | ||
| 13 | + // 共创合约编号 | ||
| 14 | + CreationContractNumber string `json:"creationContractNumber"` | ||
| 15 | + // 共创项目ID | ||
| 16 | + CreationProjectId int64 `json:"creationProjectId"` | ||
| 17 | + // 共创项目名称 | ||
| 18 | + CreationProjectName string `json:"creationProjectName"` | ||
| 19 | + // 产品名称 | ||
| 20 | + ProductName string `json:"productName"` | ||
| 21 | + // 申请人ID | ||
| 22 | + UserId int64 `json:"userId"` | ||
| 23 | + // 申请人基础ID | ||
| 24 | + UserBaseId int64 `json:"userBaseId"` | ||
| 25 | + // 组织机构ID | ||
| 26 | + OrgId int64 `json:"orgId"` | ||
| 27 | + // 公司ID | ||
| 28 | + CompanyId int64 `json:"companyId"` | ||
| 29 | + // 分红预算单ID | ||
| 30 | + DividendsEstimateId int64 `json:"dividendsEstimateId"` | ||
| 31 | + // 分红金额 | ||
| 32 | + DividendsAmount string `json:"dividendsAmount"` | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +func (event *DividendsInformExpected) EventType() string { | ||
| 36 | + return DIVIDENDS_ESTIMATED | ||
| 37 | +} |
| @@ -178,7 +178,7 @@ func (service *UserService) VisitorFrom(companyId int64, orgId int64, userBaseId | @@ -178,7 +178,7 @@ func (service *UserService) VisitorFrom(companyId int64, orgId int64, userBaseId | ||
| 178 | if userAdaptor, err := adaptor.NewUserAdaptor(); err != nil { | 178 | if userAdaptor, err := adaptor.NewUserAdaptor(); err != nil { |
| 179 | return nil, err | 179 | return nil, err |
| 180 | } else { | 180 | } else { |
| 181 | - if visitor, err := userAdaptor.ToParticipator(companyId, orgId, userBaseId, "Visitor"); err != nil { | 181 | + if visitor, err := userAdaptor.ToVisitor(companyId, orgId, userBaseId); err != nil { |
| 182 | return nil, err | 182 | return nil, err |
| 183 | } else { | 183 | } else { |
| 184 | if visitor != nil { | 184 | if visitor != nil { |
| @@ -65,6 +65,23 @@ func (adaptor *UserAdaptor) ToParticipator(companyId int64, orgId int64, userId | @@ -65,6 +65,23 @@ func (adaptor *UserAdaptor) ToParticipator(companyId int64, orgId int64, userId | ||
| 65 | return map[string]interface{}{}, nil | 65 | return map[string]interface{}{}, nil |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | +func (adaptor *UserAdaptor) ToVisitor(companyId int64, orgId int64, userBaseId int64) (interface{}, error) { | ||
| 69 | + userServiceGateway := service_gateway.NewHttplibUserServiceGateway() | ||
| 70 | + response, err := userServiceGateway.GetUserInfo(companyId, orgId, userBaseId) | ||
| 71 | + if err != nil { | ||
| 72 | + return map[string]interface{}{}, err | ||
| 73 | + } | ||
| 74 | + if userTranslator, err := translator.NewUserTranslator(); err != nil { | ||
| 75 | + return map[string]interface{}{}, err | ||
| 76 | + } else { | ||
| 77 | + visitor, err := userTranslator.ToVisitorFromRepresentation(response) | ||
| 78 | + if err != nil { | ||
| 79 | + return map[string]interface{}{}, nil | ||
| 80 | + } | ||
| 81 | + return visitor, nil | ||
| 82 | + } | ||
| 83 | +} | ||
| 84 | + | ||
| 68 | func NewUserAdaptor() (*UserAdaptor, error) { | 85 | func NewUserAdaptor() (*UserAdaptor, error) { |
| 69 | return &UserAdaptor{}, nil | 86 | return &UserAdaptor{}, nil |
| 70 | } | 87 | } |
| @@ -11,14 +11,25 @@ type HttplibBasicServiceGateway struct { | @@ -11,14 +11,25 @@ type HttplibBasicServiceGateway struct { | ||
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // AgreeCooperationApplication 同意共创申请 | 13 | // AgreeCooperationApplication 同意共创申请 |
| 14 | -func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() (map[string]interface{}, error) { | 14 | +func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication( |
| 15 | + creationProjectId int64, | ||
| 16 | + creationProjectName string, | ||
| 17 | + creationProjectNumber string, | ||
| 18 | + userId int64, | ||
| 19 | + userBaseId int64, | ||
| 20 | + orgId int64, | ||
| 21 | + companyId int64, | ||
| 22 | +) (map[string]interface{}, error) { | ||
| 15 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/agree-join-creation-project"}, "/") | 23 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/agree-join-creation-project"}, "/") |
| 16 | request := serviceGateway.createRequest(url, "post") | 24 | request := serviceGateway.createRequest(url, "post") |
| 17 | - request.Header("companyId", "") | ||
| 18 | - request.Header("userId", "") | ||
| 19 | - request.Header("orgId", "") | ||
| 20 | - request.Header("userBasic", "") | ||
| 21 | - options := map[string]interface{}{} | 25 | + options := make(map[string]interface{}) |
| 26 | + options["creationProjectId"] = creationProjectId | ||
| 27 | + options["creationProjectName"] = creationProjectName | ||
| 28 | + options["creationProjectNumber"] = creationProjectNumber | ||
| 29 | + options["userId"] = userId | ||
| 30 | + options["userBaseId"] = userBaseId | ||
| 31 | + options["orgId"] = orgId | ||
| 32 | + options["companyId"] = companyId | ||
| 22 | _, err := request.JSONBody(options) | 33 | _, err := request.JSONBody(options) |
| 23 | if err != nil { | 34 | if err != nil { |
| 24 | return nil, err | 35 | return nil, err |
| @@ -33,14 +44,25 @@ func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() | @@ -33,14 +44,25 @@ func (serviceGateway *HttplibBasicServiceGateway) AgreeCooperationApplication() | ||
| 33 | } | 44 | } |
| 34 | 45 | ||
| 35 | // RejectCooperationApplication 拒绝共创申请 | 46 | // RejectCooperationApplication 拒绝共创申请 |
| 36 | -func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() (map[string]interface{}, error) { | 47 | +func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication( |
| 48 | + creationProjectId int64, | ||
| 49 | + creationProjectName string, | ||
| 50 | + creationProjectNumber string, | ||
| 51 | + userId int64, | ||
| 52 | + userBaseId int64, | ||
| 53 | + orgId int64, | ||
| 54 | + companyId int64, | ||
| 55 | +) (map[string]interface{}, error) { | ||
| 37 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/refuse-join-creation-project"}, "/") | 56 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/refuse-join-creation-project"}, "/") |
| 38 | request := serviceGateway.createRequest(url, "post") | 57 | request := serviceGateway.createRequest(url, "post") |
| 39 | - request.Header("companyId", "") | ||
| 40 | - request.Header("userId", "") | ||
| 41 | - request.Header("orgId", "") | ||
| 42 | - request.Header("userBasic", "") | ||
| 43 | options := make(map[string]interface{}) | 58 | options := make(map[string]interface{}) |
| 59 | + options["creationProjectId"] = creationProjectId | ||
| 60 | + options["creationProjectName"] = creationProjectName | ||
| 61 | + options["creationProjectNumber"] = creationProjectNumber | ||
| 62 | + options["userId"] = userId | ||
| 63 | + options["userBaseId"] = userBaseId | ||
| 64 | + options["orgId"] = orgId | ||
| 65 | + options["companyId"] = companyId | ||
| 44 | _, err2 := request.JSONBody(options) | 66 | _, err2 := request.JSONBody(options) |
| 45 | if err2 != nil { | 67 | if err2 != nil { |
| 46 | return nil, err2 | 68 | return nil, err2 |
| @@ -55,14 +77,35 @@ func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() | @@ -55,14 +77,35 @@ func (serviceGateway *HttplibBasicServiceGateway) RejectCooperationApplication() | ||
| 55 | } | 77 | } |
| 56 | 78 | ||
| 57 | // InformExpectedDividends 分红预算消息 | 79 | // InformExpectedDividends 分红预算消息 |
| 58 | -func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map[string]interface{}, error) { | 80 | +func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends( |
| 81 | + creationContractId int64, | ||
| 82 | + creationContractName string, | ||
| 83 | + creationContractNumber string, | ||
| 84 | + creationProjectId int64, | ||
| 85 | + creationProjectName string, | ||
| 86 | + productName string, | ||
| 87 | + userId int64, | ||
| 88 | + userBaseId int64, | ||
| 89 | + orgId int64, | ||
| 90 | + companyId int64, | ||
| 91 | + dividendsEstimateId int64, | ||
| 92 | + dividendsAmount string, | ||
| 93 | +) (map[string]interface{}, error) { | ||
| 59 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/") | 94 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-expected-dividends"}, "/") |
| 60 | request := serviceGateway.createRequest(url, "post") | 95 | request := serviceGateway.createRequest(url, "post") |
| 61 | - request.Header("companyId", "") | ||
| 62 | - request.Header("userId", "") | ||
| 63 | - request.Header("orgId", "") | ||
| 64 | - request.Header("userBasic", "") | ||
| 65 | options := make(map[string]interface{}) | 96 | options := make(map[string]interface{}) |
| 97 | + options["creationContractId"] = creationContractId | ||
| 98 | + options["creationContractName"] = creationContractName | ||
| 99 | + options["creationContractNumber"] = creationContractNumber | ||
| 100 | + options["creationProjectId"] = creationProjectId | ||
| 101 | + options["creationProjectName"] = creationProjectName | ||
| 102 | + options["productName"] = productName | ||
| 103 | + options["userId"] = userId | ||
| 104 | + options["userBaseId"] = userBaseId | ||
| 105 | + options["orgId"] = orgId | ||
| 106 | + options["companyId"] = companyId | ||
| 107 | + options["dividendsEstimateId"] = dividendsEstimateId | ||
| 108 | + options["dividendsAmount"] = dividendsAmount | ||
| 66 | _, err2 := request.JSONBody(options) | 109 | _, err2 := request.JSONBody(options) |
| 67 | if err2 != nil { | 110 | if err2 != nil { |
| 68 | return nil, err2 | 111 | return nil, err2 |
| @@ -77,10 +120,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map | @@ -77,10 +120,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformExpectedDividends() (map | ||
| 77 | } | 120 | } |
| 78 | 121 | ||
| 79 | // InformJoinCreationContract 确认共创 | 122 | // InformJoinCreationContract 确认共创 |
| 80 | -func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() (map[string]interface{}, error) { | 123 | +func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract( |
| 124 | + creationContractId int64, | ||
| 125 | + creationContractName string, | ||
| 126 | + creationContractNumber string, | ||
| 127 | + creationProjectId int64, | ||
| 128 | + creationProjectName string, | ||
| 129 | + userId int64, | ||
| 130 | + userBaseId int64, | ||
| 131 | + orgId int64, | ||
| 132 | + companyId int64, | ||
| 133 | +) (map[string]interface{}, error) { | ||
| 81 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/") | 134 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/inform-join-creation-contract"}, "/") |
| 82 | request := serviceGateway.createRequest(url, "post") | 135 | request := serviceGateway.createRequest(url, "post") |
| 83 | options := make(map[string]interface{}) | 136 | options := make(map[string]interface{}) |
| 137 | + options["creationContractId"] = creationContractId | ||
| 138 | + options["creationContractName"] = creationContractName | ||
| 139 | + options["creationContractNumber"] = creationContractNumber | ||
| 140 | + options["creationProjectId"] = creationProjectId | ||
| 141 | + options["creationProjectName"] = creationProjectName | ||
| 142 | + options["userId"] = userId | ||
| 143 | + options["userBaseId"] = userBaseId | ||
| 144 | + options["orgId"] = orgId | ||
| 145 | + options["companyId"] = companyId | ||
| 84 | _, err2 := request.JSONBody(options) | 146 | _, err2 := request.JSONBody(options) |
| 85 | if err2 != nil { | 147 | if err2 != nil { |
| 86 | return nil, err2 | 148 | return nil, err2 |
| @@ -95,14 +157,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() ( | @@ -95,14 +157,29 @@ func (serviceGateway *HttplibBasicServiceGateway) InformJoinCreationContract() ( | ||
| 95 | } | 157 | } |
| 96 | 158 | ||
| 97 | // PayCreditAccount 账期支付 | 159 | // PayCreditAccount 账期支付 |
| 98 | -func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string]interface{}, error) { | 160 | +func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount( |
| 161 | + creditAccountOrderNum string, | ||
| 162 | + settlementAmount string, | ||
| 163 | + creditAccountId int64, | ||
| 164 | + dividendsEstimateId int64, | ||
| 165 | + dividendsEstimateOrderNumber string, | ||
| 166 | + userId int64, | ||
| 167 | + userBaseId int64, | ||
| 168 | + orgId int64, | ||
| 169 | + companyId int64, | ||
| 170 | +) (map[string]interface{}, error) { | ||
| 99 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/") | 171 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/notice-personal/credit-account/payment"}, "/") |
| 100 | request := serviceGateway.createRequest(url, "post") | 172 | request := serviceGateway.createRequest(url, "post") |
| 101 | - request.Header("companyId", "") | ||
| 102 | - request.Header("userId", "") | ||
| 103 | - request.Header("orgId", "") | ||
| 104 | - request.Header("userBasic", "") | ||
| 105 | options := make(map[string]interface{}) | 173 | options := make(map[string]interface{}) |
| 174 | + options["creditAccountOrderNum"] = creditAccountOrderNum | ||
| 175 | + options["settlementAmount"] = settlementAmount | ||
| 176 | + options["creditAccountId"] = creditAccountId | ||
| 177 | + options["dividendsEstimateId"] = dividendsEstimateId | ||
| 178 | + options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber | ||
| 179 | + options["userId"] = userId | ||
| 180 | + options["userBaseId"] = userBaseId | ||
| 181 | + options["orgId"] = orgId | ||
| 182 | + options["companyId"] = companyId | ||
| 106 | _, err2 := request.JSONBody(options) | 183 | _, err2 := request.JSONBody(options) |
| 107 | if err2 != nil { | 184 | if err2 != nil { |
| 108 | return nil, err2 | 185 | return nil, err2 |
| @@ -117,14 +194,29 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string | @@ -117,14 +194,29 @@ func (serviceGateway *HttplibBasicServiceGateway) PayCreditAccount() (map[string | ||
| 117 | } | 194 | } |
| 118 | 195 | ||
| 119 | // DividendsEstimate 分红预算 | 196 | // DividendsEstimate 分红预算 |
| 120 | -func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate() (map[string]interface{}, error) { | 197 | +func (serviceGateway *HttplibBasicServiceGateway) DividendsEstimate( |
| 198 | + creditAccountOrderNum string, | ||
| 199 | + settlementAmount string, | ||
| 200 | + creditAccountId int64, | ||
| 201 | + dividendsEstimateId int64, | ||
| 202 | + dividendsEstimateOrderNumber string, | ||
| 203 | + userId int64, | ||
| 204 | + userBaseId int64, | ||
| 205 | + orgId int64, | ||
| 206 | + companyId int64, | ||
| 207 | +) (map[string]interface{}, error) { | ||
| 121 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/") | 208 | url := strings.Join([]string{serviceGateway.baseURL, "notice-personal/credit-account/dividends-estimate"}, "/") |
| 122 | request := serviceGateway.createRequest(url, "post") | 209 | request := serviceGateway.createRequest(url, "post") |
| 123 | - request.Header("companyId", "") | ||
| 124 | - request.Header("userId", "") | ||
| 125 | - request.Header("orgId", "") | ||
| 126 | - request.Header("userBasic", "") | ||
| 127 | options := make(map[string]interface{}) | 210 | options := make(map[string]interface{}) |
| 211 | + options["creditAccountOrderNum"] = creditAccountOrderNum | ||
| 212 | + options["settlementAmount"] = settlementAmount | ||
| 213 | + options["creditAccountId"] = creditAccountId | ||
| 214 | + options["dividendsEstimateId"] = dividendsEstimateId | ||
| 215 | + options["dividendsEstimateOrderNumber"] = dividendsEstimateOrderNumber | ||
| 216 | + options["userId"] = userId | ||
| 217 | + options["userBaseId"] = userBaseId | ||
| 218 | + options["orgId"] = orgId | ||
| 219 | + options["companyId"] = companyId | ||
| 128 | _, err2 := request.JSONBody(options) | 220 | _, err2 := request.JSONBody(options) |
| 129 | if err2 != nil { | 221 | if err2 != nil { |
| 130 | return nil, err2 | 222 | return nil, err2 |
| @@ -13,10 +13,10 @@ type UserServiceGateway interface { | @@ -13,10 +13,10 @@ type UserServiceGateway interface { | ||
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | type BasicServiceGateway interface { | 15 | type BasicServiceGateway interface { |
| 16 | - AgreeCooperationApplication() (map[string]interface{}, error) | ||
| 17 | - RejectCooperationApplication() (map[string]interface{}, error) | ||
| 18 | - InformExpectedDividends() (map[string]interface{}, error) | ||
| 19 | - InformJoinCreationContract() (map[string]interface{}, error) | ||
| 20 | - PayCreditAccount() (map[string]interface{}, error) | ||
| 21 | - DividendsEstimate() (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) | ||
| 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) | ||
| 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 | } |
-
请 注册 或 登录 后发表评论