Commit 84f3c3b0 authored by 刘丙寅's avatar 刘丙寅

自动分配用户

parent 90b62139
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="a188f8e8-7383-4735-a16a-e71d8f97fff3" name="Default Changelist" comment="" />
<list default="true" id="a188f8e8-7383-4735-a16a-e71d8f97fff3" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/peizhi.py" beforeDir="false" afterPath="$PROJECT_DIR$/peizhi.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rota_gm.py" beforeDir="false" afterPath="$PROJECT_DIR$/rota_gm.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -9,15 +13,29 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/rota$rota_gm.coverage" NAME="rota_gm Coverage Results" MODIFIED="1619685449943" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/rota$demo.coverage" NAME="demo Coverage Results" MODIFIED="1620285725994" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/rota$rota_gm_new.coverage" NAME="rota_gm_new Coverage Results" MODIFIED="1620282120045" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/rota$rota_gm.coverage" NAME="rota_gm Coverage Results" MODIFIED="1619690148319" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="true">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/rota_gm.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="293">
<caret line="15" column="46" lean-forward="true" selection-start-line="15" selection-start-column="46" selection-end-line="15" selection-end-column="46" />
<state relative-caret-position="575">
<caret line="25" column="40" lean-forward="true" selection-start-line="25" selection-start-column="40" selection-end-line="25" selection-end-column="40" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/rota_gm_new.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="11" column="39" selection-start-line="11" selection-start-column="39" selection-end-line="11" selection-end-column="39" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
......@@ -28,8 +46,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/peizhi.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="69">
<caret line="3" column="18" lean-forward="true" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
<state relative-caret-position="368">
<caret line="16" column="19" lean-forward="true" selection-start-line="16" selection-start-column="19" selection-end-line="16" selection-end-column="19" />
</state>
</provider>
</entry>
......@@ -50,22 +68,30 @@
<find>class HTML</find>
<find>HTML</find>
<find>element.xpath('//div[@class=&quot;wnrl_riqi&quot;]')</find>
<find>ran</find>
<find>range</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/rota_gm.py" />
<option value="$PROJECT_DIR$/demo.py" />
<option value="$PROJECT_DIR$/peizhi.py" />
<option value="$PROJECT_DIR$/rota_gm_new.py" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" fullScreen="true">
<option name="x" value="1440" />
<option name="y" value="-157" />
<option name="y" value="-180" />
<option name="width" value="1920" />
<option name="height" value="1057" />
<option name="height" value="1080" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
......@@ -103,7 +129,29 @@
</list>
</option>
</component>
<component name="RunManager">
<component name="RunManager" selected="Python.demo">
<configuration name="demo" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="rota" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/demo.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="rota_gm" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="rota" />
<option name="INTERPRETER_OPTIONS" value="" />
......@@ -126,8 +174,32 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="rota_gm_new" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="rota" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/rota_gm_new.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.demo" />
<item itemvalue="Python.rota_gm_new" />
<item itemvalue="Python.rota_gm" />
</list>
</recent_temporary>
......@@ -142,42 +214,82 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1619664045043</updated>
<workItem from="1619664053864" duration="9042000" />
<workItem from="1619664053864" duration="11284000" />
<workItem from="1619763908943" duration="12423000" />
<workItem from="1620269647785" duration="9774000" />
</task>
<task id="LOCAL-00001" summary="修改文案和时间">
<created>1619687262591</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1619687262591</updated>
</task>
<task id="LOCAL-00002" summary="修改代码逻辑">
<created>1619689420583</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1619689420583</updated>
</task>
<task id="LOCAL-00003" summary="完善代码逻辑">
<created>1619690050131</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1619690050131</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="9042000" />
<option name="totallyTimeSpent" value="33481000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="1440" y="-180" width="1920" height="1080" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.13205537" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1341853" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
<window_info anchor="bottom" id="Database Changes" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Python Console" />
<window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.32970297" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.4960396" />
<window_info anchor="bottom" id="Run" order="2" weight="0.37425742" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="SciView" />
<window_info anchor="right" id="Database" />
<window_info anchor="bottom" id="TODO" order="6" weight="0.32970297" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="bottom" id="Database Changes" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Terminal" order="11" weight="0.32970297" />
<window_info anchor="bottom" id="Python Console" order="12" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="SciView" order="3" />
<window_info anchor="right" id="Database" order="4" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="修改文案和时间" />
<MESSAGE value="修改代码逻辑" />
<MESSAGE value="完善代码逻辑" />
<option name="LAST_COMMIT_MESSAGE" value="完善代码逻辑" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/venv/lib/python3.7/site-packages/requests/adapters.py">
<provider selected="true" editor-type-id="text-editor">
......@@ -350,17 +462,60 @@
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Library/Caches/PyCharm2018.3/python_stubs/1348919709/builtins.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="369">
<caret line="4155" column="21" selection-start-line="4155" selection-start-column="4" selection-end-line="4155" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/venv/lib/python3.7/site-packages/redis/client.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="344">
<caret line="704" column="24" selection-start-line="704" selection-start-column="17" selection-end-line="704" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/venv/lib/python3.7/site-packages/redis/__init__.py">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#0#43#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/demo.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="413">
<caret line="53" column="30" lean-forward="true" selection-start-line="53" selection-start-column="30" selection-end-line="53" selection-end-column="30" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/peizhi.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="69">
<caret line="3" column="18" lean-forward="true" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
<state relative-caret-position="368">
<caret line="16" column="19" lean-forward="true" selection-start-line="16" selection-start-column="19" selection-end-line="16" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/rota_gm.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="293">
<caret line="15" column="46" lean-forward="true" selection-start-line="15" selection-start-column="46" selection-end-line="15" selection-end-column="46" />
<state relative-caret-position="575">
<caret line="25" column="40" lean-forward="true" selection-start-line="25" selection-start-column="40" selection-end-line="25" selection-end-column="40" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/rota_gm_new.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="253">
<caret line="11" column="39" selection-start-line="11" selection-start-column="39" selection-end-line="11" selection-end-column="39" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
......
......@@ -10,3 +10,21 @@ Personnel_list={
20210619:"淑琴、婷婷"
}
Personnel_list_new = ["淑琴", "婷婷", "崔鑫", "张慧", "丙寅", "韧开", "陈雪", "林颖", "艮霞", "莹莹", "奉龙", "伟男"]
Personnel_list_1 ={
"淑琴":15201310698,
"婷婷":17796839512,
"崔鑫":17777863287,
"张慧":17610410225,
"丙寅":17601625117,
"韧开":18331001142,
"陈雪":18645658305,
"林颖":15033502665,
"艮霞":17610450939,
"莹莹":18301089928,
"奉龙":13608913121,
"伟男":18646292152
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ def test():
}
result = requests.get(url=url,params=params)
res = result.json()
pprint(res)
list = res.get("data").get("list")
for i in range(len(list)):
workday = list[i].get("workday")
......@@ -32,6 +33,10 @@ def test():
message = worker
if worker == None:
message = "还没有分配具体的值班人员请尽快分配"
# 钉钉报警
dd_url = "https://oapi.dingtalk.com/robot/send?access_token=062ab7f98f47c85e6c200efd21ae5d532e4f1bbfd6782ae1268b9a1f4d3dc7b9"
text = "明日开始休息:本次值班人员为:%s 值班人员记得带 电脑,手机, vpn环境" % {message}
json_text = {
......
import requests
from pprint import pprint
import peizhi
import redis,json
def test():
from datetime import date, timedelta
r = redis.Redis()
today = date.today()
format_today = today.strftime("%Y%m%d")
tomorrow = today + timedelta(days=1)
format_tomorrow = tomorrow.strftime("%Y%m%d")
days = []
url = "https://api.apihubs.cn/holiday/get"
params = {
"year":2021,
"size":1000
}
result = requests.get(url=url,params=params)
res = result.json()
pprint(res)
list = res.get("data").get("list")
for i in range(len(list)):
workday = list[i].get("workday")
if workday == 2:
date = list[i].get("date")
days.append(date)
message = ""
print(format_tomorrow)
print(format_today)
print(days)
# 如果明天是节假日 今天不是节假日,则进入判断
if int(format_tomorrow) in days and int(format_today) not in days:
# 循环判断接下来的时间,看这个假期有多长
for i in range(1,10):
print(i)
dayday = today + timedelta(days=i)
dayday = int(dayday.strftime("%Y%m%d"))
# 下一个是工作日 则跳出循环,以获得一共多长假期
if dayday not in days:
break
# redis 存储数据
redis_list = r.lrange("zhiban", 0, -1)
redis_list = [item.decode() for item in redis_list]
print("*"* 100)
print(redis_list)
print("*" * 100)
www = []
# 如果redis里面的列表是空的
if not redis_list:
new_list = peizhi.Personnel_list_new
else:
new_list = redis_list + peizhi.Personnel_list_new
# 取出来名字
for o in range(0, i):
print(i)
www.append(new_list[o])
new_list.remove(new_list[o])
r.delete("zhiban")
phone_list = []
for i in new_list:
phone = peizhi.Personnel_list_1.get(i)
phone_list.append(phone)
new_www = ' '.join(www)
print(new_www)
r.rpush("zhiban", *new_list)
dd_url = "https://oapi.dingtalk.com/robot/send?access_token=062ab7f98f47c85e6c200efd21ae5d532e4f1bbfd6782ae1268b9a1f4d3dc7b9"
text = "明日开始休假:休息 %s 天 值班人员为:%s 值班人员记得带 电脑,手机,调通vpn环境" %(i, new_www)
json_text = {
"msgtype": "text",
"at": {
"atMobiles": phone_list,
# 变为true 就会@所有人
"isAtAll": False
},
"text": {
"content": text
}
}
requests.post(url=dd_url, json=json_text, verify=False)
if __name__ == '__main__':
test()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment