Эх сурвалжийг харах

api文档,设备接口,信心管理表增加字段

zhangnaiwen 2 жил өмнө
parent
commit
7d5f736975

+ 1149 - 0
doc/api.md

@@ -0,0 +1,1149 @@
+# operation_management_center
+[toc]
+## 1	环境变量
+
+### 默认环境1
+| 参数名 | 字段值 |
+| ------ | ------ |
+
+
+
+## 2	operation_management_center
+
+##### 说明
+> 
+
+
+
+##### 联系方式
+- **联系人:**
+- **邮箱:**
+- **网址:**//
+
+##### 文档版本
+```
+v1.0
+```
+
+
+## 3	role
+
+## 3.1	获取角色成员
+
+> GET  /role/member
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|role_id||角色id|
+### 响应体
+● 200 响应数据格式:JSON
+
+
+
+##### 接口描述
+> 获取角色成员
+
+
+
+
+## 3.2	批量移除角色成员
+
+> DELETE  /role/member
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| users_id|string||false|用户ids。例:[1,2,3]|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 批量移除角色成员
+
+
+
+
+## 3.3	移除角色成员
+
+> PUT  /role/member
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| user_id|int32||false|用户id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 移除角色成员
+
+
+
+
+## 3.4	获取角色
+
+> GET  /role/role
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|role_id||角色id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取角色
+
+
+
+
+## 3.5	添加角色
+
+> POST  /role/role
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| role_name|string||true|角色名称|
+| role_describe|string||false|角色描述|
+| role_permission|string||false|角色权限|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加角色
+
+
+
+
+## 3.6	删除角色
+
+> DELETE  /role/role
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| role_id|int32||false|角色id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 删除角色
+
+
+
+
+## 3.7	修改角色
+
+> PUT  /role/role
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| role_id|int32||false|角色id|
+| role_name|string||false|角色名称|
+| role_describe|string||false|角色描述|
+| role_permission|string||false|角色权限|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改角色
+
+
+
+
+## 3.8	获取角色列表
+
+> GET  /role/role_list
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|page_size||每页记录数量,默认:20|
+|page||页数|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取角色列表
+
+
+
+
+## 4	data
+
+## 4.1	批量删除模版
+
+> DELETE  /data/batch_delete_template
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| template_ids|string||true|模版id列表。例:[1,2,3]|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 批量删除模版
+
+
+
+
+## 4.2	获取楼宇信息
+
+> GET  /data/building
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|building_id||楼宇id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取楼宇列表
+
+
+
+
+## 4.3	添加楼宇
+
+> POST  /data/building
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| building_name|string||false|楼宇名|
+| building_area|string||false|楼宇面积|
+| building_floor|string||false|建筑楼层|
+| trem|string||false|建筑年限|
+| date|string||false|建成日期|
+| contact_person|string||false|联系人|
+| contact_information|string||false|联系人方式|
+| building_introduction|string||false|楼宇简介|
+| picture|string||false|楼宇图片|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 增加楼宇
+
+
+
+
+## 4.4	删除楼宇
+
+> DELETE  /data/building
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| building_id|int32||false|楼宇id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 删除楼宇
+
+
+
+
+## 4.5	修改楼宇
+
+> PUT  /data/building
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| building_id|int32||false|楼宇id|
+| building_name|string||false|楼宇名|
+| building_area|string||false|楼宇面积|
+| building_floor|string||false|建筑楼层|
+| trem|string||false|建筑年限|
+| date|string||false|建成日期|
+| contact_person|string||false|联系人|
+| contact_information|string||false|联系人方式|
+| building_introduction|string||false|楼宇简介|
+| picture|string||false|楼宇图片|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改楼宇
+
+
+
+
+## 4.6	获取楼宇列表
+
+> GET  /data/building_list
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取楼宇列表
+
+
+
+
+## 4.7	获取公司基本信息
+
+> GET  /data/company
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|company_id||公司id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取公司信息
+
+
+
+
+## 4.8	添加公司基本信息
+
+> POST  /data/company
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| management_unit|string||false|管理单位|
+| custodian_unit|string||false|托管单位|
+| introduction|string||false|楼宇简介|
+| contact_person|string||false|联系人|
+| contact_information|string||false|联系人方式|
+| picture|string||false|公司图片|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加公司信息
+
+
+
+
+## 4.9	修改公司基本信息
+
+> PUT  /data/company
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| company_id|int32||false|公司id|
+| management_unit|string||false|管理单位|
+| custodian_unit|string||false|托管单位|
+| introduction|string||false|楼宇简介|
+| contact_person|string||false|联系人|
+| contact_information|string||false|联系人方式|
+| picture|string||false|公司图片|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改公司信息
+
+
+
+
+## 4.10	获取模版详情
+
+> GET  /data/template
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|template_id||模版id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取模版详情
+
+
+
+
+## 4.11	添加模版
+
+> POST  /data/template
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| template_name|string||false|模版名称|
+| template_format|string||false|模版格式|
+| report_type|string||false|报告类型|
+| introduction|string||false|模版简介|
+| template_file|string||false|模版文件|
+| template_type|int32||false|模版类型 0:报表,1:报告|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加报表模版
+
+
+
+
+## 4.12	删除模版
+
+> DELETE  /data/template
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| template_id|int32||false|模版id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 删除模版
+
+
+
+
+## 4.13	修改模版
+
+> PUT  /data/template
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| template_id|int32||false|模版id|
+| template_name|string||false|模版名称|
+| template_format|string||false|模版格式|
+| report_type|string||false|报告类型|
+| introduction|string||false|模版简介|
+| template_file|string||false|模版文件|
+| template_type|int32||false|模版类型 0:报表,1:报告|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改模版信息
+
+
+
+
+## 4.14	获取模版列表
+
+> GET  /data/template_list
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|page_size||每页记录数量,默认:20|
+|page||第几页|
+|template_name||模版名称|
+|template_format||模版格式|
+|template_type||模版类型 0:报表,1:报告|
+|report_type||报告类型|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 模版列表
+
+
+
+
+## 4.15	获取底层系统
+
+> GET  /data/underlying_system
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取底层系统
+
+
+
+
+## 4.16	添加底层系统信息
+
+> POST  /data/underlying_system
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| picture|string||false|楼宇图片|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加底层系统
+
+
+
+
+## 5	log
+
+## 5.1	日志导出
+
+> GET  /log/log_export
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 日志导出
+
+
+
+
+## 5.2	获取日志列表
+
+> GET  /log/log_list
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|page_size||每页记录数量,默认:20|
+|page||第几页|
+|module||系统模块|
+|name||操作人员|
+|operation_type||操作类型|
+|operation_status||操作状态|
+|start_time||开始时间|
+|end_time||结束时间|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 日志列表
+
+
+
+
+## 6	organization
+
+## 6.1	批量删除公司
+
+> DELETE  /organization/batch_delete_company
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| company_ids|string||false|公司ids。例:[1,2,3]|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 批量删除公司
+
+
+
+
+## 6.2	获取公司详情
+
+> GET  /organization/company
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|company_id||公司id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取公司详情
+
+
+
+
+## 6.3	添加公司
+
+> POST  /organization/company
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| company_name|string||true|公司名|
+| logo|string||false|商标|
+| abbreviation|string||false|公司简称|
+| code|string||false|统一社会信用代码|
+| registered_address|string||false|注册地址|
+| business_address|string||false|经营地址|
+| legal_person_name|string||false|法人姓名|
+| company_code|string||false|公司编码|
+| staff_size|string||false|编制人数|
+| on_guard_size|string||false|在岗人数|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加公司
+
+
+
+
+## 6.4	删除公司
+
+> DELETE  /organization/company
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| company_id|int32||True|公司id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 删除公司
+
+
+
+
+## 6.5	更新公司详情
+
+> PUT  /organization/company
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| company_id|int32||false|公司id|
+| company_name|string||true|公司名|
+| logo|string||false|商标|
+| abbreviation|string||false|公司简称|
+| code|string||false|统一社会信用代码|
+| registered_address|string||false|注册地址|
+| business_address|string||false|经营地址|
+| legal_person_name|string||false|法人姓名|
+| company_code|string||false|公司编码|
+| staff_size|string||false|编制人数|
+| on_guard_size|string||false|在岗人数|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改公司详情
+
+
+
+
+## 6.6	获取公司列表
+
+> GET  /organization/company_list
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|page_size||每页记录数量,默认:20|
+|page||页数|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取公司列表
+
+
+
+
+## 6.7	获取部门详情
+
+> GET  /organization/department
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|department_id||部门id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取部门详情
+
+
+
+
+## 6.8	添加部门
+
+> POST  /organization/department
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| company_id|string||false|上级公司|
+| department_name|string||false|部门名|
+| principal|string||false|负责人|
+| liaison_officer|string||false|接口人|
+| duplicate_name|string||false|拍重名|
+| on_guard|string||false|在岗人数|
+| freelance_staff|string||false|自由员工|
+| cooperation_staff|string||false|协作员工|
+| thirdparty_staff|string||false|第三方员工|
+| censure|string||false|职责|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加部门
+
+
+
+
+## 6.9	删除部门
+
+> DELETE  /organization/department
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| department_id|string||false|部门id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 删除部门
+
+
+
+
+## 6.10	更新部门详情
+
+> PUT  /organization/department
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| department_id|string||false|部门id|
+| company_id|string||false|上级公司|
+| department_name|string||false|部门名|
+| principal|string||false|负责人|
+| liaison_officer|string||false|接口人|
+| duplicate_name|string||false|拍重名|
+| on_guard|string||false|在岗人数|
+| freelance_staff|string||false|自由员工|
+| cooperation_staff|string||false|协作员工|
+| thirdparty_staff|string||false|第三方员工|
+| censure|string||false|职责|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改部门详情
+
+
+
+
+## 6.11	获取公司下部门列表
+
+> GET  /organization/department_list
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|company_id||公司id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取公司下部门列表
+
+
+
+
+## 7	permission
+
+## 7.1	权限认证
+
+> GET  /permission/auth_permission
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|path||请求url|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 权限认证
+
+
+
+
+## 7.2	获取权限信息
+
+> GET  /permission/permission
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取权限配置信息
+
+
+
+
+## 8	information
+
+## 8.1	获取楼层地图信息配置
+
+> GET  /information/floor_configuration
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|id||配置id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取楼层地图信息配置
+
+
+
+
+## 8.2	添加楼层地图信息配置
+
+> POST  /information/floor_configuration
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| name|string||false|配置名称|
+| location|string||false|楼层位置|
+| use|string||false|楼层用途|
+| remark|string||false|备注|
+| attachment|string||false|附件|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加楼层地图信息配置
+
+
+
+
+## 8.3	删除楼层地图信息配置
+
+> DELETE  /information/floor_configuration
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| id|string||false|配置id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 删除楼层地图信息配置
+
+
+
+
+## 8.4	修改楼层地图信息配置
+
+> PUT  /information/floor_configuration
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| id|string||false|配置id|
+| name|string||false|配置名称|
+| location|string||false|楼层位置|
+| use|string||false|楼层用途|
+| remark|string||false|备注|
+| attachment|string||false|附件|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改楼层地图信息配置
+
+
+
+
+## 8.5	获取信息列表
+
+> GET  /information/information_list
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 信息列表
+
+
+
+
+## 8.6	获取安保人员信息配置
+
+> GET  /information/staff_configuration
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|id||配置id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取安保人员信息配置
+
+
+
+
+## 8.7	添加安保人员信息配置
+
+> POST  /information/staff_configuration
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 
+
+
+
+
+## 8.8	删除安保人员信息配置
+
+> DELETE  /information/staff_configuration
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 
+
+
+
+
+## 8.9	修改安保人员信息配置
+
+> PUT  /information/staff_configuration
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 
+
+
+
+
+## 9	login
+
+## 9.1	登入
+
+> POST  /login
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| username|string||true|用户名|
+| password|string||true|密码|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 登入
+
+
+
+
+## 10	message
+
+## 10.1	获取消息详情
+
+> GET  /message/message
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|message_id||消息id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取消息详情
+
+
+
+
+## 10.2	新增消息
+
+> POST  /message/message
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| name|string||false|消息名称|
+| pipeline|string||false|通道配置|
+| staff|string||false|人员配置: all role:角色id company:公司id |
+| send_time|string||false|发送时间 immediately, 2020-10-20 10:10:10|
+| title|string||false|标题|
+| content|string||false|内容|
+| style|string||false|样式|
+| type|string||false|消息类型|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 新增消息
+
+
+
+
+## 10.3	修改消息
+
+> PUT  /message/message
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| message_id|string||false|消息id|
+| name|string||false|消息名称|
+| pipeline|string||false|通道配置|
+| staff|string||false|人员配置: all role: company: |
+| send_time|string||false|发送时间 immediately 2020-10-20 10:10:10|
+| title|string||false|标题|
+| content|string||false|内容|
+| style|string||false|样式|
+| type|string||false|消息类型|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改消息
+
+
+
+
+## 10.4	获取消息列表
+
+> GET  /message/message_list
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 消息列表
+
+
+
+
+## 11	users
+
+## 11.1	批量删除用户
+
+> DELETE  /users/batch_delete_user
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| users_id|string||true|用户id列表。例:[1,2,3]|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 批量删除用户
+
+
+
+
+## 11.2	批量修改用户状态,激活、禁用
+
+> PUT  /users/batch_modify_user_status
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| users_id|string||true|用户id列表。例:[1,2,3]|
+| status|int32||true|用户状态 0为正常,1为禁用|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 批量修改用户状态,激活、禁用
+
+
+
+
+## 11.3	导出用户数据
+
+> GET  /users/export_data
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 导出用户数据
+
+
+
+
+## 11.4	获取用户详情
+
+> GET  /users/user
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|id||用户id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取用户详情
+
+
+
+
+## 11.5	添加用户
+
+> POST  /users/user
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| username|string||true|用户名|
+| password|string||true|密码|
+| photograph|string||false|照片|
+| name|string||false|姓名|
+| phone|string||false|电话|
+| email|string||false|邮箱|
+| company|string||false|公司|
+| department|string||false|部门|
+| role|string||false|角色|
+| permission|string||false|权限|
+| on_job_status|string||false|在职状态|
+| duty|string||false|职务|
+| nationality|string||false|国籍|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 添加用户
+
+
+
+
+## 11.6	删除用户
+
+> DELETE  /users/user
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| id|string||false|用户id|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 删除用户
+
+
+
+
+## 11.7	更新用户详情
+
+> PUT  /users/user
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| id|string||false|用户id|
+| username|string||true|用户名|
+| password|string||true|密码|
+| photograph|string||false|照片|
+| name|string||false|姓名|
+| phone|string||false|电话|
+| email|string||false|邮箱|
+| company|string||false|公司|
+| department|string||false|部门|
+| role|string||false|角色|
+| permission|string||false|权限|
+| on_job_status|string||false|在职状态|
+| duty|string||false|职务|
+| nationality|string||false|国籍|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 更新用户详情
+
+
+
+
+## 11.8	获取用户列表
+
+> GET  /users/user_list
+### 请求参数(Query Param)
+| 参数名称 | 默认值 | 描述 |
+| ------ | ------ | ------ |
+|status||用户状态|
+|page_size||每页记录数量|
+|page||第几页|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 获取用户列表
+
+
+
+
+## 11.9	修改用户状态,激活、禁用
+
+> PUT  /users/user_status
+### 请求体(Request Body)
+| 参数名称 | 数据类型 | 默认值 | 不为空 | 描述 |
+| ------ | ------ | ------ | ------ | ------ |
+| id|int32||true|用户id|
+| status|int32||true|用户状态|
+### 响应体
+● 200 响应数据格式:JSON
+
+##### 接口描述
+> 修改用户状态,激活、禁用
+
+
+

+ 4 - 0
src/app/api/__init__.py

@@ -8,6 +8,8 @@ from app.api.data import ns as data
 from app.api.log import ns as log
 from app.api.log import ns as log
 from app.api.message import ns as message
 from app.api.message import ns as message
 from app.api.permission import ns as permission
 from app.api.permission import ns as permission
+from app.api.information import ns as information
+from app.api.device import ns as device
 
 
 api = Api(version='v1.0', title='operation_management_center', description='运营管理中心', doc='/api')
 api = Api(version='v1.0', title='operation_management_center', description='运营管理中心', doc='/api')
 
 
@@ -19,3 +21,5 @@ api.add_namespace(data)
 api.add_namespace(log)
 api.add_namespace(log)
 api.add_namespace(message)
 api.add_namespace(message)
 api.add_namespace(permission)
 api.add_namespace(permission)
+api.add_namespace(information)
+api.add_namespace(device)

+ 332 - 0
src/app/api/device.py

@@ -0,0 +1,332 @@
+import json
+
+from flask import request, jsonify, g, current_app
+from flask_restx import Resource, Namespace, reqparse
+from sqlalchemy import select, insert, update, delete, func
+from sqlalchemy.orm import Session
+
+from app.defines import StatesCode, Module, OperationType
+from app.modle.device import DeviceType, SecurityDevice
+from app.utils.jwt_util import login_required
+from app.utils.save_log import save_log
+from app.utils.util import to_dict
+from config import Config
+
+ns = Namespace('device', description='设备管理接口')
+
+config = Config()
+
+device_type = reqparse.RequestParser(bundle_errors=True)
+device_type.add_argument(name='id', type=str, location='form', required=True, help='设备类别id')
+device_type.add_argument(name='name', type=str, location='form', required=True, help='设备类别名称')
+
+
+@ns.route('/device_type')
+class DeviceTypeApi(Resource):
+    method_decorators = [login_required]
+
+    @ns.doc(id='device_list', description='设备类别列表')
+    def get(self):
+        """设备类型列表"""
+
+        try:
+            with Session(current_app.engine) as session:
+                stmt = select(DeviceType)
+                results = session.execute(stmt).scalars().all()
+
+            save_log(request, Module.DEVICE, OperationType.INQUIRE, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功', data=to_dict(results))
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.INQUIRE, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+    @ns.doc(id='add_device', description='添加设备类别')
+    @ns.expect(device_type)
+    def post(self):
+        """添加设备类型"""
+
+        device_name = request.form.get('name')
+
+        if device_name is None:
+            return jsonify(code=StatesCode.PARA_ERROR, message='设备类别不能为空')
+
+        try:
+            with Session(current_app.engine) as session:
+                stmt = insert(DeviceType).values(
+                    name=device_name
+                )
+                session.execute(stmt)
+                session.commit()
+
+            save_log(request, Module.DEVICE, OperationType.ADD, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功')
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.ADD, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+    @ns.doc(id='update_device', description='修改设备类别')
+    @ns.expect(device_type)
+    def put(self):
+        """修改设备类型"""
+
+        device_type_id = request.form.get('id')
+        device_name = request.form.get('name')
+
+        if device_type_id is None or device_name is None:
+            return jsonify(code=StatesCode.PARA_ERROR, message='设备类别或设备类别id不能为空')
+
+        try:
+            with Session(current_app.engine) as session:
+                stmt = update(DeviceType).where(DeviceType.id == device_type_id).values(
+                    name=device_name
+                )
+                session.execute(stmt)
+                session.commit()
+
+            save_log(request, Module.DEVICE, OperationType.UPDATE, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功')
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.UPDATE, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+
+device_list = reqparse.RequestParser(bundle_errors=True)
+device_list.add_argument(name='id', type=str, location='args', required=True, help='设备类别id')
+
+
+@ns.route('/device_list')
+class DeviceListApi(Resource):
+    method_decorators = [login_required]
+
+    @ns.doc(id='device_list', description='设备列表')
+    @ns.expect(device_list)
+    def get(self):
+        """获取设备列表"""
+
+        device_type_id = request.args.get('id')
+
+        if device_type_id is None:
+            return jsonify(code=StatesCode.PARA_ERROR, message='设备类别或设备类别id不能为空')
+
+        try:
+            with Session(current_app.engine) as session:
+                stmt = select(SecurityDevice).where(SecurityDevice.device_group == device_type_id)
+                results = session.execute(stmt).scalars().all()
+
+            save_log(request, Module.DEVICE, OperationType.INQUIRE, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功', data=to_dict(results))
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.INQUIRE, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+
+device = reqparse.RequestParser(bundle_errors=True)
+device.add_argument(name='id', type=str, location='args', required=True, help='设备id')
+
+device_details = reqparse.RequestParser(bundle_errors=True)
+device_details.add_argument(name='id', type=str, location='form', required=False, help='设备id')
+device_details.add_argument(name='device_name', type=str, location='form', required=False, help='设备名称')
+device_details.add_argument(name='device_id', type=str, location='form', required=False, help='设备id')
+device_details.add_argument(name='device_type', type=str, location='form', required=False, help='设备类型(1-摄像头)')
+device_details.add_argument(name='device_location', type=str, location='form', required=False, help='设备位置')
+device_details.add_argument(name='device_age', type=str, location='form', required=False, help='设备年限')
+device_details.add_argument(name='company_id', type=str, location='form', required=False, help='所属单位ID')
+device_details.add_argument(name='user_id', type=str, location='form', required=False, help='设备责任人')
+device_details.add_argument(name='device_group', type=str, location='form', required=False, help='设备分组')
+device_details.add_argument(name='status', type=str, location='form', required=False, help='设备状态(1-开启)')
+device_details.add_argument(name='floor_id', type=str, location='form', required=False, help='楼层id')
+device_details.add_argument(name='third_id', type=str, location='form', required=False, help='')
+
+
+@ns.route('/device')
+class DeviceApi(Resource):
+    method_decorators = [login_required]
+
+    @ns.doc(id='device', description='设备详情')
+    @ns.expect(device)
+    def get(self):
+        """获取设备详情"""
+
+        device_id = request.args.get('id')
+
+        if device_id is None:
+            return jsonify(code=StatesCode.PARA_ERROR, message='设备id不能为空')
+
+        try:
+            with Session(current_app.engine) as session:
+                stmt = select(SecurityDevice).where(SecurityDevice.id == device_id)
+                results = session.execute(stmt).scalars().all()
+
+            save_log(request, Module.DEVICE, OperationType.INQUIRE, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功', data=to_dict(results))
+        except Exception as e:
+            save_log(request, Module.DEVICE, OperationType.INQUIRE, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+    @ns.doc(id='add_device', description='添加设备详情')
+    @ns.expect(device_details)
+    def post(self):
+        """添加设备"""
+
+        device_name = request.form.get('device_name')
+        device_id = request.form.get('device_id')
+        device_type = request.form.get('device_type')
+        device_location = request.form.get('device_location')
+        device_age = request.form.get('device_age')
+        company_id = request.form.get('company_id')
+        user_id = request.form.get('user_id')
+        device_group = request.form.get('device_group')
+        status = request.form.get('status')
+        floor_id = request.form.get('floor_id')
+        third_id = request.form.get('third_id')
+
+        if device_name is None:
+            return jsonify(code=StatesCode.PARA_ERROR, message='设备名称不能为空')
+        try:
+            with Session(current_app.engine) as session:
+                stmt = insert(SecurityDevice).values(
+                    device_name=device_name,
+                    device_id=device_id,
+                    device_type=device_type,
+                    device_location=device_location,
+                    device_age=device_age,
+                    company_id=company_id,
+                    user_id=user_id,
+                    device_group=device_group,
+                    status=status,
+                    floor_id=floor_id,
+                    third_id=third_id
+                )
+                session.execute(stmt)
+                session.commit()
+
+            save_log(request, Module.DEVICE, OperationType.ADD, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功')
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.ADD, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+    @ns.doc(id='update_device', description='添加设备')
+    @ns.expect(device_details)
+    def put(self):
+        """修改设备"""
+
+        id = request.form.get('id')
+        device_name = request.form.get('device_name')
+        device_id = request.form.get('device_id')
+        device_type = request.form.get('device_type')
+        device_location = request.form.get('device_location')
+        device_age = request.form.get('device_age')
+        company_id = request.form.get('company_id')
+        user_id = request.form.get('user_id')
+        device_group = request.form.get('device_group')
+        status = request.form.get('status')
+        floor_id = request.form.get('floor_id')
+        third_id = request.form.get('third_id')
+
+        if device_name is None:
+            return jsonify(code=StatesCode.PARA_ERROR, message='设备名称不能为空')
+        try:
+            with Session(current_app.engine) as session:
+                stmt = update(SecurityDevice).where(SecurityDevice.id == id).values(
+                    device_name=device_name,
+                    device_id=device_id,
+                    device_type=device_type,
+                    device_location=device_location,
+                    device_age=device_age,
+                    company_id=company_id,
+                    user_id=user_id,
+                    device_group=device_group,
+                    status=status,
+                    floor_id=floor_id,
+                    third_id=third_id
+                )
+                session.execute(stmt)
+                session.commit()
+
+            save_log(request, Module.DEVICE, OperationType.UPDATE, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功')
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.UPDATE, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+    @ns.doc(id='delete_device', description='删除设备')
+    @ns.expect(device_details)
+    def delete(self):
+        """删除设备"""
+
+        id = request.form.get('id')
+
+        if id is None:
+            return jsonify(code=StatesCode.PARA_ERROR, message='设备id不能为空')
+
+        try:
+            with Session(current_app.engine) as session:
+                stmt = delete(SecurityDevice).where(SecurityDevice.id == id)
+                session.execute(stmt)
+                session.commit()
+
+            save_log(request, Module.DEVICE, OperationType.DELETE, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='成功')
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.DELETE, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))
+
+
+batch_delete_user = reqparse.RequestParser(bundle_errors=True)
+batch_delete_user.add_argument(name='devices_id', type=str, required=True, location='form', help='设备id列表')
+
+
+@ns.route('/batch_delete_device')
+class BatchDeleteDeviceApi(Resource):
+    @ns.doc(id='batch_delete_device', description='批量删除设备')
+    @ns.expect(batch_delete_user)
+    def delete(self):
+        """批量删除设备"""
+        device_id = request.form.get('devices_id')
+
+        if device_id is not None:
+            device_id = json.loads(device_id)
+        else:
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message='设备id不能为空')
+
+        try:
+            with Session(current_app.engine) as session:
+                stmt = select(SecurityDevice).where(SecurityDevice.id.in_(device_id))
+                results = session.execute(stmt).scalars().all()
+
+                for result in results:
+                    session.delete(result)
+                session.commit()
+
+            save_log(request, Module.DEVICE, OperationType.BATCH_DELETE, StatesCode.SUCCESS)
+
+            return jsonify(code=StatesCode.SUCCESS, message='批量删除成功')
+        except Exception as e:
+
+            save_log(request, Module.DEVICE, OperationType.DELETE, StatesCode.UNKNOWN_ERROR)
+
+            return jsonify(code=StatesCode.UNKNOWN_ERROR, message=str(e))

+ 5 - 3
src/app/api/information.py

@@ -2,7 +2,7 @@ import datetime
 import json
 import json
 import os
 import os
 
 
-from flask import request, jsonify, current_app
+from flask import request, jsonify, current_app, g
 from flask_restx import Resource, Namespace, reqparse
 from flask_restx import Resource, Namespace, reqparse
 from sqlalchemy import select, insert, update, delete
 from sqlalchemy import select, insert, update, delete
 from sqlalchemy.orm import Session
 from sqlalchemy.orm import Session
@@ -115,7 +115,8 @@ class FloorConfigurationApi(Resource):
                 location=location,
                 location=location,
                 use=use,
                 use=use,
                 remark=remark,
                 remark=remark,
-                attachment=attachment_url
+                attachment=attachment_url,
+                account=g.user_name
             )
             )
             session.execute(stmt)
             session.execute(stmt)
             session.commit()
             session.commit()
@@ -152,7 +153,8 @@ class FloorConfigurationApi(Resource):
                 location=location,
                 location=location,
                 use=use,
                 use=use,
                 remark=remark,
                 remark=remark,
-                attachment=attachment_url
+                attachment=attachment_url,
+                account=g.user_name
             )
             )
             session.execute(stmt)
             session.execute(stmt)
             session.commit()
             session.commit()

+ 1 - 5
src/app/defines/__init__.py

@@ -5,11 +5,6 @@ class StatesCode:
     PARA_ERROR = -3  # 参数错误
     PARA_ERROR = -3  # 参数错误
 
 
 
 
-class MessageType:
-    ordinary_message = 1  # 普通消息
-    alert_messages = 2  # 提醒消息
-
-
 class Module:
 class Module:
     """系统模块"""
     """系统模块"""
     LOGIN = '登入'
     LOGIN = '登入'
@@ -19,6 +14,7 @@ class Module:
     MESSAGE = '消息管理'
     MESSAGE = '消息管理'
     INFORMATION = '信息管理'
     INFORMATION = '信息管理'
     LOG = '日志管理'
     LOG = '日志管理'
+    DEVICE = '设备管理'
     DATA = '数据管理'
     DATA = '数据管理'
 
 
 
 

+ 33 - 0
src/app/modle/device.py

@@ -0,0 +1,33 @@
+from sqlalchemy import String, Column, Integer, Float
+
+from app.modle import Base
+
+
+class DeviceType(Base):
+    """设备类别"""
+
+    __tablename__ = 'security_device_type'
+
+    id = Column(Integer, primary_key=True, autoincrement=True, nullable=False, unique=True, doc='id')
+    type_name = Column(String, nullable=False, unique=False, index=False, doc='类别名称', comment='类别名称')
+
+
+class SecurityDevice(Base):
+    """设备表"""
+
+    __tablename__ = 'security_device'
+
+    id = Column(Integer, primary_key=True, autoincrement=True, nullable=False, unique=True, doc='id')
+    device_name = Column(String, nullable=False, unique=False, index=False, doc='设备名称', comment='设备名称')
+    device_id = Column(String, nullable=True, unique=False, index=False, doc='设备id', comment='设备id')
+    device_type = Column(Integer, nullable=True, unique=False, index=False, doc='设备类型(1-摄像头)',
+                         comment='设备类型(1-摄像头)')
+    device_location = Column(String, nullable=True, unique=False, index=False, doc='设备位置', comment='设备位置')
+    device_age = Column(Integer, nullable=True, unique=False, index=False, doc='设备年限', comment='设备年限')
+    company_id = Column(String, nullable=True, unique=False, index=False, doc='所属单位ID', comment='所属单位ID')
+    user_id = Column(String, nullable=True, unique=False, index=False, doc='设备责任人', comment='设备责任人')
+    device_group = Column(String, nullable=True, unique=False, index=False, doc='设备分组', comment='设备分组')
+    status = Column(Integer, nullable=True, unique=False, index=False, doc='设备状态(1-开启)',
+                    comment='设备状态(1-开启)')
+    floor_id = Column(Integer, nullable=True, unique=False, index=False, doc='楼层id', comment='楼层id')
+    third_id = Column(String, nullable=True, unique=False, index=False, doc='', comment='')

+ 3 - 2
src/app/modle/information.py

@@ -1,6 +1,7 @@
 from sqlalchemy import String, Column, Integer
 from sqlalchemy import String, Column, Integer
 
 
 from app.modle import Base
 from app.modle import Base
+from app.utils.util import cn_now
 
 
 
 
 class FloorConfiguration(Base):
 class FloorConfiguration(Base):
@@ -14,6 +15,8 @@ class FloorConfiguration(Base):
     use = Column(String, nullable=True, unique=False, index=False, doc='楼层用途')
     use = Column(String, nullable=True, unique=False, index=False, doc='楼层用途')
     remark = Column(String, nullable=True, unique=False, index=False, doc='备注')
     remark = Column(String, nullable=True, unique=False, index=False, doc='备注')
     attachment = Column(String, nullable=True, unique=False, index=False, doc='附件')
     attachment = Column(String, nullable=True, unique=False, index=False, doc='附件')
+    account = Column(String, nullable=True, unique=False, index=False, doc='上传账户')
+    time = Column(String, nullable=True, unique=False, index=False, default=cn_now(), doc='上传时间')
 
 
 
 
 class StaffConfiguration(Base):
 class StaffConfiguration(Base):
@@ -27,5 +30,3 @@ class StaffConfiguration(Base):
     responsibility_range = Column(String, nullable=True, unique=False, index=False, doc='职责范围')
     responsibility_range = Column(String, nullable=True, unique=False, index=False, doc='职责范围')
     staff_list = Column(String, nullable=True, unique=False, index=False, doc='人员名单')
     staff_list = Column(String, nullable=True, unique=False, index=False, doc='人员名单')
     remark = Column(String, nullable=True, unique=False, index=False, doc='备注')
     remark = Column(String, nullable=True, unique=False, index=False, doc='备注')
-
-