Browse Source

道路优化

dev
wenlele 12 months ago
parent
commit
1272f9b802
  1. 38
      api/app/lib/controllers/report/index.js

38
api/app/lib/controllers/report/index.js

@ -1351,12 +1351,12 @@ async function roadSpotPrepare (ctx) {
if (key == '乡') {
if (code == '360121201000') {
let townY002 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y002') != -1)
if (townY002[0]) {
if (townY002[0] && !spotRoadIds.length) {
spotRoadIds.push(townY002[0].id)
accumulationMileage += parseFloat(townY002[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY002[1]) {
if (townY002[1] && !spotRoadIds.length) {
spotRoadIds.push(townY002[1].id)
accumulationMileage += parseFloat(townY002[1].chainage_mileage)
}
@ -1366,20 +1366,20 @@ async function roadSpotPrepare (ctx) {
if (code == '360121105000') {
let townY031 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y031') != -1)
let townY032 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y032') != -1)
if (townY031[0]) {
if (townY031[0] && !spotRoadIds.length) {
spotRoadIds.push(townY031[0].id)
accumulationMileage += parseFloat(townY031[0].chainage_mileage)
}
if (townY032[0]) {
if (townY032[0] && !spotRoadIds.length) {
spotRoadIds.push(townY032[0].id)
accumulationMileage += parseFloat(townY032[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY031[1]) {
if (townY031[1] && !spotRoadIds.length) {
spotRoadIds.push(townY031[1].id)
accumulationMileage += parseFloat(townY031[1].chainage_mileage)
}
if (townY032[1]) {
if (townY032[1] && !spotRoadIds.length) {
spotRoadIds.push(townY032[1].id)
accumulationMileage += parseFloat(townY032[1].chainage_mileage)
}
@ -1407,12 +1407,12 @@ async function roadSpotPrepare (ctx) {
if (key == '乡') {
if (code == '360121201000') {
let townY002 = roadUnSpotedRepeatRes.filter(d => d.route_code.indexOf('Y002') != -1)
if (townY002[0]) {
if (townY002[0] && !spotRoadIds.length) {
spotRoadIds.push(townY002[0].id)
accumulationMileage += parseFloat(townY002[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY002[1]) {
if (townY002[1] && !spotRoadIds.length) {
spotRoadIds.push(townY002[1].id)
accumulationMileage += parseFloat(townY002[1].chainage_mileage)
}
@ -1423,20 +1423,20 @@ async function roadSpotPrepare (ctx) {
if (code == '360121105000') {
let townY031 = roadUnSpotedRepeatRes.filter(d => d.route_code.indexOf('Y031') != -1)
let townY032 = roadUnSpotedRepeatRes.filter(d => d.route_code.indexOf('Y032') != -1)
if (townY031[0]) {
if (townY031[0] && !spotRoadIds.length) {
spotRoadIds.push(townY031[0].id)
accumulationMileage += parseFloat(townY031[0].chainage_mileage)
}
if (townY032[0]) {
if (townY032[0] && !spotRoadIds.length) {
spotRoadIds.push(townY032[0].id)
accumulationMileage += parseFloat(townY032[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY031[1]) {
if (townY031[1] && !spotRoadIds.length) {
spotRoadIds.push(townY031[1].id)
accumulationMileage += parseFloat(townY031[1].chainage_mileage)
}
if (townY032[1]) {
if (townY032[1] && !spotRoadIds.length) {
spotRoadIds.push(townY032[1].id)
accumulationMileage += parseFloat(townY032[1].chainage_mileage)
}
@ -1613,7 +1613,7 @@ async function roadSpotPrepare (ctx) {
let lastCounty = await models.RoadSpotCheckPreview.findAll({
where: {
checked: true,
id: { $lte: lastSpotRes.id }
id: { $lt: lastSpotRes.id }
},
limit: 9,
order: [['date', 'DESC']],
@ -1643,7 +1643,7 @@ async function roadSpotPrepare (ctx) {
let town = await models.Town.findAll() || []
let spotTownRoadIds = []
let spotTownRoadIds = lastSpotRes.townshipRoadId || []
let townMil = lastSpotRes.townMil || 0 //已抽取的乡道公里数
@ -1663,9 +1663,9 @@ async function roadSpotPrepare (ctx) {
let spotVillageRoadIds = []
let spotVillageIds = []
let lastEndVillage = {} //获取每个乡镇最后一个被抽取的村
let spotVillageRoadIds = lastSpotRes.villageRoadId || []
let spotVillageIds = lastSpotRes.villageId || []
let lastEndVillage = lastSpotRes.lastAbstractVillage || {} //获取每个乡镇最后一个被抽取的村
let villageMil = lastSpotRes.villageMil || 0 //已抽取的村道公里数
let allTownCodeResTown = []
@ -1797,8 +1797,8 @@ async function roadSpotPrepare (ctx) {
let spotCheckCreate = await models.RoadSpotCheckPreview.update({
spotTownRoadIds: spotTownRoadIds,
spotVillageIds: spotVillageIds,
townshipRoadId: spotTownRoadIds,
villageRoadId: spotVillageIds,
villageId: spotVillageIds,
townMil,
villageMil,

Loading…
Cancel
Save