export.go
3.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package service
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query"
"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"
)
// ExportCompanyUser 导出公司用户信息列表
func (srv ExcelDataService) ExportCompanyUser(companyUserListQuery *query.CompanyUserListQuery) (ExportCompanyUserData, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator)
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 10000,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
DepName: companyUserListQuery.DepartmentName,
Phone: "",
UserType: domain.UserTypeEmployee,
InOrgIds: companyUserListQuery.Operator.OrgIds,
PullRealTime: true,
})
if err != nil {
return ExportCompanyUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
}
return ExportCompanyUserData{
SourceData: result.Users,
SelectedField: companyUserListQuery.SelectedField,
}, nil
}
// ExportCooperationUser 导出共创用户信息列表
func (srv ExcelDataService) ExportCooperationUser(companyUserListQuery *query.CooperationUserListQuery) (ExportCooperationUserData, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator)
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 10000,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
CooperationCompany: companyUserListQuery.CooperationCompany,
Phone: "",
UserType: domain.UserTypeCooperation,
InOrgIds: companyUserListQuery.Operator.OrgIds,
})
if err != nil {
return ExportCooperationUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
}
return ExportCooperationUserData{SourceData: result.Users, SelectedField: companyUserListQuery.SelectedField}, nil
}
// ExportCooperationUser 导出共创用户信息列表
func (srv ExcelDataService) ExportProducts(cmd *query.SearchProductQuery) (ExportProductsData, error) {
creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
result, err := creationUserGateway.SearchProduct(allied_creation_manufacture.SearchProductRequest{
ProductName: cmd.ProductName,
ProductCategory: cmd.ProductCategory,
})
if err != nil {
return ExportProductsData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
}
return ExportProductsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}