作者 陈志颖

refactor:共创项目优化

@@ -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 }