...
|
...
|
@@ -132,6 +132,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
|
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())
|
|
|
}
|
...
|
...
|
@@ -147,16 +148,18 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
|
Child: []adapter.MenuListAdapter{},
|
|
|
}
|
|
|
menu1_1 := adapter.MenuListAdapter{
|
|
|
CycleId: param.CycleId,
|
|
|
NodeName: "填写综合自评",
|
|
|
StatusName: "",
|
|
|
Types: "填写综合自评",
|
|
|
CycleId: param.CycleId,
|
|
|
NodeName: "填写综合自评",
|
|
|
StatusName: "",
|
|
|
TargetUserId: param.UserId,
|
|
|
Types: "填写综合自评",
|
|
|
}
|
|
|
menu1_2 := adapter.MenuListAdapter{
|
|
|
CycleId: param.CycleId,
|
|
|
NodeName: "查看综合自评",
|
|
|
StatusName: "",
|
|
|
Types: "查看综合自评",
|
|
|
CycleId: param.CycleId,
|
|
|
NodeName: "查看综合自评",
|
|
|
StatusName: "",
|
|
|
TargetUserId: param.UserId,
|
|
|
Types: "查看综合自评",
|
|
|
}
|
|
|
if len(selfEvaluation) > 0 {
|
|
|
if selfEvaluation[0].Status == domain.EvaluationCompleted {
|
...
|
...
|
@@ -277,8 +280,8 @@ func (srv *SummaryEvaluationService) buildSummaryItemValue(itemList []*domain.Ev |
|
|
return itemValues
|
|
|
}
|
|
|
|
|
|
// 获取综合自评详情
|
|
|
func (srv *SummaryEvaluationService) GetEvaluationSelf(param *command.QueryEvaluation) (*adapter.EvaluationInfoSelfAdapter, error) {
|
|
|
// 根据周期id和被评估人获取综合自评详情
|
|
|
func (srv *SummaryEvaluationService) GetEvaluationSelfByCycle(param *command.QueryEvaluation) (*adapter.EvaluationInfoSelfAdapter, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -753,28 +756,28 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval |
|
|
}
|
|
|
//组合 评估填写的值和评估项
|
|
|
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
|
|
|
codeList := []*adapter.LevalCodeCount{}
|
|
|
codeMap := map[string]*adapter.LevalCodeCount{}
|
|
|
for _, v := range itemValuesAdapter {
|
|
|
if v.Weight > 0 {
|
|
|
continue
|
|
|
}
|
|
|
if _, ok := codeMap[v.Value]; !ok {
|
|
|
code := &adapter.LevalCodeCount{
|
|
|
Code: v.Value,
|
|
|
Number: 0,
|
|
|
ItemList: []string{},
|
|
|
}
|
|
|
codeMap[v.Value] = code
|
|
|
codeList = append(codeList, code)
|
|
|
}
|
|
|
codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
|
|
|
codeMap[v.Value].Number += 1
|
|
|
}
|
|
|
// codeList := []*adapter.LevalCodeCount{}
|
|
|
// codeMap := map[string]*adapter.LevalCodeCount{}
|
|
|
// for _, v := range itemValuesAdapter {
|
|
|
// if v.Weight > 0 {
|
|
|
// continue
|
|
|
// }
|
|
|
// if _, ok := codeMap[v.Value]; !ok {
|
|
|
// code := &adapter.LevalCodeCount{
|
|
|
// Code: v.Value,
|
|
|
// Number: 0,
|
|
|
// ItemList: []string{},
|
|
|
// }
|
|
|
// codeMap[v.Value] = code
|
|
|
// codeList = append(codeList, code)
|
|
|
// }
|
|
|
// codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
|
|
|
// codeMap[v.Value].Number += 1
|
|
|
// }
|
|
|
result := adapter.EvaluationInfoSuperAdapter{
|
|
|
EvaluationBaseAdapter: evaluationBase,
|
|
|
LevelCount: codeList,
|
|
|
EvaluationItems: itemValuesAdapter,
|
|
|
// LevelCount: codeList,
|
|
|
EvaluationItems: itemValuesAdapter,
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
...
|
...
|
@@ -1184,3 +1187,118 @@ func (srv *SummaryEvaluationService) ConfirmScoreSuperEvaluation(param *command. |
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// 按照周期和被评估的人 获取上级评估详情
|
|
|
func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command.QueryEvaluation) (*adapter.EvaluationInfoSuperAdapter, 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()
|
|
|
}()
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": param.UserId,
|
|
|
"types": domain.EvaluationSuper,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
|
|
|
}
|
|
|
evaluationData := evaluationList[0]
|
|
|
if evaluationData.Types == domain.EvaluationSuper {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
}
|
|
|
if evaluationData.CompanyId == param.CompanyId {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
}
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": evaluationData.EvaluationProjectId,
|
|
|
"nodeType": int(domain.LinkNodeSelfAssessment),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
//获取已填写的评估内容
|
|
|
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{
|
|
|
"summaryEvaluationId": evaluationData.Id,
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(itemValues) == 0 {
|
|
|
//上级还未填写评估,获取 360 ,人资评估
|
|
|
_, evaluationListOther, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
|
|
|
"targetUserId": evaluationData.TargetUser.UserId,
|
|
|
"cycleId": evaluationData.CycleId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
evaluationIds := []int{}
|
|
|
for _, v := range evaluationListOther {
|
|
|
evaluationIds = append(evaluationIds, v.Id)
|
|
|
}
|
|
|
if len(evaluationIds) > 0 {
|
|
|
_, itemValues, err = itemValueRepo.Find(map[string]interface{}{
|
|
|
"summaryEvaluationIdList": evaluationIds,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
evaluationBase := srv.getSummaryEvaluation(transactionContext, evaluationData)
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
//组合 评估填写的值和评估项
|
|
|
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
|
|
|
codeList := []*adapter.LevalCodeCount{}
|
|
|
codeMap := map[string]*adapter.LevalCodeCount{}
|
|
|
for _, v := range itemValuesAdapter {
|
|
|
if v.Weight > 0 {
|
|
|
continue
|
|
|
}
|
|
|
if _, ok := codeMap[v.Value]; !ok {
|
|
|
code := &adapter.LevalCodeCount{
|
|
|
Code: v.Value,
|
|
|
Number: 0,
|
|
|
ItemList: []string{},
|
|
|
}
|
|
|
codeMap[v.Value] = code
|
|
|
codeList = append(codeList, code)
|
|
|
}
|
|
|
codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
|
|
|
codeMap[v.Value].Number += 1
|
|
|
}
|
|
|
result := adapter.EvaluationInfoSuperAdapter{
|
|
|
EvaluationBaseAdapter: evaluationBase,
|
|
|
LevelCount: codeList,
|
|
|
EvaluationItems: itemValuesAdapter,
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 获取周期综合评估下,周期评估列表
|
|
|
func (srv *SummaryEvaluationService) ListEvalationSuper() (map[int]interface{}, error) {
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|