作者 Your Name

更新导入模板

@@ -7,6 +7,7 @@ COPY ./config config @@ -7,6 +7,7 @@ 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
10 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] 11 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
11 ENV GO111MODULE on 12 ENV GO111MODULE on
12 ENV GOPROXY https://goproxy.cn 13 ENV GOPROXY https://goproxy.cn
@@ -136,11 +136,20 @@ func (controller *ExcelDataController) GetFileWithExt() (io.Reader, string, erro @@ -136,11 +136,20 @@ 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)  
140 - cmd := &command.ImportDataCommand{} 139 + // excelService := service.NewExcelDataService(nil)
141 code := controller.GetString(":code") 140 code := controller.GetString(":code")
142 - cmd.Code = code  
143 - var data interface{}  
144 - data, err := excelService.FileImportTemplate(cmd)  
145 - controller.Response(data, err) 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 + }
146 } 155 }
@@ -9,4 +9,5 @@ func init() { @@ -9,4 +9,5 @@ func init() {
9 web.Router("/file-import", &controllers.ExcelDataController{}, "Post:FileImport") 9 web.Router("/file-import", &controllers.ExcelDataController{}, "Post:FileImport")
10 web.Router("/file-export", &controllers.ExcelDataController{}, "Post:FileExport") 10 web.Router("/file-export", &controllers.ExcelDataController{}, "Post:FileExport")
11 web.Router("/file-import-template/:code", &controllers.ExcelDataController{}, "Get:FileImportTemplate") 11 web.Router("/file-import-template/:code", &controllers.ExcelDataController{}, "Get:FileImportTemplate")
  12 +
12 } 13 }