正在显示
4 个修改的文件
包含
19 行增加
和
3 行删除
@@ -145,6 +145,10 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -145,6 +145,10 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | + log.Logger.Info("查询到的合约", map[string]interface{}{ | ||
149 | + "cooperationContractsMap": cooperationContractsMap, | ||
150 | + }) | ||
151 | + | ||
148 | // 订单时间转换 | 152 | // 订单时间转换 |
149 | orderTimeInt, err := strconv.ParseInt(createDividendsOrderCommand.OrderTime, 10, 64) | 153 | orderTimeInt, err := strconv.ParseInt(createDividendsOrderCommand.OrderTime, 10, 64) |
150 | if err != nil { | 154 | if err != nil { |
@@ -163,9 +167,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -163,9 +167,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
163 | ruleMatchedFlag := false | 167 | ruleMatchedFlag := false |
164 | if orderGood.CooperationContractNumber != "" { | 168 | if orderGood.CooperationContractNumber != "" { |
165 | // 校验共创合约激励类型是否正确 | 169 | // 校验共创合约激励类型是否正确 |
166 | - if cooperationContractsMap[orderGood.CooperationContractNumber] != nil && cooperationContractsMap[orderGood.CooperationContractNumber].IncentivesType != 1 { | 170 | + if cooperationContractsMap[orderGood.CooperationContractNumber] != nil { |
171 | + if cooperationContractsMap[orderGood.CooperationContractNumber].IncentivesType != 1 { | ||
167 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单产品不能关联金额激励规则") | 172 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单产品不能关联金额激励规则") |
168 | } | 173 | } |
174 | + } else { | ||
175 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") | ||
176 | + } | ||
177 | + | ||
169 | // 校验产品关联合约的激励规则是否匹配订单时间 | 178 | // 校验产品关联合约的激励规则是否匹配订单时间 |
170 | if cooperationContractsMap[orderGood.CooperationContractNumber] != nil { | 179 | if cooperationContractsMap[orderGood.CooperationContractNumber] != nil { |
171 | for _, incentivesRule := range cooperationContractsMap[orderGood.CooperationContractNumber].DividendsIncentivesRules { | 180 | for _, incentivesRule := range cooperationContractsMap[orderGood.CooperationContractNumber].DividendsIncentivesRules { |
@@ -44,7 +44,7 @@ type DividendsEstimate struct { | @@ -44,7 +44,7 @@ type DividendsEstimate struct { | ||
44 | // 操作时间 | 44 | // 操作时间 |
45 | OperateTime time.Time `comment:"操作时间"` | 45 | OperateTime time.Time `comment:"操作时间"` |
46 | // 取消状态 | 46 | // 取消状态 |
47 | - IsCanceled bool `comment:"取消状态" pg:",use_zero,default:false"` | 47 | + IsCanceled bool `comment:"取消状态" pg:",use_zero"` |
48 | // 产品ID | 48 | // 产品ID |
49 | OrderGoodId int64 `comment:"产品ID"` | 49 | OrderGoodId int64 `comment:"产品ID"` |
50 | // 创建时间 | 50 | // 创建时间 |
@@ -48,6 +48,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -48,6 +48,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
48 | "created_at", | 48 | "created_at", |
49 | "deleted_at", | 49 | "deleted_at", |
50 | "updated_at", | 50 | "updated_at", |
51 | + "cooperation_contract_undertaker_id", | ||
51 | } | 52 | } |
52 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 53 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
53 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) | 54 | insertPlaceHoldersSnippet := sqlbuilder.SqlPlaceHoldersSnippet(sqlBuildFields) |
@@ -86,6 +87,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -86,6 +87,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
86 | ÷ndsEstimate.CreatedAt, | 87 | ÷ndsEstimate.CreatedAt, |
87 | ÷ndsEstimate.DeletedAt, | 88 | ÷ndsEstimate.DeletedAt, |
88 | ÷ndsEstimate.UpdatedAt, | 89 | ÷ndsEstimate.UpdatedAt, |
90 | + ÷ndsEstimate.CooperationContractUndertakerId, | ||
89 | ), | 91 | ), |
90 | fmt.Sprintf("INSERT INTO dividends_estimates (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 92 | fmt.Sprintf("INSERT INTO dividends_estimates (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
91 | dividendsEstimate.DividendsEstimateId, | 93 | dividendsEstimate.DividendsEstimateId, |
@@ -110,6 +112,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -110,6 +112,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
110 | dividendsEstimate.CreatedAt, | 112 | dividendsEstimate.CreatedAt, |
111 | nil, | 113 | nil, |
112 | dividendsEstimate.UpdatedAt, | 114 | dividendsEstimate.UpdatedAt, |
115 | + dividendsEstimate.CooperationContractUndertakerId, | ||
113 | ); err != nil { | 116 | ); err != nil { |
114 | return dividendsEstimate, err | 117 | return dividendsEstimate, err |
115 | } | 118 | } |
@@ -138,6 +141,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -138,6 +141,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
138 | ÷ndsEstimate.CreatedAt, | 141 | ÷ndsEstimate.CreatedAt, |
139 | ÷ndsEstimate.DeletedAt, | 142 | ÷ndsEstimate.DeletedAt, |
140 | ÷ndsEstimate.UpdatedAt, | 143 | ÷ndsEstimate.UpdatedAt, |
144 | + ÷ndsEstimate.CooperationContractUndertakerId, | ||
141 | ), | 145 | ), |
142 | fmt.Sprintf("UPDATE dividends_estimates SET %s WHERE dividends_estimate_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 146 | fmt.Sprintf("UPDATE dividends_estimates SET %s WHERE dividends_estimate_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
143 | dividendsEstimate.DividendsEstimateId, | 147 | dividendsEstimate.DividendsEstimateId, |
@@ -162,6 +166,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -162,6 +166,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
162 | dividendsEstimate.CreatedAt, | 166 | dividendsEstimate.CreatedAt, |
163 | nil, | 167 | nil, |
164 | dividendsEstimate.UpdatedAt, | 168 | dividendsEstimate.UpdatedAt, |
169 | + dividendsEstimate.CooperationContractUndertakerId, | ||
165 | dividendsEstimate.Identify(), | 170 | dividendsEstimate.Identify(), |
166 | ); err != nil { | 171 | ); err != nil { |
167 | return dividendsEstimate, err | 172 | return dividendsEstimate, err |
@@ -205,6 +210,7 @@ func (repository *DividendsEstimateRepository) SaveMany(dividendsEstimates []*do | @@ -205,6 +210,7 @@ func (repository *DividendsEstimateRepository) SaveMany(dividendsEstimates []*do | ||
205 | CreatedAt: dividendsEstimate.CreatedAt, | 210 | CreatedAt: dividendsEstimate.CreatedAt, |
206 | DeletedAt: dividendsEstimate.DeletedAt, | 211 | DeletedAt: dividendsEstimate.DeletedAt, |
207 | UpdatedAt: dividendsEstimate.UpdatedAt, | 212 | UpdatedAt: dividendsEstimate.UpdatedAt, |
213 | + CooperationContractUndertakerId: dividendsEstimate.CooperationContractUndertakerId, | ||
208 | }) | 214 | }) |
209 | } | 215 | } |
210 | if len(dividendsEstimateModels) > 0 { | 216 | if len(dividendsEstimateModels) > 0 { |
@@ -251,6 +257,7 @@ func (repository *DividendsEstimateRepository) UpdateMany(dividendsEstimates []* | @@ -251,6 +257,7 @@ func (repository *DividendsEstimateRepository) UpdateMany(dividendsEstimates []* | ||
251 | CreatedAt: dividendsEstimate.CreatedAt, | 257 | CreatedAt: dividendsEstimate.CreatedAt, |
252 | DeletedAt: dividendsEstimate.DeletedAt, | 258 | DeletedAt: dividendsEstimate.DeletedAt, |
253 | UpdatedAt: time.Now(), | 259 | UpdatedAt: time.Now(), |
260 | + CooperationContractUndertakerId: dividendsEstimate.CooperationContractUndertakerId, | ||
254 | }) | 261 | }) |
255 | } | 262 | } |
256 | if _, err := tx.Model(÷ndsEstimateModels).WherePK().Update(); err != nil { | 263 | if _, err := tx.Model(÷ndsEstimateModels).WherePK().Update(); err != nil { |
@@ -45,7 +45,7 @@ func (serviceGateway *httplibBaseServiceGateway) createRequest(url string, metho | @@ -45,7 +45,7 @@ func (serviceGateway *httplibBaseServiceGateway) createRequest(url string, metho | ||
45 | case "head": | 45 | case "head": |
46 | request = httplib.Head(url) | 46 | request = httplib.Head(url) |
47 | break | 47 | break |
48 | - default: | 48 | + : |
49 | request = httplib.Get(url) | 49 | request = httplib.Get(url) |
50 | } | 50 | } |
51 | return request.SetTimeout(serviceGateway.connectTimeout, serviceGateway.readWriteTimeout) | 51 | return request.SetTimeout(serviceGateway.connectTimeout, serviceGateway.readWriteTimeout) |
-
请 注册 或 登录 后发表评论