作者 yangfu

共创项目列表修改

@@ -2,6 +2,7 @@ package command @@ -2,6 +2,7 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
5 "reflect" 6 "reflect"
6 "strings" 7 "strings"
7 8
@@ -21,6 +22,8 @@ type CreateCooperationProjectCommand struct { @@ -21,6 +22,8 @@ type CreateCooperationProjectCommand struct {
21 PublisherUid string `cname:"共创项目发布人UID" json:"publisherUid" valid:"Required"` 22 PublisherUid string `cname:"共创项目发布人UID" json:"publisherUid" valid:"Required"`
22 // 共创项目描述 23 // 共创项目描述
23 CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription,omitempty"` 24 CooperationProjectDescription string `cname:"共创项目描述" json:"cooperationProjectDescription,omitempty"`
  25 + // 附件
  26 + Attachment []*domain.Attachment `json:"attachment"`
24 // 公司ID,通过集成REST上下文获取 27 // 公司ID,通过集成REST上下文获取
25 CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` 28 CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
26 // 组织机构ID 29 // 组织机构ID
@@ -135,7 +135,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro @@ -135,7 +135,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
135 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationProjectCommand.CooperationModeNumber)) 135 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationProjectCommand.CooperationModeNumber))
136 } else { 136 } else {
137 newCooperationProject := &domain.CooperationProject{ 137 newCooperationProject := &domain.CooperationProject{
138 - CooperationProjectNumber: createCooperationProjectCommand.CooperationModeNumber, 138 + CooperationProjectNumber: fmt.Sprintf("%v", time.Now().UnixNano()), //TODO:项目编码生成
139 CooperationProjectName: createCooperationProjectCommand.CooperationProjectName, 139 CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
140 CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes, 140 CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes,
141 CooperationProjectSponsor: sponsor, 141 CooperationProjectSponsor: sponsor,
@@ -143,6 +143,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro @@ -143,6 +143,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
143 CooperationProjectPublisher: publisher, 143 CooperationProjectPublisher: publisher,
144 CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription, 144 CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription,
145 CooperationProjectPublishTime: time.Now(), 145 CooperationProjectPublishTime: time.Now(),
  146 + Attachment: createCooperationProjectCommand.Attachment,
146 Company: company, 147 Company: company,
147 Department: organization.ToDepartment(), 148 Department: organization.ToDepartment(),
148 Org: organization, 149 Org: organization,
@@ -71,90 +71,90 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{} @@ -71,90 +71,90 @@ func (cooperationProject *CooperationProject) Update(data map[string]interface{}
71 if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok { 71 if cooperationProjectPublishTime, ok := data["cooperationProjectPublishTime"]; ok {
72 cooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time) 72 cooperationProject.CooperationProjectPublishTime = cooperationProjectPublishTime.(time.Time)
73 } 73 }
74 - if userId, ok := data["userId"]; ok {  
75 - cooperationProject.CooperationProjectPublisher.UserId = userId.(int64)  
76 - }  
77 - if userBaseId, ok := data["userBaseId"]; ok {  
78 - cooperationProject.CooperationProjectPublisher.UserBaseId = userBaseId.(int64)  
79 - }  
80 - if orgId, ok := data["orgId"]; ok {  
81 - cooperationProject.CooperationProjectPublisher.Org.OrgId = orgId.(int64)  
82 - }  
83 - if orgName, ok := data["orgName"]; ok {  
84 - cooperationProject.CooperationProjectPublisher.Org.OrgName = orgName.(string)  
85 - }  
86 - if companyId, ok := data["companyId"]; ok {  
87 - cooperationProject.CooperationProjectPublisher.Org.Company.CompanyId = companyId.(int64)  
88 - }  
89 - if companyLogo, ok := data["companyLogo"]; ok {  
90 - cooperationProject.CooperationProjectPublisher.Org.Company.CompanyLogo = companyLogo.(string)  
91 - }  
92 - if companyName, ok := data["companyName"]; ok {  
93 - cooperationProject.CooperationProjectPublisher.Org.Company.CompanyName = companyName.(string)  
94 - }  
95 - if orgs, ok := data["orgs"]; ok {  
96 - cooperationProject.CooperationProjectPublisher.Orgs = orgs.([]*Org)  
97 - }  
98 - if departmentId, ok := data["departmentId"]; ok {  
99 - cooperationProject.CooperationProjectPublisher.Department.DepartmentId = departmentId.(int64)  
100 - }  
101 - if departmentName, ok := data["departmentName"]; ok {  
102 - cooperationProject.CooperationProjectPublisher.Department.DepartmentName = departmentName.(string)  
103 - }  
104 - if departmentNumber, ok := data["departmentNumber"]; ok {  
105 - cooperationProject.CooperationProjectPublisher.Department.DepartmentNumber = departmentNumber.(string)  
106 - }  
107 - if isOrganization, ok := data["isOrganization"]; ok {  
108 - cooperationProject.CooperationProjectPublisher.Department.IsOrganization = isOrganization.(bool)  
109 - }  
110 - if userAvatar, ok := data["userAvatar"]; ok {  
111 - cooperationProject.CooperationProjectPublisher.UserInfo.UserAvatar = userAvatar.(string)  
112 - }  
113 - if userEmail, ok := data["userEmail"]; ok {  
114 - cooperationProject.CooperationProjectPublisher.UserInfo.UserEmail = userEmail.(string)  
115 - }  
116 - if userName, ok := data["userName"]; ok {  
117 - cooperationProject.CooperationProjectPublisher.UserInfo.UserName = userName.(string)  
118 - }  
119 - if userPhone, ok := data["userPhone"]; ok {  
120 - cooperationProject.CooperationProjectPublisher.UserInfo.UserPhone = userPhone.(string)  
121 - }  
122 - if userAccount, ok := data["userAccount"]; ok {  
123 - cooperationProject.CooperationProjectPublisher.UserInfo.UserAccount = userAccount.(string)  
124 - }  
125 - if userType, ok := data["userType"]; ok {  
126 - cooperationProject.CooperationProjectPublisher.UserType = userType.(int32)  
127 - }  
128 - if status, ok := data["status"]; ok {  
129 - cooperationProject.CooperationProjectPublisher.Status = status.(int32)  
130 - }  
131 - if companyId, ok := data["companyId"]; ok {  
132 - cooperationProject.CooperationProjectPublisher.Company.CompanyId = companyId.(int64)  
133 - }  
134 - if companyLogo, ok := data["companyLogo"]; ok {  
135 - cooperationProject.CooperationProjectPublisher.Company.CompanyLogo = companyLogo.(string)  
136 - }  
137 - if companyName, ok := data["companyName"]; ok {  
138 - cooperationProject.CooperationProjectPublisher.Company.CompanyName = companyName.(string)  
139 - }  
140 - if userId, ok := data["userId"]; ok {  
141 - cooperationProject.CooperationProjectSponsor.UserId = userId.(int64)  
142 - }  
143 - if userBaseId, ok := data["userBaseId"]; ok {  
144 - cooperationProject.CooperationProjectSponsor.UserBaseId = userBaseId.(int64)  
145 - }  
146 - if orgId, ok := data["orgId"]; ok {  
147 - cooperationProject.CooperationProjectSponsor.Org.OrgId = orgId.(int64)  
148 - }  
149 - if orgName, ok := data["orgName"]; ok {  
150 - cooperationProject.CooperationProjectSponsor.Org.OrgName = orgName.(string)  
151 - }  
152 - if companyId, ok := data["companyId"]; ok {  
153 - cooperationProject.CooperationProjectSponsor.Company.CompanyId = companyId.(int64)  
154 - }  
155 - if cooperationProjectUndertakerType, ok := data["cooperationProjectUndertakerType"]; ok {  
156 - cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerType.([]int32)  
157 - } 74 + //if userId, ok := data["userId"]; ok {
  75 + // cooperationProject.CooperationProjectPublisher.UserId = userId.(int64)
  76 + //}
  77 + //if userBaseId, ok := data["userBaseId"]; ok {
  78 + // cooperationProject.CooperationProjectPublisher.UserBaseId = userBaseId.(int64)
  79 + //}
  80 + //if orgId, ok := data["orgId"]; ok {
  81 + // cooperationProject.CooperationProjectPublisher.Org.OrgId = orgId.(int64)
  82 + //}
  83 + //if orgName, ok := data["orgName"]; ok {
  84 + // cooperationProject.CooperationProjectPublisher.Org.OrgName = orgName.(string)
  85 + //}
  86 + //if companyId, ok := data["companyId"]; ok {
  87 + // cooperationProject.CooperationProjectPublisher.Org.Company.CompanyId = companyId.(int64)
  88 + //}
  89 + //if companyLogo, ok := data["companyLogo"]; ok {
  90 + // cooperationProject.CooperationProjectPublisher.Org.Company.CompanyLogo = companyLogo.(string)
  91 + //}
  92 + //if companyName, ok := data["companyName"]; ok {
  93 + // cooperationProject.CooperationProjectPublisher.Org.Company.CompanyName = companyName.(string)
  94 + //}
  95 + //if orgs, ok := data["orgs"]; ok {
  96 + // cooperationProject.CooperationProjectPublisher.Orgs = orgs.([]*Org)
  97 + //}
  98 + //if departmentId, ok := data["departmentId"]; ok {
  99 + // cooperationProject.CooperationProjectPublisher.Department.DepartmentId = departmentId.(int64)
  100 + //}
  101 + //if departmentName, ok := data["departmentName"]; ok {
  102 + // cooperationProject.CooperationProjectPublisher.Department.DepartmentName = departmentName.(string)
  103 + //}
  104 + //if departmentNumber, ok := data["departmentNumber"]; ok {
  105 + // cooperationProject.CooperationProjectPublisher.Department.DepartmentNumber = departmentNumber.(string)
  106 + //}
  107 + //if isOrganization, ok := data["isOrganization"]; ok {
  108 + // cooperationProject.CooperationProjectPublisher.Department.IsOrganization = isOrganization.(bool)
  109 + //}
  110 + //if userAvatar, ok := data["userAvatar"]; ok {
  111 + // cooperationProject.CooperationProjectPublisher.UserInfo.UserAvatar = userAvatar.(string)
  112 + //}
  113 + //if userEmail, ok := data["userEmail"]; ok {
  114 + // cooperationProject.CooperationProjectPublisher.UserInfo.UserEmail = userEmail.(string)
  115 + //}
  116 + //if userName, ok := data["userName"]; ok {
  117 + // cooperationProject.CooperationProjectPublisher.UserInfo.UserName = userName.(string)
  118 + //}
  119 + //if userPhone, ok := data["userPhone"]; ok {
  120 + // cooperationProject.CooperationProjectPublisher.UserInfo.UserPhone = userPhone.(string)
  121 + //}
  122 + //if userAccount, ok := data["userAccount"]; ok {
  123 + // cooperationProject.CooperationProjectPublisher.UserInfo.UserAccount = userAccount.(string)
  124 + //}
  125 + //if userType, ok := data["userType"]; ok {
  126 + // cooperationProject.CooperationProjectPublisher.UserType = userType.(int32)
  127 + //}
  128 + //if status, ok := data["status"]; ok {
  129 + // cooperationProject.CooperationProjectPublisher.Status = status.(int32)
  130 + //}
  131 + //if companyId, ok := data["companyId"]; ok {
  132 + // cooperationProject.CooperationProjectPublisher.Company.CompanyId = companyId.(int64)
  133 + //}
  134 + //if companyLogo, ok := data["companyLogo"]; ok {
  135 + // cooperationProject.CooperationProjectPublisher.Company.CompanyLogo = companyLogo.(string)
  136 + //}
  137 + //if companyName, ok := data["companyName"]; ok {
  138 + // cooperationProject.CooperationProjectPublisher.Company.CompanyName = companyName.(string)
  139 + //}
  140 + //if userId, ok := data["userId"]; ok {
  141 + // cooperationProject.CooperationProjectSponsor.UserId = userId.(int64)
  142 + //}
  143 + //if userBaseId, ok := data["userBaseId"]; ok {
  144 + // cooperationProject.CooperationProjectSponsor.UserBaseId = userBaseId.(int64)
  145 + //}
  146 + //if orgId, ok := data["orgId"]; ok {
  147 + // cooperationProject.CooperationProjectSponsor.Org.OrgId = orgId.(int64)
  148 + //}
  149 + //if orgName, ok := data["orgName"]; ok {
  150 + // cooperationProject.CooperationProjectSponsor.Org.OrgName = orgName.(string)
  151 + //}
  152 + //if companyId, ok := data["companyId"]; ok {
  153 + // cooperationProject.CooperationProjectSponsor.Company.CompanyId = companyId.(int64)
  154 + //}
  155 + //if cooperationProjectUndertakerType, ok := data["cooperationProjectUndertakerType"]; ok {
  156 + // cooperationProject.CooperationProjectUndertakerTypes = cooperationProjectUndertakerType.([]int32)
  157 + //}
158 if operateTime, ok := data["operateTime"]; ok { 158 if operateTime, ok := data["operateTime"]; ok {
159 cooperationProject.OperateTime = operateTime.(time.Time) 159 cooperationProject.OperateTime = operateTime.(time.Time)
160 } 160 }
@@ -37,6 +37,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -37,6 +37,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
37 "cooperation_mode_number", 37 "cooperation_mode_number",
38 "department", 38 "department",
39 "cooperation_project_undertaker_types", 39 "cooperation_project_undertaker_types",
  40 + "attachment",
40 "org", 41 "org",
41 "company", 42 "company",
42 "operator", 43 "operator",
@@ -71,6 +72,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -71,6 +72,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
71 &cooperationProject.CooperationMode.CooperationModeNumber, 72 &cooperationProject.CooperationMode.CooperationModeNumber,
72 &cooperationProject.Department, 73 &cooperationProject.Department,
73 pg.Array(&cooperationProject.CooperationProjectUndertakerTypes), 74 pg.Array(&cooperationProject.CooperationProjectUndertakerTypes),
  75 + &cooperationProject.Attachment,
74 &cooperationProject.Org, 76 &cooperationProject.Org,
75 &cooperationProject.Company, 77 &cooperationProject.Company,
76 &cooperationProject.Operator, 78 &cooperationProject.Operator,
@@ -91,6 +93,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -91,6 +93,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
91 cooperationProject.CooperationMode.CooperationModeNumber, 93 cooperationProject.CooperationMode.CooperationModeNumber,
92 cooperationProject.Department, 94 cooperationProject.Department,
93 pg.Array(cooperationProject.CooperationProjectUndertakerTypes), 95 pg.Array(cooperationProject.CooperationProjectUndertakerTypes),
  96 + cooperationProject.Attachment,
94 cooperationProject.Org, 97 cooperationProject.Org,
95 cooperationProject.Company, 98 cooperationProject.Company,
96 cooperationProject.Operator, 99 cooperationProject.Operator,
@@ -115,6 +118,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -115,6 +118,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
115 &cooperationProject.CooperationMode.CooperationModeNumber, 118 &cooperationProject.CooperationMode.CooperationModeNumber,
116 &cooperationProject.Department, 119 &cooperationProject.Department,
117 pg.Array(&cooperationProject.CooperationProjectUndertakerTypes), 120 pg.Array(&cooperationProject.CooperationProjectUndertakerTypes),
  121 + &cooperationProject.Attachment,
118 &cooperationProject.Org, 122 &cooperationProject.Org,
119 &cooperationProject.Company, 123 &cooperationProject.Company,
120 &cooperationProject.Operator, 124 &cooperationProject.Operator,
@@ -135,6 +139,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain. @@ -135,6 +139,7 @@ func (repository *CooperationProjectRepository) Save(cooperationProject *domain.
135 cooperationProject.CooperationMode.CooperationModeNumber, 139 cooperationProject.CooperationMode.CooperationModeNumber,
136 cooperationProject.Department, 140 cooperationProject.Department,
137 pg.Array(cooperationProject.CooperationProjectUndertakerTypes), 141 pg.Array(cooperationProject.CooperationProjectUndertakerTypes),
  142 + cooperationProject.Attachment,
138 cooperationProject.Org, 143 cooperationProject.Org,
139 cooperationProject.Company, 144 cooperationProject.Company,
140 cooperationProject.Operator, 145 cooperationProject.Operator,