Przeglądaj źródła

Merge branch 'mazq-jiekouyouhua-230523' into 'release/v1.2.0'

feature: 变更通知修改

See merge request dcuc-tjdsj/auth-service!218
马志强 1 rok temu
rodzic
commit
e1f3f95a9e

+ 4 - 4
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/business/impl/NotifyBusinessImpl.java

@@ -183,8 +183,10 @@ public class NotifyBusinessImpl implements INotifyBusiness {
                     continue;
                 }
                 AuthUserVo userVo = new AuthUserVo();
-                userVo.setIdcard(userInfo.getId());
+                userVo.setId(userInfo.getId());
                 userVo.setIdcard(idcard);
+                userVo.setOrgId(userInfo.getOrgId());
+                userVo.setOrgCode(userInfo.getOrgCode());
                 ApiAppAuthVo appAuthVo = ApiAppAuthVo.builder()
                         .userInfo(userVo)
                         .build();
@@ -192,7 +194,7 @@ public class NotifyBusinessImpl implements INotifyBusiness {
                 String appCodes = list.stream()
                         .map(AppDataSensitiveLevelDTO::getCode)
                         .collect(Collectors.joining(StrUtil.COMMA));
-                log.info("通知人员:{}, 通知内容:{}", idcard, appCodes);
+                log.info("通知人员身份证号:{}, 通知内容:{}", idcard, appCodes);
                 AppAuthNotifyDto dto = AppAuthNotifyDto.builder()
                         .userTokenId(userTokenId)
                         .content(appCodes)
@@ -208,11 +210,9 @@ public class NotifyBusinessImpl implements INotifyBusiness {
                         .body();
                 log.info("sendNotify post response:{}", postResp);
             }
-
         }catch (Exception e) {
             log.error("新标准变更通知失败.", e);
         }
-
     }
 
 

+ 7 - 2
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/msg/PermissionUpdateProducer.java

@@ -10,6 +10,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -33,6 +34,9 @@ public class PermissionUpdateProducer {
     @Resource(name = "redisTemplate")
     private RedisTemplate<String, Object> redisTemplate;
 
+    @Resource
+    private StringRedisTemplate stringRedisTemplate;
+
     @Autowired
     private DcucAuthZerotrustConfig zerotrustConfig;
 
@@ -120,11 +124,12 @@ public class PermissionUpdateProducer {
                     // 加上认证下发的用户令牌前缀
                     .map(item -> ZerotrustAuthRedisConstant.REDIS_IDCARD_TOKEN_NAMESPACE + item)
                     .collect(Collectors.toList());
-            List<Object> tokenList = redisTemplate.opsForValue().multiGet(userTokenKeys);
+            // 因为存入的时候使用的是StringRedisTemplate取值也要用对应的对象,key序列化问题导致
+            List<String> tokenList = stringRedisTemplate.opsForValue().multiGet(userTokenKeys);
             List<String> userTokens = Optional.ofNullable(tokenList)
                     .orElse(Collections.emptyList())
                     .stream()
-                    .map(e -> Optional.ofNullable(e).map(Object::toString).orElse(""))
+                    .map(e -> Optional.ofNullable(e).orElse(""))
                     .collect(Collectors.toList());
 
             // 标注规范用户权限变更通知