Browse Source

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

dev
mh 2 months ago
parent
commit
3a95013969
  1. 18
      2024新增脚本.sql
  2. 2
      user-service/src/main/java/com/mh/user/entity/DevicesManageEntity.java
  3. 2
      user-service/src/main/java/com/mh/user/entity/MeterManageEntity.java
  4. 6
      user-service/src/main/java/com/mh/user/entity/ProjectInfoEntity.java
  5. 12
      user-service/src/main/java/com/mh/user/mapper/ProjectInfoMapper.java
  6. 13
      user-service/src/main/java/com/mh/user/service/impl/DevicesManageServiceImpl.java
  7. 2
      user-service/src/main/java/com/mh/user/service/impl/GatewayManageServiceImpl.java
  8. 14
      user-service/src/main/java/com/mh/user/service/impl/MeterManageServiceImpl.java
  9. 10
      user-service/src/main/java/com/mh/user/service/impl/ProjectInfoServiceImpl.java

18
2024新增脚本.sql

@ -67,7 +67,8 @@ create table devices_manage
is_frequency bit null, -- 是否变频
device_type bigint null, -- 设备类型id(字典配置)
system_id bigint null, -- 项目类型id
remark nvarchar(255) null, -- 备注
project_id bigint null, -- 项目类型id
remark nvarchar(255) 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'devices_manage';
@ -86,6 +87,7 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人', @l
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'系统id', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'project_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';
@ -119,9 +121,10 @@ create table meter_manage (
gateway_id bigint null, -- 对应网关管理表gateway_manage的id
param_id bigint null, -- 对应参数id
protocol_type bigint null, -- 协议类型(字典表)
communication_type int NULL, -- 通讯方式
communication_type int NULL, -- 通讯方式(字典表)
remark nvarchar(255) null, -- 备注
system_id bigint null, -- 项目类型id
system_id bigint null, -- 系统类型id
project_id bigint null, -- 项目类型id
grade int null -- 保留
)
@ -155,7 +158,8 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=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'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'项目类型ID', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'devices_manage', @level2type=N'Column', @level2name=N'project_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'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';
@ -175,7 +179,8 @@ CREATE TABLE gateway_manage (
remark varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
communication_type int NULL,
grade int NULL,
system_id bigint null, -- 项目类型id
system_id bigint null, -- 系统类型id
project_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';
@ -193,7 +198,8 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'运营商类
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';
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';
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'project_id';
-- 设备采集参数表
create table device_params(

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

@ -104,7 +104,7 @@ public class DevicesManageEntity implements Serializable {
/**
* 等级
*/
private int grade;
private Integer grade = 0;
/**
* 系统类型id

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

@ -171,7 +171,7 @@ public class MeterManageEntity implements Serializable {
/**
* 保留位
*/
private int grade;
private Integer grade = 0;
/**
* 系统类型id

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

@ -23,7 +23,7 @@ public class ProjectInfoEntity {
private String pAddress; //地址
@TableField("p_scale")
private int pScale;
private String pScale;
@TableField("pic")
private String pic; //图片地址
@ -89,11 +89,11 @@ public class ProjectInfoEntity {
this.pAddress = pAddress;
}
public int getpScale() {
public String getpScale() {
return pScale;
}
public void setpScale(int pScale) {
public void setpScale(String pScale) {
this.pScale = pScale;
}

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

@ -23,8 +23,16 @@ public interface ProjectInfoMapper extends BaseMapper<ProjectInfoEntity> {
@Result(property="longitude",column="longitude"),
@Result(property="latitude",column="latitude")
})
@Select("select * from project_info where system_id=#{systemID}")
List<ProjectInfoEntity> queryProjectInfo(@Param("systemID") String systemID );
@Select("<script>" +
"select * from project_info where 1=1" +
"<if test='systemId != null and systemId != \"\"'>" +
" and system_id=#{systemId} " +
"</if>" +
"<if test='projectId != null and projectId != \"\"'>" +
" and project_id=#{projectId} " +
"</if>" +
"</script>")
List<ProjectInfoEntity> queryProjectInfo(@Param("systemId") String systemID, @Param("projectId") String projectId);
//通过id查找对应的名称
@Select("select project_name from project_info where id=#{id}")

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

@ -33,16 +33,21 @@ public class DevicesManageServiceImpl implements DevicesManageService {
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
String projectId = StringUtils.getColumnFilterValue(pageRequest, "projectId");
// 设置分页参数
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"));
QueryWrapper<DevicesManageEntity> queryWrapper = new QueryWrapper<>();
if (!StringUtils.isBlank(systemID)) {
queryWrapper.eq("system_id", systemID);
}
if (!StringUtils.isBlank(projectId)) {
queryWrapper.eq("project_id", projectId);
}
List<DevicesManageEntity> manageEntities = devicesManageMapper.selectList(queryWrapper.orderByDesc("create_time"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(manageEntities));
}

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

@ -32,6 +32,7 @@ public class GatewayManageServiceImpl implements GatewayManageService {
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
String projectId = StringUtils.getColumnFilterValue(pageRequest, "projectId");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
@ -41,6 +42,7 @@ public class GatewayManageServiceImpl implements GatewayManageService {
List<GatewayManageEntity> manageEntities = gatewayManageMapper.selectList(
new QueryWrapper<GatewayManageEntity>()
.eq("system_id", systemID)
.eq("project_id", projectId)
.orderByDesc("create_time"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(manageEntities));
}

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

@ -7,6 +7,7 @@ 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.entity.MeterManageEntity;
import com.mh.user.mapper.MeterManageMapper;
import com.mh.user.service.MeterManageService;
@ -32,16 +33,21 @@ public class MeterManageServiceImpl implements MeterManageService {
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
String projectId = StringUtils.getColumnFilterValue(pageRequest, "projectId");
// 设置分页参数
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"));
QueryWrapper<MeterManageEntity> queryWrapper = new QueryWrapper<>();
if (!StringUtils.isBlank(systemID)) {
queryWrapper.eq("system_id", systemID);
}
if (!StringUtils.isBlank(projectId)) {
queryWrapper.eq("project_id", projectId);
}
List<MeterManageEntity> meterManageEntities = meterManageMapper.selectList(queryWrapper.orderByDesc("create_time"));
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(meterManageEntities));
}

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

@ -27,7 +27,7 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
@Override
public List<ProjectInfoEntity> queryProjectInfo(String systemID) {
return projectInfoMapper.queryProjectInfo(systemID);
return projectInfoMapper.queryProjectInfo(systemID, null);
}
@Override
@ -38,18 +38,24 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
@Override
public PageResult queryByPage(PageRequest pageRequest) {
String systemID = StringUtils.getColumnFilterValue(pageRequest, "systemId");
String projectId = StringUtils.getColumnFilterValue(pageRequest, "projectId");
// 设置分页参数
int pageNum = pageRequest.getPageNum();
int pageSize = pageRequest.getPageSize();
if (pageNum != 0) {
PageHelper.startPage(pageNum, pageSize);
}
List<ProjectInfoEntity> result = projectInfoMapper.queryProjectInfo(systemID);
List<ProjectInfoEntity> result = projectInfoMapper.queryProjectInfo(systemID, projectId);
return MybatisPageHelper.getPageResult(pageRequest, new PageInfo<>(result));
}
@Override
public void update(ProjectInfoEntity projectInfoEntity) {
if (null != projectInfoEntity.getFile()) {
String fileToBase64 = FileUtils.convertFileToBase64(projectInfoEntity.getFile());
projectInfoEntity.setPicContent(fileToBase64);
projectInfoEntity.setPic(projectInfoEntity.getFile().getOriginalFilename());
}
projectInfoMapper.updateById(projectInfoEntity);
}

Loading…
Cancel
Save