正在显示
5 个修改的文件
包含
43 行增加
和
15 行删除
@@ -17,11 +17,11 @@ import ( | @@ -17,11 +17,11 @@ import ( | ||
17 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao" | 17 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao" |
18 | ) | 18 | ) |
19 | 19 | ||
20 | -// 任务服务 | 20 | +// TaskService 任务服务 |
21 | type TaskService struct { | 21 | type TaskService struct { |
22 | } | 22 | } |
23 | 23 | ||
24 | -// 对抢单任务进行确认 | 24 | +// ConfirmRobTask 对抢单任务进行确认 |
25 | func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.ConfirmRobTaskCommand) (interface{}, error) { | 25 | func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.ConfirmRobTaskCommand) (interface{}, error) { |
26 | if err := confirmRobTaskCommand.ValidateCommand(); err != nil { | 26 | if err := confirmRobTaskCommand.ValidateCommand(); err != nil { |
27 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 27 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -935,7 +935,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask | @@ -935,7 +935,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask | ||
935 | if sponsorInvalid == nil { | 935 | if sponsorInvalid == nil { |
936 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者") | 936 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者") |
937 | } | 937 | } |
938 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者:"+ sponsorInvalid.EmployeeInfo.EmployeeName) | 938 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者:"+sponsorInvalid.EmployeeInfo.EmployeeName) |
939 | } | 939 | } |
940 | 940 | ||
941 | // 获取任务指派人 | 941 | // 获取任务指派人 |
@@ -959,7 +959,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask | @@ -959,7 +959,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask | ||
959 | if employeeInvalid == nil { | 959 | if employeeInvalid == nil { |
960 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员") | 960 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员") |
961 | } | 961 | } |
962 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:" + employeeInvalid.EmployeeInfo.EmployeeName) | 962 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:"+employeeInvalid.EmployeeInfo.EmployeeName) |
963 | } | 963 | } |
964 | assignedPerson = employee.EmployeeInfo | 964 | assignedPerson = employee.EmployeeInfo |
965 | } | 965 | } |
@@ -1308,7 +1308,7 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | @@ -1308,7 +1308,7 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | ||
1308 | if employeeInvalid == nil { | 1308 | if employeeInvalid == nil { |
1309 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员") | 1309 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员") |
1310 | } | 1310 | } |
1311 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:" + employeeInvalid.EmployeeInfo.EmployeeName) | 1311 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:"+employeeInvalid.EmployeeInfo.EmployeeName) |
1312 | } | 1312 | } |
1313 | updateData["assignedPerson"] = employee.EmployeeInfo | 1313 | updateData["assignedPerson"] = employee.EmployeeInfo |
1314 | } else { | 1314 | } else { |
@@ -49,6 +49,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | @@ -49,6 +49,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | ||
49 | var uid int64 | 49 | var uid int64 |
50 | var employeeName string | 50 | var employeeName string |
51 | var employeeAccount string | 51 | var employeeAccount string |
52 | + var oldPhone string | ||
53 | + var newPhone string | ||
52 | var employeeAvatarUrl string | 54 | var employeeAvatarUrl string |
53 | var isPrincipal bool | 55 | var isPrincipal bool |
54 | var status int | 56 | var status int |
@@ -74,6 +76,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | @@ -74,6 +76,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | ||
74 | if value, ok := data["avatar"]; ok { | 76 | if value, ok := data["avatar"]; ok { |
75 | employeeAvatarUrl = value.(string) | 77 | employeeAvatarUrl = value.(string) |
76 | } | 78 | } |
79 | + if value, ok := data["oldPhone"]; ok { | ||
80 | + oldPhone = value.(string) | ||
81 | + } | ||
82 | + if value, ok := data["newPhone"]; ok { | ||
83 | + newPhone = value.(string) | ||
84 | + } | ||
77 | if value, ok := data["admin_type"]; ok { | 85 | if value, ok := data["admin_type"]; ok { |
78 | if int(value.(float64)) == 2 { | 86 | if int(value.(float64)) == 2 { |
79 | isPrincipal = true | 87 | isPrincipal = true |
@@ -234,7 +242,6 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | @@ -234,7 +242,6 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | ||
234 | if _, err := employeeRepository.Save(employee); err != nil { | 242 | if _, err := employeeRepository.Save(employee); err != nil { |
235 | return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 243 | return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
236 | } | 244 | } |
237 | - //TODO 业务数据修改 | ||
238 | break | 245 | break |
239 | case "batchDelete": | 246 | case "batchDelete": |
240 | err := employeeDao.BatchRemove(uids) | 247 | err := employeeDao.BatchRemove(uids) |
@@ -248,6 +255,15 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | @@ -248,6 +255,15 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s | ||
248 | return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 255 | return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
249 | } | 256 | } |
250 | break | 257 | break |
258 | + case "changePhone": // TODO 修改手机号 | ||
259 | + // 修改用户数据 | ||
260 | + err := employeeDao.ChangePhone(oldPhone, newPhone) | ||
261 | + if err != nil { | ||
262 | + return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
263 | + } | ||
264 | + //TODO 修改业务数据 | ||
265 | + | ||
266 | + break | ||
251 | default: | 267 | default: |
252 | return false, nil | 268 | return false, nil |
253 | } | 269 | } |
@@ -10,7 +10,7 @@ type BidInfosDao struct { | @@ -10,7 +10,7 @@ type BidInfosDao struct { | ||
10 | } | 10 | } |
11 | 11 | ||
12 | //TODO ChangeBidInfosSuccessfulBidderAccount | 12 | //TODO ChangeBidInfosSuccessfulBidderAccount |
13 | -func (dao *BidInfosDao) ChangeBidInfosSuccessfulBidderAccount() { | 13 | +func (dao *BidInfosDao) ChangeBidInfosSuccessfulBidderAccount(uid int64, newAccount string) { |
14 | 14 | ||
15 | } | 15 | } |
16 | 16 |
@@ -57,6 +57,18 @@ func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string) | @@ -57,6 +57,18 @@ func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string) | ||
57 | return nil | 57 | return nil |
58 | } | 58 | } |
59 | 59 | ||
60 | +// ChangePhone TODO 修改用户手机号 | ||
61 | +func (dao *EmployeeDao) ChangePhone(oldPhone string, newPhone string) error { | ||
62 | + tx := dao.transactionContext.PgTx | ||
63 | + if _, err := tx.QueryOne( | ||
64 | + pg.Scan(), | ||
65 | + "UPDATE employees SET employee_account=? WHERE employee_account=?", | ||
66 | + oldPhone, newPhone); err != nil { | ||
67 | + return err | ||
68 | + } | ||
69 | + return nil | ||
70 | +} | ||
71 | + | ||
60 | // 更新用户素币 | 72 | // 更新用户素币 |
61 | func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error { | 73 | func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error { |
62 | tx := dao.transactionContext.PgTx | 74 | tx := dao.transactionContext.PgTx |
@@ -139,7 +151,7 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ | @@ -139,7 +151,7 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ | ||
139 | } | 151 | } |
140 | 152 | ||
141 | // 计算系统已兑换现金素币、未兑换素币 | 153 | // 计算系统已兑换现金素币、未兑换素币 |
142 | -func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] interface{}, error) { | 154 | +func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string]interface{}, error) { |
143 | var systemUnExchangeSuMoney float64 | 155 | var systemUnExchangeSuMoney float64 |
144 | var systemExchangedSuMoney float64 | 156 | var systemExchangedSuMoney float64 |
145 | var systemExchangedSuMoneyRestore float64 | 157 | var systemExchangedSuMoneyRestore float64 |
@@ -172,14 +184,14 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int | @@ -172,14 +184,14 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int | ||
172 | Select(&systemExchangedSuMoneyRestore); err != nil { | 184 | Select(&systemExchangedSuMoneyRestore); err != nil { |
173 | return nil, err | 185 | return nil, err |
174 | } | 186 | } |
175 | - return map[string] interface{} { | 187 | + return map[string]interface{}{ |
176 | "systemUnExchangeSuMoney": systemUnExchangeSuMoney, | 188 | "systemUnExchangeSuMoney": systemUnExchangeSuMoney, |
177 | "systemExchangedSuMoney": systemExchangedSuMoney - systemExchangedSuMoneyRestore, | 189 | "systemExchangedSuMoney": systemExchangedSuMoney - systemExchangedSuMoneyRestore, |
178 | - },nil | 190 | + }, nil |
179 | } | 191 | } |
180 | 192 | ||
181 | // 计算现金池已兑换现金、未兑换现金 | 193 | // 计算现金池已兑换现金、未兑换现金 |
182 | -func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interface{}, error) { | 194 | +func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string]interface{}, error) { |
183 | tx := dao.transactionContext.PgTx | 195 | tx := dao.transactionContext.PgTx |
184 | var ( | 196 | var ( |
185 | systemUnExchangeCash float64 | 197 | systemUnExchangeCash float64 |
@@ -192,7 +204,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf | @@ -192,7 +204,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf | ||
192 | Where("cash_pool.company_id = ?", companyId). | 204 | Where("cash_pool.company_id = ?", companyId). |
193 | Order("id DESC"). | 205 | Order("id DESC"). |
194 | Limit(1). | 206 | Limit(1). |
195 | - Select(&systemExchangedCash) ; err != nil { | 207 | + Select(&systemExchangedCash); err != nil { |
196 | return nil, err | 208 | return nil, err |
197 | } | 209 | } |
198 | // 系统未兑换现金 | 210 | // 系统未兑换现金 |
@@ -201,10 +213,10 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf | @@ -201,10 +213,10 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf | ||
201 | Where("cash_pool.company_id = ?", companyId). | 213 | Where("cash_pool.company_id = ?", companyId). |
202 | Order("id DESC"). | 214 | Order("id DESC"). |
203 | Limit(1). | 215 | Limit(1). |
204 | - Select(&systemUnExchangeCash) ; err != nil { | 216 | + Select(&systemUnExchangeCash); err != nil { |
205 | return nil, err | 217 | return nil, err |
206 | } | 218 | } |
207 | - return map[string] interface{} { | 219 | + return map[string]interface{}{ |
208 | "systemUnExchangeCash": systemUnExchangeCash, | 220 | "systemUnExchangeCash": systemUnExchangeCash, |
209 | "systemExchangedCash": systemExchangedCash, | 221 | "systemExchangedCash": systemExchangedCash, |
210 | }, nil | 222 | }, nil |
@@ -9,7 +9,7 @@ type SentNotificationDao struct { | @@ -9,7 +9,7 @@ type SentNotificationDao struct { | ||
9 | transactionContext *pgTransaction.TransactionContext | 9 | transactionContext *pgTransaction.TransactionContext |
10 | } | 10 | } |
11 | 11 | ||
12 | -//TODO ChangeSentNotificationReceiverAccount | 12 | +// ChangeSentNotificationReceiverAccount TODO |
13 | func (dao *SentNotificationDao) ChangeSentNotificationReceiverAccount() { | 13 | func (dao *SentNotificationDao) ChangeSentNotificationReceiverAccount() { |
14 | 14 | ||
15 | } | 15 | } |
-
请 注册 或 登录 后发表评论