chore: 批量新增各类工具脚本与配置文件

1. 新增音频录制、下载、上传相关脚本
2. 新增数据库操作、API调用工具
3. 新增Excel数据处理脚本
4. 新增弱密码检测脚本
This commit is contained in:
2026-06-14 17:47:15 +08:00
parent aac9f5934d
commit 2d8c1ea8f9
46 changed files with 11644 additions and 829 deletions
+774 -11
View File
@@ -2,24 +2,787 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "83d3f4d5",
"metadata": {},
"outputs": [],
"source": [
"from requests import get,post\n",
"import pandas as pd\n",
"import time\n",
"teamId = 19\n",
"ip = \"http://192.168.0.209:8100\"\n",
"param = {\n",
" \"username\": \"zhongwei\",\n",
" \"password\": \"123456a\",\n",
" \"client_id\": \"client\",\n",
" \"grant_type\": \"password\",\n",
" \"client_secret\": \"123456\",\n",
"}\n",
"data = get(url=f\"{ip}/oauth/token\",params=param).json()\n",
"token = data[\"access_token\"]\n",
"header = {\n",
" \"content-type\": \"application/json\",\n",
" \"authorization\": f\"Bearer {token}\",\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "873025e5",
"metadata": {},
"outputs": [
{
"ename": "",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
]
"data": {
"text/plain": [
"{'scrawlMaxSize': 10485760,\n",
" 'videoMaxSize': 104857600,\n",
" 'imageInsertAlign': 'none',\n",
" 'catcherMaxSize': 10485760,\n",
" 'snapscreenUrlPrefix': '',\n",
" 'videoActionName': 'video',\n",
" 'fileActionName': 'file',\n",
" 'imageCompressBorder': 5000,\n",
" 'imageManagerUrlPrefix': '',\n",
" 'imageManagerAllowFiles': ['.jpg', '.png', '.jpeg'],\n",
" 'scrawlUrlPrefix': '',\n",
" 'scrawlFieldName': 'file',\n",
" 'imageMaxSize': 10485760,\n",
" 'imageAllowFiles': ['.jpg', '.png', '.jpeg'],\n",
" 'snapscreenActionName': 'snap',\n",
" 'fileMaxSize': 104857600,\n",
" 'catcherActionName': 'catch',\n",
" 'fileFieldName': 'file',\n",
" 'fileManagerAllowFiles': ['.zip', '.pdf', '.doc'],\n",
" 'fileManagerActionName': 'listFile',\n",
" 'snapscreenInsertAlign': 'none',\n",
" 'fileUrlPrefix': '',\n",
" 'scrawlActionName': 'crawl',\n",
" 'imageManagerInsertAlign': 'none',\n",
" 'videoFieldName': 'file',\n",
" 'catcherLocalDomain': ['127.0.0.1', 'localhost'],\n",
" 'fileManagerListSize': 20,\n",
" 'imageActionName': 'image',\n",
" 'imageCompressEnable': True,\n",
" 'imageFieldName': 'file',\n",
" 'imageUrlPrefix': '',\n",
" 'videoUrlPrefix': '',\n",
" 'scrawlInsertAlign': 'none',\n",
" 'fileAllowFiles': ['.zip', '.pdf', '.doc'],\n",
" 'catcherUrlPrefix': '',\n",
" 'imageManagerListSize': 20,\n",
" 'catcherFieldName': 'source',\n",
" 'fileManagerUrlPrefix': '',\n",
" 'catcherAllowFiles': ['.jpg', '.png', '.jpeg'],\n",
" 'videoAllowFiles': ['.mp4'],\n",
" 'formulaConfig': {'imageUrlTemplate': 'https://r.latexeasy.com/image.svg?{}'},\n",
" 'imageManagerActionName': 'listImage'}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.to_excel('重新分班模板 (4).xlsx',index=False)"
"get(f\"{ip}/uc/project/ueditor\",headers=header).json()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c747c26d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'success': True,\n",
" 'msg': '操作成功',\n",
" 'code': 0,\n",
" 'data': [{'id': 11365245,\n",
" 'stuName': '郭嘉欣',\n",
" 'serialNo': '0022681452',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776050001000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8864,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365248,\n",
" 'stuName': '雷江昊然',\n",
" 'serialNo': '0022681580',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8867,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365267,\n",
" 'stuName': '吴梓萌',\n",
" 'serialNo': '0022722732',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036853000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8886,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036842000},\n",
" {'id': 11365241,\n",
" 'stuName': '程柏涵',\n",
" 'serialNo': '0022795772',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036329000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8860,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036336000},\n",
" {'id': 11365249,\n",
" 'stuName': '李然壹',\n",
" 'serialNo': '0022795964',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035905000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8868,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035899000},\n",
" {'id': 11365274,\n",
" 'stuName': '杨雨嘉',\n",
" 'serialNo': '0022799916',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036401000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8893,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036382000},\n",
" {'id': 11365238,\n",
" 'stuName': '蔡雨芮',\n",
" 'serialNo': '0022822732',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035453000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8857,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035468000},\n",
" {'id': 11365265,\n",
" 'stuName': '魏俊洁',\n",
" 'serialNo': '0022830076',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036331000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8884,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036311000},\n",
" {'id': 11365277,\n",
" 'stuName': '姚祉玲',\n",
" 'serialNo': '0022834044',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036142000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8896,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036135000},\n",
" {'id': 11365260,\n",
" 'stuName': '汪昊涵',\n",
" 'serialNo': '3107628753',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8879,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365244,\n",
" 'stuName': '郭佳',\n",
" 'serialNo': '3108354337',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035462000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8863,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035455000},\n",
" {'id': 11365270,\n",
" 'stuName': '徐文昊',\n",
" 'serialNo': '3108354417',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036866000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8889,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036861000},\n",
" {'id': 11367018,\n",
" 'stuName': '唐悠雯',\n",
" 'serialNo': '3108388513',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 10981,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365259,\n",
" 'stuName': '万梓涵',\n",
" 'serialNo': '3108390097',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8878,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365279,\n",
" 'stuName': '朱泓安',\n",
" 'serialNo': '3108390369',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036955000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8898,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036996000},\n",
" {'id': 11365240,\n",
" 'stuName': '陈峻鑫',\n",
" 'serialNo': '3108390481',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036695000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8859,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036686000},\n",
" {'id': 11365242,\n",
" 'stuName': '代晋铭',\n",
" 'serialNo': '3108415505',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776047344000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8861,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776047354000},\n",
" {'id': 11365257,\n",
" 'stuName': '唐裕康',\n",
" 'serialNo': '3108415697',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036869000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8876,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036873000},\n",
" {'id': 11365253,\n",
" 'stuName': '吕仕瑞',\n",
" 'serialNo': '3108435409',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035766000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8872,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036856000},\n",
" {'id': 11365255,\n",
" 'stuName': '彭雨绮',\n",
" 'serialNo': '3108435585',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036569000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8874,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036555000},\n",
" {'id': 11365256,\n",
" 'stuName': '孙婧琪',\n",
" 'serialNo': '3108441105',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036193000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8875,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036185000},\n",
" {'id': 11365258,\n",
" 'stuName': '涂凤扬',\n",
" 'serialNo': '3108442785',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036470000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8877,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036497000},\n",
" {'id': 11365246,\n",
" 'stuName': '何俊达',\n",
" 'serialNo': '3108460593',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036368000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8865,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036374000},\n",
" {'id': 11365271,\n",
" 'stuName': '徐梓轩',\n",
" 'serialNo': '3108464465',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035922000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8890,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035916000},\n",
" {'id': 11365278,\n",
" 'stuName': '张紫涵',\n",
" 'serialNo': '3108580737',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035797000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8897,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035794000},\n",
" {'id': 11365252,\n",
" 'stuName': '罗靖洁',\n",
" 'serialNo': '3108583121',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8871,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365261,\n",
" 'stuName': '王露静',\n",
" 'serialNo': '3108583313',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036402000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8880,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036386000},\n",
" {'id': 11365247,\n",
" 'stuName': '侯家鸿',\n",
" 'serialNo': '3108588801',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035778000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8866,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035778000},\n",
" {'id': 11365262,\n",
" 'stuName': '王洋梓桐',\n",
" 'serialNo': '3108598337',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776059188000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8881,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365268,\n",
" 'stuName': '夏紫萱',\n",
" 'serialNo': '3108601489',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036824000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8887,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036812000},\n",
" {'id': 11365250,\n",
" 'stuName': '刘鸿维',\n",
" 'serialNo': '3108601841',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036278000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8869,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036308000},\n",
" {'id': 11365276,\n",
" 'stuName': '姚谊诚',\n",
" 'serialNo': '3108603729',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8895,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035945000},\n",
" {'id': 11365269,\n",
" 'stuName': '谢汶良',\n",
" 'serialNo': '3108605233',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036656000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8888,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036671000},\n",
" {'id': 11365273,\n",
" 'stuName': '杨佳颖',\n",
" 'serialNo': '3108606065',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036436000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8892,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036424000},\n",
" {'id': 11365239,\n",
" 'stuName': '曹雅莉',\n",
" 'serialNo': '3108606273',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036335000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8858,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036329000},\n",
" {'id': 11365251,\n",
" 'stuName': '刘蔚菘',\n",
" 'serialNo': '3108606433',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036055000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8870,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036089000},\n",
" {'id': 11365275,\n",
" 'stuName': '杨子涵',\n",
" 'serialNo': '3108607729',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8894,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036154000},\n",
" {'id': 11365243,\n",
" 'stuName': '符唐骏',\n",
" 'serialNo': '3108614209',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035795000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8862,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035802000},\n",
" {'id': 11365263,\n",
" 'stuName': '位云馨',\n",
" 'serialNo': '3108633697',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8882,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None},\n",
" {'id': 11365266,\n",
" 'stuName': '吴琳楠',\n",
" 'serialNo': '3108635073',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036323000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8885,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036316000},\n",
" {'id': 11365272,\n",
" 'stuName': '杨丰瑞',\n",
" 'serialNo': '3108650865',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776036330000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8891,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776036322000},\n",
" {'id': 11365254,\n",
" 'stuName': '庞雨橦',\n",
" 'serialNo': '3108679985',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': 1776035795000,\n",
" 'endTime': None,\n",
" 'intoState': 1,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8873,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': 1776035786000},\n",
" {'id': 11365264,\n",
" 'stuName': '魏本杨',\n",
" 'serialNo': '3108682001',\n",
" 'gradeId': 126,\n",
" 'classId': 474,\n",
" 'startTime': None,\n",
" 'endTime': None,\n",
" 'intoState': None,\n",
" 'boarder': 2,\n",
" 'attendDate': 1776009600000,\n",
" 'stuId': 8883,\n",
" 'teamId': 119,\n",
" 'lockTime': None,\n",
" 'gateTime': None,\n",
" 'gateStartTime': None}]}"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"get(\n",
" f\"{ip}/classAttend/into/pre\",\n",
" headers=header,\n",
" params={\n",
" \"teamId\": 119,\n",
" \"dateTime\": 1776009600000,\n",
" \"teaName\": \"马靖\",\n",
" \"serial\": 9,\n",
" \"courseName\": \"26学部1班-班会\",\n",
" },\n",
").json()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3d80ee07",
"metadata": {},
"outputs": [],
"source": [
"attendDate: \"2026-04-13\"\n",
"classRoom: \"2510\"\n",
"color: \"#FB923C\"\n",
"courseName: \"26学部1班-班会\"\n",
"serial: \"第9节\"\n",
"serialnum: \"9\"\n",
"status: \"下节课\"\n",
"teaName: \"马靖\"\n",
"timeSlot: \"16:20-17:00\""
]
}
],
+27
View File
@@ -0,0 +1,27 @@
import pymysql
import snowflake
from faker import Faker
fake = Faker('zh_CN')
import random
# 创建数据库连接
conn = pymysql.connect(
host='11.1.1.5',
user='root',
password='@HXYD1109mysql',
database='school_server',
charset='utf8'
)
# 创建游标对象
cursor = conn.cursor()
def create_table(cursor,result):
data = []
for i in result:
list_list = list(i)
des=cursor.description # 获取表详情,字段名,长度,属性等
t = ",".join([item[0] for item in des])
table_head = t.split(',') # # 查询表列名 用,分割
dict_result = dict(zip(table_head, list_list)) # 打包为元组的列表 再转换为字典
data.append(dict_result) # 将字典添加到list_result中
return data
@@ -0,0 +1,216 @@
from requests import get
import time
import os
import pandas as pd
import tqdm
from datetime import datetime, timedelta
teamId = 19
ip = "http://band.hxzhxy.cn"
param = {
"username": "xtl",
"password": "xia123456",
"client_id": "client",
"grant_type": "password",
"client_secret": "123456",
}
data = get(url=f"{ip}/oauth/token", params=param).json()
token = data["access_token"]
header = {
"content-type": "application/json",
"authorization": f"Bearer {token}",
}
url = f"{ip}/pay/trads/findPayTtadsNews"
output_dir = r"e:\project\python\工具\智慧校园\本部\消费数据\24-26消费信息"
FIELD_MAP = {
"gradeName": "年级名称",
"termName": "交易地点",
"teamId": "团队ID",
"stuId": "学生ID",
"areaName": "设备区域名称",
"bagName": "交易账户",
"userNumb": "学号/工号",
"dealCount": "交易流水号/笔次",
"className": "班级名称",
"remark": "备注/充值类型",
"cardCode": "物理卡号",
"dealType": "消费方式",
"cardValue": "余额",
"userXm": "姓名",
"cardNo": "卡号",
"createDate": "入库时间",
"dealValue": "交易金额",
"recordType": "记录类型",
"id": "记录ID",
"recordId": "终端原始记录ID",
"userId": "用户唯一ID",
"dealTime": "交易时间"
}
OUTPUT_COLUMNS = list(FIELD_MAP.values())
def day_range(start_date, end_date):
current = start_date
while current <= end_date:
yield current
current += timedelta(days=1)
def month_range(start_date, end_date):
current = datetime(start_date.year, start_date.month, 1)
end_month = datetime(end_date.year, end_date.month, 1)
while current <= end_month:
yield current
if current.month == 12:
current = datetime(current.year + 1, 1, 1)
else:
current = datetime(current.year, current.month + 1, 1)
def to_timestamp_ms(dt):
return int(dt.timestamp() * 1000)
def fetch_day_records(day_dt):
day_start = datetime(day_dt.year, day_dt.month, day_dt.day, 0, 0, 0)
day_end = datetime(day_dt.year, day_dt.month, day_dt.day, 23, 59, 59)
begin_time = to_timestamp_ms(day_start)
end_time = to_timestamp_ms(day_end)
page_number = 0
page_size = 100
day_records = []
while True:
params = {
"teamId": teamId,
"pageNumber": page_number,
"pageSize": page_size,
"screen": 1,
"beginTime": begin_time,
"endTime": end_time,
"name": "",
"recordType": 1,
"termName": "",
"type": 1,
"classId": "",
"gradeId": ""
}
resp = get(url=url, params=params, headers=header, timeout=60)
resp.raise_for_status()
result = resp.json()
if not result.get("success"):
raise Exception(f"接口返回失败: {result}")
data = result.get("data") or {}
content = data.get("content") or []
total_pages = data.get("totalPages", 0)
total_elements = data.get("totalElements", 0)
day_records.extend(content)
print(
f"{day_dt.strftime('%Y-%m-%d')}{page_number + 1}/{max(total_pages, 1)} 页,"
f"当前页 {len(content)} 条,当天累计 {len(day_records)} 条,总计 {total_elements}"
)
page_number += 1
if page_number >= total_pages or total_pages == 0:
break
time.sleep(0.1)
return day_records
def parse_date(date_str):
return datetime.strptime(date_str, "%Y-%m-%d")
def convert_records_to_df(records):
rows = []
for record in records:
row = {}
for en_key, cn_key in FIELD_MAP.items():
row[cn_key] = record.get(en_key)
rows.append(row)
if not rows:
return pd.DataFrame(columns=OUTPUT_COLUMNS)
return pd.DataFrame(rows, columns=OUTPUT_COLUMNS)
def get_month_start_end(month_dt, start_date, end_date):
month_start = datetime(month_dt.year, month_dt.month, 1)
if month_dt.month == 12:
next_month = datetime(month_dt.year + 1, 1, 1)
else:
next_month = datetime(month_dt.year, month_dt.month + 1, 1)
month_end = next_month - timedelta(days=1)
if month_start < start_date:
month_start = start_date
if month_end > end_date:
month_end = end_date
return month_start, month_end
def save_month_excel(month_dt, records):
df = convert_records_to_df(records)
file_name = f"{month_dt.strftime('%Y%m')}_学生消费记录.xlsx"
file_path = os.path.join(output_dir, file_name)
df.to_excel(file_path, index=False)
return file_path, len(df)
def main():
print("开始拉取数据...")
start_date_str = os.getenv("START_DATE", "2024-01-01")
end_date_str = os.getenv("END_DATE", "2026-05-19")
start_date = parse_date(start_date_str)
end_date = parse_date(end_date_str)
all_month_list = list(month_range(start_date, end_date))
total_records = 0
success_months = 0
with tqdm.tqdm(all_month_list, desc="按月拉取消费记录") as month_pbar:
for month_dt in month_pbar:
try:
month_start, month_end = get_month_start_end(month_dt, start_date, end_date)
month_records = []
month_days = list(day_range(month_start, month_end))
for day_dt in month_days:
day_records = fetch_day_records(day_dt)
month_records.extend(day_records)
time.sleep(0.2)
file_path, count = save_month_excel(month_dt, month_records)
total_records += count
success_months += 1
month_pbar.set_postfix({
"month": month_dt.strftime("%Y-%m"),
"count": count,
"total": total_records
})
print(f"已输出: {file_path}")
except Exception as e:
print(f"{month_dt.strftime('%Y-%m')} 拉取失败: {e}")
print("\n完成")
print(f"成功月份: {success_months}")
print(f"总记录数: {total_records}")
print(f"输出目录: {output_dir}")
if __name__ == "__main__":
main()
@@ -0,0 +1,89 @@
import pandas as pd
import json
from datetime import datetime
# 读取Excel文件
file_path = r'e:\project\python\工具\智慧校园\本部\消费数据\2024学生.xlsx'
df = pd.read_excel(file_path)
print("=" * 80)
print("学生消费数据提取")
print("=" * 80)
# 1. 提取年级ID和班级ID(供用户查表)
grade_ids = sorted(df['gradeId'].unique().tolist())
class_ids = sorted(df['classId'].unique().tolist())
print(f"\n【年级ID列表】(共{len(grade_ids)}个):")
print(grade_ids)
print(f"\n【班级ID列表】(共{len(class_ids)}个):")
print(class_ids)
# 2. 提取学生消费信息
student_records = []
for _, row in df.iterrows():
record = {
'学号': str(row['stuNo']),
'姓名': row['stuName'],
'年级ID': row['gradeId'],
'班级ID': row['classId'],
'支付金额(元)': row['totalFee'] / 100, # 转换为元
'支付状态': '支付成功' if row['payState'] == 1 else '其他',
'创建时间': row['createTime'].strftime('%Y-%m-%d %H:%M:%S') if pd.notna(row['createTime']) else '',
'支付时间': row['payTime'].strftime('%Y-%m-%d %H:%M:%S') if pd.notna(row['payTime']) else '',
'物理卡号': str(row['serialNo']) if pd.notna(row['serialNo']) else '',
'teamId': row['teamId']
}
student_records.append(record)
# 3. 统计信息
print(f"\n【数据统计】")
print(f"总记录数: {len(student_records)}")
print(f"唯一学生数: {df['stuNo'].nunique()}")
print(f"总金额: {df['totalFee'].sum() / 100:.2f}")
# 4. 按年级统计
print(f"\n【按年级统计】")
grade_stats = df.groupby('gradeId').agg({
'stuNo': 'nunique',
'totalFee': 'sum'
}).reset_index()
grade_stats.columns = ['年级ID', '学生人数', '总金额(分)']
grade_stats['总金额(元)'] = grade_stats['总金额(分)'] / 100
print(grade_stats.to_string(index=False))
# 5. 按班级统计
print(f"\n【按班级统计】")
class_stats = df.groupby('classId').agg({
'stuNo': 'nunique',
'totalFee': 'sum'
}).reset_index()
class_stats.columns = ['班级ID', '学生人数', '总金额(分)']
class_stats['总金额(元)'] = class_stats['总金额(分)'] / 100
print(class_stats.to_string(index=False))
# 6. 保存详细记录到JSON
output_file = r'e:\project\python\工具\智慧校园\本部\消费数据\student_records.json'
with open(output_file, 'w', encoding='utf-8') as f:
json.dump(student_records, f, ensure_ascii=False, indent=2)
print(f"\n【输出文件】")
print(f"详细记录已保存到: {output_file}")
# 7. 保存ID映射表(等待用户补充年级和班级名称)
id_mapping = {
'grade_ids': grade_ids,
'class_ids': class_ids,
'note': '请查询数据库补充年级名称和班级名称'
}
id_mapping_file = r'e:\project\python\工具\智慧校园\本部\消费数据\id_mapping.json'
with open(id_mapping_file, 'w', encoding='utf-8') as f:
json.dump(id_mapping, f, ensure_ascii=False, indent=2)
print(f"ID映射表已保存到: {id_mapping_file}")
print("\n请查询数据库,告诉我以下ID对应的名称:")
print(f"年级ID: {grade_ids}")
print(f"班级ID: {class_ids}")
@@ -0,0 +1,25 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "72fd36ef",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -0,0 +1,38 @@
import pandas as pd
import json
# 读取Excel文件
df = pd.read_excel('e:/project/python/工具/智慧校园/本部/消费数据/2024学生.xlsx')
print("=== Excel文件基本信息 ===")
print(f"数据形状: {df.shape}")
print(f"\n列名: {df.columns.tolist()}")
print("\n=== 前10行数据 ===")
print(df.head(10))
print("\n=== 数据类型 ===")
print(df.dtypes)
# 提取唯一值
print("\n=== 唯一值统计 ===")
for col in df.columns:
unique_count = df[col].nunique()
print(f"{col}: {unique_count} 个唯一值")
if unique_count <= 20:
print(f" 值: {df[col].unique().tolist()}")
# 检查是否有年级和班级相关字段
grade_class_cols = [col for col in df.columns if any(keyword in col.lower() for keyword in ['年级', '班级', 'grade', 'class'])]
print(f"\n=== 年级/班级相关字段: {grade_class_cols} ===")
# 保存列名信息供后续使用
with open('e:/project/python/工具/智慧校园/本部/消费数据/excel_info.json', 'w', encoding='utf-8') as f:
info = {
'columns': df.columns.tolist(),
'shape': df.shape,
'sample_data': df.head(5).to_dict('records')
}
json.dump(info, f, ensure_ascii=False, indent=2)
print("\n=== 信息已保存到 excel_info.json ===")
@@ -0,0 +1,24 @@
import pandas as pd
import sys
# 读取Excel文件
file_path = r'e:\project\python\工具\智慧校园\本部\消费数据\2024学生.xlsx'
df = pd.read_excel(file_path)
print("数据形状:", df.shape)
print("\n列名:")
for i, col in enumerate(df.columns):
print(f"{i+1}. {col}")
print("\n前5行数据:")
print(df.head().to_string())
# 检查年级和班级相关字段
print("\n查找年级/班级相关字段...")
for col in df.columns:
if any(keyword in str(col) for keyword in ['年级', '班级', 'grade', 'class', 'Grade', 'Class']):
print(f"找到字段: {col}")
print(f"唯一值: {df[col].unique()[:10]}") # 只显示前10个唯一值
print("\n数据类型:")
print(df.dtypes)
@@ -0,0 +1,17 @@
import pandas as pd
# 读取年级表和班级表
grade_df = pd.read_excel(r'e:\project\python\工具\智慧校园\本部\消费数据\年级表.xlsx')
class_df = pd.read_excel(r'e:\project\python\工具\智慧校园\本部\消费数据\班级表.xlsx')
print("=== 年级表 ===")
print(f"形状: {grade_df.shape}")
print(f"列名: {grade_df.columns.tolist()}")
print("\n前10行:")
print(grade_df.head(10))
print("\n=== 班级表 ===")
print(f"形状: {class_df.shape}")
print(f"列名: {class_df.columns.tolist()}")
print("\n前10行:")
print(class_df.head(10))
@@ -0,0 +1,140 @@
import pandas as pd
from datetime import datetime
# 读取所有数据
print("正在读取数据...")
consumption_df = pd.read_excel(r'e:\project\python\工具\智慧校园\本部\消费数据\2024学生.xlsx')
grade_df = pd.read_excel(r'e:\project\python\工具\智慧校园\本部\消费数据\年级表.xlsx')
class_df = pd.read_excel(r'e:\project\python\工具\智慧校园\本部\消费数据\班级表.xlsx')
print(f"消费数据: {consumption_df.shape[0]} 条记录")
print(f"年级表: {grade_df.shape[0]} 个年级")
print(f"班级表: {class_df.shape[0]} 个班级")
# 创建年级ID到名称的映射
grade_map = dict(zip(grade_df['id'], grade_df['grade_name']))
# 创建班级ID到名称的映射
class_map = dict(zip(class_df['id'], class_df['class_name']))
# 创建班级ID到年级ID的映射(用于验证)
class_to_grade_map = dict(zip(class_df['id'], class_df['grade_id']))
print("\n正在处理消费数据...")
# 处理消费数据
processed_data = []
for _, row in consumption_df.iterrows():
grade_id = row['gradeId']
class_id = row['classId']
# 获取年级和班级名称
grade_name = grade_map.get(grade_id, f'未知年级({grade_id})')
class_name = class_map.get(class_id, f'未知班级({class_id})')
# 处理时间格式
create_time = row['createTime']
pay_time = row['payTime']
if pd.notna(create_time):
if isinstance(create_time, str):
create_time_str = create_time
else:
create_time_str = create_time.strftime('%Y-%m-%d %H:%M:%S')
else:
create_time_str = ''
if pd.notna(pay_time):
if isinstance(pay_time, str):
pay_time_str = pay_time
else:
pay_time_str = pay_time.strftime('%Y-%m-%d %H:%M:%S')
else:
pay_time_str = ''
# 处理支付状态
pay_state_map = {0: '确认中', 1: '支付成功', 2: '已取消', 3: '退款'}
pay_state = pay_state_map.get(row['payState'], f'未知状态({row["payState"]})')
# 处理充值状态
change_state_map = {0: '充值中', 1: '已取消', 2: '充值成功', 3: '充值失败'}
change_state = change_state_map.get(row['changeState'], f'未知状态({row["changeState"]})')
record = {
'学号': str(row['stuNo']),
'姓名': row['stuName'],
'年级ID': grade_id,
'年级名称': grade_name,
'班级ID': class_id,
'班级名称': class_name,
'支付金额(元)': row['totalFee'] / 100,
'支付状态': pay_state,
'充值状态': change_state,
'创建时间': create_time_str,
'支付时间': pay_time_str,
'物理卡号': str(int(row['serialNo'])) if pd.notna(row['serialNo']) else '',
'订单编号': row['outTradeNo'],
'微信订单号': row['transactionId'] if pd.notna(row['transactionId']) else '',
'支付手机号': str(row['wxPhone']),
'teamId': row['teamId']
}
processed_data.append(record)
# 创建DataFrame
result_df = pd.DataFrame(processed_data)
# 生成输出文件名
output_file = r'e:\project\python\工具\智慧校园\本部\消费数据\学生消费记录整理.xlsx'
# 写入Excel,使用多个sheet
with pd.ExcelWriter(output_file, engine='openpyxl') as writer:
# Sheet 1: 详细记录
result_df.to_excel(writer, sheet_name='详细记录', index=False)
# Sheet 2: 按年级汇总
grade_summary = result_df.groupby(['年级ID', '年级名称']).agg({
'学号': 'nunique',
'支付金额(元)': 'sum',
'姓名': 'count'
}).reset_index()
grade_summary.columns = ['年级ID', '年级名称', '学生人数', '总金额(元)', '消费笔数']
grade_summary = grade_summary.sort_values('年级ID')
grade_summary.to_excel(writer, sheet_name='按年级汇总', index=False)
# Sheet 3: 按班级汇总
class_summary = result_df.groupby(['班级ID', '班级名称', '年级名称']).agg({
'学号': 'nunique',
'支付金额(元)': 'sum',
'姓名': 'count'
}).reset_index()
class_summary.columns = ['班级ID', '班级名称', '年级名称', '学生人数', '总金额(元)', '消费笔数']
class_summary = class_summary.sort_values(['年级名称', '班级ID'])
class_summary.to_excel(writer, sheet_name='按班级汇总', index=False)
# Sheet 4: 按学生汇总
student_summary = result_df.groupby(['学号', '姓名', '年级名称', '班级名称']).agg({
'支付金额(元)': 'sum',
'创建时间': 'count'
}).reset_index()
student_summary.columns = ['学号', '姓名', '年级名称', '班级名称', '总金额(元)', '消费笔数']
student_summary = student_summary.sort_values(['年级名称', '班级名称', '学号'])
student_summary.to_excel(writer, sheet_name='按学生汇总', index=False)
print(f"\n✅ 数据整理完成!")
print(f"📁 输出文件: {output_file}")
print(f"\n📊 统计信息:")
print(f" - 总记录数: {len(result_df)}")
print(f" - 唯一学生数: {result_df['学号'].nunique()}")
print(f" - 总金额: {result_df['支付金额(元)'].sum():.2f}")
print(f"\n📋 Excel包含以下工作表:")
print(f" 1. 详细记录 - 所有消费明细")
print(f" 2. 按年级汇总 - 各年级消费统计")
print(f" 3. 按班级汇总 - 各班级消费统计")
print(f" 4. 按学生汇总 - 各学生消费统计")
# 显示年级分布
print(f"\n🏫 年级分布:")
grade_dist = result_df.groupby('年级名称')['学号'].nunique().sort_values(ascending=False)
for grade, count in grade_dist.items():
print(f" {grade}: {count}")
@@ -0,0 +1,309 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "318e7588",
"metadata": {},
"outputs": [],
"source": [
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c046d8d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "27c18f0a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 2,
"id": "343a9e44",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[]\n"
]
}
],
"source": [
"grade_id = [110,120,124, 126,127,128, 114,119,129]\n",
"sql = f'''\n",
"select \n",
" mm.id,\n",
" mm.stu_no,\n",
" mm.stu_name,\n",
" bb.student_id,\n",
" mm.plan_id -- 这里直接显示 plan_id\n",
"from (\n",
" select \n",
" s.id,\n",
" s.stu_no,\n",
" s.stu_name,\n",
" a.plan_id -- 子查询把 plan_id 带出来\n",
" from student s \n",
" inner join class_attend_stu a on s.id = a.student_id\n",
" where s.grade_id in ({\",\".join(map(str,grade_id))}) \n",
" and a.plan_id=41\n",
" group by s.id, s.stu_no, s.stu_name, a.plan_id\n",
") mm \n",
"left join (\n",
" select DISTINCT c.student_id \n",
" from class_attend c \n",
" where c.attend_date BETWEEN '2026-05-25' and '2026-05-31' \n",
" and c.student_id in (\n",
" select DISTINCT a.student_id \n",
" from class_attend_stu a \n",
" where a.plan_id=41\n",
" )\n",
") bb on mm.id = bb.student_id \n",
"WHERE bb.student_id is null\n",
"'''\n",
"cursor.execute(sql)\n",
"result = cursor.fetchall()\n",
"data = create_table(cursor,result)\n",
"print(data)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "2584e86a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n"
]
}
],
"source": [
"for item in data:\n",
" res = post(f\"{ip}/classAttendStu/createThisWeekStu\",headers=header,params={\"stuId\":item[\"id\"],\"planId\":item[\"plan_id\"]},timeout=600).text\n",
" print(res)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}