正在显示
4 个修改的文件
包含
57 行增加
和
1 行删除
| @@ -280,3 +280,22 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | @@ -280,3 +280,22 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | ||
| 280 | } | 280 | } |
| 281 | return result | 281 | return result |
| 282 | } | 282 | } |
| 283 | + | ||
| 284 | +// ImportCompanyUser 导入公司用户信息 | ||
| 285 | +func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { | ||
| 286 | + var mapTemplate = map[string]string{ | ||
| 287 | + domain.TemplateCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
| 288 | + // 模板待更新 | ||
| 289 | + domain.TemplateOrganization: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
| 290 | + domain.TemplateCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
| 291 | + domain.TemplateDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
| 292 | + } | ||
| 293 | + var url string | ||
| 294 | + var ok bool | ||
| 295 | + if url, ok = mapTemplate[importDataCommand.Code]; !ok { | ||
| 296 | + return nil, application.ThrowError(application.BUSINESS_ERROR, fmt.Sprintf("模板:%v 不存在", importDataCommand.Code)) | ||
| 297 | + } | ||
| 298 | + return map[string]string{ | ||
| 299 | + "url": url, | ||
| 300 | + }, nil | ||
| 301 | +} |
| @@ -48,3 +48,27 @@ const ( | @@ -48,3 +48,27 @@ const ( | ||
| 48 | MaxQueryRowCount = 1000 | 48 | MaxQueryRowCount = 1000 |
| 49 | NormalQueryRowCount = 100 | 49 | NormalQueryRowCount = 100 |
| 50 | ) | 50 | ) |
| 51 | + | ||
| 52 | +const ( | ||
| 53 | + // 导入公司用户 | ||
| 54 | + ImportCompanyUser = "ImportCompanyUser" | ||
| 55 | + // 导入公司组织 | ||
| 56 | + ImportOrganization = "ImportOrganization" | ||
| 57 | + // 导入共创用户 | ||
| 58 | + ImportCooperationUser = "ImportCooperationUser" | ||
| 59 | + | ||
| 60 | + // 导入分红订单 | ||
| 61 | + ImportDividendsOrders = "ImportDividendsOrders" | ||
| 62 | +) | ||
| 63 | + | ||
| 64 | +const ( | ||
| 65 | + // 导入公司用户 | ||
| 66 | + TemplateCompanyUser = "TemplateCompanyUser" | ||
| 67 | + // 导入公司组织 | ||
| 68 | + TemplateOrganization = "TemplateOrganization" | ||
| 69 | + // 导入共创用户 | ||
| 70 | + TemplateCooperationUser = "TemplateCooperationUser" | ||
| 71 | + | ||
| 72 | + // 分红订单模板 | ||
| 73 | + TemplateDividendsOrders = "TemplateDividendsOrders" | ||
| 74 | +) |
| @@ -2,6 +2,7 @@ package web_client | @@ -2,6 +2,7 @@ package web_client | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "errors" | 4 | "errors" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
| 5 | "path/filepath" | 6 | "path/filepath" |
| 6 | "strings" | 7 | "strings" |
| 7 | 8 | ||
| @@ -283,8 +284,19 @@ func (controller ExcelDataController) FileImport() { | @@ -283,8 +284,19 @@ func (controller ExcelDataController) FileImport() { | ||
| 283 | cmd.Reader = r | 284 | cmd.Reader = r |
| 284 | var data interface{} | 285 | var data interface{} |
| 285 | switch cmd.Code { | 286 | switch cmd.Code { |
| 286 | - case "ImportCompanyUser": | 287 | + case domain.ImportCompanyUser: |
| 287 | data, err = excelService.ImportCompanyUser(cmd) | 288 | data, err = excelService.ImportCompanyUser(cmd) |
| 288 | } | 289 | } |
| 289 | controller.Response(data, err) | 290 | controller.Response(data, err) |
| 290 | } | 291 | } |
| 292 | + | ||
| 293 | +func (controller ExcelDataController) FileImportTemplate() { | ||
| 294 | + excelService := service.NewExcelDataService(nil) | ||
| 295 | + cmd := &command.ImportDataCommand{} | ||
| 296 | + //controller.Unmarshal(cmd) | ||
| 297 | + code := controller.GetString(":code") | ||
| 298 | + cmd.Code = code | ||
| 299 | + var data interface{} | ||
| 300 | + data, err := excelService.FileImportTemplate(cmd) | ||
| 301 | + controller.Response(data, err) | ||
| 302 | +} |
| @@ -18,4 +18,5 @@ func init() { | @@ -18,4 +18,5 @@ func init() { | ||
| 18 | web.Router("/v1/web/excel/import/organization", &web_client.ExcelDataController{}, "Post:ImportOrganization") | 18 | web.Router("/v1/web/excel/import/organization", &web_client.ExcelDataController{}, "Post:ImportOrganization") |
| 19 | 19 | ||
| 20 | web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport") | 20 | web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport") |
| 21 | + web.Router("/v1/web/file-import-template/:code", &web_client.ExcelDataController{}, "Get:FileImportTemplate") | ||
| 21 | } | 22 | } |
-
请 注册 或 登录 后发表评论