|
@@ -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)
|
|
@@ -619,14 +634,14 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
@@ -619,14 +634,14 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
619
|
//日期
|
634
|
//日期
|
|
620
|
dayList := eData.userDayMap[v]
|
635
|
dayList := eData.userDayMap[v]
|
|
621
|
for ii, vv := range dayList {
|
636
|
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))
|
|
|
|
627
|
- xlsxFile.SetCellStr(v, axis, vv)
|
|
|
|
628
|
- }
|
637
|
+ //填写在第几行
|
|
|
|
638
|
+ axisNum := 7 + 3*ii
|
|
|
|
639
|
+ axis := fmt.Sprintf("A%d", axisNum)
|
|
|
|
640
|
+ xlsxFile.SetCellStr(v, axis, vv)
|
|
|
|
641
|
+ axisEnd := fmt.Sprintf("A%d", axisNum+2)
|
|
|
|
642
|
+ xlsxFile.MergeCell(v, axis, axisEnd) //单元格高度按三个单元格合并
|
|
629
|
}
|
643
|
}
|
|
|
|
644
|
+ //第一行
|
|
630
|
for _, v2 := range tableHeader.Child {
|
645
|
for _, v2 := range tableHeader.Child {
|
|
631
|
//第二行
|
646
|
//第二行
|
|
632
|
for _, v3 := range v2.Child {
|
647
|
for _, v3 := range v2.Child {
|
|
@@ -645,13 +660,13 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
@@ -645,13 +660,13 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
645
|
//按日期填充评估的填写的值
|
660
|
//按日期填充评估的填写的值
|
|
646
|
for i5, v5 := range dayList {
|
661
|
for i5, v5 := range dayList {
|
|
647
|
k1 := eData.dataKey(v, v5, v2.Name, v3.Name, v4.Name)
|
662
|
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())
|
|
|
|
654
|
- }
|
663
|
+ //填写在第几行
|
|
|
|
664
|
+ axisNum := 7 + 3*i5
|
|
|
|
665
|
+ axis := fmt.Sprintf("%s%d", colName, axisNum)
|
|
|
|
666
|
+ xlsxFile.SetCellStr(v, axis, eData.data[k1].String())
|
|
|
|
667
|
+ //单元格高度按三个单元格合并
|
|
|
|
668
|
+ axisEnd := fmt.Sprintf("%s%d", colName, axisNum+2)
|
|
|
|
669
|
+ xlsxFile.MergeCell(v, axis, axisEnd)
|
|
655
|
}
|
670
|
}
|
|
656
|
}
|
671
|
}
|
|
657
|
}
|
672
|
}
|