正在显示
5 个修改的文件
包含
32 行增加
和
5 行删除
@@ -2593,13 +2593,11 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC | @@ -2593,13 +2593,11 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC | ||
2593 | activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney | 2593 | activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney |
2594 | activityFoundExchangedCash := activityFound.ExchangedCash | 2594 | activityFoundExchangedCash := activityFound.ExchangedCash |
2595 | 2595 | ||
2596 | - // 判断当前人员状态 | 2596 | + // 判断当前员工是否有效 |
2597 | getEmployee := map[string]interface{}{ | 2597 | getEmployee := map[string]interface{}{ |
2598 | "uid": personFound.EmployeeInfo.Uid, | 2598 | "uid": personFound.EmployeeInfo.Uid, |
2599 | "companyId": activityFound.CompanyId, | 2599 | "companyId": activityFound.CompanyId, |
2600 | } | 2600 | } |
2601 | - | ||
2602 | - // 判断当前员工是否有效 | ||
2603 | employeeFound, err := employeeRepository.FindOne(getEmployee) | 2601 | employeeFound, err := employeeRepository.FindOne(getEmployee) |
2604 | if err != nil { | 2602 | if err != nil { |
2605 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 2603 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -40,6 +40,8 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * | @@ -40,6 +40,8 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * | ||
40 | operationSuMoneyService = value | 40 | operationSuMoneyService = value |
41 | } | 41 | } |
42 | 42 | ||
43 | + | ||
44 | + | ||
43 | if task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription); err != nil { | 45 | if task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription); err != nil { |
44 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 46 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
45 | } else { | 47 | } else { |
@@ -309,6 +309,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac | @@ -309,6 +309,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac | ||
309 | if err := acceptanceTaskCommand.ValidateCommand(); err != nil { | 309 | if err := acceptanceTaskCommand.ValidateCommand(); err != nil { |
310 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 310 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
311 | } | 311 | } |
312 | + | ||
312 | transactionContext, err := factory.CreateTransactionContext(nil) | 313 | transactionContext, err := factory.CreateTransactionContext(nil) |
313 | if err != nil { | 314 | if err != nil { |
314 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 315 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -320,6 +321,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac | @@ -320,6 +321,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac | ||
320 | transactionContext.RollbackTransaction() | 321 | transactionContext.RollbackTransaction() |
321 | }() | 322 | }() |
322 | 323 | ||
324 | + // 验收服务初始化 | ||
323 | var acceptanceTaskService service.AcceptanceTaskService | 325 | var acceptanceTaskService service.AcceptanceTaskService |
324 | if value, err := factory.CreateAcceptanceTaskService(map[string]interface{}{ | 326 | if value, err := factory.CreateAcceptanceTaskService(map[string]interface{}{ |
325 | "transactionContext": transactionContext, | 327 | "transactionContext": transactionContext, |
@@ -330,6 +332,31 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac | @@ -330,6 +332,31 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac | ||
330 | acceptanceTaskService.Subscribe(&subscriber.AbilityServiceSubscriber{}) | 332 | acceptanceTaskService.Subscribe(&subscriber.AbilityServiceSubscriber{}) |
331 | } | 333 | } |
332 | 334 | ||
335 | + // 员工仓储初始化 | ||
336 | + var employeeRepository domain.EmployeeRepository | ||
337 | + if value, err := factory.CreateEmployeeRepository(map[string]interface{}{ | ||
338 | + "transactionContext": transactionContext, | ||
339 | + }); err != nil { | ||
340 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
341 | + } else { | ||
342 | + employeeRepository = value | ||
343 | + } | ||
344 | + | ||
345 | + // 填充员工信息 | ||
346 | + for i, taskPercentage := range acceptanceTaskCommand.TaskPercentage { | ||
347 | + getEmployee := map[string]interface{}{ | ||
348 | + "uid": taskPercentage.Contributor.Uid, | ||
349 | + } | ||
350 | + employeeFound, err := employeeRepository.FindOne(getEmployee) | ||
351 | + if err != nil { | ||
352 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
353 | + } | ||
354 | + if employeeFound == nil { | ||
355 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的员工") | ||
356 | + } | ||
357 | + acceptanceTaskCommand.TaskPercentage[i].Contributor = employeeFound.EmployeeInfo | ||
358 | + } | ||
359 | + | ||
333 | if task, err := acceptanceTaskService.Acceptance(acceptanceTaskCommand.TaskId, acceptanceTaskCommand.Operator, acceptanceTaskCommand.Participators, acceptanceTaskCommand.SuMoney, acceptanceTaskCommand.TaskPercentage, acceptanceTaskCommand.ReferenceResourceScore, acceptanceTaskCommand.SolveReport, acceptanceTaskCommand.SolvePictureUrls, acceptanceTaskCommand.ActualCompletionTime); err != nil { | 360 | if task, err := acceptanceTaskService.Acceptance(acceptanceTaskCommand.TaskId, acceptanceTaskCommand.Operator, acceptanceTaskCommand.Participators, acceptanceTaskCommand.SuMoney, acceptanceTaskCommand.TaskPercentage, acceptanceTaskCommand.ReferenceResourceScore, acceptanceTaskCommand.SolveReport, acceptanceTaskCommand.SolvePictureUrls, acceptanceTaskCommand.ActualCompletionTime); err != nil { |
334 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 361 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
335 | } else { | 362 | } else { |
@@ -69,7 +69,7 @@ func (repository *EmployeeRepository) FindOne(queryOptions map[string]interface{ | @@ -69,7 +69,7 @@ func (repository *EmployeeRepository) FindOne(queryOptions map[string]interface{ | ||
69 | if companyId, ok := queryOptions["companyId"]; ok { | 69 | if companyId, ok := queryOptions["companyId"]; ok { |
70 | query = query.Where("employee.company_id = ?", companyId) | 70 | query = query.Where("employee.company_id = ?", companyId) |
71 | } | 71 | } |
72 | - if status, ok := queryOptions["status"]; ok { | 72 | + if status, ok := queryOptions["status"]; ok && status.(int) != 0 { |
73 | query = query.Where(`employee.status = ?`, status) // 筛除已离职员工 | 73 | query = query.Where(`employee.status = ?`, status) // 筛除已离职员工 |
74 | } | 74 | } |
75 | if err := query.First(); err != nil { | 75 | if err := query.First(); err != nil { |
@@ -102,7 +102,7 @@ func (repository *EmployeeRepository) FindByIds(queryOptions map[string]interfac | @@ -102,7 +102,7 @@ func (repository *EmployeeRepository) FindByIds(queryOptions map[string]interfac | ||
102 | query = query.Where("employee.company_id = ?", companyId) | 102 | query = query.Where("employee.company_id = ?", companyId) |
103 | } | 103 | } |
104 | } | 104 | } |
105 | - if status, ok := queryOptions["status"]; ok { | 105 | + if status, ok := queryOptions["status"]; ok && status.(int) != 0 { |
106 | query = query.Where(`employee.status = ?`, status) | 106 | query = query.Where(`employee.status = ?`, status) |
107 | } | 107 | } |
108 | if count, err := query.Order("uid DESC").SelectAndCount(); err != nil { | 108 | if count, err := query.Order("uid DESC").SelectAndCount(); err != nil { |
-
请 注册 或 登录 后发表评论