作者 陈志颖

refactor:共创项目优化

... ... @@ -13,14 +13,6 @@ type ReleaseCooperationProjectCommand struct {
CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"`
// 共创模式ID
CooperationModeId int64 `cname:"共创模式ID" json:"cooperationModeId" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId" valid:"Required"`
// 用户基本id
UserBaseId int64 `cname:"用户基本数据ID" json:"userBaseId" valid:"Required"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"`
// 共创项目发起人id
CooperationProjectSponsorId string `cname:"共创项目发起人UID" json:"cooperationProjectSponsorId" valid:"Required"`
// 部门ID,通过REST集成上下文获取
... ... @@ -29,6 +21,14 @@ type ReleaseCooperationProjectCommand struct {
CooperationProjectUndertakerType []int32 `cname:"共创项目承接对象" json:"cooperationProjectUndertakerType" valid:"Required"`
// 共创项目描述
CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基本id
UserBaseId int64 `cname:"用户基本数据ID" json:"userBaseId"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId"`
}
func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -68,23 +68,23 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
// 获取操作人
var operator *domain.User
if data, err := userService.OperatorFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.UserId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败")
} else {
operator = data
}
// Sponsor
// 获取发起人
var sponsor *domain.User
if data, err := userService.UserFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.SponsorUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发起人失败")
} else {
sponsor = data
}
// Publisher
// 获取发布人
var publisher *domain.User
if data, err := userService.UserFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId, createCooperationProjectCommand.PublisherUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发布人失败")
} else {
publisher = data
}
... ... @@ -100,7 +100,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
// 获取公司信息
var company *domain.Company
if data, err := companyService.CompanyFrom(createCooperationProjectCommand.CompanyId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取公司信息失败")
} else {
company = data
}
... ... @@ -116,15 +116,15 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
// 获取组织机构信息
var organization *domain.Org
if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.OrgId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取组织机构信息失败")
} else {
organization = data
}
// 获取组织机构信息
// 获取部门信息
var department *domain.Org
if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.DepartmentId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息失败")
} else {
department = data
}
... ...