|
@@ -17,6 +17,7 @@ import com.dragonsoft.auditlog.collection.qmtj.LogSendComponent;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthBusLog;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthBusLog;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationBusLog;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationBusLog;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationBusLogV2;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationBusLogV2;
|
|
|
|
+import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationBusLogV3;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationRiskLog;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.AuthenticationRiskLog;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.TokenOperationLog;
|
|
import com.dragonsoft.auditlog.collection.qmtj.pojo.req.TokenOperationLog;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
@@ -127,13 +128,41 @@ public class QmAuditPushService {
|
|
*
|
|
*
|
|
* @param authenticationLogDto
|
|
* @param authenticationLogDto
|
|
*/
|
|
*/
|
|
- public void pushAuthenticationLog(AuthenticationLogDtoV2 authenticationLogDto) {
|
|
|
|
|
|
+ public void pushAuthenticationLog(AuthenticationLogDto authenticationLogDto) {
|
|
Boolean qmEnabled = config.getQmEnabled();
|
|
Boolean qmEnabled = config.getQmEnabled();
|
|
if (null == qmEnabled || !qmEnabled) {
|
|
if (null == qmEnabled || !qmEnabled) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
executor.execute(() -> pushAuthenticationLogToAudit(authenticationLogDto));
|
|
executor.execute(() -> pushAuthenticationLogToAudit(authenticationLogDto));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 推送鉴权日志
|
|
|
|
+ *
|
|
|
|
+ * @param authenticationLogDto
|
|
|
|
+ */
|
|
|
|
+ private void pushAuthenticationLogToAudit(AuthenticationLogDto authenticationLogDto) {
|
|
|
|
+ String sysId = config.getSysId();
|
|
|
|
+ String logType = AuditConstance.AUDIT_LOG_TYPE_JQ;
|
|
|
|
+ List<AuthenticationBusLog> busLogs = getAuthenticationBusLog(authenticationLogDto);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(busLogs)) {
|
|
|
|
+ log.info("=========推送审计鉴权日志=======");
|
|
|
|
+ logSendComponent.sendAuthenticationBusLog(sysId, logType, busLogs);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 推送鉴权日志V2
|
|
|
|
+ *
|
|
|
|
+ * @param authenticationLogDto
|
|
|
|
+ */
|
|
|
|
+ public void pushAuthenticationLog(AuthenticationLogDtoV2 authenticationLogDto) {
|
|
|
|
+ Boolean qmEnabled = config.getQmEnabled();
|
|
|
|
+ if (null == qmEnabled || !qmEnabled) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ executor.execute(() -> pushAuthenticationLogToAuditV2(authenticationLogDto));
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 推送风险日志
|
|
* 推送风险日志
|
|
@@ -255,7 +284,7 @@ public class QmAuditPushService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private void pushAuthenticationLogToAudit(AuthenticationLogDtoV2 authenticationLogDto) {
|
|
|
|
|
|
+ private void pushAuthenticationLogToAuditV2(AuthenticationLogDtoV2 authenticationLogDto) {
|
|
String sysId = config.getSysId();
|
|
String sysId = config.getSysId();
|
|
String logType = AuditConstance.AUDIT_LOG_TYPE_JQ;
|
|
String logType = AuditConstance.AUDIT_LOG_TYPE_JQ;
|
|
List<AuthenticationBusLogV2> busLogs = constructAuthenticationBusLogsV2(authenticationLogDto);
|
|
List<AuthenticationBusLogV2> busLogs = constructAuthenticationBusLogsV2(authenticationLogDto);
|
|
@@ -264,7 +293,7 @@ public class QmAuditPushService {
|
|
try {
|
|
try {
|
|
String writeValueAsString = mapper.writeValueAsString(busLogs);
|
|
String writeValueAsString = mapper.writeValueAsString(busLogs);
|
|
JSONArray jsonArray = JSONObject.parseArray(writeValueAsString);
|
|
JSONArray jsonArray = JSONObject.parseArray(writeValueAsString);
|
|
- log.info("=========推送审计鉴权日志=======");
|
|
|
|
|
|
+ log.info("=========推送审计鉴权日志V2=======");
|
|
logSendComponent.sendAuthenticationBusLogV2(sysId, logType, jsonArray);
|
|
logSendComponent.sendAuthenticationBusLogV2(sysId, logType, jsonArray);
|
|
} catch (JsonProcessingException e) {
|
|
} catch (JsonProcessingException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -272,6 +301,26 @@ public class QmAuditPushService {
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(AuthenticationTypeEnum.FWJJQ.getValue().equals(authenticationLogDto.getAuthenticationType())) {
|
|
|
|
+
|
|
|
|
+ //审计中心日志对接
|
|
|
|
+ List<AuthenticationBusLogV3> busLogsV3 = constructAuthenticationBusLogsV3(authenticationLogDto);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(busLogsV3)) {
|
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
|
+ try {
|
|
|
|
+ String writeValueAsString = mapper.writeValueAsString(busLogsV3);
|
|
|
|
+ JSONArray jsonArray = JSONObject.parseArray(writeValueAsString);
|
|
|
|
+ log.info("=========推送审计中心鉴权日志V3=======");
|
|
|
|
+ logSendComponent.sendAuthenticationBusLogV3(sysId, "101", jsonArray);
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private List<AuthenticationBusLog> getAuthenticationBusLog(AuthenticationLogDto authenticationLogDto) {
|
|
private List<AuthenticationBusLog> getAuthenticationBusLog(AuthenticationLogDto authenticationLogDto) {
|
|
@@ -347,6 +396,40 @@ public class QmAuditPushService {
|
|
list.add(busLog);
|
|
list.add(busLog);
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 对接审计中心
|
|
|
|
+ * @param dto
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private List<AuthenticationBusLogV3> constructAuthenticationBusLogsV3(AuthenticationLogDtoV2 dto) {
|
|
|
|
+ List<AuthenticationBusLogV3> list = new ArrayList<>();
|
|
|
|
+ if (StringUtils.isBlank(dto.getAuthenticationType())) {
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+ AuthenticationBusLogV3 busLog = new AuthenticationBusLogV3();
|
|
|
|
+
|
|
|
|
+ Map<String,Object> baseStandardInfo = new HashMap<>();
|
|
|
|
+ baseStandardInfo.put("appName", dto.getAppName());
|
|
|
|
+ baseStandardInfo.put("operatorCertNo", dto.getUserIdcard());
|
|
|
|
+ baseStandardInfo.put("operatorName", dto.getUserName());
|
|
|
|
+ baseStandardInfo.put("operatorOrgCode", dto.getUserOrgCode());
|
|
|
|
+ baseStandardInfo.put("operatorOrgName", dto.getUserOrgName());
|
|
|
|
+ baseStandardInfo.put("terminalId", dto.getTerminalId());
|
|
|
|
+ baseStandardInfo.put("terminalIp", dto.getTerminalIp());
|
|
|
|
+ baseStandardInfo.put("terminalType", dto.getTerminalType());
|
|
|
|
+ busLog.setBaseStandardInfo(baseStandardInfo);
|
|
|
|
+ busLog.setTaskId(dto.getTaskId());
|
|
|
|
+ busLog.setTaskName(dto.getTaskName());
|
|
|
|
+ busLog.setBusinessAppName(dto.getBusinessAppName());
|
|
|
|
+ busLog.setAuthTime(DateUtil.format(dto.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ busLog.setAuthType("04"); //服务级
|
|
|
|
+ busLog.setAuthCode(dto.getAuthCode());
|
|
|
|
+ busLog.setAuthResponse(dto.getAuthResponse());
|
|
|
|
+ list.add(busLog);
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
|
|
private void getAuthenticationContent(String authType, AuthenticationBusLog busLog, List<AuthenticationContentDto> content) {
|
|
private void getAuthenticationContent(String authType, AuthenticationBusLog busLog, List<AuthenticationContentDto> content) {
|
|
String codes = "";
|
|
String codes = "";
|