...
|
...
|
@@ -2,8 +2,10 @@ package service |
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/xuri/excelize/v2"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/adapter"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
|
...
|
...
|
@@ -320,8 +322,20 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
|
level4[level4Key] = v.PromptText
|
|
|
}
|
|
|
}
|
|
|
//汇总表头
|
|
|
headerList := []excelTableHeader{}
|
|
|
//汇总表头,按列
|
|
|
headerList := []excelTableHeader{
|
|
|
{
|
|
|
Level1: "日期",
|
|
|
Level2: "",
|
|
|
Level3: "",
|
|
|
Level4: "评估标准",
|
|
|
}, {
|
|
|
Level1: "姓名",
|
|
|
Level2: "",
|
|
|
Level3: "",
|
|
|
Level4: "",
|
|
|
},
|
|
|
}
|
|
|
for _, v := range level1 {
|
|
|
item := excelTableHeader{
|
|
|
Level1: v,
|
...
|
...
|
@@ -347,7 +361,37 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
// tab
|
|
|
//数据形式 进行 行列转换
|
|
|
tableRows := map[string]map[string]string{}
|
|
|
tableRowSort := []string{}
|
|
|
for _, v := range contentList {
|
|
|
if _, ok := tableRows[v.TargetUserId]; !ok {
|
|
|
tableRows[v.TargetUserId] = map[string]string{}
|
|
|
tableRowSort = append(tableRowSort, v.TargetUserId)
|
|
|
}
|
|
|
tableRows[v.TargetUserId]["TargetUserName"] = v.TargetUserName
|
|
|
tableRows[v.TargetUserId]["BeginDay"] = v.BeginDay
|
|
|
value := []string{v.Value}
|
|
|
for _, v2 := range v.Remark {
|
|
|
value = append(value, v2.RemarkText)
|
|
|
}
|
|
|
key := v.Category + "+" + v.ContentName
|
|
|
tableRows[v.TargetUserId][key] = strings.Join(value, "\n")
|
|
|
}
|
|
|
//将数据写入xlsx
|
|
|
xlsxFile := excelize.NewFile()
|
|
|
sheetIndex := xlsxFile.GetActiveSheetIndex()
|
|
|
sheetName := xlsxFile.GetSheetName(sheetIndex)
|
|
|
// 写入第一行
|
|
|
xlsxFile.SetCellStr(sheetName, "A1", "每日绩效汇总")
|
|
|
//写入二到五行
|
|
|
for k, v := range headerList {
|
|
|
colName, _ := excelize.ColumnNumberToName(k + 1)
|
|
|
xlsxFile.SetCellStr(sheetName, colName+"2", v.Level1)
|
|
|
xlsxFile.SetCellStr(sheetName, colName+"3", v.Level2)
|
|
|
xlsxFile.SetCellStr(sheetName, colName+"4", v.Level3)
|
|
|
xlsxFile.SetCellStr(sheetName, colName+"5", v.Level4)
|
|
|
}
|
|
|
//从第六行开始写入用户填写的评估数据
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|