|
@@ -12,7 +12,6 @@ import ( |
|
@@ -12,7 +12,6 @@ import ( |
12
|
"os"
|
12
|
"os"
|
13
|
"path"
|
13
|
"path"
|
14
|
"strconv"
|
14
|
"strconv"
|
15
|
- "time"
|
|
|
16
|
)
|
15
|
)
|
17
|
|
16
|
|
18
|
type SuMoneyController struct {
|
17
|
type SuMoneyController struct {
|
|
@@ -446,6 +445,7 @@ func (controller *SuMoneyController) ExchangeCashListRanking() { |
|
@@ -446,6 +445,7 @@ func (controller *SuMoneyController) ExchangeCashListRanking() { |
446
|
controller.ServeJSON()
|
445
|
controller.ServeJSON()
|
447
|
}
|
446
|
}
|
448
|
|
447
|
|
|
|
448
|
+
|
449
|
// 导出素币兑换清单,选择导出(ids),增加导出失败信息
|
449
|
// 导出素币兑换清单,选择导出(ids),增加导出失败信息
|
450
|
func (controller *SuMoneyController) ExportExchangeList() {
|
450
|
func (controller *SuMoneyController) ExportExchangeList() {
|
451
|
cashPoolService := service.NewCashPoolService(nil)
|
451
|
cashPoolService := service.NewCashPoolService(nil)
|
|
@@ -483,25 +483,30 @@ func (controller *SuMoneyController) ExportExchangeList() { |
|
@@ -483,25 +483,30 @@ func (controller *SuMoneyController) ExportExchangeList() { |
483
|
index := f.NewSheet("Sheet1")
|
483
|
index := f.NewSheet("Sheet1")
|
484
|
//列标题赋值
|
484
|
//列标题赋值
|
485
|
for column, v := range titles {
|
485
|
for column, v := range titles {
|
486
|
- f.SetCellValue("Sheet1", cells[column]+"1", v)
|
486
|
+ f.SetCellValue("Sheet1", cells[column] + "1", v)
|
487
|
}
|
487
|
}
|
488
|
for lineNum, v := range data { //行数 lineNum 行内容 v
|
488
|
for lineNum, v := range data { //行数 lineNum 行内容 v
|
489
|
- columnNum := 0 //列数
|
|
|
490
|
- for _, vv := range v {
|
|
|
491
|
- sheetPosition := cells[columnNum] + strconv.Itoa(lineNum+2)
|
|
|
492
|
- f.SetCellValue("Sheet1", sheetPosition, vv.(string)) // 所有字段保存为字符串类型
|
|
|
493
|
- //switch vv.(type) {
|
|
|
494
|
- //case string:
|
|
|
495
|
- // f.SetCellValue("Sheet1", sheetPosition, vv.(string))
|
|
|
496
|
- // break
|
|
|
497
|
- //case int:
|
|
|
498
|
- // f.SetCellValue("Sheet1", sheetPosition, vv.(int))
|
|
|
499
|
- // break
|
|
|
500
|
- //case float64:
|
|
|
501
|
- // f.SetCellValue("Sheet1", sheetPosition, vv.(float64))
|
|
|
502
|
- // break
|
|
|
503
|
- //}
|
|
|
504
|
- columnNum++
|
489
|
+ for columnNum := 0; columnNum < len(v); columnNum ++ {
|
|
|
490
|
+ cell := cells[columnNum]
|
|
|
491
|
+ row := strconv.Itoa(lineNum + 2)
|
|
|
492
|
+ switch cell {
|
|
|
493
|
+ case "A":
|
|
|
494
|
+ sheetPosition := cell + row
|
|
|
495
|
+ f.SetCellValue("Sheet1", sheetPosition, v["name"])
|
|
|
496
|
+ break
|
|
|
497
|
+ case "B":
|
|
|
498
|
+ sheetPosition := cell + row
|
|
|
499
|
+ f.SetCellValue("Sheet1", sheetPosition, v["account"])
|
|
|
500
|
+ break
|
|
|
501
|
+ case "C":
|
|
|
502
|
+ sheetPosition := cell + row
|
|
|
503
|
+ f.SetCellValue("Sheet1", sheetPosition, v["exchanged_cash"])
|
|
|
504
|
+ break
|
|
|
505
|
+ case "D":
|
|
|
506
|
+ sheetPosition := cell + row
|
|
|
507
|
+ f.SetCellValue("Sheet1", sheetPosition, v["exchanged_su_money"])
|
|
|
508
|
+ break
|
|
|
509
|
+ }
|
505
|
}
|
510
|
}
|
506
|
}
|
511
|
}
|
507
|
f.SetActiveSheet(index)
|
512
|
f.SetActiveSheet(index)
|
|
@@ -562,11 +567,23 @@ func (controller *SuMoneyController) ExportSuMoney() { |
|
@@ -562,11 +567,23 @@ func (controller *SuMoneyController) ExportSuMoney() { |
562
|
f.SetCellValue("Sheet1", cells[column]+"1", v)
|
567
|
f.SetCellValue("Sheet1", cells[column]+"1", v)
|
563
|
}
|
568
|
}
|
564
|
for lineNum, v := range data { //行数 lineNum 行内容 v
|
569
|
for lineNum, v := range data { //行数 lineNum 行内容 v
|
565
|
- columnNum := 0 //列数
|
|
|
566
|
- for _, vv := range v {
|
|
|
567
|
- sheetPosition := cells[columnNum] + strconv.Itoa(lineNum+2)
|
|
|
568
|
- f.SetCellValue("Sheet1", sheetPosition, vv) // 所有字段保存为字符串类型
|
|
|
569
|
- columnNum++
|
570
|
+ for columnNum := 0; columnNum < len(v); columnNum ++ {
|
|
|
571
|
+ cell := cells[columnNum]
|
|
|
572
|
+ row := strconv.Itoa(lineNum + 2)
|
|
|
573
|
+ switch cell {
|
|
|
574
|
+ case "A":
|
|
|
575
|
+ sheetPosition := cell + row
|
|
|
576
|
+ f.SetCellValue("Sheet1", sheetPosition, v["name"])
|
|
|
577
|
+ break
|
|
|
578
|
+ case "B":
|
|
|
579
|
+ sheetPosition := cell + row
|
|
|
580
|
+ f.SetCellValue("Sheet1", sheetPosition, v["account"])
|
|
|
581
|
+ break
|
|
|
582
|
+ case "C":
|
|
|
583
|
+ sheetPosition := cell + row
|
|
|
584
|
+ f.SetCellValue("Sheet1", sheetPosition, v["current_su_money"])
|
|
|
585
|
+ break
|
|
|
586
|
+ }
|
570
|
}
|
587
|
}
|
571
|
}
|
588
|
}
|
572
|
f.SetActiveSheet(index)
|
589
|
f.SetActiveSheet(index)
|
|
@@ -606,13 +623,16 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() { |
|
@@ -606,13 +623,16 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() { |
606
|
var data []map[string]interface{}
|
623
|
var data []map[string]interface{}
|
607
|
records, err := suMoneyService.ListSuMoneyTransactionRecordById(exportTransactionRecordCommand)
|
624
|
records, err := suMoneyService.ListSuMoneyTransactionRecordById(exportTransactionRecordCommand)
|
608
|
for _, record := range records {
|
625
|
for _, record := range records {
|
|
|
626
|
+ timString := record.CreateTime.Format("2006/01/02 15:04:05")
|
|
|
627
|
+
|
609
|
p := map[string]interface{} {
|
628
|
p := map[string]interface{} {
|
610
|
"name": record.Employee.EmployeeName,
|
629
|
"name": record.Employee.EmployeeName,
|
611
|
"current_su_money": record.CurrentSuMoney,
|
630
|
"current_su_money": record.CurrentSuMoney,
|
612
|
"record": record.SuMoney,
|
631
|
"record": record.SuMoney,
|
613
|
- "create_time": record.CreateTime,
|
|
|
614
|
- "operator": record.Operator,
|
632
|
+ "create_time": timString,
|
|
|
633
|
+ "operator": record.Operator.EmployeeName,
|
615
|
}
|
634
|
}
|
|
|
635
|
+
|
616
|
data = append(data, p)
|
636
|
data = append(data, p)
|
617
|
}
|
637
|
}
|
618
|
if err != nil {
|
638
|
if err != nil {
|
|
@@ -629,25 +649,31 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() { |
|
@@ -629,25 +649,31 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() { |
629
|
f.SetCellValue("Sheet1", cells[column]+"1", v)
|
649
|
f.SetCellValue("Sheet1", cells[column]+"1", v)
|
630
|
}
|
650
|
}
|
631
|
for lineNum, v := range data { //行数 lineNum 行内容 v
|
651
|
for lineNum, v := range data { //行数 lineNum 行内容 v
|
632
|
- columnNum := 0 //列数
|
|
|
633
|
- for _, vv := range v {
|
|
|
634
|
- sheetPosition := cells[columnNum] + strconv.Itoa(lineNum+2)
|
|
|
635
|
- switch vv.(type) {
|
|
|
636
|
- case string:
|
|
|
637
|
- f.SetCellValue("Sheet1", sheetPosition, vv.(string))
|
652
|
+ for columnNum := 0; columnNum < len(v); columnNum ++ {
|
|
|
653
|
+ cell := cells[columnNum]
|
|
|
654
|
+ row := strconv.Itoa(lineNum + 2)
|
|
|
655
|
+ switch cell {
|
|
|
656
|
+ case "A":
|
|
|
657
|
+ sheetPosition := cell + row
|
|
|
658
|
+ f.SetCellValue("Sheet1", sheetPosition, v["name"])
|
|
|
659
|
+ break
|
|
|
660
|
+ case "B":
|
|
|
661
|
+ sheetPosition := cell + row
|
|
|
662
|
+ f.SetCellValue("Sheet1", sheetPosition, v["current_su_money"])
|
638
|
break
|
663
|
break
|
639
|
- case int:
|
|
|
640
|
- f.SetCellValue("Sheet1", sheetPosition, vv.(int))
|
664
|
+ case "C":
|
|
|
665
|
+ sheetPosition := cell + row
|
|
|
666
|
+ f.SetCellValue("Sheet1", sheetPosition, v["record"])
|
641
|
break
|
667
|
break
|
642
|
- case float64:
|
|
|
643
|
- f.SetCellValue("Sheet1", sheetPosition, vv.(float64))
|
668
|
+ case "D":
|
|
|
669
|
+ sheetPosition := cell + row
|
|
|
670
|
+ f.SetCellValue("Sheet1", sheetPosition, v["create_time"])
|
644
|
break
|
671
|
break
|
645
|
- // TODO 时间类型和格式转换
|
|
|
646
|
- case time.Time:
|
|
|
647
|
- f.SetCellValue("Sheet1", sheetPosition, vv)
|
672
|
+ case "E":
|
|
|
673
|
+ sheetPosition := cell + row
|
|
|
674
|
+ f.SetCellValue("Sheet1", sheetPosition, v["operator"])
|
648
|
break
|
675
|
break
|
649
|
}
|
676
|
}
|
650
|
- columnNum++
|
|
|
651
|
}
|
677
|
}
|
652
|
}
|
678
|
}
|
653
|
f.SetActiveSheet(index)
|
679
|
f.SetActiveSheet(index)
|