SNAPSHOT W7 已部署稳定态 — 凯迪ERP+OA一体化平台 (MET 73.3%)
恢复点(restore point)。别人改崩后可 git reset --hard 回到此提交。 == 此快照内容 == - 后端 oa-backend: 734 控制器 / 711 实体 (Spring Boot 3.2.5 + SQLite, 端口8091) - 前端 modern-ui/app: Vue3+Vite, 约700页 (构建产物已在 oa-backend/src/main/resources/static) - 数据库 oa-backend/data/oa.db: 含全部演示数据 (强制入库, 6.6MB) - 交接文档 go.md + go-code-reference/endpoints/entities/database.md - 多代理建设脚本 .claude/wf-*.js == 状态 == - 对 凯迪科技ERP_20260507.xlsx 合规 MET ~73.3% (PARTIAL 75: 34可建+6种子/bug+35外部硬天花板) - 安全: 5轮红队+5轮复检, default-deny分级鉴权, 连续零可利用 - W3~W7 累计补完436缺口; W8末轮(40缺口)为半成品(源码树可编译但未集成) - 运行: cd oa-backend; java -jar build/libs/oa-backend-0.1.0.jar --server.port=8091; admin/123456 == 排除(gitignore, 可再生) == node_modules / oa-backend/build / .jdks / *.log / Backup-ERP-* / 弃用的OFBiz核心(只保留modern-ui) 完整文件夹备份见同目录 Backup-ERP-20260615-191517/ (含上述全部, 仅缺 node_modules) 时间戳: 20260615-191517 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
"""把机械文件里金额 setter 的实参包成 Money.of(...)(括号配平),并补 import。
|
||||
仅用于不含金额算术公式的文件。"""
|
||||
import os, re
|
||||
|
||||
BASE = "/Users/qiu/Desktop/ERP/oa-backend/src/main/java/com/kaidi/oa"
|
||||
|
||||
SETTERS = [
|
||||
"setAmount", "setPaidAmount", "setInvoicedAmount", "setBudget",
|
||||
"setAppliedAmount", "setGrantedAmount", "setControlPrice", "setBidAmount",
|
||||
"setDeposit", "setTaxAmount", "setTotal", "setAnnualFee", "setBudgetAmount",
|
||||
"setActualAmount", "setBalance", "setAmountBefore", "setAmountAfter",
|
||||
"setBudgetTotal", "setActualTotal", "setMaterialCost", "setLaborCost",
|
||||
"setOverheadCost", "setTotalStandard", "setActualCost", "setVariance",
|
||||
"setUnitPrice", "setFundAmount",
|
||||
]
|
||||
|
||||
FILES = [
|
||||
"web/BudgetController.java",
|
||||
"web/PaymentController.java",
|
||||
"web/RdProjectController.java",
|
||||
"web/OpportunityController.java",
|
||||
"web/ContractController.java",
|
||||
"web/BidController.java",
|
||||
"web/PolicyApplicationController.java",
|
||||
]
|
||||
|
||||
def find_call(s, start):
|
||||
"""返回 (open_idx, close_idx, setter) 第一个未包装的金额 setter 调用,从 start 起。"""
|
||||
best = None
|
||||
for setter in SETTERS:
|
||||
i = s.find("." + setter + "(", start)
|
||||
if i != -1 and (best is None or i < best[0]):
|
||||
best = (i, setter)
|
||||
if best is None:
|
||||
return None
|
||||
i, setter = best
|
||||
open_idx = s.index("(", i)
|
||||
depth, j = 0, open_idx
|
||||
while j < len(s):
|
||||
if s[j] == "(":
|
||||
depth += 1
|
||||
elif s[j] == ")":
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
return (open_idx, j, setter)
|
||||
j += 1
|
||||
return None
|
||||
|
||||
def wrap_file(path):
|
||||
s = open(path, encoding="utf-8").read()
|
||||
out = []
|
||||
pos = 0
|
||||
count = 0
|
||||
while True:
|
||||
call = find_call(s, pos)
|
||||
if call is None:
|
||||
out.append(s[pos:])
|
||||
break
|
||||
open_idx, close_idx, setter = call
|
||||
inner = s[open_idx + 1:close_idx]
|
||||
out.append(s[pos:open_idx + 1])
|
||||
if inner.strip().startswith("Money.of(") and inner.strip().endswith(")"):
|
||||
out.append(inner) # 已包装,跳过
|
||||
else:
|
||||
out.append("Money.of(" + inner + ")")
|
||||
count += 1
|
||||
out.append(")")
|
||||
pos = close_idx + 1
|
||||
res = "".join(out)
|
||||
if count and "import com.kaidi.oa.common.Money;" not in res:
|
||||
res = re.sub(r"(package [^\n]+\n)", r"\1\nimport com.kaidi.oa.common.Money;\n", res, count=1)
|
||||
if res != s:
|
||||
open(path, "w", encoding="utf-8").write(res)
|
||||
return count
|
||||
|
||||
def main():
|
||||
for f in FILES:
|
||||
p = os.path.join(BASE, f)
|
||||
if not os.path.exists(p):
|
||||
print(f" !! 缺 {f}")
|
||||
continue
|
||||
n = wrap_file(p)
|
||||
print(f"{f}: 包装 {n} 处金额 setter")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user