|
@@ -211,7 +211,7 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs |
|
@@ -211,7 +211,7 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs |
211
|
return &result, nil
|
211
|
return &result, nil
|
212
|
}
|
212
|
}
|
213
|
|
213
|
|
214
|
-func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCycleDay) (*excelize.File, error) {
|
214
|
+func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {
|
215
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
215
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
216
|
if err != nil {
|
216
|
if err != nil {
|
217
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
217
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
@@ -249,6 +249,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
@@ -249,6 +249,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
249
|
if err := transactionContext.CommitTransaction(); err != nil {
|
249
|
if err := transactionContext.CommitTransaction(); err != nil {
|
250
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
250
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
251
|
}
|
251
|
}
|
|
|
252
|
+ //选择导出的评估项
|
|
|
253
|
+ includeCol := map[string]struct{}{}
|
|
|
254
|
+ for _, v := range param.ExportItems {
|
|
|
255
|
+ includeCol[v.Category+"+"+v.Name] = struct{}{}
|
|
|
256
|
+ }
|
252
|
|
257
|
|
253
|
//处理查询到的数据
|
258
|
//处理查询到的数据
|
254
|
//汇总 Excel表格的表头描述
|
259
|
//汇总 Excel表格的表头描述
|
|
@@ -259,6 +264,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
@@ -259,6 +264,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
259
|
if v.ContentId == 0 {
|
264
|
if v.ContentId == 0 {
|
260
|
continue
|
265
|
continue
|
261
|
}
|
266
|
}
|
|
|
267
|
+ if len(includeCol) > 0 {
|
|
|
268
|
+ if _, ok := includeCol[v.Category+"+"+v.ContentName]; !ok {
|
|
|
269
|
+ continue
|
|
|
270
|
+ }
|
|
|
271
|
+ }
|
262
|
level1Item := ""
|
272
|
level1Item := ""
|
263
|
for _, v1 := range level1 {
|
273
|
for _, v1 := range level1 {
|
264
|
if v.Category == v1 {
|
274
|
if v.Category == v1 {
|
|
@@ -354,6 +364,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
|
@@ -354,6 +364,11 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy |
354
|
tableRows[v.TargetUserId]["TargetUserName"] = v.TargetUserName
|
364
|
tableRows[v.TargetUserId]["TargetUserName"] = v.TargetUserName
|
355
|
tableRows[v.TargetUserId]["BeginDay"] = v.BeginDay
|
365
|
tableRows[v.TargetUserId]["BeginDay"] = v.BeginDay
|
356
|
if v.ContentId > 0 {
|
366
|
if v.ContentId > 0 {
|
|
|
367
|
+ if len(includeCol) > 0 {
|
|
|
368
|
+ if _, ok := includeCol[v.Category+"+"+v.ContentName]; !ok {
|
|
|
369
|
+ continue
|
|
|
370
|
+ }
|
|
|
371
|
+ }
|
357
|
value := []string{v.Value}
|
372
|
value := []string{v.Value}
|
358
|
for _, v2 := range v.Remark {
|
373
|
for _, v2 := range v.Remark {
|
359
|
value = append(value, v2.RemarkText)
|
374
|
value = append(value, v2.RemarkText)
|
|
@@ -611,29 +626,36 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
@@ -611,29 +626,36 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
611
|
continue
|
626
|
continue
|
612
|
}
|
627
|
}
|
613
|
xlsxFile.SetCellStr(v, "B2", v)
|
628
|
xlsxFile.SetCellStr(v, "B2", v)
|
|
|
629
|
+ xlsxFile.MergeCell(v, "B2", "B4")
|
614
|
//填充第一列数据
|
630
|
//填充第一列数据
|
615
|
- xlsxFile.SetCellStr(v, "A2", cycleName)
|
|
|
616
|
xlsxFile.SetCellStr(v, "A1", tableHeader.Name)
|
631
|
xlsxFile.SetCellStr(v, "A1", tableHeader.Name)
|
|
|
632
|
+ xlsxFile.SetCellStr(v, "A2", cycleName)
|
|
|
633
|
+ xlsxFile.MergeCell(v, "A2", "A4")
|
617
|
xlsxFile.SetCellStr(v, "A5", "权重")
|
634
|
xlsxFile.SetCellStr(v, "A5", "权重")
|
|
|
635
|
+ xlsxFile.MergeCell(v, "A5", "B5")
|
618
|
xlsxFile.SetCellStr(v, "A6", "评估标准")
|
636
|
xlsxFile.SetCellStr(v, "A6", "评估标准")
|
|
|
637
|
+ xlsxFile.MergeCell(v, "A6", "B6")
|
619
|
//日期
|
638
|
//日期
|
620
|
dayList := eData.userDayMap[v]
|
639
|
dayList := eData.userDayMap[v]
|
621
|
for ii, vv := range dayList {
|
640
|
for ii, vv := range dayList {
|
622
|
- if ii == 0 {
|
|
|
623
|
- axis := fmt.Sprintf("A%d", ii+7)
|
|
|
624
|
- xlsxFile.SetCellStr(v, axis, vv)
|
|
|
625
|
- } else {
|
|
|
626
|
- axis := fmt.Sprintf("A%d", 7+3*(ii+1))
|
641
|
+ //填写在第几行
|
|
|
642
|
+ axisNum := 7 + 3*ii
|
|
|
643
|
+ axis := fmt.Sprintf("A%d", axisNum)
|
627
|
xlsxFile.SetCellStr(v, axis, vv)
|
644
|
xlsxFile.SetCellStr(v, axis, vv)
|
|
|
645
|
+ axisEnd := fmt.Sprintf("B%d", axisNum+2)
|
|
|
646
|
+ xlsxFile.MergeCell(v, axis, axisEnd) //单元格高度按三个单元格合并
|
628
|
}
|
647
|
}
|
629
|
- }
|
648
|
+ allColNum := 0 //计算总共有多少列
|
|
|
649
|
+ //第一行
|
630
|
for _, v2 := range tableHeader.Child {
|
650
|
for _, v2 := range tableHeader.Child {
|
|
|
651
|
+
|
631
|
//第二行
|
652
|
//第二行
|
632
|
for _, v3 := range v2.Child {
|
653
|
for _, v3 := range v2.Child {
|
633
|
//第三行
|
654
|
//第三行
|
634
|
- for i4, v4 := range v3.Child {
|
655
|
+ for _, v4 := range v3.Child {
|
|
|
656
|
+ allColNum++
|
635
|
//按列填充数据
|
657
|
//按列填充数据
|
636
|
- colName, _ := excelize.ColumnNumberToName(i4 + 3) //第3列开始
|
658
|
+ colName, _ := excelize.ColumnNumberToName(allColNum + 2) //第3列开始
|
637
|
xlsxFile.SetCellStr(v, colName+"2", v2.Name) //分类
|
659
|
xlsxFile.SetCellStr(v, colName+"2", v2.Name) //分类
|
638
|
xlsxFile.SetCellStr(v, colName+"3", v3.Name) //加分项 得分项
|
660
|
xlsxFile.SetCellStr(v, colName+"3", v3.Name) //加分项 得分项
|
639
|
xlsxFile.SetCellStr(v, colName+"4", v4.Name) // 评估项名称
|
661
|
xlsxFile.SetCellStr(v, colName+"4", v4.Name) // 评估项名称
|
|
@@ -645,17 +667,22 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
@@ -645,17 +667,22 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
645
|
//按日期填充评估的填写的值
|
667
|
//按日期填充评估的填写的值
|
646
|
for i5, v5 := range dayList {
|
668
|
for i5, v5 := range dayList {
|
647
|
k1 := eData.dataKey(v, v5, v2.Name, v3.Name, v4.Name)
|
669
|
k1 := eData.dataKey(v, v5, v2.Name, v3.Name, v4.Name)
|
648
|
- if i5 > 0 {
|
|
|
649
|
- axis := fmt.Sprintf("%s%d", colName, 7+3*(i5+1)) //单元格高度按三个单元格合并
|
|
|
650
|
- xlsxFile.SetCellStr(v, axis, eData.data[k1].String())
|
|
|
651
|
- } else {
|
|
|
652
|
- axis := fmt.Sprintf("%s%d", colName, i5+7)
|
|
|
653
|
- xlsxFile.SetCellStr(v, axis, eData.data[k1].String())
|
670
|
+ //填写在第几行
|
|
|
671
|
+ axisNum := 7 + 3*i5
|
|
|
672
|
+ axis := fmt.Sprintf("%s%d", colName, axisNum)
|
|
|
673
|
+ if d, ok := eData.data[k1]; ok {
|
|
|
674
|
+ xlsxFile.SetCellStr(v, axis, d.String())
|
654
|
}
|
675
|
}
|
|
|
676
|
+ //单元格高度按三个单元格合并
|
|
|
677
|
+ axisEnd := fmt.Sprintf("%s%d", colName, axisNum+2)
|
|
|
678
|
+ xlsxFile.MergeCell(v, axis, axisEnd)
|
655
|
}
|
679
|
}
|
656
|
}
|
680
|
}
|
657
|
}
|
681
|
}
|
658
|
}
|
682
|
}
|
|
|
683
|
+ //
|
|
|
684
|
+ colName, _ := excelize.ColumnNumberToName(allColNum + 2)
|
|
|
685
|
+ xlsxFile.MergeCell(v, "A1", fmt.Sprintf("%s1", colName))
|
659
|
}
|
686
|
}
|
660
|
//删除默认的第一个sheet
|
687
|
//删除默认的第一个sheet
|
661
|
xlsxFile.DeleteSheet(firstSheetName)
|
688
|
xlsxFile.DeleteSheet(firstSheetName)
|
|
@@ -697,7 +724,11 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess |
|
@@ -697,7 +724,11 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess |
697
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
724
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
698
|
}
|
725
|
}
|
699
|
|
726
|
|
700
|
- headerList := HeaderLevel{}
|
727
|
+ headerList := HeaderLevel{
|
|
|
728
|
+ Name: "",
|
|
|
729
|
+ Filter: map[string]int{},
|
|
|
730
|
+ Child: []HeaderLevel{},
|
|
|
731
|
+ }
|
701
|
for _, v := range contentItems {
|
732
|
for _, v := range contentItems {
|
702
|
child := headerList.addChild(v.Category)
|
733
|
child := headerList.addChild(v.Category)
|
703
|
child.addChild(v.Name)
|
734
|
child.addChild(v.Name)
|