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

This commit is contained in:
wjj
2026-05-26 16:37:16 +08:00
committed by wkc
parent 9d3e8beceb
commit 000e8698a5
16 changed files with 672 additions and 75 deletions

View File

@@ -27,7 +27,7 @@
:disabled="!projectId"
@click="handleOverviewReportExport"
>
一键导出
导出报告
</el-button>
</div>
<overview-stats :summary="currentData.summary" />

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("加载流水详情失败");

View File

@@ -126,10 +126,10 @@
type="textarea"
:rows="5"
:disabled="isProjectTagging || isProjectArchived"
placeholder="支持逗号、中文逗号、换行分隔"
placeholder="支持英文逗号分隔"
/>
<div class="pull-bank-field-tip">
支持逗号中文逗号换行分隔文件解析结果会自动合并并去重
支持英文逗号分隔文件解析结果会自动合并并去重
</div>
</el-form-item>
<el-form-item label="身份证文件">
@@ -424,7 +424,7 @@ export default {
resetPullBankInfoForm() {
this.pullBankInfoForm = {
idCardText: "",
dateRange: [],
dateRange: this.buildDefaultPullBankInfoDateRange(),
};
this.idCardFileList = [];
this.parsingIdCardFile = false;
@@ -434,7 +434,7 @@ export default {
return Array.from(
new Set(
(text || "")
.split(/[\n,]+/)
.split(/,+/)
.map((item) => item.trim())
.filter(Boolean)
)
@@ -504,11 +504,36 @@ export default {
today.setHours(0, 0, 0, 0);
return today;
},
getPullBankInfoMinSelectableDate() {
return new Date(2025, 0, 1);
},
getPullBankInfoMaxSelectableDate() {
const yesterday = this.getPullBankInfoTodayStart();
yesterday.setDate(yesterday.getDate() - 1);
return yesterday;
},
formatPullBankInfoDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
},
buildDefaultPullBankInfoDateRange() {
const minSelectableDate = this.getPullBankInfoMinSelectableDate();
const maxSelectableDate = this.getPullBankInfoMaxSelectableDate();
const defaultStartDate = new Date(maxSelectableDate.getTime());
defaultStartDate.setFullYear(defaultStartDate.getFullYear() - 1);
if (defaultStartDate.getTime() < minSelectableDate.getTime()) {
return [
this.formatPullBankInfoDate(minSelectableDate),
this.formatPullBankInfoDate(maxSelectableDate),
];
}
return [
this.formatPullBankInfoDate(defaultStartDate),
this.formatPullBankInfoDate(maxSelectableDate),
];
},
parsePullBankInfoDate(dateValue) {
if (!dateValue) return null;
const [year, month, day] = String(dateValue)
@@ -520,13 +545,23 @@ export default {
return new Date(year, month - 1, day);
},
isPullBankInfoDateDisabled(time) {
return time.getTime() >= this.getPullBankInfoTodayStart().getTime();
const minSelectableDate = this.getPullBankInfoMinSelectableDate();
const todayStart = this.getPullBankInfoTodayStart();
return (
time.getTime() < minSelectableDate.getTime() ||
time.getTime() >= todayStart.getTime()
);
},
hasInvalidPullBankInfoDateRange(dateRange) {
const minSelectableDate = this.getPullBankInfoMinSelectableDate();
const maxSelectableDate = this.getPullBankInfoMaxSelectableDate();
return (dateRange || []).some((dateValue) => {
const date = this.parsePullBankInfoDate(dateValue);
return !date || date.getTime() > maxSelectableDate.getTime();
return (
!date ||
date.getTime() < minSelectableDate.getTime() ||
date.getTime() > maxSelectableDate.getTime()
);
});
},
buildFinalIdCardList() {
@@ -555,7 +590,7 @@ export default {
}
if (this.hasInvalidPullBankInfoDateRange([startDate, endDate])) {
this.$message.warning("时间跨度最晚只能选择到昨天");
this.$message.warning("时间跨度仅支持 2025-01-01 至昨天");
return;
}