作者 yangfu

共创项目列表修改

... ... @@ -2,6 +2,7 @@ package command
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"reflect"
"strings"
... ... @@ -21,6 +22,8 @@ type CreateCooperationProjectCommand struct {
PublisherUid string `cname:"共创项目发布人UID" json:"publisherUid" valid:"Required"`
// 共创项目描述
CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription,omitempty"`
// 附件
Attachment []*domain.Attachment `json:"attachment"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构ID
... ...
... ... @@ -135,7 +135,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationProjectCommand.CooperationModeNumber))
} else {
newCooperationProject := &domain.CooperationProject{
CooperationProjectNumber: createCooperationProjectCommand.CooperationModeNumber,
CooperationProjectNumber: fmt.Sprintf("%v", time.Now().UnixNano()), //TODO:项目编码生成
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes,
CooperationProjectSponsor: sponsor,
... ... @@ -143,6 +143,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
CooperationProjectPublisher: publisher,
CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription,
CooperationProjectPublishTime: time.Now(),
Attachment: createCooperationProjectCommand.Attachment,
Company: company,
Department: organization.ToDepartment(),
Org: organization,
... ...
... ... @@ -71,90 +71,90 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{}
if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok {
cooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time)
}
if userId, ok := data["userId"]; ok {
cooperationProject.CooperationProjectPublisher.UserId = userId.(int64)
}
if userBaseId, ok := data["userBaseId"]; ok {
cooperationProject.CooperationProjectPublisher.UserBaseId = userBaseId.(int64)
}
if orgId, ok := data["orgId"]; ok {
cooperationProject.CooperationProjectPublisher.Org.OrgId = orgId.(int64)
}
if orgName, ok := data["orgName"]; ok {
cooperationProject.CooperationProjectPublisher.Org.OrgName = orgName.(string)
}
if companyId, ok := data["companyId"]; ok {
cooperationProject.CooperationProjectPublisher.Org.Company.CompanyId = companyId.(int64)
}
if companyLogo, ok := data["companyLogo"]; ok {
cooperationProject.CooperationProjectPublisher.Org.Company.CompanyLogo = companyLogo.(string)
}
if companyName, ok := data["companyName"]; ok {
cooperationProject.CooperationProjectPublisher.Org.Company.CompanyName = companyName.(string)
}
if orgs, ok := data["orgs"]; ok {
cooperationProject.CooperationProjectPublisher.Orgs = orgs.([]*Org)
}
if departmentId, ok := data["departmentId"]; ok {
cooperationProject.CooperationProjectPublisher.Department.DepartmentId = departmentId.(int64)
}
if departmentName, ok := data["departmentName"]; ok {
cooperationProject.CooperationProjectPublisher.Department.DepartmentName = departmentName.(string)
}
if departmentNumber, ok := data["departmentNumber"]; ok {
cooperationProject.CooperationProjectPublisher.Department.DepartmentNumber = departmentNumber.(string)
}
if isOrganization, ok := data["isOrganization"]; ok {
cooperationProject.CooperationProjectPublisher.Department.IsOrganization = isOrganization.(bool)
}
if userAvatar, ok := data["userAvatar"]; ok {
cooperationProject.CooperationProjectPublisher.UserInfo.UserAvatar = userAvatar.(string)
}
if userEmail, ok := data["userEmail"]; ok {
cooperationProject.CooperationProjectPublisher.UserInfo.UserEmail = userEmail.(string)
}
if userName, ok := data["userName"]; ok {
cooperationProject.CooperationProjectPublisher.UserInfo.UserName = userName.(string)
}
if userPhone, ok := data["userPhone"]; ok {
cooperationProject.CooperationProjectPublisher.UserInfo.UserPhone = userPhone.(string)
}
if userAccount, ok := data["userAccount"]; ok {
cooperationProject.CooperationProjectPublisher.UserInfo.UserAccount = userAccount.(string)
}
if userType, ok := data["userType"]; ok {
cooperationProject.CooperationProjectPublisher.UserType = userType.(int32)
}
if status, ok := data["status"]; ok {
cooperationProject.CooperationProjectPublisher.Status = status.(int32)
}
if companyId, ok := data["companyId"]; ok {
cooperationProject.CooperationProjectPublisher.Company.CompanyId = companyId.(int64)
}
if companyLogo, ok := data["companyLogo"]; ok {
cooperationProject.CooperationProjectPublisher.Company.CompanyLogo = companyLogo.(string)
}
if companyName, ok := data["companyName"]; ok {
cooperationProject.CooperationProjectPublisher.Company.CompanyName = companyName.(string)
}
if userId, ok := data["userId"]; ok {
cooperationProject.CooperationProjectSponsor.UserId = userId.(int64)
}
if userBaseId, ok := data["userBaseId"]; ok {
cooperationProject.CooperationProjectSponsor.UserBaseId = userBaseId.(int64)
}
if orgId, ok := data["orgId"]; ok {
cooperationProject.CooperationProjectSponsor.Org.OrgId = orgId.(int64)
}
if orgName, ok := data["orgName"]; ok {
cooperationProject.CooperationProjectSponsor.Org.OrgName = orgName.(string)
}
if companyId, ok := data["companyId"]; ok {
cooperationProject.CooperationProjectSponsor.Company.CompanyId = companyId.(int64)
}
if cooperationProjectUndertakerType, ok := data["cooperationProjectUndertakerType"]; ok {
cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerType.([]int32)
}
//if userId, ok := data["userId"]; ok {
// cooperationProject.CooperationProjectPublisher.UserId = userId.(int64)
//}
//if userBaseId, ok := data["userBaseId"]; ok {
// cooperationProject.CooperationProjectPublisher.UserBaseId = userBaseId.(int64)
//}
//if orgId, ok := data["orgId"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.OrgId = orgId.(int64)
//}
//if orgName, ok := data["orgName"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.OrgName = orgName.(string)
//}
//if companyId, ok := data["companyId"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.Company.CompanyId = companyId.(int64)
//}
//if companyLogo, ok := data["companyLogo"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.Company.CompanyLogo = companyLogo.(string)
//}
//if companyName, ok := data["companyName"]; ok {
// cooperationProject.CooperationProjectPublisher.Org.Company.CompanyName = companyName.(string)
//}
//if orgs, ok := data["orgs"]; ok {
// cooperationProject.CooperationProjectPublisher.Orgs = orgs.([]*Org)
//}
//if departmentId, ok := data["departmentId"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.DepartmentId = departmentId.(int64)
//}
//if departmentName, ok := data["departmentName"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.DepartmentName = departmentName.(string)
//}
//if departmentNumber, ok := data["departmentNumber"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.DepartmentNumber = departmentNumber.(string)
//}
//if isOrganization, ok := data["isOrganization"]; ok {
// cooperationProject.CooperationProjectPublisher.Department.IsOrganization = isOrganization.(bool)
//}
//if userAvatar, ok := data["userAvatar"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserAvatar = userAvatar.(string)
//}
//if userEmail, ok := data["userEmail"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserEmail = userEmail.(string)
//}
//if userName, ok := data["userName"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserName = userName.(string)
//}
//if userPhone, ok := data["userPhone"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserPhone = userPhone.(string)
//}
//if userAccount, ok := data["userAccount"]; ok {
// cooperationProject.CooperationProjectPublisher.UserInfo.UserAccount = userAccount.(string)
//}
//if userType, ok := data["userType"]; ok {
// cooperationProject.CooperationProjectPublisher.UserType = userType.(int32)
//}
//if status, ok := data["status"]; ok {
// cooperationProject.CooperationProjectPublisher.Status = status.(int32)
//}
//if companyId, ok := data["companyId"]; ok {
// cooperationProject.CooperationProjectPublisher.Company.CompanyId = companyId.(int64)
//}
//if companyLogo, ok := data["companyLogo"]; ok {
// cooperationProject.CooperationProjectPublisher.Company.CompanyLogo = companyLogo.(string)
//}
//if companyName, ok := data["companyName"]; ok {
// cooperationProject.CooperationProjectPublisher.Company.CompanyName = companyName.(string)
//}
//if userId, ok := data["userId"]; ok {
// cooperationProject.CooperationProjectSponsor.UserId = userId.(int64)
//}
//if userBaseId, ok := data["userBaseId"]; ok {
// cooperationProject.CooperationProjectSponsor.UserBaseId = userBaseId.(int64)
//}
//if orgId, ok := data["orgId"]; ok {
// cooperationProject.CooperationProjectSponsor.Org.OrgId = orgId.(int64)
//}
//if orgName, ok := data["orgName"]; ok {
// cooperationProject.CooperationProjectSponsor.Org.OrgName = orgName.(string)
//}
//if companyId, ok := data["companyId"]; ok {
// cooperationProject.CooperationProjectSponsor.Company.CompanyId = companyId.(int64)
//}
//if cooperationProjectUndertakerType, ok := data["cooperationProjectUndertakerType"]; ok {
// cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerType.([]int32)
//}
if operateTime, ok := data["operateTime"]; ok {
cooperationProject.OperateTime = operateTime.(time.Time)
}
... ...
... ... @@ -37,6 +37,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
"cooperation_mode_number",
"department",
"cooperation_project_undertaker_types",
"attachment",
"org",
"company",
"operator",
... ... @@ -71,6 +72,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
&cooperationProject.CooperationMode.CooperationModeNumber,
&cooperationProject.Department,
pg.Array(&cooperationProject.CooperationProjectUndertakerTypes),
&cooperationProject.Attachment,
&cooperationProject.Org,
&cooperationProject.Company,
&cooperationProject.Operator,
... ... @@ -91,6 +93,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
cooperationProject.CooperationMode.CooperationModeNumber,
cooperationProject.Department,
pg.Array(cooperationProject.CooperationProjectUndertakerTypes),
cooperationProject.Attachment,
cooperationProject.Org,
cooperationProject.Company,
cooperationProject.Operator,
... ... @@ -115,6 +118,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
&cooperationProject.CooperationMode.CooperationModeNumber,
&cooperationProject.Department,
pg.Array(&cooperationProject.CooperationProjectUndertakerTypes),
&cooperationProject.Attachment,
&cooperationProject.Org,
&cooperationProject.Company,
&cooperationProject.Operator,
... ... @@ -135,6 +139,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
cooperationProject.CooperationMode.CooperationModeNumber,
cooperationProject.Department,
pg.Array(cooperationProject.CooperationProjectUndertakerTypes),
cooperationProject.Attachment,
cooperationProject.Org,
cooperationProject.Company,
cooperationProject.Operator,
... ...