|
|
@ -138,12 +138,14 @@ try { |
|
|
|
Object.keys(r).forEach(key => { |
|
|
|
arr.push(key) |
|
|
|
}) |
|
|
|
if (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 = ${isExit.id};\n` |
|
|
|
if (del != r.del && spot != r.spot && township_code != isExit.township_code) { |
|
|
|
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`, starting_place_name = `null`, |
|
|
@ -251,10 +253,12 @@ try { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fs.writeFileSync('road_update.sql', villageSql, 'utf-8'); |
|
|
|
// fs.writeFileSync('road_update.sql', villageSql, 'utf-8');
|
|
|
|
// fs.writeFileSync('no_exist_village.txt', noExistVillage, 'utf-8');
|
|
|
|
|
|
|
|
// await client.query('ROLLBACK')
|
|
|
|
await client.query(delSql); |
|
|
|
await client.query(villageSql); |
|
|
|
await client.query('COMMIT') |
|
|
|
console.log('执行完毕~') |
|
|
|
} catch (e) { |
|
|
|