作者 tangxvhui

修复bug

@@ -756,10 +756,24 @@ func (srv *MessagePersonalService) TodayMessageTaskAnomaly(param *command.GetUse @@ -756,10 +756,24 @@ func (srv *MessagePersonalService) TodayMessageTaskAnomaly(param *command.GetUse
756 } 756 }
757 resp := map[string]interface{}{ 757 resp := map[string]interface{}{
758 "needNotify": false, 758 "needNotify": false,
  759 + "pageSkip": "0",
759 } 760 }
760 if (num1 + num2 + num3) == 1 { 761 if (num1 + num2 + num3) == 1 {
761 resp["needNotify"] = true 762 resp["needNotify"] = true
762 resp["list"] = []adapter.MessageListAdapter{{Content: msg}} 763 resp["list"] = []adapter.MessageListAdapter{{Content: msg}}
  764 + if num1 > 0 {
  765 + //跳我负责的任务
  766 + resp["pageSkip"] = "1"
  767 + }
  768 + if num2 > 0 {
  769 + //跳我的下级任务
  770 + resp["pageSkip"] = "2"
  771 + }
  772 + if num3 > 0 {
  773 + //跳我的相关的任务
  774 + resp["pageSkip"] = "3"
  775 + }
  776 +
763 } else if (num1 + num2 + num3) > 1 { 777 } else if (num1 + num2 + num3) > 1 {
764 resp["needNotify"] = true 778 resp["needNotify"] = true
765 str := []string{} 779 str := []string{}
@@ -509,20 +509,25 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) @@ -509,20 +509,25 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
509 taskRecordList = append(taskRecordList, &newTaskRecord) 509 taskRecordList = append(taskRecordList, &newTaskRecord)
510 } 510 }
511 } 511 }
512 - //TODO 设置手动创建的task  
513 - _, taskList, err := taskRepo.Find(map[string]interface{}{ 512 + //设置手动创建的task
  513 + _, taskList2, err := taskRepo.Find(map[string]interface{}{
514 "leaderId": projectData.PrincipalId, 514 "leaderId": projectData.PrincipalId,
515 "status": domain.TaskRunning, 515 "status": domain.TaskRunning,
516 "createdBy": 1, 516 "createdBy": 1,
517 - "gtEndTime": time.Now().Unix(),  
518 }) 517 })
519 if err != nil { 518 if err != nil {
520 return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务task信息"+err.Error()) 519 return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务task信息"+err.Error())
521 } 520 }
522 - for index := range taskList { 521 + nowTime := time.Now()
  522 + for index := range taskList2 {
  523 + if taskList2[index].UseEndTime > 0 {
  524 + if !(taskList2[index].EndTime > nowTime.Unix()) {
  525 + continue
  526 + }
  527 + }
523 //获取里程碑数据 528 //获取里程碑数据
524 _, taskStageList, err := taskStageRepo.Find(map[string]interface{}{ 529 _, taskStageList, err := taskStageRepo.Find(map[string]interface{}{
525 - "taskId": taskList[index].Id, 530 + "taskId": taskList2[index].Id,
526 }) 531 })
527 if err != nil { 532 if err != nil {
528 return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务里程碑TaskStage信息"+err.Error()) 533 return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务里程碑TaskStage信息"+err.Error())
@@ -531,18 +536,18 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) @@ -531,18 +536,18 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
531 Id: 0, 536 Id: 0,
532 CompanyId: staffAssess.CompanyId, 537 CompanyId: staffAssess.CompanyId,
533 StaffAssessId: staffAssess.Id, 538 StaffAssessId: staffAssess.Id,
534 - TaskId: taskList[index].Id, 539 + TaskId: taskList2[index].Id,
535 TaskCategory: "", 540 TaskCategory: "",
536 - TaskName: taskList[index].Name,  
537 - TaskAlias: taskList[index].Alias,  
538 - TaskLeader: taskList[index].Leader, 541 + TaskName: taskList2[index].Name,
  542 + TaskAlias: taskList2[index].Alias,
  543 + TaskLeader: taskList2[index].Leader,
539 AssistLevel: 0, 544 AssistLevel: 0,
540 AssistContent: "", 545 AssistContent: "",
541 AnomalyState: domain.AnomalyStateInit, 546 AnomalyState: domain.AnomalyStateInit,
542 AssistState: domain.AssistStateInit, 547 AssistState: domain.AssistStateInit,
543 TaskStages: []domain.TaskStage{}, 548 TaskStages: []domain.TaskStage{},
544 TaskStageCheck: domain.TaskStage{}, 549 TaskStageCheck: domain.TaskStage{},
545 - TaskCreatedBy: taskList[index].CreatedBy, 550 + TaskCreatedBy: taskList2[index].CreatedBy,
546 } 551 }
547 sort.Slice(taskStageList, func(i, j int) bool { 552 sort.Slice(taskStageList, func(i, j int) bool {
548 return taskStageList[i].SortBy < taskStageList[j].SortBy 553 return taskStageList[i].SortBy < taskStageList[j].SortBy
@@ -1173,8 +1173,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1173,8 +1173,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1173 }) 1173 })
1174 for _, val := range taskListData { 1174 for _, val := range taskListData {
1175 _, listData, err := taskAnomalyRepo.Find(map[string]interface{}{ 1175 _, listData, err := taskAnomalyRepo.Find(map[string]interface{}{
1176 - "taskId": val.TaskId,  
1177 - "is_last": 1, 1176 + "taskId": val.TaskId,
  1177 + "isLast": 1,
1178 }) 1178 })
1179 if err == nil { 1179 if err == nil {
1180 taskAnomalyList = append(taskAnomalyList, listData...) 1180 taskAnomalyList = append(taskAnomalyList, listData...)
@@ -1455,8 +1455,8 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1455,8 +1455,8 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1455 }) 1455 })
1456 for _, val := range taskListData { 1456 for _, val := range taskListData {
1457 _, listData, err := taskAnomalyRepo.Find(map[string]interface{}{ 1457 _, listData, err := taskAnomalyRepo.Find(map[string]interface{}{
1458 - "taskId": val.TaskId,  
1459 - "is_last": 1, 1458 + "taskId": val.TaskId,
  1459 + "isLast": 1,
1460 }) 1460 })
1461 if err == nil { 1461 if err == nil {
1462 taskAnomalyList = append(taskAnomalyList, listData...) 1462 taskAnomalyList = append(taskAnomalyList, listData...)
@@ -573,7 +573,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -573,7 +573,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
573 )select * 573 )select *
574 from t_task_1 574 from t_task_1
575 order by t_task_1.status, 575 order by t_task_1.status,
576 - t_task_1.warn_flag 576 + t_task_1.warn_flag,
577 t_task_1.sort_by_1, 577 t_task_1.sort_by_1,
578 t_task_1.anomaly desc, 578 t_task_1.anomaly desc,
579 t_task_1.sort_by,t_task_1."created_at" 579 t_task_1.sort_by,t_task_1."created_at"
@@ -800,6 +800,9 @@ and (task.leader ->>'id' in(?) or task.related_user @>?) @@ -800,6 +800,9 @@ and (task.leader ->>'id' in(?) or task.related_user @>?)
800 ` 800 `
801 801
802 relatedUser := fmt.Sprintf("[%d]", relatedUserId) 802 relatedUser := fmt.Sprintf("[%d]", relatedUserId)
  803 + if len(leaderId) == 0 {
  804 + leaderId = []string{"-1"}
  805 + }
803 condition := []interface{}{companyId, pg.In(leaderId), relatedUser} 806 condition := []interface{}{companyId, pg.In(leaderId), relatedUser}
804 result := []TaskData6{} 807 result := []TaskData6{}
805 tx := d.transactionContext.PgTx 808 tx := d.transactionContext.PgTx
@@ -169,9 +169,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d @@ -169,9 +169,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d
169 } 169 }
170 } 170 }
171 //大于end_time 171 //大于end_time
172 - if val, ok := queryOptions["gtEndTime"]; ok {  
173 - query.Where(" end_time>=?", val)  
174 - } 172 + // if val, ok := queryOptions["gtEndTime"]; ok {
  173 + // query.Where(" end_time>=?", val)
  174 + // }
175 if val, ok := queryOptions["offset"]; ok { 175 if val, ok := queryOptions["offset"]; ok {
176 if offset, err := strconv.Atoi(fmt.Sprintf("%v", val)); err == nil { 176 if offset, err := strconv.Atoi(fmt.Sprintf("%v", val)); err == nil {
177 query.Offset(offset) 177 query.Offset(offset)