...
|
...
|
@@ -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)
|
...
|
...
|
@@ -619,14 +634,14 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
|
//日期
|
|
|
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("A%d", axisNum+2)
|
|
|
xlsxFile.MergeCell(v, axis, axisEnd) //单元格高度按三个单元格合并
|
|
|
}
|
|
|
//第一行
|
|
|
for _, v2 := range tableHeader.Child {
|
|
|
//第二行
|
|
|
for _, v3 := range v2.Child {
|
...
|
...
|
@@ -645,13 +660,13 @@ 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)
|
|
|
xlsxFile.SetCellStr(v, axis, eData.data[k1].String())
|
|
|
//单元格高度按三个单元格合并
|
|
|
axisEnd := fmt.Sprintf("%s%d", colName, axisNum+2)
|
|
|
xlsxFile.MergeCell(v, axis, axisEnd)
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|