浏览代码

feat:微信公众号公共消息推送

wangbo 2 年之前
父节点
当前提交
a5d4da779f

+ 12 - 0
smsb-customer-manager-app/src/main/java/com/inspur/customer/service/keycloak/KeycloakServiceImpl.java

@@ -457,4 +457,16 @@ public class KeycloakServiceImpl implements KeycloakService {
             return PageResponse.of(userRepresentations ,0 ,0,0);
         }
     }
+
+    @Override
+    public List<String> queryWechatByRole(String role) {
+        List<String> openIds = Lists.newArrayList();
+         realmResource.roles().get(role).getRoleUserMembers().forEach(user->{
+             Map<String, List<String>> attributes = user.getAttributes();
+             if (attributes != null && attributes.get("wechat") != null) {
+                 openIds.addAll(attributes.get("wechat"));
+             }
+        });
+        return openIds;
+    }
 }

+ 7 - 0
smsb-customer-manager-client/src/main/java/com/inspur/customer/client/keycloak/KeycloakService.java

@@ -223,4 +223,11 @@ public interface KeycloakService {
      */
     PageResponse<UserRepresentation> getUserListByIds(SmsbDepartmentCmd departmentCmd , List<String> userId);
 
+    /**
+     * 通过角色获取用户微信的openId
+     *
+     * @param role
+     * @return openId的集合
+     */
+    List<String> queryWechatByRole(String role);
 }