作者 yangfu

导入修改

package service
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"strconv"
"github.com/linmadan/egglib-go/core/application"
... ... @@ -103,16 +105,16 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm
// PersonSearchCooperationProject 共创用户获取共创项目列表
func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) {
extQueries := extQuires(projectQuery.Operator)
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
projectQuery.Operator)
//orgidStr := strconv.Itoa(projectQuery.OrgId)
result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的
PageSize: projectQuery.PageSize,
OrgId: projectQuery.OrgId,
Status: 1, //搜索状态为“招标中”项目
Keyword: projectQuery.Keyword,
//UserBaseId: projectQuery.Operator.UserBaseId,
SearchCooperationProjectExtQueries: extQueries,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -120,6 +122,39 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery
return int(result.Total), result.List, nil
}
func extQuires(operator domain.Operator) []*allied_creation_cooperation.SearchCooperationProjectExtQuery {
var extQueries = make([]*allied_creation_cooperation.SearchCooperationProjectExtQuery, 0)
if operator.UserBaseId > 0 {
gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
operator)
users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 100,
Offset: 0,
UserBaseId: operator.UserBaseId,
})
if err != nil {
return extQueries
}
for i := range users.Users {
u := users.Users[i]
q := &allied_creation_cooperation.SearchCooperationProjectExtQuery{
ExtCompanyId: int64(u.Company.CompanyId),
ExtOrgId: int64(u.Org.OrgId),
//ExtOrgIds: int64(u.UserOrg),
ExtUserId: int64(u.UserId),
ExtUserBaseId: int64(u.UserBaseId),
ExtCooperationProjectUndertakerTypes: []int32{int32(u.UserType & 3), 3},
}
for j := range u.UserOrg {
org := u.UserOrg[j]
q.ExtOrgIds = append(q.ExtOrgIds, int64(org.OrgID))
}
extQueries = append(extQueries, q)
}
}
return extQueries
}
// PersonSearchCooperationProject 共创用户获取共创项目列表
//func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
... ...
... ... @@ -166,6 +166,9 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) {
if projectQuery.Operator.UserBaseId > 0 {
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
projectQuery.Operator)
result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
... ...
... ... @@ -199,18 +199,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
item := allied_creation_user.BatchAddUserItem{
CompanyId: importDataCommand.Operator.CompanyId,
UserType: domain.UserTypeEmployee,
UserCode: v["userCode"],
Org: v["org"],
Department: v["department"],
UserName: v["userName"],
Phone: v["phone"],
Email: v["email"],
EnableStatus: domain.UserStatusEnable,
}
if status, ok := v["status"]; ok {
if strings.TrimSpace(status) != "启用" {
item.EnableStatus = domain.UserStatusDisable
}
UserCode: strings.TrimSpace(v["userCode"]),
Org: strings.TrimSpace(v["org"]),
Department: strings.TrimSpace(v["department"]),
UserName: strings.TrimSpace(v["userName"]),
Phone: strings.TrimSpace(v["phone"]),
Email: strings.TrimSpace(v["email"]),
EnableStatus: strings.TrimSpace(v["enableStatus"]),
}
users = append(users, item)
}
... ...
... ... @@ -171,6 +171,20 @@ type (
//查询共创项目
type (
SearchCooperationProjectExtQuery struct {
// 公司ID,通过集成REST上下文获取
ExtCompanyId int64 `cname:"公司ID" json:"extCompanyId,omitempty"`
// 组织机构ID
ExtOrgId int64 `cname:"组织机构ID" json:"extOrgId,omitempty"`
// 关联的组织机构ID列表
ExtOrgIds []int64 `cname:"关联的组织机构ID列表" json:"extOrgIds,omitempty"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
ExtUserId int64 `cname:"用户ID" json:"extUserId,omitempty"`
// 用户基础数据id
ExtUserBaseId int64 `cname:"用户基础数据ID" json:"extUserBaseId,omitempty"`
// 共创项目承接对象,1员工,2共创用户,3公开,可多选
ExtCooperationProjectUndertakerTypes []int32 `json:"extCooperationProjectUndertakerTypes"`
}
ReqCooperationProjectSearch struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
... ... @@ -192,6 +206,8 @@ type (
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
// 共创项目承接对象,1员工,2共创用户,4公开,可以多选
CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"`
// 额外的查询条件
SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
}
DataCooperationProjectSearchItem struct {
CooperationProjectID string `json:"cooperationProjectId"`
... ...
... ... @@ -393,7 +393,7 @@ type (
// 部门编码
Department string `json:"department,omitempty"`
// 状态(1:启用 2:禁用 3:注销)
EnableStatus int `json:"enableStatus,omitempty"`
EnableStatus string `json:"enableStatus,omitempty"`
// 共创公司 cooperationCompany
CooperationCompany string `json:"cooperationCompany"`
// 共创到期时间 (yyyy-MM-dd) cooperationDeadline
... ...