作者 tangxvhui

调整异常操作标记

@@ -1281,8 +1281,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1281,8 +1281,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1281 if tk.Id != val3.TaskId { 1281 if tk.Id != val3.TaskId {
1282 continue 1282 continue
1283 } 1283 }
1284 - if val3.Marks == nil {  
1285 - val3.Marks = map[string]string{} 1284 + if len(val3.Marks) == 0 {
  1285 + val3.Marks = map[string]string{"a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导"}
1286 } 1286 }
1287 noticeWho := []string{} 1287 noticeWho := []string{}
1288 for _, val2 := range val3.NoticeWho { 1288 for _, val2 := range val3.NoticeWho {
@@ -1420,6 +1420,19 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1420,6 +1420,19 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1420 defer func() { 1420 defer func() {
1421 _ = transactionContext.RollbackTransaction() 1421 _ = transactionContext.RollbackTransaction()
1422 }() 1422 }()
  1423 + // 获取我的上级人员
  1424 + userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
  1425 + _, me, err := userRepo.Find(map[string]interface{}{"id": param.UserId})
  1426 + if err != nil {
  1427 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的信息"+err.Error())
  1428 + }
  1429 + if len(me) == 0 {
  1430 + return nil, nil
  1431 + }
  1432 + var meParent []*domain.User
  1433 + if me[0].ParentId > 0 {
  1434 + _, meParent, _ = userRepo.Find(map[string]interface{}{"id": me[0].ParentId})
  1435 + }
1423 var limit = 20 1436 var limit = 20
1424 var offset = 0 1437 var offset = 0
1425 if param.PageSize > 0 { 1438 if param.PageSize > 0 {
@@ -1645,7 +1658,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1645,7 +1658,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1645 } 1658 }
1646 } 1659 }
1647 if len(val3.Marks) == 0 { 1660 if len(val3.Marks) == 0 {
1648 - val3.Marks = map[string]string{} 1661 + val3.Marks = map[string]string{"a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导"}
1649 } 1662 }
1650 userId := strconv.Itoa(param.UserId) 1663 userId := strconv.Itoa(param.UserId)
1651 isChildUser := false 1664 isChildUser := false
@@ -1662,8 +1675,10 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1662,8 +1675,10 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1662 if userId == val.LeaderId { 1675 if userId == val.LeaderId {
1663 // 去更新 1676 // 去更新
1664 tk.Marks["a"] = val3.Marks["a"] 1677 tk.Marks["a"] = val3.Marks["a"]
  1678 + if len(meParent) > 0 {
1665 // 找上级 1679 // 找上级
1666 tk.Marks["c"] = val3.Marks["c"] 1680 tk.Marks["c"] = val3.Marks["c"]
  1681 + }
1667 } else if isChildUser { 1682 } else if isChildUser {
1668 // 去辅导 1683 // 去辅导
1669 tk.Marks["d"] = val3.Marks["d"] 1684 tk.Marks["d"] = val3.Marks["d"]
@@ -808,7 +808,18 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a @@ -808,7 +808,18 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
808 taskStatgeRepo := factory.CreateTaskStageRepository(map[string]interface{}{ 808 taskStatgeRepo := factory.CreateTaskStageRepository(map[string]interface{}{
809 "transactionContext": transactionContext, 809 "transactionContext": transactionContext,
810 }) 810 })
811 - 811 + userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
  812 + _, me, err := userRepo.Find(map[string]interface{}{"id": param.UserId})
  813 + if err != nil {
  814 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的信息"+err.Error())
  815 + }
  816 + if len(me) == 0 {
  817 + return nil, nil
  818 + }
  819 + var meParent []*domain.User
  820 + if me[0].ParentId > 0 {
  821 + _, meParent, _ = userRepo.Find(map[string]interface{}{"id": me[0].ParentId})
  822 + }
812 _, anomalyList, err := taskAnomalyRepo.Find(map[string]interface{}{"id": param.Id, "companyId": param.CompanyId, "limit": 1}) 823 _, anomalyList, err := taskAnomalyRepo.Find(map[string]interface{}{"id": param.Id, "companyId": param.CompanyId, "limit": 1})
813 if err != nil { 824 if err != nil {
814 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 825 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -890,9 +901,7 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a @@ -890,9 +901,7 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
890 MarkC: "", 901 MarkC: "",
891 MarkD: "", 902 MarkD: "",
892 AnomalyDesc: "", 903 AnomalyDesc: "",
893 - AnomalyDesc2: map[string]string{  
894 - "": "",  
895 - }, 904 + AnomalyDesc2: map[string]string{},
896 } 905 }
897 // 设置操作标记 906 // 设置操作标记
898 { 907 {
@@ -909,8 +918,10 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a @@ -909,8 +918,10 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
909 if param.UserId == int(taskData.Leader.Id) { 918 if param.UserId == int(taskData.Leader.Id) {
910 // 去更新 919 // 去更新
911 result.MarkA = anomalyData.Marks["a"] 920 result.MarkA = anomalyData.Marks["a"]
  921 + if len(meParent) > 0 {
912 // 找上级 922 // 找上级
913 result.MarkC = anomalyData.Marks["c"] 923 result.MarkC = anomalyData.Marks["c"]
  924 + }
914 } else if isChildUser { 925 } else if isChildUser {
915 // 去辅导 926 // 去辅导
916 result.MarkD = anomalyData.Marks["d"] 927 result.MarkD = anomalyData.Marks["d"]
@@ -364,7 +364,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ @@ -364,7 +364,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
364 where t_task_ignore.id isnull and task.deleted_at isnull 364 where t_task_ignore.id isnull and task.deleted_at isnull
365 and task_anomaly.company_id = ? 365 and task_anomaly.company_id = ?
366 and task.related_user@> ? 366 and task.related_user@> ?
367 - and not exists (select t_user.id::text from t_user where t_user."level" <3 and task.leader->>'id'=t_user.id::text ) 367 + and task.leader->>'id' not in (select t_user.id::text from t_user where t_user."level" <4 )
368 and task_anomaly.is_last=1 368 and task_anomaly.is_last=1
369 ` 369 `
370 370
@@ -395,7 +395,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ @@ -395,7 +395,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
395 where t_task_ignore.id isnull and task.deleted_at isnull 395 where t_task_ignore.id isnull and task.deleted_at isnull
396 and task_anomaly.company_id = ? 396 and task_anomaly.company_id = ?
397 and task.related_user@> ? 397 and task.related_user@> ?
398 - and not exists (select t_user.id::text from t_user where t_user."level" <3 and task.leader->>'id'=t_user.id::text ) 398 + and task.leader->>'id' not in (select t_user.id::text from t_user where t_user."level" <4 )
399 and task_anomaly.is_last=1 399 and task_anomaly.is_last=1
400 ` 400 `
401 401