Commit a0875ccb authored by lanjiali's avatar lanjiali

校区收入查询

parent e6ceac59
...@@ -19,12 +19,10 @@ ...@@ -19,12 +19,10 @@
<select /> <select />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="54f4d37d-1724-4813-a1e2-24e200088c5f" name="Default Changelist" comment="学生收入查询"> <list default="true" id="54f4d37d-1724-4813-a1e2-24e200088c5f" 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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/run.py" beforeDir="false" afterPath="$PROJECT_DIR$/run.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/run.py" beforeDir="false" afterPath="$PROJECT_DIR$/run.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_demo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_income.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.py" afterDir="false" />
</list> </list>
...@@ -179,9 +177,9 @@ ...@@ -179,9 +177,9 @@
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.run" /> <item itemvalue="Python.run" />
<item itemvalue="Python.report_config" />
<item itemvalue="Python.hooks" /> <item itemvalue="Python.hooks" />
<item itemvalue="Python tests.pytest for test_demo.Test_select_student_expense.test_period_screen" /> <item itemvalue="Python tests.pytest for test_demo.Test_select_student_expense.test_period_screen" />
<item itemvalue="Python.report_config" />
<item itemvalue="Python tests.pytest for test_demo.Test_select_student_expense.test_student_exponse" /> <item itemvalue="Python tests.pytest for test_demo.Test_select_student_expense.test_student_exponse" />
</list> </list>
</recent_temporary> </recent_temporary>
...@@ -279,7 +277,14 @@ ...@@ -279,7 +277,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1620301228395</updated> <updated>1620301228395</updated>
</task> </task>
<option name="localTasksCounter" value="13" /> <task id="LOCAL-00013" summary="校区收入查询">
<created>1620385172857</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1620385172857</updated>
</task>
<option name="localTasksCounter" value="14" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
...@@ -305,6 +310,7 @@ ...@@ -305,6 +310,7 @@
<MESSAGE value="学生费用预警查询-分页" /> <MESSAGE value="学生费用预警查询-分页" />
<MESSAGE value="校区费用预警-查询" /> <MESSAGE value="校区费用预警-查询" />
<MESSAGE value="学生收入查询" /> <MESSAGE value="学生收入查询" />
<option name="LAST_COMMIT_MESSAGE" value="学生收入查询" /> <MESSAGE value="校区收入查询" />
<option name="LAST_COMMIT_MESSAGE" value="校区收入查询" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -3,7 +3,7 @@ import os ...@@ -3,7 +3,7 @@ import os
if __name__ == '__main__': if __name__ == '__main__':
run_config = [ run_config = [
"-s", "./script/ji_yun_ying_pc/lanjiali_report/test_school_income.py::Test_school_income::test_school_income_total", "-s", "./script/ji_yun_ying_pc/lanjiali_report/test_student_income.py::Test_student_income::test_diffient_studentincome",
"--alluredir", "./report/xml", "--alluredir", "./report/xml",
"--host", "http://192.168.32.31", "--host", "http://192.168.32.31",
"--account", "b", "--account", "b",
......
...@@ -153,4 +153,13 @@ def select_years(): ...@@ -153,4 +153,13 @@ def select_years():
today = datetime.datetime.today() today = datetime.datetime.today()
year = today.year year = today.year
years = [year-1,year] years = [year-1,year]
return years return years
\ No newline at end of file
#查询校区名称
def get_schoolarea_name(school_area):
schoolarea_id = str(school_area)
sql = f"select name from service_user.department where id in ('{schoolarea_id}')"
schoolarea_name = OperationDb.query_sql(sql)
return schoolarea_name[0][0]
...@@ -154,32 +154,39 @@ class Test_school_income(): ...@@ -154,32 +154,39 @@ class Test_school_income():
"year": [select_year()], "year": [select_year()],
"pageSize": 10, "pageSize": 10,
"pageNum": 1, "pageNum": 1,
"schoolArea": school_area "schoolArea": [3063]
} }
school_income_res = report_finance_school_income_list_post(body=school_income_data, header=jyy_header) school_income_res = report_finance_school_income_list_post(body=school_income_data, header=jyy_header)
print(school_income_res) print(school_income_res)
if school_income_res['data']['list'] == []: assert school_income_res['msg'] == '成功'
assert school_income_res['code'] == 0
@allure.story("校区收入-分页查询")
def test_schoolincome_page(self):
school_income_data1 = {
"keyword": "",
"termStr": [select_term()],
"year": [select_year()],
"pageSize": 10,
"pageNum": 1,
"schoolArea": school_areas
}
school_income_res = report_finance_school_income_list_post(body=school_income_data1, header=jyy_header)
total = school_income_res['data']['total']
print(total)
if total <= 10:
assert school_income_res['msg'] == '成功' assert school_income_res['msg'] == '成功'
assert school_income_res['code'] == 0 assert school_income_res['data']['pageNum']
else: else:
school_total_income = jsonpath.jsonpath(school_income_res,"$.data.list..totalIncome") school_income_data2 = {
total_school_income = round(sum(school_total_income,2))
print(total_school_income)
student_income_data = {
"keyword": "", "keyword": "",
"studentStatus": [0],
"classType": [],
"grade": [],
"subject": [],
"termStr": [select_term()], "termStr": [select_term()],
"year": [select_year()], "year": [select_year()],
"pageSize": 100000, "pageSize": 10,
"pageNum": 1, "pageNum": 2,
"schoolArea": school_area "schoolArea": school_areas
} }
stuincome_res = report_finance_student_income_list_post(header=jyy_header, body=student_income_data) school_income_res2 = report_finance_school_income_list_post(body=school_income_data2, header=jyy_header)
print(stuincome_res) assert school_income_res2['msg'] == '成功'
student_totalincome_list = jsonpath.jsonpath(stuincome_res, "$.data.list..totalIncome") assert school_income_res2['data']['pageNum'] == 2
total_student_income = round(sum(student_totalincome_list), 2) \ No newline at end of file
print(total_student_income)
assert total_school_income == total_student_income
# 报表-学生收入查询 # 报表-学生收入查询
import random
import allure import allure
import pytest import pytest
import jsonpath import jsonpath
...@@ -196,6 +198,33 @@ class Test_student_income(): ...@@ -196,6 +198,33 @@ class Test_student_income():
assert res['code'] == 0 assert res['code'] == 0
@allure.story("学员收入-不同校区的学生收入")
@pytest.mark.parametrize("school_area",random.sample(school_areas,3))
def test_diffient_studentincome(self,school_area):
data = {
"keyword": "",
"studentStatus": [0],
"classType": [],
"grade": [],
"subject": [],
"termStr": [select_term()],
"year": [select_year()],
"pageSize": 10,
"pageNum": 1,
"schoolArea": [school_area]
}
res = report_finance_student_income_list_post(header=jyy_header,body=data)
if res['data']['total'] == 0:
assert res['msg'] == '成功'
assert res["code"] == 0
else:
school_area_list = jsonpath.jsonpath(res,"$.data.list..schoolAreaName")
schoolarea_name = get_schoolarea_name(school_area)
result = public_asserts.assert_res_field_equal_value(school_area_list,schoolarea_name)
pytest.assume(result)
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