feat(plugin XQ0008): 支持增员按参保类型分目录存储回盘文件
更新插件版本至1.0.2,调整增员核查逻辑按参保类型分组,回盘文件按类型分目录存储,适配不同参保类型的办理需求
This commit is contained in:
@@ -109,11 +109,12 @@ def load_units(kind, operation_type=None, status_filter="empty", exclude_ids=fro
|
||||
|
||||
|
||||
def load_check_tasks(kind, status_filter=config.CHECK_STATUS, exclude_ids=frozenset()):
|
||||
"""读取名单筛选 办理状态/办理停保=待审核 的行,按参保单位分组。
|
||||
"""读取名单筛选 办理状态/办理停保=待审核 的行,分组。
|
||||
|
||||
返回 [{unit, count, cids(set)}],供核查流程使用。
|
||||
增员按参保类型+单位分组(回盘文件按类型分目录),减员按单位分组。
|
||||
返回 [{unit, type, count, cids(set)}],供核查流程使用。
|
||||
"""
|
||||
operation_type = config.WEB_ADD_TYPE if kind == 'add' else None
|
||||
operation_type = config.WEB_ADD_TYPES if kind == 'add' else None
|
||||
sub, source_file, sheet_name, status_col = load_records(
|
||||
kind, operation_type, status_filter, exclude_ids)
|
||||
print_source = os.path.basename(source_file)
|
||||
@@ -121,14 +122,26 @@ def load_check_tasks(kind, status_filter=config.CHECK_STATUS, exclude_ids=frozen
|
||||
if sub.empty:
|
||||
config.log(f"没有筛选到数据({status_col}={status_filter})")
|
||||
return [], source_file, sheet_name
|
||||
sub = sub.copy()
|
||||
sub["_unit"] = sub["参保单位"].astype(str).str.strip()
|
||||
tasks = []
|
||||
for unit, g in sub.groupby(sub["参保单位"].astype(str).str.strip()):
|
||||
cids = {config._norm_id(v) for v in g['身份证号码']}
|
||||
cids.discard('')
|
||||
tasks.append({"unit": unit, "count": len(cids), "cids": cids})
|
||||
tasks.sort(key=lambda t: t['unit'])
|
||||
if kind == 'add':
|
||||
sub["_type"] = sub["参保类型"].astype(str).str.strip()
|
||||
for (unit, t), g in sub.groupby(["_unit", "_type"]):
|
||||
cids = {config._norm_id(v) for v in g['身份证号码']}
|
||||
cids.discard('')
|
||||
tasks.append({"unit": unit, "type": t, "count": len(cids), "cids": cids})
|
||||
tasks.sort(key=lambda x: (x['unit'], x['type']))
|
||||
unit_desc = "个(类型+单位)分组"
|
||||
else:
|
||||
for unit, g in sub.groupby("_unit"):
|
||||
cids = {config._norm_id(v) for v in g['身份证号码']}
|
||||
cids.discard('')
|
||||
tasks.append({"unit": unit, "type": None, "count": len(cids), "cids": cids})
|
||||
tasks.sort(key=lambda x: x['unit'])
|
||||
unit_desc = "个参保单位"
|
||||
config.log(f"核查范围:共 {sum(t['count'] for t in tasks)} 人 / "
|
||||
f"{len(tasks)} 个参保单位({status_col}={status_filter})")
|
||||
f"{len(tasks)} {unit_desc}({status_col}={status_filter})")
|
||||
return tasks, source_file, sheet_name
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user