This commit is contained in:
2025-04-10 16:05:16 +08:00
parent bbeb97db21
commit 52d8f2874f
4 changed files with 105 additions and 151 deletions

View File

@@ -24,7 +24,7 @@ const route = useRoute()
// 获取通知数据
onMounted(() => {
getGlobalNotify()
// getGlobalNotify()
})
// 获取通知数据

View File

@@ -50,7 +50,9 @@ const currentStatus =
text: "暂无相关婚姻记录",
bgClass: "bg-gray-200",
textClass: "text-gray-500",
description: "由于民政部门系统正在升级,当前查询功能暂未恢复。<br />1. 当系统恢复查询功能时,我们将第一时间更新报告(您可以在我的历史查询记录中查看),并通过短信通知您。<br />2. 如果30个工作日内未能查询到相关信息我们承诺将为您退款26.8元的婚姻状态查询费用。",
// description: "由于民政部门系统正在升级,当前查询功能暂未恢复。<br />1. 当系统恢复查询功能时,我们将第一时间更新报告(您可以在我的历史查询记录中查看),并通过短信通知您。<br />2. 如果30个工作日内未能查询到相关信息我们承诺将为您退款26.8元的婚姻状态查询费用。",
description: "暂无婚姻相关记录",
} : {
text: "无相关记录",
bgClass: "bg-gray-200",

View File

@@ -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;
}
} else {
// 无数据视为无风险
case '3': // 低危
score += actualWeights[apiID] * 0.3;
break;
case '2': // 中危
score += actualWeights[apiID] * 0.7;
break;
case '1': // 高危
score += actualWeights[apiID];
break;
}
}
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;

View File

@@ -111,6 +111,7 @@ const orderId = ref(null);
const orderNo = ref("")
const isEmpty = ref(false)
const isPending = ref(false)
const reportScore = ref(0)
onBeforeMount(() => {
const query = new URLSearchParams(window.location.search);
orderNo.value = query.get("out_trade_no");
@@ -126,12 +127,12 @@ onBeforeMount(() => {
// 计算综合评分的函数
const calculateScore = (reportData) => {
// 从0分开始
// 从0分开始0分表示无风险
let score = 0;
// 最高分为90分
// 最高分为90分90分表示最高风险
const maxScore = 90;
// 定义各接口的相对权重比例(而非固定分值)
// 定义各接口的相对风险权重比例
const relativeWeights = {
// 关键风险指标(高优先级)
'G34BJ03': 250, // 不良记录
@@ -162,7 +163,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;
@@ -180,7 +181,7 @@ const calculateScore = (reportData) => {
actualWeights[apiID] = relativeWeights[apiID] * pointValue;
});
// 遍历报告数据进行评分
// 遍历报告数据进行评分 - 风险越高分数越高
reportData.forEach(item => {
const apiID = item.data.apiID;
const data = item.data.data;
@@ -188,7 +189,7 @@ const calculateScore = (reportData) => {
// 如果没有定义权重,跳过
if (!actualWeights[apiID]) return;
// 根据不同的API ID计算分数只有没有风险或风险低时加分)
// 根据不同的API ID计算分数有风险时加分)
switch (apiID) {
case 'G09SC02': // 婚姻状态
// 不计入风险
@@ -196,61 +197,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;
@@ -259,23 +257,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;
@@ -310,12 +305,9 @@ const calculateScore = (reportData) => {
hasRisk = true;
}
if (!hasRisk) {
if (hasRisk) {
score += actualWeights[apiID];
}
} else {
// 无数据视为无风险
score += actualWeights[apiID];
}
break;
@@ -324,38 +316,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;
}
} else {
// 无数据视为无风险
case '3': // 低危
score += actualWeights[apiID] * 0.3;
break;
case '2': // 中危
score += actualWeights[apiID] * 0.7;
break;
case '1': // 高危
score += actualWeights[apiID];
break;
}
}
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;
@@ -364,19 +347,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;
@@ -423,7 +400,6 @@ const getReport = async () => {
isPending.value = true
}
isDone.value = true
console.log(isDone.value)
}
}