作者 陈志颖

fix:更新共创项目

@@ -469,6 +469,36 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -469,6 +469,36 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
469 cooperationApplicationRepository = value 469 cooperationApplicationRepository = value
470 } 470 }
471 471
  472 + // 用户REST服务初始化
  473 + var userService service.UserService
  474 + if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
  475 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  476 + } else {
  477 + userService = value
  478 + }
  479 +
  480 + // 获取操作人
  481 + var operator *domain.User
  482 + if data, err := userService.OperatorFrom(updateCooperationProjectCommand.CompanyId, updateCooperationProjectCommand.OrgId, updateCooperationProjectCommand.UserId); err != nil {
  483 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败")
  484 + } else {
  485 + operator = data
  486 + }
  487 +
  488 + // 获取发起人
  489 + var sponsor *domain.User
  490 + // sponsorUid类型转换
  491 + sponsorUid, err := strconv.ParseInt(updateCooperationProjectCommand.SponsorUid, 10, 64)
  492 + if err != nil {
  493 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  494 + }
  495 +
  496 + if data, err := userService.UserFrom(updateCooperationProjectCommand.CompanyId, updateCooperationProjectCommand.OrgId, sponsorUid); err != nil {
  497 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发起人失败")
  498 + } else {
  499 + sponsor = data
  500 + }
  501 +
472 // 共创项目ID类型转换 502 // 共创项目ID类型转换
473 cooperationProjectId, err := strconv.ParseInt(updateCooperationProjectCommand.CooperationProjectId, 10, 64) 503 cooperationProjectId, err := strconv.ParseInt(updateCooperationProjectCommand.CooperationProjectId, 10, 64)
474 if err != nil { 504 if err != nil {
@@ -493,7 +523,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -493,7 +523,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
493 "cooperationProjectNumber": cooperationProject.CooperationProjectNumber, 523 "cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
494 "offsetLimit": false, 524 "offsetLimit": false,
495 "companyId": updateCooperationProjectCommand.CompanyId, 525 "companyId": updateCooperationProjectCommand.CompanyId,
496 - "cooperationApplicationStatus": 2, // 共创申请审核状态,1待审核,2已同意,3已拒绝 526 + "cooperationApplicationStatus": int32(2), // 共创申请审核状态,1待审核,2已同意,3已拒绝
497 }); err != nil { 527 }); err != nil {
498 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 528 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
499 } else { 529 } else {
@@ -534,6 +564,8 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -534,6 +564,8 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
534 } 564 }
535 565
536 // 更新共创项目 566 // 更新共创项目
  567 + cooperationProject.Operator = operator
  568 + cooperationProject.CooperationProjectSponsor = sponsor
537 if err := cooperationProject.Update(tool_funs.SimpleStructToMap(updateCooperationProjectCommand)); err != nil { 569 if err := cooperationProject.Update(tool_funs.SimpleStructToMap(updateCooperationProjectCommand)); err != nil {
538 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 570 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
539 } 571 }