作者 陈志颖

feat:仓储层报错优化

@@ -1303,7 +1303,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1303,7 +1303,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1303 UserPhone: "", 1303 UserPhone: "",
1304 } 1304 }
1305 } 1305 }
1306 - undertakersOriginal = undertakersOriginal + strconv.FormatInt(int64(i), 10) + "(" + undertaker.UserName + "," + undertaker.Referrer.UserName + "," + undertaker.Salesman.UserName + ")" 1306 + undertakersOriginal = undertakersOriginal + strconv.FormatInt(int64(i+1), 10) + "(" + undertaker.UserName + "," + undertaker.Referrer.UserName + "," + undertaker.Salesman.UserName + ")"
1307 } 1307 }
1308 undertakerChangeTmp1 := "【" + undertakersOriginal + "】" 1308 undertakerChangeTmp1 := "【" + undertakersOriginal + "】"
1309 1309
@@ -1340,7 +1340,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1340,7 +1340,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1340 UserPhone: "", 1340 UserPhone: "",
1341 } 1341 }
1342 } 1342 }
1343 - undertakersChanged = undertakersChanged + strconv.FormatInt(int64(i), 10) + "(" + undertaker.UserName + "," + undertaker.Referrer.UserName + "," + undertaker.Salesman.UserName + ")" 1343 + undertakersChanged = undertakersChanged + strconv.FormatInt(int64(i+1), 10) + "(" + undertaker.UserName + "," + undertaker.Referrer.UserName + "," + undertaker.Salesman.UserName + ")"
1344 } 1344 }
1345 undertakerChangeTemp2 := "【" + undertakersChanged + "】" 1345 undertakerChangeTemp2 := "【" + undertakersChanged + "】"
1346 // 拼接承接人变更记录 1346 // 拼接承接人变更记录
@@ -134,7 +134,7 @@ func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map @@ -134,7 +134,7 @@ func (repository *ContractUndertakerFeedbackRepository) FindOne(queryOptions map
134 query.SetWhereByQueryOption("contract_undertaker_feedback.feedback_id = ?", "contractUndertakerFeedbackId") 134 query.SetWhereByQueryOption("contract_undertaker_feedback.feedback_id = ?", "contractUndertakerFeedbackId")
135 if err := query.First(); err != nil { 135 if err := query.First(); err != nil {
136 if err.Error() == "pg: no rows in result set" { 136 if err.Error() == "pg: no rows in result set" {
137 - return nil, fmt.Errorf("没有此资源") 137 + return nil, fmt.Errorf("承接人反馈信息不存在")
138 } else { 138 } else {
139 return nil, err 139 return nil, err
140 } 140 }
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "fmt" 4 "fmt"
5 "github.com/go-pg/pg/v10" 5 "github.com/go-pg/pg/v10"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
7 "time" 8 "time"
8 9
9 "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" 10 "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
@@ -189,7 +190,7 @@ func (repository *CooperationApplicationRepository) FindOne(queryOptions map[str @@ -189,7 +190,7 @@ func (repository *CooperationApplicationRepository) FindOne(queryOptions map[str
189 query.SetWhereByQueryOption("cooperation_application.cooperation_application_id = ?", "cooperationApplicationId") 190 query.SetWhereByQueryOption("cooperation_application.cooperation_application_id = ?", "cooperationApplicationId")
190 if err := query.First(); err != nil { 191 if err := query.First(); err != nil {
191 if err.Error() == "pg: no rows in result set" { 192 if err.Error() == "pg: no rows in result set" {
192 - return nil, fmt.Errorf("没有此资源") 193 + return nil, fmt.Errorf("共创申请不存在")
193 } else { 194 } else {
194 return nil, err 195 return nil, err
195 } 196 }
@@ -200,14 +201,26 @@ func (repository *CooperationApplicationRepository) FindOne(queryOptions map[str @@ -200,14 +201,26 @@ func (repository *CooperationApplicationRepository) FindOne(queryOptions map[str
200 // 获取共创项目 201 // 获取共创项目
201 cooperationProjectModel := new(models.CooperationProject) 202 cooperationProjectModel := new(models.CooperationProject)
202 cooperationProjectQuery := tx.Model(cooperationProjectModel) 203 cooperationProjectQuery := tx.Model(cooperationProjectModel)
203 - if err := cooperationProjectQuery.Where("cooperation_project_number = ?", cooperationApplicationModel.CooperationProjectNumber).First(); err != nil {  
204 - return nil, err 204 + if err := cooperationProjectQuery.
  205 + Where("company->>'companyId' = '?'", cooperationApplicationModel.Company.CompanyId).
  206 + Where("org->>'orgId' = '?'", cooperationApplicationModel.Org.OrgId).
  207 + Where("cooperation_project_number = ?", cooperationApplicationModel.CooperationProjectNumber).First(); err != nil {
  208 + log.Logger.Error("申请关联的共创项目不存在", map[string]interface{}{
  209 + "cooperationApplicationModel": cooperationApplicationModel,
  210 + })
  211 + return nil, fmt.Errorf("申请关联的共创项目不存在")
205 } 212 }
206 // 获取共创模式 213 // 获取共创模式
207 cooperationModeModel := new(models.CooperationMode) 214 cooperationModeModel := new(models.CooperationMode)
208 cooperationModeQuery := tx.Model(cooperationModeModel) 215 cooperationModeQuery := tx.Model(cooperationModeModel)
209 - if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil {  
210 - return nil, err 216 + if err := cooperationModeQuery.
  217 + Where("company->>'companyId' = '?'", cooperationApplicationModel.Company.CompanyId).
  218 + Where("org->>'orgId' = '?'", cooperationApplicationModel.Org.OrgId).
  219 + Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil {
  220 + log.Logger.Error("申请关联的共创模式不存在", map[string]interface{}{
  221 + "cooperationApplicationModel": cooperationApplicationModel,
  222 + })
  223 + return nil, fmt.Errorf("申请关联的共创模式不存在")
211 } 224 }
212 return transform.TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplicationModel, cooperationProjectModel, cooperationModeModel) 225 return transform.TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplicationModel, cooperationProjectModel, cooperationModeModel)
213 } 226 }
@@ -270,7 +283,10 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -270,7 +283,10 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
270 Where("org->>'orgId' = '?'", cooperationApplicationModel.Org.OrgId). 283 Where("org->>'orgId' = '?'", cooperationApplicationModel.Org.OrgId).
271 Where("cooperation_project_number = ?", cooperationApplicationModel.CooperationProjectNumber). 284 Where("cooperation_project_number = ?", cooperationApplicationModel.CooperationProjectNumber).
272 First(); err != nil { 285 First(); err != nil {
273 - return 0, nil, err 286 + log.Logger.Error("申请关联的共创项目不存在", map[string]interface{}{
  287 + "cooperationApplicationModel": cooperationApplicationModel,
  288 + })
  289 + return 0, nil, fmt.Errorf("申请关联的共创项目不存在")
274 } 290 }
275 // 获取共创模式 291 // 获取共创模式
276 cooperationModeModel := new(models.CooperationMode) 292 cooperationModeModel := new(models.CooperationMode)
@@ -280,7 +296,10 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -280,7 +296,10 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
280 Where("org->>'orgId' = '?'", cooperationApplicationModel.Org.OrgId). 296 Where("org->>'orgId' = '?'", cooperationApplicationModel.Org.OrgId).
281 Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber). 297 Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).
282 First(); err != nil { 298 First(); err != nil {
283 - return 0, nil, err 299 + log.Logger.Error("申请关联的共创模式不存在", map[string]interface{}{
  300 + "cooperationApplicationModel": cooperationApplicationModel,
  301 + })
  302 + return 0, nil, fmt.Errorf("申请关联的共创模式不存在")
284 } 303 }
285 if cooperationApplication, err := transform.TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplicationModel, cooperationProjectModel, cooperationModeModel); err != nil { 304 if cooperationApplication, err := transform.TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplicationModel, cooperationProjectModel, cooperationModeModel); err != nil {
286 return 0, cooperationApplications, err 305 return 0, cooperationApplications, err
@@ -139,7 +139,7 @@ func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions m @@ -139,7 +139,7 @@ func (repository *CooperationContractChangeLogRepository) FindOne(queryOptions m
139 query.SetWhereByQueryOption("cooperation_contract_change_log.cooperation_contract_change_log_id = ?", "cooperationContractChangeLogId") 139 query.SetWhereByQueryOption("cooperation_contract_change_log.cooperation_contract_change_log_id = ?", "cooperationContractChangeLogId")
140 if err := query.First(); err != nil { 140 if err := query.First(); err != nil {
141 if err.Error() == "pg: no rows in result set" { 141 if err.Error() == "pg: no rows in result set" {
142 - return nil, fmt.Errorf("没有此资源") 142 + return nil, fmt.Errorf("共创合约变更记录不存在")
143 } else { 143 } else {
144 return nil, err 144 return nil, err
145 } 145 }
@@ -154,7 +154,7 @@ func (repository *CooperationContractRelevantRepository) FindOne(queryOptions ma @@ -154,7 +154,7 @@ func (repository *CooperationContractRelevantRepository) FindOne(queryOptions ma
154 query.SetWhereByQueryOption("cooperation_contract_relevant.cooperation_contract_relevant_id = ?", "cooperationContractRelevantId") 154 query.SetWhereByQueryOption("cooperation_contract_relevant.cooperation_contract_relevant_id = ?", "cooperationContractRelevantId")
155 if err := query.First(); err != nil { 155 if err := query.First(); err != nil {
156 if err.Error() == "pg: no rows in result set" { 156 if err.Error() == "pg: no rows in result set" {
157 - return nil, fmt.Errorf("没有此资源") 157 + return nil, fmt.Errorf("合约相关人不存在")
158 } else { 158 } else {
159 return nil, err 159 return nil, err
160 } 160 }
@@ -1032,7 +1032,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1032,7 +1032,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1032 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). 1032 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
1033 Where("cooperation_mode_number = ?", cooperationContractModel.CooperationModeNumber). 1033 Where("cooperation_mode_number = ?", cooperationContractModel.CooperationModeNumber).
1034 First(); err != nil { 1034 First(); err != nil {
1035 - return 0, nil, err 1035 + return 0, nil, fmt.Errorf("合约关联的共创模式不存在")
1036 } 1036 }
1037 // 获取分红激励规则列表 1037 // 获取分红激励规则列表
1038 var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule 1038 var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule
@@ -1042,7 +1042,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1042,7 +1042,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1042 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). 1042 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
1043 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). 1043 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).
1044 Select(); err != nil { 1044 Select(); err != nil {
1045 - return 0, nil, err 1045 + return 0, nil, fmt.Errorf("合约关联的分红激励规则列表不存在")
1046 } 1046 }
1047 // 获取金额激励规则列表 1047 // 获取金额激励规则列表
1048 var moneyIncentivesRuleModels []*models.MoneyIncentivesRule 1048 var moneyIncentivesRuleModels []*models.MoneyIncentivesRule
@@ -1052,7 +1052,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1052,7 +1052,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1052 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). 1052 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
1053 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). 1053 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).
1054 Select(); err != nil { 1054 Select(); err != nil {
1055 - return 0, nil, err 1055 + return 0, nil, fmt.Errorf("合约关联的金额激励规则列表不存在")
1056 } 1056 }
1057 // 获取承接人列表 1057 // 获取承接人列表
1058 var cooperationContractUndertakerModels []*models.CooperationContractUndertaker 1058 var cooperationContractUndertakerModels []*models.CooperationContractUndertaker
@@ -1062,7 +1062,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1062,7 +1062,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1062 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). 1062 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
1063 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). 1063 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).
1064 Select(); err != nil { 1064 Select(); err != nil {
1065 - return 0, nil, err 1065 + return 0, nil, fmt.Errorf("合约相关的承接人列表不存在")
1066 } 1066 }
1067 // 获取相关人列表 1067 // 获取相关人列表
1068 var cooperationContractRelevantModels []*models.CooperationContractRelevant 1068 var cooperationContractRelevantModels []*models.CooperationContractRelevant
@@ -1072,7 +1072,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1072,7 +1072,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1072 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId). 1072 Where("org->>'orgId' = '?'", cooperationContractModel.Org.OrgId).
1073 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber). 1073 Where("cooperation_contract_number = ?", cooperationContractModel.CooperationContractNumber).
1074 Select(); err != nil { 1074 Select(); err != nil {
1075 - return 0, nil, err 1075 + return 0, nil, fmt.Errorf("合约相关的相关人列表不存在")
1076 } 1076 }
1077 if cooperationContract, err := transform.TransformToCooperationContractDomainModelFromPgModels( 1077 if cooperationContract, err := transform.TransformToCooperationContractDomainModelFromPgModels(
1078 cooperationContractModel, 1078 cooperationContractModel,
@@ -169,7 +169,7 @@ func (repository *CooperationContractUndertakerRepository) FindOne(queryOptions @@ -169,7 +169,7 @@ func (repository *CooperationContractUndertakerRepository) FindOne(queryOptions
169 query.SetWhereByQueryOption("cooperation_contract_undertaker.cooperation_contract_undertaker_id = ?", "cooperationContractUndertakerId") 169 query.SetWhereByQueryOption("cooperation_contract_undertaker.cooperation_contract_undertaker_id = ?", "cooperationContractUndertakerId")
170 if err := query.First(); err != nil { 170 if err := query.First(); err != nil {
171 if err.Error() == "pg: no rows in result set" { 171 if err.Error() == "pg: no rows in result set" {
172 - return nil, fmt.Errorf("没有此资源") 172 + return nil, fmt.Errorf("合约承接人不存在")
173 } else { 173 } else {
174 return nil, err 174 return nil, err
175 } 175 }
@@ -156,7 +156,7 @@ func (repository *CooperationModeRepository) FindOne(queryOptions map[string]int @@ -156,7 +156,7 @@ func (repository *CooperationModeRepository) FindOne(queryOptions map[string]int
156 } 156 }
157 if err := query.First(); err != nil { 157 if err := query.First(); err != nil {
158 if err.Error() == "pg: no rows in result set" { 158 if err.Error() == "pg: no rows in result set" {
159 - return nil, fmt.Errorf("没有此资源") 159 + return nil, fmt.Errorf("共创模式不存在")
160 } else { 160 } else {
161 return nil, err 161 return nil, err
162 } 162 }
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "fmt" 4 "fmt"
5 "github.com/go-pg/pg/v10" 5 "github.com/go-pg/pg/v10"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
7 "time" 8 "time"
8 9
9 "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" 10 "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
@@ -218,7 +219,7 @@ func (repository *CooperationProjectRepository) FindOne(queryOptions map[string] @@ -218,7 +219,7 @@ func (repository *CooperationProjectRepository) FindOne(queryOptions map[string]
218 } 219 }
219 if err := query.First(); err != nil { 220 if err := query.First(); err != nil {
220 if err.Error() == "pg: no rows in result set" { 221 if err.Error() == "pg: no rows in result set" {
221 - return nil, fmt.Errorf("没有此资源") 222 + return nil, fmt.Errorf("共创项目不存在")
222 } else { 223 } else {
223 return nil, err 224 return nil, err
224 } 225 }
@@ -230,7 +231,10 @@ func (repository *CooperationProjectRepository) FindOne(queryOptions map[string] @@ -230,7 +231,10 @@ func (repository *CooperationProjectRepository) FindOne(queryOptions map[string]
230 cooperationModeModel := new(models.CooperationMode) 231 cooperationModeModel := new(models.CooperationMode)
231 cooperationModeQuery := tx.Model(cooperationModeModel) 232 cooperationModeQuery := tx.Model(cooperationModeModel)
232 if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil { 233 if err := cooperationModeQuery.Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).First(); err != nil {
233 - return nil, err 234 + log.Logger.Error("共创项目关联的共创模式不存在", map[string]interface{}{
  235 + "cooperationProjectModel": cooperationProjectModel,
  236 + })
  237 + return nil, fmt.Errorf("共创项目关联的共创模式不存在")
234 } 238 }
235 return transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel) 239 return transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel)
236 } 240 }
@@ -287,7 +291,10 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int @@ -287,7 +291,10 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
287 Where("org->>'orgId' = '?'", cooperationProjectModel.Org.OrgId). 291 Where("org->>'orgId' = '?'", cooperationProjectModel.Org.OrgId).
288 Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber). 292 Where("cooperation_mode_number = ?", cooperationProjectModel.CooperationModeNumber).
289 First(); err != nil { 293 First(); err != nil {
290 - return 0, nil, err 294 + log.Logger.Error("共创项目关联的共创模式不存在", map[string]interface{}{
  295 + "cooperationProjectModel": cooperationProjectModel,
  296 + })
  297 + return 0, nil, fmt.Errorf("共创项目关联的共创模式不存在")
291 } 298 }
292 if cooperationProject, err := transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel); err != nil { 299 if cooperationProject, err := transform.TransformToCooperationProjectDomainModelFromPgModels(cooperationProjectModel, cooperationModeModel); err != nil {
293 return 0, cooperationProjects, err 300 return 0, cooperationProjects, err
@@ -184,7 +184,7 @@ func (repository *CreditAccountRepository) FindOne(queryOptions map[string]inter @@ -184,7 +184,7 @@ func (repository *CreditAccountRepository) FindOne(queryOptions map[string]inter
184 query.SetWhereByQueryOption("credit_account.credit_account_id = ?", "creditAccountId") 184 query.SetWhereByQueryOption("credit_account.credit_account_id = ?", "creditAccountId")
185 if err := query.First(); err != nil { 185 if err := query.First(); err != nil {
186 if err.Error() == "pg: no rows in result set" { 186 if err.Error() == "pg: no rows in result set" {
187 - return nil, fmt.Errorf("没有此资源") 187 + return nil, fmt.Errorf("账期结算单不存在")
188 } else { 188 } else {
189 return nil, err 189 return nil, err
190 } 190 }
@@ -264,7 +264,7 @@ func (repository *DividendsEstimateRepository) FindOne(queryOptions map[string]i @@ -264,7 +264,7 @@ func (repository *DividendsEstimateRepository) FindOne(queryOptions map[string]i
264 } 264 }
265 if err := query.First(); err != nil { 265 if err := query.First(); err != nil {
266 if err.Error() == "pg: no rows in result set" { 266 if err.Error() == "pg: no rows in result set" {
267 - return nil, fmt.Errorf("没有此资源") 267 + return nil, fmt.Errorf("分红预算单不存在")
268 } else { 268 } else {
269 return nil, err 269 return nil, err
270 } 270 }
@@ -149,7 +149,7 @@ func (repository *DividendsIncentivesRuleRepository) FindOne(queryOptions map[st @@ -149,7 +149,7 @@ func (repository *DividendsIncentivesRuleRepository) FindOne(queryOptions map[st
149 query.SetWhereByQueryOption("dividends_incentives_rule.dividends_incentives_rule_id = ?", "dividendsIncentivesRuleId") 149 query.SetWhereByQueryOption("dividends_incentives_rule.dividends_incentives_rule_id = ?", "dividendsIncentivesRuleId")
150 if err := query.First(); err != nil { 150 if err := query.First(); err != nil {
151 if err.Error() == "pg: no rows in result set" { 151 if err.Error() == "pg: no rows in result set" {
152 - return nil, fmt.Errorf("没有此资源") 152 + return nil, fmt.Errorf("分红激励规则不存在")
153 } else { 153 } else {
154 return nil, err 154 return nil, err
155 } 155 }
@@ -379,7 +379,7 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte @@ -379,7 +379,7 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
379 } 379 }
380 if err := query.First(); err != nil { 380 if err := query.First(); err != nil {
381 if err.Error() == "pg: no rows in result set" { 381 if err.Error() == "pg: no rows in result set" {
382 - return nil, fmt.Errorf("没有此资源") 382 + return nil, fmt.Errorf("分红订单不存在")
383 } else { 383 } else {
384 return nil, err 384 return nil, err
385 } 385 }
@@ -394,7 +394,7 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte @@ -394,7 +394,7 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
394 Where("company_id = ?", dividendsOrderModel.Company.CompanyId). 394 Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
395 Where("org_id = ?", dividendsOrderModel.Org.OrgId). 395 Where("org_id = ?", dividendsOrderModel.Org.OrgId).
396 Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil { 396 Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil {
397 - return nil, err 397 + return nil, fmt.Errorf("分红订单关联的产品不存在")
398 } 398 }
399 // 聚合分红订单 399 // 聚合分红订单
400 return transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels) 400 return transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels)
@@ -446,7 +446,10 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa @@ -446,7 +446,10 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
446 Where("org_id = ?", dividendsOrderModel.Org.OrgId). 446 Where("org_id = ?", dividendsOrderModel.Org.OrgId).
447 Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber). 447 Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).
448 Select(); err != nil { 448 Select(); err != nil {
449 - return 0, nil, err 449 + log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{
  450 + "dividendsOrderModel": dividendsOrderModel,
  451 + })
  452 + return 0, nil, fmt.Errorf("分红订单关联的产品不存在")
450 } 453 }
451 // 聚合分红订单 454 // 聚合分红订单
452 if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels); err != nil { 455 if dividendsOrder, err := transform.TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel, orderGoodModels); err != nil {
@@ -382,7 +382,7 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str @@ -382,7 +382,7 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str
382 query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_number = ?", "dividendsReturnedOrderNumber") 382 query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_number = ?", "dividendsReturnedOrderNumber")
383 if err := query.First(); err != nil { 383 if err := query.First(); err != nil {
384 if err.Error() == "pg: no rows in result set" { 384 if err.Error() == "pg: no rows in result set" {
385 - return nil, fmt.Errorf("没有此资源") 385 + return nil, fmt.Errorf("分红退货单不存在")
386 } else { 386 } else {
387 return nil, err 387 return nil, err
388 } 388 }
@@ -397,7 +397,7 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str @@ -397,7 +397,7 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str
397 Where("company_id = ?", dividendsReturnedOrderModel.Company.CompanyId). 397 Where("company_id = ?", dividendsReturnedOrderModel.Company.CompanyId).
398 Where("org_id = ?", dividendsReturnedOrderModel.Org.OrgId). 398 Where("org_id = ?", dividendsReturnedOrderModel.Org.OrgId).
399 Where("dividends_returned_order_number = ?", dividendsReturnedOrderModel.DividendsReturnedOrderNumber).Select(); err != nil { 399 Where("dividends_returned_order_number = ?", dividendsReturnedOrderModel.DividendsReturnedOrderNumber).Select(); err != nil {
400 - return nil, err 400 + return nil, fmt.Errorf("分红退货单关联的产品不存在")
401 } 401 }
402 // 聚合分红退货单 402 // 聚合分红退货单
403 return transform.TransformToDividendsReturnedOrderDomainModelFromPgModels(dividendsReturnedOrderModel, orderGoodModels) 403 return transform.TransformToDividendsReturnedOrderDomainModelFromPgModels(dividendsReturnedOrderModel, orderGoodModels)
@@ -449,7 +449,10 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string @@ -449,7 +449,10 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string
449 Where("org_id = ?", dividendsReturnedOrderModel.Org.OrgId). 449 Where("org_id = ?", dividendsReturnedOrderModel.Org.OrgId).
450 Where("dividends_returned_order_number = ?", dividendsReturnedOrderModel.DividendsReturnedOrderNumber). 450 Where("dividends_returned_order_number = ?", dividendsReturnedOrderModel.DividendsReturnedOrderNumber).
451 Select(); err != nil { 451 Select(); err != nil {
452 - return 0, nil, err 452 + log.Logger.Error("分红退货单关联的产品不存在", map[string]interface{}{
  453 + "dividendsReturnedOrderModel": dividendsReturnedOrderModel,
  454 + })
  455 + return 0, nil, fmt.Errorf("分红退货单关联的产品不存在")
453 } 456 }
454 if dividendsReturnedOrder, err := transform.TransformToDividendsReturnedOrderDomainModelFromPgModels(dividendsReturnedOrderModel, orderGoodModels); err != nil { 457 if dividendsReturnedOrder, err := transform.TransformToDividendsReturnedOrderDomainModelFromPgModels(dividendsReturnedOrderModel, orderGoodModels); err != nil {
455 return 0, dividendsReturnedOrders, err 458 return 0, dividendsReturnedOrders, err
@@ -149,7 +149,7 @@ func (repository *MoneyIncentivesRuleRepository) FindOne(queryOptions map[string @@ -149,7 +149,7 @@ func (repository *MoneyIncentivesRuleRepository) FindOne(queryOptions map[string
149 query.SetWhereByQueryOption("money_incentives_rule.money_incentives_rule_id = ?", "moneyIncentivesRuleId") 149 query.SetWhereByQueryOption("money_incentives_rule.money_incentives_rule_id = ?", "moneyIncentivesRuleId")
150 if err := query.First(); err != nil { 150 if err := query.First(); err != nil {
151 if err.Error() == "pg: no rows in result set" { 151 if err.Error() == "pg: no rows in result set" {
152 - return nil, fmt.Errorf("没有此资源") 152 + return nil, fmt.Errorf("金额激励规则不存在")
153 } else { 153 } else {
154 return nil, err 154 return nil, err
155 } 155 }
@@ -150,7 +150,7 @@ func (repository *OrderGoodRepository) FindOne(queryOptions map[string]interface @@ -150,7 +150,7 @@ func (repository *OrderGoodRepository) FindOne(queryOptions map[string]interface
150 query.SetWhereByQueryOption("order_good.order_good_id = ?", "orderGoodId") 150 query.SetWhereByQueryOption("order_good.order_good_id = ?", "orderGoodId")
151 if err := query.First(); err != nil { 151 if err := query.First(); err != nil {
152 if err.Error() == "pg: no rows in result set" { 152 if err.Error() == "pg: no rows in result set" {
153 - return nil, fmt.Errorf("没有此资源") 153 + return nil, fmt.Errorf("订单产品不存在")
154 } else { 154 } else {
155 return nil, err 155 return nil, err
156 } 156 }