Merge remote-tracking branch 'origin/test' into dev
# Conflicts: # pkg/infrastructure/repository/pg_users_repository.go
正在显示
3 个修改的文件
包含
23 行增加
和
19 行删除
@@ -79,23 +79,24 @@ func (term *TerminalManager) DownEntityEvent(e event.Event) error { | @@ -79,23 +79,24 @@ func (term *TerminalManager) DownEntityEvent(e event.Event) error { | ||
79 | func (term *TerminalManager) SyncUser(e event.Event) error { | 79 | func (term *TerminalManager) SyncUser(e event.Event) error { |
80 | user := e.Get("user") | 80 | user := e.Get("user") |
81 | userBase := e.Get("userBase") | 81 | userBase := e.Get("userBase") |
82 | - if user != nil && userBase == nil { | ||
83 | - assertUser := user.(*domain.User) | ||
84 | - if assertUser.Ext.DepName != "制造中心" { | ||
85 | - log.Logger.Debug("【TerminalManager】 当前用户部门不是 [制造中心] 不进行同步", map[string]interface{}{"user": user}) | ||
86 | - return nil | ||
87 | - } | ||
88 | - term.BroadcastDownEntity(NewUpdateUserDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUser.Ext.UserName)) | ||
89 | - return nil | ||
90 | - } | 82 | + //if user != nil && userBase == nil { |
83 | + // assertUser := user.(*domain.User) | ||
84 | + // if assertUser.Ext.DepName != "制造中心" { | ||
85 | + // log.Logger.Debug("【TerminalManager】 当前用户部门不是 [制造中心] 不进行同步", map[string]interface{}{"user": user}) | ||
86 | + // return nil | ||
87 | + // } | ||
88 | + // term.BroadcastDownEntity(NewUpdateUserDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUser.Ext.UserName)) | ||
89 | + // return nil | ||
90 | + //} | ||
91 | if user != nil && userBase != nil { | 91 | if user != nil && userBase != nil { |
92 | assertUser := user.(*domain.User) | 92 | assertUser := user.(*domain.User) |
93 | assertUserBase := userBase.(*domain.UserBase) | 93 | assertUserBase := userBase.(*domain.UserBase) |
94 | - if assertUser.Ext.DepName != "制造中心" { | ||
95 | - log.Logger.Debug("【TerminalManager】 当前用户部门不是 [制造中心] 不进行同步", map[string]interface{}{"user": user}) | ||
96 | - return nil | ||
97 | - } | 94 | + //if assertUser.Ext.DepName != "制造中心" { |
95 | + // log.Logger.Debug("【TerminalManager】 当前用户部门不是 [制造中心] 不进行同步", map[string]interface{}{"user": user}) | ||
96 | + // return nil | ||
97 | + //} | ||
98 | if len(assertUser.Ext.IcCardNumber) == 0 { | 98 | if len(assertUser.Ext.IcCardNumber) == 0 { |
99 | + log.Logger.Debug("【TerminalManager】 当前用户ICCard未设置 不进行同步", map[string]interface{}{"user": user}) | ||
99 | return nil | 100 | return nil |
100 | } | 101 | } |
101 | term.BroadcastDownEntity(NewUpdateUserDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.UserName)) | 102 | term.BroadcastDownEntity(NewUpdateUserDownEntity(generateSn(), assertUser.Ext.IcCardNumber, assertUserBase.UserInfo.UserName)) |
@@ -25,7 +25,7 @@ func (userService *UserService) SyncToAttendanceMachine(cmd *command.SyncToAtten | @@ -25,7 +25,7 @@ func (userService *UserService) SyncToAttendanceMachine(cmd *command.SyncToAtten | ||
25 | transactionContext.RollbackTransaction() | 25 | transactionContext.RollbackTransaction() |
26 | }() | 26 | }() |
27 | userRepository, _, _ := factory.FastPgUser(transactionContext, 0) | 27 | userRepository, _, _ := factory.FastPgUser(transactionContext, 0) |
28 | - orgRepository, _, _ := factory.FastPgOrg(transactionContext, 0) | 28 | + //orgRepository, _, _ := factory.FastPgOrg(transactionContext, 0) |
29 | var users []*domain.User | 29 | var users []*domain.User |
30 | // 指定用户进行同步 | 30 | // 指定用户进行同步 |
31 | if len(cmd.Users) > 0 { | 31 | if len(cmd.Users) > 0 { |
@@ -34,11 +34,11 @@ func (userService *UserService) SyncToAttendanceMachine(cmd *command.SyncToAtten | @@ -34,11 +34,11 @@ func (userService *UserService) SyncToAttendanceMachine(cmd *command.SyncToAtten | ||
34 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 34 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
35 | } | 35 | } |
36 | } else { | 36 | } else { |
37 | - org, _ := orgRepository.FindOne(map[string]interface{}{"companyId": cmd.OperateInfo.CompanyId, "orgName": "制造中心"}) | ||
38 | - if org == nil { | ||
39 | - return nil, nil | ||
40 | - } | ||
41 | - _, users, err = userRepository.Find(map[string]interface{}{"companyId": cmd.OperateInfo.CompanyId, "inDepartmentIds": []int64{org.OrgId}}) | 37 | + //org, _ := orgRepository.FindOne(map[string]interface{}{"companyId": cmd.OperateInfo.CompanyId, "orgName": "制造中心"}) |
38 | + //if org == nil { | ||
39 | + // return nil, nil | ||
40 | + //} | ||
41 | + _, users, err = userRepository.Find(map[string]interface{}{"companyId": cmd.OperateInfo.CompanyId, "icCardNumberNotEqual": ""}) | ||
42 | if err != nil { | 42 | if err != nil { |
43 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 43 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
44 | } | 44 | } |
@@ -240,6 +240,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | @@ -240,6 +240,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | ||
240 | if v, ok := queryOptions["advancedQuery"]; ok && len(v.(string)) > 0 { | 240 | if v, ok := queryOptions["advancedQuery"]; ok && len(v.(string)) > 0 { |
241 | query.Where(v.(string)) | 241 | query.Where(v.(string)) |
242 | } | 242 | } |
243 | + if _, ok := queryOptions["icCardNumberNotEqual"]; ok { | ||
244 | + query.Where(fmt.Sprintf(`ext->>'icCardNumber' <> '%v'`, "")) | ||
245 | + } | ||
243 | query.SetOffsetAndLimit(domain.MaxQueryRow) | 246 | query.SetOffsetAndLimit(domain.MaxQueryRow) |
244 | query.SetOrderDirect("user_id", "DESC") | 247 | query.SetOrderDirect("user_id", "DESC") |
245 | if count, err := query.SelectAndCount(); err != nil { | 248 | if count, err := query.SelectAndCount(); err != nil { |
-
请 注册 或 登录 后发表评论