作者 tangxuhui

excel 导入处理

@@ -61,6 +61,7 @@ const ( @@ -61,6 +61,7 @@ const (
61 ImportDividendsOrders = "ImportDividendsOrders" 61 ImportDividendsOrders = "ImportDividendsOrders"
62 ) 62 )
63 63
  64 +//excel 导入模板
64 const ( 65 const (
65 // 导入公司用户 66 // 导入公司用户
66 TemplateCompanyUser = "TemplateCompanyUser" 67 TemplateCompanyUser = "TemplateCompanyUser"
@@ -2,10 +2,11 @@ package web_client @@ -2,10 +2,11 @@ package web_client
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
6 "path/filepath" 5 "path/filepath"
7 "strings" 6 "strings"
8 7
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  9 +
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
10 11
11 "github.com/beego/beego/v2/server/web/context" 12 "github.com/beego/beego/v2/server/web/context"
@@ -100,6 +101,10 @@ func (controller ExcelDataController) ExportCooperationUser() { @@ -100,6 +101,10 @@ func (controller ExcelDataController) ExportCooperationUser() {
100 101
101 // ImportDividendsOrder TODO 导入分红订单 102 // ImportDividendsOrder TODO 导入分红订单
102 func (controller ExcelDataController) ImportDividendsOrder() { 103 func (controller ExcelDataController) ImportDividendsOrder() {
  104 + importDividendsOrder(controller)
  105 +}
  106 +
  107 +func importDividendsOrder(controller ExcelDataController) {
103 excelFile, fileHeader, err := controller.GetFile("file") 108 excelFile, fileHeader, err := controller.GetFile("file")
104 if err != nil { 109 if err != nil {
105 log.Logger.Error("接收文件失败," + err.Error()) 110 log.Logger.Error("接收文件失败," + err.Error())
@@ -165,6 +170,10 @@ func (controller ExcelDataController) ImportDividendsOrder() { @@ -165,6 +170,10 @@ func (controller ExcelDataController) ImportDividendsOrder() {
165 170
166 // ImportDividendsReturnedOrder 导入分红退货单 171 // ImportDividendsReturnedOrder 导入分红退货单
167 func (controller ExcelDataController) ImportDividendsReturnedOrder() { 172 func (controller ExcelDataController) ImportDividendsReturnedOrder() {
  173 + importDividendsReturnedOrder(controller)
  174 +}
  175 +
  176 +func importDividendsReturnedOrder(controller ExcelDataController) {
168 excelFile, fileHeader, err := controller.GetFile("file") 177 excelFile, fileHeader, err := controller.GetFile("file")
169 if err != nil { 178 if err != nil {
170 log.Logger.Error("接收文件失败," + err.Error()) 179 log.Logger.Error("接收文件失败," + err.Error())
@@ -286,11 +295,19 @@ func (controller ExcelDataController) FileImport() { @@ -286,11 +295,19 @@ func (controller ExcelDataController) FileImport() {
286 switch cmd.Code { 295 switch cmd.Code {
287 case domain.ImportCompanyUser: 296 case domain.ImportCompanyUser:
288 data, err = excelService.ImportCompanyUser(cmd) 297 data, err = excelService.ImportCompanyUser(cmd)
  298 + case domain.ImportCooperationUser:
  299 + // data,err = excelService.ExportCooperationUser()
  300 + case domain.ImportDividendsOrders:
  301 + importDividendsOrder(controller)
  302 + case domain.ImportOrganization:
  303 + importDividendsReturnedOrder(controller)
  304 +
289 } 305 }
290 controller.Response(data, err) 306 controller.Response(data, err)
291 } 307 }
292 308
293 func (controller ExcelDataController) FileImportTemplate() { 309 func (controller ExcelDataController) FileImportTemplate() {
  310 +
294 excelService := service.NewExcelDataService(nil) 311 excelService := service.NewExcelDataService(nil)
295 cmd := &command.ImportDataCommand{} 312 cmd := &command.ImportDataCommand{}
296 //controller.Unmarshal(cmd) 313 //controller.Unmarshal(cmd)