fix(dispatch): 받는 사람 정보는 라벨 PDF만 출처(TikTok 포함)

- TikTok xlsx 의 가려진 이름/주소가 우선 채워져 PDF 가 무시되던 문제 수정
- COLUMN_ALIASES 에서 recipient_* 매핑 제거 → xlsx PII 미사용
- 머지 시 PDF 값이 있으면 무조건 덮어씀(PDF authoritative)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 14:58:21 +09:00
parent 163537fd96
commit 95561270a9
2 changed files with 5 additions and 6 deletions
+3 -1
View File
@@ -260,12 +260,14 @@ async def batch_create(
except PdfParseError as exc: except PdfParseError as exc:
logger.warning("라벨 PDF 파싱 실패 — PII 없이 진행: %s", exc) logger.warning("라벨 PDF 파싱 실패 — PII 없이 진행: %s", exc)
recipients = {} recipients = {}
# PDF 가 받는 사람 정보의 정본(authoritative). xlsx 의 가려진 이름/주소는
# 신뢰하지 않으므로 PDF 값이 있으면 덮어쓴다.
for p in parcels: for p in parcels:
rec = recipients.get((p.get("order_id") or "").strip()) rec = recipients.get((p.get("order_id") or "").strip())
if not rec: if not rec:
continue continue
for field in ("recipient_name", "recipient_phone", "recipient_address"): for field in ("recipient_name", "recipient_phone", "recipient_address"):
if rec.get(field) and not (p.get(field) or "").strip(): if rec.get(field):
p[field] = rec[field] p[field] = rec[field]
batch = st.create_batch( batch = st.create_batch(
+2 -5
View File
@@ -60,11 +60,8 @@ COLUMN_ALIASES: dict[str, tuple[str, ...]] = {
"parent sku reference no.", "판매자 sku", "상품코드"), "parent sku reference no.", "판매자 sku", "상품코드"),
"product_name": ("product name", "product_name", "item name", "product", "상품명"), "product_name": ("product name", "product_name", "item name", "product", "상품명"),
"quantity": ("quantity", "qty", "수량", "수량(개)"), "quantity": ("quantity", "qty", "수량", "수량(개)"),
"recipient_name": ("recipient", "recipient name", "buyer name", "consignee", "받는 사람", "받는사람", "수취인", "수령인"), # 받는 사람(이름/전화/주소)은 xlsx 에서 매핑하지 않는다 — xlsx 값은 가려져 있어
"recipient_phone": ("phone #", "phone#", "phone", "phone number", "contact number", "contact", # 신뢰할 수 없다. PII 는 라벨 PDF 에서만 가져온다(pdf_parser, Order ID 조인).
"전화", "전화번호", "연락처"),
"recipient_address": ("detail address", "detailed address", "address", "delivery address",
"shipping address", "full address", "주소", "배송지", "배송주소", "수령지 주소"),
} }
# 사용자에게 보여줄 컬럼 이름(누락 안내 메시지용). 비교키는 소문자라 별도 표기. # 사용자에게 보여줄 컬럼 이름(누락 안내 메시지용). 비교키는 소문자라 별도 표기.