正在显示
5 个修改的文件
包含
64 行增加
和
15 行删除
@@ -28,6 +28,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | @@ -28,6 +28,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | ||
28 | defer func() { | 28 | defer func() { |
29 | transactionContext.RollbackTransaction() | 29 | transactionContext.RollbackTransaction() |
30 | }() | 30 | }() |
31 | + | ||
31 | var notificationRepository domain.NotificationRepository | 32 | var notificationRepository domain.NotificationRepository |
32 | if value, err := factory.CreateNotificationRepository(map[string]interface{}{ | 33 | if value, err := factory.CreateNotificationRepository(map[string]interface{}{ |
33 | "transactionContext": transactionContext, | 34 | "transactionContext": transactionContext, |
@@ -36,6 +37,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | @@ -36,6 +37,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | ||
36 | } else { | 37 | } else { |
37 | notificationRepository = value | 38 | notificationRepository = value |
38 | } | 39 | } |
40 | + | ||
39 | var sentNotificationRepository domain.SentNotificationRepository | 41 | var sentNotificationRepository domain.SentNotificationRepository |
40 | if value, err := factory.CreateSentNotificationRepository(map[string]interface{}{ | 42 | if value, err := factory.CreateSentNotificationRepository(map[string]interface{}{ |
41 | "transactionContext": transactionContext, | 43 | "transactionContext": transactionContext, |
@@ -44,6 +46,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | @@ -44,6 +46,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | ||
44 | } else { | 46 | } else { |
45 | sentNotificationRepository = value | 47 | sentNotificationRepository = value |
46 | } | 48 | } |
49 | + | ||
47 | var taskDao *dao.TaskDao | 50 | var taskDao *dao.TaskDao |
48 | if value, err := factory.CreateTaskDao(map[string]interface{}{ | 51 | if value, err := factory.CreateTaskDao(map[string]interface{}{ |
49 | "transactionContext": transactionContext, | 52 | "transactionContext": transactionContext, |
@@ -52,6 +55,13 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | @@ -52,6 +55,13 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | ||
52 | } else { | 55 | } else { |
53 | taskDao = value | 56 | taskDao = value |
54 | } | 57 | } |
58 | + | ||
59 | + // 更新已过期竞标任务状态 | ||
60 | + if err := taskDao.UpdateExpiredPlannedCompletionTimeBidTask(); err != nil { | ||
61 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
62 | + } | ||
63 | + | ||
64 | + // 返回快过期任务并发送消息 | ||
55 | if tasks, err := taskDao.ListNearThePlannedCompletionTimeTask(); err != nil { | 65 | if tasks, err := taskDao.ListNearThePlannedCompletionTimeTask(); err != nil { |
56 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 66 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
57 | } else { | 67 | } else { |
@@ -88,6 +98,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | @@ -88,6 +98,7 @@ func (notificationService *NotificationService) SystemNotificationNearThePlanned | ||
88 | } | 98 | } |
89 | } | 99 | } |
90 | } | 100 | } |
101 | + | ||
91 | if err := transactionContext.CommitTransaction(); err != nil { | 102 | if err := transactionContext.CommitTransaction(); err != nil { |
92 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 103 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
93 | } else { | 104 | } else { |
@@ -108,6 +119,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | @@ -108,6 +119,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | ||
108 | defer func() { | 119 | defer func() { |
109 | transactionContext.RollbackTransaction() | 120 | transactionContext.RollbackTransaction() |
110 | }() | 121 | }() |
122 | + | ||
111 | var notificationRepository domain.NotificationRepository | 123 | var notificationRepository domain.NotificationRepository |
112 | if value, err := factory.CreateNotificationRepository(map[string]interface{}{ | 124 | if value, err := factory.CreateNotificationRepository(map[string]interface{}{ |
113 | "transactionContext": transactionContext, | 125 | "transactionContext": transactionContext, |
@@ -116,6 +128,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | @@ -116,6 +128,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | ||
116 | } else { | 128 | } else { |
117 | notificationRepository = value | 129 | notificationRepository = value |
118 | } | 130 | } |
131 | + | ||
119 | var sentNotificationRepository domain.SentNotificationRepository | 132 | var sentNotificationRepository domain.SentNotificationRepository |
120 | if value, err := factory.CreateSentNotificationRepository(map[string]interface{}{ | 133 | if value, err := factory.CreateSentNotificationRepository(map[string]interface{}{ |
121 | "transactionContext": transactionContext, | 134 | "transactionContext": transactionContext, |
@@ -124,6 +137,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | @@ -124,6 +137,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | ||
124 | } else { | 137 | } else { |
125 | sentNotificationRepository = value | 138 | sentNotificationRepository = value |
126 | } | 139 | } |
140 | + | ||
127 | var taskDao *dao.TaskDao | 141 | var taskDao *dao.TaskDao |
128 | if value, err := factory.CreateTaskDao(map[string]interface{}{ | 142 | if value, err := factory.CreateTaskDao(map[string]interface{}{ |
129 | "transactionContext": transactionContext, | 143 | "transactionContext": transactionContext, |
@@ -132,6 +146,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | @@ -132,6 +146,7 @@ func (notificationService *NotificationService) SystemNotificationNearBidEndTime | ||
132 | } else { | 146 | } else { |
133 | taskDao = value | 147 | taskDao = value |
134 | } | 148 | } |
149 | + | ||
135 | if tasks, err := taskDao.ListNearBidEndTimeTask(); err != nil { | 150 | if tasks, err := taskDao.ListNearBidEndTimeTask(); err != nil { |
136 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 151 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
137 | } else { | 152 | } else { |
@@ -349,13 +349,14 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -349,13 +349,14 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
349 | } | 349 | } |
350 | tx := dao.transactionContext.PgTx | 350 | tx := dao.transactionContext.PgTx |
351 | suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) | 351 | suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) |
352 | + | ||
352 | // 财富值榜单 | 353 | // 财富值榜单 |
353 | queryWealth := tx.Model(suMoneyTransactionRecordModel) | 354 | queryWealth := tx.Model(suMoneyTransactionRecordModel) |
354 | queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint") | 355 | queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint") |
355 | queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid") | 356 | queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid") |
356 | queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") | 357 | queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") |
357 | queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money") | 358 | queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money") |
358 | - queryWealth = queryWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking") | 359 | + queryWealth = queryWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking") |
359 | queryWealth = queryWealth.Where(`e.status = ?`, 1) | 360 | queryWealth = queryWealth.Where(`e.status = ?`, 1) |
360 | queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})) | 361 | queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})) |
361 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 362 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
@@ -368,6 +369,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -368,6 +369,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
368 | queryWealth = queryWealth.Where(`su_money_transaction_record.create_time < ?`, endTime) | 369 | queryWealth = queryWealth.Where(`su_money_transaction_record.create_time < ?`, endTime) |
369 | } | 370 | } |
370 | queryWealth = queryWealth.Group("su_money_transaction_record.employee") | 371 | queryWealth = queryWealth.Group("su_money_transaction_record.employee") |
372 | + queryWealth = queryWealth.Group("su_money_transaction_record.create_time") | ||
371 | if offset, ok := queryOptions["offset"]; ok { | 373 | if offset, ok := queryOptions["offset"]; ok { |
372 | offset := offset.(int) | 374 | offset := offset.(int) |
373 | if offset > -1 { | 375 | if offset > -1 { |
@@ -394,7 +396,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -394,7 +396,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
394 | queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid") | 396 | queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid") |
395 | queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") | 397 | queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") |
396 | queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money") | 398 | queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money") |
397 | - queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking") | 399 | + queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking") |
398 | queryEmployeeWealth = queryEmployeeWealth.Where(`e.status = ?`, 1) | 400 | queryEmployeeWealth = queryEmployeeWealth.Where(`e.status = ?`, 1) |
399 | queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})) | 401 | queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})) |
400 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 402 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
@@ -406,10 +408,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -406,10 +408,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
406 | if endTime, ok := queryOptions["endTime"]; ok { | 408 | if endTime, ok := queryOptions["endTime"]; ok { |
407 | queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.create_time < ?`, endTime) | 409 | queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.create_time < ?`, endTime) |
408 | } | 410 | } |
411 | + queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee") | ||
412 | + queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.create_time") | ||
409 | if uid, ok := queryOptions["uid"]; ok { | 413 | if uid, ok := queryOptions["uid"]; ok { |
410 | queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid) | 414 | queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid) |
411 | } | 415 | } |
412 | - queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee") | ||
413 | if err := queryEmployeeWealth.Order("employee_su_money DESC").Select(&retEmployeeWealth); err != nil { | 416 | if err := queryEmployeeWealth.Order("employee_su_money DESC").Select(&retEmployeeWealth); err != nil { |
414 | return nil, err | 417 | return nil, err |
415 | } | 418 | } |
@@ -426,7 +429,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -426,7 +429,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
426 | queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid") | 429 | queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid") |
427 | queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") | 430 | queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") |
428 | queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease") | 431 | queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease") |
429 | - queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking") | 432 | + queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking") |
430 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 433 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
431 | queryContributionsDecrease = queryContributionsDecrease.Where("e.company_id = ?", companyId) | 434 | queryContributionsDecrease = queryContributionsDecrease.Where("e.company_id = ?", companyId) |
432 | } | 435 | } |
@@ -438,7 +441,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -438,7 +441,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
438 | if endTime, ok := queryOptions["endTime"]; ok { | 441 | if endTime, ok := queryOptions["endTime"]; ok { |
439 | queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime) | 442 | queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime) |
440 | } | 443 | } |
441 | - contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee") | 444 | + contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee").Group("su_money_transaction_record.create_time") |
442 | 445 | ||
443 | queryContributions := tx.Model() | 446 | queryContributions := tx.Model() |
444 | queryContributions = queryContributions.With("t", contributionsDecrease) | 447 | queryContributions = queryContributions.With("t", contributionsDecrease) |
@@ -448,7 +451,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -448,7 +451,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
448 | queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid") | 451 | queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid") |
449 | queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name") | 452 | queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name") |
450 | queryContributions = queryContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`) | 453 | queryContributions = queryContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`) |
451 | - queryContributions = queryContributions.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking") | 454 | + queryContributions = queryContributions.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC,su_money_transaction_records.create_time) AS ranking") |
452 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 455 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
453 | queryContributions = queryContributions.Where("e.company_id = ?", companyId) | 456 | queryContributions = queryContributions.Where("e.company_id = ?", companyId) |
454 | } | 457 | } |
@@ -462,6 +465,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -462,6 +465,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
462 | } | 465 | } |
463 | queryContributions = queryContributions.Group("su_money_transaction_records.employee") | 466 | queryContributions = queryContributions.Group("su_money_transaction_records.employee") |
464 | queryContributions = queryContributions.Group("t.employee_contributions_decrease") | 467 | queryContributions = queryContributions.Group("t.employee_contributions_decrease") |
468 | + queryContributions = queryContributions.Group("su_money_transaction_records.create_time") | ||
465 | if offset, ok := queryOptions["offset"]; ok { | 469 | if offset, ok := queryOptions["offset"]; ok { |
466 | offset := offset.(int) | 470 | offset := offset.(int) |
467 | if offset > -1 { | 471 | if offset > -1 { |
@@ -14,6 +14,7 @@ type TaskDao struct { | @@ -14,6 +14,7 @@ type TaskDao struct { | ||
14 | transactionContext *pgTransaction.TransactionContext | 14 | transactionContext *pgTransaction.TransactionContext |
15 | } | 15 | } |
16 | 16 | ||
17 | +// 返回接近截止时间任务 | ||
17 | func (dao *TaskDao) ListNearThePlannedCompletionTimeTask() ([]*models.Task, error) { | 18 | func (dao *TaskDao) ListNearThePlannedCompletionTimeTask() ([]*models.Task, error) { |
18 | tx := dao.transactionContext.PgTx | 19 | tx := dao.transactionContext.PgTx |
19 | var taskModels []*models.Task | 20 | var taskModels []*models.Task |
@@ -31,6 +32,23 @@ func (dao *TaskDao) ListNearThePlannedCompletionTimeTask() ([]*models.Task, erro | @@ -31,6 +32,23 @@ func (dao *TaskDao) ListNearThePlannedCompletionTimeTask() ([]*models.Task, erro | ||
31 | } | 32 | } |
32 | } | 33 | } |
33 | 34 | ||
35 | +// 更新已过期的竞标任务的状态 | ||
36 | +func (dao *TaskDao) UpdateExpiredPlannedCompletionTimeBidTask() error { | ||
37 | + tx := dao.transactionContext.PgTx | ||
38 | + var taskModels []*models.Task | ||
39 | + currentTime := time.Now() | ||
40 | + currentDay := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, time.Now().Location()) | ||
41 | + query := tx.Model(&taskModels).Relation("RobInfo").Relation("BidInfo"). | ||
42 | + Set("task.task_type = ", domain.TASK_STATUS_EXPIRED). | ||
43 | + Where("task.planned_completion_time > ?", currentDay). | ||
44 | + Where(`task.task_type =?`, domain.TASK_TYPE_BID) | ||
45 | + if _, err := query.Update(); err != nil { | ||
46 | + return err | ||
47 | + } | ||
48 | + return nil | ||
49 | +} | ||
50 | + | ||
51 | +// 返回接近竞标截止时间的竞标任务 | ||
34 | func (dao *TaskDao) ListNearBidEndTimeTask() ([]*models.Task, error) { | 52 | func (dao *TaskDao) ListNearBidEndTimeTask() ([]*models.Task, error) { |
35 | tx := dao.transactionContext.PgTx | 53 | tx := dao.transactionContext.PgTx |
36 | var taskModels []*models.Task | 54 | var taskModels []*models.Task |
@@ -146,6 +164,9 @@ func (dao *TaskDao) CalculateSystemTask(companyId int64) (map[string]interface{} | @@ -146,6 +164,9 @@ func (dao *TaskDao) CalculateSystemTask(companyId int64) (map[string]interface{} | ||
146 | } | 164 | } |
147 | if count, err := tx.Model(taskModel). | 165 | if count, err := tx.Model(taskModel). |
148 | Where("task.company_id = ?", companyId). | 166 | Where("task.company_id = ?", companyId). |
167 | + Where("task.task_status <> ? ", domain.TASK_STATUS_CLOSED). | ||
168 | + Where("task.task_status <> ?", domain.TASK_STATUS_UNRELEASED). | ||
169 | + Where("task.task_status = ?", domain.TASK_STATUS_UNCLAIMED). | ||
149 | Where("task.is_reward_take = ?", true). | 170 | Where("task.is_reward_take = ?", true). |
150 | Count(); err != nil { | 171 | Count(); err != nil { |
151 | return nil, err | 172 | return nil, err |
@@ -300,14 +321,22 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro | @@ -300,14 +321,22 @@ func (dao *TaskDao) CalculatePersonTask(uid int64) (map[string]interface{}, erro | ||
300 | completedAsParticipator = int64(count) | 321 | completedAsParticipator = int64(count) |
301 | } | 322 | } |
302 | // 已过期任务统计(竞标时间过期的竞标任务,状态为待领取) | 323 | // 已过期任务统计(竞标时间过期的竞标任务,状态为待领取) |
303 | - currentTime := time.Now() | ||
304 | - currentDay := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 0, 0, 0, 0, time.Now().Location()) | ||
305 | - if count, err := tx.Model(taskModel).Relation("RobInfo").Relation("BidInfo"). | 324 | + //currentTime := time.Now() |
325 | + //currentDay := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 0, 0, 0, 0, time.Now().Location()) | ||
326 | + //if count, err := tx.Model(taskModel).Relation("RobInfo").Relation("BidInfo"). | ||
327 | + // Where(`task.sponsor @> '{"uid":?}'`, uid). | ||
328 | + // Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED). | ||
329 | + // Where(`task.task_type = ?`, domain.TASK_TYPE_BID). | ||
330 | + // Where("bid_info.bid_end_time >= ?", currentDay). | ||
331 | + // Where("bid_info.bid_end_time < ?", currentDay). | ||
332 | + // Count(); err != nil { | ||
333 | + // return nil, err | ||
334 | + //} else { | ||
335 | + // expiredAsSponsor = int64(count) | ||
336 | + //} | ||
337 | + if count, err := tx.Model(taskModel). | ||
306 | Where(`task.sponsor @> '{"uid":?}'`, uid). | 338 | Where(`task.sponsor @> '{"uid":?}'`, uid). |
307 | - Where("task.task_status = ? ", domain.TASK_STATUS_UNCLAIMED). | ||
308 | - Where(`task.task_type = ?`, domain.TASK_TYPE_BID). | ||
309 | - Where("bid_info.bid_end_time >= ?", currentDay). | ||
310 | - Where("bid_info.bid_end_time < ?", currentDay). | 339 | + Where("task.task_status = ? ", domain.TASK_STATUS_EXPIRED). |
311 | Count(); err != nil { | 340 | Count(); err != nil { |
312 | return nil, err | 341 | return nil, err |
313 | } else { | 342 | } else { |
@@ -531,7 +531,7 @@ func (controller *SuMoneyController) ExportSuMoney() { | @@ -531,7 +531,7 @@ func (controller *SuMoneyController) ExportSuMoney() { | ||
531 | p := map[string]interface{} { | 531 | p := map[string]interface{} { |
532 | "name": record.Employee.EmployeeName, | 532 | "name": record.Employee.EmployeeName, |
533 | "account": record.Employee.EmployeeAccount, | 533 | "account": record.Employee.EmployeeAccount, |
534 | - "current_su_money": record.SuMoney, | 534 | + "current_su_money": record.CurrentSuMoney, |
535 | } | 535 | } |
536 | data = append(data, p) | 536 | data = append(data, p) |
537 | } | 537 | } |
@@ -595,7 +595,7 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() { | @@ -595,7 +595,7 @@ func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() { | ||
595 | for _, record := range records { | 595 | for _, record := range records { |
596 | p := map[string]interface{} { | 596 | p := map[string]interface{} { |
597 | "name": record.Employee.EmployeeName, | 597 | "name": record.Employee.EmployeeName, |
598 | - "current_su_money": record.SuMoney, | 598 | + "current_su_money": record.CurrentSuMoney, |
599 | "record": record.SuMoney, | 599 | "record": record.SuMoney, |
600 | "create_time": record.CreateTime, | 600 | "create_time": record.CreateTime, |
601 | "operator": record.Operator, | 601 | "operator": record.Operator, |
-
请 注册 或 登录 后发表评论