|
@@ -188,7 +188,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
@@ -188,7 +188,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
188
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
188
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
189
|
}
|
189
|
}
|
190
|
if _, err := employeeRepository.Save(employee); err != nil {
|
190
|
if _, err := employeeRepository.Save(employee); err != nil {
|
191
|
- return false, nil
|
191
|
+ return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
192
|
}
|
192
|
}
|
193
|
}
|
193
|
}
|
194
|
}
|
194
|
}
|
|
@@ -213,7 +213,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
@@ -213,7 +213,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
213
|
case "edit":
|
213
|
case "edit":
|
214
|
employee, err := employeeRepository.FindOne(map[string]interface{}{"uid": uid})
|
214
|
employee, err := employeeRepository.FindOne(map[string]interface{}{"uid": uid})
|
215
|
if err != nil {
|
215
|
if err != nil {
|
216
|
- return false, nil
|
216
|
+ return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
217
|
}
|
217
|
}
|
218
|
if employee == nil {
|
218
|
if employee == nil {
|
219
|
return false, nil
|
219
|
return false, nil
|
|
@@ -228,19 +228,19 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
@@ -228,19 +228,19 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
228
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
228
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
229
|
}
|
229
|
}
|
230
|
if _, err := employeeRepository.Save(employee); err != nil {
|
230
|
if _, err := employeeRepository.Save(employee); err != nil {
|
231
|
- return false, nil
|
231
|
+ return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
232
|
}
|
232
|
}
|
233
|
break
|
233
|
break
|
234
|
case "batchDelete":
|
234
|
case "batchDelete":
|
235
|
err := employeeDao.BatchRemove(uids)
|
235
|
err := employeeDao.BatchRemove(uids)
|
236
|
if err != nil {
|
236
|
if err != nil {
|
237
|
- return false, nil
|
237
|
+ return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
238
|
}
|
238
|
}
|
239
|
break
|
239
|
break
|
240
|
case "batchForbid":
|
240
|
case "batchForbid":
|
241
|
err := employeeDao.BatchSetStatus(uids, status)
|
241
|
err := employeeDao.BatchSetStatus(uids, status)
|
242
|
if err != nil {
|
242
|
if err != nil {
|
243
|
- return false, nil
|
243
|
+ return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
244
|
}
|
244
|
}
|
245
|
break
|
245
|
break
|
246
|
default:
|
246
|
default:
|
|
@@ -255,12 +255,15 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
|
@@ -255,12 +255,15 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s |
255
|
case "changeAdmin":
|
255
|
case "changeAdmin":
|
256
|
err := employeeDao.ChangePrincipal(companyId, employeeAccount)
|
256
|
err := employeeDao.ChangePrincipal(companyId, employeeAccount)
|
257
|
if err != nil {
|
257
|
if err != nil {
|
258
|
- return false, nil
|
258
|
+ return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
259
|
}
|
259
|
}
|
260
|
break
|
260
|
break
|
261
|
default:
|
261
|
default:
|
262
|
return false, nil
|
262
|
return false, nil
|
263
|
}
|
263
|
}
|
|
|
264
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
265
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
266
|
+ }
|
264
|
return true, nil
|
267
|
return true, nil
|
265
|
} else {
|
268
|
} else {
|
266
|
return false, nil
|
269
|
return false, nil
|