作者 tangxvhui

添加 综合评估的查询条件

... ... @@ -97,39 +97,90 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
var cntAll360 int
var cntUncompleted360 int
//查找360评估,统计未完成的
cnt360, _, err := evaluationRepo.Find(map[string]interface{}{
cntAll360, _, err = evaluationRepo.Find(map[string]interface{}{
"types": int(domain.Evaluation360),
"executorId": param.UserId,
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if cntAll360 > 0 {
//查找360评估,统计未完成的
cntUncompleted360, _, err = evaluationRepo.Find(map[string]interface{}{
"types": int(domain.Evaluation360),
"executorId": param.UserId,
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
var cntAllSuper int
var cntUncompletedSuper int
//查询需要执行上级评估,统计未完成
cntSuper, _, err := evaluationRepo.Find(map[string]interface{}{
cntAllSuper, _, err = evaluationRepo.Find(map[string]interface{}{
"types": int(domain.EvaluationSuper),
"executorId": param.UserId,
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if cntAllSuper > 0 {
//查询需要执行上级评估,统计未完成
cntUncompletedSuper, _, err = evaluationRepo.Find(map[string]interface{}{
"types": int(domain.EvaluationSuper),
"executorId": param.UserId,
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
var cntAllHrbp int
var cntUncompletedHrbp int
//查询需要执行人资评估,统计未完成
cntHrbp, _, err := evaluationRepo.Find(map[string]interface{}{
"types": int(domain.EvaluationHrbp),
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
cntAllHrbp, _, err = evaluationRepo.Find(map[string]interface{}{
"types": int(domain.EvaluationHrbp),
"limit": 1,
"cycleId": param.CycleId,
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if cntAllHrbp > 0 {
// 查询需要执行人资评估,统计未完成
cntUncompletedHrbp, _, err = evaluationRepo.Find(map[string]interface{}{
"types": int(domain.EvaluationHrbp),
"limit": 1,
"cycleId": param.CycleId,
"status": string(domain.EvaluationUncompleted),
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
isHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -177,7 +228,6 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
} else {
menu1_1.StatusName = "未完成"
}
}
if len(myEvaluationSuper) > 0 {
if myEvaluationSuper[0].CheckResult == domain.EvaluationCheckCompleted {
... ... @@ -201,12 +251,11 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
StatusName: "",
Types: "360综评",
}
if cnt360 > 0 {
if cntUncompleted360 > 0 {
menu2_1.StatusName = "未完成"
} else {
} else if cntAll360 > 0 {
menu2_1.StatusName = "已完成"
}
menu2.Child = append(menu2.Child, menu2_1)
menuList = append(menuList, menu2)
menu3 := adapter.MenuListAdapter{
CycleId: 0,
... ... @@ -221,12 +270,11 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
StatusName: "",
Types: "人资综评",
}
if cntHrbp > 0 {
if cntUncompletedHrbp > 0 {
menu3_1.StatusName = "未完成"
} else {
} else if cntAllHrbp > 0 {
menu3_1.StatusName = "已完成"
}
menu3.Child = append(menu3.Child, menu3_1)
//hrbp 才有这个菜单
if isHrbp > 0 {
menuList = append(menuList, menu3)
... ... @@ -244,9 +292,9 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
StatusName: "",
Types: "上级综评",
}
if cntSuper > 0 {
if cntUncompletedSuper > 0 {
menu4_1.StatusName = "未完成"
} else {
} else if cntAllSuper > 0 {
menu4_1.StatusName = "已完成"
}
menu4.Child = append(menu4.Child, menu4_1)
... ... @@ -512,14 +560,14 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
// 员工提交自评内容后,
// 员工作为被评估人,
// 变更360评估/人资评估/上级评估的开始时间
// 变更360评估/人资评估/的开始时间
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionContext application.TransactionContext, param *domain.SummaryEvaluation) error {
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": param.TargetUser.UserId,
"typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp), int(domain.EvaluationSuper)},
"typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
"cycleId": param.CycleId,
"limit": 1000,
})
... ... @@ -571,7 +619,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transaction
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 变更360评估/人资评估/上级评估的开始时间
// 变更上级评估的开始时间
for _, v := range evaluationList {
v.BeginTime = time.Now()
err = evaluationRepo.Save(v)
... ... @@ -1027,6 +1075,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command.
"executorId": param.ExecutorId,
"types": int(domain.EvaluationSuper),
"limit": limit,
"beginTime": time.Now(),
}
if offset > 0 {
condition1["offset"] = offset
... ... @@ -1046,6 +1095,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command.
"types": int(domain.EvaluationSuper),
"status": domain.EvaluationUncompleted,
"limit": 1,
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -1339,9 +1389,10 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query
//获取评估列表信息
condition1 := map[string]interface{}{
"cycleId": param.CycleId,
"types": int(domain.EvaluationSuper),
"limit": limit,
"cycleId": param.CycleId,
"types": int(domain.EvaluationSuper),
"limit": limit,
"beginTime": time.Now(),
}
if offset > 0 {
condition1["offset"] = offset
... ...
... ... @@ -48,6 +48,7 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu
"targetUserName": searchTargetName,
"limit": limit,
"offset": offset,
"beginTime": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -457,6 +458,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval
"types": domain.EvaluationHrbp,
"limit": limit,
"offset": offset,
"beginTime": time.Now(),
}
if len(param.SearchName) > 0 {
condition["targetUserName"] = "%" + param.SearchName + "%"
... ...
... ... @@ -162,6 +162,15 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{
query.Where(`summary_evaluation.executor->>'userId'='?'`, v)
}
if v, ok := queryOptions["beginTime"]; ok {
t := v.(time.Time)
query.Where(`summary_evaluation.begin_time<=?`, t)
}
if v, ok := queryOptions["endTime"]; ok {
t := v.(time.Time)
query.Where(`summary_evaluation.end_time>=?`, t)
}
query.Order("id desc")
count, err := query.SelectAndCount()
if err != nil {
... ...