正在显示
3 个修改的文件
包含
12 行增加
和
6 行删除
| @@ -61,7 +61,7 @@ func terminalReport(cmd *command.TerminalReportCommand, transactionContext appli | @@ -61,7 +61,7 @@ func terminalReport(cmd *command.TerminalReportCommand, transactionContext appli | ||
| 61 | var ( | 61 | var ( |
| 62 | response string = "OK" | 62 | response string = "OK" |
| 63 | ) | 63 | ) |
| 64 | - | 64 | + log.Logger.Debug(fmt.Sprintf("【TerminalManager】 收到上行命令 command:%v table:%v content:%v", cmd.Command, cmd.Table, cmd.Content)) |
| 65 | switch cmd.Command { | 65 | switch cmd.Command { |
| 66 | case "getrequest": | 66 | case "getrequest": |
| 67 | device, ok := GlobalTerminalManager.GetDevice(cmd.TerminalId) | 67 | device, ok := GlobalTerminalManager.GetDevice(cmd.TerminalId) |
| @@ -103,7 +103,6 @@ func terminalReport(cmd *command.TerminalReportCommand, transactionContext appli | @@ -103,7 +103,6 @@ func terminalReport(cmd *command.TerminalReportCommand, transactionContext appli | ||
| 103 | break | 103 | break |
| 104 | } | 104 | } |
| 105 | case "devicecmd": | 105 | case "devicecmd": |
| 106 | - log.Logger.Debug("【TerminalManager】 收到命令应答 cmd : " + cmd.Content) | ||
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | return map[string]interface{}{ | 108 | return map[string]interface{}{ |
| @@ -98,13 +98,13 @@ func (term *TerminalManager) SyncUser(e event.Event) error { | @@ -98,13 +98,13 @@ func (term *TerminalManager) SyncUser(e event.Event) error { | ||
| 98 | if len(assertUser.Ext.IcCardNumber) == 0 { | 98 | if len(assertUser.Ext.IcCardNumber) == 0 { |
| 99 | return nil | 99 | return nil |
| 100 | } | 100 | } |
| 101 | + term.BroadcastDownEntity(NewUpdateUserDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.UserName)) | ||
| 101 | if len(assertUserBase.UserInfo.FacePortrait) > 0 { | 102 | if len(assertUserBase.UserInfo.FacePortrait) > 0 { |
| 102 | term.BroadcastDownEntity(NewUpdateUserFacePortraitDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.FacePortrait)) | 103 | term.BroadcastDownEntity(NewUpdateUserFacePortraitDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.FacePortrait)) |
| 103 | } | 104 | } |
| 104 | if len(assertUserBase.UserInfo.FingerprintPortrait) > 0 { | 105 | if len(assertUserBase.UserInfo.FingerprintPortrait) > 0 { |
| 105 | term.BroadcastDownEntity(NewUpdateUserFingerprintPortraitDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.FingerprintPortrait)) | 106 | term.BroadcastDownEntity(NewUpdateUserFingerprintPortraitDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.FingerprintPortrait)) |
| 106 | } | 107 | } |
| 107 | - term.BroadcastDownEntity(NewUpdateUserDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.UserName)) | ||
| 108 | } | 108 | } |
| 109 | return nil | 109 | return nil |
| 110 | } | 110 | } |
| @@ -102,18 +102,25 @@ func (userService *UserService) BatchEnable(batchEnableCommand *command.BatchEna | @@ -102,18 +102,25 @@ func (userService *UserService) BatchEnable(batchEnableCommand *command.BatchEna | ||
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | for i := 0; i < len(batchEnableCommand.UserIds); i++ { | 104 | for i := 0; i < len(batchEnableCommand.UserIds); i++ { |
| 105 | - if user, err := userRepository.FindOne(map[string]interface{}{"userId": batchEnableCommand.UserIds[i]}); err != nil { | 105 | + var ( |
| 106 | + user *domain.User | ||
| 107 | + userBase *domain.UserBase | ||
| 108 | + ) | ||
| 109 | + user, err = userRepository.FindOne(map[string]interface{}{"userId": batchEnableCommand.UserIds[i]}) | ||
| 110 | + if err != nil { | ||
| 106 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 111 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 107 | - } else { | 112 | + } |
| 108 | if err := user.SetEnableStatus(batchEnableCommand.EnableStatus); err != nil { | 113 | if err := user.SetEnableStatus(batchEnableCommand.EnableStatus); err != nil { |
| 109 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 114 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 110 | } | 115 | } |
| 111 | if _, err := userRepository.Save(user); err != nil { | 116 | if _, err := userRepository.Save(user); err != nil { |
| 112 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 117 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 113 | } | 118 | } |
| 114 | - if err, _ := event.Fire(domain.UserEnableEvent, map[string]interface{}{"user": user}); err != nil { | 119 | + if _, userBase, err = factory.FastPgUserBase(transactionContext, user.UserBaseId); err != nil { |
| 115 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 120 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 116 | } | 121 | } |
| 122 | + if err, _ := event.Fire(domain.UserEnableEvent, map[string]interface{}{"user": user, "userBase": userBase}); err != nil { | ||
| 123 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 117 | } | 124 | } |
| 118 | } | 125 | } |
| 119 | 126 |
-
请 注册 或 登录 后发表评论