作者 linmadan

修复驳回任务后,任务人还显示的bug

@@ -58,14 +58,16 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 @@ -58,14 +58,16 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64
58 if err := task.RejectReceiver(); err != nil { 58 if err := task.RejectReceiver(); err != nil {
59 return nil, err 59 return nil, err
60 } 60 }
61 - rejectTaskRecord := &domain.RejectTaskRecord{ 61 + newRejectTaskRecord := &domain.RejectTaskRecord{
62 Task: task, 62 Task: task,
63 Operator: operator.EmployeeInfo, 63 Operator: operator.EmployeeInfo,
64 RejectReason: rejectReason, 64 RejectReason: rejectReason,
65 CreateTime: time.Now(), 65 CreateTime: time.Now(),
66 } 66 }
67 - if _, err := rejectTaskRecordRepository.Save(rejectTaskRecord); err != nil { 67 + if rejectTaskRecord, err := rejectTaskRecordRepository.Save(newRejectTaskRecord); err != nil {
68 return nil, err 68 return nil, err
  69 + } else {
  70 + newRejectTaskRecord = rejectTaskRecord
69 } 71 }
70 if task, err := taskRepository.Save(task); err != nil { 72 if task, err := taskRepository.Save(task); err != nil {
71 return nil, err 73 return nil, err
@@ -80,7 +82,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 @@ -80,7 +82,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64
80 taskRejectedEvent.TaskStatus = task.TaskStatus 82 taskRejectedEvent.TaskStatus = task.TaskStatus
81 taskRejectedEvent.RobInfo = task.RobInfo 83 taskRejectedEvent.RobInfo = task.RobInfo
82 taskRejectedEvent.BidInfo = task.BidInfo 84 taskRejectedEvent.BidInfo = task.BidInfo
83 - taskRejectedEvent.RejectTaskRecord = rejectTaskRecord 85 + taskRejectedEvent.RejectTaskRecord = newRejectTaskRecord
84 if err := service.Publish(taskRejectedEvent); err != nil { 86 if err := service.Publish(taskRejectedEvent); err != nil {
85 return nil, err 87 return nil, err
86 } 88 }
@@ -45,6 +45,9 @@ func (repository *TaskRepository) Save(task *domain.Task) (*domain.Task, error) @@ -45,6 +45,9 @@ func (repository *TaskRepository) Save(task *domain.Task) (*domain.Task, error)
45 if task.BidInfo != nil && task.BidInfo.SuccessfulBidder != nil { 45 if task.BidInfo != nil && task.BidInfo.SuccessfulBidder != nil {
46 taskReceiverUid = task.BidInfo.SuccessfulBidder.Uid 46 taskReceiverUid = task.BidInfo.SuccessfulBidder.Uid
47 } 47 }
  48 + if (task.RobInfo == nil || task.RobInfo.Receiver == nil) && (task.BidInfo == nil || task.BidInfo.SuccessfulBidder == nil) {
  49 + taskReceiverUid = 0
  50 + }
48 if _, err := tx.QueryOne( 51 if _, err := tx.QueryOne(
49 pg.Scan(&task.TaskId, &task.CompanyId, &task.TaskName, &task.TaskType, &task.Sponsor, &task.TaskStatus, &task.ReferenceResource, &task.ProjectBelong, pg.Array(&task.CustomerValues), &task.TaskNature, &task.SuMoney, &task.AcceptanceStandard, &task.TaskDescription, pg.Array(&task.TaskPictureUrls), &task.IsRewardTake, &task.CreateTime, &task.ReleaseTime, &task.Participators, &task.TaskPercentage, &task.SolveReport, pg.Array(&task.SolvePictureUrls), &task.AssignedPerson, &task.PlannedCompletionTime, &task.ActualCompletionTime, &task.ReceiveTime, &task.CompleteTime, &task.AcceptanceTime), 52 pg.Scan(&task.TaskId, &task.CompanyId, &task.TaskName, &task.TaskType, &task.Sponsor, &task.TaskStatus, &task.ReferenceResource, &task.ProjectBelong, pg.Array(&task.CustomerValues), &task.TaskNature, &task.SuMoney, &task.AcceptanceStandard, &task.TaskDescription, pg.Array(&task.TaskPictureUrls), &task.IsRewardTake, &task.CreateTime, &task.ReleaseTime, &task.Participators, &task.TaskPercentage, &task.SolveReport, pg.Array(&task.SolvePictureUrls), &task.AssignedPerson, &task.PlannedCompletionTime, &task.ActualCompletionTime, &task.ReceiveTime, &task.CompleteTime, &task.AcceptanceTime),
50 "UPDATE tasks SET company_id=?, task_name=?, task_type=?, sponsor=?, task_status=?, reference_resource=?, project_belong=?, customer_values=?, task_nature=?, su_money=?, acceptance_standard=?, task_description=?, task_picture_urls=?, is_reward_take=?, receiver_uid=?, create_time=?, release_time=?, participators=?, task_percentage=?, solve_report=?, solve_picture_urls=?, assigned_person=?, planned_completion_time=?, actual_completion_time=?, receive_time=?, complete_time=?, acceptance_time=? WHERE id=? RETURNING id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time, receive_time, complete_time, acceptance_time", 53 "UPDATE tasks SET company_id=?, task_name=?, task_type=?, sponsor=?, task_status=?, reference_resource=?, project_belong=?, customer_values=?, task_nature=?, su_money=?, acceptance_standard=?, task_description=?, task_picture_urls=?, is_reward_take=?, receiver_uid=?, create_time=?, release_time=?, participators=?, task_percentage=?, solve_report=?, solve_picture_urls=?, assigned_person=?, planned_completion_time=?, actual_completion_time=?, receive_time=?, complete_time=?, acceptance_time=? WHERE id=? RETURNING id, company_id, task_name, task_type, sponsor, task_status, reference_resource, project_belong, customer_values, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, create_time, release_time, participators, task_percentage, solve_report, solve_picture_urls, assigned_person, planned_completion_time, actual_completion_time, receive_time, complete_time, acceptance_time",