Commit 2520c23b authored by huangqiang's avatar huangqiang

完成基础参数设置

parent e734a68a
...@@ -2,33 +2,27 @@ ...@@ -2,33 +2,27 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="ceb24b37-65a1-4b3f-be3f-7040ebc4079d" name="默认变更列表" comment=""> <list default="true" id="ceb24b37-65a1-4b3f-be3f-7040ebc4079d" name="默认变更列表" comment="">
<change afterPath="$PROJECT_DIR$/script/base_api_data/service_crm/dict_data.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/global_data_config/class_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/base_api_data/service_education/__init__.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/global_data_config/date_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/base_api_data/service_education/education_data.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/global_data_config/school_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/__init__.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/script/global_data_config/target_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/assert_config/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/assert_config/education_download_assert.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/data_config/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/data_config/suite_data.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/jyy_download_file/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/download_flle/jyy_download_file/test_education_download.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/script/global_data_config/download_file.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" 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$/common/run_method.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/run_method.py" 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/base_api_data/service-education/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_crm/__init__.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/base_api_data/service_education/education_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_education/education_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/base_api_data/service-education/system_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_education/system_data.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/base_api_data/service_education/system_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_education/system_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/base_api_data/service_gos/gos_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_gos/gos_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/base_api_data/service_public/targets_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_public/targets_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/base_api_data/service_statistics/statistics_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/base_api_data/service_statistics/statistics_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ding_ding_jdata/data_config/global_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ding_ding_jdata/data_config/global_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/global_data_config/global_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/global_data_config/global_data.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/global_data_config/global_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/global_data_config/global_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/data_config/data_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/data_config/data_config.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/statistical_report/data_config/operation_analysis_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/statistical_report/data_config/operation_analysis_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/assert_config/basic_parameter_set_assert.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/assert_config/basic_parameter_set_assert.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/global_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/global_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/query_sql.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/query_sql.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/public_asserts.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/public_asserts.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/script/public_asserts.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/public_asserts.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_add_class.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_delete_class.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_delete_class.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_update_class.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_class_handle/xin_update_class.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_course.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_course_handle/xin_update_course.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_network.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/xin_project_patriarch_app/xin_static/xin_educational/xin_network.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools/url_to_method.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/url_to_method.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/tools/url_to_method.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/url_to_method.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -74,7 +68,7 @@ ...@@ -74,7 +68,7 @@
</key> </key>
</component> </component>
<component name="RunManager" selected="Python.run"> <component name="RunManager" selected="Python.run">
<configuration name="debug" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="basic_parameter_set_data" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="jk_interface_test" /> <module name="jk_interface_test" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -82,11 +76,11 @@ ...@@ -82,11 +76,11 @@
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/debug.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/ji_yun_ying_pc/system_set/data_config/basic_parameter_set_data.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
...@@ -95,7 +89,7 @@ ...@@ -95,7 +89,7 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="download_file" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="class_data" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="jk_interface_test" /> <module name="jk_interface_test" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -107,7 +101,7 @@ ...@@ -107,7 +101,7 @@
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/global_data_config/download_file.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/global_data_config/class_data.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
...@@ -116,7 +110,7 @@ ...@@ -116,7 +110,7 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="education_download_assert" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="date_data" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="jk_interface_test" /> <module name="jk_interface_test" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
...@@ -124,11 +118,11 @@ ...@@ -124,11 +118,11 @@
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/download_flle/assert_config" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/script/global_data_config" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/download_flle/assert_config/education_download_assert.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/script/global_data_config/date_data.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
...@@ -182,10 +176,10 @@ ...@@ -182,10 +176,10 @@
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.run" /> <item itemvalue="Python.run" />
<item itemvalue="Python.education_download_assert" /> <item itemvalue="Python.basic_parameter_set_data" />
<item itemvalue="Python.debug" />
<item itemvalue="Python.url_to_method" /> <item itemvalue="Python.url_to_method" />
<item itemvalue="Python.download_file" /> <item itemvalue="Python.date_data" />
<item itemvalue="Python.class_data" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
......
...@@ -62,7 +62,7 @@ class RunTest: ...@@ -62,7 +62,7 @@ class RunTest:
if __name__ == '__main__': if __name__ == '__main__':
case_path_list = [ case_path_list = [
"./script/download_flle/jyy_download_file/test_education_download.py", "./script/ji_yun_ying_pc/system_set/test_basic_parameter_set.py::TestFullClassTargetSet",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject",
......
from script.base_api.service_education.education import education_classes_query_post from script.base_api.service_education.education import education_classes_query_post
from script.global_data_config.global_data import GlobalDataConfig from script.global_data_config.global_data import GlobalDataConfig
from script.base_api.service_education.classCapacity import classCapacity_query_post
from script.default_header import jyy_header from script.default_header import jyy_header
# 查询班级列表
class QueryClassList: class QueryClassList:
def __init__(self, courseType="常规班课", pageNum=1, pageSize=10, schoolAreaIds=None): def __init__(self, courseType="常规班课", pageNum=1, pageSize=10, schoolAreaIds=None):
...@@ -13,4 +15,18 @@ class QueryClassList: ...@@ -13,4 +15,18 @@ class QueryClassList:
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs): def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
body = {**self.__dict__, **other_field} body = {**self.__dict__, **other_field}
return education_classes_query_post(body=body, header=header, return_json=return_json, **kwargs) return education_classes_query_post(body=body, header=header, return_json=return_json, **kwargs)
\ No newline at end of file
# 查询满班目标
class QueryFullClassTarget:
def __init__(self, pageNum=1, pageSize=10, grade="", subject=""):
self.pageNum = pageNum
self.pageSize = pageSize
self.grade = grade
self.subject = subject
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
body = {**self.__dict__, **other_field}
return classCapacity_query_post(body=body, header=header, return_json=return_json, **kwargs)
\ No newline at end of file
...@@ -3,6 +3,7 @@ from script.base_api.service_education.system import system_setting_querySystemS ...@@ -3,6 +3,7 @@ from script.base_api.service_education.system import system_setting_querySystemS
from script.default_header import jyy_header from script.default_header import jyy_header
# 查询系统设置(默认退费原因)
class QuerySystemSetting: class QuerySystemSetting:
def __init__(self, types=["refundReason"]): def __init__(self, types=["refundReason"]):
......
...@@ -2,6 +2,7 @@ from script.base_api.service_gos.gos import gos_upload_uploadGoods_file_post ...@@ -2,6 +2,7 @@ from script.base_api.service_gos.gos import gos_upload_uploadGoods_file_post
from script.default_header import jyy_header from script.default_header import jyy_header
# 上传图片
class GosUploadGoodsFile: class GosUploadGoodsFile:
def __init__(self, base64files=None): def __init__(self, base64files=None):
......
...@@ -3,6 +3,7 @@ from script.global_data_config.global_data import GlobalDataConfig ...@@ -3,6 +3,7 @@ from script.global_data_config.global_data import GlobalDataConfig
from script.default_header import jyy_header from script.default_header import jyy_header
# 设置目标方案
class TargetSet: class TargetSet:
def __init__(self, school_area_id, target_data: dict, target=None): def __init__(self, school_area_id, target_data: dict, target=None):
......
...@@ -3,15 +3,12 @@ from script.base_api.service_statistics.statistics import statistics_query_conti ...@@ -3,15 +3,12 @@ from script.base_api.service_statistics.statistics import statistics_query_conti
from script.base_api.service_statistics.statistics import statistics_refundRate_post from script.base_api.service_statistics.statistics import statistics_refundRate_post
from script.base_api.service_statistics.statistics import statistics_fullClass_rate_post from script.base_api.service_statistics.statistics import statistics_fullClass_rate_post
from script.base_api.service_statistics.statistics import statistics_supplementaryPayment_post from script.base_api.service_statistics.statistics import statistics_supplementaryPayment_post
from script.global_data_config.school_data import SchoolDataConfig
from script.default_header import jyy_header from script.default_header import jyy_header
from common.operation_time import GetTime from common.operation_time import GetTime
# 成都一区的校区ID
cd1_school_area_id = [3104, 3166, 3334, 3335, 3337, 3339, 3340, 3373, 3158, 2371, 2389, 2400,
3069, 3099, 3149, 2397, 2398, 3044, 3054, 3063, 2369, 2385, 2386, 2388,
2399, 2401, 3097, 3137, 3155, 3156, 2416, 3039, 3065, 3167, 2368, 3071]
# 查询人次
class PersonTime: class PersonTime:
def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"): def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"):
...@@ -21,14 +18,14 @@ class PersonTime: ...@@ -21,14 +18,14 @@ class PersonTime:
self.year = year self.year = year
self.term = term self.term = term
self.groups = groups or ["big_area_id", "area_id", "school_area_id"] self.groups = groups or ["big_area_id", "area_id", "school_area_id"]
self.schoolIds = schoolIds or cd1_school_area_id self.schoolIds = schoolIds or SchoolDataConfig.get_department_id(is_rm_test_school=True)
self.refundType = refundType self.refundType = refundType
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs): def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
body = {**self.__dict__, **other_field} body = {**self.__dict__, **other_field}
return statistics_personTime_post(body=body, header=header, return_json=return_json, **kwargs) return statistics_personTime_post(body=body, header=header, return_json=return_json, **kwargs)
# 查询续报率
class ContinueRate: class ContinueRate:
def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"): def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"):
...@@ -38,7 +35,7 @@ class ContinueRate: ...@@ -38,7 +35,7 @@ class ContinueRate:
self.year = year self.year = year
self.term = term self.term = term
self.groups = groups or ["big_area_id", "area_id", "school_area_id"] self.groups = groups or ["big_area_id", "area_id", "school_area_id"]
self.schoolIds = schoolIds or cd1_school_area_id self.schoolIds = schoolIds or SchoolDataConfig.get_department_id(is_rm_test_school=True)
self.refundType = refundType self.refundType = refundType
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs): def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
...@@ -46,6 +43,7 @@ class ContinueRate: ...@@ -46,6 +43,7 @@ class ContinueRate:
return statistics_query_continue_post(body=body, header=header, return_json=return_json, **kwargs) return statistics_query_continue_post(body=body, header=header, return_json=return_json, **kwargs)
# 查询退费率
class RefundRate: class RefundRate:
def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="schoolRefund"): def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="schoolRefund"):
...@@ -55,7 +53,7 @@ class RefundRate: ...@@ -55,7 +53,7 @@ class RefundRate:
self.year = year self.year = year
self.term = term self.term = term
self.groups = groups or ["big_area_id", "area_id", "school_area_id"] self.groups = groups or ["big_area_id", "area_id", "school_area_id"]
self.schoolIds = schoolIds or cd1_school_area_id self.schoolIds = schoolIds or SchoolDataConfig.get_department_id(is_rm_test_school=True)
self.refundType = refundType self.refundType = refundType
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs): def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
...@@ -63,6 +61,7 @@ class RefundRate: ...@@ -63,6 +61,7 @@ class RefundRate:
return statistics_refundRate_post(body=body, header=header, return_json=return_json, **kwargs) return statistics_refundRate_post(body=body, header=header, return_json=return_json, **kwargs)
# 查询满班率
class FullClassRate: class FullClassRate:
def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"): def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"):
...@@ -72,7 +71,7 @@ class FullClassRate: ...@@ -72,7 +71,7 @@ class FullClassRate:
self.year = year self.year = year
self.term = term self.term = term
self.groups = groups or ["big_area_id", "area_id", "school_area_id"] self.groups = groups or ["big_area_id", "area_id", "school_area_id"]
self.schoolIds = schoolIds or cd1_school_area_id self.schoolIds = schoolIds or SchoolDataConfig.get_department_id(is_rm_test_school=True)
self.refundType = refundType self.refundType = refundType
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs): def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
...@@ -80,6 +79,7 @@ class FullClassRate: ...@@ -80,6 +79,7 @@ class FullClassRate:
return statistics_fullClass_rate_post(body=body, header=header, return_json=return_json, **kwargs) return statistics_fullClass_rate_post(body=body, header=header, return_json=return_json, **kwargs)
# 查询补费率
class FillRate: class FillRate:
def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"): def __init__(self, pageNum=1, pageSize=10, createTime=None, year="2021", term="暑", groups=None, schoolIds=None, refundType="teacherRefund"):
...@@ -89,7 +89,7 @@ class FillRate: ...@@ -89,7 +89,7 @@ class FillRate:
self.year = year self.year = year
self.term = term self.term = term
self.groups = groups or ["big_area_id", "area_id", "school_area_id"] self.groups = groups or ["big_area_id", "area_id", "school_area_id"]
self.schoolIds = schoolIds or cd1_school_area_id self.schoolIds = schoolIds or SchoolDataConfig.get_department_id(is_rm_test_school=True)
self.refundType = refundType self.refundType = refundType
def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs): def run(self, other_field: dict = {}, header=jyy_header, return_json=True, **kwargs):
......
...@@ -29,8 +29,6 @@ groups_field_map = { ...@@ -29,8 +29,6 @@ groups_field_map = {
} }
# 获取日期筛选数据(默认最近7天) # 获取日期筛选数据(默认最近7天)
def get_date_search_data(num: int = 6): def get_date_search_data(num: int = 6):
today_date = GetTime.get_today().get("today_date") today_date = GetTime.get_today().get("today_date")
......
class ClassDataConfig:
year = [2019, 2020, 2021, 2022]
grade = ["零年级", "一年级", "二年级", "三年级", "四年级", "五年级", "六年级", "七年级", "八年级", "九年级", "高一", "高二", "高三"]
term = ["春", "暑", "秋", "寒"]
# 学段
learning_period = ["小低", "小高", "初中", "高中"]
# 小低
small_low = ["一年级", "二年级", "三年级"]
# 小高
small_high = ["四年级", "五年级", "六年级"]
# 初中
junior_high = ["七年级", "八年级", "九年级"]
# 高中
high_school = ["高一", "高二", "高三"]
subject = ["语文", "英语", "物理", "数学", "化学"]
course_type = ["常规班课", "精品定制课", "服务班课", "集训班课", "专题班课"]
class_type = {
"常规班课": ["极趣班", "极思班", "极智班", "极客班", "极客A班", "极客蓝队班", "五四极趣班", "五四极思班", "五四极智班", "新生", "人教班", "八人精品", "定制班"],
"精品定制课": ["一对一定制班", "一对三定制班", "一对八定制班", "一对六定制班"],
"服务班课": ["公开课", "辅导课", "讲座"],
"集训班课": ["五年级选修课班", "五四制班", "知识体系复习课班"],
"专题班课": ["专题"]
}
# 期数
phase = [1, 0, 2, 3, 4]
# 价格类型
priceType = ["低价", "正价"]
# 学生类型
studentType = ["老生", "新生"]
# 获取所有班型
@classmethod
def get_all_class_type(cls):
all_class_type = []
for v in cls.class_type.values():
all_class_type = [*all_class_type, *v]
return all_class_type
# 获取常规班型
@classmethod
def get_routine_class_type(cls, is_rm_new_student_class=False):
all_routine_class_type = cls.class_type.get("常规班课")
if is_rm_new_student_class:
all_routine_class_type.remove("新生")
return all_routine_class_type
# 获取精品班型
@classmethod
def get_boutique_class_type(cls):
return cls.class_type.get("精品定制课")
# 获取服务班型
@classmethod
def get_service_class_type(cls):
return cls.class_type.get("服务班课")
# 获取专题班型
@classmethod
def get_special_class_type(cls):
return cls.class_type.get("专题班课")
# 获取专题班型
@classmethod
def get_ji_xun_class_type(cls):
return cls.class_type.get("集训班课")
if __name__ == '__main__':
print(ClassDataConfig.get_routine_class_type(True))
\ No newline at end of file
from common.operation_time import GetTime
class DateDataConfig:
# 今天日期
today_date = GetTime.get_today().get("today_date")
# 今天日期
yesterday_date = GetTime.get_today_before(1).get("before_date_1")
# 7天前的日期
before_date_7 = GetTime.get_today_before(7).get("before_date_7")
# 30天前的日期
before_date_30 = GetTime.get_today_before(30).get("before_date_30")
# 获取最近日期筛选数据(默认最近7天)
@staticmethod
def get_date_search_data(num: int = 6):
today_date = GetTime.get_today().get("today_date")
start_date = GetTime.get_today_before(num).get(f"before_date_{num}")
return GetTime.get_every_day(start_date, today_date)
# 获取日期列表的列表的筛选数据
@staticmethod
def get_date_list_de_list():
date_data_list = []
today_date = GetTime.get_today().get("today_date")
date_data_list.append((today_date, today_date))
for x in range(5, 35, 5):
date_data_list.append((GetTime.get_today_before(x).get(f"before_date_{x}"), today_date))
date_data_list = [GetTime.get_every_day(*x) for x in date_data_list]
return date_data_list
# 日期按按周分组
@staticmethod
def get_week_date_group(begin_date, end_date):
week_info_list = GetTime.get_week_info(begin_date, end_date)
year_weeks = set([x.get("year_week") for x in week_info_list])
week_group = []
for year_week in year_weeks:
week_date = [x.get('date_data') for x in week_info_list if x.get("year_week") == year_week]
week_group.append({
"year_week": year_week,
"week_date": week_date
})
from operator import itemgetter
week_group = sorted(week_group, key=itemgetter("year_week"))
return week_group
if __name__ == '__main__':
print(DateDataConfig.get_date_list_de_list())
...@@ -74,6 +74,44 @@ class GlobalDataConfig: ...@@ -74,6 +74,44 @@ class GlobalDataConfig:
all_class_type = [*all_class_type, *v] all_class_type = [*all_class_type, *v]
return all_class_type return all_class_type
# 获取下一年
@staticmethod
def get_next_year_term(year, term):
if term == "春":
return year, "暑"
elif term == "暑":
return year, "秋"
elif term == "秋":
return year, "寒"
else:
return int(year) + 1, "春"
# mongo的表名
@staticmethod
def get_mongo_db_table_name(year, term, data_type: str):
term_map = {
"春": "01",
"暑": "03",
"秋": "05",
"寒": "07",
}
return f"{year}{term_map.get(term)}_{data_type}"
# 使用分页总数和每页数量获取分页数据
@staticmethod
def get_page_num_and_size(total, size):
"""
:total:记录条数
:size:每页数量
:return: 返回分页数组,单个元素为元组,0:page_num,1:page_size
"""
num = 0
num_and_size = []
for x in range(0, total, size):
num += 1
num_and_size.append((num, size))
return num_and_size
# 获取部门ID列表 # 获取部门ID列表
@classmethod @classmethod
def get_department_id(cls, department_type=30, is_rm_test_school=False) -> list: def get_department_id(cls, department_type=30, is_rm_test_school=False) -> list:
...@@ -155,21 +193,6 @@ class GlobalDataConfig: ...@@ -155,21 +193,6 @@ class GlobalDataConfig:
] ]
return targets return targets
# 使用分页总数和每页数量获取分页数据
@staticmethod
def get_page_num_and_size(total, size):
"""
:total:记录条数
:size:每页数量
:return: 返回分页数组,单个元素为元组,0:page_num,1:page_size
"""
num = 0
num_and_size = []
for x in range(0, total, size):
num += 1
num_and_size.append((num, size))
return num_and_size
# 获取单个校区筛数据 # 获取单个校区筛数据
@classmethod @classmethod
def get_single_school_search(cls, num=20, all_school=False, is_rm_test_school=True): def get_single_school_search(cls, num=20, all_school=False, is_rm_test_school=True):
...@@ -207,28 +230,4 @@ class GlobalDataConfig: ...@@ -207,28 +230,4 @@ class GlobalDataConfig:
group_school_data.append(ran_school_area) group_school_data.append(ran_school_area)
return group_school_data return group_school_data
# 获取下一年
@staticmethod
def get_next_year_term(year, term):
if term == "春":
return year, "暑"
elif term == "暑":
return year, "秋"
elif term == "秋":
return year, "寒"
else:
return int(year) + 1, "春"
# mongo的表名
@staticmethod
def get_mongo_db_table_name(year, term, data_type: str):
term_map = {
"春": "01",
"暑": "03",
"秋": "05",
"寒": "07",
}
return f"{year}{term_map.get(term)}_{data_type}"
from common.connect_db import OperationDb
import random
class SchoolDataConfig:
# 测试校区
test_school_area = [3074, 3076, 3345, 3047, 3049, 3095, 2383, 3015, 3052]
# 获取部门ID列表
@classmethod
def get_department_id(cls, department_type=30, is_rm_test_school=False) -> list:
"""
:department_type:部门类型
:is_rm_test_school:是否剔除测试校区默认否
:return:id列表
"""
sql = f"""select id from service_user.department where type = {department_type}"""
school_area_datas = OperationDb.query_sql(sql)
school_area_ids = [x[0] for x in school_area_datas]
if is_rm_test_school:
return [x for x in school_area_ids if x not in cls.test_school_area]
else:
return school_area_ids
# 通过区域id获取对应校区ID列表
@staticmethod
def get_school_id_by_area_id(area_id):
sql = f"""select id from service_user.department where type = 30 and parent_id = {area_id}"""
school_area_datas = OperationDb.query_sql(sql)
school_area_ids = [x[0] for x in school_area_datas]
return school_area_ids
# 通过大区id获取对应校区ID列表
@staticmethod
def get_school_id_by_big_area_id(big_area_id):
sql = f"""select id from service_user.department
where type = 30 and parent_id in (select id from service_user.department where type = 40 and parent_id = {big_area_id})"""
school_area_datas = OperationDb.query_sql(sql)
school_area_ids = [x[0] for x in school_area_datas]
return school_area_ids
# 通过大区id获取对应区域ID列表
@staticmethod
def get_area_id_by_big_area_id(big_area_id):
sql = f"""select id from service_user.department where type = 40 and parent_id = {big_area_id}"""
area_datas = OperationDb.query_sql(sql)
area_ids = [x[0] for x in area_datas]
return area_ids
# id和名称映射(40为区域名称映射)
@staticmethod
def get_department_id_name_map(department_type=30) -> dict:
sql = f"""select id,name from service_user.department where type = {department_type}"""
school_area_datas = OperationDb.query_sql(sql)
return {x[0]: x[1] for x in school_area_datas}
# 部门id和短名称映射(40为区域名称映射)
@staticmethod
def get_department_short_name_map(department_type=30):
sql = f"""select id,short_name from service_user.department where type = {department_type}"""
school_area_datas = OperationDb.query_sql(sql)
return {x[0]: x[1] for x in school_area_datas}
# 获取单个校区筛数据
@classmethod
def get_single_school_search(cls, num=20, all_school=False, is_rm_test_school=True):
"""
:num:返回的校区个数:默认20
:is_rm_test_school:是否剔除测试校区
:all_school: 为True返回全部校区, 默认否
:return: 校区ID列表
"""
school_area_ids = cls.get_department_id(department_type=30, is_rm_test_school=is_rm_test_school)
if all_school:
return school_area_ids
else:
return random.sample(school_area_ids, num)
# 获取组合校区筛数据
@classmethod
def get_group_school_search(cls, num=10, is_rm_test_school=True):
"""
:num:返回的校区组合个数:默认20
:is_rm_test_school:是否剔除测试校区
:return: 校区ID列表
"""
group_school_data = []
school_area_ids = cls.get_department_id(department_type=30, is_rm_test_school=is_rm_test_school)
for x in range(num):
ran_school_area_num = random.randint(2, len(school_area_ids))
ran_school_area = random.sample(school_area_ids, ran_school_area_num)
group_school_data.append(ran_school_area)
return group_school_data
\ No newline at end of file
from common.connect_db import OperationDb
from script.global_data_config.date_data import DateDataConfig
class TargetDataConfig:
# 获取所有目标方案
@staticmethod
def get_target():
sql = """SELECT * FROM public.target_plan"""
targets = OperationDb.pd_query_sql(sql)
return targets.to_dict(orient="records")
# 获取所有目标方案
@staticmethod
def get_target_after_id(target_id):
sql = f"""SELECT * FROM public.target_plan where id > {target_id}"""
targets = OperationDb.pd_query_sql(sql)
return targets.to_dict(orient="records")
# 获取当期目标方案
@staticmethod
def get_current_term_target():
sql = """SELECT * FROM public.target_plan where is_default = '是'"""
targets = OperationDb.pd_query_sql(sql)
return targets.to_dict(orient="records")
# 获取当期之后的目标方案
@staticmethod
def get_target_after_default():
sql = """SELECT * FROM public.target_plan where id >= (SELECT id FROM public.target_plan where is_default = '是')"""
targets = OperationDb.pd_query_sql(sql)
return targets.to_dict(orient="records")
# 获取下一年
@staticmethod
def get_next_year_term(year, term):
if term == "春":
return year, "暑"
elif term == "暑":
return year, "秋"
elif term == "秋":
return year, "寒"
else:
return int(year) + 1, "春"
# 根据目标方案或者查询的截止日期
@staticmethod
def get_end_time_by_target(target: dict):
target_end_date = target.get("end_time")
today_date = DateDataConfig.today_date
if today_date >= target_end_date:
create_time = target_end_date
else:
create_time = today_date
return create_time
from common.connect_db import OperationMongoDb from common.connect_db import OperationMongoDb
from script.global_data_config.school_data import SchoolDataConfig
def get_order_infos(): def get_order_infos():
...@@ -9,25 +10,5 @@ def get_order_infos(): ...@@ -9,25 +10,5 @@ def get_order_infos():
return omd.query_data(table_name, condition=condition, fields=fields) return omd.query_data(table_name, condition=condition, fields=fields)
login_data = [ school_areas = SchoolDataConfig.get_department_id(is_rm_test_school=True)
{"type": "employee",
"identityType": 1,
"ip": "0.0.0.0",
"account": "15300000000",
"password": "88888888"
}
]
school_areas = [2389,2398,3363,3015,3154,3352,2369,3095,3348,3333,3351,3359,3345,3365,3362,3339,
3353,3334,2400,3360,3361,3373,3371,3366,3349,3372,3340,2427,3367,3335,3148,3374,
3377,3369,3376,3378,3368,3336,3370,3357,3350,3001,3072,3049,3342,3337,2411,3344,
2412,3100,3146,3052,3047,3157,3107,3108,3076,3147,3167,2413,2383,3064,3152,3063,
3101,3130,3170,3074,3165,3044,3059,3038,3166,3168,2385,3171,2373,3137,3151,2417,
3041,3036,3060,3125,3046,3109,3110,3142,3149,3037,3039,3104,2422,3158,2407,2386,
3099,2410,3067,3329,2371,3330,3133,3071,3070,3053,3065,3150,3061,3126,3062,2423,
2364,3043,2415,3131,2388,3096,2376,3042,3127,2402,2359,2365,2408,2425,3002,2391,
3135,3136,3153,3139,3144,2419,3075,2416,2421,2363,2368,2403,2414,2392,3138,2406,
3156,3155,3097,3098,3141,3069,2405,2399,2397,2360,3145,2420,2404,2374,2401,3054,
3124]
...@@ -43,5 +43,5 @@ def set_excel(df, set_dir, sheet_name): ...@@ -43,5 +43,5 @@ def set_excel(df, set_dir, sheet_name):
writer.save() writer.save()
print(get_week_date_group("2021-04-30", "2021-05-10")) # print(get_week_date_group("2021-04-30", "2021-05-10"))
...@@ -85,3 +85,14 @@ def assert_grade_open_subject(data_list, year, term): ...@@ -85,3 +85,14 @@ def assert_grade_open_subject(data_list, year, term):
[sorted(x["subjects"]) for x in data_list] [sorted(x["subjects"]) for x in data_list]
open_subject = basic_parameter_set_data.get_grade_open_subject(year, term) open_subject = basic_parameter_set_data.get_grade_open_subject(year, term)
public_asserts.assert_dict_list_equal(data_list, open_subject, join_columns=["schoolAreaId", "grade"], df1_name="极运营数据", df2_name="计算数据") public_asserts.assert_dict_list_equal(data_list, open_subject, join_columns=["schoolAreaId", "grade"], df1_name="极运营数据", df2_name="计算数据")
@allure.step("验证最高班型数据正确")
def assert_max_class_type(data_list, year, term):
for data in data_list:
data["maxClassTypes"] = sorted(str(data.get("maxClassTypes")).split(","))
my_class_info = global_data.get_class_type_by_year_term(year, term)
field_list = ["areaId", "areaName", "bigAreaId", "bigAreaName", "year", "term", "grade", "subject", "maxClassTypes"]
public_asserts.assert_dict_list_equal_by_field(data_list, my_class_info, field_list=field_list,
join_columns=["areaId", "grade", "subject"],
df1_name="极运营数据", df2_name="计算数据")
...@@ -179,3 +179,28 @@ def get_add_crm_source_data(): ...@@ -179,3 +179,28 @@ def get_add_crm_source_data():
def delete_crm_source(crm_source_id): def delete_crm_source(crm_source_id):
sql = f"delete from service_crm.student_source_dict where id = {crm_source_id}" sql = f"delete from service_crm.student_source_dict where id = {crm_source_id}"
OperationDb.insert_update_delete_sql(sql) OperationDb.insert_update_delete_sql(sql)
# 删除新增的满班目标
def delete_full_class_target_by_id(target_id):
sql = f"delete from public.class_capacity where id = {target_id}"
OperationDb.insert_update_delete_sql(sql)
# 删除新增的满班目标
def delete_full_class_target_by_condition(region, grade, subject):
sql = f"""delete from public.class_capacity
where region = {region} and grade = '{grade}' and subject = '{subject}'"""
OperationDb.insert_update_delete_sql(sql)
# 满班目标是否存在
def is_have_full_class_target(region, grade, subject):
sql = f"""select id as count
from public.class_capacity
where region = {region} and grade = '{grade}' and subject = '{subject}'"""
result = OperationDb.query_sql(sql)
if result:
return True
else:
return False
...@@ -102,6 +102,19 @@ def get_school_type(count_phase, new_school_phase_num): ...@@ -102,6 +102,19 @@ def get_school_type(count_phase, new_school_phase_num):
return "other" return "other"
def get_max_class_type(class_types: list, class_num) -> list:
max_class_type = [x for x in class_types if x in ["极客班", "极客A班", "五四极客班", "极客蓝队班"]]
if max_class_type:
max_class_type.sort()
else:
max_class_types = [x for x in class_types if x in ["极智班", "五四极智班"]]
if class_num == 1:
max_class_type = max_class_types
else:
max_class_type = []
return max_class_type
# 获取全部校年份期段数据 # 获取全部校年份期段数据
def get_all_school_year_code(): def get_all_school_year_code():
school_year_code_datas = OperationDb.query_sql(query_sql.school_year_code_sql) school_year_code_datas = OperationDb.query_sql(query_sql.school_year_code_sql)
...@@ -194,6 +207,14 @@ def get_class_by_year_term(year, term): ...@@ -194,6 +207,14 @@ def get_class_by_year_term(year, term):
return class_infos return class_infos
# 获取所有班级(查询班型)
def get_class_type_by_year_term(year, term):
class_infos = OperationDb.pd_query_sql(query_sql.query_max_class_type_sql % (year, term, year, term))
class_infos = class_infos.to_dict(orient="records")
for class_info in class_infos:
class_info["maxClassTypes"] = get_max_class_type(class_info.get("class_types"), class_info.get("class_num"))
return [x for x in class_infos if x.get("maxClassTypes")]
# 所有目标方案 # 所有目标方案
all_target = get_target() all_target = get_target()
# 默认目标方案 # 默认目标方案
......
# 查询校区的财年和期段的code
school_year_code_sql = """ school_year_code_sql = """
SELECT SELECT
big_area.id AS big_area_id, big_area.id AS big_area_id,
...@@ -21,7 +22,7 @@ WHERE ...@@ -21,7 +22,7 @@ WHERE
and open_financial_year NOTNULL and open_financial_year NOTNULL
ORDER BY open_financial_year asc, open_financial_term asc ORDER BY open_financial_year asc, open_financial_term asc
""" """
# 查询校区的财年和期段的code加上城市
school_year_code_city_sql = """ school_year_code_city_sql = """
SELECT SELECT
big_area.id AS big_area_id, big_area.id AS big_area_id,
...@@ -54,7 +55,7 @@ WHERE ...@@ -54,7 +55,7 @@ WHERE
and open_financial_year_code NOTNULL and open_financial_year_code NOTNULL
ORDER BY open_financial_year_code ORDER BY open_financial_year_code
""" """
# 按年份期段查询班级(测试校区除外)
class_query_sql = """ class_query_sql = """
SELECT SELECT
big_area.name as big_area_name, big_area.name as big_area_name,
...@@ -76,3 +77,94 @@ WHERE ...@@ -76,3 +77,94 @@ WHERE
cls.status =1 and cls.course_type = '常规班课' and cls.year = %s and cls.term = '%s' cls.status =1 and cls.course_type = '常规班课' and cls.year = %s and cls.term = '%s'
and cls.school_area not in (3074, 3076, 3345, 3047, 3049, 3095, 2383, 3015, 3052) and cls.school_area not in (3074, 3076, 3345, 3047, 3049, 3095, 2383, 3015, 3052)
""" """
# 查询最高班型
query_max_class_type_sql = """
SELECT
cls_temp.bigAreaId,
cls_temp.bigAreaName,
cls_temp.areaId,
cls_temp.areaName,
cls_temp.YEAR,
cls_temp.term,
cls_temp.grade,
cls_temp.subject,
cls_temp.class_types,
cls_num_temp.class_num
FROM
(
SELECT
big_area.ID AS bigAreaId,
big_area.NAME bigAreaName,
d_area.id AS areaId,
d_area.NAME AS areaName,
cls.YEAR,
cls.term,
cls.grade,
cls.subject,
ARRAY_AGG ( DISTINCT ( cls.class_type ) ) AS class_types
FROM
service_education.classes cls
LEFT JOIN service_user.department dept_sch ON cls.school_area = dept_sch.id
LEFT JOIN service_user.department d_area ON dept_sch.parent_id = d_area.id
LEFT JOIN service_user.department big_area ON d_area.parent_id = big_area.id
WHERE
cls.YEAR = %s
AND cls.term = '%s'
AND cls.status = 1
AND cls.course_type = '常规班课'
AND cls.school_area NOT IN (
3074,
3076,
3345,
3047,
3049,
3095,
2383,
3015,
3052
)
GROUP BY
big_area.ID,
big_area.NAME,
d_area.ID,
d_area.NAME,
cls.YEAR,
cls.term,
cls.grade,
cls.subject
) cls_temp
LEFT JOIN (
SELECT
d_area.ID AS areaId,
cls.grade,
cls.subject,
COUNT ( cls.class_id ) class_num
FROM
service_education.classes cls
LEFT JOIN service_user.department dept_sch ON cls.school_area = dept_sch.id
LEFT JOIN service_user.department d_area ON dept_sch.parent_id = d_area.id
WHERE
cls.YEAR = %s
AND cls.term = '%s'
AND cls.status = 1
AND cls.course_type = '常规班课'
AND cls.class_type IN ( '极智班', '五四极智班' )
AND cls.school_area NOT IN (
3074,
3076,
3345,
3047,
3049,
3095,
2383,
3015,
3052
)
GROUP BY
d_area.id,
cls.grade,
cls.subject
) cls_num_temp ON cls_temp.areaId = cls_num_temp.areaId
AND cls_temp.grade = cls_num_temp.grade
AND cls_temp.subject = cls_num_temp.subject
"""
...@@ -9,9 +9,20 @@ from script.base_api.service_education.system import system_setting_addSettingBy ...@@ -9,9 +9,20 @@ from script.base_api.service_education.system import system_setting_addSettingBy
from script.base_api.service_education.system import system_setting_editSettingByParam_post from script.base_api.service_education.system import system_setting_editSettingByParam_post
from script.base_api.service_education.system import system_setting_query_get from script.base_api.service_education.system import system_setting_query_get
from script.base_api.service_crm.dict import dict_studentSource_add_post from script.base_api.service_crm.dict import dict_studentSource_add_post
from script.base_api.service_statistics.statistics import statistics_maxClassType_queryAll_post
from script.base_api.service_crm.dict import dict_studentSource_edit_post
from script.base_api.service_crm.dict import dict_studentSource_updateStatus_post
from script.base_api.service_education.classCapacity import classCapacity_add_post
from script.base_api.service_education.classCapacity import classCapacity_update_post
from script.base_api.service_education.classCapacity import classCapacity_query_post
from script.global_data_config.global_data import GlobalDataConfig from script.global_data_config.global_data import GlobalDataConfig
from script.global_data_config.target_data import TargetDataConfig
from script.global_data_config.class_data import ClassDataConfig
from script.global_data_config.school_data import SchoolDataConfig
from script.base_api_data.service_education.system_data import QuerySystemSetting from script.base_api_data.service_education.system_data import QuerySystemSetting
from script.base_api_data.service_education.education_data import QueryFullClassTarget
from script.base_api_data.service_crm.dict_data import QueryStudentSource from script.base_api_data.service_crm.dict_data import QueryStudentSource
from script import public_asserts from script import public_asserts
...@@ -87,16 +98,30 @@ class TestCrmSourceSet: ...@@ -87,16 +98,30 @@ class TestCrmSourceSet:
assert len(is_have_data) == 1, f"新增的失败后数据应该只有1条,{len(is_have_data)}" assert len(is_have_data) == 1, f"新增的失败后数据应该只有1条,{len(is_have_data)}"
@allure.story("测试编辑线索来源") @allure.story("测试编辑线索来源")
def test_edit_crm_source(self): @pytest.mark.parametrize("crm_source_name", ["测试编辑线索来源", "网站"])
pass def test_edit_crm_source(self, crm_source_name):
crm_source_id = 111
@allure.story("测试查询线索来源") body = {"id": crm_source_id, "name": crm_source_name}
def test_search_crm_source(self): res = dict_studentSource_edit_post(body=body, header=jyy_header)
pass public_asserts.public_assert(res)
assert_res = QueryStudentSource().run()
assert_res_data = jsonpath.jsonpath(assert_res, f"$..children[?(@.id == {crm_source_id})]")
assert assert_res_data, f"编辑后原来的数据应该有,{assert_res_data}"
assert_name = assert_res_data[0].get("name")
assert crm_source_name == assert_name, f"编辑后显示新的名称, {crm_source_name}, {assert_name}"
@allure.story("测试停用启用线索来源") @allure.story("测试停用启用线索来源")
def test_stop_and_crm_source(self): @pytest.mark.parametrize("status", [1, 2, 1])
pass def test_stop_and_crm_source(self, status):
crm_source_id = 111
body = {"id": crm_source_id, "status": status}
res = dict_studentSource_updateStatus_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
assert_res = QueryStudentSource().run()
assert_res_data = jsonpath.jsonpath(assert_res, f"$..children[?(@.id == {crm_source_id})]")
assert assert_res_data, f"编辑后原来的数据应该有,{assert_res_data}"
assert_status = assert_res_data[0].get("status")
assert assert_status == status, f"编辑后显示返回新的状态,{assert_status},{status}"
def teardown_class(self): def teardown_class(self):
[basic_parameter_set_data.delete_crm_source(x.get("id")) for x in TestCrmSourceSet.add_crm_source] [basic_parameter_set_data.delete_crm_source(x.get("id")) for x in TestCrmSourceSet.add_crm_source]
...@@ -183,68 +208,251 @@ class TestApplyTypeSet: ...@@ -183,68 +208,251 @@ class TestApplyTypeSet:
@allure.feature("测试最高班型设置") @allure.feature("测试最高班型设置")
class TestMaxClassTypeSet: class TestMaxClassTypeSet:
@allure.story("测试当期有数据-且能对上")
def test_current_data(self):
year = global_data.default_target.get("year")
term = global_data.default_target.get("term")
body = {"areaName": "", "year": year, "grade": "", "subject": "", "term": term, "pageSize": 1000, "pageNum": 1}
res = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
res_data = res.get("data")
assert res_data, f"响应的data不能为空"
data_list = res_data.get("list")
assert data_list, f"当期的数据不会为空, {data_list}"
assert_max_class_type(data_list, year, term)
@allure.story("测试目标方案筛选")
@pytest.mark.parametrize("target", TargetDataConfig.get_target_after_default())
def test_target_search(self, target):
year = target.get("year")
term = target.get("term")
body = {"areaName": "", "year": year, "grade": "", "subject": "", "term": term, "pageSize": 1000, "pageNum": 1}
res = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
res_data = res.get("data")
assert res_data, f"响应的data不能为空"
data_list = res_data.get("list")
if data_list:
assert_max_class_type(data_list, year, term)
@allure.story("测试区域名称筛选-存在的数据") @allure.story("测试区域名称筛选-存在的数据")
@pytest.mark.parametrize("area_name", basic_parameter_set_data.area_names) @pytest.mark.parametrize("area_name", basic_parameter_set_data.area_names)
def test_area_name_search(self, area_name): def test_area_name_search(self, area_name):
pass year = global_data.default_target.get("year")
term = global_data.default_target.get("term")
body = {"areaName": area_name, "year": year, "grade": "", "subject": "", "term": term, "pageSize": 1000, "pageNum": 1}
res = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
public_asserts.assert_list_field_not_err_data(area_name, "areaName", res, compare_type="contain")
@allure.story("测试区域名称筛选-错误数据") @allure.story("测试区域名称筛选-错误数据")
@pytest.mark.parametrize("area_name", basic_parameter_set_data.err_area_names) @pytest.mark.parametrize("area_name", basic_parameter_set_data.err_area_names)
def test_area_name_err_search(self, area_name): def test_area_name_err_search(self, area_name):
pass year = global_data.default_target.get("year")
term = global_data.default_target.get("term")
@allure.story("测试目标方案筛选") body = {"areaName": area_name, "year": year, "grade": "", "subject": "", "term": term, "pageSize": 1000, "pageNum": 1}
def test_target_search(self, target): res = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
pass public_asserts.public_assert(res)
public_asserts.assert_list_field_is_not_data(res)
@allure.story("测试年级筛选") @allure.story("测试年级筛选")
def test_grade_search(self, target): @pytest.mark.parametrize("grade", ClassDataConfig.grade)
pass def test_grade_search(self, grade):
year = global_data.default_target.get("year")
term = global_data.default_target.get("term")
body = {"areaName": "", "year": year, "grade": grade, "subject": "", "term": term, "pageSize": 1000, "pageNum": 1}
res = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
public_asserts.assert_list_field_not_err_data(grade, "grade", res)
@allure.story("测试科目筛选") @allure.story("测试科目筛选")
def test_subject_search(self, target): @pytest.mark.parametrize("subject", ClassDataConfig.subject)
pass def test_subject_search(self, subject):
year = global_data.default_target.get("year")
@allure.story("测试目标方案筛选-当期有数据-且能对上") term = global_data.default_target.get("term")
def test_you_data_search(self): body = {"areaName": "", "year": year, "grade": "", "subject": subject, "term": term, "pageSize": 1000, "pageNum": 1}
pass res = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
@allure.story("测试目标方案筛选-当期有数据-且能对上") public_asserts.assert_list_field_not_err_data(subject, "subject", res)
def test_you_data_search(self):
pass
@allure.story("测试分页正确") @allure.story("测试分页正确")
def test_paging_search(self): @pytest.mark.parametrize("page_size", GlobalDataConfig.page_sizes)
pass def test_paging_search(self, page_size):
year = global_data.default_target.get("year")
term = global_data.default_target.get("term")
body = {"areaName": "", "year": year, "grade": "", "subject": "", "term": term, "pageSize": 1000, "pageNum": 1}
res = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
data = res.get("data")
total = data.get("total")
res_data_list = data.get("list")
page_and_sizes = GlobalDataConfig.get_page_num_and_size(total, page_size)
all_data_list = []
for page_num, page_size_new in page_and_sizes:
body["pageNum"] = page_num
body["pageSize"] = page_size_new
res_temp = statistics_maxClassType_queryAll_post(body=body, header=jyy_header)
public_asserts.public_assert(res_temp)
data_temp = res_temp.get("data")
assert data_temp, f"分页的不会为空, {data_temp}"
res_page_num = data_temp.get("pageNum")
res_page_size = data_temp.get("pageSize")
with assume:
assert res_page_num == page_num, "返回的pagenum错误"
assert res_page_size == page_size_new, "返回的pagesize错误"
list_temp = data_temp.get("list")
all_data_list.extend(list_temp)
public_asserts.assert_dict_list_equal(res_data_list, all_data_list,
join_columns="id",
df1_name="不分页总数据", df2_name="分页总数据相加")
@allure.epic("测试基础参数设置") @allure.epic("测试基础参数设置")
@allure.feature("测试满班目标设置") @allure.feature("测试满班目标设置")
class TestFullClassTargetSet: class TestFullClassTargetSet:
@allure.story("测试大区筛选") @allure.story("测试新增满班目标设置和不能新增相同的满班目标不")
def test_big_area_name_search(self, area_name): def test_new_full_class_target(self):
pass region = 3014
grade = "三年级"
subject = "数学"
targetNum = 90
limitNum = 100
body = {
"region": region, "grade": grade,
"subject": subject, "targetNum": targetNum,
"limitNum": limitNum
}
result = basic_parameter_set_data.is_have_full_class_target(region, grade, subject)
if result:
basic_parameter_set_data.delete_full_class_target_by_condition(region, grade, subject)
res = classCapacity_add_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
assert_res = QueryFullClassTarget(pageSize=10000).run()
assert_res_data = assert_res.get("data")
assert assert_res_data, f"查询接口响应的data不为空,{assert_res_data}"
assert_res_list = assert_res_data.get("list")
assert assert_res_list, f"查询接口响应的list不为空,{assert_res_list}"
is_have_data = [x for x in assert_res_list if x.get("region") == region
and x.get("grade") == grade
and x.get("subject") == subject
and x.get("targetNum") == targetNum
and x.get("limitNum") == limitNum]
assert is_have_data, f"查询有刚新增的数据,{is_have_data}"
assert len(is_have_data), f"刚新增的数据只有一条,{len(is_have_data)}"
res_repeat = classCapacity_add_post(body=body, header=jyy_header)
assert res_repeat.get("msg") == "限额信息已存在,新增失败!", "不能重复新增"
assert res_repeat.get("code") == -1, "不能重复新增"
@allure.story("测试编辑满班目标设置")
def test_edit_full_class_target(self):
test_data_res = QueryFullClassTarget().run()
test_data_list = test_data_res.get("data").get("list")
test_data = test_data_list[0]
test_data_2 = test_data_list[1]
region = test_data.get("region")
grade = test_data.get("grade")
subject = test_data.get("subject")
targetNum = test_data.get("targetNum")
limitNum = test_data.get("limitNum")
target_id = test_data.get("id")
body = {
"region": region, "grade": grade,
"subject": subject, "targetNum": targetNum + 1,
"limitNum": limitNum + 2, "id": target_id
}
res = classCapacity_update_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
assert_res = QueryFullClassTarget(pageSize=10000).run()
assert_res_data = assert_res.get("data")
assert assert_res_data, f"查询接口响应的data不为空,{assert_res_data}"
assert_res_list = assert_res_data.get("list")
assert assert_res_list, f"查询接口响应的list不为空,{assert_res_list}"
is_have_data = [x for x in assert_res_list if x.get("region") == region
and x.get("grade") == grade
and x.get("subject") == subject
and x.get("targetNum") == targetNum + 1
and x.get("limitNum") == limitNum + 2
and x.get("id") == target_id]
assert is_have_data, f"查询有刚修改的数据,{is_have_data}"
assert len(is_have_data), f"刚修改的数据只有一条,{len(is_have_data)}"
region_2 = test_data_2.get("region")
grade_2 = test_data_2.get("grade")
subject_2 = test_data_2.get("subject")
body = {
"region": region_2, "grade": grade_2,
"subject": subject_2, "targetNum": targetNum,
"limitNum": limitNum, "id": target_id
}
res_repeat = classCapacity_update_post(body=body, header=jyy_header)
assert res_repeat.get("msg") == "限额信息已存在,修改失败!", "不能修改为已有的数据"
assert res_repeat.get("code") == -1, "不能重复新增"
body = {
"region": region, "grade": grade,
"subject": subject, "targetNum": targetNum,
"limitNum": limitNum, "id": target_id
}
reset_res = classCapacity_update_post(body=body, header=jyy_header)
assert reset_res.get("code") == 0, "还原修改的数据失败"
@allure.story("测试区域筛选")
@pytest.mark.parametrize("area_id", SchoolDataConfig.get_department_id(department_type=40))
def test_area_name_search(self, area_id):
body = {"grade": "", "subject": "", "pageNum": 1, "pageSize": 10, "region": area_id}
res = classCapacity_query_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
public_asserts.assert_list_field_not_err_data(area_id, "region", res)
@allure.story("测试年级筛选") @allure.story("测试年级筛选")
def test_grade_search(self, target): @pytest.mark.parametrize("grade", ClassDataConfig.grade)
pass def test_grade_search(self, grade):
body = {"grade": grade, "subject": "", "pageNum": 1, "pageSize": 10}
res = classCapacity_query_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
public_asserts.assert_list_field_not_err_data(grade, "grade", res)
@allure.story("测试科目筛选") @allure.story("测试科目筛选")
def test_subject_search(self, target): @pytest.mark.parametrize("subject", ClassDataConfig.subject)
pass def test_subject_search(self, subject):
body = {"grade": "", "subject": subject, "pageNum": 1, "pageSize": 10}
@allure.story("测试分页正确") res = classCapacity_query_post(body=body, header=jyy_header)
def test_paging_search(self): public_asserts.public_assert(res)
pass public_asserts.assert_list_field_not_err_data(subject, "subject", res)
@allure.story("测试新增满班目标设置") @allure.story("测试科目筛选-组合筛选不报错")
def test_new_full_class_target(self): def test_subject_search(self):
pass body = {"grade": "三年级", "subject": "数学", "pageNum": 1, "pageSize": 10, "region": "3380"}
res = classCapacity_query_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
@allure.story("测试编辑满班目标设置") @allure.story("测试分页正确")
def test_edit_full_class_target(self): @pytest.mark.parametrize("page_size", GlobalDataConfig.page_sizes)
pass def test_paging_search(self, page_size):
body = {"grade": "", "subject": "", "pageNum": 1, "pageSize": 10000}
res = classCapacity_query_post(body=body, header=jyy_header)
public_asserts.public_assert(res)
data = res.get("data")
total = data.get("total")
res_data_list = data.get("list")
page_and_sizes = GlobalDataConfig.get_page_num_and_size(total, page_size)
all_data_list = []
for page_num, page_size_new in page_and_sizes:
body["pageNum"] = page_num
body["pageSize"] = page_size_new
res_temp = classCapacity_query_post(body=body, header=jyy_header)
public_asserts.public_assert(res_temp)
data_temp = res_temp.get("data")
assert data_temp, f"分页的不会为空, {data_temp}"
res_page_num = data_temp.get("pageNum")
res_page_size = data_temp.get("pageSize")
with assume:
assert res_page_num == page_num, "返回的pagenum错误"
assert res_page_size == page_size_new, "返回的pagesize错误"
list_temp = data_temp.get("list")
all_data_list.extend(list_temp)
public_asserts.assert_dict_list_equal(res_data_list, all_data_list,
join_columns="id",
df1_name="不分页总数据", df2_name="分页总数据相加")
@allure.epic("测试基础参数设置") @allure.epic("测试基础参数设置")
......
...@@ -146,7 +146,9 @@ def assert_download_data_equal_query(download_file_path, query_list, download_fi ...@@ -146,7 +146,9 @@ def assert_download_data_equal_query(download_file_path, query_list, download_fi
""" """
download_file_path: 下载文件路径 download_file_path: 下载文件路径
query_list: 查询的数据列表 query_list: 查询的数据列表
download_field_map: 查询的数据字段与excel字段的对应关系,且只对map里的字段
join_columns : 对比时连接的列(单个为字符串, 多个传入列表),排序不一样时使用 join_columns : 对比时连接的列(单个为字符串, 多个传入列表),排序不一样时使用
fillna_values: 为空时的填充数据
on_index : 当join_columns为none时设置为true,排序一样时使用 on_index : 当join_columns为none时设置为true,排序一样时使用
df1_name : 对比后的名称 df1_name : 对比后的名称
df2_name : 对比后的名称 df2_name : 对比后的名称
...@@ -173,3 +175,74 @@ def assert_download_data_equal_query(download_file_path, query_list, download_fi ...@@ -173,3 +175,74 @@ def assert_download_data_equal_query(download_file_path, query_list, download_fi
assert download_df.empty, f"无数据时数据应该为空,{download_df}" assert download_df.empty, f"无数据时数据应该为空,{download_df}"
@allure.step("断言响应的字典列表与期望的字典列表所有数据都一致, 指定字段")
def assert_dict_list_equal_by_field(data_list, query_list, field_list: list, field_map: dict = {},
df1_name="响应数据", df2_name="计算数据",
join_columns=None, on_index=False,
ignore_spaces=False, ignore_case=False, cast_column_names_lower=True
):
"""
data_list: 响应的数据列表
query_list: 查询的数据列表
field_list: 要对比的字段
field_map:两个列表的字段之间的映射
join_columns : 对比时连接的列(单个为字符串, 多个传入列表),排序不一样时使用
on_index : 当join_columns为none时设置为true,排序一样时使用
df1_name : 对比后的名称
df2_name : 对比后的名称
ignore_spaces : 是否忽略空格
ignore_case : 是否忽略大小写
cast_column_names_lower: 列表转小写
"""
if query_list:
res_df = pd.DataFrame(data_list)
query_df = pd.DataFrame(query_list)
query_df.rename(columns=field_map, inplace=True)
res_df.rename(columns=field_map, inplace=True)
query_df.columns = query_df.columns.map(lambda x: x.lower())
res_df.columns = res_df.columns.map(lambda x: x.lower())
field_list = [x.lower() for x in field_list]
query_df = query_df.loc[:, field_list]
res_df = res_df.loc[:, field_list]
query_df = query_df.astype(str)
res_df = res_df.astype(str)
result = datacompy.Compare(res_df, query_df, join_columns=join_columns,
on_index=on_index, df1_name=df1_name, df2_name=df2_name,
ignore_spaces=ignore_spaces, ignore_case=ignore_case, cast_column_names_lower=cast_column_names_lower
)
assert result.matches(), result.report()
else:
assert data_list == [], f"无数据时数据应该为空,{data_list}"
@allure.step("断言响应中的list字段为空列表")
def assert_list_field_is_not_data(res):
data = res.get("data")
assert data, f"data字段错误,{data}"
data_list = data.get("list")
assert data_list == [], f"错误数据查询出的list数据应该为空,{data_list}"
@allure.step("断言响应中的list对应字段无错误数据, 如果无数据算通过")
def assert_list_field_not_err_data(key_field, field_name, res, compare_type="equal"):
"""
:key_field: 字段需要包含或等于的值
:field_name: 对比的字段的名称
:res: list字段在data下的响应
:compare_type:比较方式
"""
data = res.get("data")
assert data, f"data字段错误,{data}"
data_list = data.get("list")
if data_list:
if compare_type == "equal":
err_data = [x for x in data_list if x.get(field_name) != key_field]
assert err_data == [], f"{field_name}字段不能存在不等于选择的数据,{err_data}"
else:
err_data = [x for x in data_list if str(key_field) not in str(x.get(field_name))]
assert err_data == [], f"{field_name}字段不能存在不等于选择的数据,{err_data}"
...@@ -30,4 +30,4 @@ def get_method(url, method): ...@@ -30,4 +30,4 @@ def get_method(url, method):
if __name__ == '__main__': if __name__ == '__main__':
get_method("/service-education/education/classes/query", "post") get_method("/service-education/classCapacity/query", "post")
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