Commit 267fd9a5 by Leo Zheng

changed file structure and started implementing map 2

parent 12e6427b
# 寿州古城数据接口
[中文](#中文) [English](#english)
# 中文
## 端点:`/szgc/getdata`
## 参数:
- `content`:
- 左侧API:
- sightVisitorFlowByDay
- gateStatus
- sightVisitorFlowPerHour
- guchengLoad
- totalVisitorFlow
- totalVisitorFlowByDay
- 中间API:
- currentEventStrategy
- totalEventCount
- allEvents
- 右侧API:
- getEventCountByYear
- getEventTimeDistribution
- getEventMonthDistribution
- getEventCategoryCount
- getEventSubCategoryCount
- getEventSourceCount
- getGridEventCount
- getEventProcessingTime
- `date`: 要检索数据的日期。例子: `2023-05-03`
- `sight`: 景点名称。例子: `八公山森林公园`
- `year`:要检索数据的年份。例子:`2023`
## 运行服务器
1. 克隆仓库
2. 在根目录运行:```npm install```
3. 在VSCode编译器里按F5开始运行服务器
## 测试
在根目录运行```npm test```
## 错误代码:
- 501:数据Excel文件不在指定位置
- 502:数据Excel文件找不到需要的表格
- 503:请求内缺少日期参数
- 504:请求内缺少日期或者景点参数
- 505:不支持该请求
- 506:请求内缺少年份参数
- 500:未知错误
# English
## Endpoint: /szgc/getdata
## parameters:
- `content`:
- Left Side API:
- sightVisitorFlowByDay
- gateStatus
- sightVisitorFlowPerHour
- guchengLoad
- totalVisitorFlow
- totalVisitorFlowByDay
- Middle API:
- currentEventStrategy
- totalEventCount
- allEvents
- Right Side API:
- getEventCountByYear
- getEventTimeDistribution
- getEventMonthDistribution
- getEventCategoryCount
- getEventSubCategoryCount
- getEventSourceCount
- getGridEventCount
- getEventProcessingTime
- `date`: The date you are searching. E.g. `2023-05-03`
- `sight`: The name of the sight. E.g. `八公山森林公园`
- `year`:The year you are searching. E.g. `2023`
## Example Request:
- Left Side:
```http://localhost:30016/getdata?content=sightVisitorFlowByDay&date=2023-05-03&sight=八公山森林公园```
- Middle: ```http://localhost:30016/getdata?content=currentEventStrategy&date=2023-05-03```
- Right Side: ```http://localhost:30016/getdata?content=getEventCategoryCount&year=2024```
## How to Run:
1. Clone the Repository (```git clone http://123.207.147.179:8888/chenjinjing/shouzhouServer.git```)
2. In the root directory, run ```npm install```
3. Using VScode IDE, press F5 to start the server.
## Testing
Run ```npm test``` in the root directory
## Error Code:
- 501: The Excel file storing the data is missing
- 502: The Excel sheet doesn't exist in the Excel file (Excel file is corrupted)
- 503: The request is missing parameter date
- 504: The request is missing parameter date and sight
- 505: Unsupported request
- 506: The request is missing parameter year
- 500: Unknown error
\ No newline at end of file
......@@ -3,7 +3,7 @@
* 该文件定义了策略工厂类,用于创建各种数据策略。
*/
import { dataStrategy } from "./dataStrategy";
import { dataStrategy } from "../../dataStrategy";
// 导入具体策略类
import { sightVisitorFlowByDayStrategy } from "./left/sightVisitorFlowByDayStrategy";
......
import * as asyncHandler from 'express-async-handler';
import * as szgcBiz from '../biz/getData';
import * as szgcBiz from '../../biz/getData';
export function setLeftRoutes(httpServer) {
httpServer.get('/szgc/getdata/sightVisitorFlowByDay', asyncHandler((req, res) => szgcBiz.getData(req, res, 'sightVisitorFlowByDay')));
......
import * as asyncHandler from 'express-async-handler';
import * as szgcBiz from '../../biz/getData';
export function setLeftRoutes(httpServer) {
httpServer.get('/szgc/getdata/sightVisitorFlowByDay', asyncHandler((req, res) => szgcBiz.getData(req, res, 'sightVisitorFlowByDay')));
httpServer.get('/szgc/getdata/gateStatus', asyncHandler((req, res) => szgcBiz.getData(req, res, 'gateStatus')));
httpServer.get('/szgc/getdata/sightVisitorFlowPerHour', asyncHandler((req, res) => szgcBiz.getData(req, res, 'sightVisitorFlowPerHour')));
httpServer.get('/szgc/getdata/guchengLoad', asyncHandler((req, res) => szgcBiz.getData(req, res, 'guchengLoad')));
httpServer.get('/szgc/getdata/totalVisitorFlow', asyncHandler((req, res) => szgcBiz.getData(req, res, 'totalVisitorFlow')));
httpServer.get('/szgc/getdata/totalVisitorFlowByDay', asyncHandler((req, res) => szgcBiz.getData(req, res, 'totalVisitorFlowByHour')));
}
\ No newline at end of file
import * as asyncHandler from 'express-async-handler';
import * as szgcBiz from '../../biz/getData';
export function setMiddleRoutes(httpServer) {
httpServer.get('/szgc/getdata/getCurrentEventCount', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getCurrentEventCount')));
httpServer.get('/szgc/getdata/totalEventCount', asyncHandler((req, res) => szgcBiz.getData(req, res, 'totalEventCount')));
httpServer.get('/szgc/getdata/allEvents', asyncHandler((req, res) => szgcBiz.getData(req, res, 'allEvents')));
}
import * as asyncHandler from 'express-async-handler';
import * as szgcBiz from '../../biz/getData';
export function setRightRoutes(httpServer) {
httpServer.get('/szgc/getdata/getEventCountByYear', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getEventCountByYear')));
httpServer.get('/szgc/getdata/getEventTimeDistribution', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getEventTimeDistribution')));
httpServer.get('/szgc/getdata/getEventMonthDistribution', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getEventMonthDistribution')));
httpServer.get('/szgc/getdata/getEventCategoryCount', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getEventCategoryCount')));
httpServer.get('/szgc/getdata/getEventSubCategoryCount', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getEventSubCategoryCount')));
httpServer.get('/szgc/getdata/getEventSourceCount', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getEventSourceCount')));
httpServer.get('/szgc/getdata/getGridEventCount', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getGridEventCount')));
httpServer.get('/szgc/getdata/getEventProcessingTime', asyncHandler((req, res) => szgcBiz.getData(req, res, 'getEventProcessingTime')));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment