Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creat…
…ion-cooperation into dev
正在显示
23 个修改的文件
包含
350 行增加
和
106 行删除
@@ -91,7 +91,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Crea | @@ -91,7 +91,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Crea | ||
91 | } | 91 | } |
92 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractNumber": createContractUndertakerFeedbackCommand.CooperationContractNumber}) | 92 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractNumber": createContractUndertakerFeedbackCommand.CooperationContractNumber}) |
93 | if err != nil { | 93 | if err != nil { |
94 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 94 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") |
95 | } | 95 | } |
96 | if cooperationContract == nil { | 96 | if cooperationContract == nil { |
97 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createContractUndertakerFeedbackCommand.CooperationContractNumber)) | 97 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createContractUndertakerFeedbackCommand.CooperationContractNumber)) |
@@ -153,7 +153,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) GetC | @@ -153,7 +153,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) GetC | ||
153 | } | 153 | } |
154 | contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.FindOne(map[string]interface{}{"contractUndertakerFeedbackId": getContractUndertakerFeedbackQuery.FeedbackId}) | 154 | contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.FindOne(map[string]interface{}{"contractUndertakerFeedbackId": getContractUndertakerFeedbackQuery.FeedbackId}) |
155 | if err != nil { | 155 | if err != nil { |
156 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 156 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "合约反馈信息不存在") |
157 | } | 157 | } |
158 | if contractUndertakerFeedback == nil { | 158 | if contractUndertakerFeedback == nil { |
159 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(getContractUndertakerFeedbackQuery.FeedbackId))) | 159 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(getContractUndertakerFeedbackQuery.FeedbackId))) |
@@ -228,7 +228,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Remo | @@ -228,7 +228,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Remo | ||
228 | } | 228 | } |
229 | contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.FindOne(map[string]interface{}{"contractUndertakerFeedbackId": removeContractUndertakerFeedbackCommand.FeedbackId}) | 229 | contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.FindOne(map[string]interface{}{"contractUndertakerFeedbackId": removeContractUndertakerFeedbackCommand.FeedbackId}) |
230 | if err != nil { | 230 | if err != nil { |
231 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 231 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "反馈信息不存在") |
232 | } | 232 | } |
233 | if contractUndertakerFeedback == nil { | 233 | if contractUndertakerFeedback == nil { |
234 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(removeContractUndertakerFeedbackCommand.FeedbackId))) | 234 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(removeContractUndertakerFeedbackCommand.FeedbackId))) |
@@ -306,7 +306,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Upda | @@ -306,7 +306,7 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Upda | ||
306 | } | 306 | } |
307 | contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.FindOne(map[string]interface{}{"contractUndertakerFeedbackId": updateContractUndertakerFeedbackCommand.FeedbackId}) | 307 | contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.FindOne(map[string]interface{}{"contractUndertakerFeedbackId": updateContractUndertakerFeedbackCommand.FeedbackId}) |
308 | if err != nil { | 308 | if err != nil { |
309 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 309 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "反馈信息不存在") |
310 | } | 310 | } |
311 | if contractUndertakerFeedback == nil { | 311 | if contractUndertakerFeedback == nil { |
312 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateContractUndertakerFeedbackCommand.FeedbackId))) | 312 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateContractUndertakerFeedbackCommand.FeedbackId))) |
@@ -48,7 +48,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop | @@ -48,7 +48,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop | ||
48 | // 获取共创项目 | 48 | // 获取共创项目 |
49 | cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectId": applyForCooperationCommand.CooperationProjectId}) | 49 | cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectId": applyForCooperationCommand.CooperationProjectId}) |
50 | if err != nil { | 50 | if err != nil { |
51 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 51 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创项目不存在") |
52 | } | 52 | } |
53 | if cooperationProject == nil { | 53 | if cooperationProject == nil { |
54 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(applyForCooperationCommand.CooperationProjectId, 10))) | 54 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(applyForCooperationCommand.CooperationProjectId, 10))) |
@@ -169,7 +169,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | @@ -169,7 +169,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | ||
169 | // 获取共创申请 | 169 | // 获取共创申请 |
170 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": approvalCooperationApplicationCommand.CooperationApplicationId}) | 170 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": approvalCooperationApplicationCommand.CooperationApplicationId}) |
171 | if err != nil { | 171 | if err != nil { |
172 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 172 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请不存在") |
173 | } | 173 | } |
174 | if cooperationApplication == nil { | 174 | if cooperationApplication == nil { |
175 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10))) | 175 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10))) |
@@ -330,7 +330,7 @@ func (cooperationApplicationService *CooperationApplicationService) CreateCooper | @@ -330,7 +330,7 @@ func (cooperationApplicationService *CooperationApplicationService) CreateCooper | ||
330 | } | 330 | } |
331 | cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectNumber": createCooperationApplicationCommand.CooperationProjectNumber}) | 331 | cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectNumber": createCooperationApplicationCommand.CooperationProjectNumber}) |
332 | if err != nil { | 332 | if err != nil { |
333 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 333 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创项目不存在") |
334 | } | 334 | } |
335 | if cooperationProject == nil { | 335 | if cooperationProject == nil { |
336 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationApplicationCommand.CooperationProjectNumber)) | 336 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationApplicationCommand.CooperationProjectNumber)) |
@@ -445,7 +445,7 @@ func (cooperationApplicationService *CooperationApplicationService) GetCooperati | @@ -445,7 +445,7 @@ func (cooperationApplicationService *CooperationApplicationService) GetCooperati | ||
445 | } | 445 | } |
446 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": getCooperationApplicationQuery.CooperationApplicationId}) | 446 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": getCooperationApplicationQuery.CooperationApplicationId}) |
447 | if err != nil { | 447 | if err != nil { |
448 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 448 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请不存在") |
449 | } | 449 | } |
450 | if cooperationApplication == nil { | 450 | if cooperationApplication == nil { |
451 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationApplicationQuery.CooperationApplicationId, 10))) | 451 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationApplicationQuery.CooperationApplicationId, 10))) |
@@ -523,7 +523,7 @@ func (cooperationApplicationService *CooperationApplicationService) RemoveCooper | @@ -523,7 +523,7 @@ func (cooperationApplicationService *CooperationApplicationService) RemoveCooper | ||
523 | } | 523 | } |
524 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": removeCooperationApplicationCommand.CooperationApplicationId}) | 524 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": removeCooperationApplicationCommand.CooperationApplicationId}) |
525 | if err != nil { | 525 | if err != nil { |
526 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 526 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请不存在") |
527 | } | 527 | } |
528 | if cooperationApplication == nil { | 528 | if cooperationApplication == nil { |
529 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationApplicationCommand.CooperationApplicationId, 10))) | 529 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationApplicationCommand.CooperationApplicationId, 10))) |
@@ -608,7 +608,7 @@ func (cooperationApplicationService *CooperationApplicationService) UpdateCooper | @@ -608,7 +608,7 @@ func (cooperationApplicationService *CooperationApplicationService) UpdateCooper | ||
608 | } | 608 | } |
609 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": updateCooperationApplicationCommand.CooperationApplicationId}) | 609 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": updateCooperationApplicationCommand.CooperationApplicationId}) |
610 | if err != nil { | 610 | if err != nil { |
611 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 611 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请不存在") |
612 | } | 612 | } |
613 | if cooperationApplication == nil { | 613 | if cooperationApplication == nil { |
614 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationApplicationCommand.CooperationApplicationId, 10))) | 614 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationApplicationCommand.CooperationApplicationId, 10))) |
@@ -658,7 +658,7 @@ func (cooperationApplicationService *CooperationApplicationService) CancelCooper | @@ -658,7 +658,7 @@ func (cooperationApplicationService *CooperationApplicationService) CancelCooper | ||
658 | } | 658 | } |
659 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": cooperationApplicationId}) | 659 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": cooperationApplicationId}) |
660 | if err != nil { | 660 | if err != nil { |
661 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 661 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请不存在") |
662 | } | 662 | } |
663 | if cooperationApplication == nil { | 663 | if cooperationApplication == nil { |
664 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10))) | 664 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10))) |
@@ -287,7 +287,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -287,7 +287,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
287 | } | 287 | } |
288 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeNumber": createCooperationContractCommand.CooperationModeNumber}) | 288 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeNumber": createCooperationContractCommand.CooperationModeNumber}) |
289 | if err != nil { | 289 | if err != nil { |
290 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 290 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") |
291 | } | 291 | } |
292 | if cooperationMode == nil { | 292 | if cooperationMode == nil { |
293 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationContractCommand.CooperationModeNumber)) | 293 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationContractCommand.CooperationModeNumber)) |
@@ -368,7 +368,7 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont | @@ -368,7 +368,7 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont | ||
368 | } | 368 | } |
369 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": getCooperationContractQuery.CooperationContractId}) | 369 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": getCooperationContractQuery.CooperationContractId}) |
370 | if err != nil { | 370 | if err != nil { |
371 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 371 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") |
372 | } | 372 | } |
373 | if cooperationContract == nil { | 373 | if cooperationContract == nil { |
374 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationContractQuery.CooperationContractId, 10))) | 374 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationContractQuery.CooperationContractId, 10))) |
@@ -489,7 +489,7 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC | @@ -489,7 +489,7 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC | ||
489 | } | 489 | } |
490 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": removeCooperationContractCommand.CooperationContractId}) | 490 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": removeCooperationContractCommand.CooperationContractId}) |
491 | if err != nil { | 491 | if err != nil { |
492 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 492 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") |
493 | } | 493 | } |
494 | if cooperationContract == nil { | 494 | if cooperationContract == nil { |
495 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationContractCommand.CooperationContractId, 10))) | 495 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationContractCommand.CooperationContractId, 10))) |
@@ -603,7 +603,7 @@ func (cooperationContractService *CooperationContractService) OperateCooperation | @@ -603,7 +603,7 @@ func (cooperationContractService *CooperationContractService) OperateCooperation | ||
603 | // 获取共创合约 | 603 | // 获取共创合约 |
604 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": operateCooperationContractCommand.CooperationContractId}) | 604 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": operateCooperationContractCommand.CooperationContractId}) |
605 | if err != nil { | 605 | if err != nil { |
606 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 606 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") |
607 | } | 607 | } |
608 | if cooperationContract == nil { | 608 | if cooperationContract == nil { |
609 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(operateCooperationContractCommand.CooperationContractId))) | 609 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(operateCooperationContractCommand.CooperationContractId))) |
@@ -632,6 +632,7 @@ func (cooperationContractService *CooperationContractService) OperateCooperation | @@ -632,6 +632,7 @@ func (cooperationContractService *CooperationContractService) OperateCooperation | ||
632 | Undertakers: "", | 632 | Undertakers: "", |
633 | CooperationContractNumber: cooperationContractUpdated.CooperationContractNumber, | 633 | CooperationContractNumber: cooperationContractUpdated.CooperationContractNumber, |
634 | Company: cooperationContractUpdated.Company, | 634 | Company: cooperationContractUpdated.Company, |
635 | + Org: cooperationContract.Org, | ||
635 | Operator: operator, | 636 | Operator: operator, |
636 | CreatedAt: time.Now(), | 637 | CreatedAt: time.Now(), |
637 | } | 638 | } |
@@ -731,6 +732,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper | @@ -731,6 +732,7 @@ func (cooperationContractService *CooperationContractService) BatchOperateCooper | ||
731 | Undertakers: "", | 732 | Undertakers: "", |
732 | CooperationContractNumber: cooperationContractOperated.CooperationContractNumber, | 733 | CooperationContractNumber: cooperationContractOperated.CooperationContractNumber, |
733 | Company: cooperationContractOperated.Company, | 734 | Company: cooperationContractOperated.Company, |
735 | + Org: cooperationContractOperated.Org, | ||
734 | Operator: operator, | 736 | Operator: operator, |
735 | CreatedAt: time.Now(), | 737 | CreatedAt: time.Now(), |
736 | } | 738 | } |
@@ -881,7 +883,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -881,7 +883,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
881 | // 获取待更新的共创合约 | 883 | // 获取待更新的共创合约 |
882 | cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": updateCooperationContractCommand.CooperationContractId}) | 884 | cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": updateCooperationContractCommand.CooperationContractId}) |
883 | if err8 != nil { | 885 | if err8 != nil { |
884 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err8.Error()) | 886 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") |
885 | } | 887 | } |
886 | if cooperationContract == nil { | 888 | if cooperationContract == nil { |
887 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId))) | 889 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId))) |
@@ -1266,6 +1268,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1266,6 +1268,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
1266 | Undertakers: undertakerChange, | 1268 | Undertakers: undertakerChange, |
1267 | CooperationContractNumber: cooperationContractSaved.CooperationContractNumber, | 1269 | CooperationContractNumber: cooperationContractSaved.CooperationContractNumber, |
1268 | Company: company, | 1270 | Company: company, |
1271 | + Org: organization, | ||
1269 | Operator: operator, | 1272 | Operator: operator, |
1270 | UpdatedAt: time.Time{}, | 1273 | UpdatedAt: time.Time{}, |
1271 | CreatedAt: time.Now(), | 1274 | CreatedAt: time.Now(), |
@@ -49,6 +49,22 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | @@ -49,6 +49,22 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | ||
49 | company = data | 49 | company = data |
50 | } | 50 | } |
51 | 51 | ||
52 | + // 组织机构REST服务初始化 | ||
53 | + var organizationService service.OrgService | ||
54 | + if value, err := factory.CreateOrganizationService(map[string]interface{}{}); err != nil { | ||
55 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
56 | + } else { | ||
57 | + organizationService = value | ||
58 | + } | ||
59 | + | ||
60 | + // 获取组织机构信息 | ||
61 | + var organization *domain.Org | ||
62 | + if data, err := organizationService.OrgFrom(createCooperationContractChangeLogCommand.CompanyId, createCooperationContractChangeLogCommand.OrgId); err != nil { | ||
63 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
64 | + } else { | ||
65 | + organization = data | ||
66 | + } | ||
67 | + | ||
52 | // 用户REST服务初始化 | 68 | // 用户REST服务初始化 |
53 | var userService service.UserService | 69 | var userService service.UserService |
54 | if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil { | 70 | if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil { |
@@ -82,6 +98,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | @@ -82,6 +98,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | ||
82 | Undertakers: createCooperationContractChangeLogCommand.Undertakers, | 98 | Undertakers: createCooperationContractChangeLogCommand.Undertakers, |
83 | CooperationContractNumber: createCooperationContractChangeLogCommand.CooperationContractNumber, | 99 | CooperationContractNumber: createCooperationContractChangeLogCommand.CooperationContractNumber, |
84 | Company: company, | 100 | Company: company, |
101 | + Org: organization, | ||
85 | Operator: operator, | 102 | Operator: operator, |
86 | UpdatedAt: time.Time{}, | 103 | UpdatedAt: time.Time{}, |
87 | DeletedAt: time.Time{}, | 104 | DeletedAt: time.Time{}, |
@@ -123,7 +140,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | @@ -123,7 +140,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | ||
123 | } | 140 | } |
124 | cooperationContractChangeLog, err := cooperationContractChangeLogRepository.FindOne(map[string]interface{}{"cooperationContractChangeLogId": getCooperationContractChangeLogQuery.CooperationContractChangeLogId}) | 141 | cooperationContractChangeLog, err := cooperationContractChangeLogRepository.FindOne(map[string]interface{}{"cooperationContractChangeLogId": getCooperationContractChangeLogQuery.CooperationContractChangeLogId}) |
125 | if err != nil { | 142 | if err != nil { |
126 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 143 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约变更记录不存在") |
127 | } | 144 | } |
128 | if cooperationContractChangeLog == nil { | 145 | if cooperationContractChangeLog == nil { |
129 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationContractChangeLogQuery.CooperationContractChangeLogId, 10))) | 146 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationContractChangeLogQuery.CooperationContractChangeLogId, 10))) |
@@ -198,7 +215,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | @@ -198,7 +215,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | ||
198 | } | 215 | } |
199 | cooperationContractChangeLog, err := cooperationContractChangeLogRepository.FindOne(map[string]interface{}{"cooperationContractChangeLogId": removeCooperationContractChangeLogCommand.CooperationContractChangeLogId}) | 216 | cooperationContractChangeLog, err := cooperationContractChangeLogRepository.FindOne(map[string]interface{}{"cooperationContractChangeLogId": removeCooperationContractChangeLogCommand.CooperationContractChangeLogId}) |
200 | if err != nil { | 217 | if err != nil { |
201 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 218 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约变更记录不存在") |
202 | } | 219 | } |
203 | if cooperationContractChangeLog == nil { | 220 | if cooperationContractChangeLog == nil { |
204 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationContractChangeLogCommand.CooperationContractChangeLogId, 10))) | 221 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationContractChangeLogCommand.CooperationContractChangeLogId, 10))) |
@@ -276,7 +293,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | @@ -276,7 +293,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) | ||
276 | } | 293 | } |
277 | cooperationContractChangeLog, err := cooperationContractChangeLogRepository.FindOne(map[string]interface{}{"cooperationContractChangeLogId": updateCooperationContractChangeLogCommand.CooperationContractChangeLogId}) | 294 | cooperationContractChangeLog, err := cooperationContractChangeLogRepository.FindOne(map[string]interface{}{"cooperationContractChangeLogId": updateCooperationContractChangeLogCommand.CooperationContractChangeLogId}) |
278 | if err != nil { | 295 | if err != nil { |
279 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 296 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约变更记录不存在") |
280 | } | 297 | } |
281 | if cooperationContractChangeLog == nil { | 298 | if cooperationContractChangeLog == nil { |
282 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationContractChangeLogCommand.CooperationContractChangeLogId, 10))) | 299 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationContractChangeLogCommand.CooperationContractChangeLogId, 10))) |
@@ -168,7 +168,7 @@ func (cooperationModeService *CooperationModeService) GetCooperationMode(getCoop | @@ -168,7 +168,7 @@ func (cooperationModeService *CooperationModeService) GetCooperationMode(getCoop | ||
168 | } | 168 | } |
169 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": getCooperationModeQuery.CooperationModeId}) | 169 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": getCooperationModeQuery.CooperationModeId}) |
170 | if err != nil { | 170 | if err != nil { |
171 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 171 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") |
172 | } | 172 | } |
173 | if cooperationMode == nil { | 173 | if cooperationMode == nil { |
174 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationModeQuery.CooperationModeId, 10))) | 174 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationModeQuery.CooperationModeId, 10))) |
@@ -241,7 +241,7 @@ func (cooperationModeService *CooperationModeService) RemoveCooperationMode(remo | @@ -241,7 +241,7 @@ func (cooperationModeService *CooperationModeService) RemoveCooperationMode(remo | ||
241 | } | 241 | } |
242 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": removeCooperationModeCommand.CooperationModeId}) | 242 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": removeCooperationModeCommand.CooperationModeId}) |
243 | if err != nil { | 243 | if err != nil { |
244 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 244 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") |
245 | } | 245 | } |
246 | if cooperationMode == nil { | 246 | if cooperationMode == nil { |
247 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationModeCommand.CooperationModeId, 10))) | 247 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationModeCommand.CooperationModeId, 10))) |
@@ -379,7 +379,7 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | @@ -379,7 +379,7 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda | ||
379 | 379 | ||
380 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId}) | 380 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId}) |
381 | if err != nil { | 381 | if err != nil { |
382 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 382 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") |
383 | } | 383 | } |
384 | if cooperationMode == nil { | 384 | if cooperationMode == nil { |
385 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationModeCommand.CooperationModeId, 10))) | 385 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationModeCommand.CooperationModeId, 10))) |
@@ -423,7 +423,7 @@ func (cooperationModeService *CooperationModeService) OperateCooperationMode(ope | @@ -423,7 +423,7 @@ func (cooperationModeService *CooperationModeService) OperateCooperationMode(ope | ||
423 | cooperationModeId, _ := strconv.ParseInt(operateCooperationModeCommand.CooperationModeId, 10, 64) | 423 | cooperationModeId, _ := strconv.ParseInt(operateCooperationModeCommand.CooperationModeId, 10, 64) |
424 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": cooperationModeId}) | 424 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": cooperationModeId}) |
425 | if err != nil { | 425 | if err != nil { |
426 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 426 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") |
427 | } | 427 | } |
428 | if cooperationMode == nil { | 428 | if cooperationMode == nil { |
429 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationModeId, 10))) | 429 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationModeId, 10))) |
@@ -25,15 +25,15 @@ type CreateCooperationProjectCommand struct { | @@ -25,15 +25,15 @@ type CreateCooperationProjectCommand struct { | ||
25 | // 附件 | 25 | // 附件 |
26 | Attachment []*domain.Attachment `cname:"附件" json:"attachment"` | 26 | Attachment []*domain.Attachment `cname:"附件" json:"attachment"` |
27 | // 所属部门Id | 27 | // 所属部门Id |
28 | - DepartmentId int64 `json:"departmentId,string"` | 28 | + DepartmentId int64 `cname:"所属部门ID" json:"departmentId"` |
29 | // 公司ID,通过集成REST上下文获取 | 29 | // 公司ID,通过集成REST上下文获取 |
30 | - CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` | 30 | + CompanyId int64 `cname:"公司ID" json:"companyId"` |
31 | // 组织机构ID | 31 | // 组织机构ID |
32 | - OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` | 32 | + OrgId int64 `cname:"组织机构ID" json:"orgId"` |
33 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 33 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
34 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | 34 | + UserId int64 `cname:"用户ID" json:"userId"` |
35 | // 用户基础数据id | 35 | // 用户基础数据id |
36 | - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"` | 36 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
37 | } | 37 | } |
38 | 38 | ||
39 | func (createCooperationProjectCommand *CreateCooperationProjectCommand) Valid(validation *validation.Validation) { | 39 | func (createCooperationProjectCommand *CreateCooperationProjectCommand) Valid(validation *validation.Validation) { |
@@ -13,14 +13,6 @@ type ReleaseCooperationProjectCommand struct { | @@ -13,14 +13,6 @@ type ReleaseCooperationProjectCommand struct { | ||
13 | CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"` | 13 | CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"` |
14 | // 共创模式ID | 14 | // 共创模式ID |
15 | CooperationModeId int64 `cname:"共创模式ID" json:"cooperationModeId" valid:"Required"` | 15 | CooperationModeId int64 `cname:"共创模式ID" json:"cooperationModeId" valid:"Required"` |
16 | - // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
17 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | ||
18 | - // 用户基本id | ||
19 | - UserBaseId int64 `cname:"用户基本数据ID" json:"userBaseId" valid:"Required"` | ||
20 | - // 组织机构ID | ||
21 | - OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` | ||
22 | - // 公司ID,通过集成REST上下文获取 | ||
23 | - CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` | ||
24 | // 共创项目发起人id | 16 | // 共创项目发起人id |
25 | CooperationProjectSponsorId string `cname:"共创项目发起人UID" json:"cooperationProjectSponsorId" valid:"Required"` | 17 | CooperationProjectSponsorId string `cname:"共创项目发起人UID" json:"cooperationProjectSponsorId" valid:"Required"` |
26 | // 部门ID,通过REST集成上下文获取 | 18 | // 部门ID,通过REST集成上下文获取 |
@@ -29,6 +21,14 @@ type ReleaseCooperationProjectCommand struct { | @@ -29,6 +21,14 @@ type ReleaseCooperationProjectCommand struct { | ||
29 | CooperationProjectUndertakerType []int32 `cname:"共创项目承接对象" json:"cooperationProjectUndertakerType" valid:"Required"` | 21 | CooperationProjectUndertakerType []int32 `cname:"共创项目承接对象" json:"cooperationProjectUndertakerType" valid:"Required"` |
30 | // 共创项目描述 | 22 | // 共创项目描述 |
31 | CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription" valid:"Required"` | 23 | CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription" valid:"Required"` |
24 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
25 | + UserId int64 `cname:"用户ID" json:"userId"` | ||
26 | + // 用户基本id | ||
27 | + UserBaseId int64 `cname:"用户基本数据ID" json:"userBaseId"` | ||
28 | + // 组织机构ID | ||
29 | + OrgId int64 `cname:"组织机构ID" json:"orgId"` | ||
30 | + // 公司ID,通过集成REST上下文获取 | ||
31 | + CompanyId int64 `cname:"公司ID" json:"companyId"` | ||
32 | } | 32 | } |
33 | 33 | ||
34 | func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) { | 34 | func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) { |
@@ -68,23 +68,23 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | @@ -68,23 +68,23 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | ||
68 | // 获取操作人 | 68 | // 获取操作人 |
69 | var operator *domain.User | 69 | var operator *domain.User |
70 | if data, err := userService.OperatorFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.UserId); err != nil { | 70 | if data, err := userService.OperatorFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.UserId); err != nil { |
71 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 71 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败") |
72 | } else { | 72 | } else { |
73 | operator = data | 73 | operator = data |
74 | } | 74 | } |
75 | 75 | ||
76 | - // Sponsor | 76 | + // 获取发起人 |
77 | var sponsor *domain.User | 77 | var sponsor *domain.User |
78 | if data, err := userService.UserFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.SponsorUid); err != nil { | 78 | if data, err := userService.UserFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.SponsorUid); err != nil { |
79 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 79 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发起人失败") |
80 | } else { | 80 | } else { |
81 | sponsor = data | 81 | sponsor = data |
82 | } | 82 | } |
83 | 83 | ||
84 | - // Publisher | 84 | + // 获取发布人 |
85 | var publisher *domain.User | 85 | var publisher *domain.User |
86 | if data, err := userService.UserFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.PublisherUid); err != nil { | 86 | if data, err := userService.UserFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.PublisherUid); err != nil { |
87 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 87 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发布人失败") |
88 | } else { | 88 | } else { |
89 | publisher = data | 89 | publisher = data |
90 | } | 90 | } |
@@ -100,7 +100,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | @@ -100,7 +100,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | ||
100 | // 获取公司信息 | 100 | // 获取公司信息 |
101 | var company *domain.Company | 101 | var company *domain.Company |
102 | if data, err := companyService.CompanyFrom(createCooperationProjectCommand.CompanyId); err != nil { | 102 | if data, err := companyService.CompanyFrom(createCooperationProjectCommand.CompanyId); err != nil { |
103 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 103 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取公司信息失败") |
104 | } else { | 104 | } else { |
105 | company = data | 105 | company = data |
106 | } | 106 | } |
@@ -116,15 +116,15 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | @@ -116,15 +116,15 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | ||
116 | // 获取组织机构信息 | 116 | // 获取组织机构信息 |
117 | var organization *domain.Org | 117 | var organization *domain.Org |
118 | if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId); err != nil { | 118 | if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId); err != nil { |
119 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 119 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取组织机构信息失败") |
120 | } else { | 120 | } else { |
121 | organization = data | 121 | organization = data |
122 | } | 122 | } |
123 | 123 | ||
124 | - // 获取组织机构信息 | 124 | + // 获取部门信息 |
125 | var department *domain.Org | 125 | var department *domain.Org |
126 | if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.DepartmentId); err != nil { | 126 | if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.DepartmentId); err != nil { |
127 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 127 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息失败") |
128 | } else { | 128 | } else { |
129 | department = data | 129 | department = data |
130 | } | 130 | } |
@@ -140,7 +140,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | @@ -140,7 +140,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro | ||
140 | } | 140 | } |
141 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeNumber": createCooperationProjectCommand.CooperationModeNumber}) | 141 | cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeNumber": createCooperationProjectCommand.CooperationModeNumber}) |
142 | if err != nil { | 142 | if err != nil { |
143 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 143 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在") |
144 | } | 144 | } |
145 | if cooperationMode == nil { | 145 | if cooperationMode == nil { |
146 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationProjectCommand.CooperationModeNumber)) | 146 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationProjectCommand.CooperationModeNumber)) |
@@ -456,6 +456,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -456,6 +456,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
456 | _ = transactionContext.RollbackTransaction() | 456 | _ = transactionContext.RollbackTransaction() |
457 | }() | 457 | }() |
458 | 458 | ||
459 | + // 订单产品ID类型转换 | ||
459 | orderGoodIds, err := utils.SliceAtoi(confirmDividendsIncentivesEstimateCommand.OrderGoodIds) | 460 | orderGoodIds, err := utils.SliceAtoi(confirmDividendsIncentivesEstimateCommand.OrderGoodIds) |
460 | if err != nil { | 461 | if err != nil { |
461 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 462 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -493,6 +494,22 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -493,6 +494,22 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
493 | organization = data | 494 | organization = data |
494 | } | 495 | } |
495 | 496 | ||
497 | + // 用户REST服务初始化 | ||
498 | + var userService service.UserService | ||
499 | + if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil { | ||
500 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
501 | + } else { | ||
502 | + userService = value | ||
503 | + } | ||
504 | + | ||
505 | + // 获取操作人 | ||
506 | + var operator *domain.User | ||
507 | + if data, err := userService.OperatorFrom(confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, confirmDividendsIncentivesEstimateCommand.UserId); err != nil { | ||
508 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
509 | + } else { | ||
510 | + operator = data | ||
511 | + } | ||
512 | + | ||
496 | // 分红订单仓储初始化 | 513 | // 分红订单仓储初始化 |
497 | var dividendsOrderRepository domain.DividendsOrderRepository | 514 | var dividendsOrderRepository domain.DividendsOrderRepository |
498 | if value, err := factory.CreateDividendsOrderRepository(map[string]interface{}{ | 515 | if value, err := factory.CreateDividendsOrderRepository(map[string]interface{}{ |
@@ -566,9 +583,9 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -566,9 +583,9 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
566 | for _, orderGood := range orderGoods { | 583 | for _, orderGood := range orderGoods { |
567 | dividendsEstimate := &domain.DividendsEstimate{} | 584 | dividendsEstimate := &domain.DividendsEstimate{} |
568 | if orderGood.DividendsOrderNumber != "" { // 查询分红订单 | 585 | if orderGood.DividendsOrderNumber != "" { // 查询分红订单 |
569 | - dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{"dividendsOrderNumber": orderGood.DividendsOrderNumber}) | ||
570 | - if err != nil { | ||
571 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 586 | + dividendsOrder, err3 := dividendsOrderRepository.FindOne(map[string]interface{}{"dividendsOrderNumber": orderGood.DividendsOrderNumber}) |
587 | + if err3 != nil { | ||
588 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在") | ||
572 | } | 589 | } |
573 | if dividendsOrder == nil { | 590 | if dividendsOrder == nil { |
574 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsOrderNumber)) | 591 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsOrderNumber)) |
@@ -598,7 +615,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -598,7 +615,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
598 | DividendsStage: dividendsEstimateDetail.DividendsStage, | 615 | DividendsStage: dividendsEstimateDetail.DividendsStage, |
599 | Org: organization, | 616 | Org: organization, |
600 | Company: company, | 617 | Company: company, |
601 | - Operator: nil, | 618 | + Operator: operator, |
602 | OperateTime: time.Time{}, | 619 | OperateTime: time.Time{}, |
603 | IsCanceled: false, | 620 | IsCanceled: false, |
604 | CreatedAt: time.Now(), | 621 | CreatedAt: time.Now(), |
@@ -641,7 +658,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -641,7 +658,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
641 | DividendsStage: dividendsReturnedEstimateDetail.DividendsStage, | 658 | DividendsStage: dividendsReturnedEstimateDetail.DividendsStage, |
642 | Org: organization, | 659 | Org: organization, |
643 | Company: company, | 660 | Company: company, |
644 | - Operator: nil, | 661 | + Operator: operator, |
645 | OperateTime: time.Time{}, | 662 | OperateTime: time.Time{}, |
646 | IsCanceled: false, | 663 | IsCanceled: false, |
647 | CreatedAt: time.Now(), | 664 | CreatedAt: time.Now(), |
@@ -670,16 +687,12 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -670,16 +687,12 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
670 | } | 687 | } |
671 | } | 688 | } |
672 | 689 | ||
673 | - dividendsEstimatesSaved, err := dividendsEstimateRepository.SaveMany(dividendsEstimates) | ||
674 | - if err != nil { | ||
675 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
676 | - } | ||
677 | if err := transactionContext.CommitTransaction(); err != nil { | 690 | if err := transactionContext.CommitTransaction(); err != nil { |
678 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 691 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
679 | } | 692 | } |
680 | // TODO 分析成功和失败原因 | 693 | // TODO 分析成功和失败原因 |
681 | 694 | ||
682 | - return dividendsEstimatesSaved, nil | 695 | + return dividendsEstimatesSavedSuccessfully, nil |
683 | } | 696 | } |
684 | } | 697 | } |
685 | 698 |
@@ -5,6 +5,7 @@ import ( | @@ -5,6 +5,7 @@ import ( | ||
5 | "github.com/beego/beego/v2/core/validation" | 5 | "github.com/beego/beego/v2/core/validation" |
6 | "reflect" | 6 | "reflect" |
7 | "strings" | 7 | "strings" |
8 | + "time" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type OrderGoods struct { | 11 | type OrderGoods struct { |
@@ -30,7 +31,7 @@ type CreateDividendsOrderCommand struct { | @@ -30,7 +31,7 @@ type CreateDividendsOrderCommand struct { | ||
30 | // 分红订单原单号 | 31 | // 分红订单原单号 |
31 | DividendsOriginalOrderNum string `cname:"源单号" json:"dividendsOriginalOrderNum" valid:"Required"` | 32 | DividendsOriginalOrderNum string `cname:"源单号" json:"dividendsOriginalOrderNum" valid:"Required"` |
32 | // 订单时间 | 33 | // 订单时间 |
33 | - OrderTime string `cname:"订单时间" json:"orderTime" valid:"Required"` | 34 | + OrderTime time.Time `cname:"订单时间" json:"orderTime" valid:"Required"` |
34 | // 备注 | 35 | // 备注 |
35 | Remarks string `cname:"备注" json:"remarks" valid:"Required"` | 36 | Remarks string `cname:"备注" json:"remarks" valid:"Required"` |
36 | // 订单区域名称 | 37 | // 订单区域名称 |
@@ -2,14 +2,26 @@ package command | @@ -2,14 +2,26 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "github.com/beego/beego/v2/core/validation" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | "time" | 8 | "time" |
8 | - | ||
9 | - "github.com/beego/beego/v2/core/validation" | ||
10 | ) | 9 | ) |
11 | 10 | ||
12 | type ImportDividendsOrderCommand struct { | 11 | type ImportDividendsOrderCommand struct { |
12 | + // 订单数据列表 | ||
13 | + DividendsOrderData []*DividendsOrderData `cname:"订单数据列表" json:"dividendsOrderData" valid:"Required"` | ||
14 | + // 公司ID,通过集成REST上下文获取 | ||
15 | + CompanyId int64 `cname:"公司ID" json:"companyId"` | ||
16 | + // 组织机构ID | ||
17 | + OrgId int64 `cname:"组织机构ID" json:"orgId"` | ||
18 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
19 | + UserId int64 `cname:"用户ID" json:"userId"` | ||
20 | + // 用户基础信息id | ||
21 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` | ||
22 | +} | ||
23 | + | ||
24 | +type DividendsOrderData struct { | ||
13 | // 客户名称 | 25 | // 客户名称 |
14 | CustomerName string `cname:"客户名称" json:"customerName" valid:"Required"` | 26 | CustomerName string `cname:"客户名称" json:"customerName" valid:"Required"` |
15 | // 分红订单金额 | 27 | // 分红订单金额 |
@@ -20,24 +32,16 @@ type ImportDividendsOrderCommand struct { | @@ -20,24 +32,16 @@ type ImportDividendsOrderCommand struct { | ||
20 | DividendsOriginalOrderNum string `cname:"分红订单原单号" json:"dividendsOriginalOrderNum" valid:"Required"` | 32 | DividendsOriginalOrderNum string `cname:"分红订单原单号" json:"dividendsOriginalOrderNum" valid:"Required"` |
21 | // 订单产生时间 | 33 | // 订单产生时间 |
22 | OrderTime time.Time `cname:"订单产生时间" json:"orderTime" valid:"Required"` | 34 | OrderTime time.Time `cname:"订单产生时间" json:"orderTime" valid:"Required"` |
23 | - // 备注 | ||
24 | - Remarks string `cname:"备注" json:"remarks" valid:"Required"` | ||
25 | // 订单区域名称 | 35 | // 订单区域名称 |
26 | RegionName string `cname:"订单区域名称" json:"regionName,omitempty"` | 36 | RegionName string `cname:"订单区域名称" json:"regionName,omitempty"` |
27 | // 订单业务员uid | 37 | // 订单业务员uid |
28 | SalesmanUid string `cname:"订单业务员UID" json:"salesmanUid,omitempty"` | 38 | SalesmanUid string `cname:"订单业务员UID" json:"salesmanUid,omitempty"` |
29 | - // 订单操作人uid | ||
30 | - OperatorUid string `cname:"订单操作人UID" json:"operatorUid,omitempty"` | ||
31 | // 订单产品列表 | 39 | // 订单产品列表 |
32 | OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` | 40 | OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` |
33 | - // 公司ID,通过集成REST上下文获取 | ||
34 | - CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` | ||
35 | - // 组织机构ID | ||
36 | - OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` | ||
37 | - // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
38 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | ||
39 | - // 用户基础信息id | ||
40 | - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"` | 41 | + // 订单操作人uid |
42 | + OperatorUid string `cname:"订单操作人UID" json:"operatorUid,omitempty"` | ||
43 | + // 备注 | ||
44 | + Remarks string `cname:"备注" json:"remarks,omitempty"` | ||
41 | } | 45 | } |
42 | 46 | ||
43 | func (importDividendsOrderCommand *ImportDividendsOrderCommand) Valid(validation *validation.Validation) { | 47 | func (importDividendsOrderCommand *ImportDividendsOrderCommand) Valid(validation *validation.Validation) { |
@@ -112,7 +112,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -112,7 +112,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
112 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常") | 112 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常") |
113 | } | 113 | } |
114 | 114 | ||
115 | - // 获取订单产品 | 115 | + // 新增订单产品 |
116 | var orderGoods []*domain.OrderGood | 116 | var orderGoods []*domain.OrderGood |
117 | var dividendsOrderAmount float64 | 117 | var dividendsOrderAmount float64 |
118 | for _, orderGood := range createDividendsOrderCommand.OrderGoods { | 118 | for _, orderGood := range createDividendsOrderCommand.OrderGoods { |
@@ -136,9 +136,9 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -136,9 +136,9 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
136 | dividendsOrderAmount = dividendsOrderAmount + orderGood.OrderGoodAmount | 136 | dividendsOrderAmount = dividendsOrderAmount + orderGood.OrderGoodAmount |
137 | } | 137 | } |
138 | 138 | ||
139 | - // 订单时间转换 | ||
140 | - orderTimeInt, _ := strconv.ParseInt(createDividendsOrderCommand.OrderTime, 10, 64) | ||
141 | - orderTime := utils.TransformTimestampToTime(orderTimeInt) | 139 | + //// 订单时间转换 |
140 | + //orderTimeInt, _ := strconv.ParseInt(createDividendsOrderCommand.OrderTime, 10, 64) | ||
141 | + //orderTime := utils.TransformTimestampToTime(orderTimeInt) | ||
142 | 142 | ||
143 | // 新增分红订单 | 143 | // 新增分红订单 |
144 | newDividendsOrder := &domain.DividendsOrder{ | 144 | newDividendsOrder := &domain.DividendsOrder{ |
@@ -146,7 +146,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -146,7 +146,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
146 | DividendsOrderNumber: dividendsOrderNumber, | 146 | DividendsOrderNumber: dividendsOrderNumber, |
147 | DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, | 147 | DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, |
148 | DividendsOrderAmount: dividendsOrderAmount, | 148 | DividendsOrderAmount: dividendsOrderAmount, |
149 | - OrderTime: orderTime, | 149 | + OrderTime: createDividendsOrderCommand.OrderTime, |
150 | DividendTime: time.Time{}, | 150 | DividendTime: time.Time{}, |
151 | DividendStatus: domain.TO_BE_DIVIDEND, | 151 | DividendStatus: domain.TO_BE_DIVIDEND, |
152 | Region: &domain.RegionInfo{ | 152 | Region: &domain.RegionInfo{ |
@@ -162,6 +162,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -162,6 +162,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
162 | UpdatedAt: time.Time{}, | 162 | UpdatedAt: time.Time{}, |
163 | OperateTime: time.Now(), | 163 | OperateTime: time.Now(), |
164 | Operator: operator, | 164 | Operator: operator, |
165 | + Remarks: createDividendsOrderCommand.Remarks, | ||
165 | } | 166 | } |
166 | 167 | ||
167 | // 分红订单仓储初始化 | 168 | // 分红订单仓储初始化 |
@@ -183,6 +184,174 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | @@ -183,6 +184,174 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD | ||
183 | } | 184 | } |
184 | } | 185 | } |
185 | 186 | ||
187 | +// ImportDividendsOrder 导入分红订单实体对象 | ||
188 | +func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importDividendsOrderCommand *command.ImportDividendsOrderCommand) (interface{}, error) { | ||
189 | + if err := importDividendsOrderCommand.ValidateCommand(); err != nil { | ||
190 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
191 | + } | ||
192 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
193 | + if err != nil { | ||
194 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
195 | + } | ||
196 | + if err := transactionContext.StartTransaction(); err != nil { | ||
197 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
198 | + } | ||
199 | + defer func() { | ||
200 | + _ = transactionContext.RollbackTransaction() | ||
201 | + }() | ||
202 | + | ||
203 | + // 公司REST服务初始化 | ||
204 | + var companyService service.CompanyService | ||
205 | + if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil { | ||
206 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
207 | + } else { | ||
208 | + companyService = value | ||
209 | + } | ||
210 | + | ||
211 | + // 获取公司信息 | ||
212 | + var company *domain.Company | ||
213 | + if data, err := companyService.CompanyFrom(importDividendsOrderCommand.CompanyId); err != nil { | ||
214 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
215 | + } else { | ||
216 | + company = data | ||
217 | + } | ||
218 | + | ||
219 | + // 组织机构REST服务初始化 | ||
220 | + var organizationService service.OrgService | ||
221 | + if value, err := factory.CreateOrganizationService(map[string]interface{}{}); err != nil { | ||
222 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
223 | + } else { | ||
224 | + organizationService = value | ||
225 | + } | ||
226 | + | ||
227 | + // 获取组织机构信息 | ||
228 | + var organization *domain.Org | ||
229 | + if data, err := organizationService.OrgFrom(importDividendsOrderCommand.CompanyId, importDividendsOrderCommand.OrgId); err != nil { | ||
230 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
231 | + } else { | ||
232 | + organization = data | ||
233 | + } | ||
234 | + | ||
235 | + // 用户REST服务初始化 | ||
236 | + var userService service.UserService | ||
237 | + if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil { | ||
238 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
239 | + } else { | ||
240 | + userService = value | ||
241 | + } | ||
242 | + | ||
243 | + // 获取操作人 | ||
244 | + var operator *domain.User | ||
245 | + if data, err := userService.OperatorFrom(importDividendsOrderCommand.CompanyId, importDividendsOrderCommand.OrgId, importDividendsOrderCommand.UserId); err != nil { | ||
246 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
247 | + } else { | ||
248 | + operator = data | ||
249 | + } | ||
250 | + | ||
251 | + // 分红订单DAO初始化 | ||
252 | + var dividendsOrderDao *dao.DividendsOrderDao | ||
253 | + if value, err := factory.CreateDividendsOrderDao(map[string]interface{}{ | ||
254 | + "transactionContext": transactionContext, | ||
255 | + }); err != nil { | ||
256 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
257 | + } else { | ||
258 | + dividendsOrderDao = value | ||
259 | + } | ||
260 | + | ||
261 | + var dividendsOrderImportFailed []*domain.DividendsOrder | ||
262 | + var dividendsOrderImportSuccesfully []*domain.DividendsOrder | ||
263 | + | ||
264 | + for _, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData { | ||
265 | + // 生成分红订单号 | ||
266 | + dividendsOrderNumber, err := dividendsOrderDao.GenerateDividendsOrderNumber() | ||
267 | + if err != nil { | ||
268 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
269 | + } | ||
270 | + | ||
271 | + // 校验分红订单编号是否唯一 | ||
272 | + numberAvailable, err := dividendsOrderDao.CheckDividendsOrderNumberAvailable(map[string]interface{}{ | ||
273 | + "companyId": importDividendsOrderCommand.CompanyId, | ||
274 | + "orgId": importDividendsOrderCommand.OrgId, | ||
275 | + "dividendsOrderNumber": dividendsOrderNumber, | ||
276 | + }) | ||
277 | + if err != nil { | ||
278 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
279 | + } | ||
280 | + if !numberAvailable { | ||
281 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增分红订单异常") | ||
282 | + } | ||
283 | + | ||
284 | + // 新增订单产品 | ||
285 | + var orderGoods []*domain.OrderGood | ||
286 | + var dividendsOrderAmount float64 | ||
287 | + for _, orderGood := range dividendsOrder.OrderGoods { | ||
288 | + orderGoods = append(orderGoods, &domain.OrderGood{ | ||
289 | + OrderGoodId: 0, | ||
290 | + OrderGoodAmount: orderGood.OrderGoodAmount, | ||
291 | + OrderGoodName: orderGood.OrderGoodName, | ||
292 | + OrderGoodPrice: orderGood.OrderGoodPrice, | ||
293 | + OrderGoodQuantity: orderGood.OrderGoodQuantity, | ||
294 | + DividendsOrderNumber: dividendsOrderNumber, | ||
295 | + DividendsReturnedOrderNumber: "", | ||
296 | + CooperationContractNumber: orderGood.CooperationContractNumber, | ||
297 | + OrderGoodExpense: orderGood.OrderGoodExpense, | ||
298 | + OrgId: importDividendsOrderCommand.OrgId, | ||
299 | + CompanyId: importDividendsOrderCommand.CompanyId, | ||
300 | + CreatedAt: time.Time{}, | ||
301 | + DeletedAt: time.Time{}, | ||
302 | + UpdatedAt: time.Time{}, | ||
303 | + }) | ||
304 | + // 计算分红订单金额 | ||
305 | + dividendsOrderAmount = dividendsOrderAmount + orderGood.OrderGoodAmount | ||
306 | + } | ||
307 | + | ||
308 | + // 新增分红订单 | ||
309 | + newDividendsOrder := &domain.DividendsOrder{ | ||
310 | + DividendsOrderId: 0, | ||
311 | + DividendsOrderNumber: dividendsOrderNumber, | ||
312 | + DividendsOriginalOrderNum: dividendsOrder.DividendsOriginalOrderNum, | ||
313 | + DividendsOrderAmount: dividendsOrderAmount, | ||
314 | + OrderTime: dividendsOrder.OrderTime, | ||
315 | + DividendTime: time.Time{}, | ||
316 | + DividendStatus: domain.TO_BE_DIVIDEND, | ||
317 | + Region: &domain.RegionInfo{ | ||
318 | + RegionNumber: "", | ||
319 | + RegionName: dividendsOrder.RegionName, | ||
320 | + }, | ||
321 | + CustomerName: dividendsOrder.CustomerName, | ||
322 | + Goods: orderGoods, | ||
323 | + Org: organization, | ||
324 | + Company: company, | ||
325 | + CreatedAt: time.Now(), | ||
326 | + DeletedAt: time.Time{}, | ||
327 | + UpdatedAt: time.Time{}, | ||
328 | + OperateTime: time.Now(), | ||
329 | + Operator: operator, | ||
330 | + } | ||
331 | + | ||
332 | + // 分红订单仓储初始化 | ||
333 | + var dividendsOrderRepository domain.DividendsOrderRepository | ||
334 | + if value, err1 := factory.CreateDividendsOrderRepository(map[string]interface{}{ | ||
335 | + "transactionContext": transactionContext, | ||
336 | + }); err1 != nil { | ||
337 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err1.Error()) | ||
338 | + } else { | ||
339 | + dividendsOrderRepository = value | ||
340 | + } | ||
341 | + if dividendsOrderSaved, err2 := dividendsOrderRepository.Save(newDividendsOrder); err2 != nil { | ||
342 | + dividendsOrderImportFailed = append(dividendsOrderImportFailed, newDividendsOrder) | ||
343 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error()) | ||
344 | + } else { | ||
345 | + dividendsOrderImportSuccesfully = append(dividendsOrderImportSuccesfully, dividendsOrderSaved) | ||
346 | + return dividendsOrderSaved, nil | ||
347 | + } | ||
348 | + } | ||
349 | + if err3 := transactionContext.CommitTransaction(); err3 != nil { | ||
350 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err3.Error()) | ||
351 | + } | ||
352 | + return nil, nil | ||
353 | +} | ||
354 | + | ||
186 | // GetDividendsOrder 返回分红订单实体对象 | 355 | // GetDividendsOrder 返回分红订单实体对象 |
187 | func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividendsOrderQuery *query.GetDividendsOrderQuery) (interface{}, error) { | 356 | func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividendsOrderQuery *query.GetDividendsOrderQuery) (interface{}, error) { |
188 | if err := getDividendsOrderQuery.ValidateQuery(); err != nil { | 357 | if err := getDividendsOrderQuery.ValidateQuery(); err != nil { |
@@ -2,36 +2,41 @@ package command | @@ -2,36 +2,41 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "github.com/beego/beego/v2/core/validation" | ||
5 | "reflect" | 6 | "reflect" |
6 | "strings" | 7 | "strings" |
7 | "time" | 8 | "time" |
8 | - | ||
9 | - "github.com/beego/beego/v2/core/validation" | ||
10 | ) | 9 | ) |
11 | 10 | ||
12 | -type ImportDividendsReturnedOrderCommand struct { | 11 | +// DividendsReturnedOrderData 分红退货单数据 |
12 | +type DividendsReturnedOrderData struct { | ||
13 | // 退货金额 | 13 | // 退货金额 |
14 | DividendsReturnedOrderRefund float64 `cname:"退货金额" json:"dividendsReturnedOrderRefund" valid:"Required"` | 14 | DividendsReturnedOrderRefund float64 `cname:"退货金额" json:"dividendsReturnedOrderRefund" valid:"Required"` |
15 | // 退货客户名称 | 15 | // 退货客户名称 |
16 | DividendsReturnedCustomerName string `cname:"退货客户名称" json:"dividendsReturnedCustomerName" valid:"Required"` | 16 | DividendsReturnedCustomerName string `cname:"退货客户名称" json:"dividendsReturnedCustomerName" valid:"Required"` |
17 | // 来源单号,源单号,订单号 | 17 | // 来源单号,源单号,订单号 |
18 | OriginalOrderNum string `cname:"来源单号" json:"originalOrderNum" valid:"Required"` | 18 | OriginalOrderNum string `cname:"来源单号" json:"originalOrderNum" valid:"Required"` |
19 | - // 备注 | ||
20 | - Remarks string `cname:"备注" json:"remarks" valid:"Required"` | ||
21 | // 退货日期 | 19 | // 退货日期 |
22 | DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"` | 20 | DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"` |
23 | // 退货区域名称 | 21 | // 退货区域名称 |
24 | - RegionName string `cname:"退货区域名称" json:"regionName,omitempty"` | 22 | + RegionName string `cname:"退货区域名称" json:"regionName"` |
25 | // 订单产品列表 | 23 | // 订单产品列表 |
26 | - OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` | 24 | + OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods"` |
25 | + // 备注 | ||
26 | + Remarks string `cname:"备注" json:"remarks"` | ||
27 | +} | ||
28 | + | ||
29 | +type ImportDividendsReturnedOrderCommand struct { | ||
30 | + // 分红退货单数据 | ||
31 | + DividendsReturnedOrderData []*DividendsReturnedOrderData `cname:"分红退货单数据列表" json:"dividendsReturnedOrderData" valid:"Required"` | ||
27 | // 公司ID,通过集成REST上下文获取 | 32 | // 公司ID,通过集成REST上下文获取 |
28 | - CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` | 33 | + CompanyId int64 `cname:"公司ID" json:"companyId"` |
29 | // 组织机构ID | 34 | // 组织机构ID |
30 | - OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` | 35 | + OrgId int64 `cname:"组织机构ID" json:"orgId"` |
31 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 36 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
32 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | 37 | + UserId int64 `cname:"用户ID" json:"userId"` |
33 | // 用户基础数据id | 38 | // 用户基础数据id |
34 | - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"` | 39 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
35 | } | 40 | } |
36 | 41 | ||
37 | func (importDividendsReturnedOrderCommand *ImportDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { | 42 | func (importDividendsReturnedOrderCommand *ImportDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { |
@@ -14,13 +14,15 @@ type ListDividendsReturnedOrderQuery struct { | @@ -14,13 +14,15 @@ type ListDividendsReturnedOrderQuery struct { | ||
14 | // 页面大小 | 14 | // 页面大小 |
15 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` | 15 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` |
16 | // 公司ID,通过集成REST上下文获取 | 16 | // 公司ID,通过集成REST上下文获取 |
17 | - CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` | 17 | + CompanyId int64 `cname:"公司ID" json:"companyId"` |
18 | // 组织机构ID | 18 | // 组织机构ID |
19 | - OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` | 19 | + OrgId int64 `cname:"组织机构ID" json:"orgId"` |
20 | + // 关联的组织机构列表 | ||
21 | + OrgIds []int64 `cname:"关联的组织机构列表" json:"orgIds"` | ||
20 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 22 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
21 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | 23 | + UserId int64 `cname:"用户ID" json:"userId"` |
22 | // 用户基础数据id | 24 | // 用户基础数据id |
23 | - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"` | 25 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
24 | } | 26 | } |
25 | 27 | ||
26 | func (listDividendsReturnedOrderQuery *ListDividendsReturnedOrderQuery) Valid(validation *validation.Validation) { | 28 | func (listDividendsReturnedOrderQuery *ListDividendsReturnedOrderQuery) Valid(validation *validation.Validation) { |
@@ -18,13 +18,13 @@ type SearchDividendsReturnedOrderQuery struct { | @@ -18,13 +18,13 @@ type SearchDividendsReturnedOrderQuery struct { | ||
18 | // 页面大小 | 18 | // 页面大小 |
19 | PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"` | 19 | PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"` |
20 | // 公司ID,通过集成REST上下文获取 | 20 | // 公司ID,通过集成REST上下文获取 |
21 | - CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` | 21 | + CompanyId int64 `cname:"公司ID" json:"companyId"` |
22 | // 组织机构ID | 22 | // 组织机构ID |
23 | - OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` | 23 | + OrgId int64 `cname:"组织机构ID" json:"orgId"` |
24 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 24 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
25 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | 25 | + UserId int64 `cname:"用户ID" json:"userId"` |
26 | // 用户基础数据id | 26 | // 用户基础数据id |
27 | - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"` | 27 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
28 | } | 28 | } |
29 | 29 | ||
30 | func (searchDividendsReturnedOrderQuery *SearchDividendsReturnedOrderQuery) Valid(validation *validation.Validation) { | 30 | func (searchDividendsReturnedOrderQuery *SearchDividendsReturnedOrderQuery) Valid(validation *validation.Validation) { |
@@ -131,7 +131,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | @@ -131,7 +131,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | ||
131 | 131 | ||
132 | newDividendsReturnedOrder := &domain.DividendsReturnedOrder{ | 132 | newDividendsReturnedOrder := &domain.DividendsReturnedOrder{ |
133 | DividendsReturnedOrderNumber: dividendsReturnedOrderNumber, | 133 | DividendsReturnedOrderNumber: dividendsReturnedOrderNumber, |
134 | - DividendsReturnedOrderRefund: 0, | 134 | + DividendsReturnedOrderRefund: createDividendsReturnedOrderCommand.DividendsReturnedOrderRefund, |
135 | OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum, | 135 | OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum, |
136 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, | 136 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, |
137 | DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName, | 137 | DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName, |
@@ -44,7 +44,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -44,7 +44,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
44 | // 获取合约 | 44 | // 获取合约 |
45 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractNumber": orderGood.CooperationContractNumber}) | 45 | cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractNumber": orderGood.CooperationContractNumber}) |
46 | if err != nil { | 46 | if err != nil { |
47 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 47 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创合约不存在") |
48 | } | 48 | } |
49 | if cooperationContract == nil { | 49 | if cooperationContract == nil { |
50 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.CooperationContractNumber)) | 50 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.CooperationContractNumber)) |
@@ -55,7 +55,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -55,7 +55,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
55 | "dividendsOrderNumber": orderGood.DividendsOrderNumber, | 55 | "dividendsOrderNumber": orderGood.DividendsOrderNumber, |
56 | }) | 56 | }) |
57 | if err2 != nil { | 57 | if err2 != nil { |
58 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 58 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在") |
59 | } | 59 | } |
60 | if dividendsOrder == nil { | 60 | if dividendsOrder == nil { |
61 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsOrderNumber)) | 61 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsOrderNumber)) |
@@ -68,6 +68,10 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -68,6 +68,10 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
68 | break | 68 | break |
69 | } | 69 | } |
70 | } | 70 | } |
71 | + if dividendsIncentivesRuleMatched == nil { | ||
72 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, "未匹配到分红规则") | ||
73 | + } | ||
74 | + | ||
71 | // 计算分红 | 75 | // 计算分红 |
72 | if dividendsIncentivesRuleMatched != nil { | 76 | if dividendsIncentivesRuleMatched != nil { |
73 | for _, undertaker := range cooperationContract.Undertakers { | 77 | for _, undertaker := range cooperationContract.Undertakers { |
@@ -143,7 +147,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -143,7 +147,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
143 | "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber, | 147 | "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber, |
144 | }) | 148 | }) |
145 | if err3 != nil { | 149 | if err3 != nil { |
146 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 150 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红退货单不存在") |
147 | } | 151 | } |
148 | if dividendsReturnedOrder == nil { | 152 | if dividendsReturnedOrder == nil { |
149 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsReturnedOrderNumber)) | 153 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsReturnedOrderNumber)) |
@@ -23,7 +23,7 @@ type CooperationContractChangeLog struct { | @@ -23,7 +23,7 @@ type CooperationContractChangeLog struct { | ||
23 | Company *domain.Company `comment:"公司"` | 23 | Company *domain.Company `comment:"公司"` |
24 | // 组织机构 | 24 | // 组织机构 |
25 | Org *domain.Org `comment:"组织"` | 25 | Org *domain.Org `comment:"组织"` |
26 | - // 操作人 | 26 | + // |
27 | Operator *domain.User `comment:"操作人"` | 27 | Operator *domain.User `comment:"操作人"` |
28 | // 操作时间 | 28 | // 操作时间 |
29 | OperatorTime time.Time `comment:"操作时间"` | 29 | OperatorTime time.Time `comment:"操作时间"` |
@@ -41,6 +41,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -41,6 +41,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
41 | "org", | 41 | "org", |
42 | "incentives_type", | 42 | "incentives_type", |
43 | "company", | 43 | "company", |
44 | + "department", | ||
44 | "operator", | 45 | "operator", |
45 | "operate_time", | 46 | "operate_time", |
46 | "created_at", | 47 | "created_at", |
@@ -74,6 +75,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -74,6 +75,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
74 | &cooperationContract.Org, | 75 | &cooperationContract.Org, |
75 | &cooperationContract.IncentivesType, | 76 | &cooperationContract.IncentivesType, |
76 | &cooperationContract.Company, | 77 | &cooperationContract.Company, |
78 | + &cooperationContract.Department, | ||
77 | &cooperationContract.Operator, | 79 | &cooperationContract.Operator, |
78 | &cooperationContract.OperateTime, | 80 | &cooperationContract.OperateTime, |
79 | &cooperationContract.CreatedAt, | 81 | &cooperationContract.CreatedAt, |
@@ -93,6 +95,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -93,6 +95,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
93 | cooperationContract.Org, | 95 | cooperationContract.Org, |
94 | cooperationContract.IncentivesType, | 96 | cooperationContract.IncentivesType, |
95 | cooperationContract.Company, | 97 | cooperationContract.Company, |
98 | + cooperationContract.Department, | ||
96 | cooperationContract.Operator, | 99 | cooperationContract.Operator, |
97 | cooperationContract.OperateTime, | 100 | cooperationContract.OperateTime, |
98 | cooperationContract.CreatedAt, | 101 | cooperationContract.CreatedAt, |
@@ -226,6 +229,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -226,6 +229,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
226 | &cooperationContract.Org, | 229 | &cooperationContract.Org, |
227 | &cooperationContract.IncentivesType, | 230 | &cooperationContract.IncentivesType, |
228 | &cooperationContract.Company, | 231 | &cooperationContract.Company, |
232 | + &cooperationContract.Department, | ||
229 | &cooperationContract.Operator, | 233 | &cooperationContract.Operator, |
230 | &cooperationContract.OperateTime, | 234 | &cooperationContract.OperateTime, |
231 | &cooperationContract.CreatedAt, | 235 | &cooperationContract.CreatedAt, |
@@ -245,6 +249,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -245,6 +249,7 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
245 | cooperationContract.Org, | 249 | cooperationContract.Org, |
246 | cooperationContract.IncentivesType, | 250 | cooperationContract.IncentivesType, |
247 | cooperationContract.Company, | 251 | cooperationContract.Company, |
252 | + cooperationContract.Department, | ||
248 | cooperationContract.Operator, | 253 | cooperationContract.Operator, |
249 | cooperationContract.OperateTime, | 254 | cooperationContract.OperateTime, |
250 | cooperationContract.CreatedAt, | 255 | cooperationContract.CreatedAt, |
@@ -670,6 +675,7 @@ func (repository *CooperationContractRepository) UpdateOne(cooperationContract * | @@ -670,6 +675,7 @@ func (repository *CooperationContractRepository) UpdateOne(cooperationContract * | ||
670 | Status: cooperationContract.Status, | 675 | Status: cooperationContract.Status, |
671 | Org: cooperationContract.Org, | 676 | Org: cooperationContract.Org, |
672 | Company: cooperationContract.Company, | 677 | Company: cooperationContract.Company, |
678 | + Department: cooperationContract.Department, | ||
673 | Operator: cooperationContract.Operator, | 679 | Operator: cooperationContract.Operator, |
674 | OperateTime: cooperationContract.OperateTime, | 680 | OperateTime: cooperationContract.OperateTime, |
675 | CreatedAt: cooperationContract.CreatedAt, | 681 | CreatedAt: cooperationContract.CreatedAt, |
@@ -698,6 +704,7 @@ func (repository *CooperationContractRepository) UpdateMany(cooperationContracts | @@ -698,6 +704,7 @@ func (repository *CooperationContractRepository) UpdateMany(cooperationContracts | ||
698 | Status: cooperationContract.Status, | 704 | Status: cooperationContract.Status, |
699 | Org: cooperationContract.Org, | 705 | Org: cooperationContract.Org, |
700 | Company: cooperationContract.Company, | 706 | Company: cooperationContract.Company, |
707 | + Department: cooperationContract.Department, | ||
701 | Operator: cooperationContract.Operator, | 708 | Operator: cooperationContract.Operator, |
702 | OperateTime: cooperationContract.OperateTime, | 709 | OperateTime: cooperationContract.OperateTime, |
703 | CreatedAt: cooperationContract.CreatedAt, | 710 | CreatedAt: cooperationContract.CreatedAt, |
@@ -56,12 +56,12 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -56,12 +56,12 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
56 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) | 56 | updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields) |
57 | tx := repository.transactionContext.PgTx | 57 | tx := repository.transactionContext.PgTx |
58 | if dividendsEstimate.Identify() == nil { | 58 | if dividendsEstimate.Identify() == nil { |
59 | - //dividendsEstimateId, err := repository.nextIdentify() | ||
60 | - //if err != nil { | ||
61 | - // return dividendsEstimate, err | ||
62 | - //} else { | ||
63 | - // dividendsEstimate.DividendsEstimateId = dividendsEstimateId | ||
64 | - //} | 59 | + dividendsEstimateId, err := repository.nextIdentify() |
60 | + if err != nil { | ||
61 | + return dividendsEstimate, err | ||
62 | + } else { | ||
63 | + dividendsEstimate.DividendsEstimateId = dividendsEstimateId | ||
64 | + } | ||
65 | if _, err := tx.QueryOne( | 65 | if _, err := tx.QueryOne( |
66 | pg.Scan( | 66 | pg.Scan( |
67 | ÷ndsEstimate.DividendsEstimateId, | 67 | ÷ndsEstimate.DividendsEstimateId, |
@@ -112,7 +112,10 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | @@ -112,7 +112,10 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | ||
112 | DividendsOrderNumber: good.DividendsOrderNumber, | 112 | DividendsOrderNumber: good.DividendsOrderNumber, |
113 | DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber, | 113 | DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber, |
114 | CooperationContractNumber: good.CooperationContractNumber, | 114 | CooperationContractNumber: good.CooperationContractNumber, |
115 | + CompanyId: good.CompanyId, | ||
116 | + OrgId: good.OrgId, | ||
115 | OrderGoodExpense: good.OrderGoodExpense, | 117 | OrderGoodExpense: good.OrderGoodExpense, |
118 | + OrderGoodDividendsStatus: good.OrderGoodDividendsStatus, | ||
116 | CreatedAt: time.Now(), | 119 | CreatedAt: time.Now(), |
117 | DeletedAt: time.Time{}, | 120 | DeletedAt: time.Time{}, |
118 | UpdatedAt: time.Time{}, | 121 | UpdatedAt: time.Time{}, |
@@ -204,6 +207,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | @@ -204,6 +207,7 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend | ||
204 | OrderGoodExpense: goodDomain.OrderGoodExpense, | 207 | OrderGoodExpense: goodDomain.OrderGoodExpense, |
205 | OrgId: goodDomain.OrgId, | 208 | OrgId: goodDomain.OrgId, |
206 | CompanyId: goodDomain.CompanyId, | 209 | CompanyId: goodDomain.CompanyId, |
210 | + OrderGoodDividendsStatus: goodDomain.OrderGoodDividendsStatus, | ||
207 | CreatedAt: time.Time{}, | 211 | CreatedAt: time.Time{}, |
208 | DeletedAt: time.Time{}, | 212 | DeletedAt: time.Time{}, |
209 | UpdatedAt: time.Now(), | 213 | UpdatedAt: time.Now(), |
@@ -121,6 +121,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder | @@ -121,6 +121,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder | ||
121 | OrderGoodExpense: good.OrderGoodExpense, | 121 | OrderGoodExpense: good.OrderGoodExpense, |
122 | OrgId: good.OrgId, | 122 | OrgId: good.OrgId, |
123 | CompanyId: good.CompanyId, | 123 | CompanyId: good.CompanyId, |
124 | + OrderGoodDividendsStatus: good.OrderGoodDividendsStatus, | ||
124 | CreatedAt: time.Now(), | 125 | CreatedAt: time.Now(), |
125 | DeletedAt: time.Time{}, | 126 | DeletedAt: time.Time{}, |
126 | UpdatedAt: time.Time{}, | 127 | UpdatedAt: time.Time{}, |
@@ -216,6 +217,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder | @@ -216,6 +217,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder | ||
216 | OrderGoodExpense: goodDomain.OrderGoodExpense, | 217 | OrderGoodExpense: goodDomain.OrderGoodExpense, |
217 | OrgId: goodDomain.OrgId, | 218 | OrgId: goodDomain.OrgId, |
218 | CompanyId: goodDomain.CompanyId, | 219 | CompanyId: goodDomain.CompanyId, |
220 | + OrderGoodDividendsStatus: goodDomain.OrderGoodDividendsStatus, | ||
219 | CreatedAt: time.Time{}, | 221 | CreatedAt: time.Time{}, |
220 | DeletedAt: time.Time{}, | 222 | DeletedAt: time.Time{}, |
221 | UpdatedAt: time.Now(), | 223 | UpdatedAt: time.Now(), |
@@ -23,6 +23,19 @@ func (controller *DividendsOrderController) CreateDividendsOrder() { | @@ -23,6 +23,19 @@ func (controller *DividendsOrderController) CreateDividendsOrder() { | ||
23 | controller.Response(data, err) | 23 | controller.Response(data, err) |
24 | } | 24 | } |
25 | 25 | ||
26 | +func (controller *DividendsOrderController) ImportDividendsOrder() { | ||
27 | + dividendsOrderService := service.NewDividendsOrderService(nil) | ||
28 | + importDividendsOrderCommand := &command.ImportDividendsOrderCommand{} | ||
29 | + _ = controller.Unmarshal(importDividendsOrderCommand) | ||
30 | + header := controller.GetRequestHeader(controller.Ctx) | ||
31 | + importDividendsOrderCommand.CompanyId = header.CompanyId | ||
32 | + importDividendsOrderCommand.OrgId = header.OrgId | ||
33 | + importDividendsOrderCommand.UserId = header.UserId | ||
34 | + importDividendsOrderCommand.UserBaseId = header.UserBaseId | ||
35 | + data, err := dividendsOrderService.ImportDividendsOrder(importDividendsOrderCommand) | ||
36 | + controller.Response(data, err) | ||
37 | +} | ||
38 | + | ||
26 | func (controller *DividendsOrderController) UpdateDividendsOrder() { | 39 | func (controller *DividendsOrderController) UpdateDividendsOrder() { |
27 | dividendsOrderService := service.NewDividendsOrderService(nil) | 40 | dividendsOrderService := service.NewDividendsOrderService(nil) |
28 | updateDividendsOrderCommand := &command.UpdateDividendsOrderCommand{} | 41 | updateDividendsOrderCommand := &command.UpdateDividendsOrderCommand{} |
-
请 注册 或 登录 后发表评论