|
@@ -22,7 +22,7 @@ from post_clear_check.chain import (
|
|
|
INDEX_MARK,
|
|
INDEX_MARK,
|
|
|
STATUS_MARK,
|
|
STATUS_MARK,
|
|
|
)
|
|
)
|
|
|
-from post_clear_check.feishu import FeishuError, card_text
|
|
|
|
|
|
|
+from post_clear_check.feishu import FeishuError, card_text, emphasize_verdict_block
|
|
|
from post_clear_check.gate import (
|
|
from post_clear_check.gate import (
|
|
|
FORMULA_DAYCUT,
|
|
FORMULA_DAYCUT,
|
|
|
FORMULA_EARLY_REPORT,
|
|
FORMULA_EARLY_REPORT,
|
|
@@ -356,14 +356,17 @@ def _field_blocks(rows: Sequence[_View]) -> list[str]:
|
|
|
actual = f"{shown} 无差异" if verdict == VERDICT_CORRECT else _actual(sample)
|
|
actual = f"{shown} 无差异" if verdict == VERDICT_CORRECT else _actual(sample)
|
|
|
label = {VERDICT_CORRECT: "正确", VERDICT_ERROR: "错误", VERDICT_SUSPECT: "可疑"}[verdict]
|
|
label = {VERDICT_CORRECT: "正确", VERDICT_ERROR: "错误", VERDICT_SUSPECT: "可疑"}[verdict]
|
|
|
blocks.append(
|
|
blocks.append(
|
|
|
- _lines(
|
|
|
|
|
- (
|
|
|
|
|
- f"字段:{_clear_title(formula)}",
|
|
|
|
|
- f"期望:{_expect(sample) if verdict != VERDICT_CORRECT else formula}",
|
|
|
|
|
- f"实据:{actual}",
|
|
|
|
|
- f"依据:{basis}",
|
|
|
|
|
- f"结论:{label}({correct}/{len(group)})",
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ emphasize_verdict_block(
|
|
|
|
|
+ _lines(
|
|
|
|
|
+ (
|
|
|
|
|
+ f"字段:{_clear_title(formula)}",
|
|
|
|
|
+ f"期望:{_expect(sample) if verdict != VERDICT_CORRECT else formula}",
|
|
|
|
|
+ f"实据:{actual}",
|
|
|
|
|
+ f"依据:{basis}",
|
|
|
|
|
+ f"结论:{label}({correct}/{len(group)})",
|
|
|
|
|
+ )
|
|
|
|
|
+ ),
|
|
|
|
|
+ verdict,
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
return blocks
|
|
return blocks
|
|
@@ -436,15 +439,18 @@ def _report_block(rows: Sequence[_View], business_date: date) -> str:
|
|
|
bases = _unique(view.basis for view in rows if view.basis)
|
|
bases = _unique(view.basis for view in rows if view.basis)
|
|
|
label_text = {VERDICT_CORRECT: "正确", VERDICT_ERROR: "错误", VERDICT_SUSPECT: "可疑"}[verdict]
|
|
label_text = {VERDICT_CORRECT: "正确", VERDICT_ERROR: "错误", VERDICT_SUSPECT: "可疑"}[verdict]
|
|
|
actual = f"{len(rows)} 列无差异" if verdict == VERDICT_CORRECT else f"{correct}/{len(rows)} 列无差异,其余见下方清单"
|
|
actual = f"{len(rows)} 列无差异" if verdict == VERDICT_CORRECT else f"{correct}/{len(rows)} 列无差异,其余见下方清单"
|
|
|
- return _lines(
|
|
|
|
|
- (
|
|
|
|
|
- f"报表:{label}",
|
|
|
|
|
- f"筛选:{screen}",
|
|
|
|
|
- _expect_line(names),
|
|
|
|
|
- f"实据:{actual}",
|
|
|
|
|
- _basis_line(bases or ["见各列登记"]),
|
|
|
|
|
- f"结论:{label_text}",
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ return emphasize_verdict_block(
|
|
|
|
|
+ _lines(
|
|
|
|
|
+ (
|
|
|
|
|
+ f"报表:{label}",
|
|
|
|
|
+ f"筛选:{screen}",
|
|
|
|
|
+ _expect_line(names),
|
|
|
|
|
+ f"实据:{actual}",
|
|
|
|
|
+ _basis_line(bases or ["见各列登记"]),
|
|
|
|
|
+ f"结论:{label_text}",
|
|
|
|
|
+ )
|
|
|
|
|
+ ),
|
|
|
|
|
+ verdict,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -462,15 +468,18 @@ def _step_block(formula: str, rows: Sequence[_View], business_date: date) -> str
|
|
|
bases = _unique(view.basis for view in rows if view.basis)
|
|
bases = _unique(view.basis for view in rows if view.basis)
|
|
|
label_text = {VERDICT_CORRECT: "正确", VERDICT_ERROR: "错误", VERDICT_SUSPECT: "可疑"}[verdict]
|
|
label_text = {VERDICT_CORRECT: "正确", VERDICT_ERROR: "错误", VERDICT_SUSPECT: "可疑"}[verdict]
|
|
|
actual = f"{len(rows)} 条无差异" if verdict == VERDICT_CORRECT else f"{correct}/{len(rows)} 条无差异,其余见下方清单"
|
|
actual = f"{len(rows)} 条无差异" if verdict == VERDICT_CORRECT else f"{correct}/{len(rows)} 条无差异,其余见下方清单"
|
|
|
- return _lines(
|
|
|
|
|
- (
|
|
|
|
|
- f"步骤:{_step_name(formula)}",
|
|
|
|
|
- f"筛选:{screen}",
|
|
|
|
|
- _expect_line([formula]),
|
|
|
|
|
- f"实据:{actual}",
|
|
|
|
|
- _basis_line(bases or ["见各列登记"]),
|
|
|
|
|
- f"结论:{label_text}",
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ return emphasize_verdict_block(
|
|
|
|
|
+ _lines(
|
|
|
|
|
+ (
|
|
|
|
|
+ f"步骤:{_step_name(formula)}",
|
|
|
|
|
+ f"筛选:{screen}",
|
|
|
|
|
+ _expect_line([formula]),
|
|
|
|
|
+ f"实据:{actual}",
|
|
|
|
|
+ _basis_line(bases or ["见各列登记"]),
|
|
|
|
|
+ f"结论:{label_text}",
|
|
|
|
|
+ )
|
|
|
|
|
+ ),
|
|
|
|
|
+ verdict,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -567,18 +576,22 @@ def _detail(view: _View) -> str:
|
|
|
if view.basis:
|
|
if view.basis:
|
|
|
rows.append(f"依据:{view.basis}")
|
|
rows.append(f"依据:{view.basis}")
|
|
|
rows.append(_conclusion(view))
|
|
rows.append(_conclusion(view))
|
|
|
- return _lines(rows)
|
|
|
|
|
|
|
+ # 错误清单红加粗;可疑清单与无法展开同款黄标签结论。
|
|
|
|
|
+ return emphasize_verdict_block(_lines(rows), view.verdict)
|
|
|
|
|
|
|
|
|
|
|
|
|
def _gate_block(view: _View) -> str:
|
|
def _gate_block(view: _View) -> str:
|
|
|
- return _lines(
|
|
|
|
|
- (
|
|
|
|
|
- f"字段:{view.formula_text}",
|
|
|
|
|
- f"期望:{view.check_text or view.formula_text}",
|
|
|
|
|
- f"实据:{view.calc_text or '当前缺失'}",
|
|
|
|
|
- f"依据:{view.basis}",
|
|
|
|
|
- _conclusion(view),
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ return emphasize_verdict_block(
|
|
|
|
|
+ _lines(
|
|
|
|
|
+ (
|
|
|
|
|
+ f"字段:{view.formula_text}",
|
|
|
|
|
+ f"期望:{view.check_text or view.formula_text}",
|
|
|
|
|
+ f"实据:{view.calc_text or '当前缺失'}",
|
|
|
|
|
+ f"依据:{view.basis}",
|
|
|
|
|
+ _conclusion(view),
|
|
|
|
|
+ )
|
|
|
|
|
+ ),
|
|
|
|
|
+ view.verdict,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -712,19 +725,23 @@ def _index_block(text: str) -> str:
|
|
|
detail = "对应报表卡"
|
|
detail = "对应报表卡"
|
|
|
if "明细在" in text:
|
|
if "明细在" in text:
|
|
|
detail = "明细在" + text.split("明细在", 1)[1].strip("。")
|
|
detail = "明细在" + text.split("明细在", 1)[1].strip("。")
|
|
|
- verdict = "正确"
|
|
|
|
|
|
|
+ verdict = VERDICT_CORRECT
|
|
|
if "错误" in text:
|
|
if "错误" in text:
|
|
|
- verdict = "错误"
|
|
|
|
|
|
|
+ verdict = VERDICT_ERROR
|
|
|
elif "可疑" in text:
|
|
elif "可疑" in text:
|
|
|
- verdict = "可疑"
|
|
|
|
|
- return _lines(
|
|
|
|
|
- (
|
|
|
|
|
- f"字段:{head or text}",
|
|
|
|
|
- "期望:本轮主单在该报表上的列与对应报表卡一致",
|
|
|
|
|
- f"实据:{actual or text}",
|
|
|
|
|
- f"依据:{detail}",
|
|
|
|
|
- f"结论:{verdict}",
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ verdict = VERDICT_SUSPECT
|
|
|
|
|
+ label = {VERDICT_CORRECT: "正确", VERDICT_ERROR: "错误", VERDICT_SUSPECT: "可疑"}[verdict]
|
|
|
|
|
+ return emphasize_verdict_block(
|
|
|
|
|
+ _lines(
|
|
|
|
|
+ (
|
|
|
|
|
+ f"字段:{head or text}",
|
|
|
|
|
+ "期望:本轮主单在该报表上的列与对应报表卡一致",
|
|
|
|
|
+ f"实据:{actual or text}",
|
|
|
|
|
+ f"依据:{detail}",
|
|
|
|
|
+ f"结论:{label}",
|
|
|
|
|
+ )
|
|
|
|
|
+ ),
|
|
|
|
|
+ verdict,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|