作者 tangxuhui

excel 导入处理

... ... @@ -61,6 +61,7 @@ const (
ImportDividendsOrders = "ImportDividendsOrders"
)
//excel 导入模板
const (
// 导入公司用户
TemplateCompanyUser = "TemplateCompanyUser"
... ...
... ... @@ -2,10 +2,11 @@ package web_client
import (
"errors"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"path/filepath"
"strings"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
"github.com/beego/beego/v2/server/web/context"
... ... @@ -100,6 +101,10 @@ func (controller ExcelDataController) ExportCooperationUser() {
// ImportDividendsOrder TODO 导入分红订单
func (controller ExcelDataController) ImportDividendsOrder() {
importDividendsOrder(controller)
}
func importDividendsOrder(controller ExcelDataController) {
excelFile, fileHeader, err := controller.GetFile("file")
if err != nil {
log.Logger.Error("接收文件失败," + err.Error())
... ... @@ -165,6 +170,10 @@ func (controller ExcelDataController) ImportDividendsOrder() {
// ImportDividendsReturnedOrder 导入分红退货单
func (controller ExcelDataController) ImportDividendsReturnedOrder() {
importDividendsReturnedOrder(controller)
}
func importDividendsReturnedOrder(controller ExcelDataController) {
excelFile, fileHeader, err := controller.GetFile("file")
if err != nil {
log.Logger.Error("接收文件失败," + err.Error())
... ... @@ -286,11 +295,19 @@ func (controller ExcelDataController) FileImport() {
switch cmd.Code {
case domain.ImportCompanyUser:
data, err = excelService.ImportCompanyUser(cmd)
case domain.ImportCooperationUser:
// data,err = excelService.ExportCooperationUser()
case domain.ImportDividendsOrders:
importDividendsOrder(controller)
case domain.ImportOrganization:
importDividendsReturnedOrder(controller)
}
controller.Response(data, err)
}
func (controller ExcelDataController) FileImportTemplate() {
excelService := service.NewExcelDataService(nil)
cmd := &command.ImportDataCommand{}
//controller.Unmarshal(cmd)
... ...