基于 skill-template 脚手架开发,包含: - payroll_config(费率配置,可编辑)+ payslip_snapshots(解析历史,只读)2 张业务表 - 全国默认 + 北上广 4 套费率(社保/公积金/个税起征点/7 级税率表) - 5 个业务 Action:calculate-payslip-simple / calculate-payslip-full / explain-term / view-config / edit-config - 个税累计预扣法计算,支持多月历史累加 - 20 个薪资名词库(社保/公积金/个税/全勤/加班费等) - 完整市场文档(README/TUTORIAL/DEMO/CHANGELOG) - 296 测试全部通过
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
"""mock / unit 档位:不启动浏览器。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import time
|
|
from typing import List
|
|
|
|
from service.adapter.base import BatchAdapterBase, BatchItem, BatchSubmitResult
|
|
|
|
|
|
class MockBatchAdapter(BatchAdapterBase):
|
|
name = "mock"
|
|
|
|
async def submit_batch(self, target: str, items: List[BatchItem]) -> BatchSubmitResult:
|
|
del target
|
|
if not items:
|
|
return BatchSubmitResult(
|
|
ok=False,
|
|
batch_id=None,
|
|
submitted_count=0,
|
|
submitted_amount=0.0,
|
|
error_msg="items 为空",
|
|
artifacts={"adapter": self.name},
|
|
)
|
|
|
|
time.sleep(0.05)
|
|
total = sum(it.amount for it in items)
|
|
fake_batch_id = f"MOCK-{int(time.time())}"
|
|
return BatchSubmitResult(
|
|
ok=True,
|
|
batch_id=fake_batch_id,
|
|
submitted_count=len(items),
|
|
submitted_amount=total,
|
|
error_msg=None,
|
|
artifacts={"adapter": self.name},
|
|
)
|