作者 陈志颖

fix:更新共创项目

... ... @@ -469,6 +469,36 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
cooperationApplicationRepository = value
}
// 用户REST服务初始化
var userService service.UserService
if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
userService = value
}
// 获取操作人
var operator *domain.User
if data, err := userService.OperatorFrom(updateCooperationProjectCommand.CompanyId, updateCooperationProjectCommand.OrgId, updateCooperationProjectCommand.UserId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败")
} else {
operator = data
}
// 获取发起人
var sponsor *domain.User
// sponsorUid类型转换
sponsorUid, err := strconv.ParseInt(updateCooperationProjectCommand.SponsorUid, 10, 64)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if data, err := userService.UserFrom(updateCooperationProjectCommand.CompanyId, updateCooperationProjectCommand.OrgId, sponsorUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发起人失败")
} else {
sponsor = data
}
// 共创项目ID类型转换
cooperationProjectId, err := strconv.ParseInt(updateCooperationProjectCommand.CooperationProjectId, 10, 64)
if err != nil {
... ... @@ -493,7 +523,7 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
"offsetLimit": false,
"companyId": updateCooperationProjectCommand.CompanyId,
"cooperationApplicationStatus": 2, // 共创申请审核状态,1待审核,2已同意,3已拒绝
"cooperationApplicationStatus": int32(2), // 共创申请审核状态,1待审核,2已同意,3已拒绝
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ... @@ -534,6 +564,8 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
}
// 更新共创项目
cooperationProject.Operator = operator
cooperationProject.CooperationProjectSponsor = sponsor
if err := cooperationProject.Update(tool_funs.SimpleStructToMap(updateCooperationProjectCommand)); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ...