...
|
...
|
@@ -211,7 +211,7 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs |
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCycleDay) (*excelize.File, error) {
|
|
|
func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -249,6 +249,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
//选择导出的评估项
|
|
|
includeCol := map[string]struct{}{}
|
|
|
for _, v := range param.ExportItems {
|
|
|
includeCol[v.Category+"+"+v.Name] = struct{}{}
|
|
|
}
|
|
|
|
|
|
//处理查询到的数据
|
|
|
//汇总 Excel表格的表头描述
|
...
|
...
|
@@ -259,6 +264,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
|
if v.ContentId == 0 {
|
|
|
continue
|
|
|
}
|
|
|
if len(includeCol) > 0 {
|
|
|
if _, ok := includeCol[v.Category+"+"+v.ContentName]; !ok {
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
level1Item := ""
|
|
|
for _, v1 := range level1 {
|
|
|
if v.Category == v1 {
|
...
|
...
|
@@ -354,6 +364,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
|
tableRows[v.TargetUserId]["TargetUserName"] = v.TargetUserName
|
|
|
tableRows[v.TargetUserId]["BeginDay"] = v.BeginDay
|
|
|
if v.ContentId > 0 {
|
|
|
if len(includeCol) > 0 {
|
|
|
if _, ok := includeCol[v.Category+"+"+v.ContentName]; !ok {
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
value := []string{v.Value}
|
|
|
for _, v2 := range v.Remark {
|
|
|
value = append(value, v2.RemarkText)
|
...
|
...
|
@@ -611,32 +626,39 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
|
continue
|
|
|
}
|
|
|
xlsxFile.SetCellStr(v, "B2", v)
|
|
|
xlsxFile.MergeCell(v, "B2", "B4")
|
|
|
//填充第一列数据
|
|
|
xlsxFile.SetCellStr(v, "A2", cycleName)
|
|
|
xlsxFile.SetCellStr(v, "A1", tableHeader.Name)
|
|
|
xlsxFile.SetCellStr(v, "A2", cycleName)
|
|
|
xlsxFile.MergeCell(v, "A2", "A4")
|
|
|
xlsxFile.SetCellStr(v, "A5", "权重")
|
|
|
xlsxFile.MergeCell(v, "A5", "B5")
|
|
|
xlsxFile.SetCellStr(v, "A6", "评估标准")
|
|
|
xlsxFile.MergeCell(v, "A6", "B6")
|
|
|
//日期
|
|
|
dayList := eData.userDayMap[v]
|
|
|
for ii, vv := range dayList {
|
|
|
if ii == 0 {
|
|
|
axis := fmt.Sprintf("A%d", ii+7)
|
|
|
xlsxFile.SetCellStr(v, axis, vv)
|
|
|
} else {
|
|
|
axis := fmt.Sprintf("A%d", 7+3*(ii+1))
|
|
|
xlsxFile.SetCellStr(v, axis, vv)
|
|
|
}
|
|
|
//填写在第几行
|
|
|
axisNum := 7 + 3*ii
|
|
|
axis := fmt.Sprintf("A%d", axisNum)
|
|
|
xlsxFile.SetCellStr(v, axis, vv)
|
|
|
axisEnd := fmt.Sprintf("B%d", axisNum+2)
|
|
|
xlsxFile.MergeCell(v, axis, axisEnd) //单元格高度按三个单元格合并
|
|
|
}
|
|
|
allColNum := 0 //计算总共有多少列
|
|
|
//第一行
|
|
|
for _, v2 := range tableHeader.Child {
|
|
|
|
|
|
//第二行
|
|
|
for _, v3 := range v2.Child {
|
|
|
//第三行
|
|
|
for i4, v4 := range v3.Child {
|
|
|
for _, v4 := range v3.Child {
|
|
|
allColNum++
|
|
|
//按列填充数据
|
|
|
colName, _ := excelize.ColumnNumberToName(i4 + 3) //第3列开始
|
|
|
xlsxFile.SetCellStr(v, colName+"2", v2.Name) //分类
|
|
|
xlsxFile.SetCellStr(v, colName+"3", v3.Name) //加分项 得分项
|
|
|
xlsxFile.SetCellStr(v, colName+"4", v4.Name) // 评估项名称
|
|
|
colName, _ := excelize.ColumnNumberToName(allColNum + 2) //第3列开始
|
|
|
xlsxFile.SetCellStr(v, colName+"2", v2.Name) //分类
|
|
|
xlsxFile.SetCellStr(v, colName+"3", v3.Name) //加分项 得分项
|
|
|
xlsxFile.SetCellStr(v, colName+"4", v4.Name) // 评估项名称
|
|
|
//权重 填写第5行数据
|
|
|
k23 := eData.data23Key(v, v2.Name, v3.Name, v4.Name)
|
|
|
xlsxFile.SetCellStr(v, colName+"5", eData.data3[k23])
|
...
|
...
|
@@ -645,17 +667,22 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
|
//按日期填充评估的填写的值
|
|
|
for i5, v5 := range dayList {
|
|
|
k1 := eData.dataKey(v, v5, v2.Name, v3.Name, v4.Name)
|
|
|
if i5 > 0 {
|
|
|
axis := fmt.Sprintf("%s%d", colName, 7+3*(i5+1)) //单元格高度按三个单元格合并
|
|
|
xlsxFile.SetCellStr(v, axis, eData.data[k1].String())
|
|
|
} else {
|
|
|
axis := fmt.Sprintf("%s%d", colName, i5+7)
|
|
|
xlsxFile.SetCellStr(v, axis, eData.data[k1].String())
|
|
|
//填写在第几行
|
|
|
axisNum := 7 + 3*i5
|
|
|
axis := fmt.Sprintf("%s%d", colName, axisNum)
|
|
|
if d, ok := eData.data[k1]; ok {
|
|
|
xlsxFile.SetCellStr(v, axis, d.String())
|
|
|
}
|
|
|
//单元格高度按三个单元格合并
|
|
|
axisEnd := fmt.Sprintf("%s%d", colName, axisNum+2)
|
|
|
xlsxFile.MergeCell(v, axis, axisEnd)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
colName, _ := excelize.ColumnNumberToName(allColNum + 2)
|
|
|
xlsxFile.MergeCell(v, "A1", fmt.Sprintf("%s1", colName))
|
|
|
}
|
|
|
//删除默认的第一个sheet
|
|
|
xlsxFile.DeleteSheet(firstSheetName)
|
...
|
...
|
@@ -697,7 +724,11 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
headerList := HeaderLevel{}
|
|
|
headerList := HeaderLevel{
|
|
|
Name: "",
|
|
|
Filter: map[string]int{},
|
|
|
Child: []HeaderLevel{},
|
|
|
}
|
|
|
for _, v := range contentItems {
|
|
|
child := headerList.addChild(v.Category)
|
|
|
child.addChild(v.Name)
|
...
|
...
|
|