...
|
...
|
@@ -45,97 +45,6 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin |
|
|
return isAllEmpty
|
|
|
}
|
|
|
|
|
|
// ExportCompanyUser 导出公司用户
|
|
|
func (controller ExcelDataController) ExportCompanyUser() {
|
|
|
//excelService := service.NewExcelDataService(nil)
|
|
|
//companyUserListQuery := &query.CompanyUserListQuery{}
|
|
|
//err := controller.Unmarshal(companyUserListQuery)
|
|
|
//if err != nil {
|
|
|
// log.Logger.Debug("json err:" + err.Error())
|
|
|
// controller.Response(nil, err)
|
|
|
// return
|
|
|
//}
|
|
|
//companyUserListQuery.Operator = controller.GetOperator()
|
|
|
//data, err := excelService.ExportCompanyUser(companyUserListQuery)
|
|
|
//if err != nil {
|
|
|
// log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error())
|
|
|
// controller.Response(nil, err)
|
|
|
// return
|
|
|
//}
|
|
|
//excelTool := excel.NewExcelExport()
|
|
|
//err = excelTool.ExportData(data, "")
|
|
|
//if err != nil {
|
|
|
// log.Logger.Debug("excelTool.ExportData err:" + err.Error())
|
|
|
// controller.Response(nil, err)
|
|
|
// return
|
|
|
//}
|
|
|
//controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户")
|
|
|
// 1.读取command
|
|
|
exportDataCommand := &command.ExportDataCommand{}
|
|
|
err := controller.Unmarshal(exportDataCommand)
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
exportDataCommand.Operator = controller.GetOperator()
|
|
|
|
|
|
// 2.读取data
|
|
|
var data excel.ExcelMaker
|
|
|
var filename string
|
|
|
var excelService = service.NewExcelDataService(nil)
|
|
|
switch exportDataCommand.Code {
|
|
|
default:
|
|
|
companyUserListQuery := &query.CompanyUserListQuery{}
|
|
|
exportDataCommand.UnmarshalQuery(companyUserListQuery)
|
|
|
companyUserListQuery.Operator = exportDataCommand.Operator
|
|
|
data, err = excelService.ExportCompanyUser(companyUserListQuery)
|
|
|
filename = "导出公司用户"
|
|
|
}
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("excelService.Export err:" + err.Error())
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 3.返回文件
|
|
|
excelTool := excel.NewExcelExport()
|
|
|
err = excelTool.ExportData(data, "")
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("excelTool.ExportData err:" + err.Error())
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
controller.responseExcelByFile(controller.Ctx, excelTool, filename)
|
|
|
}
|
|
|
|
|
|
// ExportCooperationUser 导出共创用户
|
|
|
func (controller ExcelDataController) ExportCooperationUser() {
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
companyUserListQuery := &query.CompanyUserListQuery{}
|
|
|
err := controller.Unmarshal(companyUserListQuery)
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
companyUserListQuery.Operator = controller.GetOperator()
|
|
|
data, err := excelService.ExportCooperationUser(companyUserListQuery)
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error())
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
excelTool := excel.NewExcelExport()
|
|
|
err = excelTool.ExportData(data, "")
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("excelTool.ExportData err:" + err.Error())
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户")
|
|
|
}
|
|
|
|
|
|
// ImportDividendsOrder 导入分红订单
|
|
|
func (controller ExcelDataController) ImportDividendsOrder() {
|
|
|
importDividendsOrder(controller)
|
...
|
...
|
@@ -316,6 +225,10 @@ func (controller ExcelDataController) FileImportTemplate() { |
|
|
|
|
|
// FileExport 文件导出
|
|
|
func (controller ExcelDataController) FileExport() {
|
|
|
fileExport(controller, "")
|
|
|
}
|
|
|
|
|
|
func fileExport(controller ExcelDataController, code string) {
|
|
|
// 1.读取command
|
|
|
exportDataCommand := &command.ExportDataCommand{}
|
|
|
err := controller.Unmarshal(exportDataCommand)
|
...
|
...
|
@@ -326,17 +239,28 @@ func (controller ExcelDataController) FileExport() { |
|
|
}
|
|
|
exportDataCommand.Operator = controller.GetOperator()
|
|
|
|
|
|
if exportDataCommand.Code == "" && code != "" {
|
|
|
exportDataCommand.Code = code
|
|
|
}
|
|
|
// 2.读取data
|
|
|
var data excel.ExcelMaker
|
|
|
var filename string
|
|
|
var excelService = service.NewExcelDataService(nil)
|
|
|
switch exportDataCommand.Code {
|
|
|
default:
|
|
|
case domain.ExportCompanyUser:
|
|
|
companyUserListQuery := &query.CompanyUserListQuery{}
|
|
|
exportDataCommand.UnmarshalQuery(companyUserListQuery)
|
|
|
companyUserListQuery.Operator = exportDataCommand.Operator
|
|
|
data, err = excelService.ExportCompanyUser(companyUserListQuery)
|
|
|
filename = "导出公司用户"
|
|
|
case domain.ExportCooperationUser:
|
|
|
companyUserListQuery := &query.CooperationUserListQuery{}
|
|
|
exportDataCommand.UnmarshalQuery(companyUserListQuery)
|
|
|
companyUserListQuery.Operator = exportDataCommand.Operator
|
|
|
data, err = excelService.ExportCooperationUser(companyUserListQuery)
|
|
|
filename = "导出共创用户"
|
|
|
default:
|
|
|
err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
|
|
|
}
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("excelService.Export err:" + err.Error())
|
...
|
...
|
@@ -354,3 +278,13 @@ func (controller ExcelDataController) FileExport() { |
|
|
}
|
|
|
controller.responseExcelByFile(controller.Ctx, excelTool, filename)
|
|
|
}
|
|
|
|
|
|
// ExportCompanyUser 导出公司用户
|
|
|
func (controller ExcelDataController) ExportCompanyUser() {
|
|
|
fileExport(controller, domain.ExportCompanyUser)
|
|
|
}
|
|
|
|
|
|
// ExportCooperationUser 导出共创用户
|
|
|
func (controller ExcelDataController) ExportCooperationUser() {
|
|
|
fileExport(controller, domain.ExportCooperationUser)
|
|
|
} |
...
|
...
|
|