作者 yangfu

导入修改

1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
4 "strconv" 6 "strconv"
5 7
6 "github.com/linmadan/egglib-go/core/application" 8 "github.com/linmadan/egglib-go/core/application"
@@ -103,16 +105,16 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm @@ -103,16 +105,16 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm
103 105
104 // PersonSearchCooperationProject 共创用户获取共创项目列表 106 // PersonSearchCooperationProject 共创用户获取共创项目列表
105 func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) { 107 func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) {
  108 + extQueries := extQuires(projectQuery.Operator)
106 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 109 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
107 projectQuery.Operator) 110 projectQuery.Operator)
108 - //orgidStr := strconv.Itoa(projectQuery.OrgId)  
109 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 111 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
110 - PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的  
111 - PageSize: projectQuery.PageSize,  
112 - OrgId: projectQuery.OrgId,  
113 - Status: 1, //搜索状态为“招标中”项目  
114 - Keyword: projectQuery.Keyword,  
115 - //UserBaseId: projectQuery.Operator.UserBaseId, 112 + PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的
  113 + PageSize: projectQuery.PageSize,
  114 + OrgId: projectQuery.OrgId,
  115 + Status: 1, //搜索状态为“招标中”项目
  116 + Keyword: projectQuery.Keyword,
  117 + SearchCooperationProjectExtQueries: extQueries,
116 }) 118 })
117 if err != nil { 119 if err != nil {
118 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 120 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -120,6 +122,39 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery @@ -120,6 +122,39 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery
120 return int(result.Total), result.List, nil 122 return int(result.Total), result.List, nil
121 } 123 }
122 124
  125 +func extQuires(operator domain.Operator) []*allied_creation_cooperation.SearchCooperationProjectExtQuery {
  126 + var extQueries = make([]*allied_creation_cooperation.SearchCooperationProjectExtQuery, 0)
  127 + if operator.UserBaseId > 0 {
  128 + gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
  129 + operator)
  130 + users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
  131 + Limit: 100,
  132 + Offset: 0,
  133 + UserBaseId: operator.UserBaseId,
  134 + })
  135 + if err != nil {
  136 + return extQueries
  137 + }
  138 + for i := range users.Users {
  139 + u := users.Users[i]
  140 + q := &allied_creation_cooperation.SearchCooperationProjectExtQuery{
  141 + ExtCompanyId: int64(u.Company.CompanyId),
  142 + ExtOrgId: int64(u.Org.OrgId),
  143 + //ExtOrgIds: int64(u.UserOrg),
  144 + ExtUserId: int64(u.UserId),
  145 + ExtUserBaseId: int64(u.UserBaseId),
  146 + ExtCooperationProjectUndertakerTypes: []int32{int32(u.UserType & 3), 3},
  147 + }
  148 + for j := range u.UserOrg {
  149 + org := u.UserOrg[j]
  150 + q.ExtOrgIds = append(q.ExtOrgIds, int64(org.OrgID))
  151 + }
  152 + extQueries = append(extQueries, q)
  153 + }
  154 + }
  155 + return extQueries
  156 +}
  157 +
123 // PersonSearchCooperationProject 共创用户获取共创项目列表 158 // PersonSearchCooperationProject 共创用户获取共创项目列表
124 //func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) { 159 //func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) {
125 // creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 160 // creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
@@ -166,6 +166,9 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer @@ -166,6 +166,9 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer
166 166
167 // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目) 167 // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
168 func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) { 168 func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) {
  169 + if projectQuery.Operator.UserBaseId > 0 {
  170 +
  171 + }
169 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 172 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
170 projectQuery.Operator) 173 projectQuery.Operator)
171 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 174 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
@@ -199,18 +199,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD @@ -199,18 +199,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
199 item := allied_creation_user.BatchAddUserItem{ 199 item := allied_creation_user.BatchAddUserItem{
200 CompanyId: importDataCommand.Operator.CompanyId, 200 CompanyId: importDataCommand.Operator.CompanyId,
201 UserType: domain.UserTypeEmployee, 201 UserType: domain.UserTypeEmployee,
202 - UserCode: v["userCode"],  
203 - Org: v["org"],  
204 - Department: v["department"],  
205 - UserName: v["userName"],  
206 - Phone: v["phone"],  
207 - Email: v["email"],  
208 - EnableStatus: domain.UserStatusEnable,  
209 - }  
210 - if status, ok := v["status"]; ok {  
211 - if strings.TrimSpace(status) != "启用" {  
212 - item.EnableStatus = domain.UserStatusDisable  
213 - } 202 + UserCode: strings.TrimSpace(v["userCode"]),
  203 + Org: strings.TrimSpace(v["org"]),
  204 + Department: strings.TrimSpace(v["department"]),
  205 + UserName: strings.TrimSpace(v["userName"]),
  206 + Phone: strings.TrimSpace(v["phone"]),
  207 + Email: strings.TrimSpace(v["email"]),
  208 + EnableStatus: strings.TrimSpace(v["enableStatus"]),
214 } 209 }
215 users = append(users, item) 210 users = append(users, item)
216 } 211 }
@@ -171,6 +171,20 @@ type ( @@ -171,6 +171,20 @@ type (
171 171
172 //查询共创项目 172 //查询共创项目
173 type ( 173 type (
  174 + SearchCooperationProjectExtQuery struct {
  175 + // 公司ID,通过集成REST上下文获取
  176 + ExtCompanyId int64 `cname:"公司ID" json:"extCompanyId,omitempty"`
  177 + // 组织机构ID
  178 + ExtOrgId int64 `cname:"组织机构ID" json:"extOrgId,omitempty"`
  179 + // 关联的组织机构ID列表
  180 + ExtOrgIds []int64 `cname:"关联的组织机构ID列表" json:"extOrgIds,omitempty"`
  181 + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
  182 + ExtUserId int64 `cname:"用户ID" json:"extUserId,omitempty"`
  183 + // 用户基础数据id
  184 + ExtUserBaseId int64 `cname:"用户基础数据ID" json:"extUserBaseId,omitempty"`
  185 + // 共创项目承接对象,1员工,2共创用户,3公开,可多选
  186 + ExtCooperationProjectUndertakerTypes []int32 `json:"extCooperationProjectUndertakerTypes"`
  187 + }
174 ReqCooperationProjectSearch struct { 188 ReqCooperationProjectSearch struct {
175 PageNumber int `json:"pageNumber"` 189 PageNumber int `json:"pageNumber"`
176 PageSize int `json:"pageSize"` 190 PageSize int `json:"pageSize"`
@@ -192,6 +206,8 @@ type ( @@ -192,6 +206,8 @@ type (
192 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` 206 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
193 // 共创项目承接对象,1员工,2共创用户,4公开,可以多选 207 // 共创项目承接对象,1员工,2共创用户,4公开,可以多选
194 CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"` 208 CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"`
  209 + // 额外的查询条件
  210 + SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
195 } 211 }
196 DataCooperationProjectSearchItem struct { 212 DataCooperationProjectSearchItem struct {
197 CooperationProjectID string `json:"cooperationProjectId"` 213 CooperationProjectID string `json:"cooperationProjectId"`
@@ -393,7 +393,7 @@ type ( @@ -393,7 +393,7 @@ type (
393 // 部门编码 393 // 部门编码
394 Department string `json:"department,omitempty"` 394 Department string `json:"department,omitempty"`
395 // 状态(1:启用 2:禁用 3:注销) 395 // 状态(1:启用 2:禁用 3:注销)
396 - EnableStatus int `json:"enableStatus,omitempty"` 396 + EnableStatus string `json:"enableStatus,omitempty"`
397 // 共创公司 cooperationCompany 397 // 共创公司 cooperationCompany
398 CooperationCompany string `json:"cooperationCompany"` 398 CooperationCompany string `json:"cooperationCompany"`
399 // 共创到期时间 (yyyy-MM-dd) cooperationDeadline 399 // 共创到期时间 (yyyy-MM-dd) cooperationDeadline