Commit 386fc4c7 authored by lanjiali's avatar lanjiali

学生收入查询

parent 31d2f8e5
...@@ -20,8 +20,11 @@ ...@@ -20,8 +20,11 @@
</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_income.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_student_income.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_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" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/test_school_expense.py" afterDir="false" />
</list> </list>
...@@ -262,7 +265,14 @@ ...@@ -262,7 +265,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1619697582572</updated> <updated>1619697582572</updated>
</task> </task>
<option name="localTasksCounter" value="11" /> <task id="LOCAL-00011" summary="校区费用预警-查询">
<created>1619776864150</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1619776864150</updated>
</task>
<option name="localTasksCounter" value="12" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
...@@ -289,15 +299,4 @@ ...@@ -289,15 +299,4 @@
<MESSAGE value="校区费用预警-查询" /> <MESSAGE value="校区费用预警-查询" />
<option name="LAST_COMMIT_MESSAGE" value="校区费用预警-查询" /> <option name="LAST_COMMIT_MESSAGE" value="校区费用预警-查询" />
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/script/ji_yun_ying_pc/lanjiali_report/data_config/report_config.py</url>
<line>64</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</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_expense.py", "-s", "./script/ji_yun_ying_pc/lanjiali_report/test_student_income.py",
"--alluredir", "./report/xml", "--alluredir", "./report/xml",
"--host", "http://192.168.32.31", "--host", "http://192.168.32.31",
"--account", "b", "--account", "b",
......
...@@ -14,10 +14,11 @@ keywords = [ ...@@ -14,10 +14,11 @@ keywords = [
"keyword_type":"studenNo" "keyword_type":"studenNo"
}, },
{ {
"keyword":'19900646794', "keyword":'19900225325',
"keyword_type": "phone" "keyword_type": "phone"
} }
] ]
#19900646794
#校区id #校区id
school_areas = [2389,2398,3363,3015,3154,3352,2369,3095,3348,3333,3351,3359,3345,3365,3362,3339, school_areas = [2389,2398,3363,3015,3154,3352,2369,3095,3348,3333,3351,3359,3345,3365,3362,3339,
...@@ -32,10 +33,10 @@ school_areas = [2389,2398,3363,3015,3154,3352,2369,3095,3348,3333,3351,3359,3345 ...@@ -32,10 +33,10 @@ school_areas = [2389,2398,3363,3015,3154,3352,2369,3095,3348,3333,3351,3359,3345
3156,3155,3097,3098,3141,3069,2405,2399,2397,2360,3145,2420,2404,2374,2401,3054, 3156,3155,3097,3098,3141,3069,2405,2399,2397,2360,3145,2420,2404,2374,2401,3054,
3124] 3124]
#查询学生id列表对应的手机号 #查询学生no列表对应的手机号
def select_student_phone(student_ids): def select_student_phone(student_Nos):
studentid = "','".join([str(x) for x in student_ids]) studentno = "','".join([str(x) for x in student_Nos])
sql = f"select student_prim_phone_no from service_profile.student where student_id in ('{studentid}')" sql = f"select student_prim_phone_no from service_profile.student where student_no in ('{studentno}')"
student_prim_phone_no = OperationDb().query_sql(sql) student_prim_phone_no = OperationDb().query_sql(sql)
return [x[0] for x in student_prim_phone_no]\ return [x[0] for x in student_prim_phone_no]\
...@@ -45,8 +46,6 @@ def select_year(): ...@@ -45,8 +46,6 @@ def select_year():
year = today.year year = today.year
return year return year
#select_year()
#期段 #期段
def select_term(): def select_term():
today = datetime.datetime.today() today = datetime.datetime.today()
...@@ -61,7 +60,7 @@ def select_term(): ...@@ -61,7 +60,7 @@ def select_term():
term = '寒' term = '寒'
return term return term
#学生的在读状态 #预警报表:学生的在读状态
student_statuses = [ student_statuses = [
{ {
'status':[1110], 'status':[1110],
...@@ -125,3 +124,23 @@ groups = [ ...@@ -125,3 +124,23 @@ groups = [
"group_type":"大区" "group_type":"大区"
} }
] ]
#学员收入的学生状态。
income_student_status = [
{
"statu":0,
"statu_type":["全部学员"]
},
{
"statu": 1,
"statu_type": ['在读']
},
{
"statu": 2,
"statu_type": ['出班']
},
{
"statu": 3,
"statu_type": ['结业']
}
]
\ No newline at end of file
...@@ -43,9 +43,9 @@ class Test_select_student_expense: ...@@ -43,9 +43,9 @@ class Test_select_student_expense:
result = public_asserts.assert_res_field_equal_value(student_NO,keyword_value) result = public_asserts.assert_res_field_equal_value(student_NO,keyword_value)
pytest.assume(result) pytest.assume(result)
elif keyword_type == "phone": elif keyword_type == "phone":
student_id = jsonpath.jsonpath(res,"$.data.list..studentId") student_no = jsonpath.jsonpath(res,"$.data.list..studentNo")
# 调用查询返回的学生id下的学生手机号 # 调用查询返回的学生no下的学生手机号
studentphone_list = select_student_phone(student_id) studentphone_list = select_student_phone(student_no)
result = public_asserts.assert_res_field_equal_value(studentphone_list,keyword_value) result = public_asserts.assert_res_field_equal_value(studentphone_list,keyword_value)
pytest.assume(result) pytest.assume(result)
......
...@@ -220,5 +220,37 @@ class Test_select_school_expense_warning(): ...@@ -220,5 +220,37 @@ class Test_select_school_expense_warning():
"year,term,subject,grade,classtype", "year,term,subject,grade,classtype",
[(select_year(), select_term(), subjects[3], grades[2],"极趣班")] [(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
# 报表-学生收入查询
import allure
import pytest
import jsonpath
from script.base_api import report_finance_student_income_list_post
from script.ji_yun_ying_pc.lanjiali_report.data_config.report_config import *
from script.default_header import jyy_header
from script import public_asserts
@allure.feature("收入报表-学生收入查询")
class Test_student_income():
@allure.story("学生收入-关键字查询")
@pytest.mark.parametrize("keyword", keywords)
def test_keywords_select(self,keyword):
keyword_value = keyword.get("keyword")
print(keyword_value)
keyword_type = keyword.get("keyword_type")
data = {
"keyword": keyword_value,
"studentStatus": [0],
"classType": [],
"grade": [],
"subject": [],
"termStr": [select_term()],
"year": [select_year()],
"pageSize": 10,
"pageNum": 1,
"schoolArea": school_areas[0:50]
}
res = report_finance_student_income_list_post(header=jyy_header,body= data)
if res['data']['list'] == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
if keyword_type == 'studentName':
student_names = jsonpath.jsonpath(res, "$.data.list..studentName")
result = public_asserts.assert_res_field_contain_value(student_names, keyword_value)
pytest.assume(result)
elif keyword_type == 'studentNo':
student_NO = jsonpath.jsonpath(res, "$.data.list..studentNo")
result = public_asserts.assert_res_field_equal_value(student_NO, keyword_value)
pytest.assume(result)
elif keyword_type == "phone":
student_No = jsonpath.jsonpath(res, "$.data.list..studentNo")
# 调用查询返回的学生id下的学生手机号
studentphone_list = select_student_phone(student_No)
result = public_asserts.assert_res_field_equal_value(studentphone_list, keyword_value)
pytest.assume(result)
@allure.story("学生收入-年份查询")
@pytest.mark.parametrize("year",[select_year()])
def test_select_year(self,year):
data = {
"keyword": "蓝",
"studentStatus": [0],
"classType": [],
"grade": [],
"subject": [],
"termStr": [select_term()],
"year": [year],
"pageSize": 10,
"pageNum": 1,
"schoolArea": school_areas[0:30]
}
res = report_finance_student_income_list_post(header=jyy_header,body=data)
@allure.story("学生收入-期段查询")
@pytest.mark.parametrize("term",[select_term()])
def test_select_term(self,term):
data = {
"keyword": "蓝",
"studentStatus": [0],
"classType": [],
"grade": [],
"subject": [],
"termStr": [term],
"year": [select_year()],
"pageSize": 10,
"pageNum": 1,
"schoolArea": school_areas[0:30]
}
res = report_finance_student_income_list_post(header=jyy_header,body=data)
classname_list = jsonpath.jsonpath(res,"$.data.list..className")
if classname_list == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
result = public_asserts.assert_res_field_contain_value(classname_list,term)
pytest.assume(result)
@allure.story("学生收入-学员状态查询")
@pytest.mark.parametrize("student_statu",income_student_status)
def test_student_statu(self,student_statu):
statu_value = student_statu.get("statu")
statu_type = student_statu.get("statu_type")
data = {
"keyword": "蓝",
"studentStatus": [statu_value],
"classType": [],
"grade": [],
"subject": [],
"termStr": [select_term()],
"year": [select_year()],
"pageSize": 10,
"pageNum": 1,
"schoolArea": school_areas[0:30]
}
res = report_finance_student_income_list_post(header=jyy_header,body=data)
studentstatu_list = jsonpath.jsonpath(res,"$.data.list..studentStatusName")
if studentstatu_list == []:
assert res['msg'] == '成功'
assert res['code'] == 0
else:
if statu_type == '全部学员':
result = public_asserts.assert_res_field_in_list(studentstatu_list,['在读','出班','结业'])
pytest.assume(result)
elif statu_type == '在读':
result = public_asserts.assert_res_field_equal_value(studentstatu_list,statu_type)
pytest.assume(result)
elif statu_type == '出班':
result = public_asserts.assert_res_field_equal_value(studentstatu_list,statu_type)
pytest.assume(result)
elif statu_type == '结业':
result = public_asserts.assert_res_field_equal_value(studentstatu_list,statu_type)
pytest.assume(result)
@allure.story("学生收入-分页判断")
def test_studentincone_page(self):
data1 = {
"keyword": "蓝",
"studentStatus": [0],
"classType": [],
"grade": [],
"subject": [],
"termStr": [select_term()],
"year": [select_year()],
"pageSize": 10,
"pageNum": 1,
"schoolArea": school_areas[0:30]
}
res1 = report_finance_student_income_list_post(header=jyy_header, body=data1)
total = res1['data']['total']
if total <= 10:
assert res1["msg"] == '成功'
assert res1["code"] == 0
assert res1['data']['pageNum'] == 1
else:
data2 = {
"keyword": "蓝",
"studentStatus": [0],
"classType": [],
"grade": [],
"subject": [],
"termStr": [select_term()],
"year": [select_year()],
"pageSize": 10,
"pageNum": 2,
"schoolArea": school_areas[0:30]
}
res2 = report_finance_student_income_list_post(header=jyy_header, body=data2)
assert res2["msg"] == '成功'
assert res2["code"] == 0
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