update
This commit is contained in:
parent
beddeeb3ed
commit
c97890e2b7
|
|
@ -242,19 +242,18 @@ class SyncOAToDidiLegalEntitySyncJob(BaseJob):
|
||||||
extra=extra,
|
extra=extra,
|
||||||
)
|
)
|
||||||
raw = resp.text or ""
|
raw = resp.text or ""
|
||||||
content_type = resp.headers.get("content-type", "") if getattr(resp, "headers", None) else ""
|
|
||||||
logger.info("Seeyon export_form_soap done templateCode=%s content_length=%s content_type=%s base_url=%s", oa_template_code, len(raw), content_type, oa_base_url)
|
|
||||||
finally:
|
finally:
|
||||||
seeyon.close()
|
seeyon.close()
|
||||||
|
|
||||||
payload = json.loads(raw) if raw else {}
|
payload = json.loads(raw) if raw else {}
|
||||||
logger.info(payload)
|
|
||||||
outer = payload.get("data") or {}
|
outer = payload.get("data") or {}
|
||||||
inner = outer.get("data") or {}
|
# 成功返回时 outer["data"] 即为表单对象:{"definition": {...}, "data": [...]}
|
||||||
inner2 = inner.get("data") or {}
|
form = outer.get("data") or {}
|
||||||
|
|
||||||
definition = inner2.get("definition") or {}
|
if not isinstance(form, dict):
|
||||||
logger.info(definition)
|
raise RuntimeError("OA export invalid: data.data is not an object (dict)")
|
||||||
|
|
||||||
|
definition = form.get("definition") or {}
|
||||||
fields = definition.get("fields") or []
|
fields = definition.get("fields") or []
|
||||||
if not isinstance(fields, list):
|
if not isinstance(fields, list):
|
||||||
raise RuntimeError("OA export invalid: definition.fields is not a list")
|
raise RuntimeError("OA export invalid: definition.fields is not a list")
|
||||||
|
|
@ -273,7 +272,7 @@ class SyncOAToDidiLegalEntitySyncJob(BaseJob):
|
||||||
if not emp_field or not company_field:
|
if not emp_field or not company_field:
|
||||||
raise RuntimeError("OA export invalid: cannot locate fields for 工号/所属公司 in definition.fields")
|
raise RuntimeError("OA export invalid: cannot locate fields for 工号/所属公司 in definition.fields")
|
||||||
|
|
||||||
rows = inner2.get("data") or []
|
rows = form.get("data") or []
|
||||||
if not isinstance(rows, list):
|
if not isinstance(rows, list):
|
||||||
raise RuntimeError("OA export invalid: data is not a list")
|
raise RuntimeError("OA export invalid: data is not a list")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue