Răsfoiți Sursa

feature: 日志报送字段修改

mazq 2 ani în urmă
părinte
comite
4f89972cfc

+ 1 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/audit/dto/AuthenticationLogDto.java

@@ -12,6 +12,7 @@ import java.util.List;
  */
 @Data
 public class AuthenticationLogDto {
+    private String userId;
     private String userName;
     private String userIdcard;
     private String requesterName;

+ 12 - 0
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/audit/dto/AuthorizeObjectDto.java

@@ -12,6 +12,11 @@ public class AuthorizeObjectDto {
      */
     private String objectName;
 
+    /**
+     * 客体资源标识code
+     */
+    private String objectCode;
+
     /**
      * 客体id
      */
@@ -34,4 +39,11 @@ public class AuthorizeObjectDto {
         this.objectId = objectId;
     }
 
+    public String getObjectCode() {
+        return objectCode;
+    }
+
+    public void setObjectCode(String objectCode) {
+        this.objectCode = objectCode;
+    }
 }

+ 0 - 4
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/listener/AuthenticationLogListener.java

@@ -1,7 +1,6 @@
 package com.dragoninfo.dcuc.auth.audit.listener;
 
 import com.alibaba.fastjson.JSON;
-import com.dragoninfo.dcuc.auth.audit.dto.AuthenticationContentDto;
 import com.dragoninfo.dcuc.auth.audit.dto.AuthenticationLogDto;
 import com.dragoninfo.dcuc.auth.audit.entity.AuthenticationContent;
 import com.dragoninfo.dcuc.auth.audit.entity.AuthenticationLog;
@@ -16,9 +15,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.kafka.annotation.KafkaListener;
-import org.springframework.stereotype.Component;
 
 import java.io.ByteArrayInputStream;
 import java.io.ObjectInputStream;
@@ -98,7 +95,6 @@ public class AuthenticationLogListener {
         authenticationLogService.saveContents(authenticationContents);
 
         authenticationLogDto.setAuthTaskId(id.toString());
-
     }
 
 }

+ 1 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/log/DataAuthLogHandler.java

@@ -198,6 +198,7 @@ public class DataAuthLogHandler {
         }).collect(Collectors.toList());
 
         AuthenticationLogDto authenticationLogDto = new AuthenticationLogDto();
+        authenticationLogDto.setUserId(userInfo.getId());
         authenticationLogDto.setUserName(userInfo.getName());
         authenticationLogDto.setUserIdcard(dataItemsCheckDto.getIdcard());
         authenticationLogDto.setCreateTime(new Date());

+ 1 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/log/FunAuthLogHandler.java

@@ -56,6 +56,7 @@ public class FunAuthLogHandler {
         }).collect(Collectors.toList());
 
         AuthenticationLogDto authenticationLogDto = new AuthenticationLogDto();
+        authenticationLogDto.setUserId(userInfo.getId());
         authenticationLogDto.setUserName(userInfo.getName());
         authenticationLogDto.setUserIdcard(dto.getIdcard());
         authenticationLogDto.setRequesterName(app.getApplyName());

+ 7 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/log/QmAuditPushService.java

@@ -168,8 +168,13 @@ public class QmAuditPushService {
                     .stream()
                     .map(AuthorizeObjectDto::getObjectName)
                     .collect(Collectors.joining(StrUtil.COMMA));
-            //设置角色名称
+            String roleCodes = objectDtos.stream()
+                    .map(AuthorizeObjectDto::getObjectCode)
+                    .collect(Collectors.joining(StrUtil.COMMA));
+            //设置客体名称
             authBusLog.setRoleNames(roleNames);
+            // 设置客体标识
+            authBusLog.setRoleCodes(roleCodes);
 
             //设置终端ip
             authBusLog.setTerminalIP(authorizeLogDto.getTerminalIP());
@@ -232,6 +237,7 @@ public class QmAuditPushService {
         busLog.setOrgcode(dto.getUserOrgCode());
         busLog.setOrgcodename(dto.getUserOrgName());
         busLog.setUserToken(dto.getUserToken());
+        busLog.setAuthId(dto.getUserId());
         List<AuthenticationContentDto> content = dto.getContent();
         getAuthenticationContent(authType, busLog, content);
         list.add(busLog);

+ 1 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/log/RoleViewAuthLogHandler.java

@@ -140,6 +140,7 @@ public class RoleViewAuthLogHandler {
         RoleInfo roleInfo = iRoleInfoService.getRoleInfoByRoleId(roleId);
         authorizeObjectDto.setObjectName(roleInfo.getName());
         authorizeObjectDto.setObjectId(roleId);
+        authorizeObjectDto.setObjectCode(roleInfo.getCode());
         return authorizeObjectDto;
     }
 

+ 5 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/log/ServiceAuthLogHandler.java

@@ -66,6 +66,7 @@ public class ServiceAuthLogHandler {
         AuthorizeObjectDto authorizeObjectDto = new AuthorizeObjectDto();
         authorizeObjectDto.setObjectName(serviceName);
         authorizeObjectDto.setObjectId(serviceCode);
+        authorizeObjectDto.setObjectCode(serviceCode);
 
         AuthorizeSubjectDto authorizeSubjectDto = new AuthorizeSubjectDto();
         authorizeSubjectDto.setSubjectId(app.getApplyCode());
@@ -100,6 +101,7 @@ public class ServiceAuthLogHandler {
         }).collect(Collectors.toList());
 
         AuthenticationLogDto authenticationLogDto = new AuthenticationLogDto();
+        authenticationLogDto.setUserId(userInfo.getId());
         authenticationLogDto.setUserName(userInfo.getName());
         authenticationLogDto.setUserIdcard(idcard);
         authenticationLogDto.setRequesterName(app.getApplyName());
@@ -148,6 +150,7 @@ public class ServiceAuthLogHandler {
         AuthorizeObjectDto authorizeObjectDto = new AuthorizeObjectDto();
         authorizeObjectDto.setObjectName(serviceName);
         authorizeObjectDto.setObjectId(serviceCode);
+        authorizeObjectDto.setObjectCode(serviceCode);
 
         AuthorizeSubjectDto authorizeSubjectDto = new AuthorizeSubjectDto();
         authorizeSubjectDto.setSubjectId(appId);
@@ -186,6 +189,7 @@ public class ServiceAuthLogHandler {
             AuthorizeObjectDto authorizeObjectDto = new AuthorizeObjectDto();
             authorizeObjectDto.setObjectName(serviceName);
             authorizeObjectDto.setObjectId(e);
+            authorizeObjectDto.setObjectCode(serviceResource.getServiceCode());
             return authorizeObjectDto;
         }).collect(Collectors.toList());
 
@@ -222,6 +226,7 @@ public class ServiceAuthLogHandler {
             AuthorizeObjectDto authorizeObjectDto = new AuthorizeObjectDto();
             authorizeObjectDto.setObjectName(serviceName);
             authorizeObjectDto.setObjectId(e);
+            authorizeObjectDto.setObjectCode(serviceResource.getServiceCode());
             return authorizeObjectDto;
         }).collect(Collectors.toList());
 

+ 3 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/audit/service/log/UserViewAuthLogHandler.java

@@ -112,8 +112,10 @@ public class UserViewAuthLogHandler {
         return roleIds.stream()
                 .map(roleId -> {
                     AuthorizeObjectDto authorizeObjectDto = new AuthorizeObjectDto();
-                    authorizeObjectDto.setObjectName(Optional.ofNullable(iRoleInfoService.getRoleInfoByRoleId(roleId)).map(RoleInfo::getName).orElse(""));
+                    RoleInfo roleInfo = iRoleInfoService.getRoleInfoByRoleId(roleId);
+                    authorizeObjectDto.setObjectName(Optional.ofNullable(roleInfo).map(RoleInfo::getName).orElse(""));
                     authorizeObjectDto.setObjectId(roleId);
+                    authorizeObjectDto.setObjectCode(Optional.ofNullable(roleInfo).map(RoleInfo::getCode).orElse(""));
                     return authorizeObjectDto;
                 }).collect(Collectors.toList());
     }