作者 陈志颖

refactor:限制离职人员操作任务

@@ -26,6 +26,7 @@ func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.Co @@ -26,6 +26,7 @@ func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.Co
26 if err := confirmRobTaskCommand.ValidateCommand(); err != nil { 26 if err := confirmRobTaskCommand.ValidateCommand(); err != nil {
27 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 27 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
28 } 28 }
  29 +
29 transactionContext, err := factory.CreateTransactionContext(nil) 30 transactionContext, err := factory.CreateTransactionContext(nil)
30 if err != nil { 31 if err != nil {
31 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 32 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -36,6 +37,7 @@ func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.Co @@ -36,6 +37,7 @@ func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.Co
36 defer func() { 37 defer func() {
37 transactionContext.RollbackTransaction() 38 transactionContext.RollbackTransaction()
38 }() 39 }()
  40 +
39 var confirmRobTaskService service.ConfirmRobTaskService 41 var confirmRobTaskService service.ConfirmRobTaskService
40 if value, err := factory.CreateConfirmRobTaskService(map[string]interface{}{ 42 if value, err := factory.CreateConfirmRobTaskService(map[string]interface{}{
41 "transactionContext": transactionContext, 43 "transactionContext": transactionContext,
@@ -47,6 +49,7 @@ func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.Co @@ -47,6 +49,7 @@ func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.Co
47 TransactionContext: transactionContext.(*pgTransaction.TransactionContext), 49 TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
48 }) 50 })
49 } 51 }
  52 +
50 if task, err := confirmRobTaskService.Confirm(confirmRobTaskCommand.TaskId, confirmRobTaskCommand.Operator, confirmRobTaskCommand.PlannedCompletionTime); err != nil { 53 if task, err := confirmRobTaskService.Confirm(confirmRobTaskCommand.TaskId, confirmRobTaskCommand.Operator, confirmRobTaskCommand.PlannedCompletionTime); err != nil {
51 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 54 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
52 } else { 55 } else {
@@ -62,6 +65,7 @@ func (taskService *TaskService) RejectTaskReceiver(rejectTaskReceiverCommand *co @@ -62,6 +65,7 @@ func (taskService *TaskService) RejectTaskReceiver(rejectTaskReceiverCommand *co
62 if err := rejectTaskReceiverCommand.ValidateCommand(); err != nil { 65 if err := rejectTaskReceiverCommand.ValidateCommand(); err != nil {
63 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 66 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
64 } 67 }
  68 +
65 transactionContext, err := factory.CreateTransactionContext(nil) 69 transactionContext, err := factory.CreateTransactionContext(nil)
66 if err != nil { 70 if err != nil {
67 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 71 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -72,6 +76,7 @@ func (taskService *TaskService) RejectTaskReceiver(rejectTaskReceiverCommand *co @@ -72,6 +76,7 @@ func (taskService *TaskService) RejectTaskReceiver(rejectTaskReceiverCommand *co
72 defer func() { 76 defer func() {
73 transactionContext.RollbackTransaction() 77 transactionContext.RollbackTransaction()
74 }() 78 }()
  79 +
75 var rejectTaskReceiverService service.RejectTaskReceiverService 80 var rejectTaskReceiverService service.RejectTaskReceiverService
76 if value, err := factory.CreateRejectTaskReceiverService(map[string]interface{}{ 81 if value, err := factory.CreateRejectTaskReceiverService(map[string]interface{}{
77 "transactionContext": transactionContext, 82 "transactionContext": transactionContext,
@@ -83,6 +88,7 @@ func (taskService *TaskService) RejectTaskReceiver(rejectTaskReceiverCommand *co @@ -83,6 +88,7 @@ func (taskService *TaskService) RejectTaskReceiver(rejectTaskReceiverCommand *co
83 TransactionContext: transactionContext.(*pgTransaction.TransactionContext), 88 TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
84 }) 89 })
85 } 90 }
  91 +
86 if task, err := rejectTaskReceiverService.Reject(rejectTaskReceiverCommand.TaskId, rejectTaskReceiverCommand.Operator, rejectTaskReceiverCommand.RejectReason); err != nil { 92 if task, err := rejectTaskReceiverService.Reject(rejectTaskReceiverCommand.TaskId, rejectTaskReceiverCommand.Operator, rejectTaskReceiverCommand.RejectReason); err != nil {
87 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 93 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
88 } else { 94 } else {
@@ -98,6 +104,7 @@ func (taskService *TaskService) RobTask(robTaskCommand *command.RobTaskCommand) @@ -98,6 +104,7 @@ func (taskService *TaskService) RobTask(robTaskCommand *command.RobTaskCommand)
98 if err := robTaskCommand.ValidateCommand(); err != nil { 104 if err := robTaskCommand.ValidateCommand(); err != nil {
99 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 105 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
100 } 106 }
  107 +
101 transactionContext, err := factory.CreateTransactionContext(nil) 108 transactionContext, err := factory.CreateTransactionContext(nil)
102 if err != nil { 109 if err != nil {
103 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 110 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -108,6 +115,7 @@ func (taskService *TaskService) RobTask(robTaskCommand *command.RobTaskCommand) @@ -108,6 +115,7 @@ func (taskService *TaskService) RobTask(robTaskCommand *command.RobTaskCommand)
108 defer func() { 115 defer func() {
109 transactionContext.RollbackTransaction() 116 transactionContext.RollbackTransaction()
110 }() 117 }()
  118 +
111 var robTaskService service.RobTaskService 119 var robTaskService service.RobTaskService
112 if value, err := factory.CreateRobTaskService(map[string]interface{}{ 120 if value, err := factory.CreateRobTaskService(map[string]interface{}{
113 "transactionContext": transactionContext, 121 "transactionContext": transactionContext,
@@ -120,6 +128,7 @@ func (taskService *TaskService) RobTask(robTaskCommand *command.RobTaskCommand) @@ -120,6 +128,7 @@ func (taskService *TaskService) RobTask(robTaskCommand *command.RobTaskCommand)
120 TransactionContext: transactionContext.(*pgTransaction.TransactionContext), 128 TransactionContext: transactionContext.(*pgTransaction.TransactionContext),
121 }) 129 })
122 } 130 }
  131 +
123 if task, err := robTaskService.Rob(robTaskCommand.TaskId, robTaskCommand.Receiver); err != nil { 132 if task, err := robTaskService.Rob(robTaskCommand.TaskId, robTaskCommand.Receiver); err != nil {
124 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 133 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
125 } else { 134 } else {
@@ -135,6 +144,7 @@ func (taskService *TaskService) BidTask(bidTaskCommand *command.BidTaskCommand) @@ -135,6 +144,7 @@ func (taskService *TaskService) BidTask(bidTaskCommand *command.BidTaskCommand)
135 if err := bidTaskCommand.ValidateCommand(); err != nil { 144 if err := bidTaskCommand.ValidateCommand(); err != nil {
136 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 145 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
137 } 146 }
  147 +
138 transactionContext, err := factory.CreateTransactionContext(nil) 148 transactionContext, err := factory.CreateTransactionContext(nil)
139 if err != nil { 149 if err != nil {
140 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 150 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -145,6 +155,7 @@ func (taskService *TaskService) BidTask(bidTaskCommand *command.BidTaskCommand) @@ -145,6 +155,7 @@ func (taskService *TaskService) BidTask(bidTaskCommand *command.BidTaskCommand)
145 defer func() { 155 defer func() {
146 transactionContext.RollbackTransaction() 156 transactionContext.RollbackTransaction()
147 }() 157 }()
  158 +
148 var bidTaskService service.BidTaskService 159 var bidTaskService service.BidTaskService
149 if value, err := factory.CreateBidTaskService(map[string]interface{}{ 160 if value, err := factory.CreateBidTaskService(map[string]interface{}{
150 "transactionContext": transactionContext, 161 "transactionContext": transactionContext,
@@ -153,6 +164,7 @@ func (taskService *TaskService) BidTask(bidTaskCommand *command.BidTaskCommand) @@ -153,6 +164,7 @@ func (taskService *TaskService) BidTask(bidTaskCommand *command.BidTaskCommand)
153 } else { 164 } else {
154 bidTaskService = value 165 bidTaskService = value
155 } 166 }
  167 +
156 if task, err := bidTaskService.Bid(bidTaskCommand.TaskId, bidTaskCommand.Bidder); err != nil { 168 if task, err := bidTaskService.Bid(bidTaskCommand.TaskId, bidTaskCommand.Bidder); err != nil {
157 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 169 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
158 } else { 170 } else {
@@ -168,6 +180,7 @@ func (taskService *TaskService) ChooseSuccessfulBidder(chooseSuccessfulBidderCom @@ -168,6 +180,7 @@ func (taskService *TaskService) ChooseSuccessfulBidder(chooseSuccessfulBidderCom
168 if err := chooseSuccessfulBidderCommand.ValidateCommand(); err != nil { 180 if err := chooseSuccessfulBidderCommand.ValidateCommand(); err != nil {
169 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 181 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
170 } 182 }
  183 +
171 transactionContext, err := factory.CreateTransactionContext(nil) 184 transactionContext, err := factory.CreateTransactionContext(nil)
172 if err != nil { 185 if err != nil {
173 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 186 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -178,6 +191,7 @@ func (taskService *TaskService) ChooseSuccessfulBidder(chooseSuccessfulBidderCom @@ -178,6 +191,7 @@ func (taskService *TaskService) ChooseSuccessfulBidder(chooseSuccessfulBidderCom
178 defer func() { 191 defer func() {
179 transactionContext.RollbackTransaction() 192 transactionContext.RollbackTransaction()
180 }() 193 }()
  194 +
181 var chooseSuccessfulBidderService service.ChooseSuccessfulBidderService 195 var chooseSuccessfulBidderService service.ChooseSuccessfulBidderService
182 if value, err := factory.CreateChooseSuccessfulBidderService(map[string]interface{}{ 196 if value, err := factory.CreateChooseSuccessfulBidderService(map[string]interface{}{
183 "transactionContext": transactionContext, 197 "transactionContext": transactionContext,
@@ -187,6 +201,7 @@ func (taskService *TaskService) ChooseSuccessfulBidder(chooseSuccessfulBidderCom @@ -187,6 +201,7 @@ func (taskService *TaskService) ChooseSuccessfulBidder(chooseSuccessfulBidderCom
187 chooseSuccessfulBidderService = value 201 chooseSuccessfulBidderService = value
188 chooseSuccessfulBidderService.Subscribe(&subscriber.AbilityServiceSubscriber{}) 202 chooseSuccessfulBidderService.Subscribe(&subscriber.AbilityServiceSubscriber{})
189 } 203 }
  204 +
190 if task, err := chooseSuccessfulBidderService.Choose(chooseSuccessfulBidderCommand.TaskId, chooseSuccessfulBidderCommand.SuccessfulBidder, chooseSuccessfulBidderCommand.Operator, chooseSuccessfulBidderCommand.PlannedCompletionTime); err != nil { 205 if task, err := chooseSuccessfulBidderService.Choose(chooseSuccessfulBidderCommand.TaskId, chooseSuccessfulBidderCommand.SuccessfulBidder, chooseSuccessfulBidderCommand.Operator, chooseSuccessfulBidderCommand.PlannedCompletionTime); err != nil {
191 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 206 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
192 } else { 207 } else {
@@ -202,6 +217,7 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm @@ -202,6 +217,7 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm
202 if err := applyCompleteTaskCommand.ValidateCommand(); err != nil { 217 if err := applyCompleteTaskCommand.ValidateCommand(); err != nil {
203 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 218 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
204 } 219 }
  220 +
205 transactionContext, err := factory.CreateTransactionContext(nil) 221 transactionContext, err := factory.CreateTransactionContext(nil)
206 if err != nil { 222 if err != nil {
207 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 223 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -212,6 +228,7 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm @@ -212,6 +228,7 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm
212 defer func() { 228 defer func() {
213 transactionContext.RollbackTransaction() 229 transactionContext.RollbackTransaction()
214 }() 230 }()
  231 +
215 var applyCompleteTaskService service.ApplyCompleteTaskService 232 var applyCompleteTaskService service.ApplyCompleteTaskService
216 if value, err := factory.CreateApplyCompleteTaskService(map[string]interface{}{ 233 if value, err := factory.CreateApplyCompleteTaskService(map[string]interface{}{
217 "transactionContext": transactionContext, 234 "transactionContext": transactionContext,
@@ -220,6 +237,7 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm @@ -220,6 +237,7 @@ func (taskService *TaskService) ApplyCompleteTask(applyCompleteTaskCommand *comm
220 } else { 237 } else {
221 applyCompleteTaskService = value 238 applyCompleteTaskService = value
222 } 239 }
  240 +
223 if task, err := applyCompleteTaskService.ApplyComplete(applyCompleteTaskCommand.TaskId, applyCompleteTaskCommand.Receiver); err != nil { 241 if task, err := applyCompleteTaskService.ApplyComplete(applyCompleteTaskCommand.TaskId, applyCompleteTaskCommand.Receiver); err != nil {
224 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 242 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
225 } else { 243 } else {
@@ -247,6 +265,7 @@ func (taskService *TaskService) ReleaseTask(releaseTaskCommand *command.ReleaseT @@ -247,6 +265,7 @@ func (taskService *TaskService) ReleaseTask(releaseTaskCommand *command.ReleaseT
247 transactionContext.RollbackTransaction() 265 transactionContext.RollbackTransaction()
248 }() 266 }()
249 267
  268 + // 发布任务服务初始化
250 var releaseTaskService service.ReleaseTaskService 269 var releaseTaskService service.ReleaseTaskService
251 if value, err := factory.CreateReleaseTaskService(map[string]interface{}{ 270 if value, err := factory.CreateReleaseTaskService(map[string]interface{}{
252 "transactionContext": transactionContext, 271 "transactionContext": transactionContext,
@@ -260,6 +279,7 @@ func (taskService *TaskService) ReleaseTask(releaseTaskCommand *command.ReleaseT @@ -260,6 +279,7 @@ func (taskService *TaskService) ReleaseTask(releaseTaskCommand *command.ReleaseT
260 }) 279 })
261 } 280 }
262 281
  282 + // 关闭任务
263 if task, err := releaseTaskService.Release(releaseTaskCommand.TaskId, releaseTaskCommand.Operator); err != nil { 283 if task, err := releaseTaskService.Release(releaseTaskCommand.TaskId, releaseTaskCommand.Operator); err != nil {
264 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 284 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
265 } else { 285 } else {
@@ -275,6 +295,7 @@ func (taskService *TaskService) OffTask(offTaskCommand *command.OffTaskCommand) @@ -275,6 +295,7 @@ func (taskService *TaskService) OffTask(offTaskCommand *command.OffTaskCommand)
275 if err := offTaskCommand.ValidateCommand(); err != nil { 295 if err := offTaskCommand.ValidateCommand(); err != nil {
276 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 296 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
277 } 297 }
  298 +
278 transactionContext, err := factory.CreateTransactionContext(nil) 299 transactionContext, err := factory.CreateTransactionContext(nil)
279 if err != nil { 300 if err != nil {
280 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 301 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -285,6 +306,8 @@ func (taskService *TaskService) OffTask(offTaskCommand *command.OffTaskCommand) @@ -285,6 +306,8 @@ func (taskService *TaskService) OffTask(offTaskCommand *command.OffTaskCommand)
285 defer func() { 306 defer func() {
286 transactionContext.RollbackTransaction() 307 transactionContext.RollbackTransaction()
287 }() 308 }()
  309 +
  310 + // 关闭任务服务初始化
288 var offTaskService service.OffTaskService 311 var offTaskService service.OffTaskService
289 if value, err := factory.CreateOffTaskService(map[string]interface{}{ 312 if value, err := factory.CreateOffTaskService(map[string]interface{}{
290 "transactionContext": transactionContext, 313 "transactionContext": transactionContext,
@@ -294,6 +317,8 @@ func (taskService *TaskService) OffTask(offTaskCommand *command.OffTaskCommand) @@ -294,6 +317,8 @@ func (taskService *TaskService) OffTask(offTaskCommand *command.OffTaskCommand)
294 offTaskService = value 317 offTaskService = value
295 offTaskService.Subscribe(&subscriber.AbilityServiceSubscriber{}) 318 offTaskService.Subscribe(&subscriber.AbilityServiceSubscriber{})
296 } 319 }
  320 +
  321 + // 关闭任务
297 if task, err := offTaskService.Off(offTaskCommand.TaskId, offTaskCommand.Operator, offTaskCommand.OffReason); err != nil { 322 if task, err := offTaskService.Off(offTaskCommand.TaskId, offTaskCommand.Operator, offTaskCommand.OffReason); err != nil {
298 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 323 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
299 } else { 324 } else {
@@ -356,6 +381,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac @@ -356,6 +381,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac
356 } 381 }
357 acceptanceTaskCommand.TaskPercentage[i].Contributor = employeeFound.EmployeeInfo 382 acceptanceTaskCommand.TaskPercentage[i].Contributor = employeeFound.EmployeeInfo
358 } 383 }
  384 +
359 // 填充评分员工信息 385 // 填充评分员工信息
360 for i, referenceResourceScore := range acceptanceTaskCommand.ReferenceResourceScore { 386 for i, referenceResourceScore := range acceptanceTaskCommand.ReferenceResourceScore {
361 for j, solveScore := range referenceResourceScore.SolveScore { 387 for j, solveScore := range referenceResourceScore.SolveScore {
@@ -495,6 +521,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -495,6 +521,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
495 if err := searchOffTaskRecordCommand.ValidateCommand(); err != nil { 521 if err := searchOffTaskRecordCommand.ValidateCommand(); err != nil {
496 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 522 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
497 } 523 }
  524 +
498 transactionContext, err := factory.CreateTransactionContext(nil) 525 transactionContext, err := factory.CreateTransactionContext(nil)
499 if err != nil { 526 if err != nil {
500 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 527 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -505,6 +532,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -505,6 +532,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
505 defer func() { 532 defer func() {
506 transactionContext.RollbackTransaction() 533 transactionContext.RollbackTransaction()
507 }() 534 }()
  535 +
508 var projectBelongRepository domain.ProjectBelongRepository 536 var projectBelongRepository domain.ProjectBelongRepository
509 if value, err := factory.CreateProjectBelongRepository(map[string]interface{}{ 537 if value, err := factory.CreateProjectBelongRepository(map[string]interface{}{
510 "transactionContext": transactionContext, 538 "transactionContext": transactionContext,
@@ -513,6 +541,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -513,6 +541,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
513 } else { 541 } else {
514 projectBelongRepository = value 542 projectBelongRepository = value
515 } 543 }
  544 +
516 projectBelongMap := make(map[int]*domain.ProjectBelong) 545 projectBelongMap := make(map[int]*domain.ProjectBelong)
517 if _, projectBelongs, err := projectBelongRepository.Find(map[string]interface{}{ 546 if _, projectBelongs, err := projectBelongRepository.Find(map[string]interface{}{
518 "companyId": searchOffTaskRecordCommand.CompanyId, 547 "companyId": searchOffTaskRecordCommand.CompanyId,
@@ -523,6 +552,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -523,6 +552,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
523 projectBelongMap[projectBelong.ProjectBelongId] = projectBelong 552 projectBelongMap[projectBelong.ProjectBelongId] = projectBelong
524 } 553 }
525 } 554 }
  555 +
526 var customerValueRepository domain.CustomerValueRepository 556 var customerValueRepository domain.CustomerValueRepository
527 if value, err := factory.CreateCustomerValueRepository(map[string]interface{}{ 557 if value, err := factory.CreateCustomerValueRepository(map[string]interface{}{
528 "transactionContext": transactionContext, 558 "transactionContext": transactionContext,
@@ -531,6 +561,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -531,6 +561,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
531 } else { 561 } else {
532 customerValueRepository = value 562 customerValueRepository = value
533 } 563 }
  564 +
534 customerValueMap := make(map[int]*domain.CustomerValue) 565 customerValueMap := make(map[int]*domain.CustomerValue)
535 if _, customerValues, err := customerValueRepository.Find(map[string]interface{}{ 566 if _, customerValues, err := customerValueRepository.Find(map[string]interface{}{
536 "companyId": searchOffTaskRecordCommand.CompanyId, 567 "companyId": searchOffTaskRecordCommand.CompanyId,
@@ -541,6 +572,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -541,6 +572,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
541 customerValueMap[customerValue.CustomerValueId] = customerValue 572 customerValueMap[customerValue.CustomerValueId] = customerValue
542 } 573 }
543 } 574 }
  575 +
544 var taskNatureRepository domain.TaskNatureRepository 576 var taskNatureRepository domain.TaskNatureRepository
545 if value, err := factory.CreateTaskNatureRepository(map[string]interface{}{ 577 if value, err := factory.CreateTaskNatureRepository(map[string]interface{}{
546 "transactionContext": transactionContext, 578 "transactionContext": transactionContext,
@@ -549,6 +581,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -549,6 +581,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
549 } else { 581 } else {
550 taskNatureRepository = value 582 taskNatureRepository = value
551 } 583 }
  584 +
552 taskNatureMap := make(map[int]*domain.TaskNature) 585 taskNatureMap := make(map[int]*domain.TaskNature)
553 if _, taskNatures, err := taskNatureRepository.Find(map[string]interface{}{ 586 if _, taskNatures, err := taskNatureRepository.Find(map[string]interface{}{
554 "companyId": searchOffTaskRecordCommand.CompanyId, 587 "companyId": searchOffTaskRecordCommand.CompanyId,
@@ -559,6 +592,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -559,6 +592,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
559 taskNatureMap[taskNature.TaskNatureId] = taskNature 592 taskNatureMap[taskNature.TaskNatureId] = taskNature
560 } 593 }
561 } 594 }
  595 +
562 var taskRepository domain.TaskRepository 596 var taskRepository domain.TaskRepository
563 if value, err := factory.CreateTaskRepository(map[string]interface{}{ 597 if value, err := factory.CreateTaskRepository(map[string]interface{}{
564 "transactionContext": transactionContext, 598 "transactionContext": transactionContext,
@@ -567,6 +601,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -567,6 +601,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
567 } else { 601 } else {
568 taskRepository = value 602 taskRepository = value
569 } 603 }
  604 +
570 var offTaskRecordRepository domain.OffTaskRecordRepository 605 var offTaskRecordRepository domain.OffTaskRecordRepository
571 if value, err := factory.CreateOffTaskRecordRepository(map[string]interface{}{ 606 if value, err := factory.CreateOffTaskRecordRepository(map[string]interface{}{
572 "transactionContext": transactionContext, 607 "transactionContext": transactionContext,
@@ -575,6 +610,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -575,6 +610,7 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
575 } else { 610 } else {
576 offTaskRecordRepository = value 611 offTaskRecordRepository = value
577 } 612 }
  613 +
578 _, tasks, err := taskRepository.Find(map[string]interface{}{ 614 _, tasks, err := taskRepository.Find(map[string]interface{}{
579 "companyId": searchOffTaskRecordCommand.CompanyId, 615 "companyId": searchOffTaskRecordCommand.CompanyId,
580 "taskStatus": domain.TASK_STATUS_CLOSED, 616 "taskStatus": domain.TASK_STATUS_CLOSED,
@@ -628,6 +664,7 @@ func (taskService *TaskService) GetOffTaskRecord(getOffTaskRecordQuery *query.Ge @@ -628,6 +664,7 @@ func (taskService *TaskService) GetOffTaskRecord(getOffTaskRecordQuery *query.Ge
628 if err := getOffTaskRecordQuery.ValidateQuery(); err != nil { 664 if err := getOffTaskRecordQuery.ValidateQuery(); err != nil {
629 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 665 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
630 } 666 }
  667 +
631 transactionContext, err := factory.CreateTransactionContext(nil) 668 transactionContext, err := factory.CreateTransactionContext(nil)
632 if err != nil { 669 if err != nil {
633 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 670 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -638,6 +675,7 @@ func (taskService *TaskService) GetOffTaskRecord(getOffTaskRecordQuery *query.Ge @@ -638,6 +675,7 @@ func (taskService *TaskService) GetOffTaskRecord(getOffTaskRecordQuery *query.Ge
638 defer func() { 675 defer func() {
639 transactionContext.RollbackTransaction() 676 transactionContext.RollbackTransaction()
640 }() 677 }()
  678 +
641 var offTaskRecordRepository domain.OffTaskRecordRepository 679 var offTaskRecordRepository domain.OffTaskRecordRepository
642 if value, err := factory.CreateOffTaskRecordRepository(map[string]interface{}{ 680 if value, err := factory.CreateOffTaskRecordRepository(map[string]interface{}{
643 "transactionContext": transactionContext, 681 "transactionContext": transactionContext,
@@ -646,6 +684,7 @@ func (taskService *TaskService) GetOffTaskRecord(getOffTaskRecordQuery *query.Ge @@ -646,6 +684,7 @@ func (taskService *TaskService) GetOffTaskRecord(getOffTaskRecordQuery *query.Ge
646 } else { 684 } else {
647 offTaskRecordRepository = value 685 offTaskRecordRepository = value
648 } 686 }
  687 +
649 offTaskRecord, err := offTaskRecordRepository.FindOne(map[string]interface{}{"offTaskRecordId": getOffTaskRecordQuery.OffTaskRecordId}) 688 offTaskRecord, err := offTaskRecordRepository.FindOne(map[string]interface{}{"offTaskRecordId": getOffTaskRecordQuery.OffTaskRecordId})
650 if err != nil { 689 if err != nil {
651 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 690 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -665,6 +704,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -665,6 +704,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
665 if err := searchRejectTaskRecordCommand.ValidateCommand(); err != nil { 704 if err := searchRejectTaskRecordCommand.ValidateCommand(); err != nil {
666 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 705 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
667 } 706 }
  707 +
668 transactionContext, err := factory.CreateTransactionContext(nil) 708 transactionContext, err := factory.CreateTransactionContext(nil)
669 if err != nil { 709 if err != nil {
670 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 710 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -675,6 +715,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -675,6 +715,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
675 defer func() { 715 defer func() {
676 transactionContext.RollbackTransaction() 716 transactionContext.RollbackTransaction()
677 }() 717 }()
  718 +
678 var projectBelongRepository domain.ProjectBelongRepository 719 var projectBelongRepository domain.ProjectBelongRepository
679 if value, err := factory.CreateProjectBelongRepository(map[string]interface{}{ 720 if value, err := factory.CreateProjectBelongRepository(map[string]interface{}{
680 "transactionContext": transactionContext, 721 "transactionContext": transactionContext,
@@ -683,6 +724,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -683,6 +724,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
683 } else { 724 } else {
684 projectBelongRepository = value 725 projectBelongRepository = value
685 } 726 }
  727 +
686 projectBelongMap := make(map[int]*domain.ProjectBelong) 728 projectBelongMap := make(map[int]*domain.ProjectBelong)
687 if _, projectBelongs, err := projectBelongRepository.Find(map[string]interface{}{ 729 if _, projectBelongs, err := projectBelongRepository.Find(map[string]interface{}{
688 "companyId": searchRejectTaskRecordCommand.CompanyId, 730 "companyId": searchRejectTaskRecordCommand.CompanyId,
@@ -693,6 +735,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -693,6 +735,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
693 projectBelongMap[projectBelong.ProjectBelongId] = projectBelong 735 projectBelongMap[projectBelong.ProjectBelongId] = projectBelong
694 } 736 }
695 } 737 }
  738 +
696 var customerValueRepository domain.CustomerValueRepository 739 var customerValueRepository domain.CustomerValueRepository
697 if value, err := factory.CreateCustomerValueRepository(map[string]interface{}{ 740 if value, err := factory.CreateCustomerValueRepository(map[string]interface{}{
698 "transactionContext": transactionContext, 741 "transactionContext": transactionContext,
@@ -701,6 +744,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -701,6 +744,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
701 } else { 744 } else {
702 customerValueRepository = value 745 customerValueRepository = value
703 } 746 }
  747 +
704 customerValueMap := make(map[int]*domain.CustomerValue) 748 customerValueMap := make(map[int]*domain.CustomerValue)
705 if _, customerValues, err := customerValueRepository.Find(map[string]interface{}{ 749 if _, customerValues, err := customerValueRepository.Find(map[string]interface{}{
706 "companyId": searchRejectTaskRecordCommand.CompanyId, 750 "companyId": searchRejectTaskRecordCommand.CompanyId,
@@ -711,6 +755,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -711,6 +755,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
711 customerValueMap[customerValue.CustomerValueId] = customerValue 755 customerValueMap[customerValue.CustomerValueId] = customerValue
712 } 756 }
713 } 757 }
  758 +
714 var taskNatureRepository domain.TaskNatureRepository 759 var taskNatureRepository domain.TaskNatureRepository
715 if value, err := factory.CreateTaskNatureRepository(map[string]interface{}{ 760 if value, err := factory.CreateTaskNatureRepository(map[string]interface{}{
716 "transactionContext": transactionContext, 761 "transactionContext": transactionContext,
@@ -719,6 +764,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -719,6 +764,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
719 } else { 764 } else {
720 taskNatureRepository = value 765 taskNatureRepository = value
721 } 766 }
  767 +
722 taskNatureMap := make(map[int]*domain.TaskNature) 768 taskNatureMap := make(map[int]*domain.TaskNature)
723 if _, taskNatures, err := taskNatureRepository.Find(map[string]interface{}{ 769 if _, taskNatures, err := taskNatureRepository.Find(map[string]interface{}{
724 "companyId": searchRejectTaskRecordCommand.CompanyId, 770 "companyId": searchRejectTaskRecordCommand.CompanyId,
@@ -729,6 +775,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -729,6 +775,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
729 taskNatureMap[taskNature.TaskNatureId] = taskNature 775 taskNatureMap[taskNature.TaskNatureId] = taskNature
730 } 776 }
731 } 777 }
  778 +
732 var taskRepository domain.TaskRepository 779 var taskRepository domain.TaskRepository
733 if value, err := factory.CreateTaskRepository(map[string]interface{}{ 780 if value, err := factory.CreateTaskRepository(map[string]interface{}{
734 "transactionContext": transactionContext, 781 "transactionContext": transactionContext,
@@ -737,6 +784,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -737,6 +784,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
737 } else { 784 } else {
738 taskRepository = value 785 taskRepository = value
739 } 786 }
  787 +
740 var rejectTaskRecordRepository domain.RejectTaskRecordRepository 788 var rejectTaskRecordRepository domain.RejectTaskRecordRepository
741 if value, err := factory.CreateRejectTaskRecordRepository(map[string]interface{}{ 789 if value, err := factory.CreateRejectTaskRecordRepository(map[string]interface{}{
742 "transactionContext": transactionContext, 790 "transactionContext": transactionContext,
@@ -745,6 +793,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -745,6 +793,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
745 } else { 793 } else {
746 rejectTaskRecordRepository = value 794 rejectTaskRecordRepository = value
747 } 795 }
  796 +
748 _, tasks, err := taskRepository.Find(map[string]interface{}{ 797 _, tasks, err := taskRepository.Find(map[string]interface{}{
749 "companyId": searchRejectTaskRecordCommand.CompanyId, 798 "companyId": searchRejectTaskRecordCommand.CompanyId,
750 "taskContentMatch": searchRejectTaskRecordCommand.TaskContentMatch, 799 "taskContentMatch": searchRejectTaskRecordCommand.TaskContentMatch,
@@ -760,6 +809,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom @@ -760,6 +809,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom
760 for _, task := range tasks { 809 for _, task := range tasks {
761 taskIds = append(taskIds, task.TaskId) 810 taskIds = append(taskIds, task.TaskId)
762 } 811 }
  812 +
763 if count, rejectTaskRecords, err := rejectTaskRecordRepository.Find(map[string]interface{}{ 813 if count, rejectTaskRecords, err := rejectTaskRecordRepository.Find(map[string]interface{}{
764 "taskIds": taskIds, 814 "taskIds": taskIds,
765 "rejectStartTime": searchRejectTaskRecordCommand.RejectStartTime, 815 "rejectStartTime": searchRejectTaskRecordCommand.RejectStartTime,
@@ -797,6 +847,7 @@ func (taskService *TaskService) GetRejectTaskRecord(getRejectTaskRecordQuery *qu @@ -797,6 +847,7 @@ func (taskService *TaskService) GetRejectTaskRecord(getRejectTaskRecordQuery *qu
797 if err := getRejectTaskRecordQuery.ValidateQuery(); err != nil { 847 if err := getRejectTaskRecordQuery.ValidateQuery(); err != nil {
798 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 848 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
799 } 849 }
  850 +
800 transactionContext, err := factory.CreateTransactionContext(nil) 851 transactionContext, err := factory.CreateTransactionContext(nil)
801 if err != nil { 852 if err != nil {
802 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 853 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -807,6 +858,7 @@ func (taskService *TaskService) GetRejectTaskRecord(getRejectTaskRecordQuery *qu @@ -807,6 +858,7 @@ func (taskService *TaskService) GetRejectTaskRecord(getRejectTaskRecordQuery *qu
807 defer func() { 858 defer func() {
808 transactionContext.RollbackTransaction() 859 transactionContext.RollbackTransaction()
809 }() 860 }()
  861 +
810 var rejectTaskRecordRepository domain.RejectTaskRecordRepository 862 var rejectTaskRecordRepository domain.RejectTaskRecordRepository
811 if value, err := factory.CreateRejectTaskRecordRepository(map[string]interface{}{ 863 if value, err := factory.CreateRejectTaskRecordRepository(map[string]interface{}{
812 "transactionContext": transactionContext, 864 "transactionContext": transactionContext,
@@ -815,6 +867,7 @@ func (taskService *TaskService) GetRejectTaskRecord(getRejectTaskRecordQuery *qu @@ -815,6 +867,7 @@ func (taskService *TaskService) GetRejectTaskRecord(getRejectTaskRecordQuery *qu
815 } else { 867 } else {
816 rejectTaskRecordRepository = value 868 rejectTaskRecordRepository = value
817 } 869 }
  870 +
818 rejectTaskRecord, err := rejectTaskRecordRepository.FindOne(map[string]interface{}{"rejectTaskRecordId": getRejectTaskRecordQuery.RejectTaskRecordId}) 871 rejectTaskRecord, err := rejectTaskRecordRepository.FindOne(map[string]interface{}{"rejectTaskRecordId": getRejectTaskRecordQuery.RejectTaskRecordId})
819 if err != nil { 872 if err != nil {
820 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 873 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -834,6 +887,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -834,6 +887,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
834 if err := createTaskCommand.ValidateCommand(); err != nil { 887 if err := createTaskCommand.ValidateCommand(); err != nil {
835 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 888 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
836 } 889 }
  890 +
837 transactionContext, err := factory.CreateTransactionContext(nil) 891 transactionContext, err := factory.CreateTransactionContext(nil)
838 if err != nil { 892 if err != nil {
839 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 893 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -844,6 +898,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -844,6 +898,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
844 defer func() { 898 defer func() {
845 transactionContext.RollbackTransaction() 899 transactionContext.RollbackTransaction()
846 }() 900 }()
  901 +
847 var taskDao *dao.TaskDao 902 var taskDao *dao.TaskDao
848 if value, err := factory.CreateTaskDao(map[string]interface{}{ 903 if value, err := factory.CreateTaskDao(map[string]interface{}{
849 "transactionContext": transactionContext, 904 "transactionContext": transactionContext,
@@ -852,6 +907,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -852,6 +907,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
852 } else { 907 } else {
853 taskDao = value 908 taskDao = value
854 } 909 }
  910 +
855 var employeeRepository domain.EmployeeRepository 911 var employeeRepository domain.EmployeeRepository
856 if value, err := factory.CreateEmployeeRepository(map[string]interface{}{ 912 if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
857 "transactionContext": transactionContext, 913 "transactionContext": transactionContext,
@@ -860,29 +916,54 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -860,29 +916,54 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
860 } else { 916 } else {
861 employeeRepository = value 917 employeeRepository = value
862 } 918 }
  919 +
863 sponsor, err := employeeRepository.FindOne(map[string]interface{}{ 920 sponsor, err := employeeRepository.FindOne(map[string]interface{}{
864 "uid": createTaskCommand.Sponsor, 921 "uid": createTaskCommand.Sponsor,
  922 + "status": 1,
865 }) 923 })
866 if err != nil { 924 if err != nil {
867 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 925 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
868 } 926 }
869 if sponsor == nil { 927 if sponsor == nil {
870 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者") 928 + // 获取无效的发布人员信息
  929 + sponsorInvalid, err := employeeRepository.FindOne(map[string]interface{}{
  930 + "uid": createTaskCommand.AssignedPerson,
  931 + })
  932 + if err != nil {
  933 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  934 + }
  935 + if sponsorInvalid == nil {
  936 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者")
  937 + }
  938 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者:"+ sponsorInvalid.EmployeeInfo.EmployeeName)
871 } 939 }
  940 +
872 // 获取任务指派人 941 // 获取任务指派人
873 var assignedPerson *domain.EmployeeInfo 942 var assignedPerson *domain.EmployeeInfo
874 if createTaskCommand.AssignedPerson != 0 { 943 if createTaskCommand.AssignedPerson != 0 {
875 employee, err := employeeRepository.FindOne(map[string]interface{}{ 944 employee, err := employeeRepository.FindOne(map[string]interface{}{
876 "uid": createTaskCommand.AssignedPerson, 945 "uid": createTaskCommand.AssignedPerson,
  946 + "status": 1,
877 }) 947 })
878 if err != nil { 948 if err != nil {
879 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 949 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
880 } 950 }
881 if employee == nil { 951 if employee == nil {
882 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员") 952 + // 获取无效的指派人员信息
  953 + employeeInvalid, err := employeeRepository.FindOne(map[string]interface{}{
  954 + "uid": createTaskCommand.AssignedPerson,
  955 + })
  956 + if err != nil {
  957 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  958 + }
  959 + if employeeInvalid == nil {
  960 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员")
  961 + }
  962 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:" + employeeInvalid.EmployeeInfo.EmployeeName)
883 } 963 }
884 assignedPerson = employee.EmployeeInfo 964 assignedPerson = employee.EmployeeInfo
885 } 965 }
  966 +
886 newTask := &domain.Task{ 967 newTask := &domain.Task{
887 TaskStatus: domain.TASK_STATUS_UNRELEASED, 968 TaskStatus: domain.TASK_STATUS_UNRELEASED,
888 CompanyId: createTaskCommand.CompanyId, 969 CompanyId: createTaskCommand.CompanyId,
@@ -907,6 +988,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -907,6 +988,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
907 PlannedCompletionTime: createTaskCommand.PlannedCompletionTime, 988 PlannedCompletionTime: createTaskCommand.PlannedCompletionTime,
908 CreateTime: time.Now(), 989 CreateTime: time.Now(),
909 } 990 }
  991 +
910 var taskRepository domain.TaskRepository 992 var taskRepository domain.TaskRepository
911 if value, err := factory.CreateTaskRepository(map[string]interface{}{ 993 if value, err := factory.CreateTaskRepository(map[string]interface{}{
912 "transactionContext": transactionContext, 994 "transactionContext": transactionContext,
@@ -915,6 +997,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -915,6 +997,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
915 } else { 997 } else {
916 taskRepository = value 998 taskRepository = value
917 } 999 }
  1000 +
918 if createTaskCommand.ReferenceResourceItems != nil && len(createTaskCommand.ReferenceResourceItems) > 0 { 1001 if createTaskCommand.ReferenceResourceItems != nil && len(createTaskCommand.ReferenceResourceItems) > 0 {
919 var referenceResourceIds []int64 1002 var referenceResourceIds []int64
920 for _, referenceResourceItem := range createTaskCommand.ReferenceResourceItems { 1003 for _, referenceResourceItem := range createTaskCommand.ReferenceResourceItems {
@@ -932,6 +1015,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -932,6 +1015,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
932 } 1015 }
933 } 1016 }
934 } 1017 }
  1018 +
935 if task, err := taskRepository.Save(newTask); err != nil { 1019 if task, err := taskRepository.Save(newTask); err != nil {
936 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1020 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
937 } else { 1021 } else {
@@ -969,6 +1053,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -969,6 +1053,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
969 if err := getTaskQuery.ValidateQuery(); err != nil { 1053 if err := getTaskQuery.ValidateQuery(); err != nil {
970 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 1054 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
971 } 1055 }
  1056 +
972 transactionContext, err := factory.CreateTransactionContext(nil) 1057 transactionContext, err := factory.CreateTransactionContext(nil)
973 if err != nil { 1058 if err != nil {
974 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1059 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -979,6 +1064,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -979,6 +1064,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
979 defer func() { 1064 defer func() {
980 transactionContext.RollbackTransaction() 1065 transactionContext.RollbackTransaction()
981 }() 1066 }()
  1067 +
982 var taskRepository domain.TaskRepository 1068 var taskRepository domain.TaskRepository
983 if value, err := factory.CreateTaskRepository(map[string]interface{}{ 1069 if value, err := factory.CreateTaskRepository(map[string]interface{}{
984 "transactionContext": transactionContext, 1070 "transactionContext": transactionContext,
@@ -987,6 +1073,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -987,6 +1073,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
987 } else { 1073 } else {
988 taskRepository = value 1074 taskRepository = value
989 } 1075 }
  1076 +
990 task, err := taskRepository.FindOne(map[string]interface{}{"taskId": getTaskQuery.TaskId}) 1077 task, err := taskRepository.FindOne(map[string]interface{}{"taskId": getTaskQuery.TaskId})
991 if err != nil { 1078 if err != nil {
992 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1079 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -1002,6 +1089,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1002,6 +1089,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1002 } else { 1089 } else {
1003 projectBelongRepository = value 1090 projectBelongRepository = value
1004 } 1091 }
  1092 +
1005 projectBelongMap := make(map[int]*domain.ProjectBelong) 1093 projectBelongMap := make(map[int]*domain.ProjectBelong)
1006 if _, projectBelongs, err := projectBelongRepository.Find(map[string]interface{}{ 1094 if _, projectBelongs, err := projectBelongRepository.Find(map[string]interface{}{
1007 "companyId": task.CompanyId, 1095 "companyId": task.CompanyId,
@@ -1012,6 +1100,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1012,6 +1100,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1012 projectBelongMap[projectBelong.ProjectBelongId] = projectBelong 1100 projectBelongMap[projectBelong.ProjectBelongId] = projectBelong
1013 } 1101 }
1014 } 1102 }
  1103 +
1015 var customerValueRepository domain.CustomerValueRepository 1104 var customerValueRepository domain.CustomerValueRepository
1016 if value, err := factory.CreateCustomerValueRepository(map[string]interface{}{ 1105 if value, err := factory.CreateCustomerValueRepository(map[string]interface{}{
1017 "transactionContext": transactionContext, 1106 "transactionContext": transactionContext,
@@ -1020,6 +1109,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1020,6 +1109,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1020 } else { 1109 } else {
1021 customerValueRepository = value 1110 customerValueRepository = value
1022 } 1111 }
  1112 +
1023 customerValueMap := make(map[int]*domain.CustomerValue) 1113 customerValueMap := make(map[int]*domain.CustomerValue)
1024 if _, customerValues, err := customerValueRepository.Find(map[string]interface{}{ 1114 if _, customerValues, err := customerValueRepository.Find(map[string]interface{}{
1025 "companyId": task.CompanyId, 1115 "companyId": task.CompanyId,
@@ -1030,6 +1120,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1030,6 +1120,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1030 customerValueMap[customerValue.CustomerValueId] = customerValue 1120 customerValueMap[customerValue.CustomerValueId] = customerValue
1031 } 1121 }
1032 } 1122 }
  1123 +
1033 var taskNatureRepository domain.TaskNatureRepository 1124 var taskNatureRepository domain.TaskNatureRepository
1034 if value, err := factory.CreateTaskNatureRepository(map[string]interface{}{ 1125 if value, err := factory.CreateTaskNatureRepository(map[string]interface{}{
1035 "transactionContext": transactionContext, 1126 "transactionContext": transactionContext,
@@ -1038,6 +1129,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1038,6 +1129,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1038 } else { 1129 } else {
1039 taskNatureRepository = value 1130 taskNatureRepository = value
1040 } 1131 }
  1132 +
1041 taskNatureMap := make(map[int]*domain.TaskNature) 1133 taskNatureMap := make(map[int]*domain.TaskNature)
1042 if _, taskNatures, err := taskNatureRepository.Find(map[string]interface{}{ 1134 if _, taskNatures, err := taskNatureRepository.Find(map[string]interface{}{
1043 "companyId": task.CompanyId, 1135 "companyId": task.CompanyId,
@@ -1048,6 +1140,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1048,6 +1140,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1048 taskNatureMap[taskNature.TaskNatureId] = taskNature 1140 taskNatureMap[taskNature.TaskNatureId] = taskNature
1049 } 1141 }
1050 } 1142 }
  1143 +
1051 taskDto := &dto.TaskDto{} 1144 taskDto := &dto.TaskDto{}
1052 if err := taskDto.LoadDto(task, projectBelongMap, customerValueMap, taskNatureMap); err != nil { 1145 if err := taskDto.LoadDto(task, projectBelongMap, customerValueMap, taskNatureMap); err != nil {
1053 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1146 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -1055,11 +1148,13 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1055,11 +1148,13 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1055 if err := transactionContext.CommitTransaction(); err != nil { 1148 if err := transactionContext.CommitTransaction(); err != nil {
1056 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1149 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
1057 } 1150 }
  1151 +
1058 // 返回任务素币奖励范围 1152 // 返回任务素币奖励范围
1059 if taskDto.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 { 1153 if taskDto.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 {
1060 taskDto.MinSuMoney = 0 1154 taskDto.MinSuMoney = 0
1061 taskDto.MaxSuMoney = task.SuMoney 1155 taskDto.MaxSuMoney = task.SuMoney
1062 } 1156 }
  1157 +
1063 return taskDto, nil 1158 return taskDto, nil
1064 } 1159 }
1065 } 1160 }
@@ -1262,6 +1357,7 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask @@ -1262,6 +1357,7 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask
1262 if err := removeTaskCommand.ValidateCommand(); err != nil { 1357 if err := removeTaskCommand.ValidateCommand(); err != nil {
1263 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 1358 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
1264 } 1359 }
  1360 +
1265 transactionContext, err := factory.CreateTransactionContext(nil) 1361 transactionContext, err := factory.CreateTransactionContext(nil)
1266 if err != nil { 1362 if err != nil {
1267 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1363 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -1272,6 +1368,7 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask @@ -1272,6 +1368,7 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask
1272 defer func() { 1368 defer func() {
1273 transactionContext.RollbackTransaction() 1369 transactionContext.RollbackTransaction()
1274 }() 1370 }()
  1371 +
1275 var taskRepository domain.TaskRepository 1372 var taskRepository domain.TaskRepository
1276 if value, err := factory.CreateTaskRepository(map[string]interface{}{ 1373 if value, err := factory.CreateTaskRepository(map[string]interface{}{
1277 "transactionContext": transactionContext, 1374 "transactionContext": transactionContext,
@@ -1280,6 +1377,7 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask @@ -1280,6 +1377,7 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask
1280 } else { 1377 } else {
1281 taskRepository = value 1378 taskRepository = value
1282 } 1379 }
  1380 +
1283 task, err := taskRepository.FindOne(map[string]interface{}{"taskId": removeTaskCommand.TaskId}) 1381 task, err := taskRepository.FindOne(map[string]interface{}{"taskId": removeTaskCommand.TaskId})
1284 if err != nil { 1382 if err != nil {
1285 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1383 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -1319,6 +1417,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in @@ -1319,6 +1417,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in
1319 if err := listTaskQuery.ValidateQuery(); err != nil { 1417 if err := listTaskQuery.ValidateQuery(); err != nil {
1320 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 1418 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
1321 } 1419 }
  1420 +
1322 transactionContext, err := factory.CreateTransactionContext(nil) 1421 transactionContext, err := factory.CreateTransactionContext(nil)
1323 if err != nil { 1422 if err != nil {
1324 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1423 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -1329,6 +1428,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in @@ -1329,6 +1428,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in
1329 defer func() { 1428 defer func() {
1330 transactionContext.RollbackTransaction() 1429 transactionContext.RollbackTransaction()
1331 }() 1430 }()
  1431 +
1332 var taskRepository domain.TaskRepository 1432 var taskRepository domain.TaskRepository
1333 if value, err := factory.CreateTaskRepository(map[string]interface{}{ 1433 if value, err := factory.CreateTaskRepository(map[string]interface{}{
1334 "transactionContext": transactionContext, 1434 "transactionContext": transactionContext,
@@ -1337,6 +1437,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in @@ -1337,6 +1437,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in
1337 } else { 1437 } else {
1338 taskRepository = value 1438 taskRepository = value
1339 } 1439 }
  1440 +
1340 if count, tasks, err := taskRepository.Find(tool_funs.SimpleStructToMap(listTaskQuery)); err != nil { 1441 if count, tasks, err := taskRepository.Find(tool_funs.SimpleStructToMap(listTaskQuery)); err != nil {
1341 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1442 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1342 } else { 1443 } else {
@@ -2,6 +2,7 @@ package domain_service @@ -2,6 +2,7 @@ package domain_service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "github.com/linmadan/egglib-go/core/application"
5 coreDomain "github.com/linmadan/egglib-go/core/domain" 6 coreDomain "github.com/linmadan/egglib-go/core/domain"
6 pgTransaction "github.com/linmadan/egglib-go/transaction/pg" 7 pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
7 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" 8 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
@@ -20,7 +21,6 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 @@ -20,7 +21,6 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
20 var employeeRepository domain.EmployeeRepository 21 var employeeRepository domain.EmployeeRepository
21 var taskRepository domain.TaskRepository 22 var taskRepository domain.TaskRepository
22 var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository 23 var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
23 - //var cashPoolRepository domain.CashPoolRepository  
24 24
25 var employeeDao *dao.EmployeeDao 25 var employeeDao *dao.EmployeeDao
26 if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil { 26 if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil {
@@ -38,11 +38,7 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 @@ -38,11 +38,7 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
38 } else { 38 } else {
39 suMoneyTransactionRecordRepository = repository 39 suMoneyTransactionRecordRepository = repository
40 } 40 }
41 - //if repository, err := repository.NewCashPoolRepository(service.transactionContext); err != nil {  
42 - // return nil, err  
43 - //} else {  
44 - // cashPoolRepository = repository  
45 - //} 41 +
46 if dao, err := dao.NewEmployeeDao(service.transactionContext); err != nil { 42 if dao, err := dao.NewEmployeeDao(service.transactionContext); err != nil {
47 return nil, err 43 return nil, err
48 } else { 44 } else {
@@ -51,12 +47,23 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 @@ -51,12 +47,23 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
51 47
52 operator, err := employeeRepository.FindOne(map[string]interface{}{ 48 operator, err := employeeRepository.FindOne(map[string]interface{}{
53 "uid": operatorUid, 49 "uid": operatorUid,
  50 + "status": 1,
54 }) 51 })
55 if err != nil { 52 if err != nil {
56 return nil, err 53 return nil, err
57 } 54 }
58 if operator == nil { 55 if operator == nil {
59 - return nil, fmt.Errorf("无效的操作者") 56 + // 获取无效的发布人员信息
  57 + operatorInvalid, err := employeeRepository.FindOne(map[string]interface{}{
  58 + "uid": operatorUid,
  59 + })
  60 + if err != nil {
  61 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  62 + }
  63 + if operatorInvalid == nil {
  64 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的操作者")
  65 + }
  66 + return nil, fmt.Errorf("无效的操作者:" + operatorInvalid.EmployeeInfo.EmployeeName)
60 } 67 }
61 task, err := taskRepository.FindOne(map[string]interface{}{ 68 task, err := taskRepository.FindOne(map[string]interface{}{
62 "taskId": taskId, 69 "taskId": taskId,
@@ -73,11 +80,22 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 @@ -73,11 +80,22 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
73 for _, participatorUid := range participators { 80 for _, participatorUid := range participators {
74 if participator, err := employeeRepository.FindOne(map[string]interface{}{ 81 if participator, err := employeeRepository.FindOne(map[string]interface{}{
75 "uid": participatorUid, 82 "uid": participatorUid,
  83 + "status": 1,
76 }); err != nil { 84 }); err != nil {
77 return nil, err 85 return nil, err
78 } else { 86 } else {
79 if participator == nil { 87 if participator == nil {
80 - return nil, fmt.Errorf("无效的参与人") 88 + // 获取无效的发布人员信息
  89 + participatorInvalid, err := employeeRepository.FindOne(map[string]interface{}{
  90 + "uid": participatorUid,
  91 + })
  92 + if err != nil {
  93 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  94 + }
  95 + if participatorInvalid == nil {
  96 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的参与人")
  97 + }
  98 + return nil, fmt.Errorf("无效的参与人:" + participatorInvalid.EmployeeInfo.EmployeeName)
81 } 99 }
82 participatorMap[participator.EmployeeInfo.Uid] = participator 100 participatorMap[participator.EmployeeInfo.Uid] = participator
83 participatorInfos = append(participatorInfos, participator.EmployeeInfo) 101 participatorInfos = append(participatorInfos, participator.EmployeeInfo)
@@ -102,12 +120,23 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 @@ -102,12 +120,23 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
102 if taskPercentageItem.IsReceiver { 120 if taskPercentageItem.IsReceiver {
103 receiver, err := employeeRepository.FindOne(map[string]interface{}{ 121 receiver, err := employeeRepository.FindOne(map[string]interface{}{
104 "uid": taskPercentageItem.Contributor.Uid, 122 "uid": taskPercentageItem.Contributor.Uid,
  123 + "status": 1,
105 }) 124 })
106 if err != nil { 125 if err != nil {
107 return nil, err 126 return nil, err
108 } 127 }
109 if receiver == nil { 128 if receiver == nil {
110 - return nil, fmt.Errorf("无效的任务领取者") 129 + // 获取无效的任务领取人员信息
  130 + receiverInvalid, err := employeeRepository.FindOne(map[string]interface{}{
  131 + "uid": operatorUid,
  132 + })
  133 + if err != nil {
  134 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  135 + }
  136 + if receiverInvalid == nil {
  137 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的任务领取者")
  138 + }
  139 + return nil, fmt.Errorf("无效的任务领取者:" + receiverInvalid.EmployeeInfo.EmployeeName)
111 } 140 }
112 employee = receiver 141 employee = receiver
113 } else { 142 } else {
@@ -133,41 +162,6 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 @@ -133,41 +162,6 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64
133 if err := employeeDao.TransferSuMoney(taskPercentageItem.Contributor.Uid, taskPercentageItem.SuMoney); err != nil { 162 if err := employeeDao.TransferSuMoney(taskPercentageItem.Contributor.Uid, taskPercentageItem.SuMoney); err != nil {
134 return nil, err 163 return nil, err
135 } 164 }
136 -  
137 - //// 更新现金池未兑换素币  
138 - //cashPoolFound, err := cashPoolRepository.FindOne(map[string]interface{}{  
139 - // "companyId": task.CompanyId,  
140 - //})  
141 - //if err != nil {  
142 - // return nil, err  
143 - //}  
144 - //if cashPoolFound != nil {  
145 - // // 获取平台素币兑换情况  
146 - // systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(task.CompanyId)  
147 - // if err != nil {  
148 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
149 - // }  
150 - // if systemSuMoneyStatistics == nil {  
151 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的公司")  
152 - // }  
153 - // systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64)  
154 - // cashPool := &domain.CashPool{  
155 - // Cash: cashPoolFound.Cash,  
156 - // CompanyId: cashPoolFound.CompanyId,  
157 - // ExchangedCash: cashPoolFound.ExchangedCash,  
158 - // UnExchangeCash: cashPoolFound.UnExchangeCash,  
159 - // ExchangedSuMoney: cashPoolFound.ExchangedSuMoney,  
160 - // UnExchangeSuMoney: systemUnExchangeSuMoney,  
161 - // Rate: cashPoolFound.Rate,  
162 - // LastRate: cashPoolFound.LastRate,  
163 - // }  
164 - // if err := cashPoolFound.Update(tool_funs.SimpleStructToMap(cashPool)); err != nil {  
165 - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
166 - // }  
167 - // if _, err := cashPoolRepository.Save(cashPool); err != nil {  
168 - // return nil, err  
169 - // }  
170 - //}  
171 } 165 }
172 if task, err := taskRepository.Save(task); err != nil { 166 if task, err := taskRepository.Save(task); err != nil {
173 return nil, err 167 return nil, err
@@ -31,12 +31,23 @@ func (service *ReleaseTaskService) Release(taskId int64, operatorUid int64) (*do @@ -31,12 +31,23 @@ func (service *ReleaseTaskService) Release(taskId int64, operatorUid int64) (*do
31 } 31 }
32 operator, err := employeeRepository.FindOne(map[string]interface{}{ 32 operator, err := employeeRepository.FindOne(map[string]interface{}{
33 "uid": operatorUid, 33 "uid": operatorUid,
  34 + "status": 1,
34 }) 35 })
35 if err != nil { 36 if err != nil {
36 return nil, err 37 return nil, err
37 } 38 }
38 if operator == nil { 39 if operator == nil {
39 - return nil, fmt.Errorf("无效的发布者") 40 + // 获取无效的发布人员信息
  41 + operatorInvalid, err := employeeRepository.FindOne(map[string]interface{}{
  42 + "uid": operatorUid,
  43 + })
  44 + if err != nil {
  45 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  46 + }
  47 + if operatorInvalid == nil {
  48 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者")
  49 + }
  50 + return nil, fmt.Errorf("无效的发布者:" + operatorInvalid.EmployeeInfo.EmployeeName)
40 } 51 }
41 task, err := taskRepository.FindOne(map[string]interface{}{ 52 task, err := taskRepository.FindOne(map[string]interface{}{
42 "taskId": taskId, 53 "taskId": taskId,