diff --git a/体测单位/北京农行.ipynb b/体测单位/北京农行.ipynb index 1be8142..a2ff56e 100644 --- a/体测单位/北京农行.ipynb +++ b/体测单位/北京农行.ipynb @@ -3,7 +3,9 @@ { "cell_type": "markdown", "id": "4626da6c-d228-4270-8d8d-c98784a106ad", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "# 第一次体测" ] @@ -68,28 +70,12 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "fd73b8be-d3fe-49aa-99d2-3cc6df4a3eb0", "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": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "523\n", - "523\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import time\n", @@ -148,16 +134,9 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "b870bd6e-f972-4073-b13d-5fda8cc92bb7", "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": [] }, "outputs": [], @@ -817,16 +796,9 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "c1b187e0-f566-43fa-88d8-090deb9ead19", "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": [] }, "outputs": [], @@ -885,6 +857,119 @@ " json.dump(dict1, fl, ensure_ascii=False) \n", "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": {