正在显示
7 个修改的文件
包含
21 行增加
和
7 行删除
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | # Folders | 6 | # Folders |
7 | _obj | 7 | _obj |
8 | _test | 8 | _test |
9 | +public/file | ||
9 | 10 | ||
10 | # Architecture specific extensions/prefixes | 11 | # Architecture specific extensions/prefixes |
11 | *.[568vq] | 12 | *.[568vq] |
@@ -22,4 +23,5 @@ _testmain.go | @@ -22,4 +23,5 @@ _testmain.go | ||
22 | *.exe | 23 | *.exe |
23 | *.test | 24 | *.test |
24 | .log | 25 | .log |
25 | -.idea | ||
26 | +.idea | ||
27 | + |
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" | 9 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" |
10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query" | 10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query" |
11 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service" | 11 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service" |
12 | + "os" | ||
12 | "path" | 13 | "path" |
13 | "strconv" | 14 | "strconv" |
14 | ) | 15 | ) |
@@ -341,7 +342,6 @@ func (controller *SuMoneyController) ImportExchangeList () { | @@ -341,7 +342,6 @@ func (controller *SuMoneyController) ImportExchangeList () { | ||
341 | return | 342 | return |
342 | } | 343 | } |
343 | // TODO 增加导入失败原因返回 | 344 | // TODO 增加导入失败原因返回 |
344 | - | ||
345 | var response utils.JsonResponse | 345 | var response utils.JsonResponse |
346 | dataList := make([]interface{}, 0) | 346 | dataList := make([]interface{}, 0) |
347 | rows, _ := xlsx.GetRows("Sheet1") | 347 | rows, _ := xlsx.GetRows("Sheet1") |
@@ -354,7 +354,7 @@ func (controller *SuMoneyController) ImportExchangeList () { | @@ -354,7 +354,7 @@ func (controller *SuMoneyController) ImportExchangeList () { | ||
354 | for _, _ = range row { | 354 | for _, _ = range row { |
355 | createExchangeCashPersonCommand.ExchangeCashActivityId = activityId | 355 | createExchangeCashPersonCommand.ExchangeCashActivityId = activityId |
356 | // TODO 非空校验 | 356 | // TODO 非空校验 |
357 | - if createExchangeCashPersonCommand.PersonName == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{ | 357 | + if row[0] == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{ |
358 | controller.Ctx.WriteString( "空字段" ) | 358 | controller.Ctx.WriteString( "空字段" ) |
359 | return | 359 | return |
360 | } | 360 | } |
@@ -363,7 +363,6 @@ func (controller *SuMoneyController) ImportExchangeList () { | @@ -363,7 +363,6 @@ func (controller *SuMoneyController) ImportExchangeList () { | ||
363 | createExchangeCashPersonCommand.PersonAccount = row[1] | 363 | createExchangeCashPersonCommand.PersonAccount = row[1] |
364 | createExchangeCashPersonCommand.ExchangedSuMoney, _ = strconv.ParseFloat(row[2], 64) | 364 | createExchangeCashPersonCommand.ExchangedSuMoney, _ = strconv.ParseFloat(row[2], 64) |
365 | } | 365 | } |
366 | - | ||
367 | data, err := cashPoolService.CreateExchangeCashPerson(createExchangeCashPersonCommand) | 366 | data, err := cashPoolService.CreateExchangeCashPerson(createExchangeCashPersonCommand) |
368 | if err != nil { | 367 | if err != nil { |
369 | response = utils.ResponseError(controller.Ctx, err) | 368 | response = utils.ResponseError(controller.Ctx, err) |
@@ -458,12 +457,26 @@ func (controller *SuMoneyController) ExportExchangeList() { | @@ -458,12 +457,26 @@ func (controller *SuMoneyController) ExportExchangeList() { | ||
458 | } | 457 | } |
459 | } | 458 | } |
460 | f.SetActiveSheet(index) | 459 | f.SetActiveSheet(index) |
460 | + | ||
461 | + // 创建下载文件夹 | ||
462 | + mkErr :=os.Mkdir("download", os.ModePerm) | ||
463 | + if err!=nil{ | ||
464 | + fmt.Println(mkErr) | ||
465 | + } | ||
466 | + | ||
461 | //保存为文件 | 467 | //保存为文件 |
462 | - f.Path="public/file/素币兑换清单.xlsx" | 468 | + f.Path="download/素币兑换清单.xlsx" |
463 | if err := f.Save(); err != nil { | 469 | if err := f.Save(); err != nil { |
464 | fmt.Println(err) | 470 | fmt.Println(err) |
465 | } | 471 | } |
472 | + | ||
466 | controller.Ctx.Output.Download(f.Path,"素币兑换清单.xlsx") | 473 | controller.Ctx.Output.Download(f.Path,"素币兑换清单.xlsx") |
474 | + | ||
475 | + // 下载完成删除文件 | ||
476 | + removeErr := os.Remove(f.Path) | ||
477 | + if err != nil { | ||
478 | + fmt.Println(removeErr) | ||
479 | + } | ||
467 | } | 480 | } |
468 | } | 481 | } |
469 | 482 |
public/README.md
已删除
100644 → 0
1 | -#mmm-worth 1 |
public/file/素币兑换清单.xlsx
已删除
100644 → 0
不能预览此文件类型
public/file/订单表.xlsx
已删除
100644 → 0
不能预览此文件类型
public/兑换素币清单-导入模板.xlsx
已删除
100644 → 0
不能预览此文件类型
-
请 注册 或 登录 后发表评论