Files
starRiverProperty/maven-cw-elevator-application/tools/stub_org_service.py
T
反编译工作区 8b15445328 feat: add service config templates and extraction script
Former-commit-id: 1de24b7eb79676d1aba9d799a58c5a753290cf52
2026-05-01 19:38:01 +08:00

96 lines
2.8 KiB
Python

#!/usr/bin/env python3
"""组织服务桩 — 模拟 ninca-common-component-organization 的 /component/person/detail 端点"""
from flask import Flask, request, jsonify
app = Flask(__name__)
# 被访人数据映射:personId → { floorList, organizationIds }
HOST_DATA = {
"1060601019894960128": { # 陈国辉 — 1403艾斯 + 星中心物业
"name": "陈国辉",
"floorList": ["605560541473144832", "605560545117995008"], # 6F, 28F
"organizationIds": [
"72fb65ec5de94201b909a98b8bae1892", # 1403艾斯
"f216235e54ca42bfa0379e69b3754aff", # 星中心物业
],
},
"1090779433129840640": { # 王姣 — 1405一博环保 + 一博
"name": "王姣",
"floorList": ["605560542752407552", "605560543834537984"], # 15F, 20F
"organizationIds": [
"2095de3d541f44eba686c78fda68336f", # 1405一博环保
"5c129c5eae114309933042d7f2006aa2", # 一博
],
},
"1072908835884208128": { # 秦夏 — 广发基金 + 正式员工
"name": "秦夏",
"floorList": [
"605560545117995008", # 28F
"605560545449345024", # 30F
"605560545596145664", # 31F
"605560545738752000", # 32F
"605560545893941248", # 33F
],
"organizationIds": [
"488b8ad049bb43408a6fbcc50bcb89ac", # 广发基金
"b549a73065374ecf871841544f329a98", # 正式员工
],
},
}
@app.route("/component/person/detail", methods=["POST"])
def person_detail():
data = request.get_json(force=True, silent=True) or {}
person_id = data.get("id", "")
host = HOST_DATA.get(person_id)
if not host:
return jsonify({
"success": False,
"code": "76260531",
"message": f"person not found: {person_id}",
"data": None,
})
return jsonify({
"success": True,
"code": "0",
"message": "ok",
"data": {
"id": person_id,
"businessId": "2524639890ba4f2cba9ba1a4eeaa4015",
"name": host["name"],
"floorList": host["floorList"],
"organizationIds": host["organizationIds"],
},
})
@app.route("/health", methods=["GET"])
def health():
return jsonify({"status": "UP"})
@app.route("/sysetting/zone/page", methods=["POST"])
def zone_page():
return jsonify({
"success": True,
"code": "0",
"data": {
"totalRows": 1,
"currentPage": 1,
"pageSize": 10,
"datas": [{
"id": "605560545117995008",
"zoneId": "605560545117995008",
"parentId": "605560539791228928",
}],
},
})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=18082, debug=False)