正在显示
5 个修改的文件
包含
18 行增加
和
19 行删除
@@ -93,16 +93,9 @@ func (subscriber *NotificationHandleSubscriber) HandleEvent(domainEvent coreDoma | @@ -93,16 +93,9 @@ func (subscriber *NotificationHandleSubscriber) HandleEvent(domainEvent coreDoma | ||
93 | if notification, err := notificationRepository.Save(notification); err != nil { | 93 | if notification, err := notificationRepository.Save(notification); err != nil { |
94 | return err | 94 | return err |
95 | } else { | 95 | } else { |
96 | - var receiver *domain.EmployeeInfo | ||
97 | - if taskRejectedEvent.TaskType == domain.TASK_TYPE_ROB { | ||
98 | - receiver = taskRejectedEvent.RobInfo.Receiver | ||
99 | - } | ||
100 | - if taskRejectedEvent.TaskType == domain.TASK_TYPE_BID { | ||
101 | - receiver = taskRejectedEvent.BidInfo.SuccessfulBidder | ||
102 | - } | ||
103 | sentNotification := &domain.SentNotification{ | 96 | sentNotification := &domain.SentNotification{ |
104 | Notification: notification, | 97 | Notification: notification, |
105 | - Receiver: receiver, | 98 | + Receiver: taskRejectedEvent.BeRejectedPerson, |
106 | IsRead: false, | 99 | IsRead: false, |
107 | ReadTime: time.Time{}, | 100 | ReadTime: time.Time{}, |
108 | } | 101 | } |
@@ -132,7 +132,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | @@ -132,7 +132,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | ||
132 | } else { | 132 | } else { |
133 | taskDao = value | 133 | taskDao = value |
134 | } | 134 | } |
135 | - if tasks, err := taskDao.ListNearThePlannedCompletionTimeTask(); err != nil { | 135 | + if tasks, err := taskDao.ListNearBidEndTimeTask(); err != nil { |
136 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 136 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
137 | } else { | 137 | } else { |
138 | for _, task := range tasks { | 138 | for _, task := range tasks { |
@@ -21,12 +21,10 @@ type TaskRejected struct { | @@ -21,12 +21,10 @@ type TaskRejected struct { | ||
21 | Sponsor *domain.EmployeeInfo `json:"sponsor"` | 21 | Sponsor *domain.EmployeeInfo `json:"sponsor"` |
22 | // 任务状态 | 22 | // 任务状态 |
23 | TaskStatus int `json:"taskStatus"` | 23 | TaskStatus int `json:"taskStatus"` |
24 | - // 抢单任务信息 | ||
25 | - RobInfo *domain.RobInfo `json:"robInfo"` | ||
26 | - // 竞标任务信息 | ||
27 | - BidInfo *domain.BidInfo `json:"bidInfo"` | ||
28 | //驳回任务记录 | 24 | //驳回任务记录 |
29 | RejectTaskRecord *domain.RejectTaskRecord | 25 | RejectTaskRecord *domain.RejectTaskRecord |
26 | + //被驳回人 | ||
27 | + BeRejectedPerson *domain.EmployeeInfo `json:"beRejectedPerson"` | ||
30 | } | 28 | } |
31 | 29 | ||
32 | func (event *TaskRejected) EventType() string { | 30 | func (event *TaskRejected) EventType() string { |
@@ -165,8 +165,10 @@ func (status *UnReleasedStatus) Update(task *Task, data map[string]interface{}) | @@ -165,8 +165,10 @@ func (status *UnReleasedStatus) Update(task *Task, data map[string]interface{}) | ||
165 | } | 165 | } |
166 | 166 | ||
167 | func (status *UnReleasedStatus) Release(task *Task) error { | 167 | func (status *UnReleasedStatus) Release(task *Task) error { |
168 | - task.ReleaseTime = time.Now() | 168 | + currentTime := time.Now() |
169 | + task.ReleaseTime = currentTime | ||
169 | if task.TaskType == TASK_TYPE_DESIGNATE { | 170 | if task.TaskType == TASK_TYPE_DESIGNATE { |
171 | + task.ReceiveTime = currentTime | ||
170 | task.TaskStatus = TASK_STATUS_UNDERWAY | 172 | task.TaskStatus = TASK_STATUS_UNDERWAY |
171 | task.CurrentStatus = &UnderwayStatus{} | 173 | task.CurrentStatus = &UnderwayStatus{} |
172 | } else { | 174 | } else { |
@@ -62,9 +62,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | @@ -62,9 +62,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | ||
62 | if operator.EmployeeInfo.Uid != task.Sponsor.Uid { | 62 | if operator.EmployeeInfo.Uid != task.Sponsor.Uid { |
63 | return nil, fmt.Errorf("无效的任务发布者") | 63 | return nil, fmt.Errorf("无效的任务发布者") |
64 | } | 64 | } |
65 | - if err := task.RejectReceiver(); err != nil { | ||
66 | - return nil, err | ||
67 | - } | 65 | + var beRejectedPerson *domain.EmployeeInfo |
68 | newRejectTaskRecord := &domain.RejectTaskRecord{ | 66 | newRejectTaskRecord := &domain.RejectTaskRecord{ |
69 | Task: task, | 67 | Task: task, |
70 | Operator: operator.EmployeeInfo, | 68 | Operator: operator.EmployeeInfo, |
@@ -72,11 +70,17 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | @@ -72,11 +70,17 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | ||
72 | CreateTime: time.Now(), | 70 | CreateTime: time.Now(), |
73 | } | 71 | } |
74 | if task.TaskType == domain.TASK_TYPE_ROB { | 72 | if task.TaskType == domain.TASK_TYPE_ROB { |
73 | + if task.RobInfo != nil && task.RobInfo.Receiver != nil{ | ||
74 | + beRejectedPerson = task.RobInfo.Receiver | ||
75 | + } | ||
75 | if err := taskDao.DeleteRobInfo(taskId); err != nil { | 76 | if err := taskDao.DeleteRobInfo(taskId); err != nil { |
76 | return nil, err | 77 | return nil, err |
77 | } | 78 | } |
78 | } | 79 | } |
79 | if task.TaskType == domain.TASK_TYPE_BID { | 80 | if task.TaskType == domain.TASK_TYPE_BID { |
81 | + if task.BidInfo != nil && task.BidInfo.SuccessfulBidder != nil{ | ||
82 | + beRejectedPerson = task.BidInfo.SuccessfulBidder | ||
83 | + } | ||
80 | if err := taskDao.CancelSuccessfulBidder(taskId); err != nil { | 84 | if err := taskDao.CancelSuccessfulBidder(taskId); err != nil { |
81 | return nil, err | 85 | return nil, err |
82 | } | 86 | } |
@@ -86,6 +90,9 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | @@ -86,6 +90,9 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | ||
86 | } else { | 90 | } else { |
87 | newRejectTaskRecord = rejectTaskRecord | 91 | newRejectTaskRecord = rejectTaskRecord |
88 | } | 92 | } |
93 | + if err := task.RejectReceiver(); err != nil { | ||
94 | + return nil, err | ||
95 | + } | ||
89 | if task, err := taskRepository.Save(task); err != nil { | 96 | if task, err := taskRepository.Save(task); err != nil { |
90 | return nil, err | 97 | return nil, err |
91 | } else { | 98 | } else { |
@@ -97,8 +104,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | @@ -97,8 +104,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | ||
97 | taskRejectedEvent.TaskType = task.TaskType | 104 | taskRejectedEvent.TaskType = task.TaskType |
98 | taskRejectedEvent.Sponsor = task.Sponsor | 105 | taskRejectedEvent.Sponsor = task.Sponsor |
99 | taskRejectedEvent.TaskStatus = task.TaskStatus | 106 | taskRejectedEvent.TaskStatus = task.TaskStatus |
100 | - taskRejectedEvent.RobInfo = task.RobInfo | ||
101 | - taskRejectedEvent.BidInfo = task.BidInfo | 107 | + taskRejectedEvent.BeRejectedPerson = beRejectedPerson |
102 | taskRejectedEvent.RejectTaskRecord = newRejectTaskRecord | 108 | taskRejectedEvent.RejectTaskRecord = newRejectTaskRecord |
103 | if err := service.Publish(taskRejectedEvent); err != nil { | 109 | if err := service.Publish(taskRejectedEvent); err != nil { |
104 | return nil, err | 110 | return nil, err |
-
请 注册 或 登录 后发表评论