|
@@ -45,97 +45,6 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin |
|
@@ -45,97 +45,6 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin |
45
|
return isAllEmpty
|
45
|
return isAllEmpty
|
46
|
}
|
46
|
}
|
47
|
|
47
|
|
48
|
-// ExportCompanyUser 导出公司用户
|
|
|
49
|
-func (controller ExcelDataController) ExportCompanyUser() {
|
|
|
50
|
- //excelService := service.NewExcelDataService(nil)
|
|
|
51
|
- //companyUserListQuery := &query.CompanyUserListQuery{}
|
|
|
52
|
- //err := controller.Unmarshal(companyUserListQuery)
|
|
|
53
|
- //if err != nil {
|
|
|
54
|
- // log.Logger.Debug("json err:" + err.Error())
|
|
|
55
|
- // controller.Response(nil, err)
|
|
|
56
|
- // return
|
|
|
57
|
- //}
|
|
|
58
|
- //companyUserListQuery.Operator = controller.GetOperator()
|
|
|
59
|
- //data, err := excelService.ExportCompanyUser(companyUserListQuery)
|
|
|
60
|
- //if err != nil {
|
|
|
61
|
- // log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error())
|
|
|
62
|
- // controller.Response(nil, err)
|
|
|
63
|
- // return
|
|
|
64
|
- //}
|
|
|
65
|
- //excelTool := excel.NewExcelExport()
|
|
|
66
|
- //err = excelTool.ExportData(data, "")
|
|
|
67
|
- //if err != nil {
|
|
|
68
|
- // log.Logger.Debug("excelTool.ExportData err:" + err.Error())
|
|
|
69
|
- // controller.Response(nil, err)
|
|
|
70
|
- // return
|
|
|
71
|
- //}
|
|
|
72
|
- //controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户")
|
|
|
73
|
- // 1.读取command
|
|
|
74
|
- exportDataCommand := &command.ExportDataCommand{}
|
|
|
75
|
- err := controller.Unmarshal(exportDataCommand)
|
|
|
76
|
- if err != nil {
|
|
|
77
|
- log.Logger.Debug("json err:" + err.Error())
|
|
|
78
|
- controller.Response(nil, err)
|
|
|
79
|
- return
|
|
|
80
|
- }
|
|
|
81
|
- exportDataCommand.Operator = controller.GetOperator()
|
|
|
82
|
-
|
|
|
83
|
- // 2.读取data
|
|
|
84
|
- var data excel.ExcelMaker
|
|
|
85
|
- var filename string
|
|
|
86
|
- var excelService = service.NewExcelDataService(nil)
|
|
|
87
|
- switch exportDataCommand.Code {
|
|
|
88
|
- default:
|
|
|
89
|
- companyUserListQuery := &query.CompanyUserListQuery{}
|
|
|
90
|
- exportDataCommand.UnmarshalQuery(companyUserListQuery)
|
|
|
91
|
- companyUserListQuery.Operator = exportDataCommand.Operator
|
|
|
92
|
- data, err = excelService.ExportCompanyUser(companyUserListQuery)
|
|
|
93
|
- filename = "导出公司用户"
|
|
|
94
|
- }
|
|
|
95
|
- if err != nil {
|
|
|
96
|
- log.Logger.Debug("excelService.Export err:" + err.Error())
|
|
|
97
|
- controller.Response(nil, err)
|
|
|
98
|
- return
|
|
|
99
|
- }
|
|
|
100
|
-
|
|
|
101
|
- // 3.返回文件
|
|
|
102
|
- excelTool := excel.NewExcelExport()
|
|
|
103
|
- err = excelTool.ExportData(data, "")
|
|
|
104
|
- if err != nil {
|
|
|
105
|
- log.Logger.Debug("excelTool.ExportData err:" + err.Error())
|
|
|
106
|
- controller.Response(nil, err)
|
|
|
107
|
- return
|
|
|
108
|
- }
|
|
|
109
|
- controller.responseExcelByFile(controller.Ctx, excelTool, filename)
|
|
|
110
|
-}
|
|
|
111
|
-
|
|
|
112
|
-// ExportCooperationUser 导出共创用户
|
|
|
113
|
-func (controller ExcelDataController) ExportCooperationUser() {
|
|
|
114
|
- excelService := service.NewExcelDataService(nil)
|
|
|
115
|
- companyUserListQuery := &query.CompanyUserListQuery{}
|
|
|
116
|
- err := controller.Unmarshal(companyUserListQuery)
|
|
|
117
|
- if err != nil {
|
|
|
118
|
- log.Logger.Debug("json err:" + err.Error())
|
|
|
119
|
- controller.Response(nil, err)
|
|
|
120
|
- return
|
|
|
121
|
- }
|
|
|
122
|
- companyUserListQuery.Operator = controller.GetOperator()
|
|
|
123
|
- data, err := excelService.ExportCooperationUser(companyUserListQuery)
|
|
|
124
|
- if err != nil {
|
|
|
125
|
- log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error())
|
|
|
126
|
- controller.Response(nil, err)
|
|
|
127
|
- return
|
|
|
128
|
- }
|
|
|
129
|
- excelTool := excel.NewExcelExport()
|
|
|
130
|
- err = excelTool.ExportData(data, "")
|
|
|
131
|
- if err != nil {
|
|
|
132
|
- log.Logger.Debug("excelTool.ExportData err:" + err.Error())
|
|
|
133
|
- controller.Response(nil, err)
|
|
|
134
|
- return
|
|
|
135
|
- }
|
|
|
136
|
- controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户")
|
|
|
137
|
-}
|
|
|
138
|
-
|
|
|
139
|
// ImportDividendsOrder 导入分红订单
|
48
|
// ImportDividendsOrder 导入分红订单
|
140
|
func (controller ExcelDataController) ImportDividendsOrder() {
|
49
|
func (controller ExcelDataController) ImportDividendsOrder() {
|
141
|
importDividendsOrder(controller)
|
50
|
importDividendsOrder(controller)
|
|
@@ -316,6 +225,10 @@ func (controller ExcelDataController) FileImportTemplate() { |
|
@@ -316,6 +225,10 @@ func (controller ExcelDataController) FileImportTemplate() { |
316
|
|
225
|
|
317
|
// FileExport 文件导出
|
226
|
// FileExport 文件导出
|
318
|
func (controller ExcelDataController) FileExport() {
|
227
|
func (controller ExcelDataController) FileExport() {
|
|
|
228
|
+ fileExport(controller, "")
|
|
|
229
|
+}
|
|
|
230
|
+
|
|
|
231
|
+func fileExport(controller ExcelDataController, code string) {
|
319
|
// 1.读取command
|
232
|
// 1.读取command
|
320
|
exportDataCommand := &command.ExportDataCommand{}
|
233
|
exportDataCommand := &command.ExportDataCommand{}
|
321
|
err := controller.Unmarshal(exportDataCommand)
|
234
|
err := controller.Unmarshal(exportDataCommand)
|
|
@@ -326,17 +239,28 @@ func (controller ExcelDataController) FileExport() { |
|
@@ -326,17 +239,28 @@ func (controller ExcelDataController) FileExport() { |
326
|
}
|
239
|
}
|
327
|
exportDataCommand.Operator = controller.GetOperator()
|
240
|
exportDataCommand.Operator = controller.GetOperator()
|
328
|
|
241
|
|
|
|
242
|
+ if exportDataCommand.Code == "" && code != "" {
|
|
|
243
|
+ exportDataCommand.Code = code
|
|
|
244
|
+ }
|
329
|
// 2.读取data
|
245
|
// 2.读取data
|
330
|
var data excel.ExcelMaker
|
246
|
var data excel.ExcelMaker
|
331
|
var filename string
|
247
|
var filename string
|
332
|
var excelService = service.NewExcelDataService(nil)
|
248
|
var excelService = service.NewExcelDataService(nil)
|
333
|
switch exportDataCommand.Code {
|
249
|
switch exportDataCommand.Code {
|
334
|
- default:
|
250
|
+ case domain.ExportCompanyUser:
|
335
|
companyUserListQuery := &query.CompanyUserListQuery{}
|
251
|
companyUserListQuery := &query.CompanyUserListQuery{}
|
336
|
exportDataCommand.UnmarshalQuery(companyUserListQuery)
|
252
|
exportDataCommand.UnmarshalQuery(companyUserListQuery)
|
337
|
companyUserListQuery.Operator = exportDataCommand.Operator
|
253
|
companyUserListQuery.Operator = exportDataCommand.Operator
|
338
|
data, err = excelService.ExportCompanyUser(companyUserListQuery)
|
254
|
data, err = excelService.ExportCompanyUser(companyUserListQuery)
|
339
|
filename = "导出公司用户"
|
255
|
filename = "导出公司用户"
|
|
|
256
|
+ case domain.ExportCooperationUser:
|
|
|
257
|
+ companyUserListQuery := &query.CooperationUserListQuery{}
|
|
|
258
|
+ exportDataCommand.UnmarshalQuery(companyUserListQuery)
|
|
|
259
|
+ companyUserListQuery.Operator = exportDataCommand.Operator
|
|
|
260
|
+ data, err = excelService.ExportCooperationUser(companyUserListQuery)
|
|
|
261
|
+ filename = "导出共创用户"
|
|
|
262
|
+ default:
|
|
|
263
|
+ err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
|
340
|
}
|
264
|
}
|
341
|
if err != nil {
|
265
|
if err != nil {
|
342
|
log.Logger.Debug("excelService.Export err:" + err.Error())
|
266
|
log.Logger.Debug("excelService.Export err:" + err.Error())
|
|
@@ -354,3 +278,13 @@ func (controller ExcelDataController) FileExport() { |
|
@@ -354,3 +278,13 @@ func (controller ExcelDataController) FileExport() { |
354
|
}
|
278
|
}
|
355
|
controller.responseExcelByFile(controller.Ctx, excelTool, filename)
|
279
|
controller.responseExcelByFile(controller.Ctx, excelTool, filename)
|
356
|
}
|
280
|
}
|
|
|
281
|
+
|
|
|
282
|
+// ExportCompanyUser 导出公司用户
|
|
|
283
|
+func (controller ExcelDataController) ExportCompanyUser() {
|
|
|
284
|
+ fileExport(controller, domain.ExportCompanyUser)
|
|
|
285
|
+}
|
|
|
286
|
+
|
|
|
287
|
+// ExportCooperationUser 导出共创用户
|
|
|
288
|
+func (controller ExcelDataController) ExportCooperationUser() {
|
|
|
289
|
+ fileExport(controller, domain.ExportCooperationUser)
|
|
|
290
|
+} |