作者 陈志颖

fix:增加操作素币判断

@@ -2200,12 +2200,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC @@ -2200,12 +2200,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
2200 activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney 2200 activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
2201 activityFoundExchangedCash := activityFound.ExchangedCash 2201 activityFoundExchangedCash := activityFound.ExchangedCash
2202 2202
  2203 + // 判断当前员工是否有效
2203 getEmployee := map[string]interface{}{ 2204 getEmployee := map[string]interface{}{
2204 "uid": createExchangeCashPersonCommand.Uid, 2205 "uid": createExchangeCashPersonCommand.Uid,
2205 "companyId": activityFound.CompanyId, 2206 "companyId": activityFound.CompanyId,
2206 } 2207 }
2207 -  
2208 - // 判断当前员工是否有效  
2209 employeeFound, err := employeeRepository.FindOne(getEmployee) 2208 employeeFound, err := employeeRepository.FindOne(getEmployee)
2210 if err != nil { 2209 if err != nil {
2211 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 2210 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -31,6 +31,17 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * @@ -31,6 +31,17 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand *
31 transactionContext.RollbackTransaction() 31 transactionContext.RollbackTransaction()
32 }() 32 }()
33 33
  34 + // 员工仓储初始化
  35 + var employeeRepository domain.EmployeeRepository
  36 + if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
  37 + "transactionContext": transactionContext,
  38 + }); err != nil {
  39 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  40 + } else {
  41 + employeeRepository = value
  42 + }
  43 +
  44 + // 操作素币服务初始化
34 var operationSuMoneyService service.OperationSuMoneyService 45 var operationSuMoneyService service.OperationSuMoneyService
35 if value, err := factory.CreateOperationSuMoneyService(map[string]interface{}{ 46 if value, err := factory.CreateOperationSuMoneyService(map[string]interface{}{
36 "transactionContext": transactionContext, 47 "transactionContext": transactionContext,
@@ -40,7 +51,18 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand * @@ -40,7 +51,18 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand *
40 operationSuMoneyService = value 51 operationSuMoneyService = value
41 } 52 }
42 53
43 - 54 + // 判断当前员工是否有效
  55 + getEmployee := map[string]interface{}{
  56 + "uid": operationSuMoneyCommand.Uid,
  57 + "status": 1,
  58 + }
  59 + employeeFound, err := employeeRepository.FindOne(getEmployee)
  60 + if err != nil {
  61 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  62 + }
  63 + if employeeFound == nil {
  64 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的员工")
  65 + }
44 66
45 if task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription); err != nil { 67 if task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription); err != nil {
46 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 68 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -356,7 +356,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac @@ -356,7 +356,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac
356 } 356 }
357 acceptanceTaskCommand.TaskPercentage[i].Contributor = employeeFound.EmployeeInfo 357 acceptanceTaskCommand.TaskPercentage[i].Contributor = employeeFound.EmployeeInfo
358 } 358 }
359 - // 填充百分比员工信息 359 + // 填充评分员工信息
360 for i, referenceResourceScore := range acceptanceTaskCommand.ReferenceResourceScore { 360 for i, referenceResourceScore := range acceptanceTaskCommand.ReferenceResourceScore {
361 for j, solveScore := range referenceResourceScore.SolveScore { 361 for j, solveScore := range referenceResourceScore.SolveScore {
362 getEmployee := map[string]interface{}{ 362 getEmployee := map[string]interface{}{