|
|
@@ -5,6 +5,7 @@ import com.alibaba.cola.dto.Response;
|
|
|
import com.alibaba.cola.dto.SingleResponse;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.inspur.customer.client.keycloak.KeycloakService;
|
|
|
+import com.inspur.customer.client.org.SmsbDepartmentUserService;
|
|
|
import com.inspur.customer.constant.Constant;
|
|
|
import com.inspur.customer.object.keycloak.KeycloakUserCO;
|
|
|
import com.inspur.customer.object.keycloak.SwitchDTO;
|
|
|
@@ -13,12 +14,12 @@ import com.inspur.customer.object.org.SmsbDepartmentCmd;
|
|
|
import com.inspur.customer.object.org.SmsbUserAdd;
|
|
|
import com.inspur.customer.object.wechat.Pair;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.keycloak.admin.client.resource.*;
|
|
|
import org.keycloak.representations.idm.*;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
@@ -35,6 +36,8 @@ public class KeycloakServiceImpl implements KeycloakService {
|
|
|
|
|
|
@Resource
|
|
|
private RealmResource realmResource;
|
|
|
+ @DubboReference
|
|
|
+ private SmsbDepartmentUserService userService;
|
|
|
|
|
|
@Override
|
|
|
@Cacheable(value = "smsb:users")
|
|
|
@@ -122,6 +125,14 @@ public class KeycloakServiceImpl implements KeycloakService {
|
|
|
|
|
|
@Override
|
|
|
public void updateAttribute(String userId ,String property , String value) {
|
|
|
+ KeycloakUserCO userCO = new KeycloakUserCO();
|
|
|
+ userCO.setId(userId);
|
|
|
+ if(Objects.nonNull(property) && property.equals("wechat")){
|
|
|
+ userCO.setWechat(Collections.singletonList(value));
|
|
|
+ }else if(Objects.nonNull(property) && property.equals("wechat-applet-openid")){
|
|
|
+ userCO.setWechatAppletOpenId(value);
|
|
|
+ }
|
|
|
+ userService.updateUserAttribute(userCO);
|
|
|
UserResource user = realmResource.users().get(userId);
|
|
|
UserRepresentation userRepresentation = user.toRepresentation();
|
|
|
if (userRepresentation.getAttributes() == null) {
|