作者 tangxvhui

更新未完成评估任务的执行人员名单

... ... @@ -457,7 +457,6 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess
}
// 员工绩效-项目管理-成员列表导出
func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ...
... ... @@ -1182,15 +1182,6 @@ func (srv StaffAssessServeice) StaffAssessSuperBeforeEdit(param *query.AssessInf
return result, nil
}
// 自评评估内容编辑前
// func (srv StaffAssessServeice) StaffAssessSelfBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
// result, err := srv.GetAssessInfo(param)
// if err != nil {
// return &adapter.AssessInfoResp{}, err
// }
// return result, nil
// }
func (srv StaffAssessServeice) getStaffAssessBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -1289,6 +1280,35 @@ func (srv StaffAssessServeice) ListExcutorUncompleted(param *query.ListExecutorQ
defer func() {
_ = transactionContext.RollbackTransaction()
}()
if param.Types == "invite" {
staffAssessDao := dao.NewStaffAssessDao(map[string]interface{}{
"transactionContext": transactionContext,
})
targetUserList, err := staffAssessDao.ListTargetUserNoInvite(param.CompanyId, param.CycleId, param.BeginDay)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工列表"+err.Error())
}
userList := []map[string]string{}
userMap := map[string]struct{}{} //过滤重复的用户id
for _, val := range targetUserList {
if _, ok := userMap[val.UserId]; ok {
continue
} else {
userMap[val.UserId] = struct{}{}
}
u := map[string]string{
"userId": val.UserId,
"userName": val.UserName,
}
userList = append(userList, u)
}
result := map[string]interface{}{
"userList": userList,
}
return result, nil
}
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
... ... @@ -1309,7 +1329,7 @@ func (srv StaffAssessServeice) ListExcutorUncompleted(param *query.ListExecutorQ
}
_, assessList, err := assessReps.Find(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
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())
... ...
... ... @@ -261,3 +261,39 @@ and staff_assess."types" ='self'
_, err := tx.Query(&result, sqlStr, condition...)
return result, err
}
type ExecutorUser struct {
UserId string `pg:"user_id"`
UserName string `pg:"user_name"`
}
// 获取没有进行过360邀请的员工
func (d *StaffAssessDao) ListTargetUserNoInvite(companyId int, cycleId int, beginDay string) ([]ExecutorUser, error) {
sqlStr := `with t1 as (
select staff_assess.target_user ->>'userId' as user_id,
staff_assess.target_user ->>'userName' as user_name
from staff_assess
where 1=1
and cycle_id =?
and company_id =?
and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') =?
and "types" in('invite_same_super','invite_diff_super')
)
select staff_assess.target_user ->>'userId' as user_id,
staff_assess.target_user ->>'userName' as user_name,
from staff_assess
left join t1 on staff_assess.target_user ->>'userId'=t1.user_id
where 1=1
and staff_assess.cycle_id =?
and company_id = ?
and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') =?
and staff_assess."types"='self'
and t1.user_id isnull
`
condition := []interface{}{cycleId, companyId, beginDay, cycleId, companyId, beginDay}
tx := d.transactionContext.PgTx
var result []ExecutorUser
_, err := tx.Query(&result, sqlStr, condition...)
return result, err
}
... ...