Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
c24e340de9
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.das.common.constant.BaseEntity;
|
import com.das.common.constant.BaseEntity;
|
||||||
|
import com.das.modules.equipment.entity.SysEquipment;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -102,8 +103,8 @@ public class SysOrg extends BaseEntity {
|
|||||||
private String aliasName;
|
private String aliasName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子节点
|
* 子设备节点
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<SysOrg> children;
|
private List<SysEquipment> equipChildren;
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,12 @@ import com.das.common.result.R;
|
|||||||
import com.das.common.utils.PageDataInfo;
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.modules.auth.entity.SysOrg;
|
import com.das.modules.auth.entity.SysOrg;
|
||||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||||
|
import com.das.modules.equipment.domain.dto.SysIotModelDto;
|
||||||
import com.das.modules.equipment.domain.vo.EquipmentTypeVo;
|
import com.das.modules.equipment.domain.vo.EquipmentTypeVo;
|
||||||
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||||
import com.das.modules.equipment.service.SysEquipmentService;
|
import com.das.modules.equipment.service.SysEquipmentService;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
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.PostMapping;
|
||||||
@ -110,15 +113,36 @@ public class EquipmentController {
|
|||||||
return sysEquipmentService.querySysEquipmentList(sysEquipmentDto);
|
return sysEquipmentService.querySysEquipmentList(sysEquipmentDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备类型列表
|
||||||
|
* @return 所有的设备类型
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
public R<List<SysEquipmentVo>> queryAllSysEquipmentList(@RequestBody SysEquipmentDto sysEquipmentDto) {
|
||||||
|
return R.success(sysEquipmentService.queryAllSysEquipmentList(sysEquipmentDto));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备树
|
* 查询设备树
|
||||||
* @return 所有的设备类型
|
* @return 所有的设备类型
|
||||||
*/
|
*/
|
||||||
@PostMapping("/getDeviceTree")
|
@PostMapping("/getEquipmentTree")
|
||||||
public R<List<SysOrg>> getRootOrg(@RequestBody SysEquipmentDto sysEquipmentDto) {
|
public R<List<SysOrg>> getRootOrg(@RequestBody SysEquipmentDto sysEquipmentDto) {
|
||||||
if (sysEquipmentDto.getOrgId() == null) {
|
if (sysEquipmentDto.getOrgId() == null) {
|
||||||
throw new ServiceException("参数缺失");
|
throw new ServiceException("参数缺失");
|
||||||
}
|
}
|
||||||
return R.success(sysEquipmentService.getRootOrg(sysEquipmentDto));
|
return R.success(sysEquipmentService.getRootOrg(sysEquipmentDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 设备导出 */
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void exportSysEquipment(@RequestBody SysEquipmentDto sysEquipmentDto, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
|
if (sysEquipmentDto.getParentEquipmentId() == null) {
|
||||||
|
throw new ServiceException("请选择需要下载的设备类型信息");
|
||||||
|
}
|
||||||
|
sysEquipmentService.exportSysEquipment(sysEquipmentDto,request, response);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.das.modules.equipment.domain.excel;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysEquipmentExcel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型编码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型编码",index = 0)
|
||||||
|
private Integer objectType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属物模型ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "所属物模型名称",index = 1)
|
||||||
|
private String iotModelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备编码",index = 2)
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名称",index = 3)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制造商
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "制造商",index = 4)
|
||||||
|
private String madeinFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号规格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "型号规格",index = 5)
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装位置
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "安装位置",index = 6)
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装位置_经度
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "安装位置_经度",index = 7)
|
||||||
|
private float longitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装位置_纬度
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "安装位置_纬度",index = 8)
|
||||||
|
private float latitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装日期
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "安装日期",index = 9)
|
||||||
|
private Date installDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注",index = 10)
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "机构名称",index = 11)
|
||||||
|
private String orgName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级设备id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "上级设备名称",index = 12)
|
||||||
|
private String parentEquipmentName;
|
||||||
|
|
||||||
|
}
|
@ -4,15 +4,23 @@ package com.das.modules.equipment.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||||
|
import com.das.modules.equipment.domain.dto.SysIotModelDto;
|
||||||
import com.das.modules.equipment.domain.dto.SysIotModelFieldDto;
|
import com.das.modules.equipment.domain.dto.SysIotModelFieldDto;
|
||||||
|
import com.das.modules.equipment.domain.excel.SysEquipmentExcel;
|
||||||
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||||
import com.das.modules.equipment.domain.vo.SysIotModelFieldVo;
|
import com.das.modules.equipment.domain.vo.SysIotModelFieldVo;
|
||||||
import com.das.modules.equipment.entity.SysEquipment;
|
import com.das.modules.equipment.entity.SysEquipment;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysEquipmentMapper extends BaseMapper<SysEquipment> {
|
public interface SysEquipmentMapper extends BaseMapper<SysEquipment> {
|
||||||
|
|
||||||
IPage<SysEquipmentVo> querySysEquipmentList(IPage<SysEquipmentVo> page, @Param("info") SysEquipmentDto sysEquipmentDto);
|
IPage<SysEquipmentVo> querySysEquipmentList(IPage<SysEquipmentVo> page, @Param("info") SysEquipmentDto sysEquipmentDto);
|
||||||
|
|
||||||
|
List<SysEquipment> queryEquipmentTree(@Param("info")SysEquipmentDto sysEquipmentDto);
|
||||||
|
|
||||||
|
List<SysEquipmentExcel> queryInfoById (@Param("info") SysEquipmentDto sysEquipmentDto);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,10 @@ public interface SysEquipmentService {
|
|||||||
|
|
||||||
PageDataInfo<SysEquipmentVo> querySysEquipmentList(SysEquipmentDto sysEquipmentDto);
|
PageDataInfo<SysEquipmentVo> querySysEquipmentList(SysEquipmentDto sysEquipmentDto);
|
||||||
|
|
||||||
|
List<SysEquipmentVo> queryAllSysEquipmentList(SysEquipmentDto sysEquipmentDto);
|
||||||
|
|
||||||
List<SysOrg> getRootOrg(SysEquipmentDto sysEquipmentDto);
|
List<SysOrg> getRootOrg(SysEquipmentDto sysEquipmentDto);
|
||||||
|
|
||||||
|
void exportSysEquipment(SysEquipmentDto sysEquipmentDto, HttpServletRequest request, HttpServletResponse response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,18 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.das.common.config.SessionUtil;
|
import com.das.common.config.SessionUtil;
|
||||||
import com.das.common.exceptions.ServiceException;
|
import com.das.common.exceptions.ServiceException;
|
||||||
import com.das.common.utils.BeanCopyUtils;
|
import com.das.common.utils.BeanCopyUtils;
|
||||||
|
import com.das.common.utils.ExcelUtil;
|
||||||
import com.das.common.utils.PageDataInfo;
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.common.utils.PageQuery;
|
import com.das.common.utils.PageQuery;
|
||||||
import com.das.modules.auth.domain.vo.SysUserVo;
|
import com.das.modules.auth.domain.vo.SysUserVo;
|
||||||
import com.das.modules.auth.entity.SysOrg;
|
import com.das.modules.auth.entity.SysOrg;
|
||||||
|
import com.das.modules.auth.mapper.SysOrgMapper;
|
||||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||||
|
import com.das.modules.equipment.domain.dto.SysIotModelDto;
|
||||||
|
import com.das.modules.equipment.domain.excel.SheetInfoBean;
|
||||||
|
import com.das.modules.equipment.domain.excel.SysEquipmentExcel;
|
||||||
|
import com.das.modules.equipment.domain.excel.SysIotModelFieldExcel;
|
||||||
|
import com.das.modules.equipment.domain.excel.SysIotModelServiceExcel;
|
||||||
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||||
import com.das.modules.equipment.domain.vo.SysIotModelServiceVo;
|
import com.das.modules.equipment.domain.vo.SysIotModelServiceVo;
|
||||||
import com.das.modules.equipment.domain.vo.SysIotModelVo;
|
import com.das.modules.equipment.domain.vo.SysIotModelVo;
|
||||||
@ -19,10 +26,13 @@ import com.das.modules.equipment.entity.SysIotModel;
|
|||||||
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||||
import com.das.modules.equipment.mapper.SysIotModelMapper;
|
import com.das.modules.equipment.mapper.SysIotModelMapper;
|
||||||
import com.das.modules.equipment.service.SysEquipmentService;
|
import com.das.modules.equipment.service.SysEquipmentService;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
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 org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -32,6 +42,9 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysEquipmentMapper sysEquipmentMapper;
|
private SysEquipmentMapper sysEquipmentMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysOrgMapper sysOrgMapper;
|
||||||
@Override
|
@Override
|
||||||
public SysEquipmentVo creatSysEquipment(SysEquipmentDto sysEquipmentDto) {
|
public SysEquipmentVo creatSysEquipment(SysEquipmentDto sysEquipmentDto) {
|
||||||
SysEquipment sysEquipment = new SysEquipment();
|
SysEquipment sysEquipment = new SysEquipment();
|
||||||
@ -79,8 +92,43 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
|||||||
return PageDataInfo.build(iPage.getRecords(), iPage.getTotal());
|
return PageDataInfo.build(iPage.getRecords(), iPage.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysEquipmentVo> queryAllSysEquipmentList(SysEquipmentDto sysEquipmentDto) {
|
||||||
|
// 查询当前账号机构下的子机构和子设备
|
||||||
|
QueryWrapper<SysEquipment> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("org_id", sysEquipmentDto.getOrgId());
|
||||||
|
queryWrapper.eq("parent_equipment_id", sysEquipmentDto.getParentEquipmentId());
|
||||||
|
queryWrapper.eq("object_type", sysEquipmentDto.getObjectType());
|
||||||
|
List<SysEquipment> sysEquipmentList = sysEquipmentMapper.selectList(queryWrapper);
|
||||||
|
List<SysEquipmentVo> list = new ArrayList<>();
|
||||||
|
list.addAll(BeanCopyUtils.copyList(sysEquipmentList, SysEquipmentVo.class));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysOrg> getRootOrg(SysEquipmentDto sysEquipmentDto) {
|
public List<SysOrg> getRootOrg(SysEquipmentDto sysEquipmentDto) {
|
||||||
return null;
|
// 查询当前账号机构下的子机构和子设备
|
||||||
|
QueryWrapper<SysOrg> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("id", sysEquipmentDto.getOrgId());
|
||||||
|
List<SysOrg> sysOrgList = sysOrgMapper.selectList(queryWrapper);
|
||||||
|
if (sysOrgList.size() == 0) {
|
||||||
|
throw new ServiceException("机构不存在");
|
||||||
|
}
|
||||||
|
for (SysOrg sysOrg : sysOrgList) {
|
||||||
|
sysOrg.setEquipChildren(sysEquipmentMapper.queryEquipmentTree(sysEquipmentDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sysOrgList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportSysEquipment(SysEquipmentDto sysEquipmentDto, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
// 查询物模型属性和动作
|
||||||
|
List<SysEquipmentExcel> sysEquipmentList = sysEquipmentMapper.queryInfoById(sysEquipmentDto);
|
||||||
|
String fileName = "设备类型信息表";
|
||||||
|
List<SheetInfoBean> sheetInfoBeanList = new ArrayList<>();
|
||||||
|
SheetInfoBean sheetInfoBean = new SheetInfoBean("设备类型信息", SysEquipmentExcel.class, sysEquipmentList);
|
||||||
|
sheetInfoBeanList.add(sheetInfoBean);
|
||||||
|
ExcelUtil.exportMoreSheet(fileName,request,response,sheetInfoBeanList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,23 @@
|
|||||||
<result property="iotModelId" column="iot_model_id" jdbcType="BIGINT"/>
|
<result property="iotModelId" column="iot_model_id" jdbcType="BIGINT"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="com.das.modules.equipment.domain.excel.SysEquipmentExcel" id="SysEquipmentExcelMap">
|
||||||
|
|
||||||
|
<result property="orgName" column="org_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="parentEquipmentName" column="parent_equipment_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="objectType" column="object_type" jdbcType="INTEGER"/>
|
||||||
|
<result property="iotModelName" column="iot_model_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="code" column="code" jdbcType="VARCHAR"/>
|
||||||
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="model" column="model" jdbcType="VARCHAR"/>
|
||||||
|
<result property="location" column="location" jdbcType="VARCHAR"/>
|
||||||
|
<result property="madeinFactory" column="madein_factory" jdbcType="VARCHAR"/>
|
||||||
|
<result property="installDate" column="install_date" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="remarks" column="remarks" jdbcType="VARCHAR"/>
|
||||||
|
<result property="latitude" column="latitude" jdbcType="REAL"/>
|
||||||
|
<result property="longitude" column="longitude" jdbcType="REAL"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<select id="querySysEquipmentList" resultMap="SysEquipmentMap">
|
<select id="querySysEquipmentList" resultMap="SysEquipmentMap">
|
||||||
select t.* from sys_equipment t
|
select t.* from sys_equipment t
|
||||||
<where>
|
<where>
|
||||||
@ -31,7 +48,37 @@
|
|||||||
<if test="info.parentEquipmentId != null and info.parentEquipmentId != ''">
|
<if test="info.parentEquipmentId != null and info.parentEquipmentId != ''">
|
||||||
and t.parent_equipment_id = #{info.parentEquipmentId}
|
and t.parent_equipment_id = #{info.parentEquipmentId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="info.name != null and info.name != ''">
|
||||||
|
and t.name like concat('%',#{info.name},'%')
|
||||||
|
</if>
|
||||||
|
<if test="info.code != null and info.code != ''">
|
||||||
|
and t.code like concat('%',#{info.code},'%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="queryEquipmentTree" resultMap="SysEquipmentMap">
|
||||||
|
select t.* from sys_equipment t WHERE t.org_id = #{info.id} and t.object_type in (10001,10002)
|
||||||
|
<if test="info.parentEquipmentId != null and info.parentEquipmentId != ''">
|
||||||
|
and t.parent_equipment_id = #{info.parentEquipmentId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryInfoById" resultMap="SysEquipmentExcelMap">
|
||||||
|
select t.*,se."name" as parentEquipmentName,sim.iot_model_name as iotModelName, so."name" as orgName from sys_equipment t
|
||||||
|
left join sys_equipment se on t.parent_equipment_id = se.id
|
||||||
|
left join sys_iot_model sim on t.iot_model_id = sim.id
|
||||||
|
left join sys_org so on t.org_id = so.id
|
||||||
|
<where>
|
||||||
|
<if test="info.id != null and info.id != ''">
|
||||||
|
and t.parent_equipment_id = #{info.id}
|
||||||
|
</if>
|
||||||
|
<if test="info.orgId != null and info.orgId != ''">
|
||||||
|
and t.org_id = #{info.orgId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -1,12 +1,48 @@
|
|||||||
# 数据采集
|
# 数据采集
|
||||||
|
|
||||||
## 采集配置说明
|
## 采集程序与系统交互通道
|
||||||
|
|
||||||
采集程序配置存放在: `/das/conf/collector.json`
|
采集程序与系统间采用Websocket方式通讯, 访问系统服务器端口: 7790
|
||||||
|
|
||||||
如果系统配置更新将生成配置更新文件: `/das/conf/collector.json.update`。
|
报文格式为`json`, 字符集: `utf-8`。
|
||||||
|
|
||||||
配置文件内容如下:
|
### 通道建立
|
||||||
|
|
||||||
|
采集程序建立连接时,需要带上自身节点ID,连接URL如下所示:
|
||||||
|
|
||||||
|
`ws://127.0.0.1:7790/gate/{nodeId}/{version}`
|
||||||
|
|
||||||
|
* `nodeId`: 采集节点ID
|
||||||
|
* `version`: 采集节点配置版本号,无配置时为0
|
||||||
|
|
||||||
|
建立连接后,当{version}为0时, 会主动推送配置更新命令。
|
||||||
|
|
||||||
|
PS: 同一节点只允许建立一条连接。
|
||||||
|
|
||||||
|
## 通讯报文
|
||||||
|
|
||||||
|
### 报文格式
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
//命令
|
||||||
|
"cmd": "heartbeat",
|
||||||
|
//命令ID
|
||||||
|
"cmdId": "123123",
|
||||||
|
//发送时间(毫秒)
|
||||||
|
"time": 123123123123,
|
||||||
|
//数据体
|
||||||
|
"data": {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 配置更新
|
||||||
|
|
||||||
|
?> 方向: `系统` -> `采集程序`
|
||||||
|
|
||||||
|
**命令:** `configUpdate`
|
||||||
|
|
||||||
|
**数据体:**
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -82,37 +118,6 @@
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 采集程序与系统交互通道
|
|
||||||
|
|
||||||
采集程序与系统间采用Websocket方式通讯, 访问系统服务器端口: 7790
|
|
||||||
|
|
||||||
报文格式为`json`, 字符集: `utf-8`。
|
|
||||||
|
|
||||||
### 通道建立
|
|
||||||
|
|
||||||
采集程序建立连接时,需要带上自身节点ID,连接URL如下所示:
|
|
||||||
|
|
||||||
`ws://127.0.0.1:7790/gate/{nodeId}`
|
|
||||||
|
|
||||||
PS: 同一节点只允许建立一条连接。
|
|
||||||
|
|
||||||
## 通讯报文
|
|
||||||
|
|
||||||
### 报文格式
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
//命令
|
|
||||||
"cmd": "heartbeat",
|
|
||||||
//命令ID
|
|
||||||
"cmdId": "123123",
|
|
||||||
//发送时间(毫秒)
|
|
||||||
"time": 123123123123,
|
|
||||||
//数据体
|
|
||||||
"data": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 节点心跳报文
|
### 节点心跳报文
|
||||||
|
|
||||||
?> 方向: `采集程序` -> `系统`
|
?> 方向: `采集程序` -> `系统`
|
||||||
@ -152,8 +157,8 @@ PS: 同一节点只允许建立一条连接。
|
|||||||
**数据体:**
|
**数据体:**
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
//设备ID
|
"deviceId": "1123451235464",
|
||||||
"12351235213":{
|
"values": {
|
||||||
//设备完整初始数据
|
//设备完整初始数据
|
||||||
"Ia": 123.1,
|
"Ia": 123.1,
|
||||||
"Ib": 122.1,
|
"Ib": 122.1,
|
||||||
@ -162,22 +167,12 @@ PS: 同一节点只允许建立一条连接。
|
|||||||
"Ub": 221.4,
|
"Ub": 221.4,
|
||||||
"Uc": 223.1,
|
"Uc": 223.1,
|
||||||
"Switch01": 1
|
"Switch01": 1
|
||||||
},
|
|
||||||
"12351235214":{
|
|
||||||
//设备完整初始数据
|
|
||||||
"Ia": 122.1,
|
|
||||||
"Ib": 123.1,
|
|
||||||
"Ic": 121.1,
|
|
||||||
"Ua": 224.3,
|
|
||||||
"Ub": 223.4,
|
|
||||||
"Uc": 223.1,
|
|
||||||
"Switch01": 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
````
|
```
|
||||||
|
|
||||||
### 模拟量上报
|
### 模拟量数据上报
|
||||||
|
|
||||||
?> 方向: `采集程序` -> `系统`
|
?> 方向: `采集程序` -> `系统`
|
||||||
|
|
||||||
@ -186,33 +181,120 @@ PS: 同一节点只允许建立一条连接。
|
|||||||
**数据体:**
|
**数据体:**
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
//key为设备ID
|
//数据时间(毫秒)
|
||||||
"1123451235": {
|
"dataTime": 123123123123,
|
||||||
|
//设备ID
|
||||||
|
"deviceId": "1123451235464",
|
||||||
|
"values": {
|
||||||
//key为属性名
|
//key为属性名
|
||||||
"Ia": 123.1,
|
"Ia": 123.1,
|
||||||
"Ib": 122.1,
|
"Ib": 122.1,
|
||||||
"Ic": 123.1
|
"Ic": 123.1
|
||||||
},
|
|
||||||
"351235123" : {
|
|
||||||
"P" : 1213.1,
|
|
||||||
"Q" : 123.1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### 状态量上报
|
### 状态量数据上报
|
||||||
|
|
||||||
?> 方向: `采集程序` -> `系统`
|
?> 方向: `采集程序` -> `系统`
|
||||||
|
|
||||||
**命令:** `discreteData`
|
**命令:** `stateData`
|
||||||
|
|
||||||
**数据体:**
|
**数据体:**
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
//key为设备ID
|
//数据时间(毫秒)
|
||||||
"1123451235": {
|
"dataTime": 123123123123,
|
||||||
|
//设备ID
|
||||||
|
"deviceId": "1123451235464",
|
||||||
|
"values": {
|
||||||
//key为属性名
|
//key为属性名
|
||||||
"Switch01": 1
|
"Switch01": 1
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 历史模拟量数据上报
|
||||||
|
|
||||||
|
?> 方向: `采集程序` -> `系统`
|
||||||
|
|
||||||
|
**命令:** `historyAnalogData`
|
||||||
|
|
||||||
|
**数据体:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
//数据时间(毫秒)
|
||||||
|
"dataTime": 123123123123,
|
||||||
|
//设备ID
|
||||||
|
"deviceId": "1123451235464",
|
||||||
|
"values": {
|
||||||
|
//key为属性名
|
||||||
|
"Ia": 123.1,
|
||||||
|
"Ib": 122.1,
|
||||||
|
"Ic": 123.1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 历史状态量数据上报
|
||||||
|
|
||||||
|
?> 方向: `采集程序` -> `系统`
|
||||||
|
|
||||||
|
**命令:** `historyStateData`
|
||||||
|
|
||||||
|
**数据体:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
//数据时间(毫秒)
|
||||||
|
"dataTime": 123123123123,
|
||||||
|
//设备ID
|
||||||
|
"deviceId": "1123451235464",
|
||||||
|
"values": {
|
||||||
|
//key为属性名
|
||||||
|
"Switch01": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 遥控/遥调命令请求
|
||||||
|
|
||||||
|
?> 方向: `系统` -> `采集程序`
|
||||||
|
|
||||||
|
**命令:** `deviceControl`
|
||||||
|
|
||||||
|
**数据体:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
//设备ID
|
||||||
|
"deviceId": "1123451235464",
|
||||||
|
//遥控服务名
|
||||||
|
"serviceName": "start",
|
||||||
|
//操作值
|
||||||
|
"opValue": 1
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 遥控/遥调命令响应
|
||||||
|
|
||||||
|
?> 方向: `采集程序` -> `系统`
|
||||||
|
|
||||||
|
**命令:** `deviceControlResp`
|
||||||
|
|
||||||
|
**数据体:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
//操作结果
|
||||||
|
"result": true,
|
||||||
|
//设备ID
|
||||||
|
"deviceId": "1123451235464",
|
||||||
|
//遥控服务名
|
||||||
|
"serviceName": "start",
|
||||||
|
//操作值
|
||||||
|
"opValue": 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user