| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package com.inspur.customer.object.keycloak;
- import com.fasterxml.jackson.annotation.JsonIgnore;
- import lombok.Data;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.lang.Nullable;
- import java.io.Serializable;
- import java.util.BitSet;
- import java.util.List;
- /**
- * keycloak user
- * @author linwenhua
- * @date 2022-06-14 16:54
- **/
- @Data
- public class KeycloakUserCO implements Serializable {
- private static final long serialVersionUID = 6869360605249346844L;
- private String id;
- private String username;
- private String phone;
- private String email;
- private String wechat;
- private String wechatAppletOpenId;
- public void setPhone(@Nullable List<String> phones) {
- if (phones != null && !phones.isEmpty()) {
- phone = phones.get(0);
- }
- }
- public void setWechat(@Nullable List<String> wechats) {
- if (wechats != null && !wechats.isEmpty()) {
- String temp = wechats.get(0);
- if (!temp.contains("{\"")) {
- wechat = temp;
- }
- }
- }
- public void setWechatApplet(@Nullable List<String> wechatApplets) {
- if (wechatApplets != null && !wechatApplets.isEmpty()) {
- String temp = wechatApplets.get(0);
- if (!temp.contains("{\"")) {
- wechatAppletOpenId = temp;
- }
- }
- }
- @JsonIgnore
- public BitSet getInformFlag() {
- BitSet bitSet = new BitSet(4);
- if (StringUtils.isNotBlank(phone)) {
- bitSet.set(0);
- }
- if (StringUtils.isNotBlank(email)) {
- bitSet.set(1);
- }
- if (StringUtils.isNotBlank(wechat)) {
- bitSet.set(2);
- }
- if (StringUtils.isNotBlank(wechatAppletOpenId)) {
- bitSet.set(3);
- }
- return bitSet;
- }
- }
|