...
|
...
|
@@ -188,7 +188,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if _, err := employeeRepository.Save(employee); err != nil {
|
|
|
return false, nil
|
|
|
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -213,7 +213,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
|
case "edit":
|
|
|
employee, err := employeeRepository.FindOne(map[string]interface{}{"uid": uid})
|
|
|
if err != nil {
|
|
|
return false, nil
|
|
|
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if employee == nil {
|
|
|
return false, nil
|
...
|
...
|
@@ -228,19 +228,19 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if _, err := employeeRepository.Save(employee); err != nil {
|
|
|
return false, nil
|
|
|
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
break
|
|
|
case "batchDelete":
|
|
|
err := employeeDao.BatchRemove(uids)
|
|
|
if err != nil {
|
|
|
return false, nil
|
|
|
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
break
|
|
|
case "batchForbid":
|
|
|
err := employeeDao.BatchSetStatus(uids, status)
|
|
|
if err != nil {
|
|
|
return false, nil
|
|
|
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
break
|
|
|
default:
|
...
|
...
|
@@ -255,12 +255,15 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
|
case "changeAdmin":
|
|
|
err := employeeDao.ChangePrincipal(companyId, employeeAccount)
|
|
|
if err != nil {
|
|
|
return false, nil
|
|
|
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
break
|
|
|
default:
|
|
|
return false, nil
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return true, nil
|
|
|
} else {
|
|
|
return false, nil
|
...
|
...
|
|