...
|
...
|
@@ -258,7 +258,7 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent |
|
|
//处理查询到的数据
|
|
|
//汇总 Excel表格的表头描述
|
|
|
level1 := []string{} //分类
|
|
|
level3 := map[string][]string{} // key=分类+得分项类型 val=名称
|
|
|
level3 := map[string][]string{} //key=分类+得分项类型 val=名称
|
|
|
level4 := map[string]string{} //key=分类+名称 val=评估标准
|
|
|
for _, v := range contentList {
|
|
|
if v.ContentId == 0 {
|
...
|
...
|
@@ -447,38 +447,6 @@ func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleD |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
//roleRepo := factory.CreateRoleRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//})
|
|
|
//roleUserRepo := factory.CreateRoleUserRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//})
|
|
|
//_, roleList, err := roleRepo.Find(map[string]interface{}{
|
|
|
// "type": domain.RoleTypeSystem,
|
|
|
// "companyId": param.CompanyId,
|
|
|
//})
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取角色信息列表"+err.Error())
|
|
|
//}
|
|
|
//_, userRoleList, err := roleUserRepo.Find(map[string]interface{}{
|
|
|
// "companyId": param.CompanyId,
|
|
|
// "userId": param.OperaterId,
|
|
|
//})
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息列表"+err.Error())
|
|
|
//}
|
|
|
//hrbp := -1
|
|
|
//for _, v := range userRoleList {
|
|
|
// for _, v2 := range roleList {
|
|
|
// if v.RoleId == v2.Id {
|
|
|
// hrbp = 1
|
|
|
// break
|
|
|
// }
|
|
|
// }
|
|
|
// if hrbp == 1 {
|
|
|
// break
|
|
|
// }
|
|
|
//}
|
|
|
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
...
|
...
|
@@ -569,7 +537,7 @@ func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleD |
|
|
}
|
|
|
|
|
|
// 员工绩效-综合管理-导出绩效-个人
|
|
|
func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (*excelize.File, error) {
|
|
|
func (srv StaffAssessServeice) ExportUserAssess2(param *query.ExportUserAssess2Commad) (*excelize.File, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -598,6 +566,7 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
|
param.CycleId,
|
|
|
param.OperatorId,
|
|
|
hrbp,
|
|
|
param.ExportUserId,
|
|
|
)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -738,3 +707,126 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess |
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 员工绩效-项目管理-成员列表导出
|
|
|
|
|
|
func (srv StaffAssessServeice) ExportUserAssess3(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
hrbp, err := srv.getHRBP(transactionContext, param.CompanyId, param.OperaterId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
contentList, err := assessDao.ExportDataUserAssess(dao.SearchConditin1{
|
|
|
CompanyId: param.CompanyId,
|
|
|
CycleId: param.CycleId,
|
|
|
BeginDay: param.BeginDay,
|
|
|
TargetUserName: param.TargetUserName,
|
|
|
TargetUserId: param.TargetUserId,
|
|
|
Limit: 5000,
|
|
|
Offset: 0,
|
|
|
OperaterId: param.OperaterId,
|
|
|
Hrbp: hrbp,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取数据列表"+err.Error())
|
|
|
}
|
|
|
|
|
|
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{}{}
|
|
|
}
|
|
|
|
|
|
eData := newExportData2()
|
|
|
eData.setData(contentList)
|
|
|
//将数据写入xlsx
|
|
|
xlsxFile := excelize.NewFile()
|
|
|
sheetIndex := xlsxFile.GetActiveSheetIndex()
|
|
|
sheetName := xlsxFile.GetSheetName(sheetIndex)
|
|
|
//写入第一行
|
|
|
xlsxFile.SetCellStr(sheetName, "A1", "每日绩效汇总")
|
|
|
xlsxFile.SetCellStr(sheetName, "A2", "日期")
|
|
|
xlsxFile.MergeCell(sheetName, "A2", "A4")
|
|
|
xlsxFile.SetCellStr(sheetName, "B2", "姓名")
|
|
|
xlsxFile.MergeCell(sheetName, "B2", "B4")
|
|
|
xlsxFile.SetCellStr(sheetName, "A5", "评估标准")
|
|
|
|
|
|
//填充1,2 列
|
|
|
rowNum := 0
|
|
|
for _, v := range eData.rowSort.Child {
|
|
|
for _, v2 := range v.Child {
|
|
|
rowNum++
|
|
|
axisNum := fmt.Sprintf("%d", rowNum+5)
|
|
|
xlsxFile.SetCellStr(sheetName, "A"+axisNum, v.Name)
|
|
|
xlsxFile.SetCellStr(sheetName, "B"+axisNum, v2.Name)
|
|
|
}
|
|
|
}
|
|
|
for _, v := range eData.tableHeader.Child {
|
|
|
for _, v2 := range v.Child {
|
|
|
for _, v3 := range v2.Child {
|
|
|
_ = v3
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//写入二到五行
|
|
|
// 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)
|
|
|
// }
|
|
|
//从第六行开始写入用户填写的评估数据
|
|
|
// for k, v := range tableRowSort {
|
|
|
// rowNum := strconv.Itoa(k + 6)
|
|
|
// row := tableRows[v]
|
|
|
// for k2, v2 := range headerList {
|
|
|
// if k2 == 0 {
|
|
|
// xlsxFile.SetCellStr(sheetName, "A"+rowNum, row["BeginDay"])
|
|
|
// continue
|
|
|
// }
|
|
|
// if k2 == 1 {
|
|
|
// xlsxFile.SetCellStr(sheetName, "B"+rowNum, row["TargetUserName"])
|
|
|
// continue
|
|
|
// }
|
|
|
// colName, _ := excelize.ColumnNumberToName(k2 + 1)
|
|
|
// key := v2.Level1 + "+" + v2.Level3
|
|
|
// if mVal, ok := row[key]; ok {
|
|
|
// xlsxFile.SetCellStr(sheetName, colName+rowNum, mVal)
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
//TODO 调整样式
|
|
|
xlsxFile.MergeCell(sheetName, "A2", "A4")
|
|
|
xlsxFile.MergeCell(sheetName, "B2", "B4")
|
|
|
xlsxFile.MergeCell(sheetName, "B5", "B5")
|
|
|
// //设置行高
|
|
|
// for i := range tableRowSort {
|
|
|
// xlsxFile.SetRowHeight(sheetName, i+5, 50)
|
|
|
// }
|
|
|
// //设置列宽
|
|
|
// for i := range headerList {
|
|
|
// colName, _ := excelize.ColumnNumberToName(i + 1)
|
|
|
// if i == 0 {
|
|
|
// xlsxFile.SetColWidth(sheetName, colName, colName, 30)
|
|
|
// }
|
|
|
// }
|
|
|
return xlsxFile, nil
|
|
|
} |
...
|
...
|
|