From d970bcf57d2cc7456b8e17be101952be3e531733 Mon Sep 17 00:00:00 2001 From: houwei Date: Thu, 24 Oct 2024 13:55:27 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=81=A5=E6=8E=A7?= =?UTF-8?q?=E9=81=A5=E8=B0=83=E6=93=8D=E4=BD=9C=E7=9A=84api=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/service/impl/SysNodeServiceImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java index eb9f51df..e09e5669 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java @@ -77,6 +77,7 @@ public class SysNodeServiceImpl implements SysNodeService { @Autowired TerminalMessageEventHandler terminalMessageEventHandler; + @Override public List querySysNodeList() { List sysNodeVoList = sysNodeMapper.querySysNodeList(); @@ -398,17 +399,19 @@ public class SysNodeServiceImpl implements SysNodeService { } + private long currentActiveNodeId = 0; /** * 获得当前激活的节点id * @return 节点id */ private long getActiveNodeId(){ - List list = sysNodeMapper.querySysNodeList(); - if(list.isEmpty()){ - return 0; - }else{ - return list.get(0).getId(); + if(currentActiveNodeId==0){ + List list = sysNodeMapper.querySysNodeList(); + if(!list.isEmpty()){ + currentActiveNodeId= list.get(0).getId(); + } } + return currentActiveNodeId; } // 绑定设备的测点信息,不是绑定设备到映射表 From 4cccbd11cb7b84b6a8a63cae433805b8233f7b5d Mon Sep 17 00:00:00 2001 From: houwei Date: Thu, 24 Oct 2024 15:47:58 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B5=E9=9D=A2api?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/_sidebar.md | 2 ++ docs/api/node.md | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 24c993d0..3387b014 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -4,6 +4,8 @@ - [设备管理接口](api/equipment.md) - [节点管理接口](api/node.md) - [数据访问接口](api/data.md) + - [页面接口] + - [首页](api/home.md) - [数据采集](datacollect/) - [系统部署](deploy/) - [Linux系统部署](deploy/linux.md) diff --git a/docs/api/node.md b/docs/api/node.md index e7bfbb29..8ca01933 100644 --- a/docs/api/node.md +++ b/docs/api/node.md @@ -19,6 +19,8 @@ | | 1.2.8导出映射表信息 | /api/node/link/exportMappingList | SYS_AUTHORITY_ID_ADMIN | | | 1.2.9获取绑定设备树信息 | /api/node/link/getBindDeviceTree | SYS_AUTHORITY_ID_ADMIN | | | 1.2.10保存测点信息 | /api/node/link/saveMappingList | SYS_AUTHORITY_ID_ADMIN | +| | 1.2.11设备遥控操作 | /api/node/link/command | SYS_AUTHORITY_ID_TURBINE_CTRL | +| | 1.2.12设备遥调操作 | /api/node/link/setPoint | SYS_AUTHORITY_ID_TURBINE_CTRL | ## 1.1 节点相关接口 @@ -478,4 +480,12 @@ POST 请求接口 "success": true, "msg": "操作成功" } -``` \ No newline at end of file +``` + +### 1.2.11设备遥控操作 + + + + +### 1.2.12设备遥调操作 + From ccc84e3ad423684942676b6f32998350c8226046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Thu, 24 Oct 2024 16:30:21 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/_sidebar.md | 4 ++-- docs/api/pages/_sidebar.md | 1 + docs/api/{ => pages}/home.md | 0 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 docs/api/pages/_sidebar.md rename docs/api/{ => pages}/home.md (100%) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 3387b014..b65144d9 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -4,8 +4,8 @@ - [设备管理接口](api/equipment.md) - [节点管理接口](api/node.md) - [数据访问接口](api/data.md) - - [页面接口] - - [首页](api/home.md) + - [页面访问接口](api/pages/) + - [首页](api/pages/home.md) - [数据采集](datacollect/) - [系统部署](deploy/) - [Linux系统部署](deploy/linux.md) diff --git a/docs/api/pages/_sidebar.md b/docs/api/pages/_sidebar.md new file mode 100644 index 00000000..328af778 --- /dev/null +++ b/docs/api/pages/_sidebar.md @@ -0,0 +1 @@ +* [返回首页](/) \ No newline at end of file diff --git a/docs/api/home.md b/docs/api/pages/home.md similarity index 100% rename from docs/api/home.md rename to docs/api/pages/home.md From e56a3871693c856ef4cf27f37d3e926161f66fca Mon Sep 17 00:00:00 2001 From: yu Date: Thu, 24 Oct 2024 16:35:00 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=85=8D=E7=BD=AEAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysEnumController.java | 32 +- .../equipment/service/SysEnumService.java | 4 + .../service/impl/SysEnumServiceImpl.java | 45 +- docs/api/enumPage.md | 390 ++++++++++++++++++ 4 files changed, 462 insertions(+), 9 deletions(-) create mode 100644 docs/api/enumPage.md diff --git a/das/src/main/java/com/das/modules/equipment/controller/SysEnumController.java b/das/src/main/java/com/das/modules/equipment/controller/SysEnumController.java index dda36d3f..9688a314 100644 --- a/das/src/main/java/com/das/modules/equipment/controller/SysEnumController.java +++ b/das/src/main/java/com/das/modules/equipment/controller/SysEnumController.java @@ -111,7 +111,7 @@ public class SysEnumController { * 删除枚举值 * */ @PostMapping("/deleteEnumValues") - public R> deleteEnumValues(@RequestBody SysEnumValuesDto sysEnumValuesDto) { + public R deleteEnumValues(@RequestBody SysEnumValuesDto sysEnumValuesDto) { //判断是否有权限 boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString()); if(!hasPermission){ @@ -123,6 +123,36 @@ public class SysEnumController { sysEnumService.deleteEnumValues(sysEnumValuesDto); return R.success(); } + + /** 修改枚举类型 */ + @PostMapping("/updateEnumTypes") + public R updateEnumTypes(@RequestBody SysEnumTypesDto sysEnumTypesDto) { + //判断是否有权限 + boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString()); + if(!hasPermission){ + return R.fail("没有设备管理权限"); + } + if (sysEnumTypesDto.getId() ==null) { + throw new ServiceException("参数缺失"); + } + SysEnumTypesVo sysEnumTypesVo = sysEnumService.updateEnumTypes(sysEnumTypesDto); + return R.success(sysEnumTypesVo); + } + + /** 删除枚举类型 */ + @PostMapping("/deleteEnumTypes") + public R deleteEnumTypes(@RequestBody SysEnumTypesDto sysEnumTypesDto) { + //判断是否有权限 + boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString()); + if(!hasPermission){ + return R.fail("没有设备管理权限"); + } + if (sysEnumTypesDto.getId() ==null) { + throw new ServiceException("参数缺失"); + } + sysEnumService.deleteEnumTypes(sysEnumTypesDto); + return R.success(); + } } diff --git a/das/src/main/java/com/das/modules/equipment/service/SysEnumService.java b/das/src/main/java/com/das/modules/equipment/service/SysEnumService.java index ce4f13e1..4ef225d8 100644 --- a/das/src/main/java/com/das/modules/equipment/service/SysEnumService.java +++ b/das/src/main/java/com/das/modules/equipment/service/SysEnumService.java @@ -12,6 +12,10 @@ public interface SysEnumService { SysEnumTypesVo addEnumTypes(SysEnumTypesDto sysEnumTypesDto); + SysEnumTypesVo updateEnumTypes(SysEnumTypesDto sysEnumTypesDto); + + void deleteEnumTypes(SysEnumTypesDto sysEnumTypesDto); + SysEnumValuesVo addEnumValues(SysEnumValuesDto sysEnumValuesDto); SysEnumValuesVo updateEnumValues(SysEnumValuesDto sysEnumValuesDto); diff --git a/das/src/main/java/com/das/modules/equipment/service/impl/SysEnumServiceImpl.java b/das/src/main/java/com/das/modules/equipment/service/impl/SysEnumServiceImpl.java index 12e9b263..d77d5c8a 100644 --- a/das/src/main/java/com/das/modules/equipment/service/impl/SysEnumServiceImpl.java +++ b/das/src/main/java/com/das/modules/equipment/service/impl/SysEnumServiceImpl.java @@ -56,6 +56,42 @@ public class SysEnumServiceImpl implements SysEnumService { return sysEnumTypesVo; } + /** + * 修改枚举类型 + * @param sysEnumTypesDto + * @return + */ + @Override + public SysEnumTypesVo updateEnumTypes(SysEnumTypesDto sysEnumTypesDto) { + SysEnumTypes sysEnumTypes = new SysEnumTypes(); + BeanCopyUtils.copy(sysEnumTypesDto, sysEnumTypes); + SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY); + sysEnumTypes.setUpdatedBy(sysUserVo.getAccount()); + sysEnumTypes.setUpdatedTime(new Date()); + sysEnumTypesMapper.updateById(sysEnumTypes); + SysEnumTypesVo sysEnumTypesVo = new SysEnumTypesVo(); + BeanCopyUtils.copy(sysEnumTypes, sysEnumTypesVo); + return sysEnumTypesVo; + } + + /** + * 删除枚举类型 + * @param sysEnumTypesDto + */ + @Override + public void deleteEnumTypes(SysEnumTypesDto sysEnumTypesDto) { + SysEnumTypes sysEnumTypes = new SysEnumTypes(); + BeanCopyUtils.copy(sysEnumTypesDto, sysEnumTypes); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("enum_type_id",sysEnumTypesDto.getId()); + queryWrapper.eq("is_active",1); + Long count = sysEnumValuesMapper.selectCount(queryWrapper); + if (count >0){ + throw new ServiceException("该枚举类型下,存在枚举值,不可删除!"); + } + sysEnumTypesMapper.deleteById(sysEnumTypesDto.getId()); + } + /** 新增枚举值 */ @Override public SysEnumValuesVo addEnumValues(SysEnumValuesDto sysEnumValuesDto) { @@ -84,13 +120,6 @@ public class SysEnumServiceImpl implements SysEnumService { public SysEnumValuesVo updateEnumValues(SysEnumValuesDto sysEnumValuesDto) { SysEnumValues sysEnumValues = new SysEnumValues(); BeanCopyUtils.copy(sysEnumValuesDto,sysEnumValues); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("enum_type_id",sysEnumValuesDto.getEnumTypeId()); - queryWrapper.eq("description",sysEnumValuesDto.getDescription()); - Long count = sysEnumValuesMapper.selectCount(queryWrapper); - if (count >0){ - throw new ServiceException("枚举值描述,不可重复!"); - } SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY); sysEnumValues.setUpdatedBy(sysUserVo.getAccount()); sysEnumValues.setUpdatedTime(new Date()); @@ -117,7 +146,7 @@ public class SysEnumServiceImpl implements SysEnumService { } /** - * 查询枚举类型列表 + * 查询枚举值列表 * @param sysEnumValuesDto * @return */ diff --git a/docs/api/enumPage.md b/docs/api/enumPage.md new file mode 100644 index 00000000..64213ff5 --- /dev/null +++ b/docs/api/enumPage.md @@ -0,0 +1,390 @@ +# 枚举类型配置模块 + +## API接口一览表 + +| 接口分类 | 接口描述 | API接口 | 权限 | +|-----------|---------------| ------------------------------------- | --------------------------- | +| 2.1枚举类型配置 | 2.1.1新增枚举类型 | /api/enum/addEnumTypes | SYS_AUTHORITY_ID_DEVICE_MGR| +| | 2.1.2新增枚举值 | /api/enum/addEnumValues | SYS_AUTHORITY_ID_DEVICE_MGR | +| | 2.1.3枚举值修改 | /api/enum/updateEnumValues | SYS_AUTHORITY_ID_DEVICE_MGR | +| | 2.1.4获取枚举类型列表 | /api/enum/queryEnumTypesList | | +| | 2.1.5获取枚举值列表 | /api/enum/queryEnumValuesList | | +| | 2.1.6删除枚举值 | /api/enum/deleteEnumValues | SYS_AUTHORITY_ID_DEVICE_MGR | +| | 2.1.7修改枚举类型 | /api/enum/updateEnumTypes | SYS_AUTHORITY_ID_DEVICE_MGR | +| | 2.1.8删除枚举类型 | /api/enum/deleteEnumTypes | SYS_AUTHORITY_ID_DEVICE_MGR | + + +### 2.1 枚举类型配置相关接口 + +#### 2.1.1 新增枚举类型 + +POST 请求接口 + +> /api/enum/addEnumTypes + + +请求参数 + +```json +{ + "name": "testEnum", + "description": "测试枚举类型" +} +``` +入参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +| ------------ | -------- |----|--------| +| name | String | NO | 枚举类型名称 | +| description | String | NO | 枚举描述 | + + +返回报文 + +```json +{ + "code": 200, + "success": true, + "data": { + "id": "1849346211333619713", + "name": "testEnum", + "description": "测试枚举类型" + }, + "msg": "操作成功" +} +``` +返参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +| ------------- |---------| ---- |--------| +| id | String | 否 | id | +| name | String | 否 | 枚举类型名称 | +| description | String | 否 | 枚举描述 | + +#### 2.1.2 新增枚举值 + +POST 请求接口 + +> /api/enum/addEnumValues + + +请求参数 + +```json +{ + "enumTypeId": 1849346211333619713, + "value": "testenum1", + "description": "测试枚举值1", + "isActive": 1, + "orderNumber": 1 +} +``` +入参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +| ------------ |---------|----|----------------| +| enumTypeId | Long | NO | 枚举类型id | +| value | String | NO | 枚举值内容 | +| description | String | NO | 枚举值描述 | +| isActive | Integer | NO | 是否有效(0:无效,1:有效) | +| orderNumber | Integer | NO | 排序 | + + +返回报文 + +```json +{ + "code": 200, + "success": true, + "data": { + "id": "1849347701024608258", + "enumTypeId": 1849346211333619713, + "value": "testenum1", + "description": "测试枚举值1", + "orderNumber": 1, + "isActive": 1 + }, + "msg": "操作成功" +} +``` +返参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|---------------|---------| ---- |-----------------| +| id | String | 否 | id | +| enumTypeId | Long | 否 | 枚举类型id | +| value | String | 否 | 枚举值内容 | +| description | String | 否 | 枚举值描述 | +| isActive | Integer | 否 | 是否有效(0:无效,1:有效) | +| orderNumber | Integer | 否 | 排序 | + +#### 2.1.3 枚举值修改 + +POST 请求接口 + +> /api/enum/updateEnumValues + + +请求参数 + +```json +{ + "id": 1849347701024608258, + "enumTypeId": 1849346211333619713, + "value": "testenum2", + "description": "测试枚举值2", + "isActive": 1, + "orderNumber": 1 +} +``` +入参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|-------------|---------|-----|-----------------| +| id | Long | NO | 枚举值id | +| enumTypeId | Long | NO | 枚举类型id | +| value | String | YES | 枚举值内容 | +| description | String | YES | 枚举值描述 | +| isActive | Integer | YES | 是否有效(0:无效,1:有效) | +| orderNumber | Integer | YES | 排序 | + + +返回报文 + +```json +{ + "code": 200, + "success": true, + "data": { + "id": "1849347701024608258", + "enumTypeId": 1849346211333619713, + "value": "testenum2", + "description": "测试枚举值2", + "orderNumber": 1, + "isActive": 1 + }, + "msg": "操作成功" +} +``` +返参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|---------------|---------| ---- |-----------------| +| id | String | 否 | id | +| enumTypeId | Long | 否 | 枚举类型id | +| value | String | 否 | 枚举值内容 | +| description | String | 否 | 枚举值描述 | +| isActive | Integer | 否 | 是否有效(0:无效,1:有效) | +| orderNumber | Integer | 否 | 排序 | + +#### 2.1.4 获取枚举类型列表 + +POST 请求接口 + +> /api/enum/queryEnumTypesList + + +请求参数 +无 + +返回报文 + +```json +{ + "code": 200, + "success": true, + "data": [ + { + "id": "1", + "name": "iTurbineOperationMode", + "description": "运行模式" + }, + { + "id": "2", + "name": "iBPLevel", + "description": "刹车等级" + } + ], + "msg": "操作成功" +} +``` +返参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|---------------|---------| ---- |--------| +| id | String | 否 | id | +| name | String | 否 | 枚举类型名称 | +| description | String | 否 | 枚举值描述 | + +#### 2.1.5 获取枚举值列表 + +POST 请求接口 + +> /api/enum/queryEnumValuesList + + +请求参数 + +```json +{ + "pageNum":1, + "pageSize":20, + "description": "通讯断开", + "enumTypeId": "1" +} +``` +入参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|-------------|---------|-----|---------| +| pageNum | Integer | NO | 当前页 | +| pageSize | Integer | NO | 每页显示大小 | +| description | String | YES | 枚举值描述 | +| enumTypeId | String | NO | 枚举值类型id | + + +返回报文 + +```json +{ + "code": 200, + "success": true, + "data": { + "total": 1, + "rows": [ + { + "id": "1000", + "enumTypeId": 1, + "enumTypeIdStr": "1", + "value": "0", + "description": "通讯断开", + "orderNumber": 1, + "isActive": 1 + } + ], + "code": 200, + "msg": "查询成功" + }, + "msg": "操作成功" +} +``` +返参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|---------------|---------| ---- |-----------------| +| id | String | 否 | id | +| enumTypeId | Long | 否 | 枚举类型id | +| enumTypeIdStr | String | 否 | 枚举类型id(字符串类型) | +| value | String | 否 | 枚举值内容 | +| description | String | 否 | 枚举值描述 | +| isActive | Integer | 否 | 是否有效(0:无效,1:有效) | +| orderNumber | Integer | 否 | 排序 | + + +#### 2.1.6 删除枚举值 + +POST 请求接口 + +> /api/enum/deleteEnumValues + + +请求参数 + +```json +{ + "id":"1849347701024608258" +} +``` +入参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|-------------|---------|----|---------| +| id | String | NO | 枚举值id | + + +返回报文 + +```json +{ + "code": 200, + "success": true, + "msg": "操作成功" +} +``` +#### 2.1.7 修改枚举类型 + +POST 请求接口 + +> /api/enum/updateEnumTypes + + +请求参数 + +```json +{ + "id":1849361189939826689, + "name": "testEnum3", + "description": "测试枚举类型3" +} +``` +入参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|-------------|---------|-----|--------| +| id | Long | NO | 枚举类型id | +| name | String | YES | 枚举类型名称 | +| description | String | YES | 枚举类型描述 | + + +返回报文 + +```json +{ + "code": 200, + "success": true, + "data": { + "id": "1849361189939826689", + "name": "testEnum3", + "description": "测试枚举类型3" + }, + "msg": "操作成功" +} +``` +返参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|-------------|---------|-----|--------| +| id | Long | 否 | 枚举类型id | +| name | String | 否 | 枚举类型名称 | +| description | String | 否 | 枚举类型描述 | + +#### 2.1.8 删除枚举类型 + +POST 请求接口 + +> /api/enum/deleteEnumTypes + + +请求参数 + +```json +{ + "id":1849361189939826689 +} +``` +入参描述 + +| 参数名 | 参数类型 | 可选 | 描述 | +|-------------|------|----|--------| +| id | Long | NO | 枚举类型id | + + +返回报文 + +```json +{ + "code": 200, + "success": true, + "msg": "操作成功" +} +``` \ No newline at end of file From 7e1cd7f8c3d31d4ac450f90c859e85c90b136006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Thu, 24 Oct 2024 16:48:20 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/pages/home.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/pages/home.md b/docs/api/pages/home.md index 3824914b..70392fd9 100644 --- a/docs/api/pages/home.md +++ b/docs/api/pages/home.md @@ -14,9 +14,9 @@ | | 2.1.8实时告警确认 | 告警记录ID | /api/home/realTimeAlertConfirm | | -### 2.1 首页相关接口 +## 2.1 首页相关接口 -#### 2.1.1 风场概况 +### 2.1.1 风场概况 POST 请求接口 @@ -56,7 +56,7 @@ POST 请求接口 -#### 2.1.2 今日运行状态 +### 2.1.2 今日运行状态 POST 请求接口 @@ -106,7 +106,7 @@ POST 请求接口 | offlineNum | Integer | 否 | 离线台数 | -#### 2.1.3 功率趋势 +### 2.1.3 功率趋势 POST 请求接口 @@ -148,7 +148,7 @@ POST 请求接口 | windSpeed | Double | 否 | 风速 | | dataTime | String | 否 | 数据时间 | -#### 2.1.4 风机矩阵 +### 2.1.4 风机矩阵 POST 请求接口 @@ -199,7 +199,7 @@ POST 请求接口 | standard | Integer | 否 | 是否为标杆机组 | | windTurbine | String | 否 | 风机编码 | -#### 2.1.5 发电量概况 +### 2.1.5 发电量概况 POST 请求接口 @@ -251,7 +251,7 @@ POST 请求接口 | yearGeneration | Double | 否 | 年发电量 | | totalGeneration | Double | 否 | 总发电量 | -#### 2.1.6 发电量趋势 +### 2.1.6 发电量趋势 POST 请求接口 @@ -305,7 +305,7 @@ POST 请求接口 | samePeriod | Double | 否 | 同期 | | generationTime | Double | 否 | 发电量时间 | -#### 2.1.7 实时告警 +### 2.1.7 实时告警 POST 请求接口 @@ -353,7 +353,7 @@ POST 请求接口 | alertId | Long | 否 | 告警id | | confirmStatus | Integer | 否 | 确认状态 | -#### 2.1.8 实时告警-确认 +### 2.1.8 实时告警-确认 POST 请求接口 From 960baa3772918311d66a4477369a22161a534aa4 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Thu, 24 Oct 2024 16:50:35 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=85=A5=E5=BA=93redis?= =?UTF-8?q?,=E6=9F=A5=E8=AF=A2key=E7=BB=9F=E4=B8=80=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/das/modules/node/service/impl/DataServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java index 4d5a30a7..accdaebc 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java @@ -248,7 +248,7 @@ public class DataServiceImpl implements DataService { Iterator keysHigh = values.fieldNames(); while (keysHigh.hasNext()) { String fieldName = keysHigh.next(); - String key = String.format("RT:%s:%s", deviceId, fieldName); + String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); keyValueMap.put(key,values.get(fieldName)); } adminRedisTemplate.mSet(keyValueMap); From 817a6a0f37783e788055f31e0e93da0772f89536 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Thu, 24 Oct 2024 16:51:31 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=85=A5=E5=BA=93redis?= =?UTF-8?q?,=E6=9F=A5=E8=AF=A2key=E7=BB=9F=E4=B8=80=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/das/modules/data/service/DataService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/das/src/main/java/com/das/modules/data/service/DataService.java b/das/src/main/java/com/das/modules/data/service/DataService.java index d91de72a..d652b7fb 100644 --- a/das/src/main/java/com/das/modules/data/service/DataService.java +++ b/das/src/main/java/com/das/modules/data/service/DataService.java @@ -53,12 +53,12 @@ public class DataService { //为空查全部 List sysIotModelFields = sysIotModelFieldMapper.queryAllFiledNames(Long.valueOf(snapshotValueQueryParam.getDeviceId())); for (String item : sysIotModelFields) { - String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item); + String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item.toLowerCase()); keyList.add(key); } } else { for (String item : attributes) { - String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item); + String key = String.format("RT:%s:%s", snapshotValueQueryParam.getDeviceId(), item.toLowerCase()); keyList.add(key); } } From 8e0430925cebfcc41f19cb0da0f486e618e52f4a Mon Sep 17 00:00:00 2001 From: huguanghan Date: Thu, 24 Oct 2024 17:35:17 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E9=A3=8E=E6=9C=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/mapper/SysEquipmentMapper.java | 4 ++ .../WindTurbinesPageController.java | 19 +++++- .../page/domian/WindTurbinesPageVo.java | 19 ++++++ .../page/service/WindTurbinesPageService.java | 67 +++++++++++++++++++ .../resources/mapper/SysEquipmentMapper.xml | 7 ++ 5 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java create mode 100644 das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java diff --git a/das/src/main/java/com/das/modules/equipment/mapper/SysEquipmentMapper.java b/das/src/main/java/com/das/modules/equipment/mapper/SysEquipmentMapper.java index ae6dafd3..c5bc767c 100644 --- a/das/src/main/java/com/das/modules/equipment/mapper/SysEquipmentMapper.java +++ b/das/src/main/java/com/das/modules/equipment/mapper/SysEquipmentMapper.java @@ -8,6 +8,7 @@ import com.das.modules.equipment.domain.excel.SysEquipmentExcel; import com.das.modules.equipment.domain.vo.BaseImptabmappingVo; import com.das.modules.equipment.domain.vo.SysEquipmentVo; import com.das.modules.equipment.entity.SysEquipment; +import com.das.modules.page.domian.WindTurbinesPageVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -40,4 +41,7 @@ public interface SysEquipmentMapper extends BaseMapperPlus queryBelongLines(@Param("objectType") Long objectType); + + List queryAllWindList(@Param("objectType") Long objectType); } diff --git a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java index 595ff7b2..2ec4a027 100644 --- a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java +++ b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java @@ -1,7 +1,11 @@ package com.das.modules.page.controller; import com.das.common.result.R; +import com.das.modules.page.domian.WindTurbinesPageVo; +import com.das.modules.page.service.WindTurbinesPageService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -17,6 +21,8 @@ import java.util.List; @RequestMapping("/api/page/turbines") @RestController public class WindTurbinesPageController { + @Autowired + private WindTurbinesPageService windTurbinesPageService; /** * 获取风机机组所属线路列表 * @return 返回字符串数组 @@ -24,6 +30,17 @@ public class WindTurbinesPageController { @PostMapping("/lines") public R> queryBelongLines() { //TODO: 查询sql: select distinct belong_line as name from sys_equipment t where t.object_type = 10002 and belong_line !=''; - return R.success(); + List lines = windTurbinesPageService.queryBelongLines(); + return R.success(lines); + } + + /** + * 获取风机页面数据 + * @return 返回风机页面数据 + */ + @GetMapping ("/queryWindTurbinesPages") + public R> queryWindTurbinesPages(){ + List windTurbinesPageVos = windTurbinesPageService.queryAllWindTurbinesPages(); + return R.success(windTurbinesPageVos); } } diff --git a/das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java b/das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java new file mode 100644 index 00000000..880e6473 --- /dev/null +++ b/das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java @@ -0,0 +1,19 @@ +package com.das.modules.page.domian; + +import lombok.Data; + +import java.util.Map; + +@Data +public class WindTurbinesPageVo { + + private Long irn; + + private String name; + + private String model; + + private String belongLine; + + private Map map; +} diff --git a/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java new file mode 100644 index 00000000..e67bb5dd --- /dev/null +++ b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java @@ -0,0 +1,67 @@ +package com.das.modules.page.service; + +import com.das.modules.data.domain.SnapshotValueQueryParam; +import com.das.modules.data.service.DataService; +import com.das.modules.equipment.mapper.SysEquipmentMapper; +import com.das.modules.page.domian.WindTurbinesPageVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Transactional(rollbackFor = Exception.class) +@Service +@Slf4j +public class WindTurbinesPageService { + private static final Long OBJECT_TYPE = 10002L; + + @Autowired + SysEquipmentMapper sysEquipmentMapper; + + @Autowired + private DataService dataService; + + /** + * 获取风机机组所属线路列表 + * @return 返回字符串数组 + */ + public List queryBelongLines(){ + return sysEquipmentMapper.queryBelongLines(OBJECT_TYPE); + } + + public List queryAllWindTurbinesPages(){ + List windTurbinesPageVos = sysEquipmentMapper.queryAllWindList(OBJECT_TYPE); + List paramList = new ArrayList<>(); + List attributesList = new ArrayList<>(); + attributesList.add("iwindspeed"); + attributesList.add("iturbineoperationmode"); + attributesList.add("igenpower"); + attributesList.add("ikwhthisday"); + attributesList.add("ikwhoverall"); + attributesList.add("ivanedirection"); + attributesList.add("irotorspeed"); + attributesList.add("igenspeed"); + attributesList.add("itempnacelle_1sec"); + attributesList.add("ihydrpress"); + attributesList.add("ipitchangle1"); + attributesList.add("ipitchangle2"); + attributesList.add("ipitchangle3"); + attributesList.add("iyplevel"); + attributesList.add("gridlostdetected"); + for (WindTurbinesPageVo item : windTurbinesPageVos){ + SnapshotValueQueryParam snapshotValueQueryParam = new SnapshotValueQueryParam(); + snapshotValueQueryParam.setAttributes(attributesList); + snapshotValueQueryParam.setDeviceId(item.getIrn().toString()); + paramList.add(snapshotValueQueryParam); + } + Map> map = dataService.querySnapshotValues(paramList); + for (WindTurbinesPageVo item : windTurbinesPageVos){ + item.setMap(map.get(item.getIrn().toString())); + } + return windTurbinesPageVos; + } +} diff --git a/das/src/main/resources/mapper/SysEquipmentMapper.xml b/das/src/main/resources/mapper/SysEquipmentMapper.xml index 9b26a30c..372d87c3 100644 --- a/das/src/main/resources/mapper/SysEquipmentMapper.xml +++ b/das/src/main/resources/mapper/SysEquipmentMapper.xml @@ -162,5 +162,12 @@ + + + From 790c6adf98bd60671781754c23b7b98f627d1d14 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Thu, 24 Oct 2024 17:41:59 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E9=A3=8E=E6=9C=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/das/modules/page/domian/WindTurbinesPageVo.java | 2 +- .../com/das/modules/page/service/WindTurbinesPageService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java b/das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java index 880e6473..30e94bdb 100644 --- a/das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java +++ b/das/src/main/java/com/das/modules/page/domian/WindTurbinesPageVo.java @@ -15,5 +15,5 @@ public class WindTurbinesPageVo { private String belongLine; - private Map map; + private Map attributeMap; } diff --git a/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java index e67bb5dd..7d4cd987 100644 --- a/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java +++ b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java @@ -60,7 +60,7 @@ public class WindTurbinesPageService { } Map> map = dataService.querySnapshotValues(paramList); for (WindTurbinesPageVo item : windTurbinesPageVos){ - item.setMap(map.get(item.getIrn().toString())); + item.setAttributeMap(map.get(item.getIrn().toString())); } return windTurbinesPageVos; } From c8b1a1385385f9ed13944a680de070c91837a800 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Thu, 24 Oct 2024 17:50:49 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E9=A3=8E=E6=9C=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=81=A5=E6=8E=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WindTurbinesPageController.java | 19 ++++++++++++++----- .../page/service/WindTurbinesPageService.java | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java index 2ec4a027..fecc79ea 100644 --- a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java +++ b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java @@ -1,14 +1,12 @@ package com.das.modules.page.controller; import com.das.common.result.R; +import com.das.modules.node.domain.dto.DeviceCommandDto; import com.das.modules.page.domian.WindTurbinesPageVo; import com.das.modules.page.service.WindTurbinesPageService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -27,7 +25,7 @@ public class WindTurbinesPageController { * 获取风机机组所属线路列表 * @return 返回字符串数组 */ - @PostMapping("/lines") + @GetMapping("/lines") public R> queryBelongLines() { //TODO: 查询sql: select distinct belong_line as name from sys_equipment t where t.object_type = 10002 and belong_line !=''; List lines = windTurbinesPageService.queryBelongLines(); @@ -43,4 +41,15 @@ public class WindTurbinesPageController { List windTurbinesPageVos = windTurbinesPageService.queryAllWindTurbinesPages(); return R.success(windTurbinesPageVos); } + + /** + * + * @param controlList 遥控List + * @return 成功或者失败 + */ + @PostMapping ("/queryWindTurbinesPages") + public R windTurbinesControl(@RequestBody List controlList){ + windTurbinesPageService.windTurbinesControl(controlList); + return R.success(); + } } diff --git a/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java index 7d4cd987..c22074cc 100644 --- a/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java +++ b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java @@ -3,6 +3,8 @@ package com.das.modules.page.service; import com.das.modules.data.domain.SnapshotValueQueryParam; import com.das.modules.data.service.DataService; import com.das.modules.equipment.mapper.SysEquipmentMapper; +import com.das.modules.node.domain.dto.DeviceCommandDto; +import com.das.modules.node.service.SysNodeService; import com.das.modules.page.domian.WindTurbinesPageVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +27,9 @@ public class WindTurbinesPageService { @Autowired private DataService dataService; + @Autowired + SysNodeService sysNodeService; + /** * 获取风机机组所属线路列表 * @return 返回字符串数组 @@ -33,6 +38,11 @@ public class WindTurbinesPageService { return sysEquipmentMapper.queryBelongLines(OBJECT_TYPE); } + + /** + * 获取风机页面数据 + * @return 返回风机页面数据 + */ public List queryAllWindTurbinesPages(){ List windTurbinesPageVos = sysEquipmentMapper.queryAllWindList(OBJECT_TYPE); List paramList = new ArrayList<>(); @@ -64,4 +74,10 @@ public class WindTurbinesPageService { } return windTurbinesPageVos; } + + public void windTurbinesControl(List controlList){ + for (DeviceCommandDto item : controlList){ + sysNodeService.deviceCommand(item); + } + } } From 6551d37d6f318d3f6248fe70bec0cedaee8eb9cd Mon Sep 17 00:00:00 2001 From: huguanghan Date: Thu, 24 Oct 2024 18:32:00 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E9=A3=8E=E6=9C=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=81=A5=E6=8E=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SysIotModelServiceImpl.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java b/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java index 05e86556..aa7389d2 100644 --- a/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java +++ b/das/src/main/java/com/das/modules/equipment/service/impl/SysIotModelServiceImpl.java @@ -418,33 +418,33 @@ public class SysIotModelServiceImpl implements SysIotModelService { } if (CollectionUtils.isNotEmpty(sysIotModelFieldList)) { sysIotModelFieldMapper.insertBatch(sysIotModelFieldList); - ListUtil.page(sysIotModelFieldList, COMMIT_COUNT, create -> { - for (SysIotModelField item : create){ - createTdStableOrColumn(item); - } - }); +// ListUtil.page(sysIotModelFieldList, COMMIT_COUNT, create -> { +// for (SysIotModelField item : create){ +// createTdStableOrColumn(item); +// } +// }); } if (CollectionUtils.isNotEmpty(updateSysIotModelFieldList)) { - ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, update -> { - for (SysIotModelField item : update){ - SysIotModelField oldSysIotField = sysIotModelFieldMapper.selectById(item.getId()); - if (oldSysIotField != null){ - if (!oldSysIotField.getAttributeCode().equals(item.getAttributeCode()) && oldSysIotField.getDataType().equals(item.getDataType()) && Objects.equals(oldSysIotField.getHighSpeed(), item.getHighSpeed())){ - //更新td表结构 - updateTDStableOrColumn(item,oldSysIotField); - } - } - } - }); +// ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, update -> { +// for (SysIotModelField item : update){ +// SysIotModelField oldSysIotField = sysIotModelFieldMapper.selectById(item.getId()); +// if (oldSysIotField != null){ +// if (!oldSysIotField.getAttributeCode().equals(item.getAttributeCode()) && oldSysIotField.getDataType().equals(item.getDataType()) && Objects.equals(oldSysIotField.getHighSpeed(), item.getHighSpeed())){ +// //更新td表结构 +// updateTDStableOrColumn(item,oldSysIotField); +// } +// } +// } +// }); sysIotModelFieldMapper.updateBatchById(updateSysIotModelFieldList); } if (CollectionUtils.isNotEmpty(delSysIotModelFieldList)) { - ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, delete -> { - for (SysIotModelField item : delete){ - deleteTDStableOrColumn(item); - } - }); +// ListUtil.page(updateSysIotModelFieldList, COMMIT_COUNT, delete -> { +// for (SysIotModelField item : delete){ +// deleteTDStableOrColumn(item); +// } +// }); sysIotModelFieldMapper.deleteBatchIds(delSysIotModelFieldList); } } From ec0791270afa821c12b3d59b8437107456978a20 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Thu, 24 Oct 2024 18:59:58 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E9=A3=8E=E6=9C=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=81=A5=E6=8E=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../das/modules/page/controller/WindTurbinesPageController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java index fecc79ea..f38dfa4f 100644 --- a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java +++ b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java @@ -47,7 +47,7 @@ public class WindTurbinesPageController { * @param controlList 遥控List * @return 成功或者失败 */ - @PostMapping ("/queryWindTurbinesPages") + @PostMapping ("/windTurbinesControl") public R windTurbinesControl(@RequestBody List controlList){ windTurbinesPageService.windTurbinesControl(controlList); return R.success();