正在显示
5 个修改的文件
包含
80 行增加
和
3 行删除
@@ -1278,6 +1278,59 @@ func (srv StaffAssessServeice) getStaffAssessBeforeEdit(param *query.AssessInfoQ | @@ -1278,6 +1278,59 @@ func (srv StaffAssessServeice) getStaffAssessBeforeEdit(param *query.AssessInfoQ | ||
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | // 获取未完成评估任务的执行人员名单 | 1280 | // 获取未完成评估任务的执行人员名单 |
1281 | -func (srv StaffAssessServeice) ListExcutorUncompleted() error { | ||
1282 | - return nil | 1281 | +func (srv StaffAssessServeice) ListExcutorUncompleted(param *query.ListExecutorQuery) (map[string]interface{}, error) { |
1282 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
1283 | + if err != nil { | ||
1284 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1285 | + } | ||
1286 | + if err := transactionContext.StartTransaction(); err != nil { | ||
1287 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1288 | + } | ||
1289 | + defer func() { | ||
1290 | + _ = transactionContext.RollbackTransaction() | ||
1291 | + }() | ||
1292 | + assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ | ||
1293 | + "transactionContext": transactionContext, | ||
1294 | + }) | ||
1295 | + condition := map[string]interface{}{ | ||
1296 | + "cycleId": param.CycleId, | ||
1297 | + "beginDay": param.BeginDay, | ||
1298 | + "companyId": param.CompanyId, | ||
1299 | + "status": string(domain.StaffAssessUncompleted), | ||
1300 | + "typesList": []string{""}, | ||
1301 | + } | ||
1302 | + switch param.Types { | ||
1303 | + case "self": | ||
1304 | + condition["typesList"] = []string{string(domain.AssessSelf)} | ||
1305 | + case "super": | ||
1306 | + condition["typesList"] = []string{string(domain.AssessSuper)} | ||
1307 | + case "invite": | ||
1308 | + condition["typesList"] = []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)} | ||
1309 | + } | ||
1310 | + | ||
1311 | + _, assessList, err := assessReps.Find(condition) | ||
1312 | + if err != nil { | ||
1313 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) | ||
1314 | + } | ||
1315 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
1316 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1317 | + } | ||
1318 | + userList := []map[string]string{} | ||
1319 | + userMap := map[int]struct{}{} //过滤重复的用户id | ||
1320 | + for _, val := range assessList { | ||
1321 | + if _, ok := userMap[val.TargetUser.UserId]; ok { | ||
1322 | + continue | ||
1323 | + } else { | ||
1324 | + userMap[val.TargetUser.UserId] = struct{}{} | ||
1325 | + } | ||
1326 | + u := map[string]string{ | ||
1327 | + "userId": strconv.Itoa(val.TargetUser.UserId), | ||
1328 | + "userName": val.TargetUser.UserName, | ||
1329 | + } | ||
1330 | + userList = append(userList, u) | ||
1331 | + } | ||
1332 | + result := map[string]interface{}{ | ||
1333 | + "userList": userList, | ||
1334 | + } | ||
1335 | + return result, nil | ||
1283 | } | 1336 | } |
@@ -137,7 +137,6 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | @@ -137,7 +137,6 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | ||
137 | if v, ok := queryOptions["targetUserIds"]; ok { | 137 | if v, ok := queryOptions["targetUserIds"]; ok { |
138 | query.Where(`staff_assess.target_user->>'userId' in(?)`, pg.In(v)) | 138 | query.Where(`staff_assess.target_user->>'userId' in(?)`, pg.In(v)) |
139 | } | 139 | } |
140 | - | ||
141 | if v, ok := queryOptions["targetUserName"].(string); ok { | 140 | if v, ok := queryOptions["targetUserName"].(string); ok { |
142 | query.Where(`staff_assess.target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v)) | 141 | query.Where(`staff_assess.target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v)) |
143 | } | 142 | } |
@@ -355,3 +355,18 @@ func (c *StaffAssessController) GetStaffAsessSelfCountLevel() { | @@ -355,3 +355,18 @@ func (c *StaffAssessController) GetStaffAsessSelfCountLevel() { | ||
355 | data, err := srv.GetStaffAsessSelfCountLevel(paramReq) | 355 | data, err := srv.GetStaffAsessSelfCountLevel(paramReq) |
356 | c.Response(data, err) | 356 | c.Response(data, err) |
357 | } | 357 | } |
358 | + | ||
359 | +func (c *StaffAssessController) ListExcutorUncompleted() { | ||
360 | + srv := service.NewStaffAssessServeice() | ||
361 | + paramReq := &query.ListExecutorQuery{} | ||
362 | + err := c.BindJSON(paramReq) | ||
363 | + if err != nil { | ||
364 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
365 | + c.Response(nil, e) | ||
366 | + return | ||
367 | + } | ||
368 | + userReq := middlewares.GetUser(c.Ctx) | ||
369 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
370 | + data, err := srv.ListExcutorUncompleted(paramReq) | ||
371 | + c.Response(data, err) | ||
372 | +} |
@@ -36,6 +36,7 @@ func init() { | @@ -36,6 +36,7 @@ func init() { | ||
36 | web.NSCtrlPost("/summary/export-indicator", (*controllers.StaffAssessController).ExportPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 | 36 | web.NSCtrlPost("/summary/export-indicator", (*controllers.StaffAssessController).ExportPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 |
37 | web.NSCtrlPost("/target_user/self/cycle", (*controllers.StaffAssessController).ListTargetUserSelfCycle), //获取员工自评的周期下拉列表 | 37 | web.NSCtrlPost("/target_user/self/cycle", (*controllers.StaffAssessController).ListTargetUserSelfCycle), //获取员工自评的周期下拉列表 |
38 | web.NSCtrlPost("/target_user/self/summary", (*controllers.StaffAssessController).GetStaffAsessSelfCountLevel), //获取员工每日自评小结 | 38 | web.NSCtrlPost("/target_user/self/summary", (*controllers.StaffAssessController).GetStaffAsessSelfCountLevel), //获取员工每日自评小结 |
39 | + web.NSCtrlPost("/list/executor/uncompleted", (*controllers.StaffAssessController).ListExcutorUncompleted), //获取周期内对应日期的未完成填写评估的人员 | ||
39 | ) | 40 | ) |
40 | //v2 改版 | 41 | //v2 改版 |
41 | assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task", | 42 | assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task", |
-
请 注册 或 登录 后发表评论