Browse Source

用户分析增加相关属性

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.4.2^2
zouap 4 years ago
parent
commit
48229a6e7d
1 changed files with 9 additions and 6 deletions
  1. +9
    -6
      routers/repo/user_data_analysis.go

+ 9
- 6
routers/repo/user_data_analysis.go View File

@@ -55,8 +55,8 @@ func getExcelHeader(ctx *context.Context) map[string]string {
excelHeader = append(excelHeader, ctx.Tr("user.static.countdate"))

excelHeaderMap := make(map[string]string, 0)
i := 0
var i byte
i = 0
for _, value := range excelHeader {
excelColumn := getColumn(i) + fmt.Sprint(1)
log.Info("excelColumn=" + excelColumn)
@@ -68,7 +68,8 @@ func getExcelHeader(ctx *context.Context) map[string]string {

func writeExcel(row int, xlsx *excelize.File, sheetName string, userRecord *models.UserBusinessAnalysisAll) {
rows := fmt.Sprint(row)
tmp := 0
var tmp byte
tmp = 0
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.ID)
tmp = tmp + 1
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Name)
@@ -133,11 +134,13 @@ func writeExcel(row int, xlsx *excelize.File, sheetName string, userRecord *mode
tmp = tmp + 1
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, formatTime)
}
func getColumn(tmp int) string {
func getColumn(tmp byte) string {
var tmpA byte
tmpA = 'A'
if tmp < 26 {
return fmt.Sprint('A' + tmp)
return string(tmpA + tmp)
} else {
return "A" + fmt.Sprint('A'+(tmp-26))
return "A" + string(tmpA+(tmp-26))
}
}



Loading…
Cancel
Save