优化涉疑交易模型口径和报告展示

This commit is contained in:
wjj
2026-05-26 16:37:16 +08:00
parent ef8147892e
commit 180a892275
16 changed files with 672 additions and 75 deletions

View File

@@ -353,7 +353,61 @@ const SUSPICIOUS_TYPE_OPTIONS = [
{ value: "MODEL_RULE", label: "模型规则命中" },
];
const normalizeHitTags = (hitTags) => (Array.isArray(hitTags) ? hitTags : []);
const normalizeSuspiciousType = (value) => (
SUSPICIOUS_TYPE_OPTIONS.some((item) => item.value === value) ? value : "ALL"
);
const ABNORMAL_CUSTOMER_TRANSACTION_RULE_CODE = "ABNORMAL_CUSTOMER_TRANSACTION";
const ABNORMAL_CUSTOMER_TRANSACTION_RULE_NAME = "与客户之间非正常资金往来";
const resolveAbnormalCustomerTransactionRuleName = (nameListHitType) => {
if (nameListHitType === "中介") {
return "疑似与中介往来";
}
if (nameListHitType === "信贷客户") {
return "与信贷客户之间非正常资金往来";
}
return ABNORMAL_CUSTOMER_TRANSACTION_RULE_NAME;
};
const normalizeRuleName = (tag, context) => {
if (!tag) {
return "";
}
if (
tag.ruleCode === ABNORMAL_CUSTOMER_TRANSACTION_RULE_CODE
|| tag.ruleName === "异常交易"
|| tag.ruleName === ABNORMAL_CUSTOMER_TRANSACTION_RULE_NAME
) {
return resolveAbnormalCustomerTransactionRuleName(context && context.nameListHitType);
}
return tag.ruleName || "";
};
const normalizeHitTags = (hitTags, context = {}) => {
if (!Array.isArray(hitTags)) {
return [];
}
const seen = new Set();
return hitTags
.map((tag) => ({
...tag,
ruleName: normalizeRuleName(tag, context),
}))
.filter((tag) => {
const key = `${tag.ruleCode || ""}|${tag.ruleName || ""}`;
if (seen.has(key)) {
return false;
}
seen.add(key);
return true;
})
.sort((left, right) => {
const leftPriority = left.ruleCode === ABNORMAL_CUSTOMER_TRANSACTION_RULE_CODE ? 0 : 1;
const rightPriority = right.ruleCode === ABNORMAL_CUSTOMER_TRANSACTION_RULE_CODE ? 0 : 1;
return leftPriority - rightPriority;
});
};
const createEmptyDetailData = () => ({
bankStatementId: "",
@@ -443,7 +497,7 @@ export default {
deep: true,
handler(value) {
this.projectId = value && value.projectId ? value.projectId : null;
this.currentSuspiciousType = value && value.suspiciousType ? value.suspiciousType : "ALL";
this.currentSuspiciousType = normalizeSuspiciousType(value && value.suspiciousType);
this.suspiciousPageNum = 1;
this.suspiciousPageSize = 5;
this.suspiciousTotal = Number(value && value.total) || 0;
@@ -603,7 +657,7 @@ export default {
return {
...detail,
...row,
hitTags: normalizeHitTags(detail.hitTags),
hitTags: normalizeHitTags(detail.hitTags, row),
};
} catch (error) {
return {
@@ -647,7 +701,14 @@ export default {
this.detailVisible = true;
this.detailLoading = true;
try {
this.detailData = await this.fetchStatementDetail(row.bankStatementId, false);
const detail = await this.fetchStatementDetail(row.bankStatementId, false);
this.detailData = {
...detail,
...row,
hitTags: row && Array.isArray(row.hitTags) && row.hitTags.length
? normalizeHitTags(row.hitTags, row)
: normalizeHitTags(detail.hitTags, row),
};
} catch (error) {
this.detailData = createEmptyDetailData();
this.$message.error("加载流水详情失败");