修改养殖端小程序,保险前后端和小程序

This commit is contained in:
xuqiuyun
2025-09-19 18:13:07 +08:00
parent eb3c4604d3
commit 35db747d4f
89 changed files with 16231 additions and 1500 deletions

View File

@@ -0,0 +1,163 @@
const express = require('express');
const router = express.Router();
const dataWarehouseController = require('../controllers/dataWarehouseController');
const { jwtAuth, checkPermission } = require('../middleware/auth');
/**
* @swagger
* tags:
* name: DataWarehouse
* description: 数据览仓相关接口
*/
/**
* @swagger
* /api/data-warehouse/overview:
* get:
* summary: 获取数据览仓概览数据
* tags: [DataWarehouse]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: 成功获取概览数据
* content:
* application/json:
* schema:
* type: object
* properties:
* code: { type: 'number' }
* status: { type: 'string' }
* data: { type: 'object' }
* message: { type: 'string' }
* timestamp: { type: 'string' }
* 401:
* description: 未授权
* 500:
* description: 服务器内部错误
*/
router.get('/overview', jwtAuth, checkPermission('data', 'read'),
dataWarehouseController.getOverview
);
/**
* @swagger
* /api/data-warehouse/insurance-type-distribution:
* get:
* summary: 获取保险类型分布数据
* tags: [DataWarehouse]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: 成功获取保险类型分布数据
* content:
* application/json:
* schema:
* type: object
* properties:
* code: { type: 'number' }
* status: { type: 'string' }
* data: { type: 'array' }
* message: { type: 'string' }
* timestamp: { type: 'string' }
* 401:
* description: 未授权
* 500:
* description: 服务器内部错误
*/
router.get('/insurance-type-distribution', jwtAuth, checkPermission('data', 'read'),
dataWarehouseController.getInsuranceTypeDistribution
);
/**
* @swagger
* /api/data-warehouse/application-status-distribution:
* get:
* summary: 获取申请状态分布数据
* tags: [DataWarehouse]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: 成功获取申请状态分布数据
* content:
* application/json:
* schema:
* type: object
* properties:
* code: { type: 'number' }
* status: { type: 'string' }
* data: { type: 'array' }
* message: { type: 'string' }
* timestamp: { type: 'string' }
* 401:
* description: 未授权
* 500:
* description: 服务器内部错误
*/
router.get('/application-status-distribution', jwtAuth, checkPermission('data', 'read'),
dataWarehouseController.getApplicationStatusDistribution
);
/**
* @swagger
* /api/data-warehouse/trend-data:
* get:
* summary: 获取近7天趋势数据
* tags: [DataWarehouse]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: 成功获取趋势数据
* content:
* application/json:
* schema:
* type: object
* properties:
* code: { type: 'number' }
* status: { type: 'string' }
* data: { type: 'array' }
* message: { type: 'string' }
* timestamp: { type: 'string' }
* 401:
* description: 未授权
* 500:
* description: 服务器内部错误
*/
router.get('/trend-data', jwtAuth, checkPermission('data', 'read'),
dataWarehouseController.getTrendData
);
/**
* @swagger
* /api/data-warehouse/claim-stats:
* get:
* summary: 获取赔付统计数据
* tags: [DataWarehouse]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: 成功获取赔付统计数据
* content:
* application/json:
* schema:
* type: object
* properties:
* code: { type: 'number' }
* status: { type: 'string' }
* data: { type: 'array' }
* message: { type: 'string' }
* timestamp: { type: 'string' }
* 401:
* description: 未授权
* 500:
* description: 服务器内部错误
*/
router.get('/claim-stats', jwtAuth, checkPermission('data', 'read'),
dataWarehouseController.getClaimStats
);
module.exports = router;

View File

@@ -0,0 +1,119 @@
const express = require('express');
const router = express.Router();
const menuController = require('../controllers/menuController');
const { jwtAuth } = require('../middleware/auth');
/**
* @swagger
* tags:
* name: Menus
* description: 菜单管理相关接口
*/
/**
* @swagger
* /api/menus/public:
* get:
* summary: 获取公开菜单列表(无需认证)
* tags: [Menus]
* responses:
* 200:
* description: 成功获取菜单列表
* content:
* application/json:
* schema:
* type: object
* properties:
* code:
* type: integer
* example: 200
* status:
* type: string
* example: success
* data:
* type: array
* items:
* $ref: '#/components/schemas/Menu'
* message:
* type: string
* example: 获取菜单成功
* 500:
* description: 服务器内部错误
*/
router.get('/public', menuController.getMenus);
/**
* @swagger
* /api/menus:
* get:
* summary: 获取当前用户的菜单列表
* tags: [Menus]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: 成功获取菜单列表
* content:
* application/json:
* schema:
* type: object
* properties:
* code:
* type: integer
* example: 200
* status:
* type: string
* example: success
* data:
* type: array
* items:
* $ref: '#/components/schemas/Menu'
* message:
* type: string
* example: 获取菜单成功
* 401:
* description: 未授权
* 500:
* description: 服务器内部错误
*/
router.get('/', jwtAuth, menuController.getMenus);
/**
* @swagger
* /api/menus/all:
* get:
* summary: 获取所有菜单(包括非激活状态,仅管理员可用)
* tags: [Menus]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: 成功获取所有菜单
* content:
* application/json:
* schema:
* type: object
* properties:
* code:
* type: integer
* example: 200
* status:
* type: string
* example: success
* data:
* type: array
* items:
* $ref: '#/components/schemas/Menu'
* message:
* type: string
* example: 获取所有菜单成功
* 401:
* description: 未授权
* 403:
* description: 没有权限
* 500:
* description: 服务器内部错误
*/
router.get('/all', jwtAuth, menuController.getAllMenus);
module.exports = router;