refactor: 完成项目目录重构与代码迁移
本次提交完成了整体项目的目录梳理与代码迁移: 1. 将根级controlplane、webhost等目录的代码迁移至desktop/对应子目录,统一桌面端架构 2. 移动并整理了插件目录结构,将插件统一放入根级plugins/ 3. 调整了前端项目的路径与配置,统一前后端开发构建流程 4. 清理了废弃的旧版app/目录与冗余的构建中间文件 5. 更新了.gitignore与README.md,适配新的项目结构
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""增员名单制作模式(sb_person_change 插件)。
|
||||
|
||||
自 workflows/XQ0008 generate_add.py 迁移:读取【参保名单】sheet,筛选 区域=重庆 ∩
|
||||
参保类型=指定类型 ∩ 办理状态为空,按参保单位分组复制《增员模版.xls》(保留下拉字典),
|
||||
逐店生成《XX增员导入名单.xls》。日期规则与影刀版一致:先「转移参保」后「新参保」,
|
||||
工伤参保时间=当日,其余参保时间=本月1日。
|
||||
"""
|
||||
from datetime import datetime
|
||||
|
||||
from . import config
|
||||
from . import excelio
|
||||
from . import source
|
||||
|
||||
|
||||
def _log(msg):
|
||||
config.log(msg)
|
||||
|
||||
|
||||
def _translate_education(val):
|
||||
if val is None or config._to_text(val) == '':
|
||||
return '90.其他'
|
||||
return config.EDU_MAP.get(str(val).strip(), '90.其他')
|
||||
|
||||
|
||||
def _translate_nation(val):
|
||||
if val is None or config._to_text(val) == '':
|
||||
return '99.其他'
|
||||
return config.NATION_MAP.get(str(val).strip(), '99.其他')
|
||||
|
||||
|
||||
def _translate_residence(val):
|
||||
if val is None or config._to_text(val) == '':
|
||||
return ''
|
||||
return config.RESIDENCE_MAP.get(str(val).strip(), '')
|
||||
|
||||
|
||||
def _process_add_members(operation_type):
|
||||
"""生成指定参保类型的增员导入名单。"""
|
||||
cm = config.COLUMN_MAP_ADD
|
||||
source_file, df_filtered = source.load_add_rows(operation_type)
|
||||
if df_filtered.empty:
|
||||
return []
|
||||
config.check_not_locked(source_file)
|
||||
|
||||
today = datetime.now()
|
||||
first_day = today.replace(day=1)
|
||||
_log(f"今日日期:{today.strftime('%Y-%m-%d')}")
|
||||
_log(f"本月1日:{first_day.strftime('%Y-%m-%d')}(首次参加/养老/失业/医疗/生育参保时间)")
|
||||
_log(f"工伤参保时间:{today.strftime('%Y-%m-%d')}(当日)")
|
||||
|
||||
template_file = excelio.find_template_file(config.ADD_TEMPLATE_FILE)
|
||||
output_dir = excelio.get_output_dir_add(operation_type)
|
||||
_log(f"输出目录:{output_dir}")
|
||||
produced = []
|
||||
for store_name, group in df_filtered.groupby(cm['单位名称']):
|
||||
_log(f" 正在处理:{store_name},共 {len(group)} 人")
|
||||
first_row = group.iloc[0]
|
||||
unit_no = first_row[cm['社保号']]
|
||||
unit_full_name = first_row[cm['参保单位全称']]
|
||||
|
||||
# 逐行生成数据(键 = 模板列名)
|
||||
records = []
|
||||
for _, row in group.iterrows():
|
||||
records.append({
|
||||
'证件号码': config._to_text(row[cm['证件号码']]),
|
||||
'姓名': row[cm['姓名']],
|
||||
'民族': _translate_nation(row[cm['民族']]),
|
||||
'首次参加工作日期': first_day,
|
||||
'月基本工资额': config._clean_value(row[cm['月基本工资额']]),
|
||||
'工种': config.DEFAULT_VALUES_ADD['工种'],
|
||||
'个人身份': config.DEFAULT_VALUES_ADD['个人身份'],
|
||||
'户口性质': _translate_residence(row[cm['户口性质']]),
|
||||
'联系电话': config._to_text(row[cm['联系电话']]),
|
||||
'文化程度': _translate_education(row[cm['文化程度']]),
|
||||
'养老保险参保时间': first_day,
|
||||
'失业保险参保时间': first_day,
|
||||
'医疗保险参保时间': first_day,
|
||||
'工伤保险参保时间': today,
|
||||
'生育保险参保时间': first_day,
|
||||
'证件类型': config.DEFAULT_VALUES_ADD['证件类型'],
|
||||
'国籍': config.DEFAULT_VALUES_ADD['国籍'],
|
||||
'备注': config.DEFAULT_VALUES_ADD['备注'],
|
||||
'专职技能': config.DEFAULT_VALUES_ADD['专职技能'],
|
||||
'技能等级': config.DEFAULT_VALUES_ADD['技能等级'],
|
||||
})
|
||||
|
||||
output_path = f"{output_dir}\\{config._safe_name(store_name)}增员导入名单.xls"
|
||||
excelio.write_template(template_file, output_path, unit_no, unit_full_name,
|
||||
records, config.TPL_COLS_ADD, config.DATE_COLS_ADD)
|
||||
_log(f" 已生成:{output_path}")
|
||||
produced.append({"unit": str(store_name), "count": len(group), "path": output_path})
|
||||
|
||||
_log(f"所有【{operation_type}】导入名单生成完成!")
|
||||
return produced
|
||||
|
||||
|
||||
def run(ctx):
|
||||
"""主入口(与影刀版一致):依次生成「转移参保」和「新参保」两类名单。"""
|
||||
ctx.progress(5)
|
||||
produced = []
|
||||
produced += _process_add_members('转移参保')
|
||||
ctx.progress(40)
|
||||
produced += _process_add_members('新参保')
|
||||
ctx.progress(100)
|
||||
total = sum(p["count"] for p in produced)
|
||||
return {"summary": f"增员名单制作:{len(produced)} 个单位 / {total} 人",
|
||||
"rows": produced, "notes": []}
|
||||
Reference in New Issue
Block a user