作者 Your Name

获取导入模板

@@ -7,7 +7,6 @@ COPY ./config config @@ -7,7 +7,6 @@ COPY ./config config
7 COPY ./go.mod go.mod 7 COPY ./go.mod go.mod
8 COPY ./go.sum go.sum 8 COPY ./go.sum go.sum
9 COPY ./main.go main.go 9 COPY ./main.go main.go
10 -COPY ./download ./download  
11 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] 10 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
12 ENV GO111MODULE on 11 ENV GO111MODULE on
13 ENV GOPROXY https://goproxy.cn 12 ENV GOPROXY https://goproxy.cn
@@ -2,9 +2,10 @@ package service @@ -2,9 +2,10 @@ package service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "strings"
  6 +
5 "github.com/linmadan/egglib-go/core/application" 7 "github.com/linmadan/egglib-go/core/application"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/ecelData/command" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/ecelData/command"
7 - "strings"  
8 9
9 "github.com/linmadan/egglib-go/utils/excel" 10 "github.com/linmadan/egglib-go/utils/excel"
10 ) 11 )
@@ -51,7 +52,7 @@ func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool { @@ -51,7 +52,7 @@ func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool {
51 return isAllEmpty 52 return isAllEmpty
52 } 53 }
53 54
54 -//// FileImportTemplate 导入模板 55 +// // FileImportTemplate 导入模板
55 func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { 56 func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) {
56 var mapTemplate = map[string]string{ 57 var mapTemplate = map[string]string{
57 //domain.ImportCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807485_EaxECeRz23WpzrMZmbwdEPRJ3Pdxpx5X.xlsx", 58 //domain.ImportCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807485_EaxECeRz23WpzrMZmbwdEPRJ3Pdxpx5X.xlsx",
@@ -59,6 +60,12 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import @@ -59,6 +60,12 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
59 //domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743206_NPYTKw6RGhXn4TpYNEQhGGdCkXKXTnxM.xlsx", 60 //domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743206_NPYTKw6RGhXn4TpYNEQhGGdCkXKXTnxM.xlsx",
60 //domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx", 61 //domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx",
61 //domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx", 62 //domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
  63 + //二级品审核导入
  64 + "ImportProductRecordLevel2": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221030/object/1667144411_R3h4nQxxcMJ7ympktMsYBBQ6bAcFC6xj.xlsx",
  65 + //工时管理导入
  66 + "ImportAttendance": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221030/object/1667144523_w66QpzZTfxsmhbM5mmBrHjpytcydMNs2.xlsx",
  67 + //事故管理导入
  68 + "ImportProductTrouble": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221030/object/1667144570_xYKYMrMnXWTyasDPnX2JNXEZHd3rJsWG.xlsx",
62 } 69 }
63 var url string 70 var url string
64 var ok bool 71 var ok bool
@@ -136,20 +136,11 @@ func (controller *ExcelDataController) GetFileWithExt() (io.Reader, string, erro @@ -136,20 +136,11 @@ func (controller *ExcelDataController) GetFileWithExt() (io.Reader, string, erro
136 } 136 }
137 137
138 func (controller *ExcelDataController) FileImportTemplate() { 138 func (controller *ExcelDataController) FileImportTemplate() {
139 - // excelService := service.NewExcelDataService(nil) 139 + excelService := service.NewExcelDataService(nil)
140 code := controller.GetString(":code") 140 code := controller.GetString(":code")
141 - // cmd := &command.ImportDataCommand{}  
142 - // cmd.Code = code  
143 - // var data interface{}  
144 - // data, err := excelService.FileImportTemplate(cmd)  
145 - // controller.Response(data, err)  
146 -  
147 - switch code {  
148 - case "ImportProductTrouble":  
149 - controller.Ctx.Output.Download("./download/excel_tpl/事故管理导入.xlsx")  
150 - case "ImportProductRecordLevel2":  
151 - controller.Ctx.Output.Download("./download/excel_tpl/二级品审核导入.xlsx")  
152 - case "ImportAttendance":  
153 - controller.Ctx.Output.Download("./download/excel_tpl/工时管理导入.xlsx")  
154 - } 141 + cmd := &command.ImportDataCommand{}
  142 + cmd.Code = code
  143 + var data interface{}
  144 + data, err := excelService.FileImportTemplate(cmd)
  145 + controller.Response(data, err)
155 } 146 }