This commit is contained in:
高云鹏 2024-07-09 17:31:27 +08:00
commit 8e93b4e34d
19 changed files with 882 additions and 69 deletions

View File

@ -26,6 +26,8 @@
<sa.version>1.38.0</sa.version>
<easyexcel.version>4.0.1</easyexcel.version>
<annotations.version>4.8.6</annotations.version>
<undertow.version>2.3.14.Final</undertow.version>
<apache.poi>5.3.0</apache.poi>
</properties>
<dependencies>
@ -83,14 +85,13 @@
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${apache.poi}</version>
</dependency>
<!-- 提供Redis连接池 -->
<dependency>

View File

@ -73,10 +73,10 @@ public class EquipmentController {
@PostMapping("/update")
public R<SysEquipmentVo> updateSysEquipment(@RequestBody SysEquipmentDto sysEquipmentDto) {
//判断是否有权限
// boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
// if(!hasPermission){
// return R.fail("没有设备管理权限");
// }
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
if(!hasPermission){
return R.fail("没有设备管理权限");
}
if (sysEquipmentDto.getOrgId() == null) {
throw new ServiceException("参数缺失");
@ -127,29 +127,22 @@ public class EquipmentController {
* @return 所有的设备类型
*/
@PostMapping("/getEquipmentTree")
public R<SysOrg> getRootOrg(@RequestBody SysEquipmentDto sysEquipmentDto) {
if (sysEquipmentDto.getOrgId() == null) {
throw new ServiceException("参数缺失");
}
return R.success(sysEquipmentService.getRootOrg(sysEquipmentDto));
public R<List<SysEquipmentVo>> getRootEquipment() {
return R.success(sysEquipmentService.getRootEquipment());
}
/** 设备导出 */
@PostMapping("/export")
public void exportSysEquipment(@RequestBody SysEquipmentDto sysEquipmentDto, HttpServletRequest request, HttpServletResponse response) {
if (sysEquipmentDto.getParentEquipmentId() == null) {
throw new ServiceException("请选择需要下载的设备类型信息");
}
sysEquipmentService.exportSysEquipment(sysEquipmentDto,request, response);
}
/** 设备导出 */
@PostMapping("/import")
public R<Void> importSysIotModel(@RequestParam("file") MultipartFile file) throws IOException {
sysEquipmentService.importSysEquipment(file);
public R<Void> importSysIotModel(String id, @RequestParam("file") MultipartFile file) throws IOException {
sysEquipmentService.importSysEquipment(id, file);
return R.success();
}
}

View File

@ -20,7 +20,7 @@ public interface SysEquipmentMapper extends BaseMapper<SysEquipment> {
IPage<SysEquipmentVo> querySysEquipmentList(IPage<SysEquipmentVo> page, @Param("info") SysEquipmentDto sysEquipmentDto);
List<SysEquipmentVo> queryEquipmentTree(@Param("id")Long id);
List<SysEquipmentVo> queryEquipmentTree();
List<SysEquipmentExcel> queryInfoById (@Param("info") SysEquipmentDto sysEquipmentDto);

View File

@ -28,10 +28,10 @@ public interface SysEquipmentService {
List<SysEquipmentVo> queryAllSysEquipmentList(SysEquipmentDto sysEquipmentDto);
SysOrg getRootOrg(SysEquipmentDto sysEquipmentDto);
List<SysEquipmentVo> getRootEquipment();
void exportSysEquipment(SysEquipmentDto sysEquipmentDto, HttpServletRequest request, HttpServletResponse response);
void importSysEquipment(MultipartFile file) throws IOException;
void importSysEquipment(String parentEquipmentId,MultipartFile file) throws IOException;
}

View File

@ -107,15 +107,8 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
}
@Override
public SysOrg getRootOrg(SysEquipmentDto sysEquipmentDto) {
// 查询当前账号机构下的子机构和子设备
QueryWrapper<SysOrg> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", sysEquipmentDto.getOrgId());
SysOrg sysOrg = sysOrgMapper.selectOne(queryWrapper);
if (sysOrg == null) {
throw new ServiceException("机构不存在");
}
List<SysEquipmentVo> equipList = sysEquipmentMapper.queryEquipmentTree(sysEquipmentDto.getOrgId());
public List<SysEquipmentVo> getRootEquipment() {
List<SysEquipmentVo> equipList = sysEquipmentMapper.queryEquipmentTree();
// 根据ordId和设备编码查出对应的子设备
List<SysEquipmentVo> newEquipList = new ArrayList<>();
if (!CollectionUtils.isEmpty(equipList)) {
@ -123,16 +116,12 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
QueryWrapper<SysEquipment> queryEquipWrapper = new QueryWrapper<>();
queryEquipWrapper.eq("parent_equipment_id", info.getId());
queryEquipWrapper.eq("object_type", info.getObjectType());
queryEquipWrapper.eq("org_id", sysEquipmentDto.getOrgId());
List<SysEquipment> children = sysEquipmentMapper.selectList(queryEquipWrapper);
info.setEquipChildren(children);
newEquipList.add(info);
}
}
List<SysOrg> orgList = sysOrgMapper.queryAllOrgTree(sysEquipmentDto.getOrgId());
sysOrg.setEquipChildren(equipList);
sysOrg.setOrgChildren(orgList);
return sysOrg;
return newEquipList;
}
@Override
@ -147,7 +136,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
}
@Override
public void importSysEquipment(MultipartFile file) throws IOException {
public void importSysEquipment(String parentEquipmentId, MultipartFile file) throws IOException {
//输入流
InputStream inputStream = file.getInputStream();
//监视器
@ -167,13 +156,17 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
SysEquipment field = new SysEquipment();
BeanUtil.copyProperties(dto,field);
// 根据名称获取物模型id
Long iotModelId = sysIotModelMapper.queryIotModelIdByName(dto.getIotModelName());
Long parentEquipmentId = sysEquipmentMapper.queryParentEquipmentIdByName(dto.getParentEquipmentName());
Long orgId = sysOrgMapper.queryOrgIdByName(dto.getOrgName());
field.setIotModelId(iotModelId);
field.setParentEquipmentId(parentEquipmentId);
if(StringUtils.isNotBlank(dto.getOrgName())) {
Long iotModelId = sysIotModelMapper.queryIotModelIdByName(dto.getIotModelName());
field.setIotModelId(iotModelId);
}
if(StringUtils.isNotBlank(dto.getOrgName())) {
Long orgId = sysOrgMapper.queryOrgIdByName(dto.getOrgName());
field.setOrgId(orgId);
}
field.setParentEquipmentId(Long.valueOf(parentEquipmentId));
field.setId(SequenceUtils.generateId());
field.setOrgId(orgId);
field.setCreatedTime(new Date());
field.setUpdatedTime(new Date());
field.setRevision(1);

View File

@ -0,0 +1,88 @@
package com.das.modules.node.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.das.common.constant.SysAuthorityIds;
import com.das.common.exceptions.ServiceException;
import com.das.common.result.R;
import com.das.common.utils.PageDataInfo;
import com.das.modules.equipment.domain.dto.SysIotModelDto;
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
import com.das.modules.equipment.domain.vo.SysIotModelVo;
import com.das.modules.node.domain.dto.SysNodeDto;
import com.das.modules.node.domain.vo.SysCommunicationLinkVo;
import com.das.modules.node.domain.vo.SysNodeVo;
import com.das.modules.node.service.SysNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 物模型Controller
*/
@RestController
@RequestMapping("/api/node")
public class SysNodeController {
@Autowired
private SysNodeService sysNodeService;
/** 获取节点列表 */
@PostMapping("/list")
public R<List<SysNodeVo>> querySysNodeList() {
return R.success(sysNodeService.querySysNodeList());
}
/** 新增节点 */
@PostMapping("/add")
public R<SysNodeVo> createSysNode(@RequestBody SysNodeDto sysNodeDto) {
//判断是否有权限
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
if(!hasPermission){
return R.fail("没有设备管理权限");
}
return R.success(sysNodeService.createSysNode(sysNodeDto));
}
/** 修改节点 */
@PostMapping("/update")
public R<SysNodeVo> updateSysNode(@RequestBody SysNodeDto sysNodeDto) {
//判断是否有权限
// boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
// if(!hasPermission){
// return R.fail("没有设备管理权限");
// }
return R.success(sysNodeService.updateSysNode(sysNodeDto));
}
/** 删除节点 */
@PostMapping("/delete")
public R<Void> deleteSysNode(@RequestBody SysNodeDto sysNodeDto) {
//判断是否有权限
// boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
// if(!hasPermission){
// return R.fail("没有设备管理权限");
// }
if (sysNodeDto.getId() == null) {
throw new ServiceException("参数缺失");
}
sysNodeService.deleteSysNode(sysNodeDto.getId());
return R.success();
}
/** 配置下发 */
@PostMapping("/configUpdate")
public R<Void> configUpdate() {
return R.success();
}
}

View File

@ -0,0 +1,23 @@
package com.das.modules.node.domain.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
@Data
public class SysNodeDto implements Serializable {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
private String nodeName;
private String nodeIp;
private Integer revision;
}

View File

@ -0,0 +1,48 @@
package com.das.modules.node.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
/**
* 链路前端回显
*
* @author guchengwei
*/
@Data
public class SysCommunicationLinkVo {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 链路名称
*/
private String linkName;
/**
* 通讯协议
*/
private Integer protocol;
/**
* 协议参数
*/
private String params;
/**
* 所属系统节点
*/
private String nodeName;
/**
* 所属系统节点id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long nodeId;
private Integer revision;
}

View File

@ -0,0 +1,42 @@
package com.das.modules.node.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
/**
* 节点前端回显
*
* @author guchengwei
*/
@Data
public class SysNodeVo {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 节点名称
*/
private String nodeName;
/**
* 节点ip
*/
private String nodeIp;
/**
* 所属机构
*/
private String orgName;
/**
* 所属机构id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
private Integer revision;
}

View File

@ -0,0 +1,65 @@
package com.das.modules.node.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.das.common.constant.BaseEntity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serial;
/**
* <p>
* 链路表
* </p>
*
* @author chenhaojie
*/
@EqualsAndHashCode(callSuper = true)
@TableName("sys_communicationlink")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysCommunicationLink extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 系统节点ID
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 链路名称
*/
@TableField("link_name")
private String linkName;
/**
* 通讯协议
*/
@TableField("protocol")
private Integer protocol;
/**
* 协议参数
*/
@TableField("params")
private String params;
/**
* 所属系统节点ID
*/
@TableField("node_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long nodeId;
}

View File

@ -0,0 +1,59 @@
package com.das.modules.node.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.das.common.constant.BaseEntity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serial;
/**
* <p>
* 节点表
* </p>
*
* @author chenhaojie
*/
@EqualsAndHashCode(callSuper = true)
@TableName("sys_node")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysNode extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 系统节点ID
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 节点名称
*/
@TableField("node_name")
private String nodeName;
/**
* 节点ip
*/
@TableField("node_ip")
private String nodeIp;
/**
* 所属机构id
*/
@TableField("org_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
}

View File

@ -0,0 +1,12 @@
package com.das.modules.node.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.das.modules.node.entity.SysCommunicationLink;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysCommunicationLinkMapper extends BaseMapper<SysCommunicationLink> {
}

View File

@ -0,0 +1,16 @@
package com.das.modules.node.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.das.modules.node.domain.vo.SysNodeVo;
import com.das.modules.node.entity.SysNode;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SysNodeMapper extends BaseMapper<SysNode> {
List<SysNodeVo> querySysNodeList();
}

View File

@ -0,0 +1,17 @@
package com.das.modules.node.service;
import com.das.modules.node.domain.dto.SysNodeDto;
import com.das.modules.node.domain.vo.SysNodeVo;
import java.util.List;
public interface SysNodeService {
List<SysNodeVo> querySysNodeList();
SysNodeVo createSysNode(SysNodeDto sysNodeDto);
SysNodeVo updateSysNode(SysNodeDto sysNodeDto);
void deleteSysNode(Long id);
}

View File

@ -0,0 +1,89 @@
package com.das.modules.node.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.das.common.config.SessionUtil;
import com.das.common.exceptions.ServiceException;
import com.das.common.utils.BeanCopyUtils;
import com.das.common.utils.SequenceUtils;
import com.das.modules.auth.domain.vo.SysUserVo;
import com.das.modules.auth.entity.SysOrg;
import com.das.modules.auth.mapper.SysOrgMapper;
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
import com.das.modules.equipment.domain.vo.SysIotModelVo;
import com.das.modules.equipment.entity.SysEquipment;
import com.das.modules.equipment.entity.SysIotModel;
import com.das.modules.node.domain.dto.SysNodeDto;
import com.das.modules.node.domain.vo.SysNodeVo;
import com.das.modules.node.entity.SysNode;
import com.das.modules.node.mapper.SysNodeMapper;
import com.das.modules.node.service.SysNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Transactional(rollbackFor = Exception.class)
@Service
public class SysNodeServiceImpl implements SysNodeService {
@Autowired
private SysNodeMapper sysNodeMapper;
@Autowired
private SysOrgMapper sysOrgMapper;
@Override
public List<SysNodeVo> querySysNodeList() {
List<SysNodeVo> sysNodeVoList = sysNodeMapper.querySysNodeList();
return sysNodeVoList;
}
@Override
public SysNodeVo createSysNode(SysNodeDto sysNodeDto) {
SysNode sysNode = new SysNode();
BeanCopyUtils.copy(sysNodeDto,sysNode);
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
sysNode.setId(SequenceUtils.generateId());
sysNode.setCreatedTime(new Date());
sysNode.setUpdatedTime(new Date());
sysNode.setCreatedBy(sysUserVo.getAccount());
sysNode.setUpdatedBy(sysUserVo.getAccount());
// sysNode.setCreatedBy("测试");
// sysNode.setUpdatedBy("测试");
sysNode.setRevision(1);
sysNodeMapper.insert(sysNode);
SysNodeVo sysNodeVo = new SysNodeVo();
// 根据org_id查询组织名称
SysOrg sysorg = sysOrgMapper.selectById(sysNode.getOrgId());
BeanCopyUtils.copy(sysNode,sysNodeVo);
sysNodeVo.setOrgName(sysorg.getName());
return sysNodeVo;
}
@Override
public SysNodeVo updateSysNode(SysNodeDto sysNodeDto) {
SysNode sysNode = new SysNode();
BeanCopyUtils.copy(sysNodeDto,sysNode);
// SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
sysNode.setUpdatedTime(new Date());
sysNode.setUpdatedBy("测试");
// sysIotModel.setUpdatedBy("sysUserVo.getAccount()");
sysNodeMapper.updateById(sysNode);
SysNodeVo sysNodeVo = new SysNodeVo();
// 根据org_id查询组织名称
SysOrg sysorg = sysOrgMapper.selectById(sysNode.getOrgId());
BeanCopyUtils.copy(sysNode,sysNodeVo);
sysNodeVo.setOrgName(sysorg.getName());
return sysNodeVo;
}
@Override
public void deleteSysNode(Long id) {
// 判断节点下是否有链路有就不能删除
sysNodeMapper.deleteById(id);
}
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.das.modules.node.mapper.SysNodeMapper">
<resultMap type="com.das.modules.node.domain.vo.SysNodeVo" id="SysNodeMap">
<result property="id" column="id" jdbcType="BIGINT"/>
<result property="nodeName" column="node_name" jdbcType="VARCHAR"/>
<result property="nodeIp" column="node_ip" jdbcType="VARCHAR"/>
<result property="orgName" column="orgName" jdbcType="VARCHAR"/>
<result property="orgId" column="org_id" jdbcType="BIGINT"/>
<result property="revision" column="revision" jdbcType="INTEGER"/>
</resultMap>
<select id="querySysNodeList" resultMap="SysNodeMap">
select sn.*,so."name" as orgName from sys_node sn left join sys_org so on sn.org_id = so.id
</select>
</mapper>

View File

@ -2,4 +2,5 @@
- [API说明](api/)
- [系统管理](api/systemmgr.md)
- [设备管理](api/equipment.md)
- [节点管理](api/node.md)
- [数据采集](datacollect/)

View File

@ -2,30 +2,32 @@
## API接口一览表
| 接口分类 | 接口描述 | API接口 | 权限 |
| ------------- | -------------------------------- | ------------------------------------- | ---------------------------- |
| 接口分类 | 接口描述 | API接口 | 权限 |
| ------------- |------------------------| ------------------------------------- | ---------------------------- |
| 2.1设备类型 | 2.1.1获取所有设备类型信息 | /api/equipment/type/list | |
| 2.2物模型 | 2.2.1获取物模型列表 | /api/equipment/model/list | |
| | 2.2.2物模型新增 | /api/equipment/model/add | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.3物模型修改 | /api/equipment/model/update | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.4物模型删除 | /api/equipment/model/delete | SYS_AUTHORITY_ID_ADMIN |
| 2.2物模型属性 | 2.2.5获取物模型属性列表 | /api/equipment/model/attribute/list | |
| | 2.2.6物模型属性新增 | /api/equipment/model/attribute/add | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.7物模型属性修改 | /api/equipment/model/attribute/update | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.8物模型属性删除 | /api/equipment/model/attribute/delete | SYS_AUTHORITY_ID_ADMIN |
| 2.2物模型方法 | 2.2.9获取物模型方法列表 | /api/equipment/model/service/list | |
| | 2.2.10物模型方法新增 | /api/equipment/model/service/add | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.11物模型方法修改 | /api/equipment/model/service/update | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.12物模型方法删除 | /api/equipment/model/service/delete | SYS_AUTHORITY_ID_ADMIN |
| 2.2物模型 | 2.2.1获取物模型列表 | /api/equipment/model/list | |
| | 2.2.2物模型新增 | /api/equipment/model/add | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.3物模型修改 | /api/equipment/model/update | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.4物模型删除 | /api/equipment/model/delete | SYS_AUTHORITY_ID_ADMIN |
| 2.2物模型属性 | 2.2.5获取物模型属性列表 | /api/equipment/model/attribute/list | |
| | 2.2.6物模型属性新增 | /api/equipment/model/attribute/add | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.7物模型属性修改 | /api/equipment/model/attribute/update | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.8物模型属性删除 | /api/equipment/model/attribute/delete | SYS_AUTHORITY_ID_ADMIN |
| 2.2物模型方法 | 2.2.9获取物模型方法列表 | /api/equipment/model/service/list | |
| | 2.2.10物模型方法新增 | /api/equipment/model/service/add | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.11物模型方法修改 | /api/equipment/model/service/update | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.12物模型方法删除 | /api/equipment/model/service/delete | SYS_AUTHORITY_ID_ADMIN |
| | 2.2.13 Excel导出物模型属性和方法 | /api/equipment/model/export | |
| | 2.2.14 Excel导入物模型属性和方法 | /api/equipment/model/import | SYS_AUTHORITY_ID_ADMIN |
| 2.3设备台账 | 2.3.1 设备不分页查询 | /api/equipment/list | SYS_AUTHORITY_ID_DEVICE_VIEW |
| | 2.3.2 设备分页查询 | /api/equipment/query | SYS_AUTHORITY_ID_DEVICE_VIEW |
| | 2.3.3 设备新增 | /api/equipment/add | SYS_AUTHORITY_ID_DEVICE_MGR |
| | 2.3.4 设备修改 | /api/equipment/update | SYS_AUTHORITY_ID_DEVICE_MGR |
| | 2.3.5 设备删除 | /api/equipment/delete | SYS_AUTHORITY_ID_DEVICE_MGR |
| | 2.3.6 Excel导出设备清单 | /api/equipment/export | SYS_AUTHORITY_ID_DEVICE_VIEW |
| | 2.3.7 Excel导入设备清单 | /api/equipment/import | SYS_AUTHORITY_ID_DEVICE_MGR |
| 2.3设备台账 | 2.3.1 设备不分页查询 | /api/equipment/list | SYS_AUTHORITY_ID_DEVICE_VIEW |
| | 2.3.2 设备分页查询 | /api/equipment/query | SYS_AUTHORITY_ID_DEVICE_VIEW |
| | 2.3.3 设备新增 | /api/equipment/add | SYS_AUTHORITY_ID_DEVICE_MGR |
| | 2.3.4 设备修改 | /api/equipment/update | SYS_AUTHORITY_ID_DEVICE_MGR |
| | 2.3.5 设备删除 | /api/equipment/delete | SYS_AUTHORITY_ID_DEVICE_MGR |
| | 2.3.6 Excel导出设备清单 | /api/equipment/export | SYS_AUTHORITY_ID_DEVICE_VIEW |
| | 2.3.7 Excel导入设备清单 | /api/equipment/import | SYS_AUTHORITY_ID_DEVICE_MGR |
| | 2.3.8 获取设备树 | /api/equipment/getEquipmentTree | |
| | 2.3.9 获取所有设备类型 | /api/equipment/type | |
### 2.1 设备类型相关接口
@ -870,9 +872,175 @@ POST请求接口
返回报文
```json
{
"code": 200,
"success": true,
"data": [
{
"code": 200,
"success": true,
"msg": "操作成功"
"id": "2",
"objectType": 10002,
"code": "10002",
"name": "机组",
"longitude": 0,
"latitude": 0,
"parentEquipmentId": "0",
"equipChildren": [
{
"createdBy": "测试",
"createdTime": "2024-07-08 06:50:32",
"updatedBy": "测试",
"updatedTime": "2024-07-08 06:50:32",
"revision": 1,
"id": "1810204805816188930",
"objectType": 10002,
"code": "",
"name": "GGG",
"madeinFactory": "",
"model": "",
"location": "",
"longitude": 0,
"latitude": 0,
"remarks": "",
"orgId": "1",
"parentEquipmentId": "2"
},
{
"createdBy": "测试",
"createdTime": "2024-07-08 06:52:44",
"updatedBy": "测试",
"updatedTime": "2024-07-08 06:52:44",
"revision": 1,
"id": "1810205361720852481",
"objectType": 10002,
"code": "",
"name": "RRR",
"madeinFactory": "",
"model": "",
"location": "",
"longitude": 0,
"latitude": 0,
"remarks": "",
"orgId": "1",
"parentEquipmentId": "2"
},
{
"createdBy": "测试",
"createdTime": "2024-07-08 06:53:07",
"updatedBy": "测试",
"updatedTime": "2024-07-08 15:01:33",
"revision": 1,
"id": "1810205456222715906",
"objectType": 10002,
"code": "test1",
"name": "test1",
"madeinFactory": "test1",
"model": "test1",
"location": "test1",
"longitude": 48.69145,
"latitude": 20.6946,
"installDate": "2027-07-05 15:30:23",
"remarks": "test1",
"orgId": "1",
"parentEquipmentId": "2"
},
{
"createdBy": "测试",
"createdTime": "2024-07-08 07:02:38",
"updatedBy": "测试",
"updatedTime": "2024-07-08 07:02:38",
"revision": 1,
"id": "1810207853032570881",
"objectType": 10002,
"code": "",
"name": "12121",
"madeinFactory": "",
"model": "",
"location": "",
"longitude": 0,
"latitude": 0,
"remarks": "",
"orgId": "1",
"parentEquipmentId": "2"
}
]
},
{
"id": "1",
"objectType": 10001,
"code": "10001",
"name": "风电场",
"longitude": 0,
"latitude": 0,
"parentEquipmentId": "0",
"equipChildren": [
{
"createdBy": "测试",
"createdTime": "2024-07-08 06:41:56",
"updatedBy": "测试",
"updatedTime": "2024-07-08 06:41:56",
"revision": 1,
"id": "1810202642163499009",
"objectType": 10001,
"code": "",
"name": "aaaa",
"madeinFactory": "",
"model": "",
"location": "",
"longitude": 0,
"latitude": 0,
"remarks": "",
"orgId": "1",
"parentEquipmentId": "1"
},
{
"createdBy": "测试",
"createdTime": "2024-07-08 06:45:09",
"updatedBy": "测试",
"updatedTime": "2024-07-08 06:45:09",
"revision": 1,
"id": "1810203450657538050",
"objectType": 10001,
"code": "",
"name": "yy",
"madeinFactory": "",
"model": "",
"location": "",
"longitude": 0,
"latitude": 0,
"remarks": "",
"orgId": "1",
"parentEquipmentId": "1"
}
]
}
],
"msg": "操作成功"
}
```
#### 2.3.9 获取所有设备类型
> /api/equipment/type
请求参数
无请求参数
返回报文
```json
{
"code": 200,
"success": true,
"data": [
{
"equipmentTypeId": "10001",
"equipmentTypeName": "风电场"
},
{
"equipmentTypeId": "10002",
"equipmentTypeName": "机组"
}
],
"msg": "操作成功"
}
```

176
docs/api/node.md Normal file
View File

@ -0,0 +1,176 @@
# 节点模块
# API接口一览表
| 接口分类 | 接口描述 | API接口 | 权限 |
|-------|--------------------------|------------------------| ---------------------------- |
| 1.1节点 | 1.1.1获取所有节点信息列表 | /api/node/list | |
| | 1.1.2新增节点信息 | /api/node/add | |
| | 1.1.3修改节点信息 | /api/node/update | SYS_AUTHORITY_ID_ADMIN |
| | 1.1.4删除节点信息 | /api/node/delete | SYS_AUTHORITY_ID_ADMIN |
| | 1.1.5配置下发 | /api/node/configUpdate | SYS_AUTHORITY_ID_ADMIN |
| 1.2链路 | 1.2.1获取所有链路分页查询 | /api/node/link/list | |
| | 1.2.2新增链路信息 | /api/node/link/add | SYS_AUTHORITY_ID_ADMIN |
| | 1.2.3修改链路信息 | /api/node/link/update | SYS_AUTHORITY_ID_ADMIN |
| | 1.2.4删除链路信息 | /api/node/link/delete | SYS_AUTHORITY_ID_ADMIN |
### 1.1 节点相关接口
#### 1.1.1 获取所有节点信息列表
POST 请求接口
> /api/node/list
请求参数
返回报文
```json
{
"code": 200,
"success": true,
"data": [
{
"id": "1",
"nodeName": "测试节点",
"nodeIp": "127.0.0.1",
"orgName": "某风电场",
"orgId": "1",
"revision": 1
}
],
"msg": "操作成功"
}
```
返参描述
| 参数名 | 参数类型 | 可选 | 描述 |
| ------------- | -------- | ---- |------|
| id | String | 否 | 节点ID |
| nodeName | String | 否 | 节点名称 |
| nodeIp | String | 否 | 节点IP |
| orgName | String | 否 | 机构名称 |
| orgId | String | 否 | 机构ID |
| revision | String | 否 | 乐观锁 |
#### 1.1.2 新增节点信息
POST 请求接口
> /api/node/add
请求参数
```json
{
"nodeName": "测试节点1",
"nodeIp": "127.0.0.1",
"orgId": "1"
}
```
入参描述
| 参数名 | 参数类型 | 可选 | 描述 |
| ------------- | -------- | ---- |------|
| nodeName | String | 否 | 节点名称 |
| nodeIp | String | 否 | 节点IP |
| orgId | String | 否 | 机构ID |
返回报文
```json
{
"code": 200,
"success": true,
"data": {
"id": "73535240297775104",
"nodeName": "测试节点1",
"nodeIp": "127.0.0.1",
"orgName": "某风电场",
"orgId": "1",
"revision": 1
},
"msg": "操作成功"
}
```
#### 1.1.3 修改节点信息
POST 请求接口
> /api/node/update
请求参数
```json
{
"id": "73535240297775104",
"nodeName": "测试节点1",
"nodeIp": "127.0.0.3",
"orgId": "1",
"revision": 2
}
```
返回报文
```json
{
"code": 200,
"success": true,
"data": {
"id": "73535240297775104",
"nodeName": "测试节点1",
"nodeIp": "127.0.0.3",
"orgName": "某风电场",
"orgId": "1",
"revision": 3
},
"msg": "操作成功"
}
```
#### 1.1.4 删除节点信息
POST 请求接口
> /api/node/delete
请求参数
```json
{
"id": "73535240297775104"
}
```
返回报文
```json
{
"code": 200,
"success": true,
"msg": "操作成功"
}
```
#### 1.1.5 配置下发
POST 请求接口
> /api/node/configUpdate
请求参数
```json
```
返回报文
```json
{
"code": 200,
"success": true,
"msg": "操作成功"
}
```