|
|
package web_client
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"io"
|
|
|
"strings"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
|
...
|
...
|
@@ -43,7 +45,7 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin |
|
|
return isAllEmpty
|
|
|
}
|
|
|
|
|
|
//导出公司用户
|
|
|
// ExportCompanyUser 导出公司用户
|
|
|
func (controller ExcelDataController) ExportCompanyUser() {
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
companyUserListQuery := &query.CompanyUserListQuery{}
|
...
|
...
|
@@ -70,7 +72,7 @@ func (controller ExcelDataController) ExportCompanyUser() { |
|
|
controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户")
|
|
|
}
|
|
|
|
|
|
//导出共创用户
|
|
|
// ExportCooperationUser 导出共创用户
|
|
|
func (controller ExcelDataController) ExportCooperationUser() {
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
companyUserListQuery := &query.CompanyUserListQuery{}
|
...
|
...
|
@@ -97,7 +99,7 @@ func (controller ExcelDataController) ExportCooperationUser() { |
|
|
controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户")
|
|
|
}
|
|
|
|
|
|
// ImportDividendsOrder TODO 导入分红订单
|
|
|
// ImportDividendsOrder 导入分红订单
|
|
|
func (controller ExcelDataController) ImportDividendsOrder() {
|
|
|
importDividendsOrder(controller)
|
|
|
}
|
...
|
...
|
@@ -223,95 +225,51 @@ func importDividendsReturnedOrder(controller ExcelDataController) { |
|
|
controller.Response(result, nil)
|
|
|
}
|
|
|
|
|
|
func (controller ExcelDataController) ImportCompanyUser() {
|
|
|
importCompanyUser(controller)
|
|
|
}
|
|
|
func importCompanyUser(controller ExcelDataController) {
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
r, err := controller.GetExcelFile()
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cmd := &command.ImportDataCommand{}
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
cmd.Reader = r
|
|
|
data, err := excelService.ImportCompanyUser(cmd)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller ExcelDataController) ImportCooperationUser() {
|
|
|
importCooperationUser(controller)
|
|
|
}
|
|
|
func importCooperationUser(controller ExcelDataController) {
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
r, err := controller.GetExcelFile()
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
// FileImport 文件导入
|
|
|
func (controller ExcelDataController) FileImport() {
|
|
|
code := controller.GetString("code")
|
|
|
switch code {
|
|
|
case domain.ImportDividendsOrders:
|
|
|
importDividendsOrder(controller)
|
|
|
case domain.ImportDividendsReturnOrders:
|
|
|
importDividendsReturnedOrder(controller)
|
|
|
default:
|
|
|
defaultImport(controller)
|
|
|
}
|
|
|
cmd := &command.ImportDataCommand{}
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
cmd.Reader = r
|
|
|
data, err := excelService.ImportCooperationUser(cmd)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func importOrganization(controller ExcelDataController) {
|
|
|
func defaultImport(controller ExcelDataController) {
|
|
|
var (
|
|
|
data interface{}
|
|
|
err error
|
|
|
r io.Reader
|
|
|
)
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
r, err := controller.GetExcelFile()
|
|
|
r, err = controller.GetExcelFile()
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cmd := &command.ImportDataCommand{}
|
|
|
controller.ParseForm(cmd)
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
cmd.Reader = r
|
|
|
data, err := excelService.ImportOrganization(cmd)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller ExcelDataController) ImportOrganization() {
|
|
|
importOrganization(controller)
|
|
|
}
|
|
|
|
|
|
func (controller ExcelDataController) FileImport() {
|
|
|
// excelService := service.NewExcelDataService(nil)
|
|
|
// r, err := controller.GetExcelFile()
|
|
|
// if err != nil {
|
|
|
// controller.Response(nil, err)
|
|
|
// return
|
|
|
// }
|
|
|
// cmd := &command.ImportDataCommand{}
|
|
|
//controller.Unmarshal(cmd)
|
|
|
// controller.ParseForm(cmd)
|
|
|
// cmd.Operator = controller.GetOperator()
|
|
|
// cmd.Reader = r
|
|
|
// var (
|
|
|
// data interface{}
|
|
|
// err error
|
|
|
// )
|
|
|
code := controller.GetString("code")
|
|
|
switch code {
|
|
|
switch cmd.Code {
|
|
|
case domain.ImportCompanyUser:
|
|
|
importCompanyUser(controller)
|
|
|
data, err = excelService.ImportCompanyUser(cmd)
|
|
|
case domain.ImportCooperationUser:
|
|
|
importCooperationUser(controller)
|
|
|
case domain.ImportDividendsOrders:
|
|
|
importDividendsOrder(controller)
|
|
|
case domain.ImportDividendsReturnOrders:
|
|
|
importDividendsReturnedOrder(controller)
|
|
|
data, err = excelService.ImportCooperationUser(cmd)
|
|
|
case domain.ImportOrganization:
|
|
|
importOrganization(controller)
|
|
|
data, err = excelService.ImportOrganization(cmd)
|
|
|
default:
|
|
|
err = fmt.Errorf("导入不存在 Code:%v", cmd.Code)
|
|
|
}
|
|
|
// controller.Response(data, err)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller ExcelDataController) FileImportTemplate() {
|
|
|
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
cmd := &command.ImportDataCommand{}
|
|
|
//controller.Unmarshal(cmd)
|
|
|
code := controller.GetString(":code")
|
|
|
cmd.Code = code
|
|
|
var data interface{}
|
...
|
...
|
|