作者 陈志颖

fix:增加操作素币判断

... ... @@ -2200,12 +2200,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
activityFoundExchangedCash := activityFound.ExchangedCash
// 判断当前员工是否有效
getEmployee := map[string]interface{}{
"uid": createExchangeCashPersonCommand.Uid,
"companyId": activityFound.CompanyId,
}
// 判断当前员工是否有效
employeeFound, err := employeeRepository.FindOne(getEmployee)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ...
... ... @@ -31,6 +31,17 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand *
transactionContext.RollbackTransaction()
}()
// 员工仓储初始化
var employeeRepository domain.EmployeeRepository
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
employeeRepository = value
}
// 操作素币服务初始化
var operationSuMoneyService service.OperationSuMoneyService
if value, err := factory.CreateOperationSuMoneyService(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -40,7 +51,18 @@ func (suMoneyService *SuMoneyService) OperationSuMoney(operationSuMoneyCommand *
operationSuMoneyService = value
}
// 判断当前员工是否有效
getEmployee := map[string]interface{}{
"uid": operationSuMoneyCommand.Uid,
"status": 1,
}
employeeFound, err := employeeRepository.FindOne(getEmployee)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if employeeFound == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的员工")
}
if task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ...
... ... @@ -356,7 +356,7 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac
}
acceptanceTaskCommand.TaskPercentage[i].Contributor = employeeFound.EmployeeInfo
}
// 填充百分比员工信息
// 填充评分员工信息
for i, referenceResourceScore := range acceptanceTaskCommand.ReferenceResourceScore {
for j, solveScore := range referenceResourceScore.SolveScore {
getEmployee := map[string]interface{}{
... ...