正在显示
5 个修改的文件
包含
60 行增加
和
1 行删除
@@ -13,6 +13,8 @@ type ListEmployeeQuery struct { | @@ -13,6 +13,8 @@ type ListEmployeeQuery struct { | ||
13 | EmployeeNameMatch string `json:"employeeNameMatch,omitempty"` | 13 | EmployeeNameMatch string `json:"employeeNameMatch,omitempty"` |
14 | // 查询偏离量 | 14 | // 查询偏离量 |
15 | Offset int `json:"offset,omitempty"` | 15 | Offset int `json:"offset,omitempty"` |
16 | + // 员工状态(启用或者禁用) | ||
17 | + Status int `json:"status"` | ||
16 | // 查询限制 | 18 | // 查询限制 |
17 | Limit int `json:"limit,omitempty"` | 19 | Limit int `json:"limit,omitempty"` |
18 | } | 20 | } |
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/service" | 10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/service" |
11 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao" | 11 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao" |
12 | + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/utils" | ||
12 | ) | 13 | ) |
13 | 14 | ||
14 | // 素币服务 | 15 | // 素币服务 |
@@ -145,6 +146,37 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon | @@ -145,6 +146,37 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon | ||
145 | if err := transactionContext.CommitTransaction(); err != nil { | 146 | if err := transactionContext.CommitTransaction(); err != nil { |
146 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 147 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
147 | } | 148 | } |
149 | + | ||
150 | + for _, suMoneyTransactionRecord := range suMoneyTransactionRecords { | ||
151 | + contributions := []int{2,3,4} | ||
152 | + suMoney := []int{1,2,3,4,5} | ||
153 | + // 查询贡献值时规范描述 | ||
154 | + if utils.StringSliceEqualBCE(searchSuMoneyTransactionRecordCommand.RecordTypes, contributions) { | ||
155 | + switch suMoneyTransactionRecord.RecordType { | ||
156 | + case 2: // 任务奖励 | ||
157 | + suMoneyTransactionRecord.RecordDescription = suMoneyTransactionRecord.RecordDescription + "奖励" | ||
158 | + case 3: // 增加 | ||
159 | + suMoneyTransactionRecord.RecordDescription = "增加贡献" | ||
160 | + case 4: // 扣除 | ||
161 | + suMoneyTransactionRecord.RecordDescription = "扣除贡献" | ||
162 | + } | ||
163 | + } | ||
164 | + // 查询素币值时规范描述 | ||
165 | + if utils.StringSliceEqualBCE(searchSuMoneyTransactionRecordCommand.RecordTypes, suMoney) { | ||
166 | + switch suMoneyTransactionRecord.RecordType { | ||
167 | + case 1: // 兑换物资 | ||
168 | + suMoneyTransactionRecord.RecordDescription = "兑换物资" | ||
169 | + case 2: // 任务奖励 | ||
170 | + suMoneyTransactionRecord.RecordDescription = suMoneyTransactionRecord.RecordDescription + "奖励" | ||
171 | + case 3: // 增加 | ||
172 | + suMoneyTransactionRecord.RecordDescription = "增加素币" | ||
173 | + case 4: // 扣除 | ||
174 | + suMoneyTransactionRecord.RecordDescription = "扣除素币" | ||
175 | + case 5: // 兑换现金 | ||
176 | + suMoneyTransactionRecord.RecordDescription = "素币兑换现金" | ||
177 | + } | ||
178 | + } | ||
179 | + } | ||
148 | return map[string]interface{}{ | 180 | return map[string]interface{}{ |
149 | "count": count, | 181 | "count": count, |
150 | "suMoneyTransactionRecords": suMoneyTransactionRecords, | 182 | "suMoneyTransactionRecords": suMoneyTransactionRecords, |
@@ -39,7 +39,7 @@ func (dao *TaskDao) UpdateExpiredPlannedCompletionTimeBidTask() error { | @@ -39,7 +39,7 @@ func (dao *TaskDao) UpdateExpiredPlannedCompletionTimeBidTask() error { | ||
39 | tx := dao.transactionContext.PgTx | 39 | tx := dao.transactionContext.PgTx |
40 | _, err := tx.Query( | 40 | _, err := tx.Query( |
41 | pg.Scan(), | 41 | pg.Scan(), |
42 | - "UPDATE tasks SET task_status = ? FROM bid_infos WHERE bid_infos.bid_end_time < ? AND tasks.task_type = ? AND tasks.task_status = ?", | 42 | + "UPDATE tasks SET task_status = ? FROM bid_infos WHERE tasks.id = bid_infos.task_id AND bid_infos.bid_end_time < ? AND tasks.task_type = ? AND tasks.task_status = ?", |
43 | domain.TASK_STATUS_EXPIRED, currentDay, domain.TASK_TYPE_BID, domain.TASK_STATUS_UNCLAIMED) | 43 | domain.TASK_STATUS_EXPIRED, currentDay, domain.TASK_TYPE_BID, domain.TASK_STATUS_UNCLAIMED) |
44 | return err | 44 | return err |
45 | } | 45 | } |
@@ -73,6 +73,10 @@ func (service *OperationSuMoneyService) Operation(uid int64, operatorUid int64, | @@ -73,6 +73,10 @@ func (service *OperationSuMoneyService) Operation(uid int64, operatorUid int64, | ||
73 | recordType = domain.SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE_CASH | 73 | recordType = domain.SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE_CASH |
74 | transferSuMoney = 0 - suMoney | 74 | transferSuMoney = 0 - suMoney |
75 | } | 75 | } |
76 | + if operationType == 5 { // 任务奖励 | ||
77 | + recordType = domain.SU_MONEY_TRANSACTION_RECORD_TYPE_AWARD | ||
78 | + transferSuMoney = suMoney | ||
79 | + } | ||
76 | suMoneyTransactionRecord := &domain.SuMoneyTransactionRecord{ | 80 | suMoneyTransactionRecord := &domain.SuMoneyTransactionRecord{ |
77 | RecordType: recordType, | 81 | RecordType: recordType, |
78 | Employee: employee.EmployeeInfo, | 82 | Employee: employee.EmployeeInfo, |
pkg/infrastructure/utils/utils.go
0 → 100644
1 | +package utils | ||
2 | + | ||
3 | + | ||
4 | +func StringSliceEqualBCE(a, b []int) bool { | ||
5 | + if len(a) != len(b) { | ||
6 | + return false | ||
7 | + } | ||
8 | + | ||
9 | + if (a == nil) != (b == nil) { | ||
10 | + return false | ||
11 | + } | ||
12 | + | ||
13 | + b = b[:len(a)] | ||
14 | + for i, v := range a { | ||
15 | + if v != b[i] { | ||
16 | + return false | ||
17 | + } | ||
18 | + } | ||
19 | + | ||
20 | + return true | ||
21 | +} |
-
请 注册 或 登录 后发表评论