Commit 48a25d80 authored by lanjiali's avatar lanjiali

校区费用预警

parent a0875ccb
...@@ -20,11 +20,10 @@ ...@@ -20,11 +20,10 @@
</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 afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py" afterDir="false" />
<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/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_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" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -284,7 +283,14 @@ ...@@ -284,7 +283,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1620385172857</updated> <updated>1620385172857</updated>
</task> </task>
<option name="localTasksCounter" value="14" /> <task id="LOCAL-00014" summary="校区收入查询">
<created>1620468346117</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1620468346117</updated>
</task>
<option name="localTasksCounter" value="15" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
......
...@@ -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_student_income.py::Test_student_income::test_diffient_studentincome", "-s", "./script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py",
"--alluredir", "./report/xml", "--alluredir", "./report/xml",
"--host", "http://192.168.32.31", "--host", "http://192.168.32.31",
"--account", "b", "--account", "b",
......
...@@ -33,7 +33,11 @@ class Test_select_student_expense: ...@@ -33,7 +33,11 @@ class Test_select_student_expense:
"term": "春", "term": "春",
"schoolAreaIds": school_areas "schoolAreaIds": school_areas
} }
res = report_finance_student_expense_warning_post(body=data ,header=jyy_header ) res = report_finance_student_expense_warning_post(body=data ,header=jyy_header)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
if keyword_type == "studentName": if keyword_type == "studentName":
student_names = jsonpath.jsonpath(res, "$.data.list..studentName") student_names = jsonpath.jsonpath(res, "$.data.list..studentName")
result = public_asserts.assert_res_field_contain_value(student_names, keyword_value) result = public_asserts.assert_res_field_contain_value(student_names, keyword_value)
...@@ -57,11 +61,15 @@ class Test_select_student_expense: ...@@ -57,11 +61,15 @@ class Test_select_student_expense:
"pageSize": 10, "pageSize": 10,
"studentStatuses": [1110], "studentStatuses": [1110],
"year": year, "year": year,
"keyword": '蓝', "keyword": '',
"term": "春", "term": "春",
"schoolAreaIds": school_areas "schoolAreaIds": school_areas[0:50]
} }
res = report_finance_student_expense_warning_post(header = jyy_header,body = data) res = report_finance_student_expense_warning_post(header = jyy_header,body = data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
years = jsonpath.jsonpath(res,"$.data.list..year") years = jsonpath.jsonpath(res,"$.data.list..year")
result = public_asserts.assert_res_field_equal_value(years,year) result = public_asserts.assert_res_field_equal_value(years,year)
pytest.assume(result) pytest.assume(result)
...@@ -79,6 +87,10 @@ class Test_select_student_expense: ...@@ -79,6 +87,10 @@ class Test_select_student_expense:
"schoolAreaIds": school_areas "schoolAreaIds": school_areas
} }
res = report_finance_student_expense_warning_post(header=jyy_header, body=data) res = report_finance_student_expense_warning_post(header=jyy_header, body=data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
terms = jsonpath.jsonpath(res,"$.data.list..term") terms = jsonpath.jsonpath(res,"$.data.list..term")
result = public_asserts.assert_res_field_equal_value(terms,term) result = public_asserts.assert_res_field_equal_value(terms,term)
pytest.assume(result) pytest.assume(result)
...@@ -98,6 +110,10 @@ class Test_select_student_expense: ...@@ -98,6 +110,10 @@ class Test_select_student_expense:
"schoolAreaIds": school_areas "schoolAreaIds": school_areas
} }
res = report_finance_student_expense_warning_post(header= jyy_header, body= data) res = report_finance_student_expense_warning_post(header= jyy_header, body= data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
student_status = jsonpath.jsonpath(res,"$.data.list..studentStatus") student_status = jsonpath.jsonpath(res,"$.data.list..studentStatus")
if status_meaning == '在读学员': if status_meaning == '在读学员':
result = public_asserts.assert_res_field_in_list(student_status,status_value) result = public_asserts.assert_res_field_in_list(student_status,status_value)
...@@ -125,6 +141,10 @@ class Test_select_student_expense: ...@@ -125,6 +141,10 @@ class Test_select_student_expense:
"grades": [grade] "grades": [grade]
} }
res = report_finance_student_expense_warning_post(header= jyy_header,body= data) res = report_finance_student_expense_warning_post(header= jyy_header,body= data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
grade_list = jsonpath.jsonpath(res,"$.data.list..grade") grade_list = jsonpath.jsonpath(res,"$.data.list..grade")
if grade == '一年级': if grade == '一年级':
result = public_asserts.assert_res_field_equal_value(grade_list,'1年级') result = public_asserts.assert_res_field_equal_value(grade_list,'1年级')
...@@ -139,7 +159,7 @@ class Test_select_student_expense: ...@@ -139,7 +159,7 @@ class Test_select_student_expense:
result = public_asserts.assert_res_field_equal_value(grade_list,'4年级') result = public_asserts.assert_res_field_equal_value(grade_list,'4年级')
pytest.assume(result) pytest.assume(result)
@allure.title('学生费用预警-学科筛选') @allure.story('学生费用预警-学科筛选')
@pytest.mark.parametrize("subject", subjects) @pytest.mark.parametrize("subject", subjects)
def test_select_subject(self,subject): def test_select_subject(self,subject):
data = { data = {
...@@ -153,6 +173,10 @@ class Test_select_student_expense: ...@@ -153,6 +173,10 @@ class Test_select_student_expense:
"subjects": [subject] "subjects": [subject]
} }
res = report_finance_student_expense_warning_post(header=jyy_header, body=data) res = report_finance_student_expense_warning_post(header=jyy_header, body=data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
subject_list = jsonpath.jsonpath(res,'$.data.list..subject') subject_list = jsonpath.jsonpath(res,'$.data.list..subject')
if subject == '语文': if subject == '语文':
result = public_asserts.assert_res_field_equal_value(subject_list,subject) result = public_asserts.assert_res_field_equal_value(subject_list,subject)
...@@ -187,6 +211,10 @@ class Test_select_student_expense: ...@@ -187,6 +211,10 @@ class Test_select_student_expense:
"schoolAreaIds": school_areas "schoolAreaIds": school_areas
} }
res = report_finance_student_expense_warning_post(header=jyy_header, body=data) res = report_finance_student_expense_warning_post(header=jyy_header, body=data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
class_type_list = jsonpath.jsonpath(res,"$.data.list..classType") class_type_list = jsonpath.jsonpath(res,"$.data.list..classType")
if classtype_name == '常规班课': if classtype_name == '常规班课':
result = public_asserts.assert_res_field_in_list(class_type_list,class_types_value) result = public_asserts.assert_res_field_in_list(class_type_list,class_types_value)
...@@ -267,6 +295,10 @@ class Test_select_student_expense: ...@@ -267,6 +295,10 @@ class Test_select_student_expense:
"schoolAreaIds": school_areas "schoolAreaIds": school_areas
} }
res = report_finance_student_expense_warning_post(header= jyy_header,body= data) res = report_finance_student_expense_warning_post(header= jyy_header,body= data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
#获取返回的学生预收课时数,判断与接口返回的计算结果一致 #获取返回的学生预收课时数,判断与接口返回的计算结果一致
total_prepaidNum = jsonpath.jsonpath(res,"$.data.extend.prepaidNum") total_prepaidNum = jsonpath.jsonpath(res,"$.data.extend.prepaidNum")
...@@ -379,9 +411,9 @@ class Test_select_student_expense: ...@@ -379,9 +411,9 @@ class Test_select_student_expense:
"pageSize": 10, "pageSize": 10,
"studentStatuses": [1110], "studentStatuses": [1110],
"year": select_year(), "year": select_year(),
"keyword": '蓝', "keyword": '',
"term": select_term(), "term": select_term(),
"schoolAreaIds": school_areas "schoolAreaIds": school_areas[0:20]
} }
res = report_finance_student_expense_warning_post(header=jyy_header,body=data) res = report_finance_student_expense_warning_post(header=jyy_header,body=data)
studentexpense_total = res['data']['total'] studentexpense_total = res['data']['total']
...@@ -394,9 +426,9 @@ class Test_select_student_expense: ...@@ -394,9 +426,9 @@ class Test_select_student_expense:
"pageSize": 10, "pageSize": 10,
"studentStatuses": [1110], "studentStatuses": [1110],
"year": select_year(), "year": select_year(),
"keyword": '蓝', "keyword": '',
"term": select_term(), "term": select_term(),
"schoolAreaIds": school_areas "schoolAreaIds": school_areas[0:20]
} }
res_page2 = report_finance_student_expense_warning_post(header=jyy_header,body=data2) res_page2 = report_finance_student_expense_warning_post(header=jyy_header,body=data2)
assert res_page2['msg'] == '成功' assert res_page2['msg'] == '成功'
......
# 校区费用预警
import allure
import pytest
import jsonpath
from script import public_asserts
from script.base_api import report_finance_school_expense_warning_post,report_finance_student_expense_warning_post
from script.ji_yun_ying_pc.lanjiali_report.data_config.report_config import *
from script.default_header import jyy_header
@allure.feature("预警报表-校区费用预警查询")
class Test_select_school_expense_warning():
@allure.story("校区费用预警-按年份筛选")
@pytest.mark.parametrize("year",[select_year()])
def test_select_year(self,year):
print(year)
data = {
"pageNum": 1,
"pageSize": 10,
"year": year,
"term": "春",
"schoolAreaIds": school_areas,
"groups": ["school_area_id"]
}
res = report_finance_school_expense_warning_post(header=jyy_header,body=data)
assert res['msg'] == '成功'
assert res['code'] == 0
@allure.story("校区费用预警-按期段筛选")
@pytest.mark.parametrize("term",[select_term()])
def test_select_term(self,term):
data = {
"pageNum": 1,
"pageSize": 10,
"year": select_year(),
"term": term,
"schoolAreaIds": school_areas,
"groups": ["school_area_id"]
}
res = report_finance_school_expense_warning_post(header=jyy_header,body=data)
assert res['msg'] == '成功'
assert res['code'] == 0
@allure.story("校区费用预警-组合筛选")
@pytest.mark.parametrize(
'year,term,grade,subject,classtype',
[
(
select_year(),select_term(),grades[2],subjects[3],'极趣班'
)
]
)
def test_select_all(self,year,term,grade,subject,classtype):
data = {
"pageNum": 1,
"pageSize": 10,
"year": year,
"term": term,
"subjects": [subject],
"grades": [grade],
"classTypes": [classtype],
"schoolAreaIds": school_areas,
"groups": ["school_area_id"]
}
res = report_finance_school_expense_warning_post(header=jyy_header, body=data)
assert res['msg'] == '成功'
assert res['code'] == 0
@allure.story("校区费用预警-汇总数据校验")
@pytest.mark.parametrize(
"year,term,subject,grade,classtype",
[(
select_year(),select_term(),subjects[4],grades[2],"数学"
)]
)
def test_schoolExtend_total(self,year,term,subject,grade,classtype):
data = {
"pageNum": 1,
"pageSize": 10,
"year": year,
"term": term,
"subjects": [subject],
"grades": [grade],
"classTypes": [classtype],
"schoolAreaIds": school_areas,
"groups": ["school_area_id"]
}
schoolexpense_res = report_finance_school_expense_warning_post(header=jyy_header,body=data)
#获取学生费用预警汇总数据
student_expense_data = {
"pageNum": 1,
"pageSize": 10000,
"year": year,
"term": term,
"subjects": [subject],
"grades": [grade],
"classTypes": [classtype],
"schoolAreaIds": school_areas,
"studentStatuses": [1110, 1140, 1150, 1120, 1130, 1160]
}
studentexpense_res = report_finance_student_expense_warning_post(header=jyy_header,body=student_expense_data)
if schoolexpense_res['data']['list'] != []:
#校区汇总的预收课时总数与学生预收课时总数判断
school_prepaidNum_total = round(schoolexpense_res['data']['extend']['prepaidNum'],2)
student_prepaidNum_total = round(studentexpense_res['data']['extend']['prepaidNum'], 2)
assert school_prepaidNum_total == student_prepaidNum_total
print(school_prepaidNum_total)
#校区汇总的预收课程净额
school_prepaidAmount_total = round(schoolexpense_res['data']['extend']['prepaidAmount'],2)
student_prepaidAmount_total = round(studentexpense_res['data']['extend']['prepaidAmount'], 2)
assert school_prepaidAmount_total == student_prepaidAmount_total
print(school_prepaidAmount_total)
#校区汇总的课消课时数
school_attendanceNum_total = round(schoolexpense_res['data']['extend']['attendanceNum'],2)
student_attendanceNum_total = round(studentexpense_res['data']['extend']['attendanceNum'], 2)
assert school_attendanceNum_total == student_attendanceNum_total
print(school_attendanceNum_total)
#校区汇总的溢价
school_premium_total = round(schoolexpense_res['data']['extend']['premium'],2)
student_premium_total = round(studentexpense_res['data']['extend']['premium'], 2)
print(school_premium_total)
assert school_premium_total == student_premium_total
#校区汇总的其他抵扣
school_otherDeduction_total = round(schoolexpense_res['data']['extend']['otherDeduction'],2)
student_otherDeduction_total = round(studentexpense_res['data']['extend']['otherDeduction'], 2)
print(school_otherDeduction_total)
assert school_otherDeduction_total == student_otherDeduction_total
#校区差异调整汇总 imbalanceAmount
school_imbalanceAmount_total = round(schoolexpense_res['data']['extend']['imbalanceAmount'],2)
student_imbalanceAmount_total = round(studentexpense_res['data']['extend']['imbalanceAmount'], 2)
assert school_imbalanceAmount_total == student_imbalanceAmount_total
print(school_imbalanceAmount_total)
else:
assert schoolexpense_res['msg'] == '成功'
assert schoolexpense_res['code'] == 0
@allure.story("校区费用预警-不同校区的列表数据正确")
@pytest.mark.parametrize(
#[2389]:成都金沙中心校 [3063]:创意山中心校
"year,term,subject,grade,classtype,schoolarea",
[
(select_year(), select_term(), subjects[3], grades[2], "极趣班",[2389]),
(select_year(), select_term(), subjects[3], grades[2], "极趣班", [3063])
]
)
def test_diffient_schoolexpense_total(self,year,term,subject,grade,classtype,schoolarea):
print(grade,subject)
schoolexpense_data = {
"pageNum": 1,
"pageSize": 10,
"year": year,
"term": term,
"subjects": [subject],
"grades": [grade],
"classTypes": [classtype],
"schoolAreaIds": schoolarea,
"groups": ["school_area_id"]
}
schoolexpense_res = report_finance_school_expense_warning_post(header=jyy_header,body=schoolexpense_data)
#获取对应校区学生的费用预警总额
studentexpense_data = {
"pageNum": 1,
"pageSize": 10000,
"year": year,
"term": term,
"subjects": [subject],
"grades": [grade],
"classTypes": [classtype],
"schoolAreaIds": schoolarea,
"studentStatuses": [1110, 1140, 1150, 1120, 1130, 1160]
}
studentexpense_res = report_finance_student_expense_warning_post(header=jyy_header,body=studentexpense_data)
if schoolexpense_res['data']['list'] == []:
assert schoolexpense_res['code'] == 0
assert schoolexpense_res['msg'] == '成功'
else:
# 校区汇总的预收课时总数与学生预收课时总数判断
school_prepaidNum_total = round(schoolexpense_res['data']['extend']['prepaidNum'], 2)
student_prepaidNum_total = round(studentexpense_res['data']['extend']['prepaidNum'], 2)
assert school_prepaidNum_total == student_prepaidNum_total
# 校区汇总的预收课程净额
school_prepaidAmount_total = round(schoolexpense_res['data']['extend']['prepaidAmount'], 2)
student_prepaidAmount_total = round(studentexpense_res['data']['extend']['prepaidAmount'], 2)
assert school_prepaidAmount_total == student_prepaidAmount_total
# 校区汇总的课消课时数
school_attendanceNum_total = round(schoolexpense_res['data']['extend']['attendanceNum'], 2)
student_attendanceNum_total = round(studentexpense_res['data']['extend']['attendanceNum'], 2)
assert school_attendanceNum_total == student_attendanceNum_total
# 校区汇总的溢价
school_premium_total = round(schoolexpense_res['data']['extend']['premium'], 2)
student_premium_total = round(studentexpense_res['data']['extend']['premium'], 2)
assert school_premium_total == student_premium_total
# 校区汇总的其他抵扣
school_otherDeduction_total = round(schoolexpense_res['data']['extend']['otherDeduction'], 2)
student_otherDeduction_total = round(studentexpense_res['data']['extend']['otherDeduction'], 2)
assert school_otherDeduction_total == student_otherDeduction_total
# 校区差异调整汇总 imbalanceAmount
school_imbalanceAmount_total = round(schoolexpense_res['data']['extend']['imbalanceAmount'], 2)
student_imbalanceAmount_total = round(studentexpense_res['data']['extend']['imbalanceAmount'], 2)
assert school_imbalanceAmount_total == student_imbalanceAmount_total
@allure.story("校区费用预警-分页")
@pytest.mark.parametrize(
"year,term,subject,grade,classtype",
[(select_year(), select_term(), subjects[3], grades[2],"极趣班")]
)
def test_page(self,year,term,subject,grade,classtype):
data = {
"pageNum": 1,
"pageSize": 10,
"year": year,
"term": term,
"subjects": [subject],
"grades": [grade],
"classTypes": [classtype],
"schoolAreaIds": school_areas,
"groups": ["school_area_id"]
}
res1 = report_finance_school_expense_warning_post(header=jyy_header,body=data)
schoolexpense_total = res1['data']['total']
if schoolexpense_total <= 10:
assert res1['msg'] == '成功'
assert res1['data']['pageNum'] == 1
else:
data2 = {
"pageNum": 2,
"pageSize": 10,
"year": year,
"term": term,
"subjects": [subject],
"grades": [grade],
"classTypes": [classtype],
"schoolAreaIds": school_areas,
"groups": ["school_area_id"]
}
res2 = report_finance_school_expense_warning_post(header=jyy_header,body=data2)
assert res2['msg'] == '成功'
assert res2['data']['pageNum'] == 2
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