Browse Source

(*)脚本进程完善

dev
peng.peng 10 months ago
parent
commit
749f734354
  1. 8
      scripts/1.4.1/data/1_insert_road_data/index.js

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

@ -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) {
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) {

Loading…
Cancel
Save