feat: 新增社保告知书制作下发全流程模块
1. 新增参保/停保告知书生成模块,支持按模板批量生成Word+PDF 2. 新增社保转移告知书独立数据源处理逻辑 3. 新增OA工作沟通推送数据自动构造能力 4. 重构雇主险模块,拆分变更清单导出为独立文件 5. 新增花名册查询工具模块,支持店长/人事批量查询 6. 更新项目文档与README说明
This commit is contained in:
@@ -558,22 +558,9 @@ def send_work_communication(
|
||||
)
|
||||
|
||||
|
||||
# ==================== 主入口(影刀指令) ====================
|
||||
def main(receiver_keywords, subject, content, attachment_paths="", creator_id="", category="工作安排"):
|
||||
"""
|
||||
影刀指令入口:发送工作沟通推送。
|
||||
|
||||
Args:
|
||||
receiver_keywords: 接收人工号或姓名(列表或字符串)
|
||||
subject: 沟通标题
|
||||
content: 沟通内容(支持 HTML 富文本)
|
||||
attachment_paths: 附件文件路径(列表或字符串,可空)
|
||||
creator_id: 创建人(当前操作人)用户 ID;为空则尝试从新建页自动提取
|
||||
category: 沟通类型(默认 工作安排)
|
||||
|
||||
Returns:
|
||||
{"success": bool, "message": str, "doc_id": str};并写入影刀全局变量 push_result。
|
||||
"""
|
||||
def _send_work_communication_wrapped(receiver_keywords, subject, content, attachment_paths="",
|
||||
creator_id="", category="工作安排"):
|
||||
"""单条工作沟通推送(捕获异常,返回 result dict)。"""
|
||||
try:
|
||||
doc_id = send_work_communication(
|
||||
receiver_keywords=receiver_keywords,
|
||||
@@ -583,25 +570,81 @@ def main(receiver_keywords, subject, content, attachment_paths="", creator_id=""
|
||||
creator_id=creator_id or None,
|
||||
category=category,
|
||||
)
|
||||
result = {"success": True, "message": f"工作沟通发送成功,文档ID: {doc_id}", "doc_id": doc_id}
|
||||
return {"success": True, "message": f"工作沟通发送成功,文档ID: {doc_id}", "doc_id": doc_id}
|
||||
except SystemExit as e:
|
||||
result = {"success": False, "message": str(e), "doc_id": ""}
|
||||
return {"success": False, "message": str(e), "doc_id": ""}
|
||||
except Exception as e:
|
||||
logger.error("工作沟通推送失败: %s", e)
|
||||
result = {"success": False, "message": f"工作沟通推送失败: {e}", "doc_id": ""}
|
||||
return {"success": False, "message": f"工作沟通推送失败: {e}", "doc_id": ""}
|
||||
|
||||
|
||||
# ==================== 主入口(影刀指令) ====================
|
||||
def main(messages=None, receiver_keywords=None, subject=None, content=None,
|
||||
attachment_paths="", creator_id="", category="工作安排"):
|
||||
"""
|
||||
影刀指令入口:发送工作沟通推送。
|
||||
|
||||
支持两种调用方式:
|
||||
1) main(messages):messages 为列表,每条含字段
|
||||
{receivers, subject, content, attachment_paths, creator_id, category},
|
||||
对应 notice 模块 oa_work_communications 全局变量结构,逐条推送
|
||||
2) main(receiver_keywords=..., subject=..., content=..., ...):单条推送(向后兼容)
|
||||
|
||||
Returns:
|
||||
{"success": bool, "message": str, "doc_id": str};并写入影刀全局变量 push_result。
|
||||
"""
|
||||
if isinstance(messages, list) and messages:
|
||||
results = []
|
||||
for i, msg in enumerate(messages, 1):
|
||||
r = _send_work_communication_wrapped(
|
||||
receiver_keywords=msg.get("receivers", []),
|
||||
subject=msg.get("subject", ""),
|
||||
content=msg.get("content", ""),
|
||||
attachment_paths=msg.get("attachment_paths", ""),
|
||||
creator_id=msg.get("creator_id", ""),
|
||||
category=msg.get("category", "工作安排"),
|
||||
)
|
||||
results.append(r)
|
||||
logger.info("[%d/%d] %s", i, len(messages), r.get("message"))
|
||||
ok = sum(1 for r in results if r.get("success"))
|
||||
result = {
|
||||
"success": ok == len(results),
|
||||
"message": f"共推送 {len(results)} 条,成功 {ok} 条",
|
||||
"doc_id": ",".join(r.get("doc_id", "") for r in results if r.get("doc_id")),
|
||||
}
|
||||
else:
|
||||
result = _send_work_communication_wrapped(
|
||||
receiver_keywords=receiver_keywords or [],
|
||||
subject=subject or "",
|
||||
content=content or "",
|
||||
attachment_paths=attachment_paths,
|
||||
creator_id=creator_id,
|
||||
category=category,
|
||||
)
|
||||
_set_glv("push_result", result)
|
||||
logger.info("推送结果: %s", result)
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 本地独立运行调试示例(影刀中由指令参数传入)
|
||||
result = main(
|
||||
receiver_keywords=["37036361"],
|
||||
subject="【RPA自动化】影刀版工作沟通推送测试",
|
||||
content="<p>影刀单文件版工作沟通推送测试。</p>",
|
||||
attachment_paths="",
|
||||
creator_id="",
|
||||
category="工作安排",
|
||||
)
|
||||
# 本地独立运行调试示例:messages 结构同 notice 模块的 oa_work_communications 全局变量,
|
||||
# 逐条调用 main 推送(影刀中同样按该结构循环推送)。
|
||||
messages = [
|
||||
{
|
||||
"receivers": ["37036361", "37001166"], # 测试接收人(多人)
|
||||
"subject": "2026年8月员工参保结果告知书",
|
||||
"content": "<p>【测试】重庆区域门店8月新参保已完成,请各门店传达告知。</p>",
|
||||
"attachment_paths": [],
|
||||
"category": "工作安排",
|
||||
},
|
||||
{
|
||||
"receivers": ["37036361", "37001166"],
|
||||
"subject": "2026年8月员工参保单位变更确认",
|
||||
"content": "<p>【测试】本月人力资源部已输出“工作与参保单位不一致”人员,请完成转移确认。</p>",
|
||||
"attachment_paths": [],
|
||||
"category": "工作安排",
|
||||
},
|
||||
]
|
||||
main(messages)
|
||||
result = main(messages)
|
||||
print("RESULT:", result)
|
||||
|
||||
Reference in New Issue
Block a user