Browse Source

(*) 更新道路脚本完善

dev
peng.peng 1 year ago
parent
commit
8f27c2d776
  1. 167
      scripts/1.4.1/data/1_insert_road_data/index.js

167
scripts/1.4.1/data/1_insert_road_data/index.js

@ -138,13 +138,15 @@ try {
Object.keys(r).forEach(key => {
arr.push(key)
})
console.log(arr)
let isExit = allRoads.find(s => s.route_code == r.route_code && s.section_no == r.section_no && s.route_name == r.route_name)
if (r.route_name == '协成-塘南(乡道改)') {
console.log(1)
}
let isExit = allRoads.find(s => s.route_code == r.route_code && (s.section_no == r.section_no || !s.section_no) && s.route_name == r.route_name)
if (isExit) {
villageSql += `UPDATE road SET village_id = ${villageId}, "del" = ${del}, spot = ${spot}, "township_code" = ${township_code ? township_code : `null`} WHERE id = ${r.id};\n`
villageSql += `UPDATE road SET village_id = ${villageId}, "del" = ${del}, spot = ${spot}, "township_code" = ${township_code ? township_code : `null`} WHERE id = ${isExit.id};\n`
} else {
const {
route_name = `null`, route_code = `null`, section_no = `null`, township_code = `null`, starting_place_name = `null`,
route_name = `null`, route_code = `null`, section_no = `null`, starting_place_name = `null`,
start_station = `null`, category_of_starting_point_and_dividing_point = `null`, stop_place_name = `null`,
category_of_dead_center_and_dividing_point = `null`, stop_station = `null`, section_type = `null`,
route_code_before_road_network_adjustment = `null`, serial_number_of_original_section = `null`,
@ -166,84 +168,85 @@ try {
location_city = `null`, level = `null`, surface_thickness = `null`,
} = r;
villageSql += `
INSERT INTO road (
village_id,
"del",
spot,
route_name, route_code, section_no, township_code, starting_place_name,
start_station, category_of_starting_point_and_dividing_point, stop_place_name,
category_of_dead_center_and_dividing_point, stop_station, section_type,
route_code_before_road_network_adjustment, serial_number_of_original_section,
starting_stake_number_of_the_original_road_section, ending_point_stake_no_of_the_original_road_section,
route_level, nature_of_road_section, completion_time, reconstruction_time, nature_of_construction,
gbm_and_civilized_model_road, landforms, nature_of_charges, toll_station, number_of_culverts,
technical_level, pavement_type, pavement_width, subgrade_width, lane_characteristics,
whether_it_is_open_to_traffic_in_sunny_or_rainy_days, design_speed_per_hour, urban_management_section_or_not,
management_and_maintenance_unit, road_administration_unit, alimentation, source_of_listed_maintenance_funds,
curing_time, greening_mileage, greening_mileaged, type_of_repeated_road_section,
serial_number_of_repeated_section, repeated_section_route_code, planned_fund_category,
planned_year, plan_document_no, plan_item_unique_code, planned_project_route_code,
plan_project_name, planned_project_type, completion_status, year_of_completion, planned_fund_category__one,
planned_year__one, plan_document_no__one, plan_item_unique_code__one, plan_project_name__one,
completion_status__one, year_of_completion__one, station_range, reporting_unit, reason_for_change,
change_time, last_repair_and_maintenance_year, whether_maintenance_managed_highway, remarks,
route_code_of_last_year, route_name_of_last_year, starting_station_of_last_year,
last_years_ending_point_stake_number, graphic_mileage, chainage_mileage, districtcounty,
location_city, level, surface_thickness
) VALUES (
${villageId || `null`},
${del},
${spot},
${route_name ? `'${r.route_name}'` : `null`}, ${route_code ? `'${r.route_code}'` : `null`},
${section_no ? `'${r.section_no}'` : `null`}, ${township_code ? `'${r.township_code}'` : `null`},
${starting_place_name ? `'${r.starting_place_name}'` : `null`},
${start_station ? `'${r.start_station}'` : `null`}, ${category_of_starting_point_and_dividing_point ? `'${r.category_of_starting_point_and_dividing_point}'` : `null`},
${stop_place_name ? `'${r.stop_place_name}'` : `null`},
${category_of_dead_center_and_dividing_point ? `'${r.category_of_dead_center_and_dividing_point}'` : `null`}, ${stop_station ? `'${r.stop_station}'` : `null`},
${section_type ? `'${r.section_type}'` : `null`},
${route_code_before_road_network_adjustment ? `'${r.route_code_before_road_network_adjustment}'` : `null`}, ${serial_number_of_original_section ? `'${r.serial_number_of_original_section}'` : `null`},
${starting_stake_number_of_the_original_road_section ? `'${r.starting_stake_number_of_the_original_road_section}'` : `null`},
${ending_point_stake_no_of_the_original_road_section ? `'${r.ending_point_stake_no_of_the_original_road_section}'` : `null`},
${route_level ? `'${r.route_level}'` : `null`}, ${nature_of_road_section ? `'${r.nature_of_road_section}'` : `null`},
${completion_time ? `'${r.completion_time}'` : `null`},
${reconstruction_time ? `'${r.reconstruction_time}'` : `null`}, ${nature_of_construction ? `'${r.nature_of_construction}'` : `null`},
${gbm_and_civilized_model_road ? `'${r.gbm_and_civilized_model_road}'` : `null`}, ${landforms ? `'${r.landforms}'` : `null`},
${nature_of_charges ? `'${r.nature_of_charges}'` : `null`},
${toll_station ? `'${r.toll_station}'` : `null`}, ${number_of_culverts ? `'${r.number_of_culverts}'` : `null`},
${technical_level ? `'${r.technical_level}'` : `null`}, ${pavement_type ? `'${r.pavement_type}'` : `null`},
${pavement_width ? `'${r.pavement_width}'` : `null`},
${subgrade_width ? `'${r.subgrade_width}'` : `null`}, ${lane_characteristics ? `'${r.lane_characteristics}'` : `null`},
${whether_it_is_open_to_traffic_in_sunny_or_rainy_days ? `'${r.whether_it_is_open_to_traffic_in_sunny_or_rainy_days}'` : `null`},
${design_speed_per_hour ? `'${r.design_speed_per_hour}'` : `null`}, ${urban_management_section_or_not ? `'${r.urban_management_section_or_not}'` : `null`},
${management_and_maintenance_unit ? `'${r.management_and_maintenance_unit}'` : `null`}, ${road_administration_unit ? `'${r.road_administration_unit}'` : `null`},
${alimentation ? `'${r.alimentation}'` : `null`}, ${source_of_listed_maintenance_funds ? `'${r.source_of_listed_maintenance_funds}'` : `null`},
${curing_time ? `'${r.curing_time}'` : `null`}, ${greening_mileage ? `'${r.greening_mileage}'` : `null`},
${greening_mileaged ? `'${r.greening_mileaged}'` : `null`},
${type_of_repeated_road_section ? `'${r.type_of_repeated_road_section}'` : `null`},
${serial_number_of_repeated_section ? `'${r.serial_number_of_repeated_section}'` : `null`},
${repeated_section_route_code ? `'${r.repeated_section_route_code}'` : `null`},
${planned_fund_category ? `'${r.planned_fund_category}'` : `null`},
${planned_year ? `'${r.planned_year}'` : `null`}, ${plan_document_no ? `'${r.plan_document_no}'` : `null`},
${plan_item_unique_code ? `'${r.plan_item_unique_code}'` : `null`},
${planned_project_route_code ? `'${r.planned_project_route_code}'` : `null`},
${plan_project_name ? `'${r.plan_project_name}'` : `null`}, ${planned_project_type ? `'${r.planned_project_type}'` : `null`},
${completion_status ? `'${r.completion_status}'` : `null`},
${year_of_completion ? `'${r.year_of_completion}'` : `null`}, ${planned_fund_category__one ? `'${r.planned_fund_category__one}'` : `null`},
${planned_year__one ? `'${r.planned_year__one}'` : `null`}, ${plan_document_no__one ? `'${r.plan_document_no__one}'` : `null`},
${plan_item_unique_code__one ? `'${r.plan_item_unique_code__one}'` : `null`},
${plan_project_name__one ? `'${r.plan_project_name__one}'` : `null`},
${completion_status__one ? `'${r.completion_status__one}'` : `null`}, ${year_of_completion__one ? `'${r.year_of_completion__one}'` : `null`},
${station_range ? `'${r.station_range}'` : `null`}, ${reporting_unit ? `'${r.reporting_unit}'` : `null`},
${reason_for_change ? `'${r.reason_for_change}'` : `null`},
${change_time ? `'${r.change_time}'` : `null`}, ${last_repair_and_maintenance_year ? `'${r.last_repair_and_maintenance_year}'` : `null`},
${whether_maintenance_managed_highway ? `'${r.whether_maintenance_managed_highway}'` : `null`}, ${remarks ? `'${r.remarks}'` : `null`},
${route_code_of_last_year ? `'${r.route_code_of_last_year}'` : `null`}, ${route_name_of_last_year ? `'${r.route_name_of_last_year}'` : `null`},
${starting_station_of_last_year ? `'${r.starting_station_of_last_year}'` : `null`},
${last_years_ending_point_stake_number ? `'${r.last_years_ending_point_stake_number}'` : `null`}, ${graphic_mileage ? `'${r.graphic_mileage}'` : `null`},
${chainage_mileage ? `'${r.chainage_mileage}'` : `null`}, ${districtcounty ? `'${r.districtcounty}'` : `null`},
${location_city ? `'${r.location_city}'` : `null`}, ${level ? `'${r.level}'` : `null`},
${surface_thickness ? `'${r.surface_thickness}'` : `null`}
);\n`
INSERT INTO road (
village_id,
"del",
spot,
route_name, route_code, section_no, township_code, starting_place_name,
start_station, category_of_starting_point_and_dividing_point, stop_place_name,
category_of_dead_center_and_dividing_point, stop_station, section_type,
route_code_before_road_network_adjustment, serial_number_of_original_section,
starting_stake_number_of_the_original_road_section, ending_point_stake_no_of_the_original_road_section,
route_level, nature_of_road_section, completion_time, reconstruction_time, nature_of_construction,
gbm_and_civilized_model_road, landforms, nature_of_charges, toll_station, number_of_culverts,
technical_level, pavement_type, pavement_width, subgrade_width, lane_characteristics,
whether_it_is_open_to_traffic_in_sunny_or_rainy_days, design_speed_per_hour, urban_management_section_or_not,
management_and_maintenance_unit, road_administration_unit, alimentation, source_of_listed_maintenance_funds,
curing_time, greening_mileage, greening_mileaged, type_of_repeated_road_section,
serial_number_of_repeated_section, repeated_section_route_code, planned_fund_category,
planned_year, plan_document_no, plan_item_unique_code, planned_project_route_code,
plan_project_name, planned_project_type, completion_status, year_of_completion, planned_fund_category__one,
planned_year__one, plan_document_no__one, plan_item_unique_code__one, plan_project_name__one,
completion_status__one, year_of_completion__one, station_range, reporting_unit, reason_for_change,
change_time, last_repair_and_maintenance_year, whether_maintenance_managed_highway, remarks,
route_code_of_last_year, route_name_of_last_year, starting_station_of_last_year,
last_years_ending_point_stake_number, graphic_mileage, chainage_mileage, districtcounty,
location_city, level, surface_thickness
) VALUES (
${villageId || `null`},
${del},
${spot},
${route_name ? `'${r.route_name}'` : `null`}, ${route_code ? `'${r.route_code}'` : `null`},
${section_no ? `'${r.section_no}'` : `null`}, ${township_code ? `'${township_code}'` : `null`},
${starting_place_name ? `'${r.starting_place_name}'` : `null`},
${start_station ? `'${r.start_station}'` : `null`}, ${category_of_starting_point_and_dividing_point ? `'${r.category_of_starting_point_and_dividing_point}'` : `null`},
${stop_place_name ? `'${r.stop_place_name}'` : `null`},
${category_of_dead_center_and_dividing_point ? `'${r.category_of_dead_center_and_dividing_point}'` : `null`}, ${stop_station ? `'${r.stop_station}'` : `null`},
${section_type ? `'${r.section_type}'` : `null`},
${route_code_before_road_network_adjustment ? `'${r.route_code_before_road_network_adjustment}'` : `null`}, ${serial_number_of_original_section ? `'${r.serial_number_of_original_section}'` : `null`},
${starting_stake_number_of_the_original_road_section ? `'${r.starting_stake_number_of_the_original_road_section}'` : `null`},
${ending_point_stake_no_of_the_original_road_section ? `'${r.ending_point_stake_no_of_the_original_road_section}'` : `null`},
${route_level ? `'${r.route_level}'` : `null`}, ${nature_of_road_section ? `'${r.nature_of_road_section}'` : `null`},
${completion_time ? `'${r.completion_time}'` : `null`},
${reconstruction_time ? `'${r.reconstruction_time}'` : `null`}, ${nature_of_construction ? `'${r.nature_of_construction}'` : `null`},
${gbm_and_civilized_model_road ? `'${r.gbm_and_civilized_model_road}'` : `null`}, ${landforms ? `'${r.landforms}'` : `null`},
${nature_of_charges ? `'${r.nature_of_charges}'` : `null`},
${toll_station ? `'${r.toll_station}'` : `null`}, ${number_of_culverts ? `'${r.number_of_culverts}'` : `null`},
${technical_level ? `'${r.technical_level}'` : `null`}, ${pavement_type ? `'${r.pavement_type}'` : `null`},
${pavement_width ? `'${r.pavement_width}'` : `null`},
${subgrade_width ? `'${r.subgrade_width}'` : `null`}, ${lane_characteristics ? `'${r.lane_characteristics}'` : `null`},
${whether_it_is_open_to_traffic_in_sunny_or_rainy_days ? `'${r.whether_it_is_open_to_traffic_in_sunny_or_rainy_days}'` : `null`},
${design_speed_per_hour ? `'${r.design_speed_per_hour}'` : `null`}, ${urban_management_section_or_not ? `'${r.urban_management_section_or_not}'` : `null`},
${management_and_maintenance_unit ? `'${r.management_and_maintenance_unit}'` : `null`}, ${road_administration_unit ? `'${r.road_administration_unit}'` : `null`},
${alimentation ? `'${r.alimentation}'` : `null`}, ${source_of_listed_maintenance_funds ? `'${r.source_of_listed_maintenance_funds}'` : `null`},
${curing_time ? `'${r.curing_time}'` : `null`}, ${greening_mileage ? `'${r.greening_mileage}'` : `null`},
${greening_mileaged ? `'${r.greening_mileaged}'` : `null`},
${type_of_repeated_road_section ? `'${r.type_of_repeated_road_section}'` : `null`},
${serial_number_of_repeated_section ? `'${r.serial_number_of_repeated_section}'` : `null`},
${repeated_section_route_code ? `'${r.repeated_section_route_code}'` : `null`},
${planned_fund_category ? `'${r.planned_fund_category}'` : `null`},
${planned_year ? `'${r.planned_year}'` : `null`}, ${plan_document_no ? `'${r.plan_document_no}'` : `null`},
${plan_item_unique_code ? `'${r.plan_item_unique_code}'` : `null`},
${planned_project_route_code ? `'${r.planned_project_route_code}'` : `null`},
${plan_project_name ? `'${r.plan_project_name}'` : `null`}, ${planned_project_type ? `'${r.planned_project_type}'` : `null`},
${completion_status ? `'${r.completion_status}'` : `null`},
${year_of_completion ? `'${r.year_of_completion}'` : `null`}, ${planned_fund_category__one ? `'${r.planned_fund_category__one}'` : `null`},
${planned_year__one ? `'${r.planned_year__one}'` : `null`}, ${plan_document_no__one ? `'${r.plan_document_no__one}'` : `null`},
${plan_item_unique_code__one ? `'${r.plan_item_unique_code__one}'` : `null`},
${plan_project_name__one ? `'${r.plan_project_name__one}'` : `null`},
${completion_status__one ? `'${r.completion_status__one}'` : `null`}, ${year_of_completion__one ? `'${r.year_of_completion__one}'` : `null`},
${station_range ? `'${r.station_range}'` : `null`}, ${reporting_unit ? `'${r.reporting_unit}'` : `null`},
${reason_for_change ? `'${r.reason_for_change}'` : `null`},
${change_time ? `'${r.change_time}'` : `null`}, ${last_repair_and_maintenance_year ? `'${r.last_repair_and_maintenance_year}'` : `null`},
${whether_maintenance_managed_highway ? `'${r.whether_maintenance_managed_highway}'` : `null`}, ${remarks ? `'${r.remarks}'` : `null`},
${route_code_of_last_year ? `'${r.route_code_of_last_year}'` : `null`}, ${route_name_of_last_year ? `'${r.route_name_of_last_year}'` : `null`},
${starting_station_of_last_year ? `'${r.starting_station_of_last_year}'` : `null`},
${last_years_ending_point_stake_number ? `'${r.last_years_ending_point_stake_number}'` : `null`}, ${graphic_mileage ? `'${r.graphic_mileage}'` : `null`},
${chainage_mileage ? `'${r.chainage_mileage}'` : `null`}, ${districtcounty ? `'${r.districtcounty}'` : `null`},
${location_city ? `'${r.location_city}'` : `null`}, ${level ? `'${r.level}'` : `null`},
${surface_thickness ? `'${r.surface_thickness}'` : `null`}
);\n`
}
}

Loading…
Cancel
Save