正在显示
4 个修改的文件
包含
37 行增加
和
2 行删除
@@ -686,7 +686,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom | @@ -686,7 +686,7 @@ func (taskService *TaskService) SearchRejectTaskRecord(searchRejectTaskRecordCom | ||
686 | } | 686 | } |
687 | _, tasks, err := taskRepository.Find(map[string]interface{}{ | 687 | _, tasks, err := taskRepository.Find(map[string]interface{}{ |
688 | "companyId": searchRejectTaskRecordCommand.CompanyId, | 688 | "companyId": searchRejectTaskRecordCommand.CompanyId, |
689 | - "taskStatus": domain.TASK_STATUS_CLOSED, | 689 | + "taskStatus": domain.TASK_STATUS_UNCLAIMED, |
690 | "taskContentMatch": searchRejectTaskRecordCommand.TaskContentMatch, | 690 | "taskContentMatch": searchRejectTaskRecordCommand.TaskContentMatch, |
691 | "taskType": searchRejectTaskRecordCommand.TaskType, | 691 | "taskType": searchRejectTaskRecordCommand.TaskType, |
692 | "projectBelongs": searchRejectTaskRecordCommand.ProjectBelongs, | 692 | "projectBelongs": searchRejectTaskRecordCommand.ProjectBelongs, |
@@ -58,6 +58,15 @@ func (dao *TaskDao) AddRobInfo(taskId int64, receiver *domain.EmployeeInfo) erro | @@ -58,6 +58,15 @@ func (dao *TaskDao) AddRobInfo(taskId int64, receiver *domain.EmployeeInfo) erro | ||
58 | return err | 58 | return err |
59 | } | 59 | } |
60 | 60 | ||
61 | +func (dao *TaskDao) DeleteRobInfo(taskId int64) error { | ||
62 | + tx := dao.transactionContext.PgTx | ||
63 | + _, err := tx.QueryOne( | ||
64 | + pg.Scan(), | ||
65 | + "DELETE FROM rob_infos WHERE task_id=?", | ||
66 | + taskId) | ||
67 | + return err | ||
68 | +} | ||
69 | + | ||
61 | func (dao *TaskDao) AddBidInfo(taskId int64, bidStartTime time.Time, bidEndTime time.Time, isRemind bool) error { | 70 | func (dao *TaskDao) AddBidInfo(taskId int64, bidStartTime time.Time, bidEndTime time.Time, isRemind bool) error { |
62 | tx := dao.transactionContext.PgTx | 71 | tx := dao.transactionContext.PgTx |
63 | _, err := tx.QueryOne( | 72 | _, err := tx.QueryOne( |
@@ -94,6 +103,15 @@ func (dao *TaskDao) SetSuccessfulBidder(taskId int64, successfulBidder *domain.E | @@ -94,6 +103,15 @@ func (dao *TaskDao) SetSuccessfulBidder(taskId int64, successfulBidder *domain.E | ||
94 | return err | 103 | return err |
95 | } | 104 | } |
96 | 105 | ||
106 | +func (dao *TaskDao) CancelSuccessfulBidder(taskId int64) error { | ||
107 | + tx := dao.transactionContext.PgTx | ||
108 | + _, err := tx.QueryOne( | ||
109 | + pg.Scan(), | ||
110 | + "UPDATE bid_infos SET successful_bidder=?, win_bid_time=? WHERE task_id=?", | ||
111 | + nil, time.Time{}, taskId) | ||
112 | + return err | ||
113 | +} | ||
114 | + | ||
97 | func (dao *TaskDao) CalculateSystemTask(companyId int64) (map[string]interface{}, error) { | 115 | func (dao *TaskDao) CalculateSystemTask(companyId int64) (map[string]interface{}, error) { |
98 | var released int64 | 116 | var released int64 |
99 | var underway int64 | 117 | var underway int64 |
@@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
6 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 6 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
7 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" |
8 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/event" | 8 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/event" |
9 | + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao" | ||
9 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/repository" | 10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/repository" |
10 | "time" | 11 | "time" |
11 | ) | 12 | ) |
@@ -19,6 +20,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | @@ -19,6 +20,7 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | ||
19 | var employeeRepository domain.EmployeeRepository | 20 | var employeeRepository domain.EmployeeRepository |
20 | var taskRepository domain.TaskRepository | 21 | var taskRepository domain.TaskRepository |
21 | var rejectTaskRecordRepository domain.RejectTaskRecordRepository | 22 | var rejectTaskRecordRepository domain.RejectTaskRecordRepository |
23 | + var taskDao *dao.TaskDao | ||
22 | if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil { | 24 | if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil { |
23 | return nil, err | 25 | return nil, err |
24 | } else { | 26 | } else { |
@@ -34,6 +36,11 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | @@ -34,6 +36,11 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | ||
34 | } else { | 36 | } else { |
35 | rejectTaskRecordRepository = repository | 37 | rejectTaskRecordRepository = repository |
36 | } | 38 | } |
39 | + if dao, err := dao.NewTaskDao(service.transactionContext); err != nil { | ||
40 | + return nil, err | ||
41 | + } else { | ||
42 | + taskDao = dao | ||
43 | + } | ||
37 | operator, err := employeeRepository.FindOne(map[string]interface{}{ | 44 | operator, err := employeeRepository.FindOne(map[string]interface{}{ |
38 | "uid": operatorUid, | 45 | "uid": operatorUid, |
39 | }) | 46 | }) |
@@ -64,6 +71,16 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | @@ -64,6 +71,16 @@ func (service *RejectTaskReceiverService) Reject(taskId int64, operatorUid int64 | ||
64 | RejectReason: rejectReason, | 71 | RejectReason: rejectReason, |
65 | CreateTime: time.Now(), | 72 | CreateTime: time.Now(), |
66 | } | 73 | } |
74 | + if task.TaskType == domain.TASK_TYPE_ROB { | ||
75 | + if err := taskDao.DeleteRobInfo(taskId); err != nil { | ||
76 | + return nil, err | ||
77 | + } | ||
78 | + } | ||
79 | + if task.TaskType == domain.TASK_TYPE_BID { | ||
80 | + if err := taskDao.CancelSuccessfulBidder(taskId); err != nil { | ||
81 | + return nil, err | ||
82 | + } | ||
83 | + } | ||
67 | if rejectTaskRecord, err := rejectTaskRecordRepository.Save(newRejectTaskRecord); err != nil { | 84 | if rejectTaskRecord, err := rejectTaskRecordRepository.Save(newRejectTaskRecord); err != nil { |
68 | return nil, err | 85 | return nil, err |
69 | } else { | 86 | } else { |
@@ -58,7 +58,7 @@ var _ = Describe("搜索驳回任务记录", func() { | @@ -58,7 +58,7 @@ var _ = Describe("搜索驳回任务记录", func() { | ||
58 | "INSERT INTO tasks (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, participators, task_percentage, solve_report, solve_picture_urls, receiver_uid, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", | 58 | "INSERT INTO tasks (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, participators, task_percentage, solve_report, solve_picture_urls, receiver_uid, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", |
59 | 1, 101, "抢单任务1", 1, &domain.EmployeeInfo{ | 59 | 1, 101, "抢单任务1", 1, &domain.EmployeeInfo{ |
60 | Uid: 2499036607974745088, | 60 | Uid: 2499036607974745088, |
61 | - }, 6, "null", projectBelongId, pg.Array([]int{customerValueId1, customerValueId2, customerValueId3}), taskNatureId, 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), true, []*domain.EmployeeInfo{ | 61 | + }, 2, "null", projectBelongId, pg.Array([]int{customerValueId1, customerValueId2, customerValueId3}), taskNatureId, 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), true, []*domain.EmployeeInfo{ |
62 | { | 62 | { |
63 | Uid: 2499036607974745077, | 63 | Uid: 2499036607974745077, |
64 | }, | 64 | }, |
-
请 注册 或 登录 后发表评论