This commit is contained in:
512song committed 2023-09-19 12:52:48 +08:00
1 parent f32d8ba3f3
commit ddfebf8878
1 file changed
+120 -35
+120 -35
View File
@@ -3,7 +3,9 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "4626da6c-d228-4270-8d8d-c98784a106ad", "id": "4626da6c-d228-4270-8d8d-c98784a106ad",
"metadata": {}, "metadata": {
"tags": []
},
"source": [ "source": [
"# 第一次体测" "# 第一次体测"
] ]
@@ -68,28 +70,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": null,
"id": "fd73b8be-d3fe-49aa-99d2-3cc6df4a3eb0", "id": "fd73b8be-d3fe-49aa-99d2-3cc6df4a3eb0",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-09-18T02:28:13.173784Z",
"iopub.status.busy": "2023-09-18T02:28:13.173377Z",
"iopub.status.idle": "2023-09-18T02:28:13.258454Z",
"shell.execute_reply": "2023-09-18T02:28:13.257893Z",
"shell.execute_reply.started": "2023-09-18T02:28:13.173753Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"523\n",
"523\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import time\n", "import time\n",
@@ -148,16 +134,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": null,
"id": "b870bd6e-f972-4073-b13d-5fda8cc92bb7", "id": "b870bd6e-f972-4073-b13d-5fda8cc92bb7",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-09-18T02:33:35.544712Z",
"iopub.status.busy": "2023-09-18T02:33:35.544319Z",
"iopub.status.idle": "2023-09-18T02:33:35.710354Z",
"shell.execute_reply": "2023-09-18T02:33:35.709872Z",
"shell.execute_reply.started": "2023-09-18T02:33:35.544678Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [],
@@ -817,16 +796,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"id": "c1b187e0-f566-43fa-88d8-090deb9ead19", "id": "c1b187e0-f566-43fa-88d8-090deb9ead19",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-09-13T07:58:04.130282Z",
"iopub.status.busy": "2023-09-13T07:58:04.129816Z",
"iopub.status.idle": "2023-09-13T07:58:04.144786Z",
"shell.execute_reply": "2023-09-13T07:58:04.143845Z",
"shell.execute_reply.started": "2023-09-13T07:58:04.130228Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [],
@@ -885,6 +857,119 @@
" json.dump(dict1, fl, ensure_ascii=False) \n", " json.dump(dict1, fl, ensure_ascii=False) \n",
"print(len(re_ta))" "print(len(re_ta))"
] ]
},
{
"cell_type": "markdown",
"id": "3877fc60-171c-434a-aa27-8f1fe9936dd2",
"metadata": {},
"source": [
"## 报告按部门分类"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "80a85fcd-0597-4b58-898f-de420239919f",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import json\n",
"import glob\n",
"from pathlib import Path\n",
"\n",
"fi_path = '/home/songyi/python/mycrm/flask/pdf/files/309118'\n",
"new_path = 'file/309118'\n",
"old = []\n",
"dict2 = {}\n",
"\n",
"filename = 'data/北京农行人员名单all.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
"for fn in fls:\n",
" fi_name =Path(fn).stem.split('-')[0]\n",
" code = int(fi_name)\n",
" unit_path = Path(new_path,dict1[str(code)]['unit'])\n",
" unit_path.mkdir(parents = True, exist_ok = True)\n",
" n_name = Path(unit_path,Path(fn).stem)\n",
" if not os.path.exists(n_name):\n",
" shutil.copyfile(fn,n_name)\n",
" print(n_name)"
]
},
{
"cell_type": "markdown",
"id": "3022dcdd-8700-468f-86ab-6ce43b118e1c",
"metadata": {},
"source": [
"## 生成体测报告打印明细表"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "24433f75-6397-4b12-870e-611b77db8ded",
"metadata": {
"execution": {
"iopub.execute_input": "2023-09-19T04:31:27.480917Z",
"iopub.status.busy": "2023-09-19T04:31:27.480455Z",
"iopub.status.idle": "2023-09-19T04:31:27.564161Z",
"shell.execute_reply": "2023-09-19T04:31:27.563713Z",
"shell.execute_reply.started": "2023-09-19T04:31:27.480880Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import os,sys,shutil\n",
"import json\n",
"import glob\n",
"from pathlib import Path\n",
"import openpyxl\n",
"\n",
"fi_path = '/home/songyi/python/mycrm/flask/pdf/files/309118'\n",
"new_path = 'file/309118'\n",
"list1 = []\n",
"filename = 'data/北京农行人员名单all.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
"for fn in fls:\n",
" list2 = []\n",
" fi_name =Path(fn).stem.split('-')[0] \n",
" code = int(fi_name)\n",
" unit = dict1[str(code)]['unit']\n",
" list2 = [fi_name,Path(fn).stem.split('-')[1],unit]\n",
" list1.append(list2)\n",
"filename = 'data/北京农行体测报告打印明细表.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list1:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename) \n",
"print('ok')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e3744d35-930d-4f18-9b11-cb8b09882461",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {