|
@@ -154,13 +154,14 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
|
@@ -154,13 +154,14 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
154
|
}
|
154
|
}
|
155
|
if len(assessInviteData) > 0 {
|
155
|
if len(assessInviteData) > 0 {
|
156
|
stepItem.Status = string(domain.StaffAssessCompleted)
|
156
|
stepItem.Status = string(domain.StaffAssessCompleted)
|
|
|
157
|
+ } else {
|
|
|
158
|
+ stepItem.Status = string(domain.StaffAssessUncompleted)
|
157
|
}
|
159
|
}
|
158
|
//待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
|
160
|
//待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
|
159
|
if len(assessInviteData) > 5 {
|
161
|
if len(assessInviteData) > 5 {
|
160
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
162
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
161
|
} else {
|
163
|
} else {
|
162
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
|
164
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
|
163
|
- stepItem.Status = string(domain.StaffAssessUncompleted)
|
|
|
164
|
}
|
165
|
}
|
165
|
case domain.LinkNodeAllAssessment:
|
166
|
case domain.LinkNodeAllAssessment:
|
166
|
//我评估别人,被邀请评估
|
167
|
//我评估别人,被邀请评估
|
|
@@ -352,36 +353,21 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
|
@@ -352,36 +353,21 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
352
|
}
|
353
|
}
|
353
|
nowTime := time.Now()
|
354
|
nowTime := time.Now()
|
354
|
|
355
|
|
355
|
- _, assassessTaskList, err := assessTaskRepo.Find(map[string]interface{}{
|
|
|
356
|
- "evaluationProjectId": param.EvaluationProjectId,
|
|
|
357
|
- "beginDay": taskBeginTime.Local().Format("2006-01-02"),
|
|
|
358
|
- })
|
|
|
359
|
- if err != nil {
|
|
|
360
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询同日期同项目已存在的评估任务"+err.Error())
|
|
|
361
|
- }
|
|
|
362
|
- var assessTaskData *domain.StaffAssessTask
|
|
|
363
|
- //更新旧数据或者新建数据
|
|
|
364
|
- if len(assassessTaskList) > 0 {
|
|
|
365
|
- assessTaskData = assassessTaskList[0]
|
|
|
366
|
- assessTaskData.UpdatedAt = nowTime
|
|
|
367
|
- } else {
|
|
|
368
|
- //建立新的评估任务
|
|
|
369
|
- assessTaskData = &domain.StaffAssessTask{
|
|
|
370
|
- Id: 0,
|
|
|
371
|
- CompanyId: param.CompanyId,
|
|
|
372
|
- EvaluationProjectId: param.EvaluationProjectId,
|
|
|
373
|
- EvaluationProjectName: param.EvaluationProjectName,
|
|
|
374
|
- CycleId: param.CycleId,
|
|
|
375
|
- CycleName: param.CycleName,
|
|
|
376
|
- BeginTime: taskBeginTime,
|
|
|
377
|
- EndTime: taskEndTime,
|
|
|
378
|
- StepList: []domain.AssessTaskStep{},
|
|
|
379
|
- ExecutorId: []int{},
|
|
|
380
|
- CreatedAt: nowTime,
|
|
|
381
|
- UpdatedAt: nowTime,
|
|
|
382
|
- DeletedAt: nil,
|
|
|
383
|
- BeginDay: taskBeginTime.Local().Format("2006-01-02"),
|
|
|
384
|
- }
|
356
|
+ assessTaskData := &domain.StaffAssessTask{
|
|
|
357
|
+ Id: 0,
|
|
|
358
|
+ CompanyId: param.CompanyId,
|
|
|
359
|
+ EvaluationProjectId: param.EvaluationProjectId,
|
|
|
360
|
+ EvaluationProjectName: param.EvaluationProjectName,
|
|
|
361
|
+ CycleId: param.CycleId,
|
|
|
362
|
+ CycleName: param.CycleName,
|
|
|
363
|
+ BeginTime: taskBeginTime,
|
|
|
364
|
+ EndTime: taskEndTime,
|
|
|
365
|
+ StepList: []domain.AssessTaskStep{},
|
|
|
366
|
+ ExecutorId: []int{},
|
|
|
367
|
+ CreatedAt: nowTime,
|
|
|
368
|
+ UpdatedAt: nowTime,
|
|
|
369
|
+ DeletedAt: nil,
|
|
|
370
|
+ BeginDay: taskBeginTime.Local().Format("2006-01-02"),
|
385
|
}
|
371
|
}
|
386
|
executorIds := []int{} //提取评估的参与人id
|
372
|
executorIds := []int{} //提取评估的参与人id
|
387
|
executorIdMap := map[int]struct{}{} //过滤重复的用户
|
373
|
executorIdMap := map[int]struct{}{} //过滤重复的用户
|
|
@@ -393,24 +379,8 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
|
@@ -393,24 +379,8 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat |
393
|
executorIdMap[v] = struct{}{}
|
379
|
executorIdMap[v] = struct{}{}
|
394
|
executorIds = append(executorIds, v)
|
380
|
executorIds = append(executorIds, v)
|
395
|
}
|
381
|
}
|
396
|
- //就数据中提取参与人
|
|
|
397
|
- for _, v := range assessTaskData.ExecutorId {
|
|
|
398
|
- if _, ok := executorIdMap[v]; ok {
|
|
|
399
|
- continue
|
|
|
400
|
- }
|
|
|
401
|
- executorIdMap[v] = struct{}{}
|
|
|
402
|
- executorIds = append(executorIds, v)
|
|
|
403
|
- }
|
|
|
404
|
- //填入新的参与人id
|
|
|
405
|
assessTaskData.ExecutorId = executorIds
|
382
|
assessTaskData.ExecutorId = executorIds
|
406
|
- //填充新的评估环节
|
|
|
407
|
-loop:
|
|
|
408
|
for _, v := range param.StepList {
|
383
|
for _, v := range param.StepList {
|
409
|
- for _, vv := range assessTaskData.StepList {
|
|
|
410
|
- if vv.LinkNodeId == v.LinkNodeId {
|
|
|
411
|
- continue loop
|
|
|
412
|
- }
|
|
|
413
|
- }
|
|
|
414
|
stepBeginTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.BeginTime, time.Local)
|
384
|
stepBeginTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.BeginTime, time.Local)
|
415
|
if err != nil {
|
385
|
if err != nil {
|
416
|
return nil, application.ThrowError(application.ARG_ERROR, "评估环节开始时间填写错误,"+param.BeginTime)
|
386
|
return nil, application.ThrowError(application.ARG_ERROR, "评估环节开始时间填写错误,"+param.BeginTime)
|
|
@@ -429,20 +399,45 @@ loop: |
|
@@ -429,20 +399,45 @@ loop: |
429
|
}
|
399
|
}
|
430
|
assessTaskData.StepList = append(assessTaskData.StepList, step)
|
400
|
assessTaskData.StepList = append(assessTaskData.StepList, step)
|
431
|
}
|
401
|
}
|
432
|
- //排序流程环节
|
|
|
433
|
- stepList := domain.SortTaskStep(assessTaskData.StepList)
|
|
|
434
|
- sort.Sort(stepList)
|
|
|
435
|
- assessTaskData.StepList = stepList
|
|
|
436
|
//添加员工的节点任务
|
402
|
//添加员工的节点任务
|
437
|
assessList, err := srv.createStaffAssess(transactionContext, assessTaskData)
|
403
|
assessList, err := srv.createStaffAssess(transactionContext, assessTaskData)
|
438
|
if err != nil {
|
404
|
if err != nil {
|
439
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成个人评估项"+err.Error())
|
405
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成个人评估项"+err.Error())
|
440
|
}
|
406
|
}
|
|
|
407
|
+
|
|
|
408
|
+ //合并项目评估的新旧数据
|
|
|
409
|
+ _, assassessTaskList, err := assessTaskRepo.Find(map[string]interface{}{
|
|
|
410
|
+ "evaluationProjectId": param.EvaluationProjectId,
|
|
|
411
|
+ "beginDay": taskBeginTime.Local().Format("2006-01-02"),
|
|
|
412
|
+ })
|
|
|
413
|
+ if err != nil {
|
|
|
414
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询同日期同项目已存在的评估任务"+err.Error())
|
|
|
415
|
+ }
|
|
|
416
|
+
|
|
|
417
|
+ if len(assassessTaskList) > 0 {
|
|
|
418
|
+ //就数据中提取参与人
|
|
|
419
|
+ for _, v := range assessTaskData.ExecutorId {
|
|
|
420
|
+ if _, ok := executorIdMap[v]; ok {
|
|
|
421
|
+ continue
|
|
|
422
|
+ }
|
|
|
423
|
+ executorIdMap[v] = struct{}{}
|
|
|
424
|
+ executorIds = append(executorIds, v)
|
|
|
425
|
+ }
|
|
|
426
|
+ assassessTaskList[0].UpdatedAt = time.Now()
|
|
|
427
|
+ assassessTaskList[0].ExecutorId = executorIds
|
|
|
428
|
+ //更新步骤
|
|
|
429
|
+ assassessTaskList[0].StepList = append(assassessTaskList[0].StepList, assessTaskData.StepList...)
|
|
|
430
|
+ assessTaskData = assassessTaskList[0]
|
|
|
431
|
+ //排序流程环节
|
|
|
432
|
+ stepList := domain.SortTaskStep(assessTaskData.StepList)
|
|
|
433
|
+ sort.Sort(stepList)
|
|
|
434
|
+ }
|
441
|
_, err = assessTaskRepo.Save(assessTaskData)
|
435
|
_, err = assessTaskRepo.Save(assessTaskData)
|
442
|
if err != nil {
|
436
|
if err != nil {
|
443
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error())
|
437
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error())
|
444
|
}
|
438
|
}
|
445
|
|
439
|
|
|
|
440
|
+ //保存 员工的评估任务
|
446
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
441
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
447
|
"transactionContext": transactionContext,
|
442
|
"transactionContext": transactionContext,
|
448
|
})
|
443
|
})
|
|
@@ -453,6 +448,9 @@ loop: |
|
@@ -453,6 +448,9 @@ loop: |
453
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人评估项"+err.Error())
|
448
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人评估项"+err.Error())
|
454
|
}
|
449
|
}
|
455
|
}
|
450
|
}
|
|
|
451
|
+
|
|
|
452
|
+ //处理生成的项目评估
|
|
|
453
|
+
|
456
|
return map[string]interface{}{
|
454
|
return map[string]interface{}{
|
457
|
"assessTaskId": assessTaskData.Id,
|
455
|
"assessTaskId": assessTaskData.Id,
|
458
|
}, nil
|
456
|
}, nil
|
|
@@ -460,7 +458,6 @@ loop: |
|
@@ -460,7 +458,6 @@ loop: |
460
|
|
458
|
|
461
|
// 添加节点任务
|
459
|
// 添加节点任务
|
462
|
func (srv StaffAssessServeice) createStaffAssess(transactionContext application.TransactionContext, param *domain.StaffAssessTask) ([]domain.StaffAssess, error) {
|
460
|
func (srv StaffAssessServeice) createStaffAssess(transactionContext application.TransactionContext, param *domain.StaffAssessTask) ([]domain.StaffAssess, error) {
|
463
|
-
|
|
|
464
|
selfUserId := []int{} //评估的参与人
|
461
|
selfUserId := []int{} //评估的参与人
|
465
|
userIdMap := map[int]struct{}{} //过滤重复的用户
|
462
|
userIdMap := map[int]struct{}{} //过滤重复的用户
|
466
|
for _, v := range param.ExecutorId {
|
463
|
for _, v := range param.ExecutorId {
|
|
@@ -588,44 +585,39 @@ func (srv StaffAssessServeice) createStaffAssessSupper( |
|
@@ -588,44 +585,39 @@ func (srv StaffAssessServeice) createStaffAssessSupper( |
588
|
userList []*domain.User, userDepartmentMap map[int64][]*domain.Department,
|
585
|
userList []*domain.User, userDepartmentMap map[int64][]*domain.Department,
|
589
|
) ([]domain.StaffAssess, error) {
|
586
|
) ([]domain.StaffAssess, error) {
|
590
|
var assessList []domain.StaffAssess
|
587
|
var assessList []domain.StaffAssess
|
591
|
- // 获取员工的上级用户
|
|
|
592
|
- userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
593
|
- "transactionContext": transactionContext,
|
|
|
594
|
- })
|
|
|
595
|
for _, v := range userList {
|
588
|
for _, v := range userList {
|
596
|
- departmentList, ok := userDepartmentMap[v.Id]
|
|
|
597
|
- if !ok {
|
589
|
+ //获取上级
|
|
|
590
|
+ chargeUserList, err := srv.getStaffSuper(transactionContext, *v)
|
|
|
591
|
+ if err != nil {
|
|
|
592
|
+ return nil, err
|
|
|
593
|
+ }
|
|
|
594
|
+ if len(chargeUserList) == 0 {
|
598
|
continue
|
595
|
continue
|
599
|
}
|
596
|
}
|
600
|
- for _, vv2 := range departmentList {
|
|
|
601
|
- if len(vv2.ChargeUserIds) == 0 {
|
|
|
602
|
- continue
|
597
|
+ for _, v2 := range chargeUserList {
|
|
|
598
|
+ assessTemp.TargetUser = domain.StaffDesc{
|
|
|
599
|
+ UserId: int(v.Id),
|
|
|
600
|
+ Account: v.Account,
|
|
|
601
|
+ UserName: v.Name,
|
603
|
}
|
602
|
}
|
604
|
- //获取部门的主管
|
|
|
605
|
- _, chargeUserList, err := userRepo.Find(map[string]interface{}{
|
|
|
606
|
- "ids": vv2.ChargeUserIds,
|
|
|
607
|
- "limit": 40,
|
|
|
608
|
- })
|
|
|
609
|
- if err != nil {
|
|
|
610
|
- return nil, application.ThrowError(application.ARG_ERROR, "获取部门主管信息"+err.Error())
|
603
|
+ assessTemp.Executor = domain.StaffDesc{
|
|
|
604
|
+ UserId: int(v2.Id),
|
|
|
605
|
+ Account: v2.Account,
|
|
|
606
|
+ UserName: v2.Name,
|
611
|
}
|
607
|
}
|
612
|
- for _, vvv3 := range chargeUserList {
|
|
|
613
|
- assessTemp.TargetDepartment = []domain.StaffDepartment{
|
|
|
614
|
- {DepartmentId: int(vv2.Id), DepartmentName: vv2.Name},
|
|
|
615
|
- }
|
|
|
616
|
- assessTemp.TargetUser = domain.StaffDesc{
|
|
|
617
|
- UserId: int(v.Id),
|
|
|
618
|
- Account: v.Account,
|
|
|
619
|
- UserName: v.Name,
|
608
|
+ targetDepartment := []domain.StaffDepartment{}
|
|
|
609
|
+ if departmentList, ok := userDepartmentMap[v.Id]; ok {
|
|
|
610
|
+ for _, department := range departmentList {
|
|
|
611
|
+ targetDepartment = append(targetDepartment, domain.StaffDepartment{
|
|
|
612
|
+ DepartmentId: int(department.Id),
|
|
|
613
|
+ DepartmentName: department.Name,
|
|
|
614
|
+ })
|
620
|
}
|
615
|
}
|
621
|
- assessTemp.Executor = domain.StaffDesc{
|
|
|
622
|
- UserId: int(vvv3.Id),
|
|
|
623
|
- Account: vvv3.Account,
|
|
|
624
|
- UserName: vvv3.Name,
|
|
|
625
|
- }
|
|
|
626
|
- assessList = append(assessList, assessTemp)
|
|
|
627
|
}
|
616
|
}
|
|
|
617
|
+ assessTemp.TargetDepartment = targetDepartment
|
|
|
618
|
+ assessList = append(assessList, assessTemp)
|
628
|
}
|
619
|
}
|
|
|
620
|
+
|
629
|
}
|
621
|
}
|
630
|
return assessList, nil
|
622
|
return assessList, nil
|
631
|
}
|
623
|
}
|
|
@@ -1592,36 +1584,37 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T |
|
@@ -1592,36 +1584,37 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T |
1592
|
log.Logger.Error("获取公司信息," + err.Error())
|
1584
|
log.Logger.Error("获取公司信息," + err.Error())
|
1593
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取公司信息,"+err.Error())
|
1585
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取公司信息,"+err.Error())
|
1594
|
}
|
1586
|
}
|
1595
|
- departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
|
|
1596
|
- "transactionContext": transactionContext,
|
|
|
1597
|
- })
|
1587
|
+ // departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
|
|
1588
|
+ // "transactionContext": transactionContext,
|
|
|
1589
|
+ // })
|
1598
|
// //查找员工的部门
|
1590
|
// //查找员工的部门
|
1599
|
// var departmentList []*domain.Department
|
1591
|
// var departmentList []*domain.Department
|
1600
|
// if len(userData.DepartmentId) > 0 {
|
1592
|
// if len(userData.DepartmentId) > 0 {
|
1601
|
|
1593
|
|
1602
|
// }
|
1594
|
// }
|
1603
|
|
1595
|
|
1604
|
- var supperUserList []*domain.User
|
|
|
1605
|
- if len(userData.DepartmentId) > 0 {
|
|
|
1606
|
- _, departmentList, err := departmentRepo.Find(map[string]interface{}{
|
|
|
1607
|
- "ids": userData.DepartmentId,
|
|
|
1608
|
- })
|
|
|
1609
|
- if err != nil {
|
|
|
1610
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())
|
|
|
1611
|
- }
|
|
|
1612
|
- var chargeUserIds []int64
|
|
|
1613
|
- for _, v := range departmentList {
|
|
|
1614
|
- chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
|
|
|
1615
|
- }
|
|
|
1616
|
- if len(chargeUserIds) > 0 {
|
|
|
1617
|
- _, supperUserList, err = userRepo.Find(map[string]interface{}{
|
|
|
1618
|
- "ids": chargeUserIds,
|
|
|
1619
|
- })
|
|
|
1620
|
- if err != nil {
|
|
|
1621
|
- return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())
|
|
|
1622
|
- }
|
|
|
1623
|
- }
|
|
|
1624
|
- }
|
1596
|
+ // var supperUserList []*domain.User
|
|
|
1597
|
+ // if len(userData.DepartmentId) > 0 {
|
|
|
1598
|
+ // _, departmentList, err := departmentRepo.Find(map[string]interface{}{
|
|
|
1599
|
+ // "ids": userData.DepartmentId,
|
|
|
1600
|
+ // })
|
|
|
1601
|
+ // if err != nil {
|
|
|
1602
|
+ // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())
|
|
|
1603
|
+ // }
|
|
|
1604
|
+ // var chargeUserIds []int64
|
|
|
1605
|
+ // for _, v := range departmentList {
|
|
|
1606
|
+ // chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
|
|
|
1607
|
+ // }
|
|
|
1608
|
+ // if len(chargeUserIds) > 0 {
|
|
|
1609
|
+ // _, supperUserList, err = userRepo.Find(map[string]interface{}{
|
|
|
1610
|
+ // "ids": chargeUserIds,
|
|
|
1611
|
+ // })
|
|
|
1612
|
+ // if err != nil {
|
|
|
1613
|
+ // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())
|
|
|
1614
|
+ // }
|
|
|
1615
|
+ // }
|
|
|
1616
|
+ // }
|
|
|
1617
|
+ supperUserList, _ := srv.getStaffSuper(transactionContext, *userData)
|
1625
|
userInfo := adapter.StaffInfo{
|
1618
|
userInfo := adapter.StaffInfo{
|
1626
|
UserName: userData.Name,
|
1619
|
UserName: userData.Name,
|
1627
|
CompanyName: companyData.Name,
|
1620
|
CompanyName: companyData.Name,
|
|
@@ -1703,12 +1696,14 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
@@ -1703,12 +1696,14 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
1703
|
continue
|
1696
|
continue
|
1704
|
}
|
1697
|
}
|
1705
|
v.Value = item.Value
|
1698
|
v.Value = item.Value
|
1706
|
- //填入评估值描述
|
|
|
1707
|
- reteResult, err := v.Rule.ScoreOrRating(&v.Value)
|
|
|
1708
|
- if err != nil {
|
|
|
1709
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
1699
|
+ if len(item.Value) > 0 {
|
|
|
1700
|
+ //填入评估值描述
|
|
|
1701
|
+ reteResult, err := v.Rule.ScoreOrRating(&v.Value)
|
|
|
1702
|
+ if err != nil {
|
|
|
1703
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
1704
|
+ }
|
|
|
1705
|
+ v.ReteResult = reteResult
|
1710
|
}
|
1706
|
}
|
1711
|
- v.ReteResult = reteResult
|
|
|
1712
|
for ii := range v.Remark {
|
1707
|
for ii := range v.Remark {
|
1713
|
for _, vvv := range item.Remark {
|
1708
|
for _, vvv := range item.Remark {
|
1714
|
if v.Remark[ii].Title == vvv.Title {
|
1709
|
if v.Remark[ii].Title == vvv.Title {
|
|
@@ -1719,7 +1714,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
@@ -1719,7 +1714,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
1719
|
}
|
1714
|
}
|
1720
|
|
1715
|
|
1721
|
}
|
1716
|
}
|
1722
|
-
|
|
|
1723
|
//保存信息
|
1717
|
//保存信息
|
1724
|
for i := range assessContentList {
|
1718
|
for i := range assessContentList {
|
1725
|
_, err = assessContentRepo.Save(assessContentList[i])
|
1719
|
_, err = assessContentRepo.Save(assessContentList[i])
|
|
@@ -1774,7 +1768,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA |
|
@@ -1774,7 +1768,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA |
1774
|
}
|
1768
|
}
|
1775
|
|
1769
|
|
1776
|
//获取员工的上级是谁 ,TODO
|
1770
|
//获取员工的上级是谁 ,TODO
|
1777
|
-func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]domain.User, error) {
|
1771
|
+func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) {
|
1778
|
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
1772
|
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
1779
|
"transactionContext": transactionContext,
|
1773
|
"transactionContext": transactionContext,
|
1780
|
})
|
1774
|
})
|
|
@@ -1793,6 +1787,29 @@ func (srv StaffAssessServeice) getStaffSuper(transactionContext application.Tran |
|
@@ -1793,6 +1787,29 @@ func (srv StaffAssessServeice) getStaffSuper(transactionContext application.Tran |
1793
|
}
|
1787
|
}
|
1794
|
}
|
1788
|
}
|
1795
|
if len(departmemtList) == 0 {
|
1789
|
if len(departmemtList) == 0 {
|
|
|
1790
|
+ //找不到员工的部门
|
|
|
1791
|
+ companyRepo := factory.CreateCompanyRepository(map[string]interface{}{
|
|
|
1792
|
+ "transactionContext": transactionContext,
|
|
|
1793
|
+ })
|
|
|
1794
|
+ companyData, err := companyRepo.FindOne(map[string]interface{}{
|
|
|
1795
|
+ "id": targetUser.CompanyId,
|
|
|
1796
|
+ })
|
|
|
1797
|
+ if err != nil {
|
|
|
1798
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的公司"+err.Error())
|
|
|
1799
|
+ }
|
|
|
1800
|
+ //公司作为最顶级
|
|
|
1801
|
+ departmemtList = append(departmemtList, &domain.Department{
|
|
|
1802
|
+ Id: 0,
|
|
|
1803
|
+ CompanyId: companyData.Id,
|
|
|
1804
|
+ Level: 0,
|
|
|
1805
|
+ Name: companyData.Name,
|
|
|
1806
|
+ ParentId: 0,
|
|
|
1807
|
+ ChargeUserIds: companyData.ChargeUserIds,
|
|
|
1808
|
+ Path: "",
|
|
|
1809
|
+ CreatedAt: time.Time{},
|
|
|
1810
|
+ UpdatedAt: time.Time{},
|
|
|
1811
|
+ DeletedAt: &time.Time{},
|
|
|
1812
|
+ })
|
1796
|
|
1813
|
|
1797
|
}
|
1814
|
}
|
1798
|
//获取部门管理员
|
1815
|
//获取部门管理员
|
|
@@ -1836,14 +1853,5 @@ loop: |
|
@@ -1836,14 +1853,5 @@ loop: |
1836
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error())
|
1853
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error())
|
1837
|
}
|
1854
|
}
|
1838
|
}
|
1855
|
}
|
1839
|
- if len(chargeUserList) == 0 {
|
|
|
1840
|
- //如果都找不到数据
|
|
|
1841
|
-
|
|
|
1842
|
- }
|
|
|
1843
|
-
|
|
|
1844
|
- // _, chargeUserList, err := userRepo.Find(map[string]interface{}{
|
|
|
1845
|
- // "ids": chargeUserIds,
|
|
|
1846
|
- // })
|
|
|
1847
|
-
|
|
|
1848
|
- return nil, nil
|
1856
|
+ return chargeUserList, nil
|
1849
|
} |
1857
|
} |