作者 tangxvhui

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

@@ -457,7 +457,6 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess @@ -457,7 +457,6 @@ func (srv StaffAssessServeice) QueryPerformanceIndicator(param *query.ListAssess
457 } 457 }
458 458
459 // 员工绩效-项目管理-成员列表导出 459 // 员工绩效-项目管理-成员列表导出
460 -  
461 func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) { 460 func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessContentCycleDay) (*excelize.File, error) {
462 transactionContext, err := factory.CreateTransactionContext(nil) 461 transactionContext, err := factory.CreateTransactionContext(nil)
463 if err != nil { 462 if err != nil {
@@ -1182,15 +1182,6 @@ func (srv StaffAssessServeice) StaffAssessSuperBeforeEdit(param *query.AssessInf @@ -1182,15 +1182,6 @@ func (srv StaffAssessServeice) StaffAssessSuperBeforeEdit(param *query.AssessInf
1182 return result, nil 1182 return result, nil
1183 } 1183 }
1184 1184
1185 -// 自评评估内容编辑前  
1186 -// func (srv StaffAssessServeice) StaffAssessSelfBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {  
1187 -// result, err := srv.GetAssessInfo(param)  
1188 -// if err != nil {  
1189 -// return &adapter.AssessInfoResp{}, err  
1190 -// }  
1191 -// return result, nil  
1192 -// }  
1193 -  
1194 func (srv StaffAssessServeice) getStaffAssessBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) { 1185 func (srv StaffAssessServeice) getStaffAssessBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
1195 transactionContext, err := factory.CreateTransactionContext(nil) 1186 transactionContext, err := factory.CreateTransactionContext(nil)
1196 if err != nil { 1187 if err != nil {
@@ -1289,6 +1280,35 @@ func (srv StaffAssessServeice) ListExcutorUncompleted(param *query.ListExecutorQ @@ -1289,6 +1280,35 @@ func (srv StaffAssessServeice) ListExcutorUncompleted(param *query.ListExecutorQ
1289 defer func() { 1280 defer func() {
1290 _ = transactionContext.RollbackTransaction() 1281 _ = transactionContext.RollbackTransaction()
1291 }() 1282 }()
  1283 +
  1284 + if param.Types == "invite" {
  1285 + staffAssessDao := dao.NewStaffAssessDao(map[string]interface{}{
  1286 + "transactionContext": transactionContext,
  1287 + })
  1288 + targetUserList, err := staffAssessDao.ListTargetUserNoInvite(param.CompanyId, param.CycleId, param.BeginDay)
  1289 + if err != nil {
  1290 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工列表"+err.Error())
  1291 + }
  1292 + userList := []map[string]string{}
  1293 + userMap := map[string]struct{}{} //过滤重复的用户id
  1294 + for _, val := range targetUserList {
  1295 + if _, ok := userMap[val.UserId]; ok {
  1296 + continue
  1297 + } else {
  1298 + userMap[val.UserId] = struct{}{}
  1299 + }
  1300 + u := map[string]string{
  1301 + "userId": val.UserId,
  1302 + "userName": val.UserName,
  1303 + }
  1304 + userList = append(userList, u)
  1305 + }
  1306 + result := map[string]interface{}{
  1307 + "userList": userList,
  1308 + }
  1309 + return result, nil
  1310 + }
  1311 +
1292 assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ 1312 assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
1293 "transactionContext": transactionContext, 1313 "transactionContext": transactionContext,
1294 }) 1314 })
@@ -1309,7 +1329,7 @@ func (srv StaffAssessServeice) ListExcutorUncompleted(param *query.ListExecutorQ @@ -1309,7 +1329,7 @@ func (srv StaffAssessServeice) ListExcutorUncompleted(param *query.ListExecutorQ
1309 } 1329 }
1310 _, assessList, err := assessReps.Find(condition) 1330 _, assessList, err := assessReps.Find(condition)
1311 if err != nil { 1331 if err != nil {
1312 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) 1332 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工列表"+err.Error())
1313 } 1333 }
1314 if err := transactionContext.CommitTransaction(); err != nil { 1334 if err := transactionContext.CommitTransaction(); err != nil {
1315 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1335 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -261,3 +261,39 @@ and staff_assess."types" ='self' @@ -261,3 +261,39 @@ and staff_assess."types" ='self'
261 _, err := tx.Query(&result, sqlStr, condition...) 261 _, err := tx.Query(&result, sqlStr, condition...)
262 return result, err 262 return result, err
263 } 263 }
  264 +
  265 +type ExecutorUser struct {
  266 + UserId string `pg:"user_id"`
  267 + UserName string `pg:"user_name"`
  268 +}
  269 +
  270 +// 获取没有进行过360邀请的员工
  271 +func (d *StaffAssessDao) ListTargetUserNoInvite(companyId int, cycleId int, beginDay string) ([]ExecutorUser, error) {
  272 + sqlStr := `with t1 as (
  273 + select staff_assess.target_user ->>'userId' as user_id,
  274 + staff_assess.target_user ->>'userName' as user_name
  275 + from staff_assess
  276 + where 1=1
  277 + and cycle_id =?
  278 + and company_id =?
  279 + and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') =?
  280 + and "types" in('invite_same_super','invite_diff_super')
  281 +
  282 + )
  283 + select staff_assess.target_user ->>'userId' as user_id,
  284 + staff_assess.target_user ->>'userName' as user_name,
  285 + from staff_assess
  286 + left join t1 on staff_assess.target_user ->>'userId'=t1.user_id
  287 + where 1=1
  288 + and staff_assess.cycle_id =?
  289 + and company_id = ?
  290 + and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') =?
  291 + and staff_assess."types"='self'
  292 + and t1.user_id isnull
  293 + `
  294 + condition := []interface{}{cycleId, companyId, beginDay, cycleId, companyId, beginDay}
  295 + tx := d.transactionContext.PgTx
  296 + var result []ExecutorUser
  297 + _, err := tx.Query(&result, sqlStr, condition...)
  298 + return result, err
  299 +}