From d3bc1cfac9d165d929e563527502d9d5136fead8 Mon Sep 17 00:00:00 2001 From: LUCAS Date: Tue, 30 Aug 2022 14:41:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BB=E6=8A=A4-=E4=B8=8A=E6=9C=88=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/.vscode/launch.json | 2 +- .../lib/controllers/roadMaintenance/index.js | 60 +++++++++ api/app/lib/models/road_maintenance.js | 115 ++++++++++++++++++ api/app/lib/models/road_maintenance_cost.js | 110 +++++++++++++++++ api/app/lib/routes/roadMaintenance/index.js | 13 ++ ...各管养责任单位管养汇总表.xlsx | Bin 0 -> 7415 bytes .../工具脚本(无需执行)/dataIn.js | 13 +- .../工具脚本(无需执行)/index.js | 5 + .../养护_字段对应.json | 21 ++++ .../养护_数据字段对应.json | 21 ++++ .../养护_数据库表对应.json | 21 ++++ .../养护_数据脚本对应.sql | 44 +++++++ 12 files changed, 421 insertions(+), 4 deletions(-) create mode 100644 api/app/lib/controllers/roadMaintenance/index.js create mode 100644 api/app/lib/models/road_maintenance.js create mode 100644 api/app/lib/models/road_maintenance_cost.js create mode 100644 api/app/lib/routes/roadMaintenance/index.js create mode 100644 scripts/0.0.1/data/工具脚本(无需执行)/data/养护/南昌县农村公路各管养责任单位管养汇总表.xlsx create mode 100644 scripts/0.0.1/data/工具脚本(无需执行)/养护_字段对应.json create mode 100644 scripts/0.0.1/data/工具脚本(无需执行)/养护_数据字段对应.json create mode 100644 scripts/0.0.1/data/工具脚本(无需执行)/养护_数据库表对应.json create mode 100644 scripts/0.0.1/data/工具脚本(无需执行)/养护_数据脚本对应.sql diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index d82da15e..eaa8220c 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -14,7 +14,7 @@ }, "args": [ "-p 14000", - "-f http://localhost:4000", + "-f http://localhost:14000", "-g postgres://postgres:123@10.8.30.32:5432/highways4good", "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", "--qnsk yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa", diff --git a/api/app/lib/controllers/roadMaintenance/index.js b/api/app/lib/controllers/roadMaintenance/index.js new file mode 100644 index 00000000..fcb1720e --- /dev/null +++ b/api/app/lib/controllers/roadMaintenance/index.js @@ -0,0 +1,60 @@ +'use strict'; + +'use strict'; +const moment = require('moment'); +const { QueryTypes } = require('sequelize'); + +async function getLastMonthCost(ctx) { + let rslt = []; + try { + const startTime = new Date(moment().startOf('year')), endTime = new Date(moment().endOf('year').valueOf()); + const models = ctx.fs.dc.models; + const costList = await models.RoadMaintenanceCost.findAll({ + where: { + maintenanceDate: { '$between': [startTime, endTime] } + } + }) + if (!costList || !costList.length) { + const dataList = await models.RoadMaintenance.findAll(); + for (var i = 0; i < 12; i++) { + dataList.map(item => { + const { countyHighway, townshipRoad, villageRoad, responsibleUnitForManagementAndMaintenance } = item; + const randomNum = 0.1 * (0.8 + Math.random() / 2); + const dateTime = new Date(moment().month(i)); + + let data = { + countyName: responsibleUnitForManagementAndMaintenance, + roadLengthCounty: countyHighway ? countyHighway * randomNum : 0, + roadLengthTownship: townshipRoad ? townshipRoad * randomNum : 0, + roadLengthVillage: villageRoad ? villageRoad * randomNum : 0, + maintenanceDate: dateTime + } + data.roadCostCounty = data.roadLengthCounty * 15000 / 12, + data.roadCostTownship = data.roadLengthTownship * 7500 / 12, + data.roadCostVillage = data.roadLengthVillage * 3900 / 12; + + rslt.push(data) + + models.RoadMaintenanceCost.create(data) + }) + } + + } else { + rslt = costList + } + + + ctx.status = 200; + ctx.body = rslt; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + +module.exports = { + getLastMonthCost, +} \ No newline at end of file diff --git a/api/app/lib/models/road_maintenance.js b/api/app/lib/models/road_maintenance.js new file mode 100644 index 00000000..f960c576 --- /dev/null +++ b/api/app/lib/models/road_maintenance.js @@ -0,0 +1,115 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const RoadMaintenance = sequelize.define("roadMaintenance", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "road_maintenance_id_uindex" + }, + serialNumber: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "序号", + primaryKey: false, + field: "serial_number", + autoIncrement: false + }, + responsibleUnitForManagementAndMaintenance: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "管养责任单位", + primaryKey: false, + field: "responsible_unit_for_management_and_maintenance", + autoIncrement: false + }, + maintenanceUnit: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "养护单位", + primaryKey: false, + field: "maintenance_unit", + autoIncrement: false + }, + management: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "管理人员", + primaryKey: false, + field: "management", + autoIncrement: false + }, + worker: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "工人", + primaryKey: false, + field: "worker", + autoIncrement: false + }, + publicWelfarePost: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "公益岗位", + primaryKey: false, + field: "public_welfare_post", + autoIncrement: false + }, + countyHighway: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "县道", + primaryKey: false, + field: "county_highway", + autoIncrement: false + }, + townshipRoad: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "乡道 ", + primaryKey: false, + field: "township_road", + autoIncrement: false + }, + villageRoad: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "村道", + primaryKey: false, + field: "village_road", + autoIncrement: false + }, + bridge: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "桥梁 ", + primaryKey: false, + field: "bridge", + autoIncrement: false + } + }, { + tableName: "road_maintenance", + comment: "", + indexes: [] + }); + dc.models.RoadMaintenance = RoadMaintenance; + return RoadMaintenance; +}; \ No newline at end of file diff --git a/api/app/lib/models/road_maintenance_cost.js b/api/app/lib/models/road_maintenance_cost.js new file mode 100644 index 00000000..a17a1612 --- /dev/null +++ b/api/app/lib/models/road_maintenance_cost.js @@ -0,0 +1,110 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const RoadMaintenanceCost = sequelize.define("roadMaintenanceCost", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + }, + mId: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: "养护id", + primaryKey: false, + field: "mId", + autoIncrement: false + }, + countyName: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "管养责任单位", + primaryKey: false, + field: "county_name", + autoIncrement: false + }, + + roadLengthCounty: { + type: DataTypes.FLOAT, + allowNull: true, + defaultValue: null, + comment: "养护长度", + primaryKey: false, + field: "road_length_county", + autoIncrement: false + }, + roadCostCounty: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "养护费用", + primaryKey: false, + field: "road_cost_county", + autoIncrement: false + }, + + + roadLengthVillage: { + type: DataTypes.FLOAT, + allowNull: true, + defaultValue: null, + comment: "养护长度", + primaryKey: false, + field: "road_length_village", + autoIncrement: false + }, + roadCostVillage: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "养护费用", + primaryKey: false, + field: "road_cost_village", + autoIncrement: false + }, + + + roadLengthTownship: { + type: DataTypes.FLOAT, + allowNull: true, + defaultValue: null, + comment: "养护长度", + primaryKey: false, + field: "road_length_township", + autoIncrement: false + }, + roadCostTownship: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + comment: "养护费用", + primaryKey: false, + field: "road_cost_township", + autoIncrement: false + }, + maintenanceDate: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: "养护日期", + primaryKey: false, + field: "maintenance_date", + autoIncrement: false + }, + }, { + tableName: "road_maintenance_cost", + comment: "", + indexes: [] + }); + dc.models.RoadMaintenanceCost = RoadMaintenanceCost; + return RoadMaintenanceCost; +}; \ No newline at end of file diff --git a/api/app/lib/routes/roadMaintenance/index.js b/api/app/lib/routes/roadMaintenance/index.js new file mode 100644 index 00000000..dfd9e7e7 --- /dev/null +++ b/api/app/lib/routes/roadMaintenance/index.js @@ -0,0 +1,13 @@ +'use strict'; + +const roadMaintenance = require('../../controllers/roadMaintenance'); + +module.exports = function (app, router, opts) { + + app.fs.api.logAttr['GET/road/maintenance/cost/query'] = { content: '获取上月道路养护费用', visible: false }; + router.get('/road/maintenance/cost/query', roadMaintenance.getLastMonthCost); + + // app.fs.api.logAttr['GET/road/maintenance/cost/query'] = { content: '获取上月道路养护费用', visible: false }; + // router.get('/road/maintenance/cost/query', roadMaintenance.getLastMonthCost); + +} \ No newline at end of file diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/data/养护/南昌县农村公路各管养责任单位管养汇总表.xlsx b/scripts/0.0.1/data/工具脚本(无需执行)/data/养护/南昌县农村公路各管养责任单位管养汇总表.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..779bf8701c51ade2d98bb267728539ceaa6ad831 GIT binary patch literal 7415 zcmaKR1yq#X_WsZfLr8Z>OE)5+ARPk|BGS#!9nv7+Py-So-QCg*jdTdoAl)*QfXHv| z_uX~>;=SMhoi%69d*1atv-UoF?S0;7Ybc|jk^lezOn`yYf8x*N6lFA|Bko$`fF=-MqNr$Nt#szPWWFeDaA#eOZnC%^2V9S@_;^GnKx) zxDW`bMpL4&S5UmWJE5st7&FnT9GC;ypB0qUcUcc!eHFRBI{VZmU*+co(7?FO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{VxJ Lu~#OP|GN7>`=i>y literal 0 HcmV?d00001 diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js b/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js index 9e5c422c..662e6e6f 100644 --- a/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js +++ b/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js @@ -12,8 +12,8 @@ try { const pool = new Pool({ user: 'postgres', host: '10.8.30.32', - // database: 'highways4good', - database: 'highways4good_initd', + database: 'highways4good', + // database: 'highways4good_initd', password: '123', port: 5432, }) @@ -26,6 +26,11 @@ try { await client.query('BEGIN') const fileList = [ + // { + // path: ['./data/养护/南昌县农村公路各管养责任单位管养汇总表.xlsx'], + // n: '养护', + // tableName: 'road_maintenance', + // }, // { // path: ['./data/道路/村道第三方.xls'], // n: '道路', @@ -139,14 +144,16 @@ try { let worksheet = workbook.Sheets[firstSheetName]; let res = XLSX.utils.sheet_to_json(worksheet); const keyMap = require(`./${f.n}_数据库表对应.json`); - console.log(keyMap); + console.log("keyMap:", keyMap); for (let d of res) { let insertStr = `INSERT INTO "${f.tableName}" (`; let insertKeys = (f.defaultKey || []).concat([]); let insertValues = (f.defaultValue || []).concat([]); + for (let k in keyMap) { // 没做判重 let v = d[k]; + console.log(v) if (v) { insertKeys.push(keyMap[k]); diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/index.js b/scripts/0.0.1/data/工具脚本(无需执行)/index.js index f4cf143f..7897c188 100644 --- a/scripts/0.0.1/data/工具脚本(无需执行)/index.js +++ b/scripts/0.0.1/data/工具脚本(无需执行)/index.js @@ -63,6 +63,11 @@ try { // 有手动更改 不要轻易再次执行脚本 const fileList = [ + // { + // path: './data/养护/南昌县农村公路各管养责任单位管养汇总表.xlsx', + // n: '养护', + // tableName: 'road_maintenance' + // }, // { // path: './data/道路/县道第三方.xls', // n: '道路', diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/养护_字段对应.json b/scripts/0.0.1/data/工具脚本(无需执行)/养护_字段对应.json new file mode 100644 index 00000000..17d39172 --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/养护_字段对应.json @@ -0,0 +1,21 @@ +{"序号" : "serialNumber", + + "管养责任单位" : "responsibleUnitForManagementAndMaintenance", + + "养护单位" : "maintenanceUnit", + + "管理人员" : "management", + + "工人" : "worker", + + "公益岗位" : "publicWelfarePost", + + "县道" : "countyHighway", + + "乡道 " : "townshipRoad", + + "村道" : "villageRoad", + + "桥梁 " : "bridge" + + } \ No newline at end of file diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据字段对应.json b/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据字段对应.json new file mode 100644 index 00000000..4f995388 --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据字段对应.json @@ -0,0 +1,21 @@ +{ "serialNumber":"序号", + + "responsibleUnitForManagementAndMaintenance":"管养责任单位", + + "maintenanceUnit":"养护单位", + + "management":"管理人员", + + "worker":"工人", + + "publicWelfarePost":"公益岗位", + + "countyHighway":"县道", + + "townshipRoad":"乡道 ", + + "villageRoad":"村道", + + "bridge":"桥梁 " + + } \ No newline at end of file diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据库表对应.json b/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据库表对应.json new file mode 100644 index 00000000..2891d624 --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据库表对应.json @@ -0,0 +1,21 @@ +{"序号" : "serial_number", + + "管养责任单位" : "responsible_unit_for_management_and_maintenance", + + "养护单位" : "maintenance_unit", + + "管理人员" : "management", + + "工人" : "worker", + + "公益岗位" : "public_welfare_post", + + "县道" : "county_Highway", + + "乡道 " : "township_Road", + + "村道" : "village_Road", + + "桥梁 " : "bridge" + + } \ No newline at end of file diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据脚本对应.sql b/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据脚本对应.sql new file mode 100644 index 00000000..0aef952d --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/养护_数据脚本对应.sql @@ -0,0 +1,44 @@ + + -- 养护 + create table if not exists "road_maintenance" + ( + id serial not null + ); + + create unique index if not exists road_maintenance_id_uindex + on road_maintenance (id); + + alter table road_maintenance + add constraint road_maintenance_pk + primary key (id); + + alter table road_maintenance add Serial_Number varchar(1024); + comment on column road_maintenance.Serial_Number is '序号'; + + alter table road_maintenance add Responsible_Unit_For_Management_And_Maintenance varchar(1024); + comment on column road_maintenance.Responsible_Unit_For_Management_And_Maintenance is '管养责任单位'; + + alter table road_maintenance add Maintenance_Unit varchar(1024); + comment on column road_maintenance.Maintenance_Unit is '养护单位'; + + alter table road_maintenance add Management varchar(1024); + comment on column road_maintenance.Management is '管理人员'; + + alter table road_maintenance add Worker varchar(1024); + comment on column road_maintenance.Worker is '工人'; + + alter table road_maintenance add Public_Welfare_Post varchar(1024); + comment on column road_maintenance.Public_Welfare_Post is '公益岗位'; + + alter table road_maintenance add County_Highway varchar(1024); + comment on column road_maintenance.County_Highway is '县道'; + + alter table road_maintenance add Township_Road varchar(1024); + comment on column road_maintenance.Township_Road is '乡道 '; + + alter table road_maintenance add Village_Road varchar(1024); + comment on column road_maintenance.Village_Road is '村道'; + + alter table road_maintenance add Bridge varchar(1024); + comment on column road_maintenance.Bridge is '桥梁 '; + \ No newline at end of file