正在显示
5 个修改的文件
包含
30 行增加
和
5 行删除
@@ -68,8 +68,14 @@ type Task struct { | @@ -68,8 +68,14 @@ type Task struct { | ||
68 | SolvePictureUrls []string `json:"solvePictureUrls"` | 68 | SolvePictureUrls []string `json:"solvePictureUrls"` |
69 | // 创建时间 | 69 | // 创建时间 |
70 | CreateTime time.Time `json:"createTime"` | 70 | CreateTime time.Time `json:"createTime"` |
71 | - // 发布时间 | 71 | + // 发布任务时间 |
72 | ReleaseTime time.Time `json:"releaseTime"` | 72 | ReleaseTime time.Time `json:"releaseTime"` |
73 | + // 领取任务时间 | ||
74 | + ReceiveTime time.Time `json:"receiveTime"` | ||
75 | + // 完成任务操作时间 | ||
76 | + CompleteTime time.Time `json:"completeTime"` | ||
77 | + // 验收方验收时间 | ||
78 | + AcceptanceTime time.Time `json:"acceptanceTime"` | ||
73 | //当前状态 | 79 | //当前状态 |
74 | CurrentStatus TaskStatus `json:"-"` | 80 | CurrentStatus TaskStatus `json:"-"` |
75 | } | 81 | } |
@@ -131,7 +131,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (*domain.PersonTaskStatistics | @@ -131,7 +131,7 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (*domain.PersonTaskStatistics | ||
131 | Count(); err != nil { | 131 | Count(); err != nil { |
132 | return nil, err | 132 | return nil, err |
133 | } else { | 133 | } else { |
134 | - personTaskStatistics.UnderwayAsReceiver = int64(count) | 134 | + personTaskStatistics.UnderwayAsSponsor = int64(count) |
135 | } | 135 | } |
136 | if count, err := tx.Model(taskModel). | 136 | if count, err := tx.Model(taskModel). |
137 | Where(`task.sponsor @> '{"uid":?}'`, uid). | 137 | Where(`task.sponsor @> '{"uid":?}'`, uid). |
@@ -50,6 +50,13 @@ type Task struct { | @@ -50,6 +50,13 @@ type Task struct { | ||
50 | // 创建时间 | 50 | // 创建时间 |
51 | CreateTime time.Time | 51 | CreateTime time.Time |
52 | ReceiverUid int64 | 52 | ReceiverUid int64 |
53 | + // 发布任务时间 | ||
53 | ReleaseTime time.Time | 54 | ReleaseTime time.Time |
54 | - RemoveTime time.Time `pg:",soft_delete"` | 55 | + // 领取任务时间 |
56 | + ReceiveTime time.Time | ||
57 | + // 完成任务操作时间 | ||
58 | + CompleteTime time.Time | ||
59 | + // 验收方验收时间 | ||
60 | + AcceptanceTime time.Time | ||
61 | + RemoveTime time.Time `pg:",soft_delete"` | ||
55 | } | 62 | } |
@@ -183,8 +183,16 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int | @@ -183,8 +183,16 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int | ||
183 | } else { | 183 | } else { |
184 | query = query.Limit(20) | 184 | query = query.Limit(20) |
185 | } | 185 | } |
186 | - if sortByReleaseTime, ok := queryOptions["sortByReleaseTime"]; ok && (sortByReleaseTime == "ASC" || sortByReleaseTime == "DESC") { | 186 | + if sortByCreateTime, ok := queryOptions["sortByCreateTime"]; ok && (sortByCreateTime == "ASC" || sortByCreateTime == "DESC") { |
187 | + query = query.Order(fmt.Sprintf("task.create_time %s", sortByCreateTime.(string))) | ||
188 | + } else if sortByReleaseTime, ok := queryOptions["sortByReleaseTime"]; ok && (sortByReleaseTime == "ASC" || sortByReleaseTime == "DESC") { | ||
187 | query = query.Order(fmt.Sprintf("task.release_time %s", sortByReleaseTime.(string))) | 189 | query = query.Order(fmt.Sprintf("task.release_time %s", sortByReleaseTime.(string))) |
190 | + } else if sortByReceiveTime, ok := queryOptions["sortByReceiveTime"]; ok && (sortByReceiveTime == "ASC" || sortByReceiveTime == "DESC") { | ||
191 | + query = query.Order(fmt.Sprintf("task.release_time %s", sortByReleaseTime.(string))) | ||
192 | + } else if sortByCompleteTime, ok := queryOptions["sortByCompleteTime"]; ok && (sortByCompleteTime == "ASC" || sortByCompleteTime == "DESC") { | ||
193 | + query = query.Order(fmt.Sprintf("task.complete_time %s", sortByCompleteTime.(string))) | ||
194 | + } else if sortByAcceptanceTime, ok := queryOptions["sortByAcceptanceTime"]; ok && (sortByAcceptanceTime == "ASC" || sortByAcceptanceTime == "DESC") { | ||
195 | + query = query.Order(fmt.Sprintf("task.acceptance_time %s", sortByAcceptanceTime.(string))) | ||
188 | } else { | 196 | } else { |
189 | query = query.Order("task.id DESC") | 197 | query = query.Order("task.id DESC") |
190 | } | 198 | } |
@@ -276,6 +284,10 @@ func (repository *TaskRepository) transformPgModelToDomainModel(taskModel *model | @@ -276,6 +284,10 @@ func (repository *TaskRepository) transformPgModelToDomainModel(taskModel *model | ||
276 | TaskPictureUrls: taskModel.TaskPictureUrls, | 284 | TaskPictureUrls: taskModel.TaskPictureUrls, |
277 | IsRewardTake: taskModel.IsRewardTake, | 285 | IsRewardTake: taskModel.IsRewardTake, |
278 | CreateTime: taskModel.CreateTime, | 286 | CreateTime: taskModel.CreateTime, |
287 | + ReleaseTime: taskModel.ReleaseTime, | ||
288 | + ReceiveTime: taskModel.ReceiveTime, | ||
289 | + CompleteTime: taskModel.CompleteTime, | ||
290 | + AcceptanceTime: taskModel.AcceptanceTime, | ||
279 | RobInfo: robInfo, | 291 | RobInfo: robInfo, |
280 | BidInfo: bidInfo, | 292 | BidInfo: bidInfo, |
281 | Participators: taskModel.Participators, | 293 | Participators: taskModel.Participators, |
@@ -48,7 +48,7 @@ var _ = Describe("获取个人任务统计", func() { | @@ -48,7 +48,7 @@ var _ = Describe("获取个人任务统计", func() { | ||
48 | "INSERT INTO tasks (id, company_id, task_name, task_type, sponsor, task_status, reference_resource, customer_value, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, participators, task_percentage, solve_report, solve_picture_urls, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", | 48 | "INSERT INTO tasks (id, company_id, task_name, task_type, sponsor, task_status, reference_resource, customer_value, task_nature, su_money, acceptance_standard, task_description, task_picture_urls, is_reward_take, participators, task_percentage, solve_report, solve_picture_urls, create_time, release_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", |
49 | 4, 101, "竞标任务1", 2, &domain.EmployeeInfo{ | 49 | 4, 101, "竞标任务1", 2, &domain.EmployeeInfo{ |
50 | Uid: 2499036607974745099, | 50 | Uid: 2499036607974745099, |
51 | - }, 1, "null", pg.Array([]string{"口感", "便利", "品牌"}), "面", 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), false, "null", "null", "", pg.Array([]string{}), time.Now(), time.Now().Add(dayAfter)) | 51 | + }, 3, "null", pg.Array([]string{"口感", "便利", "品牌"}), "面", 1000.00, "验收标准1", "任务描述1", pg.Array([]string{}), false, "null", "null", "", pg.Array([]string{}), time.Now(), time.Now().Add(dayAfter)) |
52 | Expect(err3).NotTo(HaveOccurred()) | 52 | Expect(err3).NotTo(HaveOccurred()) |
53 | _, err4 := pG.DB.QueryOne( | 53 | _, err4 := pG.DB.QueryOne( |
54 | pg.Scan(), | 54 | pg.Scan(), |
-
请 注册 或 登录 后发表评论