作者 Your Name

更新导入模板

... ... @@ -7,6 +7,7 @@ COPY ./config config
COPY ./go.mod go.mod
COPY ./go.sum go.sum
COPY ./main.go main.go
COPY ./download ./download
RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
ENV GO111MODULE on
ENV GOPROXY https://goproxy.cn
... ...
... ... @@ -136,11 +136,20 @@ func (controller *ExcelDataController) GetFileWithExt() (io.Reader, string, erro
}
func (controller *ExcelDataController) FileImportTemplate() {
excelService := service.NewExcelDataService(nil)
cmd := &command.ImportDataCommand{}
// excelService := service.NewExcelDataService(nil)
code := controller.GetString(":code")
cmd.Code = code
var data interface{}
data, err := excelService.FileImportTemplate(cmd)
controller.Response(data, err)
// cmd := &command.ImportDataCommand{}
// cmd.Code = code
// var data interface{}
// data, err := excelService.FileImportTemplate(cmd)
// controller.Response(data, err)
switch code {
case "ImportProductTrouble":
controller.Ctx.Output.Download("./download/excel_tpl/事故管理导入.xlsx")
case "ImportProductRecordLevel2":
controller.Ctx.Output.Download("./download/excel_tpl/二级品审核导入.xlsx")
case "ImportAttendance":
controller.Ctx.Output.Download("./download/excel_tpl/工时管理导入.xlsx")
}
}
... ...
... ... @@ -9,4 +9,5 @@ func init() {
web.Router("/file-import", &controllers.ExcelDataController{}, "Post:FileImport")
web.Router("/file-export", &controllers.ExcelDataController{}, "Post:FileExport")
web.Router("/file-import-template/:code", &controllers.ExcelDataController{}, "Get:FileImportTemplate")
}
... ...