Browse Source

1、字典管理、资产设备管理、网关管理、设备采集参数配置管理、仪表管理接口;

pro_v1
mh 3 months ago
parent
commit
95987cdc6d
  1. 217
      2024新增脚本.sql
  2. 22
      common/pom.xml
  3. 6
      common/src/main/java/com/mh/common/page/MybatisPageHelper.java
  4. 25
      common/src/main/java/com/mh/common/utils/FileUtils.java
  5. 17
      common/src/main/java/com/mh/common/utils/StringUtils.java
  6. 26
      pom.xml
  7. 11
      user-service/pom.xml
  8. 2
      user-service/src/main/java/com/mh/user/UserServiceApplication.java
  9. 296
      user-service/src/main/java/com/mh/user/controller/DeviceManageController.java
  10. 60
      user-service/src/main/java/com/mh/user/controller/DevicesManageController.java
  11. 60
      user-service/src/main/java/com/mh/user/controller/DevicesParamsController.java
  12. 61
      user-service/src/main/java/com/mh/user/controller/GatewayManageController.java
  13. 60
      user-service/src/main/java/com/mh/user/controller/MeterManageController.java
  14. 46
      user-service/src/main/java/com/mh/user/controller/ProjectInfoController.java
  15. 60
      user-service/src/main/java/com/mh/user/controller/SysDictController.java
  16. 3
      user-service/src/main/java/com/mh/user/entity/BaseEntity.java
  17. 69
      user-service/src/main/java/com/mh/user/entity/DeviceParamsEntity.java
  18. 142
      user-service/src/main/java/com/mh/user/entity/DevicesManageEntity.java
  19. 26
      user-service/src/main/java/com/mh/user/entity/GatewayManageEntity.java
  20. 228
      user-service/src/main/java/com/mh/user/entity/MeterManageEntity.java
  21. 186
      user-service/src/main/java/com/mh/user/entity/ProjectInfoEntity.java
  22. 16
      user-service/src/main/java/com/mh/user/mapper/DeviceParamsMapper.java
  23. 16
      user-service/src/main/java/com/mh/user/mapper/DevicesManageMapper.java
  24. 16
      user-service/src/main/java/com/mh/user/mapper/MeterManageMapper.java
  25. 6
      user-service/src/main/java/com/mh/user/mapper/ProjectInfoMapper.java
  26. 17
      user-service/src/main/java/com/mh/user/mapper/SysDictMapper.java
  27. 22
      user-service/src/main/java/com/mh/user/mapper/chillers/GatewayManageMapper.java
  28. 3
      user-service/src/main/java/com/mh/user/model/BaseModel.java
  29. 9
      user-service/src/main/java/com/mh/user/model/SysDict.java
  30. 2
      user-service/src/main/java/com/mh/user/netty/EchoServerHandler.java
  31. 24
      user-service/src/main/java/com/mh/user/service/BaseService.java
  32. 13
      user-service/src/main/java/com/mh/user/service/DeviceParamsService.java
  33. 13
      user-service/src/main/java/com/mh/user/service/DevicesManageService.java
  34. 10
      user-service/src/main/java/com/mh/user/service/GatewayManageService.java
  35. 13
      user-service/src/main/java/com/mh/user/service/MeterManageService.java
  36. 4
      user-service/src/main/java/com/mh/user/service/ProjectInfoService.java
  37. 9
      user-service/src/main/java/com/mh/user/service/SysDictService.java
  38. 105
      user-service/src/main/java/com/mh/user/service/chillers/GatewayManageService.java
  39. 192
      user-service/src/main/java/com/mh/user/service/chillers/impl/GatewayManageServiceImpl.java
  40. 68
      user-service/src/main/java/com/mh/user/service/impl/DeviceParamsServiceImpl.java
  41. 71
      user-service/src/main/java/com/mh/user/service/impl/DevicesManageServiceImpl.java
  42. 79
      user-service/src/main/java/com/mh/user/service/impl/GatewayManageServiceImpl.java
  43. 69
      user-service/src/main/java/com/mh/user/service/impl/MeterManageServiceImpl.java
  44. 50
      user-service/src/main/java/com/mh/user/service/impl/ProjectInfoServiceImpl.java
  45. 87
      user-service/src/main/java/com/mh/user/service/impl/SysDictServiceImpl.java
  46. 28
      user-service/src/main/java/com/mh/user/sqlmapper/SysDictMapper.xml
  47. 7
      user-service/src/main/resources/application-dev.yml
  48. 5
      user-service/src/main/resources/application-prod.yml
  49. 5
      user-service/src/main/resources/application-test.yml
  50. 89
      user-service/src/test/java/com/mh/user/SysUserTest.java

217
2024新增脚本.sql

@ -0,0 +1,217 @@
-- 2024-07-31 (未执行)
alter table project_info add longitude numeric(10,2) null;
exec sp_addextendedproperty N'MS_Description', N'经度', N'schema', N'dbo', N'table', N'project_info', N'column', N'longitude';
alter table project_info add latitude numeric(10,2) null;
exec sp_addextendedproperty N'MS_Description', N'纬度', N'schema', N'dbo', N'table', N'project_info', N'column', N'latitude';
alter table project_info add create_time datetime null;
exec sp_addextendedproperty N'MS_Description', N'创建时间', N'schema', N'dbo', N'table', N'project_info', N'column', N'create_time';
alter table project_info add pic_content text null;
exec sp_addextendedproperty N'MS_Description', N'图片内容', N'schema', N'dbo', N'table', N'project_info', N'column', N'pic_content';
-- 2024-08-13 创建字典表数据
CREATE TABLE sys_dict (
id bigint NOT NULL,
value nvarchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL,
label nvarchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL,
[type] nvarchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL,
description nvarchar(100) COLLATE Chinese_PRC_CI_AS NOT NULL,
sort decimal(10,0) NOT NULL,
create_by nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
create_time datetime2 NULL,
last_update_by nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
last_update_time datetime2 NULL,
remarks nvarchar(255) COLLATE Chinese_PRC_CI_AS NULL,
del_flag tinyint NULL,
status bit null,
parent_id bigint null
CONSTRAINT PK__sys_dict__3213E83F527BBC48 PRIMARY KEY (id)
);
-- Extended properties
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典表', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数据值', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'value';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'标签名', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'label';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类型', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'type';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'description';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序(升序)', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'sort';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'create_by';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'create_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新人', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'last_update_by';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'last_update_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注信息', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'remarks';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否删除 -1:已删除 0:正常', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'del_flag';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态(0正常 1停用)', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'status';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'父id:0最高级', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'sys_dict', @level2type=N'Column', @level2name=N'parent_id';
-- 2024-08-22
-- 资产设备管理
create table devices_manage
(
id bigint identity primary key not null, -- id
device_name nvarchar(100) null, -- 设备名称
device_brand nvarchar(100) null, -- 设备品牌
em_brand nvarchar(100) null, -- 机电品牌
rated_input_power numeric(24, 2) null, -- 额定输入功率
rated_refrigeration_capacity numeric(24, 2) null, -- 额定制冷量
rated_cop numeric(24, 2) null, -- 额定COP
rated_flow numeric(24, 2) null, -- 额定流量
production_time datetime null, -- 生产日期
create_time datetime null, -- 创建时间
update_time datetime null, -- 更新时间
create_by nvarchar(50) null, -- 创建人
is_frequency bit null, -- 是否变频
device_type bigint null, -- 设备类型id(字典配置)
system_id bigint null, -- 项目类型id
remark nvarchar(255) null, -- 备注
grade int null -- 保留
)
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'资产设备管理', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设备名称', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'device_name';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设备品牌', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'device_brand';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'机电品牌', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'em_brand';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'额定输入功率', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'rated_input_power';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'额定制冷量', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'rated_refrigeration_capacity';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'额定COP', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'rated_cop';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'额定流量', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'rated_flow';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'生产日期', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'production_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'create_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'update_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'create_by';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否变频', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'is_frequency';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设备类型id(字典配置)', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'device_type';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'项目类型id', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'system_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'remark';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数据标识', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'grade';
-- 仪表管理
create table meter_manage (
id bigint identity primary key not null, -- 编号
mt_type bigint null, -- 仪表类型(从字典值获取)
mt_name nvarchar(100) null, -- 仪表名称
other_name nvarchar(100) null, -- 仪表别名
mt_brand nvarchar(100) null, -- 仪表品牌
mt_num nvarchar(20) null, -- 仪表表面号
mt_code nvarchar(20) null, -- 仪表采集码
register_addr nvarchar(20), -- 寄存器地址
func_code nvarchar(20) null, -- 功能码
identify_code nvarchar(20) null, -- 仪表识别码
mt_caliber_pulse nvarchar(20) null, -- 仪表口径或者脉冲常数
mt_range numeric(24,3) null, -- 仪表范围
mt_ratio int null, -- 仪表倍率
mt_init_value numeric(24,3) null, -- 初始值
digits int null, -- 小数位数
data_type int null, -- 数据类型16位、32位、64位
cur_value numeric(24,3) null, -- 当前值
cur_time datetime null, -- 当前值时间
mt_is_sum bit null, -- 是否总表
create_time datetime null, -- 创建时间
update_time datetime null, -- 更新时间
unit nvarchar(20) null, -- 单位
sort bigint null, -- 排序
data_com nvarchar(100) null, -- 通信端口
device_id bigint null, -- 对应device_manage的id
gateway_id bigint null, -- 对应网关管理表gateway_manage的id
param_id bigint null, -- 对应参数id
protocol_type bigint null, -- 协议类型(字典表)
communication_type int NULL, -- 通讯方式
remark nvarchar(255) null, -- 备注
system_id bigint null, -- 项目类型id
grade int null -- 保留
)
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表管理', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表类型(从字典值获取)', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_type_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表名称', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_name';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表别名', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'other_name';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表品牌', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_brand';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表表面号', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_num';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表采集码', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_code';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'寄存器地址', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'register_addr';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'功能码', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'func_code';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表识别码', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'identify_code';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表口径或者脉冲常数', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_caliber_pulse';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表范围', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_range';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表倍率', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_ratio';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'初始值', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'mt_init_value';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'小数位数', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'meter_manage', @level2type=N'Column', @level2name=N'digits';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数据类型16位、32位、64位', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'data_type';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'当前值', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'cur_value';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'当前值时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'cur_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否总表', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'mt_is_sum';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'create_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'update_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'单位', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'unit';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'sort';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'对应device_manage的id', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'device_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'对应网关管理表gateway_manage的id', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'gateway_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'对应参数id', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'param_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'协议类型(字典表)', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'protocol_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'通讯方式', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'communication_type';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'remark';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'项目类型ID', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'system_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'保留', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'grade';
-- 网关管理表
CREATE TABLE gateway_manage (
id bigint identity(1,1) NOT NULL,
gw_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
gw_ip varchar(20) COLLATE Chinese_PRC_CI_AS NULL,
gw_addr varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
port int NULL,
collection_loop int NULL,
create_time datetime NULL,
update_time datetime NULL,
connect_time datetime NULL,
internet_card varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
operator_type int NULL,
remark varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
communication_type int NULL,
grade int NULL,
system_id bigint null, -- 项目类型id
CONSTRAINT pk_gateway_manage PRIMARY KEY (id)
);
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网关管理', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网关名称', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'gw_name';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网关IP地址', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'gw_ip';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网关对应的编号地址', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'gw_addr';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'网关端口', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'port';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'采集周期', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'collection_loop';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'create_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'update_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'连接时间', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'connect_time';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'卡号', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'internet_card';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'运营商类型 0:中国移动 1:中国联通 2:中国电信', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'operator_type';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'remark';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'通信类型(字典表)', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'communication_type_id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'预留字段', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'grade';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'项目类型id', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'gateway_manage', @level2type=N'Column', @level2name=N'system_id';
-- 设备采集参数表
create table device_params(
id bigint primary key identity(1,1) not null, -- 编号
mt_type int not null, -- 仪表类型(从字典表中拿)
baud_rate int not null, -- 波特率
data_bit int not null, -- 数据位
stop_bit int not null, -- 停止位
parity nvarchar(10) not null, -- 校验位
remark varchar(100) null -- 备注
)
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设备采集参数表', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编号', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params', @level2type=N'Column', @level2name=N'id';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'仪表类型(从字典中获取)', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params', @level2type=N'Column', @level2name=N'mt_type';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'波特率', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params', @level2type=N'Column', @level2name=N'baud_rate';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'数据位', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params', @level2type=N'Column', @level2name=N'data_bit';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'停止位', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params', @level2type=N'Column', @level2name=N'stop_bit';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'校验位', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params', @level2type=N'Column', @level2name=N'parity';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'device_params', @level2type=N'Column', @level2name=N'remark';
-- 2024-08-22

22
common/pom.xml

@ -30,12 +30,28 @@
<version>2.0.51</version> <version>2.0.51</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>pagehelper</artifactId>
<version>1.2.13</version> <version>6.1.0</version>
<exclusions>
<exclusion>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>sqlparser4.5</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>sqlparser-timeout</artifactId>
<version>6.1.0</version>
</dependency>
<!-- web --> <!-- web -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

6
common/src/main/java/com/mh/common/page/MybatisPageHelper.java

@ -39,7 +39,9 @@ public class MybatisPageHelper {
// 设置分页参数 // 设置分页参数
int pageNum = pageRequest.getPageNum(); int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize(); int pageSize = pageRequest.getPageSize();
PageHelper.startPage(pageNum, pageSize); if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
// 利用反射调用查询方法 // 利用反射调用查询方法
Object result = ReflectionUtils.invoke(mapper, queryMethodName, args); Object result = ReflectionUtils.invoke(mapper, queryMethodName, args);
return getPageResult(pageRequest, new PageInfo((List) result)); return getPageResult(pageRequest, new PageInfo((List) result));
@ -50,7 +52,7 @@ public class MybatisPageHelper {
* @param pageRequest * @param pageRequest
* @return * @return
*/ */
private static PageResult getPageResult(PageRequest pageRequest, PageInfo<?> pageInfo) { public static PageResult getPageResult(PageRequest pageRequest, PageInfo<?> pageInfo) {
PageResult pageResult = new PageResult(); PageResult pageResult = new PageResult();
pageResult.setPageNum(pageInfo.getPageNum()); pageResult.setPageNum(pageInfo.getPageNum());
pageResult.setPageSize(pageInfo.getPageSize()); pageResult.setPageSize(pageInfo.getPageSize());

25
common/src/main/java/com/mh/common/utils/FileUtils.java

@ -1,11 +1,10 @@
package com.mh.common.utils; package com.mh.common.utils;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream; import java.io.*;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
/** /**
* 文件相关操作 * 文件相关操作
@ -39,4 +38,20 @@ public class FileUtils {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static String convertFileToBase64(MultipartFile file) {
byte[] data = null;
// 读取文件字节数组
try {
InputStream in = file.getInputStream();
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
// 对字节数组进行编码,得到base64编码字符串
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
}
} }

17
common/src/main/java/com/mh/common/utils/StringUtils.java

@ -1,5 +1,8 @@
package com.mh.common.utils; package com.mh.common.utils;
import com.mh.common.page.ColumnFilter;
import com.mh.common.page.PageRequest;
/** /**
* 字符串工具类 * 字符串工具类
* @author Louis * @author Louis
@ -16,4 +19,18 @@ public class StringUtils {
return value == null || "".equals(value) || "null".equals(value) || "undefined".equals(value); return value == null || "".equals(value) || "null".equals(value) || "undefined".equals(value);
} }
/**
* 获取过滤字段的值
* @param filterName
* @return
*/
public static String getColumnFilterValue(PageRequest pageRequest, String filterName) {
String value = null;
ColumnFilter columnFilter = pageRequest.getColumnFilter(filterName);
if(columnFilter != null) {
value = columnFilter.getValue();
}
return value;
}
} }

26
pom.xml

@ -34,16 +34,16 @@
<groupId>org.jolokia</groupId> <groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId> <artifactId>jolokia-core</artifactId>
</dependency> </dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>--> <!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger2</artifactId>--> <!-- <artifactId>springfox-swagger2</artifactId>-->
<!-- <version>${swagger.version}</version>--> <!-- <version>${swagger.version}</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>--> <!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger-ui</artifactId>--> <!-- <artifactId>springfox-swagger-ui</artifactId>-->
<!-- <version>${swagger.version}</version>--> <!-- <version>${swagger.version}</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId> <artifactId>spring-boot-starter-aop</artifactId>
@ -59,6 +59,12 @@
<artifactId>purejavacomm</artifactId> <artifactId>purejavacomm</artifactId>
<version>1.0.1.RELEASE</version> <version>1.0.1.RELEASE</version>
</dependency> </dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.15.3</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>

11
user-service/pom.xml

@ -88,9 +88,16 @@
<!-- </dependency>--> <!-- </dependency>-->
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version> <version>3.5.7</version>
<exclusions>
<exclusion>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- mysql数据库链接--> <!-- mysql数据库链接-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>mysql</groupId>--> <!-- <groupId>mysql</groupId>-->

2
user-service/src/main/java/com/mh/user/UserServiceApplication.java

@ -1,6 +1,7 @@
package com.mh.user; package com.mh.user;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
@ -11,6 +12,7 @@ import javax.annotation.PreDestroy;
@Slf4j @Slf4j
@SpringBootApplication(scanBasePackages = "com.mh.user") @SpringBootApplication(scanBasePackages = "com.mh.user")
@EnableScheduling @EnableScheduling
@MapperScan("com.mh.user.mapper")
public class UserServiceApplication extends SpringBootServletInitializer { public class UserServiceApplication extends SpringBootServletInitializer {
@Override @Override

296
user-service/src/main/java/com/mh/user/controller/DeviceManageController.java

@ -1,296 +0,0 @@
//package com.mh.user.controller;
//
//import com.alibaba.fastjson.JSONObject;
//import com.mh.common.http.HttpResult;
//import com.mh.user.dto.DeviceMessageDTO;
//import com.mh.user.entity.*;
//import com.mh.user.manage.QuartzManager;
//import com.mh.user.service.chillers.DeviceDisplayService;
//import com.mh.user.constants.Constant;
//import com.mh.user.service.chillers.DeviceManageService;
//import com.mh.user.service.chillers.DeviceParamService;
//import com.mh.user.service.chillers.GatewayManageService;
//import com.mh.user.utils.GetReadOrder485;
//import com.mh.user.utils.QuerySendThread;
//import com.mh.user.constants.SocketMessage;
//import com.mh.user.utils.TimeDifferenceUtil;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import java.text.ParseException;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author ljf
// * @title :
// * @description : 设备管理接口
// * @updateTime 2020-05-29
// * @updateTime 2020-07-17
// * @throws :
// */
//@RestController
//public class DeviceManageController {
//
// private final DeviceDisplayService deviceDisplayService;
// private final GatewayManageService gatewayManageService;
// private final DeviceManageService deviceManageService;
// private final DeviceParamService deviceParamService;
//
// public DeviceManageController(DeviceDisplayService deviceDisplayService, GatewayManageService gatewayManageService, DeviceManageService deviceManageService, DeviceParamService deviceParamService) {
// this.deviceDisplayService = deviceDisplayService;
// this.gatewayManageService = gatewayManageService;
// this.deviceManageService = deviceManageService;
// this.deviceParamService = deviceParamService;
// }
//
// @Resource
// QuartzManager quartzManager;
//
// @Autowired
// private SocketMessage socketMessage;
//
// // 查询设备信息状态
// @GetMapping("/operation/getColdStation")
// public HttpResult getColdStation(@RequestParam(value = "deviceType", required = true) String deviceType) {
// List<DeviceMessageDTO> deviceMessageList = deviceDisplayService.queryDeviceStatus(deviceType);
// Map<String, Object> formValues = new HashMap<>();
// formValues.put("formValues",deviceMessageList);
// return HttpResult.ok("success", formValues);
// }
//
// // 对设备进行操作处理
// @PostMapping("/operation/operationDevice")
// public HttpResult operationDevice(@RequestBody List<OrderEntity> changeValues) {
// String result;
// try {
// List<OrderMessageEntity> orderMessageEntityList;
// // type值 0:修改频率, 1:修改开关状态, 2: 关闭冷却泵之前,查询最近关闭的冷却塔时间,3: 群控手自动切换类型,4: 修改温度, 5: 修改压力
//// // 添加网页发送指令状态 update by ljf on 2020-08-07
// Constant.CONTROL_WEB_FLAG = true;
// // 暂停采集
//// quartzManager.pauseJob("DDC","JobDDCGroup");
//// Thread.sleep(2000);
// // 修改成不用暂停采集处理
// GetReadOrder485 getReadOrder485 = new GetReadOrder485();
// // 判断是否是去关闭冷却泵,如果是,需要检查最近冷却塔有没有关闭并且关闭时间大于8分钟
// // 判断changeValues大小
// int size = changeValues.size();
// int type = changeValues.get(0).getType();
// if (type == 3 && size == 1) {
// // 生成指令
// orderMessageEntityList = getReadOrder485.createOrder(changeValues);
// if (orderMessageEntityList.size() != 0) {
// // 开启发送指令
// NettyChillerControlClient nettyChillerControlClient = new NettyChillerControlClient();
//// nettyChillerControlClient.connect(8081, "192.168.1.131", orderMessageEntityList);
// nettyChillerControlClient.connect(socketMessage.getPort(), socketMessage.getIP(), orderMessageEntityList);
// // 开启线程监测标志
// QuerySendThread querySendThread = new QuerySendThread();
// querySendThread.start();
// if (Constant.SEND_STATUS) {
// result = "success";
// } else {
// result = "fail";
// }
// } else {
// result = "fail";
// }
// } else if (type == 2 && size == 1) {
// TimeDifferenceUtil timeDifferenceUtil = new TimeDifferenceUtil();
// Boolean a = timeDifferenceUtil.timeDifference(socketMessage.getOverTime());
// if (a) {
// // 生成指令
// orderMessageEntityList = getReadOrder485.createOrder(changeValues);
// if (orderMessageEntityList.size() != 0) {
// // 开启发送指令
// NettyChillerControlClient nettyChillerControlClient = new NettyChillerControlClient();
//// nettyChillerControlClient.connect(8081, "192.168.1.131", orderMessageEntityList);
// nettyChillerControlClient.connect(socketMessage.getPort(), socketMessage.getIP(), orderMessageEntityList);
// // 开启线程监测标志
// QuerySendThread querySendThread = new QuerySendThread();
// querySendThread.start();
// if (Constant.SEND_STATUS) {
// result = "success";
// } else {
// result = "fail";
// }
// } else {
// result = "fail";
// }
// } else {
// result = "冷却塔关机还没有超过8分钟";
// }
// } else {
// // 生成指令
// orderMessageEntityList = getReadOrder485.createOrder(changeValues);
// if (orderMessageEntityList.size() != 0) {
// // 开启发送指令
// NettyChillerControlClient nettyChillerControlClient = new NettyChillerControlClient();
//// nettyChillerControlClient.connect(8081, "192.168.1.131", orderMessageEntityList);
// nettyChillerControlClient.connect(socketMessage.getPort(), socketMessage.getIP(), orderMessageEntityList);
// // 开启线程监测标志
// QuerySendThread querySendThread = new QuerySendThread();
// querySendThread.start();
// if (Constant.SEND_STATUS) {
// result = "success";
// } else {
// result = "fail";
// }
// } else {
// result = "fail";
// }
// }
// Constant.CONTROL_WEB_FLAG = false;
// // 不需要停止采集
//// Constant.WEB_FLAG = false;
//// // 延迟5秒处理,等待线程处理数据
// Thread.sleep(500);
//// // 重新开启定时采集
//// quartzManager.resumeAllJob();
//// quartzManager.resumeJob("DDC","JobDDCGroup");
// } catch (InterruptedException | ParseException e) {
// e.printStackTrace();
// result = "fail";
// }
// // 异常情况处理
// return HttpResult.ok(result);
// }
//
// /**
// * 查询网关信息
// * @param requestJson
// * @return
// */
// @PostMapping("/gateWay/getGateWayList")
// public HttpResult gateWayList(@RequestBody String requestJson){
// JSONObject jsonObject =JSONObject.parseObject(requestJson);
// Integer operator = null;
// Integer grade = null;
// if(jsonObject.get("operator") != null){
// if(jsonObject.get("operator").equals("中国移动")){
// operator = 0;
// }else if(jsonObject.get("operator").equals("中国联通")){
// operator = 1;
// }else if(jsonObject.get("operator").equals("中国电信")){
// operator = 2;
// }
// }
// if(jsonObject.get("grade") != null){
// if(jsonObject.get("grade").equals("正常")){
// grade = 0;
// }else if(jsonObject.get("grade").equals("不在线")){
// grade = 1;
// }else if(jsonObject.get("grade").equals("异常")){
// grade = 2;
// }
// }
// List<GatewayManageEntity> gateWayList = gatewayManageService.queryByOther(grade,operator);
// JSONObject tableData = new JSONObject();
// tableData.put("tableData",gateWayList);
// return HttpResult.ok(tableData);
//// System.out.println(requestJson);
//// return null;
// }
//
// /**
// * 新增或更新网关信息
// * @param reqestJson
// * @return
// */
// @PostMapping("/gateWay/addOrUpdateGateWayInfo")
// public HttpResult addOrUpdateGateWayInfo(@RequestBody GatewayManageEntity reqestJson){
// try {
// System.out.println(reqestJson.toString());
// gatewayManageService.addOrUpdateGateWayInfo(reqestJson);
// return HttpResult.ok();
// } catch (Exception e) {
// e.printStackTrace();
// return HttpResult.error(e.getMessage());
// }
// }
//
// /**
// * 删除网关/基表/基表参数信息
// * @param requestJson
// * @return
// */
// @PostMapping("/device/deleteDeviceInfo")
// public HttpResult deleteDeviceInfo(@RequestBody String requestJson){
// JSONObject jsonObject =JSONObject.parseObject(requestJson);
// System.out.println(jsonObject.get("deviceId"));
// try {
// deviceManageService.deleteDeviceInfo((Integer)jsonObject.get("deviceId"),jsonObject.get("deviceType").toString());
// return HttpResult.ok();
// } catch (Exception e) {
// e.printStackTrace();
// return HttpResult.error(e.getMessage());
// }
// }
//
// /**
// * 查询基表管理中的基表数据
// * @param requestJson
// * @return
// */
// @PostMapping("/baseMeter/getBaseMeterList")
// public HttpResult getBaseMeterList(@RequestBody String requestJson){
// JSONObject jsonObject =JSONObject.parseObject(requestJson);
// List<DeviceManageEntity> list = deviceManageService.getDeviceByOther(jsonObject.get("deviceNum").toString());
// JSONObject tableData = new JSONObject();
// tableData.put("tableData",list);
// return HttpResult.ok(tableData);
// }
//
// /**
// * 增加或更新基表信息数据
// * @param requestJson
// * @return
// */
// @PostMapping("/baseMeter/addOrUpdateBaseMeter")
// public HttpResult addOrUpdateBaseMeter(@RequestBody DeviceManageEntity requestJson){
// try {
// deviceManageService.addOrUpdateBaseMeter(requestJson);
// return HttpResult.ok();
// } catch (Exception e) {
// e.printStackTrace();
// return HttpResult.error("检查输入的设备码是否有误!");
// }
// }
//
// /**
// * 查询基表参数管理中的基表参数数据
// * @param requestJson
// * @return
// */
// @PostMapping("/baseMeterParam/getBaseMeterParamList")
// public HttpResult getBaseMeterParamList(@RequestBody String requestJson){
// JSONObject jsonObject =JSONObject.parseObject(requestJson);
// System.out.println(jsonObject.get("baseMeterType"));
// String baseMeterType = (String) jsonObject.get("baseMeterType");
// List<DeviceParameterEntity> list = deviceParamService.getBaseMeterParamList(baseMeterType);
// JSONObject tableData = new JSONObject();
// tableData.put("tableData",list);
// return HttpResult.ok(tableData);
// }
//
// /**
// * 添加或更新基表参数信息
// * @param requestJson
// * @return
// */
// @PostMapping("/baseMeterParam/addOrUpdateBaseMeterParam")
// public HttpResult addOrUpdateBaseMeterParam(@RequestBody DeviceParameterEntity requestJson){
// try {
// deviceParamService.addOrUpdateBaseMeterParam(requestJson);
// return HttpResult.ok();
// } catch (Exception e) {
// e.printStackTrace();
// return HttpResult.error(e.getMessage());
// }
// }
//
//
//}

60
user-service/src/main/java/com/mh/user/controller/DevicesManageController.java

@ -0,0 +1,60 @@
package com.mh.user.controller;
import com.mh.common.http.HttpResult;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.user.annotation.SysLogger;
import com.mh.user.entity.DevicesManageEntity;
import com.mh.user.service.DevicesManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 仪表管理控制层
* @date 2024-08-23 08:53:03
*/
@RestController
@RequestMapping("/devicesManage")
public class DevicesManageController {
@Autowired
private DevicesManageService devicesManageService;
@SysLogger(value="资产管理信息",optDesc = "查询资产管理信息")
@PostMapping("/findByPage")
public PageResult queryGatewayManage(@RequestBody PageRequest pageRequest) {
return devicesManageService.queryByPage(pageRequest);
}
@SysLogger(value="资产管理信息",optDesc = "编辑资产管理信息")
@PostMapping("/update")
public HttpResult updateProInfo(DevicesManageEntity entity) {
devicesManageService.update(entity);
return HttpResult.ok();
}
@SysLogger(value="资产管理信息",optDesc = "根据项目id查询对应信息")
@GetMapping("/findById")
public HttpResult findById(@RequestParam("id") Integer id) {
DevicesManageEntity entity = devicesManageService.findById(id);
return HttpResult.ok(entity);
}
@SysLogger(value="资产管理信息",optDesc = "添加资产管理信息")
@PostMapping("/save")
public HttpResult saveGw(DevicesManageEntity entity) {
devicesManageService.save(entity);
return HttpResult.ok();
}
@SysLogger(value="资产管理信息",optDesc = "删除资产管理信息")
@GetMapping("/deleteById")
public HttpResult deleteProInfo(@RequestParam String id) {
devicesManageService.delete(id);
return HttpResult.ok();
}
}

60
user-service/src/main/java/com/mh/user/controller/DevicesParamsController.java

@ -0,0 +1,60 @@
package com.mh.user.controller;
import com.mh.common.http.HttpResult;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.user.annotation.SysLogger;
import com.mh.user.entity.DeviceParamsEntity;
import com.mh.user.service.DeviceParamsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 设备参数管理控制层
* @date 2024-08-23 08:53:03
*/
@RestController
@RequestMapping("/deviceParams")
public class DevicesParamsController {
@Autowired
private DeviceParamsService deviceParamsService;
@SysLogger(value="资产管理信息",optDesc = "查询资产管理信息")
@PostMapping("/findByPage")
public PageResult queryGatewayManage(@RequestBody PageRequest pageRequest) {
return deviceParamsService.queryByPage(pageRequest);
}
@SysLogger(value="资产管理信息",optDesc = "编辑资产管理信息")
@PostMapping("/update")
public HttpResult updateProInfo(DeviceParamsEntity entity) {
deviceParamsService.update(entity);
return HttpResult.ok();
}
@SysLogger(value="资产管理信息",optDesc = "根据项目id查询对应信息")
@GetMapping("/findById")
public HttpResult findById(@RequestParam("id") Integer id) {
DeviceParamsEntity entity = deviceParamsService.findById(id);
return HttpResult.ok(entity);
}
@SysLogger(value="资产管理信息",optDesc = "添加资产管理信息")
@PostMapping("/save")
public HttpResult saveGw(DeviceParamsEntity entity) {
deviceParamsService.save(entity);
return HttpResult.ok();
}
@SysLogger(value="资产管理信息",optDesc = "删除资产管理信息")
@GetMapping("/deleteById")
public HttpResult deleteProInfo(@RequestParam String id) {
deviceParamsService.delete(id);
return HttpResult.ok();
}
}

61
user-service/src/main/java/com/mh/user/controller/GatewayManageController.java

@ -0,0 +1,61 @@
package com.mh.user.controller;
import com.mh.common.http.HttpResult;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.user.annotation.SysLogger;
import com.mh.user.entity.GatewayManageEntity;
import com.mh.user.service.GatewayManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 网关管理接口控制类
* @date 2024-08-22 17:19:21
*/
@RestController
@RequestMapping("/gw")
public class GatewayManageController {
@Autowired
private GatewayManageService gatewayManageService;
@SysLogger(value="网关管理信息",optDesc = "查询网关管理信息")
@PostMapping("/findByPage")
public PageResult queryGatewayManage(@RequestBody PageRequest pageRequest) {
return gatewayManageService.queryByPage(pageRequest);
}
@SysLogger(value="网关管理信息",optDesc = "编辑网关管理信息")
@PostMapping("/update")
public HttpResult updateProInfo(GatewayManageEntity gatewayManageEntity) {
gatewayManageService.update(gatewayManageEntity);
return HttpResult.ok();
}
@SysLogger(value="网关管理信息",optDesc = "根据项目id查询对应信息")
@GetMapping("/findById")
public HttpResult findById(@RequestParam("id") Integer id) {
GatewayManageEntity gatewayManageEntity = gatewayManageService.findById(id);
return HttpResult.ok(gatewayManageEntity);
}
@SysLogger(value="网关管理信息",optDesc = "添加网关管理信息")
@PostMapping("/save")
public HttpResult saveGw(GatewayManageEntity gatewayManageEntity) {
gatewayManageService.save(gatewayManageEntity);
return HttpResult.ok();
}
@SysLogger(value="网关管理信息",optDesc = "删除网关管理信息")
@GetMapping("/deleteById")
public HttpResult deleteProInfo(@RequestParam String id) {
gatewayManageService.delete(id);
return HttpResult.ok();
}
}

60
user-service/src/main/java/com/mh/user/controller/MeterManageController.java

@ -0,0 +1,60 @@
package com.mh.user.controller;
import com.mh.common.http.HttpResult;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.user.annotation.SysLogger;
import com.mh.user.entity.MeterManageEntity;
import com.mh.user.service.MeterManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 仪表管理控制层
* @date 2024-08-23 08:53:03
*/
@RestController
@RequestMapping("/mtManage")
public class MeterManageController {
@Autowired
private MeterManageService meterManageService;
@SysLogger(value="仪表管理信息",optDesc = "查询仪表管理信息")
@PostMapping("/findByPage")
public PageResult queryGatewayManage(@RequestBody PageRequest pageRequest) {
return meterManageService.queryByPage(pageRequest);
}
@SysLogger(value="仪表管理信息",optDesc = "编辑仪表管理信息")
@PostMapping("/update")
public HttpResult updateProInfo(MeterManageEntity entity) {
meterManageService.update(entity);
return HttpResult.ok();
}
@SysLogger(value="仪表管理信息",optDesc = "根据项目id查询对应信息")
@GetMapping("/findById")
public HttpResult findById(@RequestParam("id") Integer id) {
MeterManageEntity entity = meterManageService.findById(id);
return HttpResult.ok(entity);
}
@SysLogger(value="仪表管理信息",optDesc = "添加仪表管理信息")
@PostMapping("/save")
public HttpResult saveGw(MeterManageEntity entity) {
meterManageService.save(entity);
return HttpResult.ok();
}
@SysLogger(value="仪表管理信息",optDesc = "删除仪表管理信息")
@GetMapping("/deleteById")
public HttpResult deleteProInfo(@RequestParam String id) {
meterManageService.delete(id);
return HttpResult.ok();
}
}

46
user-service/src/main/java/com/mh/user/controller/ProjectInfoController.java

@ -1,14 +1,13 @@
package com.mh.user.controller; package com.mh.user.controller;
import com.mh.common.http.HttpResult; import com.mh.common.http.HttpResult;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.user.annotation.SysLogger; import com.mh.user.annotation.SysLogger;
import com.mh.user.entity.ProjectInfoEntity; import com.mh.user.entity.ProjectInfoEntity;
import com.mh.user.service.ProjectInfoService; import com.mh.user.service.ProjectInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -20,10 +19,45 @@ public class ProjectInfoController {
ProjectInfoService projectInfoService; ProjectInfoService projectInfoService;
@SysLogger(value="项目信息",optDesc = "查询项目信息") @SysLogger(value="项目信息",optDesc = "查询项目信息")
@PostMapping("/queryPro") @PostMapping("/queryProBySystemId")
public HttpResult queryProject(@RequestParam(value = "systemId")String systemID) { public HttpResult queryProBySystemId(@RequestParam(value = "systemId")String systemID) {
List<ProjectInfoEntity> list=projectInfoService.queryProjectInfo(systemID); List<ProjectInfoEntity> list=projectInfoService.queryProjectInfo(systemID);
return HttpResult.ok(list); return HttpResult.ok(list);
} }
@SysLogger(value="项目信息",optDesc = "查询项目信息")
@PostMapping("/findByPage")
public PageResult queryProject(@RequestBody PageRequest pageRequest) {
return projectInfoService.queryByPage(pageRequest);
}
@SysLogger(value="项目信息",optDesc = "编辑项目信息")
@PostMapping("/update")
public HttpResult updateProInfo(ProjectInfoEntity projectInfoEntity) {
projectInfoService.update(projectInfoEntity);
return HttpResult.ok();
}
@SysLogger(value="项目信息",optDesc = "根据项目id查询对应信息")
@GetMapping("/findById")
public HttpResult findById(@RequestParam("id") Integer id) {
ProjectInfoEntity projectInfoEntity = projectInfoService.findById(id);
return HttpResult.ok(projectInfoEntity);
}
@SysLogger(value="项目信息",optDesc = "添加项目信息")
@PostMapping("/save")
public HttpResult saveProInfo(ProjectInfoEntity projectInfoEntity) {
projectInfoService.save(projectInfoEntity);
return HttpResult.ok();
}
@SysLogger(value="项目信息",optDesc = "删除项目信息")
@GetMapping("/deleteById")
public HttpResult deleteProInfo(@RequestParam String id) {
projectInfoService.delete(id);
return HttpResult.ok();
}
} }

60
user-service/src/main/java/com/mh/user/controller/SysDictController.java

@ -0,0 +1,60 @@
package com.mh.user.controller;
import com.mh.common.http.HttpResult;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.user.annotation.SysLogger;
import com.mh.user.model.SysDict;
import com.mh.user.service.SysDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 系统字典管理
* @date 2024-08-23 10:59:09
*/
@RestController
@RequestMapping("/dict")
public class SysDictController {
@Autowired
private SysDictService sysDictService;
@SysLogger(value="系统字典管理",optDesc = "查询系统字典管理")
@PostMapping("/findByPage")
public PageResult queryGatewayManage(@RequestBody PageRequest pageRequest) {
return sysDictService.findPage(pageRequest);
}
@SysLogger(value="系统字典管理",optDesc = "编辑系统字典管理")
@PostMapping("/update")
public HttpResult update(SysDict entity) {
sysDictService.updateByPrimaryKey(entity);
return HttpResult.ok();
}
@SysLogger(value="系统字典管理",optDesc = "根据项目id查询对应信息")
@GetMapping("/findById")
public HttpResult findById(@RequestParam("id") Long id) {
SysDict entity = sysDictService.findById(id);
return HttpResult.ok(entity);
}
@SysLogger(value="系统字典管理",optDesc = "添加系统字典管理")
@PostMapping("/save")
public HttpResult save(SysDict entity) {
sysDictService.save(entity);
return HttpResult.ok();
}
@SysLogger(value="系统字典管理",optDesc = "删除系统字典管理")
@GetMapping("/deleteById")
public HttpResult delete(@RequestParam Long id) {
sysDictService.deleteByPrimaryKey(id);
return HttpResult.ok();
}
}

3
user-service/src/main/java/com/mh/user/entity/BaseEntity.java

@ -1,6 +1,8 @@
package com.mh.user.entity; package com.mh.user.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -21,6 +23,7 @@ public class BaseEntity implements Serializable {
static final long serialVersionUID = 42L; static final long serialVersionUID = 42L;
@TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")

69
user-service/src/main/java/com/mh/user/entity/DeviceParamsEntity.java

@ -0,0 +1,69 @@
package com.mh.user.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 设备采集参数实体类
* @date 2024-08-22 17:04:12
*/
@Setter
@Getter
@TableName("device_params")
public class DeviceParamsEntity {
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 仪表类型从字典表中拿
*/
private int mtType;
/**
* 波特率
*/
private int baudRate;
/**
* 数据位
*/
private int dataBit;
/**
* 停止位
*/
private int stopBit;
/**
* 校验位
*/
private String parity;
/**
* 备注
*/
private String remark;
@Override
public String toString() {
return "DeviceParamsEntity{" +
"id=" + id +
", mtType=" + mtType +
", baudRate=" + baudRate +
", dataBit=" + dataBit +
", stopBit=" + stopBit +
", parity=" + parity +
", remark='" + remark + '\'' +
'}';
}
}

142
user-service/src/main/java/com/mh/user/entity/DevicesManageEntity.java

@ -0,0 +1,142 @@
package com.mh.user.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 资产设备管理
* @date 2024-08-22 16:11:30
*/
@Setter
@Getter
@TableName("devices_manage")
public class DevicesManageEntity implements Serializable {
/**
* 编号
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 设备名称
*/
private String deviceName;
/**
* 设备品牌
*/
private String deviceBrand;
/**
* 机电品牌
*/
private String emBrand;
/**
* 额定输入功率
*/
private BigDecimal ratedInputPower;
/**
* 额定制冷量
*/
private BigDecimal ratedRefrigerationCapacity;
/**
* 额定COP
*/
private BigDecimal ratedCop;
/**
* 额定流量
*/
private BigDecimal ratedFlow;
/**
* 生产日期
*/
private String productionTime;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/**
* 创建人
*/
private String createBy;
/**
* 是否变频
*/
private byte isFrequency;
/**
* 设备类型
*/
private long deviceType;
/**
* 备注
*/
private String remark;
/**
* 等级
*/
private int grade;
/**
* 系统类型id
*/
private Long systemId;
/**
* 项目id
*/
private Long projectId;
@Override
public String toString() {
return "DevicesManageEntity{" +
"id=" + id +
", deviceName='" + deviceName + '\'' +
", deviceBrand='" + deviceBrand + '\'' +
", emBrand='" + emBrand + '\'' +
", ratedInputPower=" + ratedInputPower +
", ratedRefrigerationCapacity=" + ratedRefrigerationCapacity +
", ratedCop=" + ratedCop +
", ratedFlow=" + ratedFlow +
", productionTime=" + productionTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createBy='" + createBy + '\'' +
", isFrequency=" + isFrequency +
", deviceType=" + deviceType +
", remark='" + remark + '\'' +
", grade=" + grade +
", systemId=" + systemId +
", projectId=" + projectId +
'}';
}
}

26
user-service/src/main/java/com/mh/user/entity/GatewayManageEntity.java

@ -1,5 +1,6 @@
package com.mh.user.entity; package com.mh.user.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -18,19 +19,22 @@ import java.util.Date;
@Setter @Setter
@Getter @Getter
@ToString @ToString
@TableName("gateway_manage")
public class GatewayManageEntity extends BaseEntity { public class GatewayManageEntity extends BaseEntity {
private String gatewayName; // 网关名称 private String gwName; // 网关名称
private String gatewayIp; // 网关IP地址 private String gwIp; // 网关IP地址
private String gatewayAddress; // 网关安装地址 private String gwAddr; // 网关安装地址
private String dataCom; // 串口号 private int port; // 端口号
private String createDate; // 安装时间 private int collectionLoop; // 采集周期
private String connectDate; // 最新上线连接时间 private Date connectTime; // 最新上线连接时间
private int grade; // 标志位(连接状态) 0:正常;1:不在线;2:异常 private String internetCard; // 物联网卡号
private String internetCard; // 物联网卡号 private int operatorType; // 0:中国移动 1:中国联通 2:中国电信
private int operator; //0:中国移动 1:中国联通 2:中国电信 private int communicationType; // 通讯类型
private int gatewayPort; // 端口号 private String remark; // 备注
private String type; // 操作类型 private int grade; // 标志位(连接状态) 0:正常;1:不在线;2:异常
private Long systemId; // 系统类型id
private Long projectId; // 项目类型id
} }

228
user-service/src/main/java/com/mh/user/entity/MeterManageEntity.java

@ -0,0 +1,228 @@
package com.mh.user.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 仪表管理
* @date 2024-08-22 16:35:19
*/
@Setter
@Getter
@TableName("meter_manage")
public class MeterManageEntity implements Serializable {
/**
* 编号
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 仪表类型
*/
private Long mtType;
/**
* 仪表名称
*/
private String mtName;
/**
* 其他名称
*/
private String otherName;
/**
* 仪表品牌
*/
private String mtBrand;
/**
* 仪表编号
*/
private String mtNum;
/**
* 仪表地址
*/
private String mtCode;
/**
* 寄存器地址
*/
private String registerAddr;
/**
* 功能码
*/
private String funcCode;
/**
* 数据标识码
*/
private String identifyCode;
/**
* 口径以及脉冲常数
*/
private String mtCaliberPulse;
/**
* 仪表范围
*/
private BigDecimal mtRange;
/**
* 仪表比例
*/
private int mtRatio;
/**
* 初始值
*/
private BigDecimal mtInitValue;
/**
* 保留位数
*/
private int digits;
/**
* 数据类型
*/
private int dataType;
/**
* 当前值
*/
private BigDecimal curValue;
/**
* 当前时间
*/
private Date curTime;
/**
* 是否是总表
*/
private byte mtIsSum;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 单位
*/
private String unit;
/**
* 排序
*/
private Long sort;
/**
* 通讯串口
*/
private String dataCom;
/**
* 设备id
*/
private Long deviceId;
/**
* 网关id
*/
private Long gatewayId;
/**
* 参数id
*/
private Long paramId;
/**
* 协议类型
*/
private Long protocolType;
/**
* 备注
*/
private String remark;
/**
* 保留位
*/
private int grade;
/**
* 系统类型id
*/
private Long systemId;
/**
* 项目id
*/
private Long projectId;
/**
* 通讯类型
*/
private Long communicationType;
@Override
public String toString() {
return "MeterManageEntity{" +
"id=" + id +
", mtType=" + mtType +
", mtName='" + mtName + '\'' +
", otherName='" + otherName + '\'' +
", mtBrand='" + mtBrand + '\'' +
", mtNum='" + mtNum + '\'' +
", mtCode='" + mtCode + '\'' +
", registerAddr='" + registerAddr + '\'' +
", funcCode='" + funcCode + '\'' +
", identifyCode='" + identifyCode + '\'' +
", mtCaliberPulse='" + mtCaliberPulse + '\'' +
", mtRange=" + mtRange +
", mtRatio=" + mtRatio +
", mtInitValue=" + mtInitValue +
", digits=" + digits +
", dataType=" + dataType +
", curValue=" + curValue +
", curTime=" + curTime +
", mtIsSum=" + mtIsSum +
", createTime=" + createTime +
", updateTime=" + updateTime +
", unit='" + unit + '\'' +
", sort=" + sort +
", dataCom='" + dataCom + '\'' +
", deviceId=" + deviceId +
", gatewayId=" + gatewayId +
", paramId=" + paramId +
", protocolType=" + protocolType +
", remark='" + remark + '\'' +
", grade=" + grade +
", systemId=" + systemId +
", projectId=" + projectId +
'}';
}
}

186
user-service/src/main/java/com/mh/user/entity/ProjectInfoEntity.java

@ -1,20 +1,192 @@
package com.mh.user.entity; package com.mh.user.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
import java.util.Date;
@TableName("project_info") @TableName("project_info")
@Data
public class ProjectInfoEntity { public class ProjectInfoEntity {
@TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
private String projectName; //项目名称
private String pAddress; //地址 @TableField("project_name")
private String projectName; //项目名称
@TableField("p_address")
private String pAddress; //地址
@TableField("p_scale")
private int pScale; private int pScale;
private String pic; //图片
private String tel; //电话 @TableField("pic")
private String systemId; //系统编号 private String pic; //图片地址
@TableField("pic_content")
private String picContent; // 图片内容
@TableField("tel")
private String tel; //电话
@TableField("system_id")
private String systemId; //系统编号
@TableField("remarks")
private String remarks; private String remarks;
/**
* 经度
*/
@TableField("longitude")
private BigDecimal longitude;
/**
* 纬度
*/
@TableField("latitude")
private BigDecimal latitude;
/**
* 创建时间
*/
@TableField("create_time")
private Date createTime;
/**
* 文件流
*/
@TableField(exist = false)
@JsonIgnore
private MultipartFile file;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getpAddress() {
return pAddress;
}
public void setpAddress(String pAddress) {
this.pAddress = pAddress;
}
public int getpScale() {
return pScale;
}
public void setpScale(int pScale) {
this.pScale = pScale;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public String getPicContent() {
return picContent;
}
public void setPicContent(String picContent) {
this.picContent = picContent;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getSystemId() {
return systemId;
}
public void setSystemId(String systemId) {
this.systemId = systemId;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public BigDecimal getLongitude() {
return longitude;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude() {
return latitude;
}
public void setLatitude(BigDecimal latitude) {
this.latitude = latitude;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public MultipartFile getFile() {
return file;
}
public void setFile(MultipartFile file) {
this.file = file;
}
@Override
public String toString() {
return "ProjectInfoEntity{" +
"id=" + id +
", projectName='" + projectName + '\'' +
", pAddress='" + pAddress + '\'' +
", pScale=" + pScale +
", pic='" + pic + '\'' +
", picContent='" + picContent + '\'' +
", tel='" + tel + '\'' +
", systemId='" + systemId + '\'' +
", remarks='" + remarks + '\'' +
", longitude=" + longitude +
", latitude=" + latitude +
", createTime=" + createTime +
", file=" + file +
'}';
}
} }

16
user-service/src/main/java/com/mh/user/mapper/DeviceParamsMapper.java

@ -0,0 +1,16 @@
package com.mh.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mh.user.entity.DeviceParamsEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 设备采集参数
* @date 2024-08-23 09:28:57
*/
@Mapper
public interface DeviceParamsMapper extends BaseMapper<DeviceParamsEntity> {
}

16
user-service/src/main/java/com/mh/user/mapper/DevicesManageMapper.java

@ -0,0 +1,16 @@
package com.mh.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mh.user.entity.DevicesManageEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 资产设备管理
* @date 2024-08-23 10:22:16
*/
@Mapper
public interface DevicesManageMapper extends BaseMapper<DevicesManageEntity> {
}

16
user-service/src/main/java/com/mh/user/mapper/MeterManageMapper.java

@ -0,0 +1,16 @@
package com.mh.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mh.user.entity.MeterManageEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 仪表管理对接数据库
* @date 2024-08-23 09:03:13
*/
@Mapper
public interface MeterManageMapper extends BaseMapper<MeterManageEntity> {
}

6
user-service/src/main/java/com/mh/user/mapper/ProjectInfoMapper.java

@ -18,8 +18,10 @@ public interface ProjectInfoMapper extends BaseMapper<ProjectInfoEntity> {
@Result(property="pic",column="pic"), @Result(property="pic",column="pic"),
@Result(property="tel",column="tel"), @Result(property="tel",column="tel"),
@Result(property="systemId",column="system_id"), @Result(property="systemId",column="system_id"),
@Result(property="remarks",column="remarks") @Result(property="remarks",column="remarks"),
@Result(property="createTime",column="create_time"),
@Result(property="longitude",column="longitude"),
@Result(property="latitude",column="latitude")
}) })
@Select("select * from project_info where system_id=#{systemID}") @Select("select * from project_info where system_id=#{systemID}")
List<ProjectInfoEntity> queryProjectInfo(@Param("systemID") String systemID ); List<ProjectInfoEntity> queryProjectInfo(@Param("systemID") String systemID );

17
user-service/src/main/java/com/mh/user/mapper/SysDictMapper.java

@ -0,0 +1,17 @@
package com.mh.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mh.user.model.SysDict;
import org.apache.ibatis.annotations.Mapper;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 系统字典管理
* @date 2024-08-23 11:15:47
*/
@Mapper
public interface SysDictMapper extends BaseMapper<SysDict> {
boolean deleteByPrimaryKey(Long id);
}

22
user-service/src/main/java/com/mh/user/mapper/chillers/GatewayManageMapper.java

@ -1,5 +1,6 @@
package com.mh.user.mapper.chillers; package com.mh.user.mapper.chillers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mh.user.entity.GatewayManageEntity; import com.mh.user.entity.GatewayManageEntity;
import com.mh.user.provide.GatewayManageProvider; import com.mh.user.provide.GatewayManageProvider;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@ -12,9 +13,8 @@ import java.util.List;
* desc: 网关管理实现类 * desc: 网关管理实现类
* create-date: 2020-05-21 * create-date: 2020-05-21
* */ * */
@Component
@Mapper @Mapper
public interface GatewayManageMapper { public interface GatewayManageMapper extends BaseMapper<GatewayManageEntity> {
/** /**
* 根据条件查询网关信息 * 根据条件查询网关信息
@ -37,24 +37,6 @@ public interface GatewayManageMapper {
}) })
List<GatewayManageEntity> queryByOther(@Param("grade") Integer grade, @Param("operator") Integer operator); List<GatewayManageEntity> queryByOther(@Param("grade") Integer grade, @Param("operator") Integer operator);
/**
* 新增网关信息
* @param gatewayManageEntity
*/
@Insert("insert into gateway_manage(gateway_name, gateway_ip, gateway_address, data_com,internet_card, " +
"operator, gateway_port, grade, connect_date) values(#{gatewayName},#{gatewayIP},#{gatewayAddress},#{dataCom},#{internetCard}," +
"#{operator},#{gatewayPort},#{grade},#{connectDate})")
void insertGateWayInfo(GatewayManageEntity gatewayManageEntity);
/**
* 更新网关信息
* @param gatewayManageEntity
*/
@Update("update gateway_manage set gateway_name = #{gatewayName}, gateway_ip = #{gatewayIP}, gateway_address = #{gatewayAddress}, " +
"data_com = #{dataCom}, internet_card = #{internetCard}, operator = #{operator}, " +
"gateway_port = #{gatewayPort}, grade = #{grade}, connect_date= #{connectDate} where id = #{id}")
void updateGateWayInfo(GatewayManageEntity gatewayManageEntity);
// 查询全部信息 // 查询全部信息
@ResultMap("rs") @ResultMap("rs")
@Select("select id,gateway_name, gateway_ip, gateway_address, data_com, connect_date, internet_card, operator, gateway_port, grade from gateway_manage ") @Select("select id,gateway_name, gateway_ip, gateway_address, data_com, connect_date, internet_card, operator, gateway_port, grade from gateway_manage ")

3
user-service/src/main/java/com/mh/user/model/BaseModel.java

@ -1,5 +1,7 @@
package com.mh.user.model; package com.mh.user.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -15,6 +17,7 @@ import java.util.Date;
@Getter @Getter
public class BaseModel { public class BaseModel {
@TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
private String createBy; private String createBy;

9
user-service/src/main/java/com/mh/user/model/SysDict.java

@ -2,9 +2,11 @@ package com.mh.user.model;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString;
@Setter @Setter
@Getter @Getter
@ToString
public class SysDict extends BaseModel { public class SysDict extends BaseModel {
private String value; private String value;
@ -21,4 +23,11 @@ public class SysDict extends BaseModel {
private Byte delFlag; private Byte delFlag;
/**
* 是否启用0-启用1-禁用
*/
private Byte status;
private Long parentId;
} }

2
user-service/src/main/java/com/mh/user/netty/EchoServerHandler.java

@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.mh.user.constants.Constant; import com.mh.user.constants.Constant;
import com.mh.user.entity.DeviceCodeParamEntity; import com.mh.user.entity.DeviceCodeParamEntity;
import com.mh.user.service.DeviceCodeParamService; import com.mh.user.service.DeviceCodeParamService;
import com.mh.user.service.chillers.GatewayManageService; import com.mh.user.service.GatewayManageService;
import com.mh.user.utils.*; import com.mh.user.utils.*;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;

24
user-service/src/main/java/com/mh/user/service/BaseService.java

@ -0,0 +1,24 @@
package com.mh.user.service;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 基础服务类增删查改
* @date 2024-08-23 09:06:19
*/
public interface BaseService<T> {
PageResult queryByPage(PageRequest pageRequest);
void update(T entity);
T findById(Integer id);
void save(T entity);
void delete(String id);
}

13
user-service/src/main/java/com/mh/user/service/DeviceParamsService.java

@ -0,0 +1,13 @@
package com.mh.user.service;
import com.mh.user.entity.DeviceParamsEntity;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 设备采集服务类
* @date 2024-08-23 09:33:34
*/
public interface DeviceParamsService extends BaseService<DeviceParamsEntity> {
}

13
user-service/src/main/java/com/mh/user/service/DevicesManageService.java

@ -0,0 +1,13 @@
package com.mh.user.service;
import com.mh.user.entity.DevicesManageEntity;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 资产设备管理
* @date 2024-08-23 10:24:33
*/
public interface DevicesManageService extends BaseService<DevicesManageEntity> {
}

10
user-service/src/main/java/com/mh/user/service/GatewayManageService.java

@ -2,9 +2,11 @@ package com.mh.user.service;
import com.mh.user.entity.GatewayManageEntity; import com.mh.user.entity.GatewayManageEntity;
import java.util.List; /**
* 新增网关服务管理
*/
public interface GatewayManageService extends BaseService<GatewayManageEntity> {
String selectProjectName(String port);
public interface GatewayManageService { void updateGatewayManage2(String port);
List<GatewayManageEntity> selectGateway();
} }

13
user-service/src/main/java/com/mh/user/service/MeterManageService.java

@ -0,0 +1,13 @@
package com.mh.user.service;
import com.mh.user.entity.MeterManageEntity;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 仪表管理
* @date 2024-08-23 08:59:46
*/
public interface MeterManageService extends BaseService<MeterManageEntity> {
}

4
user-service/src/main/java/com/mh/user/service/ProjectInfoService.java

@ -1,12 +1,10 @@
package com.mh.user.service; package com.mh.user.service;
import com.mh.user.entity.ProjectInfoEntity; import com.mh.user.entity.ProjectInfoEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
public interface ProjectInfoService { public interface ProjectInfoService extends BaseService<ProjectInfoEntity> {
List<ProjectInfoEntity> queryProjectInfo(String systemID ); List<ProjectInfoEntity> queryProjectInfo(String systemID );

9
user-service/src/main/java/com/mh/user/service/SysDictService.java

@ -1,6 +1,7 @@
package com.mh.user.service; package com.mh.user.service;
import com.mh.common.service.CurdService; import com.mh.common.service.CurdService;
import com.mh.user.entity.MeterManageEntity;
import com.mh.user.model.SysDict; import com.mh.user.model.SysDict;
import java.util.List; import java.util.List;
@ -14,8 +15,12 @@ public interface SysDictService extends CurdService<SysDict> {
/** /**
* 根据名称查询 * 根据名称查询
* @param lable * @param label
* @return * @return
*/ */
List<SysDict> findByLable(String lable); List<SysDict> findByLabel(String label);
boolean deleteByPrimaryKey(Long id);
void updateByPrimaryKey(SysDict entity);
} }

105
user-service/src/main/java/com/mh/user/service/chillers/GatewayManageService.java

@ -1,55 +1,50 @@
package com.mh.user.service.chillers; //package com.mh.user.service.chillers;
//
import com.mh.user.entity.GatewayManageEntity; //import com.mh.user.entity.GatewayManageEntity;
import org.apache.ibatis.annotations.Param; //import org.apache.ibatis.annotations.Param;
//
import java.util.List; //import java.util.List;
//
/** ///**
* 网关管理服务类 // * 网关管理服务类
* authorljf // * author:ljf
* createdate2020-05-21 // * create—date:2020-05-21
*/ // */
public interface GatewayManageService { //public interface GatewayManageService {
//
/** // /**
* 根据条件查询网关信息 // * 根据条件查询网关信息
* @param grade // * @param grade
* @param operator // * @param operator
* @return // * @return
*/ // */
List<GatewayManageEntity> queryByOther(Integer grade, Integer operator); // List<GatewayManageEntity> queryByOther(Integer grade, Integer operator);
//
/** //
* 新增或更新网关信息 // // 添加网关设备
* @param gatewayManageEntity // String insertGatewayManage(GatewayManageEntity gatewayManageEntity);
*/ //
void addOrUpdateGateWayInfo(GatewayManageEntity gatewayManageEntity); // // 根据网关ID删除网关设备
// void deleteGatewayManageByID(int gatewayID);
// 添加网关设备 //
String insertGatewayManage(GatewayManageEntity gatewayManageEntity); // // 根据网关ID查询设备信息
// GatewayManageEntity queryGatewayByID(Long gatewayID);
// 根据网关ID删除网关设备 //
void deleteGatewayManageByID(int gatewayID); // // 查询全部
// List<GatewayManageEntity> queryAll();
// 根据网关ID查询设备信息 //
GatewayManageEntity queryGatewayByID(Long gatewayID); // // 设备总数
// int queryByOtherCount(int page, int size, int gatewayID);
// 查询全部 //
List<GatewayManageEntity> queryAll(); // // 更新网关管理器的最新连接数据
// void updateGatewayManage(String IP,String port);
// 设备总数 //
int queryByOtherCount(int page, int size, int gatewayID); // // 更新网关管理器的最新连接数据
// void updateGatewayManage2(String port);
// 更新网关管理器的最新连接数据 //
void updateGatewayManage(String IP,String port); // // 根据grade查询对应的网关路由信息
// GatewayManageEntity queryGatewayByGrade(Long grade);
// 更新网关管理器的最新连接数据 //
void updateGatewayManage2(String port); // //根据端口或者IP或者心跳包查询网关对应的项目名称
// String selectProjectName(String str);
// 根据grade查询对应的网关路由信息 //}
GatewayManageEntity queryGatewayByGrade(Long grade);
//根据端口或者IP或者心跳包查询网关对应的项目名称
String selectProjectName(String str);
}

192
user-service/src/main/java/com/mh/user/service/chillers/impl/GatewayManageServiceImpl.java

@ -1,103 +1,89 @@
package com.mh.user.service.chillers.impl; //package com.mh.user.service.chillers.impl;
//
import com.mh.user.entity.GatewayManageEntity; //import com.mh.user.entity.GatewayManageEntity;
import com.mh.user.mapper.chillers.GatewayManageMapper; //import com.mh.user.mapper.chillers.GatewayManageMapper;
import com.mh.user.service.chillers.GatewayManageService; //import com.mh.user.service.chillers.GatewayManageService;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.util.List; //import java.util.List;
//
/** ///**
* @author ljf // * @author ljf
* @title // * @title :
* @description 网关管理实现类 // * @description : 网关管理实现类
* @updateTime 2020-05-21 // * @updateTime 2020-05-21
* @throws // * @throws :
*/ // */
@Service //@Service
public class GatewayManageServiceImpl implements GatewayManageService { //public class GatewayManageServiceImpl implements GatewayManageService {
//
// 通过构造函数注入,引用Mapper // // 通过构造函数注入,引用Mapper
private final GatewayManageMapper gatewayManageMapper; // private final GatewayManageMapper gatewayManageMapper;
//
public GatewayManageServiceImpl(GatewayManageMapper gatewayManageMapper) { // public GatewayManageServiceImpl(GatewayManageMapper gatewayManageMapper) {
this.gatewayManageMapper = gatewayManageMapper; // this.gatewayManageMapper = gatewayManageMapper;
} // }
//
/** // /**
* 按条件查询网关信息 // * 按条件查询网关信息
* @param grade // * @param grade
* @param operator // * @param operator
* @return // * @return
*/ // */
@Override // @Override
public List<GatewayManageEntity> queryByOther(Integer grade, Integer operator) { // public List<GatewayManageEntity> queryByOther(Integer grade, Integer operator) {
return gatewayManageMapper.queryByOther(grade, operator); // return gatewayManageMapper.queryByOther(grade, operator);
} // }
//
/** // @Override
* 新增或更新网关信息 // public String insertGatewayManage(GatewayManageEntity gatewayManageEntity) {
* @param gatewayManageEntity // // 判断是否已经包含
*/ // GatewayManageEntity gatewayManageEntity1 = gatewayManageMapper.queryGatewayByID(gatewayManageEntity.getId());
@Override // if (gatewayManageEntity1.getId() != null) {
public void addOrUpdateGateWayInfo(GatewayManageEntity gatewayManageEntity) { // return "数据重复,请重新插入";
if(gatewayManageEntity.getType().equals("edit")){ // } else {
// 更新 // gatewayManageMapper.insertGatewayManage(gatewayManageEntity);
gatewayManageMapper.updateGateWayInfo(gatewayManageEntity); // return "数据插入成功";
} else if (gatewayManageEntity.getType().equals("add")) { // }
// 新增 // }
gatewayManageMapper.insertGateWayInfo(gatewayManageEntity); //
} // @Override
} // public void deleteGatewayManageByID(int gatewayID) {
@Override // gatewayManageMapper.deleteGatewayManageByID(gatewayID);
public String insertGatewayManage(GatewayManageEntity gatewayManageEntity) { // }
// 判断是否已经包含 //
GatewayManageEntity gatewayManageEntity1 = gatewayManageMapper.queryGatewayByID(gatewayManageEntity.getId()); // @Override
if (gatewayManageEntity1.getId() != null) { // public GatewayManageEntity queryGatewayByID(Long gatewayID) {
return "数据重复,请重新插入"; // return gatewayManageMapper.queryGatewayByID(gatewayID);
} else { // }
gatewayManageMapper.insertGatewayManage(gatewayManageEntity); //
return "数据插入成功"; // @Override
} // public List<GatewayManageEntity> queryAll() {
} // return gatewayManageMapper.queryAll();
// }
@Override //
public void deleteGatewayManageByID(int gatewayID) { // @Override
gatewayManageMapper.deleteGatewayManageByID(gatewayID); // public int queryByOtherCount(int page, int size, int gatewayID) {
} // return gatewayManageMapper.queryByOtherCount(page, size, gatewayID);
// }
@Override //
public GatewayManageEntity queryGatewayByID(Long gatewayID) { // @Override
return gatewayManageMapper.queryGatewayByID(gatewayID); // public void updateGatewayManage(String IP,String port) {
} // gatewayManageMapper.updateGatewayManage(IP,port);
// }
@Override //
public List<GatewayManageEntity> queryAll() { // @Override
return gatewayManageMapper.queryAll(); // public void updateGatewayManage2(String port) {
} // gatewayManageMapper.updateGatewayManage2(port);
// }
@Override //
public int queryByOtherCount(int page, int size, int gatewayID) { // @Override
return gatewayManageMapper.queryByOtherCount(page, size, gatewayID); // public GatewayManageEntity queryGatewayByGrade(Long grade) {
} // return gatewayManageMapper.queryGatewayByGrade(grade);
// }
@Override //
public void updateGatewayManage(String IP,String port) { // @Override
gatewayManageMapper.updateGatewayManage(IP,port); // public String selectProjectName(String str) {
} // return gatewayManageMapper.selectProjectName(str);
// }
@Override //}
public void updateGatewayManage2(String port) {
gatewayManageMapper.updateGatewayManage2(port);
}
@Override
public GatewayManageEntity queryGatewayByGrade(Long grade) {
return gatewayManageMapper.queryGatewayByGrade(grade);
}
@Override
public String selectProjectName(String str) {
return gatewayManageMapper.selectProjectName(str);
}
}

68
user-service/src/main/java/com/mh/user/service/impl/DeviceParamsServiceImpl.java

@ -0,0 +1,68 @@
package com.mh.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mh.common.page.MybatisPageHelper;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.common.utils.StringUtils;
import com.mh.user.entity.DeviceParamsEntity;
import com.mh.user.entity.GatewayManageEntity;
import com.mh.user.mapper.DeviceParamsMapper;
import com.mh.user.service.DeviceParamsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 设备采集服务类实现类
* @date 2024-08-23 09:34:07
*/
@Service
public class DeviceParamsServiceImpl implements DeviceParamsService {
@Autowired
private DeviceParamsMapper deviceParamsMapper;
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String mtType = StringUtils.getColumnFilterValue(pageRequest, "mtType");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
QueryWrapper<DeviceParamsEntity> queryWrapper = new QueryWrapper<DeviceParamsEntity>();
if (!StringUtils.isBlank(mtType)) {
queryWrapper.eq("mt_type", mtType);
}
List<DeviceParamsEntity> manageEntities = deviceParamsMapper.selectList(queryWrapper.orderByDesc("id"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(manageEntities));
}
@Override
public void update(DeviceParamsEntity entity) {
deviceParamsMapper.updateById(entity);
}
@Override
public DeviceParamsEntity findById(Integer id) {
return deviceParamsMapper.selectById(id);
}
@Override
public void save(DeviceParamsEntity entity) {
deviceParamsMapper.insert(entity);
}
@Override
public void delete(String id) {
deviceParamsMapper.deleteById(id);
}
}

71
user-service/src/main/java/com/mh/user/service/impl/DevicesManageServiceImpl.java

@ -0,0 +1,71 @@
package com.mh.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mh.common.page.MybatisPageHelper;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.common.utils.StringUtils;
import com.mh.user.entity.DevicesManageEntity;
import com.mh.user.mapper.DevicesManageMapper;
import com.mh.user.service.DevicesManageService;
import com.mh.user.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 资产设备管理实现类
* @date 2024-08-23 10:25:06
*/
@Service
public class DevicesManageServiceImpl implements DevicesManageService {
@Autowired
private DevicesManageMapper devicesManageMapper;
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
List<DevicesManageEntity> manageEntities = devicesManageMapper.selectList(
new QueryWrapper<DevicesManageEntity>()
.eq("system_id", systemID)
.orderByDesc("create_time"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(manageEntities));
}
@Override
public void update(DevicesManageEntity entity) {
entity.setUpdateTime(new Date());
devicesManageMapper.updateById(entity);
}
@Override
public DevicesManageEntity findById(Integer id) {
return devicesManageMapper.selectById(id);
}
@Override
public void save(DevicesManageEntity entity) {
entity.setCreateBy(SecurityUtils.getUsername());
entity.setCreateTime(new Date());
devicesManageMapper.insert(entity);
}
@Override
public void delete(String id) {
devicesManageMapper.deleteById(id);
}
}

79
user-service/src/main/java/com/mh/user/service/impl/GatewayManageServiceImpl.java

@ -0,0 +1,79 @@
package com.mh.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mh.common.page.MybatisPageHelper;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.common.utils.StringUtils;
import com.mh.user.entity.GatewayManageEntity;
import com.mh.user.mapper.chillers.GatewayManageMapper;
import com.mh.user.service.GatewayManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 网关管理实现类
* @date 2024-08-22 17:36:41
*/
@Service
public class GatewayManageServiceImpl implements GatewayManageService {
@Autowired
private GatewayManageMapper gatewayManageMapper;
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
List<GatewayManageEntity> manageEntities = gatewayManageMapper.selectList(
new QueryWrapper<GatewayManageEntity>()
.eq("system_id", systemID)
.orderByDesc("create_time"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(manageEntities));
}
@Override
public void update(GatewayManageEntity gatewayManageEntity) {
gatewayManageEntity.setUpdateTime(new Date());
gatewayManageMapper.updateById(gatewayManageEntity);
}
@Override
public GatewayManageEntity findById(Integer id) {
return gatewayManageMapper.selectById(id);
}
@Override
public void save(GatewayManageEntity gatewayManageEntity) {
gatewayManageEntity.setCreateTime(new Date());
gatewayManageMapper.insert(gatewayManageEntity);
}
@Override
public void delete(String id) {
gatewayManageMapper.deleteById(id);
}
@Override
public String selectProjectName(String port) {
return gatewayManageMapper.selectProjectName(port);
}
@Override
public void updateGatewayManage2(String port) {
gatewayManageMapper.updateGatewayManage2(port);
}
}

69
user-service/src/main/java/com/mh/user/service/impl/MeterManageServiceImpl.java

@ -0,0 +1,69 @@
package com.mh.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mh.common.page.MybatisPageHelper;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.common.utils.StringUtils;
import com.mh.user.entity.MeterManageEntity;
import com.mh.user.mapper.MeterManageMapper;
import com.mh.user.service.MeterManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description 仪表管理实现类
* @date 2024-08-23 09:02:18
*/
@Service
public class MeterManageServiceImpl implements MeterManageService {
@Autowired
private MeterManageMapper meterManageMapper;
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
List<MeterManageEntity> meterManageEntities = meterManageMapper.selectList(
new QueryWrapper<MeterManageEntity>()
.eq("system_id", systemID)
.orderByDesc("create_time"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(meterManageEntities));
}
@Override
public void update(MeterManageEntity entity) {
entity.setUpdateTime(new Date());
meterManageMapper.updateById(entity);
}
@Override
public MeterManageEntity findById(Integer id) {
return meterManageMapper.selectById(id);
}
@Override
public void save(MeterManageEntity entity) {
entity.setCreateTime(new Date());
meterManageMapper.insert(entity);
}
@Override
public void delete(String id) {
meterManageMapper.deleteById(id);
}
}

50
user-service/src/main/java/com/mh/user/service/impl/ProjectInfoServiceImpl.java

@ -1,18 +1,27 @@
package com.mh.user.service.impl; package com.mh.user.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import com.mh.common.page.MybatisPageHelper;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.common.utils.FileUtils;
import com.mh.common.utils.StringUtils;
import com.mh.user.entity.ProjectInfoEntity; import com.mh.user.entity.ProjectInfoEntity;
import com.mh.user.mapper.ProjectInfoMapper; import com.mh.user.mapper.ProjectInfoMapper;
import com.mh.user.service.ProjectInfoService; import com.mh.user.service.ProjectInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
@Service @Service
public class ProjectInfoServiceImpl implements ProjectInfoService { public class ProjectInfoServiceImpl implements ProjectInfoService {
@Autowired @Autowired
ProjectInfoMapper projectInfoMapper; private ProjectInfoMapper projectInfoMapper;
@Override @Override
@ -25,4 +34,43 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
public String selectName(String id) { public String selectName(String id) {
return projectInfoMapper.selectName(id); return projectInfoMapper.selectName(id);
} }
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
List<ProjectInfoEntity> result = projectInfoMapper.queryProjectInfo(systemID);
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(result));
}
@Override
public void update(ProjectInfoEntity projectInfoEntity) {
projectInfoMapper.updateById(projectInfoEntity);
}
@Override
public void save(ProjectInfoEntity projectInfoEntity) {
if (null != projectInfoEntity.getFile()) {
String fileToBase64 = FileUtils.convertFileToBase64(projectInfoEntity.getFile());
projectInfoEntity.setPicContent(fileToBase64);
projectInfoEntity.setPic(projectInfoEntity.getFile().getOriginalFilename());
}
projectInfoEntity.setCreateTime(new Date());
projectInfoMapper.insert(projectInfoEntity);
}
@Override
public void delete(String id) {
projectInfoMapper.deleteById(id);
}
@Override
public ProjectInfoEntity findById(Integer id) {
return projectInfoMapper.selectById(id);
}
} }

87
user-service/src/main/java/com/mh/user/service/impl/SysDictServiceImpl.java

@ -0,0 +1,87 @@
package com.mh.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mh.common.page.MybatisPageHelper;
import com.mh.common.page.PageRequest;
import com.mh.common.page.PageResult;
import com.mh.common.utils.StringUtils;
import com.mh.user.entity.MeterManageEntity;
import com.mh.user.mapper.SysDictMapper;
import com.mh.user.model.SysDict;
import com.mh.user.service.SysDictService;
import com.mh.user.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project mh_esi
* @description
* @date 2024-08-23 11:13:38
*/
@Service
public class SysDictServiceImpl implements SysDictService {
@Autowired
private SysDictMapper sysDictMapper;
@Override
public boolean deleteByPrimaryKey(Long id) {
return sysDictMapper.deleteByPrimaryKey(id);
}
@Override
public List<SysDict> findByLabel(String label) {
return Collections.emptyList();
}
@Override
public int save(SysDict record) {
record.setCreateBy(SecurityUtils.getUsername());
record.setCreateTime(new Date());
return sysDictMapper.insert(record);
}
@Override
public int delete(SysDict record) {
return sysDictMapper.deleteById(record);
}
@Override
public int delete(List<SysDict> records) {
return 0;
}
@Override
public SysDict findById(Long id) {
return sysDictMapper.selectById(id);
}
@Override
public PageResult findPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
List<SysDict> sysDictList = sysDictMapper.selectList(
new QueryWrapper<SysDict>().orderByDesc("create_time"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(sysDictList));
}
@Override
public void updateByPrimaryKey(SysDict entity) {
entity.setLastUpdateBy(SecurityUtils.getUsername());
entity.setLastUpdateTime(new Date());
sysDictMapper.updateById(entity);
}
}

28
user-service/src/main/java/com/mh/user/sqlmapper/SysDictMapper.xml

@ -16,7 +16,7 @@
<result column="del_flag" jdbcType="TINYINT" property="delFlag" /> <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, value, label, type, description, sort, create_by, create_time, last_update_by, id, value, label, type, description, sort, create_by, create_time, last_update_by,
last_update_time, remarks, del_flag last_update_time, remarks, del_flag
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@ -29,18 +29,18 @@
delete from sys_dict delete from sys_dict
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<insert id="insert" parameterType="com.mh.user.model.SysDict"> <!-- <insert id="insert" parameterType="com.mh.user.model.SysDict">-->
insert into sys_dict (id, value, label, <!-- insert into sys_dict (id, value, label, -->
type, description, sort, <!-- type, description, sort,-->
create_by, create_time, last_update_by, <!-- create_by, create_time, last_update_by, -->
last_update_time, remarks, del_flag <!-- last_update_time, remarks, del_flag-->
) <!-- )-->
values (#{id,jdbcType=BIGINT}, #{value,jdbcType=VARCHAR}, #{label,jdbcType=VARCHAR}, <!-- values (#{id,jdbcType=BIGINT}, #{value,jdbcType=VARCHAR}, #{label,jdbcType=VARCHAR}, -->
#{type,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{sort,jdbcType=DECIMAL}, <!-- #{type,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{sort,jdbcType=DECIMAL},-->
#{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateBy,jdbcType=BIGINT}, <!-- #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateBy,jdbcType=BIGINT}, -->
#{lastUpdateTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{delFlag,jdbcType=TINYINT} <!-- #{lastUpdateTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{delFlag,jdbcType=TINYINT}-->
) <!-- )-->
</insert> <!-- </insert>-->
<insert id="insertSelective" parameterType="com.mh.user.model.SysDict"> <insert id="insertSelective" parameterType="com.mh.user.model.SysDict">
insert into sys_dict insert into sys_dict
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -186,7 +186,7 @@
from sys_dict from sys_dict
where label like #{pattern} where label like #{pattern}
</select> </select>
<select id="findByLable" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="findByLabel" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from sys_dict from sys_dict

7
user-service/src/main/resources/application-dev.yml

@ -31,6 +31,9 @@ spring:
prefetch: 2 prefetch: 2
simple: simple:
prefetch: 2 prefetch: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
# redis: # redis:
# database: 0 # database: 0
@ -90,10 +93,12 @@ logging:
path: logs/${spring.application.name} path: logs/${spring.application.name}
##软件最后更新日期20230116 ##软件最后更新日期20230116
mybatis: mybatis-plus:
mapper-locations: classpath:com/mh/user/sqlmapper/*.xml mapper-locations: classpath:com/mh/user/sqlmapper/*.xml
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
type-aliases-package: com.mh.user.entity type-aliases-package: com.mh.user.entity

5
user-service/src/main/resources/application-prod.yml

@ -31,6 +31,9 @@ spring:
prefetch: 2 prefetch: 2
simple: simple:
prefetch: 2 prefetch: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
# redis: # redis:
# database: 0 # database: 0
@ -90,7 +93,7 @@ logging:
path: logs/${spring.application.name} path: logs/${spring.application.name}
##软件最后更新日期20230116 ##软件最后更新日期20230116
mybatis: mybatis-plus:
mapper-locations: classpath:com/mh/user/sqlmapper/*.xml mapper-locations: classpath:com/mh/user/sqlmapper/*.xml
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true

5
user-service/src/main/resources/application-test.yml

@ -31,6 +31,9 @@ spring:
prefetch: 2 prefetch: 2
simple: simple:
prefetch: 2 prefetch: 2
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
# redis: # redis:
# database: 0 # database: 0
@ -90,7 +93,7 @@ logging:
path: logs/${spring.application.name} path: logs/${spring.application.name}
##软件最后更新日期20230116 ##软件最后更新日期20230116
mybatis: mybatis-plus:
mapper-locations: classpath:com/mh/user/sqlmapper/*.xml mapper-locations: classpath:com/mh/user/sqlmapper/*.xml
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true

89
user-service/src/test/java/com/mh/user/SysUserTest.java

@ -1,8 +1,24 @@
package com.mh.user; package com.mh.user;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author ljf * @author ljf
@ -14,22 +30,69 @@ import java.util.Date;
public class SysUserTest { public class SysUserTest {
public static void main(String[] args) throws ParseException { public static void main(String[] args) throws ParseException, IOException {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 读取TXT文件中的HTML内容
Date date1 = new Date(); String htmlContent = readFile("C:/Users/MH/Desktop/getAir.txt");
// 使用Jsoup解析HTML
Document doc = Jsoup.parse(htmlContent);
// 提取所有的img标签
Elements imgElements = doc.select("img");
// 存储img标签的src属性
List<String> imgSrcs = new ArrayList<>();
for (Element img : imgElements) {
if (img.attr("src").startsWith("//")) {
imgSrcs.add("http:" + img.attr("src"));
} else {
imgSrcs.add(img.attr("src"));
}
}
for (int i = 0; i < imgSrcs.size(); i++) {
// 指定要保存的本地文件路径
Path localFilePath = Paths.get("D:/ljf/images/"+i+".jpg");
// 下载图片
try {
downloadImageToFile(imgSrcs.get(i), localFilePath);
} catch (IOException e) {
continue;
}
}
}
private static String readFile(String filePath) throws IOException {
StringBuilder contentBuilder = new StringBuilder();
String str=""; try (BufferedReader br = new BufferedReader(new FileReader(filePath))) {
if (date1!=null){ String currentLine;
str=sdf1.format(date1);
}else{ while ((currentLine = br.readLine()) != null) {
Date date=new Date();//获取系统日期 contentBuilder.append(currentLine).append("\n");
str=sdf1.format(date); }
} }
String curDate=""; return contentBuilder.toString();
curDate=str.substring(0,16)+":00"; }
Date parse = sdf1.parse(curDate);
System.out.println(parse); /**
* 从给定的URL下载图片并保存到指定的本地路径
*
* @param urlStr 图片URL地址
* @param localPath 本地文件路径
* @throws IOException 如果发生IO错误
*/
private static void downloadImageToFile(String urlStr, Path localPath) throws IOException {
// 打开URL连接
URL url = new URL(urlStr);
try (InputStream in = url.openStream()) {
// 创建文件的父目录(如果不存在)
Files.createDirectories(localPath.getParent());
// 将输入流的内容复制到本地文件
Files.copy(in, localPath, StandardCopyOption.REPLACE_EXISTING);
}
} }
} }

Loading…
Cancel
Save