作者 Your Name

获取导入模板

... ... @@ -7,7 +7,6 @@ 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
... ...
... ... @@ -2,9 +2,10 @@ package service
import (
"fmt"
"strings"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/ecelData/command"
"strings"
"github.com/linmadan/egglib-go/utils/excel"
)
... ... @@ -51,7 +52,7 @@ func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool {
return isAllEmpty
}
//// FileImportTemplate 导入模板
// // FileImportTemplate 导入模板
func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) {
var mapTemplate = map[string]string{
//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
//domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743206_NPYTKw6RGhXn4TpYNEQhGGdCkXKXTnxM.xlsx",
//domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx",
//domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
//二级品审核导入
"ImportProductRecordLevel2": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221030/object/1667144411_R3h4nQxxcMJ7ympktMsYBBQ6bAcFC6xj.xlsx",
//工时管理导入
"ImportAttendance": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221030/object/1667144523_w66QpzZTfxsmhbM5mmBrHjpytcydMNs2.xlsx",
//事故管理导入
"ImportProductTrouble": "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20221030/object/1667144570_xYKYMrMnXWTyasDPnX2JNXEZHd3rJsWG.xlsx",
}
var url string
var ok bool
... ...
... ... @@ -136,20 +136,11 @@ func (controller *ExcelDataController) GetFileWithExt() (io.Reader, string, erro
}
func (controller *ExcelDataController) FileImportTemplate() {
// excelService := service.NewExcelDataService(nil)
excelService := service.NewExcelDataService(nil)
code := controller.GetString(":code")
// 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")
}
cmd := &command.ImportDataCommand{}
cmd.Code = code
var data interface{}
data, err := excelService.FileImportTemplate(cmd)
controller.Response(data, err)
}
... ...