/**
scope(file)
loop(10)
parallel(10)
timeout(10h)
**/;

CREATE CLASS IF NOT EXISTS /by0317{%02d,filei}()
WITH autosearch=true, version=false, key=manu, alias='by0317{%02d,filei}', namespace='by0317{%02d,filei}'
;

create class if not exists /by0317{%02d,filei}/enterprise (
	id varchar "业务主键",
	operator_company_id	varchar "飞行企业ID",
	company_name	varchar "企业名称",
	company_type	varchar "企业类型",
	qualification_status	varchar "资质状态",
	operation_status	varchar "运营状态",
	operation_region	varchar "运营区域",
	managed_site_target	int "目标起降点数量",
	managed_aircraft_target	int "目标飞行器数量",
	managed_pilot_target	int "目标飞手数量"
) with autosearch=true, version=false, key=manu, alias='飞行企业ID', nickname='by0317{%02d,filei}_enterprise';

create class if not exists /by0317{%02d,filei}/site (
	id varchar "业务主键",
	site_id	varchar "起降点ID",
	site_name	varchar "起降点名称",
	site_type	varchar "起降点类型",
	operator_company_id	varchar "运营企业ID",
	region_name	varchar "所属区域",
	address_desc	varchar "地址描述",
	site_capacity	int "站点容量",
	site_status	varchar "站点状态",
	activity_tier	varchar "活跃度分层"
) with autosearch=true, version=false, key=manu, alias='起降点ID', nickname='by0317{%02d,filei}_site';

create class if not exists /by0317{%02d,filei}/aircraft (
	id varchar "业务主键",
	aircraft_id	varchar "飞行器ID",
	aircraft_name	varchar "飞行器名称",
	brand_name	varchar "品牌",
	model_name	varchar "型号",
	main_scene	varchar "主适用场景",
	operator_company_id	varchar "归属企业ID",
	home_site_id	varchar "挂靠起降点ID",
	aircraft_status	varchar "飞行器状态",
	availability_flag	boolean "是否可分配",
	supported_payload_types	varchar "支持载荷类型"
) with autosearch=true, version=false, key=manu, alias='飞行器ID', nickname='by0317{%02d,filei}_aircraft';

create class if not exists /by0317{%02d,filei}/pilot (
	id varchar "业务主键",
	pilot_id	varchar "飞手ID",
	pilot_name	varchar "飞手姓名",
	operator_company_id	varchar "归属企业ID",
	home_site_id	varchar "驻守起降点ID",
	certificate_level	varchar "资质等级",
	availability_status	varchar "可调度状态",
	duty_status	varchar "值班状态",
	authorized_models	varchar "授权机型"
) with autosearch=true, version=false, key=manu, alias='飞手ID', nickname='by0317{%02d,filei}_pilot';

create class if not exists /by0317{%02d,filei}/business_object (
	id varchar "业务主键",
	business_object_id	varchar "业务对象ID",
	business_object_name	varchar "业务对象名称",
	business_object_type	varchar "业务对象类型",
	scenario_type	varchar "所属场景",
	region_name	varchar "所属区域",
	business_status	varchar "业务状态",
	risk_level	varchar "风险等级"
) with autosearch=true, version=false, key=manu, alias='业务对象ID', nickname='by0317{%02d,filei}_business_object';

create class if not exists /by0317{%02d,filei}/route (
	id varchar "业务主键",
	route_id	varchar "航线ID",
	route_name	varchar "航线名称",
	route_type	varchar "航线类型",
	scenario_type	varchar "所属场景",
	operator_company_id	varchar "运营企业ID",
	origin_site_id	varchar "起点起降点ID",
	destination_site_id	varchar "终点起降点ID",
	business_object_id	varchar "服务业务对象ID",
	route_length_km	double "航线长度（公里）",
	route_status	varchar "航线状态"
) with autosearch=true, version=false, key=manu, alias='航线ID', nickname='by0317{%02d,filei}_route';

create class if not exists /by0317{%02d,filei}/task (
	id varchar "业务主键",
	task_id	varchar "任务ID",
	task_name	varchar "任务名称",
	task_type	varchar "任务类型",
	task_source	varchar "任务来源",
	priority_level	varchar "优先级",
	task_status	varchar "任务状态",
	operator_company_id	varchar "承担企业ID",
	business_object_id	varchar "目标业务对象ID",
	planned_start_time	timestamp "计划开始时间",
	planned_end_time	timestamp "计划结束时间",
	actual_start_time	timestamp "实际开始时间",
	actual_end_time	timestamp "实际结束时间",
	sla_requirement	varchar "时效要求",
	result_summary	varchar "结果摘要",
	completion_evaluation	varchar "完成评价",
	task_capability_type	varchar "任务能力类型",
	result_type	varchar "结果类型",
	flight_activity_count	int "飞行活动次数"
) with autosearch=true, version=false, key=manu, alias='任务ID', nickname='by0317{%02d,filei}_task';

create class if not exists /by0317{%02d,filei}/flight_activity (
	id varchar "业务主键",
	flight_activity_id	varchar "飞行活动ID",
	flight_activity_name	varchar "飞行活动名称",
	flight_activity_type	varchar "飞行活动类型",
	task_id	varchar "所属任务ID",
	operator_company_id	varchar "组织企业ID",
	business_object_id	varchar "服务业务对象ID",
	route_id	varchar "遵循航线ID",
	origin_site_id	varchar "起点起降点ID",
	destination_site_id	varchar "终点起降点ID",
	aircraft_id	varchar "使用飞行器ID",
	pilot_id	varchar "执行飞手ID",
	flight_plan_id	varchar "飞行计划ID",
	plan_status	varchar "计划状态",
	plan_start_time	timestamp "计划开始时间",
	plan_end_time	timestamp "计划结束时间",
	approval_status	varchar "审批状态",
	takeoff_time	timestamp "起飞时间",
	landing_time	timestamp "降落时间",
	flight_duration_minutes	int "飞行时长（分钟）",
	execution_status	varchar "执行状态",
	result_status	varchar "结果状态",
	result_generated_time	timestamp "结果生成时间",
	actual_payload_type	varchar "实际载荷类型",
	result_summary	varchar "结果摘要"
) with autosearch=true, version=false, key=manu, alias='飞行活动ID', nickname='by0317{%02d,filei}_flight_activity';

create class if not exists /by0317{%02d,filei}/operation_event (
	id varchar "业务主键",
	event_id	varchar "运行事件ID",
	event_type	varchar "事件类型",
	event_level	varchar "事件级别",
	event_status	varchar "事件状态",
	event_time	timestamp "事件时间",
	task_id	varchar "关联任务ID",
	flight_activity_id	varchar "关联飞行活动ID",
	business_object_id	varchar "关联业务对象ID",
	aircraft_id	varchar "关联飞行器ID",
	pilot_id	varchar "关联飞手ID",
	event_desc	varchar "事件描述",
	handling_result	varchar "处理结果",
	evidence_type	varchar "证据类型"
) with autosearch=true, version=false, key=manu, alias='运行事件ID', nickname='by0317{%02d,filei}_operation_event';


-- 创建对象类: 账户
create class if not exists /by0317{%02d,filei}/account (
	id	varchar "业务主键",
	account_user_id	varchar "用户ID",
	account_dept_id	varchar "部门ID",
	account_user_name	varchar "用户姓名",
	nick_name	varchar "昵称",
	user_type	varchar "用户类型",
	email	varchar "邮箱",
	phonenumber	varchar "手机号",
	sex	varchar "性别",
	avatar	varchar "头像",
	password	varchar "密码",
	account_status	varchar "状态",
	wx_open_id	varchar "微信OpenID",
	account_del_flag	varchar "删除标志",
	login_ip	varchar "登录IP",
	login_date	timestamp "登录时间",
	account_create_by	varchar "创建者",
	account_create_time	timestamp "创建时间",
	account_update_by	varchar "更新者",
	account_update_time	timestamp "更新时间",
	remark	varchar "备注"
)
with autosearch=true, version=false, key=manu, alias='账户', nickname='by0317{%02d,filei}_account';

-- 创建对象类: 备案记录
create class if not exists /by0317{%02d,filei}/bus_filing_record (
	id	varchar "主键id",
	is_ordered	varchar "是否已下单（0未下单，1已下单）",
	is_ordered_txt	varchar "是否已下单（0未下单，1已下单）",
	is_overdue	varchar "是否超期（0未超期，1已超期）",
	bus_filing_record_status	int "状态（0-待审核 1-已通过 2-已驳回 3-自行处理审核中 4-自行处理审核驳回 5-自行处理审核通过 8-取消审核中 9-已取消）",
	bus_filing_record_status_txt	varchar "状态（0-待审核 1-已通过 2-已驳回 3-自行处理审核中 4-自行处理审核驳回 5-自行处理审核通过 8-取消审核中 9-已取消）",
	bus_filing_record_user_id	varchar "用户id",
	bus_filing_record_user_name	varchar "用户名字",
	phone	varchar "手机号",
	bus_filing_record_address	varchar "备案地址",
	emission_time	timestamp "预计排放时间",
	bus_filing_record_volume	int "预计排放体积",
	bus_filing_record_sack_num	int "预计袋子数量",
	audit_type	varchar "审核方式（system系统审核，manual人工审核）（注意，这是备案审核，不是取消审核。取消审核都是人工）",
	audit_time	timestamp "审核通过时间",
	bus_filing_record_longitude	varchar "经度",
	bus_filing_record_latitude	varchar "纬度",
	construction_company	varchar "装饰装修工程施工公司",
	construction_user_name	varchar "装饰装修工程施工公司联系人",
	construction_phone	varchar "装饰装修工程施工公司联系人电话",
	cancel_reason	varchar "取消原因",
	cancel_apply_remark	varchar "取消备案申请备注",
	audit_cancel_remark	varchar "审核取消备案备注",
	audit_remark	varchar "审核备注",
	audit_handle_remark	varchar "审核自行处理记录备注",
	bus_filing_record_dept_district_id	varchar "部门区id",
	bus_filing_record_dept_district_name	varchar "部门区名称",
	bus_filing_record_district_administrative_code	varchar "区行政编码",
	bus_filing_record_dept_street_id	varchar "部门街镇id",
	bus_filing_record_dept_street_name	varchar "部门街镇名称",
	bus_filing_record_street_administrative_code	varchar "镇街行政编码",
	bus_filing_record_dept_community_id	varchar "部门社区id",
	bus_filing_record_dept_community_name	varchar "部门社区名称",
	bus_filing_record_community_administrative_code	varchar "社区行政编码",
	is_remind_user	varchar "是否提醒用户（0未提醒，1已提醒）",
	is_work_order	varchar "是否生成工单（0未生成，1已生成）",
	delay_num	int "延期次数",
	bus_filing_record_del_flag	varchar "删除标志（0代表存在 2代表删除）",
	bus_filing_record_dept_id	varchar "创建部门",
	bus_filing_record_create_time	timestamp "创建时间",
	bus_filing_record_update_by	varchar "更新者",
	bus_filing_record_create_by	varchar "创建者",
	bus_filing_record_update_time	timestamp "更新时间"
)
with autosearch=true, version=false, key=manu, alias='备案记录', nickname='by0317{%02d,filei}_bus_filing_record';

-- 创建对象类: 订单的联单
create class if not exists /by0317{%02d,filei}/bus_link_order (
	id	varchar "业务主键",
	bus_link_order	varchar "联单id",
	bus_link_order_order_id	varchar "订单id",
	bus_link_order_status	int "联单状态（待派单11,待装车12，待卸车13，已清运19）",
	bus_link_order_status_txt	varchar "联单状态（待派单11,待装车12，待卸车13，已清运19）",
	bus_link_order_feedback_volume	double "订单反馈体积",
	bus_link_order_actual_price	double "订单实际价格",
	bus_link_order_dispatch_time	timestamp "派单时间",
	bus_link_order_dispatch_user_id	varchar "派单人id",
	bus_link_order_dispatch_user_name	varchar "派单人名称",
	bus_link_order_clean_driver_id	varchar "清运司机id",
	bus_link_order_clean_driver_name	varchar "清运司机名称",
	bus_link_order_clean_driver_phone	varchar "清运司机电话",
	bus_link_order_car_id	varchar "清运车辆id",
	car_type	varchar "车辆类型（newEnergy:新能源自卸车,hookLift:钩臂车,muck:泥头车,custom:自编车辆）",
	car_type_txt	varchar "车辆类型（newEnergy:新能源自卸车,hookLift:钩臂车,muck:泥头车,custom:自编车辆）",
	bus_link_order_car_license_plate	varchar "清运车辆车牌",
	car_volume	int "清运车辆容量",
	car_number	int "清运车辆数量",
	transport_company_id	varchar "运输公司id",
	transport_company_name	varchar "运输公司名称",
	transport_company_address	varchar "运输公司地址",
	transport_company_region	varchar "运输公司区域",
	disposal_method	varchar "处置方式(recycle:循环利用,harmlessTreat:无害处置,harmlessLand:无害填埋,wasteEnergy:焚烧发电)",
	disposal_method_txt	varchar "处置方式(recycle:循环利用,harmlessTreat:无害处置,harmlessLand:无害填埋,wasteEnergy:焚烧发电)",
	transport_method	varchar "运输方式(陆运:land, 水运:water)",
	transport_method_txt	varchar "运输方式(陆运:land, 水运:water)",
	waste_classification_name	varchar "垃圾分类名称",
	waste_classification_type	varchar "垃圾分类类型（cw:建筑废弃物）",
	loading_time	timestamp "装车时间时间",
	loading_before_images_url	varchar "装车前图片",
	loading_after_time_images_url	varchar "装车后图片",
	bill_images_url	varchar "票据图片url",
	unloading_time	timestamp "卸车时间",
	unloading_before_images_url	varchar "卸车前图片",
	unloading_after_images_url	varchar "卸车后图片",
	complete_time	timestamp "联单完成时间",
	dispatch_dept_id	varchar "处置部门id",
	user_id	varchar "下单人用户id",
	source_name	varchar "源头名称",
	source_type	varchar "源头类型（tempStorage:街道临时堆放点,scatteredColl:零星收运,decoFiling:装修备案）",
	source_type_txt	varchar "源头类型（tempStorage:街道临时堆放点,scatteredColl:零星收运,decoFiling:装修备案）",
	source_district_id	varchar "源头区县id",
	source_district_name	varchar "源头区县名称",
	source_district_administrative_code	varchar "源头区县行政编码",
	source_street_id	varchar "源头街道id",
	source_street_name	varchar "源头街道名称",
	source_street_administrative_code	varchar "源头街道行政编码",
	source_community_id	varchar "源头社区id",
	source_community_name	varchar "源头社区名称",
	source_community_administrative_code	varchar "源头社区行政编码",
	source_address	varchar "源头具体地址",
	customer_name	varchar "客户联系人姓名",
	customer_phone	varchar "客户联系人电话",
	source_longitude	varchar "源头经度",
	source_latitude	varchar "源头纬度",
	disposal_name	varchar "消纳单位名称",
	disposal_district_id	varchar "消纳单位区县id",
	disposal_district_name	varchar "消纳单位区县名称",
	disposal_district_administrative_code	varchar "消纳单位区县行政编码",
	disposal_street_id	varchar "消纳单位街道id",
	disposal_street_name	varchar "消纳单位街道名称",
	disposal_street_administrative_code	varchar "消纳单位街道行政编码",
	disposal_community_id	varchar "消纳单位社区id",
	disposal_community_name	varchar "消纳单位社区名称",
	disposal_community_administrative_code	varchar "消纳单位社区行政编码",
	disposal_address	varchar "消纳单位具体地址",
	disposal_contact_name	varchar "消纳单位联系人姓名",
	disposal_contact_phone	varchar "消纳单位联系人电话",
	disposal_longitude	varchar "消纳单位经度",
	disposal_latitude	varchar "消纳单位纬度",
	receiving_company_id	varchar "接单公司id",
	receiving_company	varchar "接单公司",
	del_flag	varchar "删除标志（0代表存在 2代表删除）",
	del_flag_txt	varchar "删除标志（0代表存在 2代表删除）",
	dept_id	varchar "创建部门",
	create_by	varchar "创建者",
	create_time	timestamp "创建时间",
	update_by	varchar "更新者",
	update_time	timestamp "更新时间",
	remark	varchar "备注"
)
with autosearch=true, version=false, key=manu, alias='订单的联单', nickname='by0317{%02d,filei}_bus_link_order';

-- 创建对象类: 订单
create class if not exists /by0317{%02d,filei}/bus_order_info (
	id	varchar "业务主键",
	bus_order_info_order_id	varchar "订单id",
	filing_id	varchar "备案id",
	bus_order_info_status	int "订单状态（0:已取消，1:待派单，2：待自运，3:待装车，4:待卸车，10已完成）",
	bus_order_info_status_txt	varchar "订单状态（0:已取消，1:待派单，2：待自运，3:待装车，4:待卸车，10已完成）",
	type	varchar "订单类型（零星收运：LXSY,装修清运：ZXQY）",
	type_txt	varchar "订单类型（零星收运：LXSY,装修清运：ZXQY）",
	appointment_time	varchar "预约时间段",
	bus_order_info_user_id	varchar "下单人用户id",
	bus_order_info_user_name	varchar "下单人用户名",
	user_phone	varchar "下单人手机号码",
	bus_order_info_dept_district_id	varchar "部门区id",
	bus_order_info_dept_district_name	varchar "部门区名称",
	bus_order_info_district_administrative_code	varchar "区行政编码",
	bus_order_info_dept_street_id	varchar "部门街镇id",
	bus_order_info_dept_street_name	varchar "部门街镇名称",
	bus_order_info_street_administrative_code	varchar "镇街行政编码",
	bus_order_info_dept_community_id	varchar "部门社区id",
	bus_order_info_dept_community_name	varchar "部门社区名称",
	bus_order_info_community_administrative_code	varchar "社区行政编码",
	bus_order_info_address	varchar "详细地址",
	bus_order_info_longitude	varchar "经度（WGS84）",
	bus_order_info_latitude	varchar "纬度（WGS84）",
	recycle_method	varchar "回收方式（1101上门回收，1102自运）",
	recycle_method_txt	varchar "回收方式（1101上门回收，1102自运）",
	estimate_price	double "订单预估价格",
	bus_order_info_volume	int "预估回收体积",
	bus_order_info_sack_num	int "回收袋数",
	bus_order_info_feedback_volume	double "订单反馈体积",
	bus_order_info_actual_price	double "订单实际价格",
	floor	int "楼层",
	elevator	int "是否有电梯",
	elevator_txt	int "是否有电梯",
	images_url	varchar "订单图片地址",
	bus_order_info_dispatch_time	timestamp "派单时间",
	dispatch_dept_id	varchar "处置部门id",
	dispatch_dept_category	varchar "处置部门编码",
	dispatch_dept_name	varchar "处置部门名称",
	bus_order_info_dispatch_user_id	varchar "派单人id",
	bus_order_info_dispatch_user_name	varchar "派单人名称",
	bus_order_info_clean_driver_id	varchar "清运司机id",
	bus_order_info_clean_driver_name	varchar "清运司机名称",
	bus_order_info_clean_driver_phone	varchar "清运司机电话",
	bus_order_info_car_id	varchar "清运车辆id",
	bus_order_info_car_license_plate	varchar "清运车辆车牌",
	loading_time	timestamp "装车时间时间",
	loading_before_images_url	varchar "装车前图片",
	loading_after_time_images_url	varchar "装车后图片",
	bill_images_url	varchar "票据图片url",
	unloading_time	timestamp "卸车时间",
	unloading_before_images_url	varchar "卸车前图片",
	unloading_after_images_url	varchar "卸车后图片",
	comment_time	timestamp "下单人评论时间",
	comment_content	varchar "下单人评论内容",
	comment_star	double "下单人星级（0-5）",
	comment_star_name	varchar "下单人评论星级名称",
	clean_driver_comment_time	timestamp "配送员评论时间",
	clean_driver_comment_content	varchar "配送员评论内容",
	clean_driver_comment_star	double "配送员评论星级（0-5）",
	clean_driver_comment_star_name	varchar "配送员评论星级名称",
	complete_time	timestamp "订单完成时间",
	pre_finish_reason	varchar "订单提前结束原因",
	bus_order_info_del_flag	varchar "删除标志（0代表存在 2代表删除）",
	bus_order_info_dept_id	varchar "创建部门",
	bus_order_info_create_by	varchar "创建者",
	bus_order_info_create_time	timestamp "创建时间",
	bus_order_info_update_by	varchar "更新者",
	bus_order_info_update_time	timestamp "更新时间",
	dispatch_user_phone	varchar "派单人电话"
)
with autosearch=true, version=false, key=manu, alias='订单', nickname='by0317{%02d,filei}_bus_order_info';

-- 创建对象类: 底数管理
create class if not exists /by0317{%02d,filei}/cg_base_management (
	id	varchar "主键",
	cg_base_management_create_user	varchar "创建人 ID",
	cg_base_management_create_dept	varchar "创建人街道 ID",
	cg_base_management_create_time	timestamp "创建时间",
	cg_base_management_update_user	varchar "修改人 ID",
	cg_base_management_update_time	timestamp "修改时间",
	cg_base_management_status	int "业务状态，默认 0",
	cg_base_management_is_deleted	int "是否已删除，默认 0",
	cg_base_management_tenant_id	varchar "租户 ID (区 ID)",
	version	int "版本号，默认 0",
	province_code	varchar "省级区划编号",
	province_name	varchar "省级名称",
	city_code	varchar "市级区划编号",
	city_name	varchar "市级名称",
	district_code	varchar "区级区划编号",
	district_name	varchar "区级名称",
	region_code	varchar "地域 CODE",
	region	varchar "地域",
	community	varchar "社区名称",
	community_code	varchar "社区名称 CODE",
	live_type	varchar "收费对象类型",
	live_type_code	varchar "收费对象类型 CODE",
	is_poor_people	varchar "是否困难群众",
	is_sanitation_services	varchar "是否提供清洁卫生服务",
	unit_type	varchar "单位性质",
	unit_type_code	varchar "单位性质 CODE",
	is_employees_number_lt_six	varchar "从业人员数量是否小于 6 人（已不用）",
	is_area_lt_fifty	varchar "运营场所套内面积是否小于 50 平方米（已不用）",
	is_catering_service	varchar "是否从事餐饮服务、食品加工销售、其他产品生产加工经营（已不用）",
	is_paid_management	varchar "对市容环境卫生责任区是否实行有偿代管路段（已不用）",
	section_area	varchar "路段面积",
	section_area_code	varchar "路段面积 CODE",
	is_waiting_service	varchar "是否提供垃圾待运服务",
	susiness_area	varchar "经营面积（字段名可能存在笔误，应为 business_area）",
	susiness_area_code	varchar "经营面积 CODE（字段名可能存在笔误，应为 business_area_code）",
	room_number	varchar "房号（已不用）",
	charge_object	varchar "收费对象姓名",
	card_number	varchar "收费对象身份证号码",
	phone	varchar "收费对象联系电话",
	barrelage	varchar "垃圾量（桶数）",
	people_number	int "人数（人）",
	area	varchar "面积（平方米）",
	month	varchar "包月",
	equipment_use	varchar "设备使用量（桶）",
	avenue_road_lane	varchar "街路巷（已不用）",
	house_number	varchar "门牌号（已不用）",
	is_remit	varchar "是否代缴",
	remit_type	varchar "代缴类型",
	remit_type_code	varchar "代缴类型 CODE",
	charge_object_name	varchar "收费对象名称",
	registered_address	varchar "单位注册地址",
	enterprise_name	varchar "企业名称 / 商铺名称",
	operated_type	varchar "对比操作类型（更新：update，新：insert）",
	operated_type_code	varchar "对比操作类型 code（更新：update，新：insert）",
	operated_time	varchar "对比操作时间",
	uscc	varchar "统一社会信用代码",
	audit_user	int "审核人",
	audit_time	timestamp "审核时间",
	barrel_type	varchar "垃圾桶类型",
	barrel_type_code	varchar "垃圾桶类型 CODE",
	toll_collector_id	varchar "收费员 id",
	detailed_address	varchar "详细地址",
	household	varchar "户数（户）",
	is_deal_amount	varchar "是否协议量计费",
	room_code	varchar "套间地址二维码 code",
	room_number_code	varchar "套间地址 code",
	building_code	varchar "楼栋地址二维码 code",
	house_number_code	varchar "楼栋地址 code",
	paby_abutment_status	int "平安白云对接状态（0：未对接确认，1：正常，2：楼栋不存在，3：套房不存在），默认 0",
	exemption_targets_type	varchar "减免对象类型（N：否、poorPeople：困难群众、martyrFamilyDependants：烈士遗属、preferentialTreatment：优抚对象）",
	exemption_targets_type_code	varchar "减免对象类型 code（N：否、poorPeople：困难群众、martyrFamilyDependants：烈士遗属、preferentialTreatment：优抚对象）"
)
with autosearch=true, version=false, key=manu, alias='底数管理', nickname='by0317{%02d,filei}_cg_base_management';

-- 创建对象类: 账单管理
create class if not exists /by0317{%02d,filei}/cp_charge_bill (
	id	varchar "业务主键",
	cp_charge_bill_ID	varchar "主键",
	cp_charge_bill_create_user	varchar "创建人 ID",
	cp_charge_bill_create_dept	varchar "创建人街道 ID",
	cp_charge_bill_create_time	timestamp "创建时间",
	cp_charge_bill_update_user	varchar "修改人 ID",
	cp_charge_bill_update_time	timestamp "修改时间",
	cp_charge_bill_status	int "业务状态，默认 0",
	cp_charge_bill_is_deleted	int "是否已删除，默认 0",
	cp_charge_bill_tenant_id	varchar "租户 ID (区 ID)",
	version	int "版本号，默认 0",
	region	varchar "地域",
	region_code	varchar "地域 Code",
	community	varchar "社区名称",
	community_code	varchar "社区名称 CODE",
	bill_create_time	varchar "账单生成时间",
	bill_code	varchar "账单编号",
	contract_id	varchar "合同 ID",
	contract_name	varchar "合同名称",
	contract_code	varchar "合同编号",
	contract_start_time	varchar "合同开始时间",
	contract_end_time	varchar "合同截止时间",
	pay_cycle	varchar "缴费周期",
	pay_cycle_code	varchar "缴费周期 CODE",
	card_number	varchar "身份证号码",
	charge_object	varchar "收费对象",
	phone	varchar "联系电话",
	resource_address	varchar "资源地址",
	bill_state	varchar "账单状态",
	bill_state_code	varchar "账单状态 CODE",
	bill_cycle_start_time	varchar "账单周期（开始时间）",
	bill_cycle_end_time	varchar "账单周期（截止时间）",
	amount	varchar "金额",
	pay_status	varchar "缴费状态（未缴费，已缴费），默认 ' 未缴费'",
	pay_status_code	varchar "缴费状态 CODE（unpaid：未缴费，paid：已缴费），默认 'unpaid'",
	pay_time	varchar "缴费时间",
	frozen_reason	varchar "冻结原因",
	unit_no	varchar "执收单位",
	paynote_no	varchar "缴款码",
	push_bill_time	varchar "推送非税时间",
	attr_path	varchar "冻结上传附件地址",
	out_pay_order_id	varchar "外部支付系统订单号",
	base_management_id	varchar "底数管理 id（关联 cg_base_management 表 id）",
	is_prepaid	varchar "是否预收，默认 'N'",
	qr_code	varchar "二维码 URL",
	bill_cycle_num	int "缴费周期数，默认 1",
	payer_name	varchar "缴款人",
	is_additional_recording	varchar "是否补录，默认 'N'",
	is_current_cycle_bill	varchar "是否周期开始生成账单，默认 'N'",
	toll_collector_id	varchar "收费员 id",
	is_online_pay	varchar "是否线上缴费",
	is_push_bill	varchar "是否推送非税",
	live_type	varchar "居住类型",
	live_type_code	varchar "居住类型 CODE",
	uscc	varchar "统一社会信用代码",
	is_revoke_payable	varchar "是否被应缴撤销，1 表示被应缴撤销，默认 '0'",
	payment_channels	varchar "支付渠道（非税单笔：financeSystem，非税自动划扣：financeAuto），默认 ' 非税单笔'",
	payment_channels_code	varchar "支付渠道 code（非税单笔：financeSystem，非税自动划扣：financeAuto），默认 'financeSystem'",
	auto_pay_type	varchar "自动划扣类型（空为没有，rcb 为农商行，ccb 为建行，lcbc 为工行）",
	auto_pay_type_code	varchar "自动划扣类型 code（空为没有，rcb 为农商行，ccb 为建行，lcbc 为工行）",
	notice_pay_code	varchar "自动划扣缴款码",
	is_push_auto	int "是否已推送自动划扣，默认 0",
	auto_push_time	varchar "自动划扣推送时间",
	frozen_time	varchar "冻结时间",
	address_type	varchar "地址类型（property：物业小区，shops：商铺，institutionalUnit：机团单位，principleResidence：自住房屋，rentalHouseRoom：出租屋套间，rentalHouseBuilding：出租屋楼栋，enterprise：企业，warehouse：仓库）",
	address_type_code	varchar "地址类型 CODE（property：物业小区，shops：商铺，institutionalUnit：机团单位，principleResidence：自住房屋，rentalHouseRoom：出租屋套间，rentalHouseBuilding：出租屋楼栋，enterprise：企业，warehouse：仓库）"
)
with autosearch=true, version=false, key=manu, alias='账单管理', nickname='by0317{%02d,filei}_cp_charge_bill';

-- Deleted sp_chronological_statistics

-- Deleted sp_target_amount

-- 创建对象类: 收费契约管理
create class if not exists /by0317{%02d,filei}/cp_charge_contract (
	id	varchar "业务主键",
	cp_charge_contract_ID	varchar "主键",
	cp_charge_contract_create_user	varchar "创建人 ID",
	cp_charge_contract_create_dept	varchar "创建人街道 ID",
	cp_charge_contract_create_time	timestamp "创建时间",
	cp_charge_contract_update_user	varchar "修改人 ID",
	cp_charge_contract_update_time	timestamp "修改时间",
	cp_charge_contract_status	int "业务状态，默认 0",
	cp_charge_contract_is_deleted	int "是否已删除，默认 0",
	cp_charge_contract_is_deleted_txt	varchar "字典值治理",
	cp_charge_contract_tenant_id	varchar "租户 ID (区 ID)",
	version	int "版本号，默认 0",
	region_code	varchar "地域 CODE",
	region	varchar "地域",
	community	varchar "社区名称",
	community_code	varchar "社区名称 CODE",
	contract_name	varchar "合同名称",
	contract_code	varchar "合同编号",
	contract_start_time	varchar "合同开始时间",
	contract_end_time	varchar "合同截止时间",
	pay_cycle	varchar "缴费周期",
	pay_cycle_code	varchar "缴费周期 CODE",
	charge_object_name	varchar "收费对象名称",
	charge_object	varchar "收费对象",
	phone	varchar "联系电话",
	card_number	varchar "身份证号码",
	address	varchar "房屋地址",
	contract_template_name	varchar "契约模板名称",
	contract_template_id	varchar "契约模板 ID",
	sign_status	varchar "签订状态（waitSign：待签订，refuseSign：拒签，contractPeriod：合同期中，overdue：过期，terminationSign：人为终止）",
	sign_status_code	varchar "签订状态 CODE（waitSign：待签订，refuseSign：拒签，contractPeriod：合同期中，overdue：过期，terminationSign：人为终止）",
	reason	varchar "原因",
	enterprise_name	varchar "企业名称 / 商铺名称",
	base_management_id	varchar "底数管理 id（关联 cg_base_management 表 id）",
	examine_status	varchar "审核状态",
	attach_id	varchar "签名附件 id",
	registered_address	varchar "单位注册地址",
	user_sign_time	varchar "用户签订时间",
	live_type	varchar "居住类型",
	live_type_code	varchar "居住类型 CODE",
	is_prepaid	varchar "是否预收，默认 'N'",
	is_prepaid_txt	varchar "字典值治理",
	contract_type	varchar "契约类型（生活垃圾契约（主契约）：domesticGarbage，厨余垃圾契约（拆分契约）：kitchenWaste，其他垃圾契约（拆分契约）：otherWaste）",
	contract_type_code	varchar "契约类型 CODE（生活垃圾契约（主契约）：domesticGarbage，厨余垃圾契约（拆分契约）：kitchenWaste，其他垃圾契约（拆分契约）：otherWaste）",
	national_emblem_attach_id	varchar "身份证国徽面附件 ID",
	portrait_attach_id	varchar "身份证人像面附件 ID",
	national_emblem_attach_link	varchar "国徽面附件 Link",
	portrait_attach_link	varchar "人像面附件 link",
	uscc	varchar "统一社会信用代码",
	amount	varchar "金额",
	cycle_num	int "缴费周期数，默认 1",
	audit_type	varchar "审核类型（front：前置审核，post：后置审查）",
	audit_type_code	varchar "审核类型 CODE（front：前置审核，post：后置审查）",
	is_examination	int "是否审查",
	is_examination_txt	varchar "字典值治理",
	is_additional_recording	varchar "是否补录，默认 'N'",
	is_additional_recording_txt	varchar "字典值治理",
	is_current_cycle_bill	varchar "是否周期开始生成账单，默认 'N'",
	is_current_cycle_bill_txt	varchar "字典值治理",
	toll_collector_id	varchar "收费员 id",
	is_push_bill	varchar "是否推送非税",
	is_push_bill_txt	varchar "字典值治理",
	auto_pay_type	varchar "自动划扣类型（空为没有，rcb 为农商行，ccb 为建行，lcbc 为工行），默认 ''",
	auto_pay_type_code	varchar "自动划扣类型 code（空为没有，rcb 为农商行，ccb 为建行，lcbc 为工行），默认 ''",
	unit_type	varchar "单位性质",
	unit_type_code	varchar "单位性质 CODE"
)
with autosearch=true, version=false, key=manu, alias='收费契约管理', nickname='by0317{%02d,filei}_cp_charge_contract';

-- 创建对象类: 区域信息
create class if not exists /by0317{%02d,filei}/region_info (
	id	varchar "业务主键",
	region_code	varchar "区域编码",
	region	varchar "区域名称"
)
with autosearch=true, version=false, key=manu, alias='镇街', nickname='by0317{%02d,filei}_region_info';

-- 创建对象类: 区域目标金额
create class if not exists /by0317{%02d,filei}/region_target (
    id varchar "主键",
    create_user varchar "创建人 ID",
    create_dept varchar "创建人街道 ID",
    create_time timestamp "创建时间",
    update_user varchar "修改人 ID",
    update_time timestamp "修改时间",
    status int "业务状态，默认 0",
    is_deleted int "是否已删除，默认 0",
    tenant_id varchar "租户 ID (区 ID)",
    version int "版本号，默认 0",
    region_code varchar "地域 CODE",
    region varchar "地域",
    target_amount double "目标金额",
    year int "年度"
) with autosearch=true, version=false, key=manu, alias='区域目标金额', nickname='by0317{%02d,filei}_region_target';

-- 创建对象类: 区域序时统计
create class if not exists /by0317{%02d,filei}/region_stats (
    id varchar "主键",
    create_user varchar "创建人 ID",
    create_dept varchar "创建人街道 ID",
    create_time timestamp "创建时间",
    update_user varchar "修改人 ID",
    update_time timestamp "修改时间",
    status int "业务状态，默认 0",
    is_deleted int "是否已删除，默认 0",
    tenant_id varchar "租户 ID (区 ID)",
    version int "版本号，默认 0",
    region_code varchar "地域 CODE",
    region varchar "地域",
    statistical_date varchar "统计日期（yyyyMMdd）",
    total_amount double "应收金额",
    paid_amount double "已收金额",
    contribution_rate double "缴费率（%）",
    all_total_amount double "全区应收金额",
    all_paid_amount double "全区已收金额",
    all_contribution_rate double "全区缴费率（%）",
    contribution_rate_compare varchar "缴费率比较（higher：较高，lower：较低）",
    target_progress double "目标进度（%）",
    chronological_progress double "序时进度（%）",
    is_reach_progress int "是否达到进度（1：是，0：否）"
) with autosearch=true, version=false, key=manu, alias='区域序时统计', nickname='by0317{%02d,filei}_region_stats';

