Files
QiufengandClaude Opus 4.8 5e51dc3f56 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>
2026-06-15 19:19:15 +08:00

90 lines
3.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""把指定实体的真·金额字段从 double 改为 BigDecimal(字段声明+getter+setter+import)。
科学量/数量字段不传入,保持 double。"""
import re, sys, os
BASE = "/Users/qiu/Desktop/ERP/oa-backend/src/main/java/com/kaidi/oa/domain"
# 文件 -> 该文件里需要转成 BigDecimal 的金额字段
TARGETS = {
"Contract.java": ["amount", "paidAmount", "invoicedAmount"],
"RdProject.java": ["budget"],
"ContractMilestone.java": ["amount"],
"PolicyApplication.java": ["appliedAmount", "grantedAmount"],
"Bid.java": ["controlPrice", "bidAmount", "deposit"],
"Payment.java": ["amount"],
"Invoice.java": ["amount", "taxAmount", "total"],
"Patent.java": ["annualFee"],
"Budget.java": ["budgetAmount", "actualAmount"],
"Account.java": ["balance"],
"ContractChange.java": ["amountBefore", "amountAfter"],
"Declaration.java": ["amount"],
"Opportunity.java": ["amount"],
"CostCenter.java": ["budgetTotal", "actualTotal"],
"StandardCost.java": ["materialCost", "laborCost", "overheadCost",
"totalStandard", "actualCost", "variance"],
"BomItem.java": ["unitPrice"], # bidQty/actualQty 保持 double
"PriceItem.java": ["unitPrice"],
"RdExpense.java": ["amount"],
"Policy.java": ["fundAmount"],
"Voucher.java": ["amount"],
}
def cap(s):
return s[0].upper() + s[1:]
def ensure_import(src):
if "import java.math.BigDecimal;" in src:
return src
# 插在 package 行之后第一处空行/或第一条 import 前
lines = src.split("\n")
out, inserted = [], False
for i, ln in enumerate(lines):
out.append(ln)
if not inserted and ln.startswith("package "):
out.append("")
out.append("import java.math.BigDecimal;")
inserted = True
# 若下一行本就是空行,跳过避免双空行
if i + 1 < len(lines) and lines[i + 1].strip() == "":
continue
return "\n".join(out)
def xform(path, fields):
src = open(path, encoding="utf-8").read()
orig = src
changed = []
for f in fields:
c = cap(f)
# 字段声明:private double <f> -> private BigDecimal <f>
s1 = re.sub(rf"(\bprivate\s+)double(\s+{re.escape(f)}\b)", r"\1BigDecimal\2", src)
# getterpublic double get<C>( -> public BigDecimal get<C>(
s2 = re.sub(rf"(\bpublic\s+)double(\s+get{re.escape(c)}\s*\()", r"\1BigDecimal\2", s1)
# setter 形参:set<C>(double -> set<C>(BigDecimal
s3 = re.sub(rf"(\bset{re.escape(c)}\s*\(\s*)double(\s+)", r"\1BigDecimal\2", s2)
if s3 != src:
changed.append(f)
src = s3
else:
print(f" !! {os.path.basename(path)}: 字段 {f} 未命中任何模式(需手查)")
if changed:
src = ensure_import(src)
if src != orig:
open(path, "w", encoding="utf-8").write(src)
return changed
def main():
total = 0
for fn, fields in TARGETS.items():
p = os.path.join(BASE, fn)
if not os.path.exists(p):
print(f" !! 缺文件 {fn}")
continue
ch = xform(p, fields)
total += len(ch)
print(f"{fn}: 改 {len(ch)}/{len(fields)} 字段 {ch}")
print(f"\n合计改 {total} 个金额字段")
if __name__ == "__main__":
main()