diff --git a/api/app/lib/controllers/organization/department.js b/api/app/lib/controllers/organization/department.js index a1824f5f..640a80b7 100644 --- a/api/app/lib/controllers/organization/department.js +++ b/api/app/lib/controllers/organization/department.js @@ -121,6 +121,18 @@ async function delDep (ctx) { getDep(d.dataValues) } + const undeleteUserCount = await models.User.count({ + where: { + departmentId: { + $in: depIds + }, + delete: false + } + }) + if (undeleteUserCount) { + throw '该部门下有用户,不能删除' + } + await models.Department.update({ delete: true, }, { @@ -144,7 +156,9 @@ async function delDep (ctx) { await transaction.rollback(); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; - ctx.body = {} + ctx.body = { + message: typeof error == 'string' ? error : undefined + } } } diff --git a/api/app/lib/routes/data/index.js b/api/app/lib/routes/data/index.js index e944a323..a711792d 100644 --- a/api/app/lib/routes/data/index.js +++ b/api/app/lib/routes/data/index.js @@ -45,7 +45,7 @@ module.exports = function (app, router, opts) { router.post('/road/import', road.importIn); app.fs.api.logAttr['GET/road'] = { content: '获取道路数据', visible: true }; - router.post('/road', road.get); + router.get('/road', road.get); app.fs.api.logAttr['put/road'] = { content: '编辑道路数据', visible: true }; router.put('/road', road.edit); diff --git a/api/log/development.log b/api/log/development.log index a260f189..c37ac24e 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -7155,3 +7155,6 @@ 2022-07-22 15:22:09.565 - info: [FS-AUTH] Inject auth and api mv into router. 2022-07-22 15:22:12.241 - error: path: /overspeed, error: ReferenceError: startTime is not defined 2022-07-22 15:22:51.819 - error: path: /overspeed, error: ReferenceError: startTime is not defined +2022-07-22 15:58:39.491 - debug: [FS-LOGGER] Init. +2022-07-22 15:58:39.611 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2022-07-22 15:58:39.611 - info: [FS-AUTH] Inject auth and api mv into router. diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/data/公交/运营线路/(四公司)南昌公交运营线路基础信息表2022年6月(总表).xlsx b/scripts/0.0.1/data/工具脚本(无需执行)/data/公交/运营线路/(四公司)南昌公交运营线路基础信息表2022年6月(总表).xlsx new file mode 100644 index 00000000..27580a47 Binary files /dev/null and b/scripts/0.0.1/data/工具脚本(无需执行)/data/公交/运营线路/(四公司)南昌公交运营线路基础信息表2022年6月(总表).xlsx differ diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js b/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js index 694a05a2..8e017ba2 100644 --- a/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js +++ b/scripts/0.0.1/data/工具脚本(无需执行)/dataIn.js @@ -122,6 +122,11 @@ try { // n: '治超', // tableName: 'overspeed', // }, + { + path: ['./data/公交/运营线路/(四公司)南昌公交运营线路基础信息表2022年6月(总表).xlsx'], + n: '公交线路', + tableName: 'bus_line', + }, ] for (let f of fileList) { diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/index.js b/scripts/0.0.1/data/工具脚本(无需执行)/index.js index 4dbe029a..7964db7b 100644 --- a/scripts/0.0.1/data/工具脚本(无需执行)/index.js +++ b/scripts/0.0.1/data/工具脚本(无需执行)/index.js @@ -43,6 +43,7 @@ try { let upperCaseRslt = rslt[0].dst .replace(/\//g, ' ') .replace(/'/g, '') + .replace(/:/g,'') .trim() .replace(/\s{2,}/g, '') .replace(/-/g, ' '); @@ -91,6 +92,11 @@ try { // n: '治超', // tableName: 'overspeed' // }, + { + path: './data/公交/运营线路/(四公司)南昌公交运营线路基础信息表2022年6月(总表).xlsx', + n: '公交线路', + tableName: 'bus_line' + }, ] for (let f of fileList) { diff --git a/scripts/0.0.1/data/工具脚本(无需执行)/公交线路_字段对应.json b/scripts/0.0.1/data/工具脚本(无需执行)/公交线路_字段对应.json new file mode 100644 index 00000000..c0eb487b --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/公交线路_字段对应.json @@ -0,0 +1,25 @@ +{ + "公司": "company", + "车队": "fleet", + "车队长": "carCaptain", + "副车队长": "assistantCarCaptain", + "办公地点": "officeLocation", + "线路名称": "lineName", + "线路类型": "lineType", + "线路划分": "lineDivision", + "GPS编号": "gPSNumber", + "起点终点": "startingPointEndPoint", + "车辆数": "numberOfVehicles", + "全程公里数": "totalKilometers", + "票价": "ticketPrice", + "开通时间": "openingTime", + "运行时间": "runningTime", + "开班时间夏令": "openingTimeSummer", + "收班时间夏令": "shiftClosingTimeSummer", + "开班时间冬令": "openingTimeWinter", + "收班时间冬令": "shiftClosingTimeWinter", + "沿途站点上行": "uplinkOfStationsAlongTheWay", + "沿途站点下行": "downlinkOfStationsAlongTheWay", + "所属区域": "area", + "备注": "remarks" +} \ 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..fd7a425d --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/公交线路_数据字段对应.json @@ -0,0 +1,25 @@ +{ + "company": "公司", + "fleet": "车队", + "carCaptain": "车队长", + "assistantCarCaptain": "副车队长", + "officeLocation": "办公地点", + "lineName": "线路名称", + "lineType": "线路类型", + "lineDivision": "线路划分", + "gPSNumber": "GPS编号", + "startingPointEndPoint": "起点终点", + "numberOfVehicles": "车辆数", + "totalKilometers": "全程公里数", + "ticketPrice": "票价", + "openingTime": "开通时间", + "runningTime": "运行时间", + "openingTimeSummer": "开班时间夏令", + "shiftClosingTimeSummer": "收班时间夏令", + "openingTimeWinter": "开班时间冬令", + "shiftClosingTimeWinter": "收班时间冬令", + "uplinkOfStationsAlongTheWay": "沿途站点上行", + "downlinkOfStationsAlongTheWay": "沿途站点下行", + "area": "所属区域", + "remarks": "备注" +} \ 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..113970b6 --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/公交线路_数据库表对应.json @@ -0,0 +1,25 @@ +{ + "公司": "company", + "车队": "fleet", + "车队长": "car_Captain", + "副车队长": "assistant_car_Captain", + "办公地点": "office_location", + "线路名称": "line_name", + "线路类型": "line_type", + "线路划分": "line_division", + "GPS编号": "gPS_number", + "起点终点": "starting_point_end_point", + "车辆数": "number_of_vehicles", + "全程公里数": "total_kilometers", + "票价": "ticket_Price", + "开通时间": "opening_time", + "运行时间": "running_time", + "开班时间夏令": "opening_time_summer", + "收班时间夏令": "shift_closing_time_summer", + "开班时间冬令": "opening_time_Winter", + "收班时间冬令": "shift_closing_time_winter", + "沿途站点上行": "uplink_of_stations_along_the_way", + "沿途站点下行": "downlink_of_stations_along_the_way", + "所属区域": "area", + "备注": "remarks" +} \ 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..f9fd6e7c --- /dev/null +++ b/scripts/0.0.1/data/工具脚本(无需执行)/公交线路_数据脚本对应.sql @@ -0,0 +1,29 @@ +-- 公交线路 + +CREATE TABLE if not exists "bus_line" ( id serial not null ); + +CREATE unique index if not exists bus_line_id_uindex +ON bus_line (id); alter TABLE bus_line add constraint bus_line_pk primary key (id); alter TABLE bus_line add Company varchar(1024); comment +ON column bus_line.Company is '公司'; alter TABLE bus_line add Fleet varchar(1024); comment +ON column bus_line.Fleet is '车队'; alter TABLE bus_line add Car_Captain varchar(1024); comment +ON column bus_line.Car_Captain is '车队长'; alter TABLE bus_line add Assistant_Car_Captain varchar(1024); comment +ON column bus_line.Assistant_Car_Captain is '副车队长'; alter TABLE bus_line add Office_Location varchar(1024); comment +ON column bus_line.Office_Location is '办公地点'; alter TABLE bus_line add Line_Name varchar(1024); comment +ON column bus_line.Line_Name is '线路名称'; alter TABLE bus_line add Line_Type varchar(1024); comment +ON column bus_line.Line_Type is '线路类型'; alter TABLE bus_line add Line_Division varchar(1024); comment +ON column bus_line.Line_Division is '线路划分'; alter TABLE bus_line add GPS_Number varchar(1024); comment +ON column bus_line.GPS_Number is 'GPS编号'; alter TABLE bus_line add Starting_Point_End_Point varchar(1024); comment +ON column bus_line.Starting_Point_End_Point is '起点终点'; alter TABLE bus_line add Number_Of_Vehicles varchar(1024); comment +ON column bus_line.Number_Of_Vehicles is '车辆数'; alter TABLE bus_line add Total_Kilometers varchar(1024); comment +ON column bus_line.Total_Kilometers is '全程公里数'; alter TABLE bus_line add Ticket_Price varchar(1024); comment +ON column bus_line.Ticket_Price is '票价'; alter TABLE bus_line add Opening_Time varchar(1024); comment +ON column bus_line.Opening_Time is '开通时间'; alter TABLE bus_line add Running_Time varchar(1024); comment +ON column bus_line.Running_Time is '运行时间'; alter TABLE bus_line add Opening_Time_Summer varchar(1024); comment +ON column bus_line.Opening_Time_Summer is '开班时间夏令'; alter TABLE bus_line add Shift_Closing_Time_Summer varchar(1024); comment +ON column bus_line.Shift_Closing_Time_Summer is '收班时间夏令'; alter TABLE bus_line add Opening_Time_Winter varchar(1024); comment +ON column bus_line.Opening_Time_Winter is '开班时间冬令'; alter TABLE bus_line add Shift_Closing_Time_Winter varchar(1024); comment +ON column bus_line.Shift_Closing_Time_Winter is '收班时间冬令'; alter TABLE bus_line add Uplink_Of_Stations_Along_The_Way varchar(1024); comment +ON column bus_line.Uplink_Of_Stations_Along_The_Way is '沿途站点上行'; alter TABLE bus_line add Downlink_Of_Stations_Along_The_Way varchar(1024); comment +ON column bus_line.Downlink_Of_Stations_Along_The_Way is '沿途站点下行'; alter TABLE bus_line add Area varchar(1024); comment +ON column bus_line.Area is '所属区域'; alter TABLE bus_line add Remarks varchar(1024); comment +ON column bus_line.Remarks is '备注'; \ No newline at end of file