From 52d8f2874ff4f835de55848365683b214ef41fdc Mon Sep 17 00:00:00 2001
From: liangzai <2440983361@qq.com>
Date: Thu, 10 Apr 2025 16:05:16 +0800
Subject: [PATCH] temp
---
src/layouts/GlobalLayout.vue | 2 +-
src/ui/CMarriage.vue | 4 +-
src/views/Example.vue | 136 +++++++++++++++--------------------
src/views/Report.vue | 114 ++++++++++++-----------------
4 files changed, 105 insertions(+), 151 deletions(-)
diff --git a/src/layouts/GlobalLayout.vue b/src/layouts/GlobalLayout.vue
index f98df9f..468fb35 100644
--- a/src/layouts/GlobalLayout.vue
+++ b/src/layouts/GlobalLayout.vue
@@ -24,7 +24,7 @@ const route = useRoute()
// 获取通知数据
onMounted(() => {
- getGlobalNotify()
+ // getGlobalNotify()
})
// 获取通知数据
diff --git a/src/ui/CMarriage.vue b/src/ui/CMarriage.vue
index 5695991..a79106a 100644
--- a/src/ui/CMarriage.vue
+++ b/src/ui/CMarriage.vue
@@ -50,7 +50,9 @@ const currentStatus =
text: "暂无相关婚姻记录",
bgClass: "bg-gray-200",
textClass: "text-gray-500",
- description: "由于民政部门系统正在升级,当前查询功能暂未恢复。
1. 当系统恢复查询功能时,我们将第一时间更新报告(您可以在我的历史查询记录中查看),并通过短信通知您。
2. 如果30个工作日内未能查询到相关信息,我们承诺将为您退款26.8元的婚姻状态查询费用。",
+ // description: "由于民政部门系统正在升级,当前查询功能暂未恢复。
1. 当系统恢复查询功能时,我们将第一时间更新报告(您可以在我的历史查询记录中查看),并通过短信通知您。
2. 如果30个工作日内未能查询到相关信息,我们承诺将为您退款26.8元的婚姻状态查询费用。",
+ description: "暂无婚姻相关记录",
+
} : {
text: "无相关记录",
bgClass: "bg-gray-200",
diff --git a/src/views/Example.vue b/src/views/Example.vue
index 5226452..f4d8237 100644
--- a/src/views/Example.vue
+++ b/src/views/Example.vue
@@ -113,7 +113,7 @@ const reportName = ref("")
const reportDateTime = ref(null)
const feature = ref("")
const isEmpty = ref(false)
-const reportScore = ref(75); // 默认分数
+const reportScore = ref(0); // 默认分数
onBeforeMount(() => {
const query = new URLSearchParams(window.location.search);
@@ -201,12 +201,12 @@ const maskValue = computed(() => {
// 计算综合评分的函数
const calculateScore = (reportData) => {
- // 从0分开始
+ // 从0分开始(0分表示无风险)
let score = 0;
- // 最高分为90分
+ // 最高分为90分(90分表示最高风险)
const maxScore = 90;
- // 定义各接口的相对权重比例(而非固定分值)
+ // 定义各接口的相对风险权重比例
const relativeWeights = {
// 关键风险指标(高优先级)
'G34BJ03': 250, // 不良记录
@@ -237,7 +237,7 @@ const calculateScore = (reportData) => {
const availableAPIs = reportData.map(item => item.data.apiID).filter(id => relativeWeights[id]);
// 如果没有可评分的接口,返回默认分数
- if (availableAPIs.length === 0) return 60; // 默认60分
+ if (availableAPIs.length === 0) return 30; // 默认30分(中等风险)
// 计算当前报告中所有接口的相对权重总和
let totalWeight = 0;
@@ -255,7 +255,7 @@ const calculateScore = (reportData) => {
actualWeights[apiID] = relativeWeights[apiID] * pointValue;
});
- // 遍历报告数据进行评分
+ // 遍历报告数据进行评分 - 风险越高分数越高
reportData.forEach(item => {
const apiID = item.data.apiID;
const data = item.data.data;
@@ -263,7 +263,7 @@ const calculateScore = (reportData) => {
// 如果没有定义权重,跳过
if (!actualWeights[apiID]) return;
- // 根据不同的API ID计算分数(只有没有风险或风险低时加分)
+ // 根据不同的API ID计算分数(有风险时加分)
switch (apiID) {
case 'G09SC02': // 婚姻状态
// 不计入风险
@@ -271,61 +271,58 @@ const calculateScore = (reportData) => {
case 'G27BJ05': // 借贷申请记录
if (data) {
- // 检查所有字段是否都为0(没有风险)
- let noRisk = true;
+ // 检查是否有申请记录(有则表示风险)
+ let hasRisk = false;
for (const key in data) {
- if (data[key] !== 0 && data[key] !== '0') {
- noRisk = false;
+ if (data[key] !== 0 && data[key] !== '0' &&
+ key.indexOf('allnum') > -1 &&
+ !isNaN(parseInt(data[key])) &&
+ parseInt(data[key]) > 0) {
+ hasRisk = true;
break;
}
}
- if (noRisk || !Object.keys(data).length) {
+ if (hasRisk) {
score += actualWeights[apiID];
}
- } else {
- // 无数据视为无风险
- score += actualWeights[apiID];
}
break;
case 'G28BJ05': // 借贷行为记录
if (data) {
- // 检查所有字段是否都为0(没有风险)
- let noRisk = true;
+ // 检查是否有借贷记录(有则表示风险)
+ let hasRisk = false;
for (const key in data) {
- if (data[key] !== 0 && data[key] !== '0') {
- noRisk = false;
+ if (data[key] !== 0 && data[key] !== '0' &&
+ (key.indexOf('lendamt') > -1 || key.indexOf('num') > -1) &&
+ !isNaN(parseInt(data[key])) &&
+ parseInt(data[key]) > 0) {
+ hasRisk = true;
break;
}
}
- if (noRisk || !Object.keys(data).length) {
+ if (hasRisk) {
score += actualWeights[apiID];
}
- } else {
- // 无数据视为无风险
- score += actualWeights[apiID];
}
break;
case 'G26BJ05': // 违约异常
if (data) {
- // 检查除特定字段外的其他字段是否都为0(没有风险)
+ // 检查除特定字段外的其他字段是否有异常值(有异常则表示风险)
const excludeFields = ['swift_number', 'code', 'flag_specialList_c'];
- let noRisk = true;
+ let hasRisk = false;
for (const key in data) {
if (!excludeFields.includes(key) && data[key] !== 0 && data[key] !== '0') {
- noRisk = false;
+ hasRisk = true;
break;
}
}
- if (noRisk || !Object.keys(data).length) {
+ if (hasRisk) {
score += actualWeights[apiID];
}
- } else {
- // 无数据视为无风险
- score += actualWeights[apiID];
}
break;
@@ -334,23 +331,20 @@ const calculateScore = (reportData) => {
// 根据风险等级加分
switch (data.risk_level) {
case 'A': // 无风险
- score += actualWeights[apiID];
+ // 不加分
break;
case 'F': // 低风险
- score += actualWeights[apiID] * 0.7;
+ score += actualWeights[apiID] * 0.3;
break;
case 'C': // 中风险
case 'D': // 中风险
- score += actualWeights[apiID] * 0.3;
+ score += actualWeights[apiID] * 0.7;
break;
case 'B': // 高风险
case 'E': // 高风险
- // 不加分
+ score += actualWeights[apiID];
break;
}
- } else {
- // 无数据视为无风险
- score += actualWeights[apiID];
}
break;
@@ -385,12 +379,9 @@ const calculateScore = (reportData) => {
hasRisk = true;
}
- if (!hasRisk) {
+ if (hasRisk) {
score += actualWeights[apiID];
}
- } else {
- // 无数据视为无风险
- score += actualWeights[apiID];
}
break;
@@ -399,38 +390,29 @@ const calculateScore = (reportData) => {
// 根据filterType判断风险等级
switch (data.filterType) {
case '0': // 安全
- score += actualWeights[apiID];
- break;
- case '3': // 低危
- score += actualWeights[apiID] * 0.7;
- break;
- case '2': // 中危
- score += actualWeights[apiID] * 0.3;
- break;
- case '1': // 高危
// 不加分
break;
+ case '3': // 低危
+ score += actualWeights[apiID] * 0.3;
+ break;
+ case '2': // 中危
+ score += actualWeights[apiID] * 0.7;
+ break;
+ case '1': // 高危
+ score += actualWeights[apiID];
+ break;
}
- } else {
- // 无数据视为无风险
- score += actualWeights[apiID];
}
break;
case 'G19BJ02': // 手机二次卡
- if (data && data.is_second_card === false) {
- score += actualWeights[apiID];
- } else if (!data) {
- // 无数据视为无风险
+ if (data && data.is_second_card === true) {
score += actualWeights[apiID];
}
break;
case 'G02BJ02': // 手机在网时长
- if (data && data.online_months >= 6) {
- score += actualWeights[apiID];
- } else if (!data) {
- // 无数据视为无风险
+ if (data && data.online_months < 6) {
score += actualWeights[apiID];
}
break;
@@ -439,19 +421,13 @@ const calculateScore = (reportData) => {
case 'G17BJ02': // 手机号二要素
case 'KZEYS': // 身份证二要素
case 'G20GZ01': // 银行卡四要素核验
- if (data && data.is_consistent) {
- score += actualWeights[apiID];
- } else if (!data) {
- // 无数据视为无风险
+ if (data && data.is_consistent === false) {
score += actualWeights[apiID];
}
break;
case 'FIN019': // 银行卡黑名单
- if (data && data.is_blacklisted === false) {
- score += actualWeights[apiID];
- } else if (!data) {
- // 无数据视为无风险
+ if (data && data.is_blacklisted === true) {
score += actualWeights[apiID];
}
break;
@@ -506,7 +482,7 @@ const calculateScore = (reportData) => {