作者 陈志颖

feat:增加修改手机号

@@ -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())
@@ -411,11 +411,11 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac @@ -411,11 +411,11 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac
411 411
412 // 搜索任务 412 // 搜索任务
413 func (taskService *TaskService) SearchTask(searchTaskCommand *command.SearchTaskCommand) (interface{}, error) { 413 func (taskService *TaskService) SearchTask(searchTaskCommand *command.SearchTaskCommand) (interface{}, error) {
414 - if err := searchTaskCommand.ValidateCommand(); err != nil { // 校验搜索命令 414 + if err := searchTaskCommand.ValidateCommand(); err != nil { // 校验搜索命令
415 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 415 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
416 } 416 }
417 417
418 - transactionContext, err := factory.CreateTransactionContext(nil) // 工厂类创建事务上下文 418 + transactionContext, err := factory.CreateTransactionContext(nil) // 工厂类创建事务上下文
419 if err != nil { 419 if err != nil {
420 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 420 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
421 } 421 }
@@ -918,7 +918,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -918,7 +918,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
918 } 918 }
919 919
920 sponsor, err := employeeRepository.FindOne(map[string]interface{}{ 920 sponsor, err := employeeRepository.FindOne(map[string]interface{}{
921 - "uid": createTaskCommand.Sponsor, 921 + "uid": createTaskCommand.Sponsor,
922 "status": 1, 922 "status": 1,
923 }) 923 })
924 if err != nil { 924 if err != nil {
@@ -935,14 +935,14 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -935,14 +935,14 @@ 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 // 获取任务指派人
942 var assignedPerson *domain.EmployeeInfo 942 var assignedPerson *domain.EmployeeInfo
943 if createTaskCommand.AssignedPerson != 0 { 943 if createTaskCommand.AssignedPerson != 0 {
944 employee, err := employeeRepository.FindOne(map[string]interface{}{ 944 employee, err := employeeRepository.FindOne(map[string]interface{}{
945 - "uid": createTaskCommand.AssignedPerson, 945 + "uid": createTaskCommand.AssignedPerson,
946 "status": 1, 946 "status": 1,
947 }) 947 })
948 if err != nil { 948 if err != nil {
@@ -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 }
@@ -978,7 +978,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask @@ -978,7 +978,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
978 CustomerValues: createTaskCommand.CustomerValues, 978 CustomerValues: createTaskCommand.CustomerValues,
979 TaskNature: createTaskCommand.TaskNature, 979 TaskNature: createTaskCommand.TaskNature,
980 SuMoney: createTaskCommand.SuMoney, 980 SuMoney: createTaskCommand.SuMoney,
981 - MinSuMoney: createTaskCommand.MinSuMoney, 981 + MinSuMoney: createTaskCommand.MinSuMoney,
982 MaxSuMoney: createTaskCommand.MaxSuMoney, 982 MaxSuMoney: createTaskCommand.MaxSuMoney,
983 AcceptanceStandard: createTaskCommand.AcceptanceStandard, 983 AcceptanceStandard: createTaskCommand.AcceptanceStandard,
984 TaskDescription: createTaskCommand.TaskDescription, 984 TaskDescription: createTaskCommand.TaskDescription,
@@ -1150,7 +1150,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter @@ -1150,7 +1150,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
1150 } 1150 }
1151 1151
1152 // 返回任务素币奖励范围 1152 // 返回任务素币奖励范围
1153 - if taskDto.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 { 1153 + if taskDto.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 {
1154 taskDto.MinSuMoney = 0 1154 taskDto.MinSuMoney = 0
1155 taskDto.MaxSuMoney = task.SuMoney 1155 taskDto.MaxSuMoney = task.SuMoney
1156 } 1156 }
@@ -1291,7 +1291,7 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask @@ -1291,7 +1291,7 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask
1291 employeeRepository = value 1291 employeeRepository = value
1292 } 1292 }
1293 employee, err := employeeRepository.FindOne(map[string]interface{}{ 1293 employee, err := employeeRepository.FindOne(map[string]interface{}{
1294 - "uid": updateTaskCommand.AssignedPerson, 1294 + "uid": updateTaskCommand.AssignedPerson,
1295 "status": 1, 1295 "status": 1,
1296 }) 1296 })
1297 if err != nil { 1297 if err != nil {
@@ -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 {
@@ -1457,7 +1457,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in @@ -1457,7 +1457,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in
1457 } 1457 }
1458 var retTasks []*domain.Task 1458 var retTasks []*domain.Task
1459 for _, task := range tasks { 1459 for _, task := range tasks {
1460 - if task.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 { 1460 + if task.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 {
1461 task.MinSuMoney = 0 1461 task.MinSuMoney = 0
1462 task.MaxSuMoney = task.SuMoney 1462 task.MaxSuMoney = task.SuMoney
1463 } 1463 }
@@ -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
@@ -89,12 +97,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s @@ -89,12 +97,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
89 uids = append(uids, int64(uid.(float64))) 97 uids = append(uids, int64(uid.(float64)))
90 } 98 }
91 } 99 }
92 - if value, ok := data["add"]; ok { // 添加员工 100 + if value, ok := data["add"]; ok { // 添加员工
93 for _, addEmployee := range value.([]interface{}) { 101 for _, addEmployee := range value.([]interface{}) {
94 addEmployees = append(addEmployees, addEmployee.(map[string]interface{})) 102 addEmployees = append(addEmployees, addEmployee.(map[string]interface{}))
95 } 103 }
96 } 104 }
97 - if value, ok := data["edit"]; ok { // 编辑员工 105 + if value, ok := data["edit"]; ok { // 编辑员工
98 for _, editEmployee := range value.([]interface{}) { 106 for _, editEmployee := range value.([]interface{}) {
99 editEmployees = append(editEmployees, editEmployee.(map[string]interface{})) 107 editEmployees = append(editEmployees, editEmployee.(map[string]interface{}))
100 } 108 }
@@ -144,8 +152,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s @@ -144,8 +152,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
144 EmployeeAvatarUrl: employeeAvatarUrl, 152 EmployeeAvatarUrl: employeeAvatarUrl,
145 IsPrincipal: isPrincipal, 153 IsPrincipal: isPrincipal,
146 }, 154 },
147 - Status: status,  
148 - SuMoney: 0, 155 + Status: status,
  156 + SuMoney: 0,
149 CreateTime: time.Now(), 157 CreateTime: time.Now(),
150 } 158 }
151 159
@@ -206,8 +214,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s @@ -206,8 +214,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
206 EmployeeAvatarUrl: employeeAvatarUrl, 214 EmployeeAvatarUrl: employeeAvatarUrl,
207 IsPrincipal: isPrincipal, 215 IsPrincipal: isPrincipal,
208 }, 216 },
209 - Status: status,  
210 - SuMoney: 0, 217 + Status: status,
  218 + SuMoney: 0,
211 CreateTime: time.Now(), 219 CreateTime: time.Now(),
212 } 220 }
213 if _, err := employeeRepository.Save(employee); err != nil { 221 if _, err := employeeRepository.Save(employee); err != nil {
@@ -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,18 +184,18 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int @@ -172,18 +184,18 @@ 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,  
178 - },nil 189 + "systemExchangedSuMoney": systemExchangedSuMoney - systemExchangedSuMoneyRestore,
  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
186 - systemExchangedCash float64 198 + systemExchangedCash float64
187 ) 199 )
188 // 系统已兑换现金 200 // 系统已兑换现金
189 cashPool := new(models.CashPool) 201 cashPool := new(models.CashPool)
@@ -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,22 +213,22 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf @@ -201,22 +213,22 @@ 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
211 } 223 }
212 224
213 // 计算个人素币收支(素币明细收支) 225 // 计算个人素币收支(素币明细收支)
214 func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) { 226 func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
215 var ( 227 var (
216 - incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加)  
217 - expendSuMoney float64 // 消耗的素币(1:兑换物资,4:扣除)  
218 - expendSuMoneyExchange float64 // 5: 兑换现金  
219 - incomeSuMoneyExchangeRestore float64 // 6: 兑换素币撤回 228 + incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加)
  229 + expendSuMoney float64 // 消耗的素币(1:兑换物资,4:扣除)
  230 + expendSuMoneyExchange float64 // 5: 兑换现金
  231 + incomeSuMoneyExchangeRestore float64 // 6: 兑换素币撤回
220 ) 232 )
221 tx := dao.transactionContext.PgTx 233 tx := dao.transactionContext.PgTx
222 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) 234 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
@@ -261,7 +273,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction @@ -261,7 +273,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
261 return nil, err 273 return nil, err
262 } 274 }
263 return map[string]interface{}{ 275 return map[string]interface{}{
264 - "incomeSuMoney": incomeSuMoney, // 个人素币收入 276 + "incomeSuMoney": incomeSuMoney, // 个人素币收入
265 "expendSuMoney": expendSuMoney + (expendSuMoneyExchange - incomeSuMoneyExchangeRestore), // 个人素币支出 277 "expendSuMoney": expendSuMoney + (expendSuMoneyExchange - incomeSuMoneyExchangeRestore), // 个人素币支出
266 }, nil 278 }, nil
267 } 279 }
@@ -269,8 +281,8 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction @@ -269,8 +281,8 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
269 // 计算个人贡献值收支(贡献明细收支) 281 // 计算个人贡献值收支(贡献明细收支)
270 func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) { 282 func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
271 var ( 283 var (
272 - incomeContributions float64 // 收入的贡献值(2:任务奖励,3:增加)  
273 - expendContributions float64 // 支出的贡献值 (4: 扣除) 284 + incomeContributions float64 // 收入的贡献值(2:任务奖励,3:增加)
  285 + expendContributions float64 // 支出的贡献值 (4: 扣除)
274 ) 286 )
275 tx := dao.transactionContext.PgTx 287 tx := dao.transactionContext.PgTx
276 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) 288 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
@@ -301,37 +313,37 @@ func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, trans @@ -301,37 +313,37 @@ func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, trans
301 return nil, err 313 return nil, err
302 } 314 }
303 return map[string]interface{}{ 315 return map[string]interface{}{
304 - "incomeContributions": incomeContributions, // 个人贡献值收入  
305 - "expendContributions": expendContributions, // 个人贡献支出  
306 - "contributions": incomeContributions - expendContributions, // 个人贡献值 316 + "incomeContributions": incomeContributions, // 个人贡献值收入
  317 + "expendContributions": expendContributions, // 个人贡献支出
  318 + "contributions": incomeContributions - expendContributions, // 个人贡献值
307 }, nil 319 }, nil
308 } 320 }
309 321
310 // 贡献值、财富值总榜和年榜, 322 // 贡献值、财富值总榜和年榜,
311 func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]interface{}) (interface{}, error) { 323 func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]interface{}) (interface{}, error) {
312 - var retWealth []struct { // 个人财富值  
313 - Uid int64  
314 - EmployeeName string 324 + var retWealth []struct { // 个人财富值
  325 + Uid int64
  326 + EmployeeName string
315 EmployeeSuMoney float64 327 EmployeeSuMoney float64
316 - Ranking int 328 + Ranking int
317 } 329 }
318 - var retEmployeeWealth []struct { // 个人贡献值  
319 - Uid int64  
320 - EmployeeName string 330 + var retEmployeeWealth []struct { // 个人贡献值
  331 + Uid int64
  332 + EmployeeName string
321 EmployeeSuMoney float64 333 EmployeeSuMoney float64
322 - Ranking int 334 + Ranking int
323 } 335 }
324 - var retContributions []struct { // 员工贡献值  
325 - Uid int64  
326 - EmployeeName string 336 + var retContributions []struct { // 员工贡献值
  337 + Uid int64
  338 + EmployeeName string
327 EmployeesContributions float64 339 EmployeesContributions float64
328 - Ranking int 340 + Ranking int
329 } 341 }
330 - var retEmployeeContributions []struct { // 员工贡献值  
331 - Uid int64  
332 - EmployeeName string 342 + var retEmployeeContributions []struct { // 员工贡献值
  343 + Uid int64
  344 + EmployeeName string
333 EmployeesContributions float64 345 EmployeesContributions float64
334 - Ranking int 346 + Ranking int
335 } 347 }
336 348
337 tx := dao.transactionContext.PgTx 349 tx := dao.transactionContext.PgTx
@@ -496,23 +508,23 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter @@ -496,23 +508,23 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
496 } 508 }
497 509
498 return map[string]interface{}{ 510 return map[string]interface{}{
499 - "employeesWealth": retWealth,  
500 - "employeesContributions": retContributions, 511 + "employeesWealth": retWealth,
  512 + "employeesContributions": retContributions,
501 "currentEmployeeContributions": retCurrentEmployeeContributions, 513 "currentEmployeeContributions": retCurrentEmployeeContributions,
502 - "currentEmployeeWealth": retCurrentEmployeeWealth, 514 + "currentEmployeeWealth": retCurrentEmployeeWealth,
503 }, nil 515 }, nil
504 } 516 }
505 517
506 // 公司员工贡献值分组统计 518 // 公司员工贡献值分组统计
507 func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int, startTime time.Time, endTime time.Time) (map[string]interface{}, error) { 519 func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int, startTime time.Time, endTime time.Time) (map[string]interface{}, error) {
508 - var ret []struct { // 员工贡献值  
509 - Uid int  
510 - EmployeeName string 520 + var ret []struct { // 员工贡献值
  521 + Uid int
  522 + EmployeeName string
511 EmployeesContributions float64 523 EmployeesContributions float64
512 } 524 }
513 - var retDecrease []struct { // 员工减少的贡献值  
514 - Uid int  
515 - EmployeeName string 525 + var retDecrease []struct { // 员工减少的贡献值
  526 + Uid int
  527 + EmployeeName string
516 EmployeesContributions float64 528 EmployeesContributions float64
517 } 529 }
518 tx := dao.transactionContext.PgTx 530 tx := dao.transactionContext.PgTx
@@ -562,8 +574,8 @@ func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int, startTime @@ -562,8 +574,8 @@ func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int, startTime
562 // 公司员工财富值分组统计 574 // 公司员工财富值分组统计
563 func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time.Time, endTime time.Time) (map[string]interface{}, error) { 575 func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time.Time, endTime time.Time) (map[string]interface{}, error) {
564 var ret []struct { 576 var ret []struct {
565 - Uid int  
566 - EmployeeName string 577 + Uid int
  578 + EmployeeName string
567 EmployeeSuMoney float64 579 EmployeeSuMoney float64
568 } 580 }
569 tx := dao.transactionContext.PgTx 581 tx := dao.transactionContext.PgTx
@@ -574,7 +586,7 @@ func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time. @@ -574,7 +586,7 @@ func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time.
574 ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money"). 586 ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money").
575 Where(`e.company_id = ?`, companyId). 587 Where(`e.company_id = ?`, companyId).
576 //Where(`e.status = ?`, 1). 588 //Where(`e.status = ?`, 1).
577 - Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})). // 增加,任务奖励的 589 + Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})). // 增加,任务奖励的
578 Where(`su_money_transaction_record.create_time > ?`, startTime). 590 Where(`su_money_transaction_record.create_time > ?`, startTime).
579 Where(`su_money_transaction_record.create_time < ?`, endTime). 591 Where(`su_money_transaction_record.create_time < ?`, endTime).
580 Group("su_money_transaction_record.employee"). 592 Group("su_money_transaction_record.employee").
@@ -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 }
@@ -22,4 +22,4 @@ func NewSentNotificationDao(transactionContext *pgTransaction.TransactionContext @@ -22,4 +22,4 @@ func NewSentNotificationDao(transactionContext *pgTransaction.TransactionContext
22 transactionContext: transactionContext, 22 transactionContext: transactionContext,
23 }, nil 23 }, nil
24 } 24 }
25 -}  
  25 +}