|
@@ -258,7 +258,7 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent |
|
@@ -258,7 +258,7 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContent |
258
|
//处理查询到的数据
|
258
|
//处理查询到的数据
|
259
|
//汇总 Excel表格的表头描述
|
259
|
//汇总 Excel表格的表头描述
|
260
|
level1 := []string{} //分类
|
260
|
level1 := []string{} //分类
|
261
|
- level3 := map[string][]string{} // key=分类+得分项类型 val=名称
|
261
|
+ level3 := map[string][]string{} //key=分类+得分项类型 val=名称
|
262
|
level4 := map[string]string{} //key=分类+名称 val=评估标准
|
262
|
level4 := map[string]string{} //key=分类+名称 val=评估标准
|
263
|
for _, v := range contentList {
|
263
|
for _, v := range contentList {
|
264
|
if v.ContentId == 0 {
|
264
|
if v.ContentId == 0 {
|
|
@@ -447,38 +447,6 @@ func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleD |
|
@@ -447,38 +447,6 @@ func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleD |
447
|
if err != nil {
|
447
|
if err != nil {
|
448
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
448
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
449
|
}
|
449
|
}
|
450
|
- //roleRepo := factory.CreateRoleRepository(map[string]interface{}{
|
|
|
451
|
- // "transactionContext": transactionContext,
|
|
|
452
|
- //})
|
|
|
453
|
- //roleUserRepo := factory.CreateRoleUserRepository(map[string]interface{}{
|
|
|
454
|
- // "transactionContext": transactionContext,
|
|
|
455
|
- //})
|
|
|
456
|
- //_, roleList, err := roleRepo.Find(map[string]interface{}{
|
|
|
457
|
- // "type": domain.RoleTypeSystem,
|
|
|
458
|
- // "companyId": param.CompanyId,
|
|
|
459
|
- //})
|
|
|
460
|
- //if err != nil {
|
|
|
461
|
- // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取角色信息列表"+err.Error())
|
|
|
462
|
- //}
|
|
|
463
|
- //_, userRoleList, err := roleUserRepo.Find(map[string]interface{}{
|
|
|
464
|
- // "companyId": param.CompanyId,
|
|
|
465
|
- // "userId": param.OperaterId,
|
|
|
466
|
- //})
|
|
|
467
|
- //if err != nil {
|
|
|
468
|
- // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息列表"+err.Error())
|
|
|
469
|
- //}
|
|
|
470
|
- //hrbp := -1
|
|
|
471
|
- //for _, v := range userRoleList {
|
|
|
472
|
- // for _, v2 := range roleList {
|
|
|
473
|
- // if v.RoleId == v2.Id {
|
|
|
474
|
- // hrbp = 1
|
|
|
475
|
- // break
|
|
|
476
|
- // }
|
|
|
477
|
- // }
|
|
|
478
|
- // if hrbp == 1 {
|
|
|
479
|
- // break
|
|
|
480
|
- // }
|
|
|
481
|
- //}
|
|
|
482
|
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
|
450
|
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
|
483
|
"transactionContext": transactionContext,
|
451
|
"transactionContext": transactionContext,
|
484
|
})
|
452
|
})
|
|
@@ -569,7 +537,7 @@ func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleD |
|
@@ -569,7 +537,7 @@ func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleD |
569
|
}
|
537
|
}
|
570
|
|
538
|
|
571
|
// 员工绩效-综合管理-导出绩效-个人
|
539
|
// 员工绩效-综合管理-导出绩效-个人
|
572
|
-func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (*excelize.File, error) {
|
540
|
+func (srv StaffAssessServeice) ExportUserAssess2(param *query.ExportUserAssess2Commad) (*excelize.File, error) {
|
573
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
541
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
574
|
if err != nil {
|
542
|
if err != nil {
|
575
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
543
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
@@ -598,6 +566,7 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
|
@@ -598,6 +566,7 @@ func (srv StaffAssessServeice) ExportUserAssess2(param *query.SummaryCommand) (* |
598
|
param.CycleId,
|
566
|
param.CycleId,
|
599
|
param.OperatorId,
|
567
|
param.OperatorId,
|
600
|
hrbp,
|
568
|
hrbp,
|
|
|
569
|
+ param.ExportUserId,
|
601
|
)
|
570
|
)
|
602
|
if err != nil {
|
571
|
if err != nil {
|
603
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
572
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -738,3 +707,126 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess |
|
@@ -738,3 +707,126 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess |
738
|
}
|
707
|
}
|
739
|
return result, nil
|
708
|
return result, nil
|
740
|
}
|
709
|
}
|
|
|
710
|
+
|
|
|
711
|
+// 员工绩效-项目管理-成员列表导出
|
|
|
712
|
+
|
|
|
713
|
+func (srv StaffAssessServeice) ExportUserAssess3(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {
|
|
|
714
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
715
|
+ if err != nil {
|
|
|
716
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
717
|
+ }
|
|
|
718
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
719
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
720
|
+ }
|
|
|
721
|
+ defer func() {
|
|
|
722
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
723
|
+ }()
|
|
|
724
|
+
|
|
|
725
|
+ hrbp, err := srv.getHRBP(transactionContext, param.CompanyId, param.OperaterId)
|
|
|
726
|
+ if err != nil {
|
|
|
727
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
728
|
+ }
|
|
|
729
|
+
|
|
|
730
|
+ assessDao := dao.NewStaffAssessDao(map[string]interface{}{
|
|
|
731
|
+ "transactionContext": transactionContext,
|
|
|
732
|
+ })
|
|
|
733
|
+ contentList, err := assessDao.ExportDataUserAssess(dao.SearchConditin1{
|
|
|
734
|
+ CompanyId: param.CompanyId,
|
|
|
735
|
+ CycleId: param.CycleId,
|
|
|
736
|
+ BeginDay: param.BeginDay,
|
|
|
737
|
+ TargetUserName: param.TargetUserName,
|
|
|
738
|
+ TargetUserId: param.TargetUserId,
|
|
|
739
|
+ Limit: 5000,
|
|
|
740
|
+ Offset: 0,
|
|
|
741
|
+ OperaterId: param.OperaterId,
|
|
|
742
|
+ Hrbp: hrbp,
|
|
|
743
|
+ })
|
|
|
744
|
+ if err != nil {
|
|
|
745
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取数据列表"+err.Error())
|
|
|
746
|
+ }
|
|
|
747
|
+
|
|
|
748
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
749
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
750
|
+ }
|
|
|
751
|
+ //选择导出的评估项
|
|
|
752
|
+ includeCol := map[string]struct{}{}
|
|
|
753
|
+ for _, v := range param.ExportItems {
|
|
|
754
|
+ includeCol[v.Category+"+"+v.Name] = struct{}{}
|
|
|
755
|
+ }
|
|
|
756
|
+
|
|
|
757
|
+ eData := newExportData2()
|
|
|
758
|
+ eData.setData(contentList)
|
|
|
759
|
+ //将数据写入xlsx
|
|
|
760
|
+ xlsxFile := excelize.NewFile()
|
|
|
761
|
+ sheetIndex := xlsxFile.GetActiveSheetIndex()
|
|
|
762
|
+ sheetName := xlsxFile.GetSheetName(sheetIndex)
|
|
|
763
|
+ //写入第一行
|
|
|
764
|
+ xlsxFile.SetCellStr(sheetName, "A1", "每日绩效汇总")
|
|
|
765
|
+ xlsxFile.SetCellStr(sheetName, "A2", "日期")
|
|
|
766
|
+ xlsxFile.MergeCell(sheetName, "A2", "A4")
|
|
|
767
|
+ xlsxFile.SetCellStr(sheetName, "B2", "姓名")
|
|
|
768
|
+ xlsxFile.MergeCell(sheetName, "B2", "B4")
|
|
|
769
|
+ xlsxFile.SetCellStr(sheetName, "A5", "评估标准")
|
|
|
770
|
+
|
|
|
771
|
+ //填充1,2 列
|
|
|
772
|
+ rowNum := 0
|
|
|
773
|
+ for _, v := range eData.rowSort.Child {
|
|
|
774
|
+ for _, v2 := range v.Child {
|
|
|
775
|
+ rowNum++
|
|
|
776
|
+ axisNum := fmt.Sprintf("%d", rowNum+5)
|
|
|
777
|
+ xlsxFile.SetCellStr(sheetName, "A"+axisNum, v.Name)
|
|
|
778
|
+ xlsxFile.SetCellStr(sheetName, "B"+axisNum, v2.Name)
|
|
|
779
|
+ }
|
|
|
780
|
+ }
|
|
|
781
|
+ for _, v := range eData.tableHeader.Child {
|
|
|
782
|
+ for _, v2 := range v.Child {
|
|
|
783
|
+ for _, v3 := range v2.Child {
|
|
|
784
|
+ _ = v3
|
|
|
785
|
+ }
|
|
|
786
|
+ }
|
|
|
787
|
+ }
|
|
|
788
|
+ //写入二到五行
|
|
|
789
|
+ // for k, v := range headerList {
|
|
|
790
|
+ // colName, _ := excelize.ColumnNumberToName(k + 1)
|
|
|
791
|
+ // xlsxFile.SetCellStr(sheetName, colName+"2", v.Level1)
|
|
|
792
|
+ // xlsxFile.SetCellStr(sheetName, colName+"3", v.Level2)
|
|
|
793
|
+ // xlsxFile.SetCellStr(sheetName, colName+"4", v.Level3)
|
|
|
794
|
+ // xlsxFile.SetCellStr(sheetName, colName+"5", v.Level4)
|
|
|
795
|
+ // }
|
|
|
796
|
+ //从第六行开始写入用户填写的评估数据
|
|
|
797
|
+ // for k, v := range tableRowSort {
|
|
|
798
|
+ // rowNum := strconv.Itoa(k + 6)
|
|
|
799
|
+ // row := tableRows[v]
|
|
|
800
|
+ // for k2, v2 := range headerList {
|
|
|
801
|
+ // if k2 == 0 {
|
|
|
802
|
+ // xlsxFile.SetCellStr(sheetName, "A"+rowNum, row["BeginDay"])
|
|
|
803
|
+ // continue
|
|
|
804
|
+ // }
|
|
|
805
|
+ // if k2 == 1 {
|
|
|
806
|
+ // xlsxFile.SetCellStr(sheetName, "B"+rowNum, row["TargetUserName"])
|
|
|
807
|
+ // continue
|
|
|
808
|
+ // }
|
|
|
809
|
+ // colName, _ := excelize.ColumnNumberToName(k2 + 1)
|
|
|
810
|
+ // key := v2.Level1 + "+" + v2.Level3
|
|
|
811
|
+ // if mVal, ok := row[key]; ok {
|
|
|
812
|
+ // xlsxFile.SetCellStr(sheetName, colName+rowNum, mVal)
|
|
|
813
|
+ // }
|
|
|
814
|
+ // }
|
|
|
815
|
+ // }
|
|
|
816
|
+ //TODO 调整样式
|
|
|
817
|
+ xlsxFile.MergeCell(sheetName, "A2", "A4")
|
|
|
818
|
+ xlsxFile.MergeCell(sheetName, "B2", "B4")
|
|
|
819
|
+ xlsxFile.MergeCell(sheetName, "B5", "B5")
|
|
|
820
|
+ // //设置行高
|
|
|
821
|
+ // for i := range tableRowSort {
|
|
|
822
|
+ // xlsxFile.SetRowHeight(sheetName, i+5, 50)
|
|
|
823
|
+ // }
|
|
|
824
|
+ // //设置列宽
|
|
|
825
|
+ // for i := range headerList {
|
|
|
826
|
+ // colName, _ := excelize.ColumnNumberToName(i + 1)
|
|
|
827
|
+ // if i == 0 {
|
|
|
828
|
+ // xlsxFile.SetColWidth(sheetName, colName, colName, 30)
|
|
|
829
|
+ // }
|
|
|
830
|
+ // }
|
|
|
831
|
+ return xlsxFile, nil
|
|
|
832
|
+} |