作者 庄敏学

导入同步

@@ -278,13 +278,14 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro @@ -278,13 +278,14 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro
278 editUserIds = append(editUserIds, param.EditUsers[i].Id) 278 editUserIds = append(editUserIds, param.EditUsers[i].Id)
279 editUserMap[param.EditUsers[i].Id] = param.EditUsers[i] 279 editUserMap[param.EditUsers[i].Id] = param.EditUsers[i]
280 } 280 }
  281 + nowTime := time.Now()
  282 + if len(editUserIds) > 0 {
281 _, editUserList, err := userRepo.Find(map[string]interface{}{ 283 _, editUserList, err := userRepo.Find(map[string]interface{}{
282 "ids": editUserIds, 284 "ids": editUserIds,
283 }) 285 })
284 if err != nil { 286 if err != nil {
285 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 287 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
286 } 288 }
287 - nowTime := time.Now()  
288 for i := range editUserList { 289 for i := range editUserList {
289 mVal, ok := editUserMap[editUserList[i].Id] 290 mVal, ok := editUserMap[editUserList[i].Id]
290 if !ok { 291 if !ok {
@@ -303,9 +304,11 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro @@ -303,9 +304,11 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro
303 return err 304 return err
304 } 305 }
305 } 306 }
  307 + }
306 var ( 308 var (
307 tempUser domain.User 309 tempUser domain.User
308 ) 310 )
  311 + if len(param.AddUsers) > 0 {
309 for i := range param.AddUsers { 312 for i := range param.AddUsers {
310 tempUser = domain.User{ 313 tempUser = domain.User{
311 Id: param.AddUsers[i].Id, 314 Id: param.AddUsers[i].Id,
@@ -325,6 +328,7 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro @@ -325,6 +328,7 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro
325 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 328 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
326 } 329 }
327 } 330 }
  331 + }
328 if err := transactionContext.CommitTransaction(); err != nil { 332 if err := transactionContext.CommitTransaction(); err != nil {
329 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 333 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
330 } 334 }