正在显示
3 个修改的文件
包含
30 行增加
和
1 行删除
| @@ -538,6 +538,14 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | @@ -538,6 +538,14 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | ||
| 538 | } else { | 538 | } else { |
| 539 | taskRepository = value | 539 | taskRepository = value |
| 540 | } | 540 | } |
| 541 | + var taskDao *dao.TaskDao | ||
| 542 | + if value, err := factory.CreateTaskDao(map[string]interface{}{ | ||
| 543 | + "transactionContext": transactionContext, | ||
| 544 | + }); err != nil { | ||
| 545 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 546 | + } else { | ||
| 547 | + taskDao = value | ||
| 548 | + } | ||
| 541 | task, err := taskRepository.FindOne(map[string]interface{}{"taskId": updateTaskCommand.TaskId}) | 549 | task, err := taskRepository.FindOne(map[string]interface{}{"taskId": updateTaskCommand.TaskId}) |
| 542 | if err != nil { | 550 | if err != nil { |
| 543 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 551 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| @@ -551,6 +559,11 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | @@ -551,6 +559,11 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | ||
| 551 | if task, err := taskRepository.Save(task); err != nil { | 559 | if task, err := taskRepository.Save(task); err != nil { |
| 552 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 560 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 553 | } else { | 561 | } else { |
| 562 | + if task.TaskType == domain.TASK_TYPE_BID { | ||
| 563 | + if err := taskDao.UpdateBidInfo(updateTaskCommand.TaskId, updateTaskCommand.BidStartTime, updateTaskCommand.BidEndTime); err != nil { | ||
| 564 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 565 | + } | ||
| 566 | + } | ||
| 554 | if err := transactionContext.CommitTransaction(); err != nil { | 567 | if err := transactionContext.CommitTransaction(); err != nil { |
| 555 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 568 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 556 | } | 569 | } |
| @@ -32,6 +32,15 @@ func (dao *TaskDao) AddBidInfo(taskId int64, bidStartTime time.Time, bidEndTime | @@ -32,6 +32,15 @@ func (dao *TaskDao) AddBidInfo(taskId int64, bidStartTime time.Time, bidEndTime | ||
| 32 | return err | 32 | return err |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | +func (dao *TaskDao) UpdateBidInfo(taskId int64, bidStartTime time.Time, bidEndTime time.Time) error { | ||
| 36 | + tx := dao.transactionContext.PgTx | ||
| 37 | + _, err := tx.QueryOne( | ||
| 38 | + pg.Scan(), | ||
| 39 | + "UPDATE bid_infos SET bid_start_time=?, bid_end_time=? WHERE task_id=?", | ||
| 40 | + bidStartTime, bidEndTime, taskId) | ||
| 41 | + return err | ||
| 42 | +} | ||
| 43 | + | ||
| 35 | func (dao *TaskDao) AddBidderInfo(taskId int64, bidder *domain.EmployeeInfo) error { | 44 | func (dao *TaskDao) AddBidderInfo(taskId int64, bidder *domain.EmployeeInfo) error { |
| 36 | tx := dao.transactionContext.PgTx | 45 | tx := dao.transactionContext.PgTx |
| 37 | _, err := tx.QueryOne( | 46 | _, err := tx.QueryOne( |
| @@ -76,12 +76,19 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 | @@ -76,12 +76,19 @@ func (service *AcceptanceTaskService) Acceptance(taskId int64, operatorUid int64 | ||
| 76 | return nil, err | 76 | return nil, err |
| 77 | } | 77 | } |
| 78 | for _, taskPercentageItem := range taskPercentage { | 78 | for _, taskPercentageItem := range taskPercentage { |
| 79 | + var taskTypeName string | ||
| 80 | + if task.TaskType == domain.TASK_TYPE_BID { | ||
| 81 | + taskTypeName = "竞标任务" | ||
| 82 | + } | ||
| 83 | + if task.TaskType == domain.TASK_TYPE_ROB { | ||
| 84 | + taskTypeName = "抢单任务" | ||
| 85 | + } | ||
| 79 | suMoneyTransactionRecord := &domain.SuMoneyTransactionRecord{ | 86 | suMoneyTransactionRecord := &domain.SuMoneyTransactionRecord{ |
| 80 | RecordType: domain.SU_MONEY_TRANSACTION_RECORD_TYPE_AWARD, | 87 | RecordType: domain.SU_MONEY_TRANSACTION_RECORD_TYPE_AWARD, |
| 81 | Employee: taskPercentageItem.Contributor, | 88 | Employee: taskPercentageItem.Contributor, |
| 82 | SuMoney: taskPercentageItem.SuMoney, | 89 | SuMoney: taskPercentageItem.SuMoney, |
| 83 | Operator: operator.EmployeeInfo, | 90 | Operator: operator.EmployeeInfo, |
| 84 | - RecordDescription: fmt.Sprintf("完成[%s]任务奖励", task.TaskName), | 91 | + RecordDescription: fmt.Sprintf("%s-%s", taskTypeName, task.TaskName), |
| 85 | CreateTime: time.Now(), | 92 | CreateTime: time.Now(), |
| 86 | } | 93 | } |
| 87 | if _, err := suMoneyTransactionRecordRepository.Save(suMoneyTransactionRecord); err != nil { | 94 | if _, err := suMoneyTransactionRecordRepository.Save(suMoneyTransactionRecord); err != nil { |
-
请 注册 或 登录 后发表评论