export.go
6.8 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
}
// ExportEmployeeProductive 导出员工产能
func (srv ExcelDataService) ExportEmployeeProductive(cmd *query.ManufactureEmployeeProductiveQuery) (ExportEmployeeProductiveData, error) {
creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
result, err := creationUserGateway.SearchEmployeeProductive(allied_creation_manufacture.SearchEmployeeProductiveRequest{
WorkshopName: cmd.WorkshopName,
LineName: cmd.LineName,
SectionName: cmd.SectionName,
UserName: cmd.UserName,
EmployeeType: cmd.EmployeeType,
BeginTime: cmd.BeginTime,
EndTime: cmd.EndTime,
})
if err != nil {
return ExportEmployeeProductiveData{}, fmt.Errorf("获取员工产能数据失败:%w", err)
}
return ExportEmployeeProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}
// ExportEmployeeProductive 导出车间产能
func (srv ExcelDataService) ExportWorkshopProductive(cmd *query.ManufactureWorkshopProductiveQuery) (ExportWorkshopProductiveData, error) {
creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
result, err := creationUserGateway.SearchWorkshopProductive(allied_creation_manufacture.SearchWorkshopProductiveRequest{
SectionName: cmd.SectionName,
PlanProductName: cmd.PlanProductName,
BeginTime: cmd.BeginTime,
EndTime: cmd.EndTime,
})
if err != nil {
return ExportWorkshopProductiveData{}, fmt.Errorf("获取员工产能数据失败:%w", err)
}
return ExportWorkshopProductiveData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}
// ExportSecondLevelRecord 二级废品
func (srv ExcelDataService) ExportSecondLevelRecord(cmd *query.ManufactureSecondLevelRecordQuery) (ExportSecondLevelData, error) {
creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
result, err := creationUserGateway.SearchSecondLevelRecord(allied_creation_manufacture.SearchSecondLevelRecordRequest{
WorkshopName: cmd.WorkshopName,
BatchNumber: cmd.BatchNumber,
UserName: cmd.UserName,
LineName: cmd.LineName,
SectionName: cmd.SectionName,
EmployeeType: cmd.EmployeeType,
BeginTime: cmd.BeginTime,
EndTime: cmd.EndTime,
})
if err != nil {
return ExportSecondLevelData{}, fmt.Errorf("获取二级废品数据失败:%w", err)
}
return ExportSecondLevelData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}
// ExportEmployeeAttendanceStatics 导出员工工时
func (srv ExcelDataService) ExportEmployeeAttendanceStatics(cmd *query.ManufactureExportEmployeeAttendanceStaticsQuery) (ExportEmployeeAttendanceStaticsData, error) {
creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
result, err := creationUserGateway.SearchEmployeeAttendanceStatics(*cmd.SearchEmployeeAttendanceStaticsRequest)
if err != nil {
return ExportEmployeeAttendanceStaticsData{}, fmt.Errorf("获取员工工时数据失败:%w", err)
}
return ExportEmployeeAttendanceStaticsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}
// ExportWorkshopAttendanceStatics 导出车间工时
func (srv ExcelDataService) ExportWorkshopAttendanceStatics(cmd *query.ManufactureExportWorkshopAttendanceStaticsQuery) (ExportWorkshopAttendanceStaticsData, error) {
creationUserGateway := allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(cmd.Operator)
result, err := creationUserGateway.SearchWorkshopWorkTimeStatics(*cmd.SearchWorkshopWorkTimeStaticsRequest)
if err != nil {
return ExportWorkshopAttendanceStaticsData{}, fmt.Errorf("获取车间工时数据失败:%w", err)
}
return ExportWorkshopAttendanceStaticsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}