Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
210dc5d8ff
@ -23,5 +23,7 @@ public interface SysEquipmentMapper extends BaseMapperPlus<SysEquipment, SysEqui
|
||||
|
||||
Long queryChildEquipmentCount(@Param("id")Long id);
|
||||
|
||||
void updateIotAddr(Long id, String iotAddr);
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.das.modules.node.command;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.das.common.utils.AdminRedisTemplate;
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AnalogDataCommand implements BaseCommand{
|
||||
public static final String YC_KEY_NAME = "RDB:YC:VALUES";
|
||||
|
||||
@Autowired
|
||||
AdminRedisTemplate adminRedisTemplate;
|
||||
@Override
|
||||
public void doCommand(TerminalMessage data) {
|
||||
JsonNode jsonNode = data.getData();
|
||||
Map<String, Object> values = Map.of(
|
||||
"deviceId", jsonNode.get("deviceId").asLong(),
|
||||
"dataTime", data.getTime(),
|
||||
"values", ListUtil.toList(jsonNode.get("value").asText())
|
||||
);
|
||||
adminRedisTemplate.set(YC_KEY_NAME, values);
|
||||
|
||||
// 存入td库
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.das.modules.node.command;
|
||||
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface BaseCommand {
|
||||
void doCommand(TerminalMessage data);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.das.modules.node.command;
|
||||
|
||||
import com.das.common.utils.AdminRedisTemplate;
|
||||
import com.das.common.utils.StringUtils;
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class HeartbeatCommand implements BaseCommand{
|
||||
|
||||
@Autowired
|
||||
AdminRedisTemplate adminRedisTemplate;
|
||||
@Override
|
||||
public void doCommand(TerminalMessage data) {
|
||||
JsonNode dataInfo = data.getData();
|
||||
if (!dataInfo.isEmpty()) {
|
||||
JsonNode linkNode = data.getData().get("links");
|
||||
if (linkNode != null && linkNode.isArray()) {
|
||||
for (JsonNode fruitNode : linkNode) {
|
||||
String linkId = fruitNode.get("linkId").asText();
|
||||
String online = fruitNode.get("online").asText();
|
||||
|
||||
if (StringUtils.isEmpty(online)) {
|
||||
adminRedisTemplate.set(linkId, 0);
|
||||
} else {
|
||||
if ("true".equals(online)) {
|
||||
adminRedisTemplate.set(linkId, 1);
|
||||
} else {
|
||||
adminRedisTemplate.set(linkId, 0);
|
||||
}
|
||||
}
|
||||
adminRedisTemplate.expire(linkId, 300L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.das.modules.node.command;
|
||||
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
|
||||
public class HistoryStateDataCommand implements BaseCommand{
|
||||
@Override
|
||||
public void doCommand(TerminalMessage data) {
|
||||
// 更新td数据库
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.das.modules.node.command;
|
||||
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
|
||||
public class InitDeviceDataCommand implements BaseCommand{
|
||||
@Override
|
||||
public void doCommand(TerminalMessage data) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.das.modules.node.command;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.das.common.utils.AdminRedisTemplate;
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class StateDataCommand implements BaseCommand{
|
||||
|
||||
public static final String YM_KEY_NAME = "RDB:YM:VALUES";
|
||||
|
||||
@Autowired
|
||||
AdminRedisTemplate adminRedisTemplate;
|
||||
@Override
|
||||
public void doCommand(TerminalMessage data) {
|
||||
JsonNode jsonNode = data.getData();
|
||||
Map<String, Object> values = Map.of(
|
||||
"deviceId", jsonNode.get("deviceId").asLong(),
|
||||
"dataTime", data.getTime(),
|
||||
"values", ListUtil.toList(jsonNode.get("value").asText())
|
||||
);
|
||||
adminRedisTemplate.set(YM_KEY_NAME, values);
|
||||
}
|
||||
}
|
@ -6,11 +6,8 @@ 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.node.domain.dto.SysCommunicationLinkDto;
|
||||
import com.das.modules.node.domain.dto.SysNodeDto;
|
||||
import com.das.modules.node.domain.vo.ProtocolTypeVo;
|
||||
import com.das.modules.node.domain.vo.SysCommunicationLinkVo;
|
||||
import com.das.modules.node.domain.vo.SysNodeVo;
|
||||
import com.das.modules.node.domain.dto.*;
|
||||
import com.das.modules.node.domain.vo.*;
|
||||
import com.das.modules.node.service.SysNodeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -149,5 +146,63 @@ public class SysNodeController {
|
||||
|
||||
return R.success(typeVoList);
|
||||
}
|
||||
|
||||
/** 获取映射表信息 */
|
||||
@PostMapping("/link/getMappingList")
|
||||
public R<?> getMappingList(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
||||
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
if (sysImptabmappingDto.getLinkId() == null) {
|
||||
throw new ServiceException("参数缺失");
|
||||
}
|
||||
List<ImptabmappingVo> list = sysNodeService.getMappingList(sysImptabmappingDto);
|
||||
return R.success(list);
|
||||
}
|
||||
|
||||
/** 获取绑定的设备列表信息 */
|
||||
@PostMapping("/link/getBindDeviceTree")
|
||||
public R<?> getBindDeviceTree(@RequestBody SysImptabmappingDto sysImptabmappingDto) {
|
||||
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
if (sysImptabmappingDto.getLinkId() == null) {
|
||||
throw new ServiceException("参数缺失");
|
||||
}
|
||||
List<SysImptabmappingVo> list = sysNodeService.getBindDeviceTree(sysImptabmappingDto.getLinkId());
|
||||
return R.success(list);
|
||||
}
|
||||
|
||||
/** 绑定设备信息 */
|
||||
@PostMapping("/link/bindDeviceMeas")
|
||||
public R<Void> bindMeas(@RequestBody BindEquipmentDto bindEquipmentDto) {
|
||||
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
sysNodeService.bindDeviceMeas(bindEquipmentDto.getEquipmentId(), bindEquipmentDto.getLinkId());
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/** 保存测点信息 */
|
||||
@PostMapping("/link/saveMappingList")
|
||||
public R<Void> saveMappingList(@RequestBody List<ImptabmappingDto> impList) {
|
||||
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
sysNodeService.saveMappingList(impList);
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.das.modules.node.disruptor;
|
||||
|
||||
import com.das.common.utils.SpringUtils;
|
||||
import com.das.modules.node.command.BaseCommand;
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import com.das.modules.node.handler.NodeMessageHandler;
|
||||
import com.lmax.disruptor.EventHandler;
|
||||
@ -23,9 +25,23 @@ public class TerminalMessageEventHandler implements EventHandler<TerminalMessage
|
||||
if (callbackMap.containsKey(terminalMessage.getCmdId())){
|
||||
//如果是回调函数,推送到回调函数
|
||||
callbackMap.get(terminalMessage.getCmdId()).complete(terminalMessage);
|
||||
}
|
||||
else{
|
||||
|
||||
} else{
|
||||
String cmd = terminalMessage.getCmd();
|
||||
BaseCommand commander = null;
|
||||
try {
|
||||
commander = SpringUtils.getBean(cmd);
|
||||
} catch (Exception e) {
|
||||
log.debug("当前未找到执行command容器");
|
||||
}
|
||||
if (commander != null) {
|
||||
try {
|
||||
commander.doCommand(terminalMessage);
|
||||
} catch (Exception ex) {
|
||||
log.error(String.format("命令 - %s 处理失败", cmd), ex);
|
||||
}
|
||||
} else {
|
||||
log.error("命令[{}]无效, 未发现实现适配器!", cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
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.util.List;
|
||||
|
||||
@Data
|
||||
public class BindEquipmentDto {
|
||||
|
||||
private List<BindEquipmentInfoDto> equipmentId;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long linkId;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
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.util.List;
|
||||
|
||||
@Data
|
||||
public class BindEquipmentInfoDto {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long equipmentId;
|
||||
|
||||
private String iotAddr;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
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 ImptabmappingDto implements Serializable {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long linkId;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long equipmentId;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private Object params;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
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 SysImptabmappingDto implements Serializable {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long linkId;
|
||||
|
||||
private Integer type;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.das.modules.node.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ConfigUpdateVo {
|
||||
|
||||
public Integer version;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private String nodeId;
|
||||
|
||||
private List<LinkVo> links;
|
||||
|
||||
private List equipments;
|
||||
|
||||
public ConfigUpdateVo() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.das.modules.node.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EquipmentVo {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String addr;
|
||||
|
||||
private List<IotModelVo> attrs;
|
||||
|
||||
private List<IotModelVo> services;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.das.modules.node.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 映射表前端回显
|
||||
*
|
||||
* @author guchengwei
|
||||
*/
|
||||
@Data
|
||||
public class ImptabmappingVo {
|
||||
|
||||
private String name;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long equipmentId;
|
||||
|
||||
private String equipmentName;
|
||||
private Integer porder;
|
||||
|
||||
private String params;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.das.modules.node.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 映射表前端回显
|
||||
*
|
||||
* @author guchengwei
|
||||
*/
|
||||
@Data
|
||||
public class IotModelVo {
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
private Object params;
|
||||
}
|
20
das/src/main/java/com/das/modules/node/domain/vo/LinkVo.java
Normal file
20
das/src/main/java/com/das/modules/node/domain/vo/LinkVo.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.das.modules.node.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LinkVo {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long linkId;
|
||||
|
||||
private String linkName;
|
||||
//协议号
|
||||
private Integer protocol;
|
||||
//协议参数
|
||||
private Object params;
|
||||
|
||||
private String[] devices;
|
||||
}
|
@ -30,7 +30,7 @@ public class SysCommunicationLinkVo {
|
||||
/**
|
||||
* 协议参数
|
||||
*/
|
||||
private String params;
|
||||
private Object params;
|
||||
|
||||
/**
|
||||
* 所属系统节点
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.das.modules.node.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 映射表前端回显
|
||||
*
|
||||
* @author guchengwei
|
||||
*/
|
||||
@Data
|
||||
public class SysImptabmappingVo {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long linkId;
|
||||
|
||||
private String linkName;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long equipmentId;
|
||||
|
||||
private String equipmentName;
|
||||
|
||||
private String equipmentAttribute;
|
||||
|
||||
private String equipmentService;
|
||||
|
||||
private Integer porder;
|
||||
|
||||
private String params;
|
||||
|
||||
private Integer revision;
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
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_imptabmapping")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysImptabmapping extends BaseEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 系统节点ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 对应链路ID
|
||||
*/
|
||||
@TableField("link_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long linkId;
|
||||
|
||||
/**
|
||||
* 对应设备ID
|
||||
*/
|
||||
@TableField("equipment_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long equipmentId;
|
||||
|
||||
/**
|
||||
* 对应设备属性
|
||||
*/
|
||||
@TableField("equipment_attribute")
|
||||
private String equipmentAttribute;
|
||||
|
||||
/**
|
||||
* 对应设备服务
|
||||
*/
|
||||
@TableField("equipment_service")
|
||||
private String equipmentService;
|
||||
|
||||
@TableField("porder")
|
||||
private Integer porder;
|
||||
|
||||
@TableField("params")
|
||||
private String params;
|
||||
}
|
@ -32,6 +32,7 @@ public class NodeMessageHandler extends TextWebSocketHandler {
|
||||
String remoteIp = (String) session.getAttributes().getOrDefault(NodeConstant.REMOTE_IP, "");
|
||||
Long nodeId = (Long)session.getAttributes().get(NodeConstant.NODE_ID);
|
||||
Long version = (Long)session.getAttributes().get(NodeConstant.VERSION);
|
||||
long time = System.currentTimeMillis();
|
||||
log.debug("IP: {} 请求连接. sessionId: {}", remoteIp, session.getId());
|
||||
if (onlineSessions.containsKey(nodeId)){
|
||||
//如果终端节点已在线,则拒绝新的终端连接
|
||||
@ -51,11 +52,11 @@ public class NodeMessageHandler extends TextWebSocketHandler {
|
||||
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
|
||||
TerminalMessage msg = JsonUtils.parseObject(message.getPayload(), TerminalMessage.class);
|
||||
String nodeId = session.getAttributes().get(NodeConstant.NODE_ID).toString();
|
||||
Long version = (Long)session.getAttributes().get(NodeConstant.VERSION);
|
||||
String cmdId = msg.getCmdId();
|
||||
String cmd = msg.getCmd();
|
||||
long time = msg.getTime();
|
||||
JsonNode data = msg.getData();
|
||||
|
||||
log.info("收到 Node:{} 命令: {}", nodeId, cmd);
|
||||
log.debug("内容: {}", data.toString());
|
||||
if (dataService == null){
|
||||
@ -64,6 +65,17 @@ public class NodeMessageHandler extends TextWebSocketHandler {
|
||||
if (dataService != null){
|
||||
dataService.pushMessage(msg);
|
||||
}
|
||||
// 如果version是0,则需要调用一次configUpdate配置更新
|
||||
if (version == 0){
|
||||
JsonNode configUpdateData = dataService.getConfigUpdateInfo(Long.valueOf(nodeId));
|
||||
TerminalMessage configUpdate = TerminalMessage.builder()
|
||||
.cmd("configUpdate")
|
||||
.cmdId(nodeId)
|
||||
.time(time)
|
||||
.data(configUpdateData)
|
||||
.build();
|
||||
sendActionMessage(Long.valueOf(nodeId), configUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,7 +147,8 @@ public class NodeMessageHandler extends TextWebSocketHandler {
|
||||
WebSocketSession session = onlineSessions.get(nodeId);
|
||||
if (session != null){
|
||||
try {
|
||||
session.sendMessage(new TextMessage(message.toString()));
|
||||
session.sendMessage(new TextMessage(message.toJsonString()));
|
||||
log.info("发送的消息为:{}", message.toJsonString());
|
||||
}
|
||||
catch (Exception exception){
|
||||
log.error(String.format("发送消息失败: NodeId: %s", nodeId), exception);
|
||||
|
@ -9,10 +9,14 @@ import com.das.modules.node.entity.SysCommunicationLink;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysCommunicationLinkMapper extends BaseMapper<SysCommunicationLink> {
|
||||
IPage<SysCommunicationLinkVo> querySysCommunicationLinkList(IPage<SysCommunicationLinkVo> page, @Param("info") SysCommunicationLinkDto sysCommunicationLinkDto);
|
||||
|
||||
Long querySysCommunicationLinkCount(@Param("nodeId") Long nodeId);
|
||||
|
||||
List<SysCommunicationLinkVo> querySysCommunicationLink(@Param("nodeId") Long nodeId);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.das.modules.node.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.das.modules.auth.mapper.BaseMapperPlus;
|
||||
import com.das.modules.node.domain.dto.SysCommunicationLinkDto;
|
||||
import com.das.modules.node.domain.vo.ImptabmappingVo;
|
||||
import com.das.modules.node.domain.vo.IotModelVo;
|
||||
import com.das.modules.node.domain.vo.SysCommunicationLinkVo;
|
||||
import com.das.modules.node.domain.vo.SysImptabmappingVo;
|
||||
import com.das.modules.node.entity.SysCommunicationLink;
|
||||
import com.das.modules.node.entity.SysImptabmapping;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysImptabmappingMapper extends BaseMapperPlus<SysImptabmapping, SysImptabmapping> {
|
||||
List<ImptabmappingVo> getMappingList(Long linkId, Integer type);
|
||||
|
||||
List<ImptabmappingVo> getMappingControlList(Long linkId, Integer type);
|
||||
|
||||
List<SysImptabmappingVo> getBindDevice(Long linkId);
|
||||
|
||||
void deleteBindDevice(Long linkId);
|
||||
|
||||
List<Long> getEquipmentId(Long linkId);
|
||||
|
||||
List<IotModelVo> getIotModelFieldByEquipmentId(Long equipmentId);
|
||||
|
||||
List<IotModelVo> getIotModelServiceByEquipmentId(Long equipmentId);
|
||||
|
||||
String getIotAddrByEquipmentId(Long equipmentId);
|
||||
|
||||
String getAttributeCode(Long equipmentId, Integer type);
|
||||
|
||||
String getServiceCode(Long equipmentId, Integer type);
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
package com.das.modules.node.service;
|
||||
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
public interface DataService {
|
||||
|
||||
void pushMessage(TerminalMessage msg);
|
||||
|
||||
JsonNode getConfigUpdateInfo(Long nodeId);
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package com.das.modules.node.service;
|
||||
|
||||
import com.das.common.utils.PageDataInfo;
|
||||
import com.das.modules.node.domain.dto.SysCommunicationLinkDto;
|
||||
import com.das.modules.node.domain.dto.SysNodeDto;
|
||||
import com.das.modules.node.domain.dto.*;
|
||||
import com.das.modules.node.domain.vo.ImptabmappingVo;
|
||||
import com.das.modules.node.domain.vo.SysCommunicationLinkVo;
|
||||
import com.das.modules.node.domain.vo.SysImptabmappingVo;
|
||||
import com.das.modules.node.domain.vo.SysNodeVo;
|
||||
|
||||
import java.util.List;
|
||||
@ -25,5 +26,10 @@ public interface SysNodeService {
|
||||
|
||||
void deleteSysCommunicationLink(Long id);
|
||||
|
||||
List<ImptabmappingVo> getMappingList(SysImptabmappingDto sysImptabmappingDto);
|
||||
|
||||
List<SysImptabmappingVo> getBindDeviceTree(Long linkId);
|
||||
void bindDeviceMeas(List<BindEquipmentInfoDto> equipmentId, Long linkId);
|
||||
|
||||
void saveMappingList(List<ImptabmappingDto> impList);
|
||||
}
|
||||
|
@ -3,7 +3,12 @@ package com.das.modules.node.service.impl;
|
||||
import com.das.modules.node.disruptor.MessageEventFactory;
|
||||
import com.das.modules.node.disruptor.TerminalMessageEventHandler;
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import com.das.modules.node.domain.vo.*;
|
||||
import com.das.modules.node.mapper.SysCommunicationLinkMapper;
|
||||
import com.das.modules.node.mapper.SysImptabmappingMapper;
|
||||
import com.das.modules.node.service.DataService;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.lmax.disruptor.RingBuffer;
|
||||
import com.lmax.disruptor.dsl.Disruptor;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
@ -11,7 +16,11 @@ import jakarta.annotation.PreDestroy;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@ -25,6 +34,12 @@ public class DataServiceImpl implements DataService {
|
||||
@Resource
|
||||
TerminalMessageEventHandler terminalMessageEventHandler;
|
||||
|
||||
@Resource
|
||||
SysCommunicationLinkMapper sysCommunicationLinkMapper;
|
||||
|
||||
@Resource
|
||||
SysImptabmappingMapper sysImptabmappingMapper;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
//初始化高性能队列
|
||||
@ -66,4 +81,69 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonNode getConfigUpdateInfo(Long nodeId) {
|
||||
ConfigUpdateVo configUpdateVo = new ConfigUpdateVo();
|
||||
List<LinkVo> links = new ArrayList<>();
|
||||
List<EquipmentVo> equipments = new ArrayList<>();
|
||||
List<Long> equipmentList = new ArrayList<>();
|
||||
// 获取所有的链路信息
|
||||
List<SysCommunicationLinkVo> sysCommunicationLinkVoList = sysCommunicationLinkMapper.querySysCommunicationLink(nodeId);
|
||||
for (SysCommunicationLinkVo sysCommunicationLinkVo : sysCommunicationLinkVoList) {
|
||||
LinkVo linkVo = new LinkVo();
|
||||
linkVo.setLinkId(sysCommunicationLinkVo.getId());
|
||||
linkVo.setLinkName(sysCommunicationLinkVo.getLinkName());
|
||||
linkVo.setParams(sysCommunicationLinkVo.getParams());
|
||||
linkVo.setProtocol(sysCommunicationLinkVo.getProtocol());
|
||||
List<String> stringList = new ArrayList<>();
|
||||
// 获取关联的设备Id
|
||||
equipmentList = sysImptabmappingMapper.getEquipmentId(sysCommunicationLinkVo.getId());
|
||||
for (Long equipmentId : equipmentList) {
|
||||
stringList.add(String.valueOf(equipmentId));
|
||||
}
|
||||
String[] stringArray = stringList.toArray(new String[0]);
|
||||
linkVo.setDevices(stringArray);
|
||||
links.add(linkVo);
|
||||
}
|
||||
for (Long equipmentId : equipmentList) {
|
||||
List<IotModelVo> newIotModelFieldList = new ArrayList<>();
|
||||
List<IotModelVo> newIotModelServiceList = new ArrayList<>();
|
||||
// 获取设备IOT地址
|
||||
String iotAddr = sysImptabmappingMapper.getIotAddrByEquipmentId(equipmentId);
|
||||
// 根据设备Id获取对应的物模型属性和动作
|
||||
List<IotModelVo> iotModelFieldList = sysImptabmappingMapper.getIotModelFieldByEquipmentId(equipmentId);
|
||||
if (!CollectionUtils.isEmpty(iotModelFieldList)) {
|
||||
for (IotModelVo info : iotModelFieldList) {
|
||||
if(info.getParams() != null){
|
||||
// info.setParams();
|
||||
}
|
||||
newIotModelFieldList.add(info);
|
||||
}
|
||||
}
|
||||
List<IotModelVo> iotModelServiceList = sysImptabmappingMapper.getIotModelServiceByEquipmentId(equipmentId);
|
||||
if (!CollectionUtils.isEmpty(iotModelServiceList)) {
|
||||
for (IotModelVo info : iotModelServiceList) {
|
||||
// if(!StringUtils.hasText(info.getParams())){
|
||||
// info.setParams("{}");
|
||||
// }
|
||||
newIotModelServiceList.add(info);
|
||||
}
|
||||
}
|
||||
EquipmentVo equipment = new EquipmentVo();
|
||||
equipment.setAddr(iotAddr);
|
||||
equipment.setId(equipmentId);
|
||||
equipment.setAttrs(newIotModelFieldList);
|
||||
equipment.setServices(newIotModelServiceList);
|
||||
equipments.add(equipment);
|
||||
}
|
||||
configUpdateVo.setCreateTime(System.currentTimeMillis());
|
||||
configUpdateVo.setNodeId(String.valueOf(nodeId));
|
||||
configUpdateVo.setVersion(1);
|
||||
configUpdateVo.setLinks(links);
|
||||
configUpdateVo.setEquipments(equipments);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode jsonNode = mapper.valueToTree(configUpdateVo);
|
||||
return jsonNode;
|
||||
}
|
||||
}
|
||||
|
@ -10,19 +10,25 @@ 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.node.domain.dto.SysCommunicationLinkDto;
|
||||
import com.das.modules.node.domain.dto.SysNodeDto;
|
||||
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||
import com.das.modules.node.domain.dto.*;
|
||||
import com.das.modules.node.domain.vo.ImptabmappingVo;
|
||||
import com.das.modules.node.domain.vo.SysCommunicationLinkVo;
|
||||
import com.das.modules.node.domain.vo.SysImptabmappingVo;
|
||||
import com.das.modules.node.domain.vo.SysNodeVo;
|
||||
import com.das.modules.node.entity.SysCommunicationLink;
|
||||
import com.das.modules.node.entity.SysImptabmapping;
|
||||
import com.das.modules.node.entity.SysNode;
|
||||
import com.das.modules.node.mapper.SysCommunicationLinkMapper;
|
||||
import com.das.modules.node.mapper.SysImptabmappingMapper;
|
||||
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 org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -40,6 +46,12 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
@Autowired
|
||||
private SysOrgMapper sysOrgMapper;
|
||||
|
||||
@Autowired
|
||||
private SysImptabmappingMapper sysImptabmappingMapper;
|
||||
|
||||
@Autowired
|
||||
private SysEquipmentMapper sysEquipmentMapper;
|
||||
|
||||
@Override
|
||||
public List<SysNodeVo> querySysNodeList() {
|
||||
List<SysNodeVo> sysNodeVoList = sysNodeMapper.querySysNodeList();
|
||||
@ -147,4 +159,99 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
// 判断节点下是否有链路,有就不能删除
|
||||
sysCommunicationLinkMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImptabmappingVo> getMappingList(SysImptabmappingDto sysImptabmappingDto) {
|
||||
// 138模拟量 139累积量 140离散量 146遥调 147遥控
|
||||
Integer type = sysImptabmappingDto.getType();
|
||||
List<ImptabmappingVo> list = new ArrayList<>();
|
||||
if (type == 138 || type == 139 || type == 140) {
|
||||
list = sysImptabmappingMapper.getMappingList(sysImptabmappingDto.getLinkId(), type);
|
||||
}else if (type == 146 || type == 147) {
|
||||
list = sysImptabmappingMapper.getMappingControlList(sysImptabmappingDto.getLinkId(), type);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysImptabmappingVo> getBindDeviceTree(Long linkId) {
|
||||
List<SysImptabmappingVo> bindDeviceList = sysImptabmappingMapper.getBindDevice(linkId);
|
||||
return bindDeviceList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindDeviceMeas(List<BindEquipmentInfoDto> equipmentId, Long linkId) {
|
||||
List<SysImptabmapping> addList = new ArrayList<>();
|
||||
//获取已经绑定的设备
|
||||
List<SysImptabmappingVo> bindDeviceList = sysImptabmappingMapper.getBindDevice(linkId);
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
if (CollectionUtils.isEmpty(bindDeviceList)) {
|
||||
addSysImptabmapping(equipmentId, linkId, sysUserVo, addList);
|
||||
} else {
|
||||
// 删除原来绑定的设备信息
|
||||
sysImptabmappingMapper.deleteBindDevice(linkId);
|
||||
addSysImptabmapping(equipmentId, linkId, sysUserVo, addList);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(addList)) {
|
||||
sysImptabmappingMapper.insertBatch(addList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveMappingList(List<ImptabmappingDto> impList) {
|
||||
if (!CollectionUtils.isEmpty(impList)) {
|
||||
List<SysImptabmapping> list = new ArrayList<>();
|
||||
int index = 0;
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
for (ImptabmappingDto imp : impList) {
|
||||
SysImptabmapping sysImptabmapping = new SysImptabmapping();
|
||||
if (imp.getType() == 138 || imp.getType() == 139 || imp.getType() == 140) {
|
||||
// 获取属性编码
|
||||
String code = sysImptabmappingMapper.getAttributeCode(imp.getEquipmentId(), imp.getType());
|
||||
sysImptabmapping.setEquipmentAttribute(code);
|
||||
}else if (imp.getType() == 146 || imp.getType() == 147) {
|
||||
// 获取动作编码
|
||||
String code = sysImptabmappingMapper.getServiceCode(imp.getEquipmentId(), imp.getType());
|
||||
sysImptabmapping.setEquipmentService(code);
|
||||
}
|
||||
index++;
|
||||
sysImptabmapping.setCreatedTime(new Date());
|
||||
sysImptabmapping.setUpdatedTime(new Date());
|
||||
sysImptabmapping.setCreatedBy(sysUserVo.getAccount());
|
||||
sysImptabmapping.setUpdatedBy(sysUserVo.getAccount());
|
||||
sysImptabmapping.setLinkId(imp.getLinkId());
|
||||
sysImptabmapping.setEquipmentId(imp.getEquipmentId());
|
||||
sysImptabmapping.setId(SequenceUtils.generateId());
|
||||
sysImptabmapping.setPorder(index);
|
||||
sysImptabmapping.setParams(String.valueOf(imp.getParams()));
|
||||
sysImptabmapping.setRevision(1);
|
||||
list.add(sysImptabmapping);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
sysImptabmappingMapper.insertBatch(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addSysImptabmapping(List<BindEquipmentInfoDto> equipmentId, Long linkId, SysUserVo sysUserVo, List<SysImptabmapping> addList) {
|
||||
int index = 0;
|
||||
for (BindEquipmentInfoDto info : equipmentId) {
|
||||
index++;
|
||||
SysImptabmapping sysImptabmapping = new SysImptabmapping();
|
||||
sysImptabmapping.setEquipmentId(info.getEquipmentId());
|
||||
sysImptabmapping.setLinkId(linkId);
|
||||
sysImptabmapping.setId(SequenceUtils.generateId());
|
||||
sysImptabmapping.setCreatedTime(new Date());
|
||||
sysImptabmapping.setUpdatedTime(new Date());
|
||||
sysImptabmapping.setCreatedBy(sysUserVo.getAccount());
|
||||
sysImptabmapping.setUpdatedBy(sysUserVo.getAccount());
|
||||
sysImptabmapping.setRevision(1);
|
||||
sysImptabmapping.setPorder(index);
|
||||
addList.add(sysImptabmapping);
|
||||
// 更新设备表里面的设备地址
|
||||
sysEquipmentMapper.updateIotAddr(info.getEquipmentId(), info.getIotAddr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,8 @@
|
||||
select count(1) from sys_communicationlink sc where sc.node_id = #{nodeId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="querySysCommunicationLink" resultType="com.das.modules.node.domain.vo.SysCommunicationLinkVo">
|
||||
select sc.id,sc.link_name,sc.protocol,to_json(sc.params::json) AS params from sys_communicationlink sc where sc.node_id = #{nodeId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -111,5 +111,9 @@
|
||||
select count(1) from sys_equipment where parent_equipment_id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateIotAddr" >
|
||||
update sys_equipment set iot_addr = #{iotAddr} where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
96
das/src/main/resources/mapper/SysImptabmappingMapper.xml
Normal file
96
das/src/main/resources/mapper/SysImptabmappingMapper.xml
Normal file
@ -0,0 +1,96 @@
|
||||
<?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.SysImptabmappingMapper">
|
||||
|
||||
<resultMap type="com.das.modules.node.domain.vo.SysImptabmappingVo" id="SysImptabmappingMap">
|
||||
<result property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="linkId" column="link_id" jdbcType="BIGINT"/>
|
||||
<result property="linkName" column="linkName" jdbcType="VARCHAR"/>
|
||||
<result property="equipmentId" column="equipment_id" jdbcType="BIGINT"/>
|
||||
<result property="equipmentName" column="equipmentName" jdbcType="VARCHAR"/>
|
||||
<result property="equipmentAttribute" column="equipment_attribute" jdbcType="VARCHAR"/>
|
||||
<result property="equipmentService" column="equipment_service" jdbcType="VARCHAR"/>
|
||||
<result property="params" column="params" jdbcType="VARCHAR"/>
|
||||
<result property="porder" column="porder" jdbcType="INTEGER"/>
|
||||
<result property="revision" column="revision" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.das.modules.node.domain.vo.ImptabmappingVo" id="ImptabmappingMap">
|
||||
<result property="equipmentName" column="equipmentName" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="equipmentId" column="equipment_id" jdbcType="BIGINT"/>
|
||||
<result property="params" column="params" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.das.modules.node.domain.vo.IotModelVo" id="IotModelMap">
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="params" column="params" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getMappingList" resultMap="ImptabmappingMap">
|
||||
select se."name" as equipmentName, simf.attribute_name as name,si.params,se.id as equipment_id from sys_imptabmapping si
|
||||
left join sys_equipment se on si.equipment_id = se.id
|
||||
left join sys_iot_model_field simf on se.iot_model_id = simf.iot_model_id
|
||||
where si.link_id = #{linkId} and simf.attribute_type = #{type}
|
||||
order by si.porder
|
||||
</select>
|
||||
|
||||
<select id="getMappingControlList" resultMap="ImptabmappingMap">
|
||||
select se."name" as equipmentName, sims.service_name as name,si.params,se.id as equipment_id from sys_imptabmapping si
|
||||
left join sys_equipment se on si.equipment_id = se.id
|
||||
left join sys_iot_model_service sims on se.iot_model_id = sims.iot_model_id
|
||||
where si.link_id = #{linkId} and sims.service_type = #{type}
|
||||
order by si.porder
|
||||
</select>
|
||||
|
||||
<select id="getBindDevice" resultMap="SysImptabmappingMap">
|
||||
select se.id as equipment_id,se."name" as equipmentName, si.porder from sys_imptabmapping si
|
||||
left join sys_equipment se on se.id = si.equipment_id
|
||||
where si.link_id = #{linkId} order by si.porder
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteBindDevice" >
|
||||
delete from sys_imptabmapping where link_id = #{linkId}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="getEquipmentId" resultType="java.lang.Long">
|
||||
select si.equipment_id from sys_imptabmapping si
|
||||
left join sys_communicationlink sc on sc.id = si.link_id
|
||||
where sc.id = #{linkId}
|
||||
</select>
|
||||
|
||||
<select id="getIotModelFieldByEquipmentId" resultType="com.das.modules.node.domain.vo.IotModelVo">
|
||||
select simf.attribute_name as name,simf.attribute_type as type,to_json(si.params::json) as params from sys_imptabmapping si
|
||||
left join sys_equipment se on si.equipment_id = se.id
|
||||
left join sys_iot_model_field simf on se.iot_model_id = simf.iot_model_id
|
||||
where si.equipment_id = #{equipmentId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getIotModelServiceByEquipmentId" resultType="com.das.modules.node.domain.vo.IotModelVo">
|
||||
select sims.service_name as name ,sims.service_type as type ,to_json(si.params::json) AS params from sys_imptabmapping si
|
||||
left join sys_equipment se on si.equipment_id = se.id
|
||||
left join sys_iot_model_service sims on se.iot_model_id = sims.iot_model_id
|
||||
where si.equipment_id = #{equipmentId}
|
||||
</select>
|
||||
|
||||
<select id="getIotAddrByEquipmentId" resultType="java.lang.String">
|
||||
select se.iot_addr from sys_equipment se where se.id = #{equipmentId}
|
||||
</select>
|
||||
|
||||
<select id="getAttributeCode" resultType="java.lang.String">
|
||||
select distinct simf.attribute_code from sys_iot_model_field simf
|
||||
left join sys_equipment se on simf.iot_model_id = se.iot_model_id
|
||||
where se.id = #{equipmentId} and simf.attribute_type = #{type}
|
||||
</select>
|
||||
|
||||
<select id="getServiceCode" resultType="java.lang.String">
|
||||
select distinct sims.service_code from sys_iot_model_service sims
|
||||
left join sys_equipment se on sims.iot_model_id = se.iot_model_id
|
||||
where se.id = #{equipmentId} and sims.service_type = #{type}
|
||||
</select>
|
||||
|
||||
</mapper>
|
190
docs/api/node.md
190
docs/api/node.md
@ -2,21 +2,27 @@
|
||||
|
||||
# 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 |
|
||||
| 接口分类 | 接口描述 | 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.2.5获取映射表信息 | /api/node/link/getMappingList | SYS_AUTHORITY_ID_ADMIN |
|
||||
| | 1.2.6绑定设备信息 | /api/node/link/bindDeviceMeas | SYS_AUTHORITY_ID_ADMIN |
|
||||
| | 1.2.7导入映射表信息 | /api/node/link/importMappingList | SYS_AUTHORITY_ID_ADMIN |
|
||||
| | 1.2.8导出映射表信息 | /api/node/link/exportMappingList | SYS_AUTHORITY_ID_ADMIN |
|
||||
| | 1.2.9获取绑定设备树信息 | /api/node/link/getBindDeviceTree | SYS_AUTHORITY_ID_ADMIN |
|
||||
| | 1.2.10保存测点信息 | /api/node/link/saveMappingList | SYS_AUTHORITY_ID_ADMIN |
|
||||
|
||||
### 1.1 节点相关接口
|
||||
## 1.1 节点相关接口
|
||||
|
||||
#### 1.1.1 获取所有节点信息列表
|
||||
### 1.1.1 获取所有节点信息列表
|
||||
|
||||
POST 请求接口
|
||||
|
||||
@ -57,7 +63,7 @@ POST 请求接口
|
||||
| revision | String | 否 | 乐观锁 |
|
||||
|
||||
|
||||
#### 1.1.2 新增节点信息
|
||||
### 1.1.2 新增节点信息
|
||||
|
||||
POST 请求接口
|
||||
|
||||
@ -98,7 +104,7 @@ POST 请求接口
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.1.3 修改节点信息
|
||||
### 1.1.3 修改节点信息
|
||||
|
||||
POST 请求接口
|
||||
|
||||
@ -132,7 +138,7 @@ POST 请求接口
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.1.4 删除节点信息
|
||||
### 1.1.4 删除节点信息
|
||||
|
||||
POST 请求接口
|
||||
|
||||
@ -154,7 +160,7 @@ POST 请求接口
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.1.5 配置下发
|
||||
### 1.1.5 配置下发
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/configUpdate
|
||||
@ -175,7 +181,9 @@ POST 请求接口
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2.1 获取节点下的链路分页查询
|
||||
## 1.2 链路相关接口
|
||||
|
||||
### 1.2.1 获取节点下的链路分页查询
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/list
|
||||
@ -228,7 +236,7 @@ POST 请求接口
|
||||
| revision | String | 否 | 乐观锁 |
|
||||
|
||||
|
||||
#### 1.2.2 新增链路
|
||||
### 1.2.2 新增链路
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/add
|
||||
@ -271,7 +279,7 @@ POST 请求接口
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2.3 修改链路
|
||||
### 1.2.3 修改链路
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/update
|
||||
@ -309,7 +317,7 @@ POST 请求接口
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2.4 删除链路
|
||||
### 1.2.4 删除链路
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/delete
|
||||
@ -331,3 +339,143 @@ POST 请求接口
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
### 1.2.5 获取映射表信息
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/getMappingList
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"linkId": "73556002258550784",
|
||||
"type": 138
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": {
|
||||
"name": "hight",
|
||||
"equipmentName": "ceshifangfa",
|
||||
"equipmenId": "1788084346705514497",
|
||||
"params":"{bindAddr:127.0.0.1,bindPort:80,targetPort:443,targetAddr:114.114.114.114,socketType:1}"
|
||||
},
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
### 1.2.6 绑定设备信息
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/bindDeviceMeas
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"equipmentId": ["1788084346705514497"],
|
||||
"linkId": "73556002258550784"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
### 1.2.7 导入映射表信息
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/importMappingList
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"linkId": "73556002258550784"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 1.2.8 导出映射表信息
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/exportMappingList
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"linkId": "73556002258550784"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 1.2.9 获取绑定设备树信息
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/getBindDeviceTree
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"linkId": "73556002258550784"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": [
|
||||
{
|
||||
"equipmentId": "73714632985149440",
|
||||
"equipmentName": "风电场测试",
|
||||
"porder": 1
|
||||
}
|
||||
],
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
### 1.2.10 保存测点信息
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/saveMappingList
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"linkId": "73556002258550784",
|
||||
"equipmentId": "73714632985149440",
|
||||
"type": 139,
|
||||
"params": "{}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
@ -71,6 +71,8 @@ PS: 同一节点只允许建立一条连接。
|
||||
{
|
||||
//设备ID
|
||||
"id": "11234131",
|
||||
//设备IOT地址
|
||||
"addr": "12341235",
|
||||
//属性列表
|
||||
"attrs":[
|
||||
{
|
||||
|
@ -10,9 +10,9 @@
|
||||
@click="onChangeTab('ele')"
|
||||
:class="state.iconType == 'ele' ? 'active' : ''"
|
||||
>
|
||||
ele
|
||||
<!-- ele -->
|
||||
</span>
|
||||
<span
|
||||
<!-- <span
|
||||
:title="'Font Awesome ' + $t('utils.Icon')"
|
||||
@click="onChangeTab('awe')"
|
||||
:class="state.iconType == 'awe' ? 'active' : ''"
|
||||
@ -24,7 +24,7 @@
|
||||
</span>
|
||||
<span :title="$t('utils.Local icon title')" @click="onChangeTab('local')" :class="state.iconType == 'local' ? 'active' : ''">
|
||||
local
|
||||
</span>
|
||||
</span> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="selector-body">
|
||||
|
@ -22,12 +22,13 @@ export const routePush = async (to: RouteLocationRaw) => {
|
||||
message: i18n.global.t('utils.Navigation failed, navigation guard intercepted!'),
|
||||
type: 'error',
|
||||
})
|
||||
} else if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
|
||||
ElNotification({
|
||||
message: i18n.global.t('utils.Navigation failed, it is at the navigation target position!'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
// else if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
|
||||
// ElNotification({
|
||||
// message: i18n.global.t('utils.Navigation failed, it is at the navigation target position!'),
|
||||
// type: 'warning',
|
||||
// })
|
||||
// }
|
||||
} catch (error) {
|
||||
ElNotification({
|
||||
message: i18n.global.t('utils.Navigation failed, invalid route!'),
|
||||
|
@ -159,7 +159,6 @@ import BaInput from '/@/components/baInput/index.vue'
|
||||
import type Node from 'element-plus/es/components/tree/src/model/node'
|
||||
|
||||
const adminInfo = useAdminInfo()
|
||||
console.log(adminInfo, 'adminInfo')
|
||||
|
||||
// 树查询
|
||||
const menuData = ref()
|
||||
@ -173,7 +172,6 @@ interface menusTree {
|
||||
const RyMenusTreeQuery = (data: any) => {
|
||||
menusTree(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
console.log(res, '菜单树查询')
|
||||
menuData.value = res.data
|
||||
nextTick(() => {
|
||||
menuTree.value?.setCurrentKey(res.data[0]?.id!, false)
|
||||
@ -234,13 +232,10 @@ interface Tree {
|
||||
const fromDataId = ref()
|
||||
const tableData = ref()
|
||||
const handleNodeClick = (data: Tree) => {
|
||||
console.log(data, '1111')
|
||||
fromDataId.value = data.id
|
||||
const queryData = {
|
||||
parentMenuId: data.id,
|
||||
}
|
||||
console.log(queryData, 'queryData')
|
||||
|
||||
queryMenuMethod(queryData)
|
||||
}
|
||||
|
||||
@ -252,18 +247,13 @@ const queryListData = {
|
||||
}
|
||||
const clickQuery = () => {
|
||||
queryListData.menuName = input2.value
|
||||
console.log(queryListData, 'queryListDataqueryListData')
|
||||
|
||||
queryMenuMethod(queryListData)
|
||||
}
|
||||
|
||||
// 查询接口
|
||||
const queryMenuMethod = (data: any) => {
|
||||
menusQuery(data).then((res) => {
|
||||
console.log(res, 888)
|
||||
|
||||
if (res.code == 200) {
|
||||
console.log(res.rows, '菜单页面')
|
||||
tableData.value = res.rows
|
||||
} else {
|
||||
ElMessage.error({
|
||||
@ -282,7 +272,6 @@ const defaultProps = {
|
||||
// 菜单
|
||||
const visible = ref(false)
|
||||
const menuEdit = (data: any) => {
|
||||
console.log(data.row, 'data1111111')
|
||||
visible.value = true
|
||||
fromUpDate.id = data.row.id
|
||||
fromUpDate.revision = data.row.revision
|
||||
@ -377,11 +366,9 @@ interface menusUpdate {
|
||||
// rows?: any[]
|
||||
}
|
||||
const onSubmit = () => {
|
||||
console.log(fromUpDate, 'fromUpDate')
|
||||
formRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
menusUpdate(fromUpDate).then((res) => {
|
||||
console.log(res, '更新')
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
message: res.msg,
|
||||
@ -409,7 +396,6 @@ const allPermissionData = ref()
|
||||
// 菜单权限
|
||||
const allPermission = () => {
|
||||
allPermissionQuery().then((res) => {
|
||||
console.log(res.data, 'resdata')
|
||||
|
||||
allPermissionData.value = res.data
|
||||
})
|
||||
@ -439,7 +425,6 @@ const handleCloseDelete = (done: () => void) => {
|
||||
const dialogVisibleDelete1 = (done: () => void) => {
|
||||
dialogVisibleDelete.value = false
|
||||
menuDelete(fromDeleteData).then((res) => {
|
||||
console.log(res, '删除')
|
||||
if (res.code == 200) {
|
||||
setTimeout(() => {
|
||||
ElMessage({
|
||||
@ -498,12 +483,10 @@ const fromAdd = () => {
|
||||
formInlineAdd.updatedTime = 12345
|
||||
}
|
||||
const addOnSubmit = () => {
|
||||
console.log(formInlineAdd, 'formInlineAdd')
|
||||
formRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
formInlineAdd.parentMenuId = fromDataId.value
|
||||
menuAdd(formInlineAdd).then((res: any) => {
|
||||
console.log(res, '增加')
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
message: res.msg,
|
||||
@ -512,8 +495,6 @@ const addOnSubmit = () => {
|
||||
const queryData = {
|
||||
parentMenuId: fromDataId.value,
|
||||
}
|
||||
console.log(queryData, 666)
|
||||
|
||||
queryMenuMethod(queryData)
|
||||
RyMenusTreeQuery(fromParameter)
|
||||
} else {
|
||||
@ -534,10 +515,8 @@ const currentPage4 = ref(4)
|
||||
const pageSize4 = ref(100)
|
||||
|
||||
const handleSizeChange = (val: number) => {
|
||||
console.log(`${val} items per page`)
|
||||
}
|
||||
const handleCurrentChange = (val: number) => {
|
||||
console.log(`current page: ${val}`)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -211,10 +211,7 @@ const treeQuery = reactive({
|
||||
const userData = ref()
|
||||
const treeRefUserList = ref()
|
||||
const getTree = () => {
|
||||
console.log(treeQuery, 'treeQuery')
|
||||
|
||||
userList(treeQuery).then((res) => {
|
||||
console.log(res.data, '树用户111')
|
||||
userData.value = res.data
|
||||
nextTick(() => {
|
||||
treeRefUserList.value?.setCurrentKey(res.data[0]?.id!, false)
|
||||
@ -241,11 +238,8 @@ const formQuery = reactive({
|
||||
const treeId = ref()
|
||||
|
||||
const handleNodeClick = (data: Tree) => {
|
||||
console.log(data.id, 'data')
|
||||
|
||||
treeId.value = data.id
|
||||
formQuery.orgId = data.id
|
||||
console.log(formQuery, 444444444)
|
||||
RyUserQuery(formQuery)
|
||||
}
|
||||
|
||||
@ -260,13 +254,10 @@ const loadNode = (node: Node, resolve: (data: Tree[]) => void) => {
|
||||
|
||||
userList(treeQuery)
|
||||
.then((res) => {
|
||||
console.log(res, '树')
|
||||
// userData.value = res.data
|
||||
return resolve(res.data)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
.catch((err) => {})
|
||||
}
|
||||
|
||||
const defaultProps = {
|
||||
@ -282,7 +273,6 @@ const tableData = ref()
|
||||
const RyUserQuery = (data: any) => {
|
||||
userQuery(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
console.log(res, 'res111')
|
||||
tableData.value = res.rows
|
||||
pageTotal.value = res.total
|
||||
} else {
|
||||
@ -364,7 +354,6 @@ const addUserFromData = () => {
|
||||
|
||||
const handleCloseParam = (data: any) => {
|
||||
visibleParam.value = false
|
||||
console.log(data)
|
||||
}
|
||||
const formRef = ref()
|
||||
const addOnSubmit = () => {
|
||||
@ -372,11 +361,9 @@ const addOnSubmit = () => {
|
||||
if (valid) {
|
||||
visibleParam.value = false
|
||||
formUserAdd.orgId = treeId.value
|
||||
console.log(formUserAdd, treeId.value, 'formUserAdd')
|
||||
|
||||
userAdd(formUserAdd).then((res) => {
|
||||
if (res.code == 200) {
|
||||
console.log(res, '新增')
|
||||
formQuery.orgId = treeId.value
|
||||
RyUserQuery(formQuery)
|
||||
} else {
|
||||
@ -405,7 +392,6 @@ const formUserUpData = reactive({
|
||||
profilePicture: '',
|
||||
})
|
||||
const viewUsers = (data: any) => {
|
||||
console.log(data, '页面修改数据1')
|
||||
formRef.value?.resetFields()
|
||||
visibleParamUpData.value = true
|
||||
formUserUpData.id = data.row.id
|
||||
@ -423,11 +409,8 @@ const viewUsers = (data: any) => {
|
||||
const upDataOnSubmit = () => {
|
||||
formRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
console.log(formUserUpData, formUserUpData.password, 'formUserUpData')
|
||||
|
||||
userUpdate(formUserUpData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
console.log(res, '修改成功')
|
||||
// ElMessage({
|
||||
// message: res.msg,
|
||||
// })
|
||||
@ -474,7 +457,6 @@ const userDeleteDialog1 = () => {
|
||||
})
|
||||
}, 1000)
|
||||
formQuery.orgId = treeId.value
|
||||
console.log(formQuery, 'formQuery')
|
||||
RyUserQuery(formQuery)
|
||||
} else {
|
||||
ElMessage.error({
|
||||
@ -493,9 +475,7 @@ const roleName = {
|
||||
}
|
||||
const allPermission = () => {
|
||||
allRoleQuery(roleName).then((res) => {
|
||||
console.log(res.rows, 'resdata')
|
||||
allPermissionData.value = res.rows
|
||||
console.log(allPermissionData.value, '89898989111')
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,6 @@ const equipTypeList = () => {
|
||||
const equipModeData = ref()
|
||||
const equipModeList = (data: any) => {
|
||||
equipDetailsModel(data).then((res) => {
|
||||
console.log(res, '设备详情物模型')
|
||||
equipModeData.value = res.data
|
||||
})
|
||||
}
|
||||
@ -444,7 +443,6 @@ const equipOrgList = () => {
|
||||
equipDetailsOrg({
|
||||
parentOrgId: adminInfo.orgid,
|
||||
}).then((res) => {
|
||||
console.log(res, '设备详情机构列表')
|
||||
equipOrgData.value = res.data
|
||||
})
|
||||
}
|
||||
@ -453,13 +451,11 @@ const equipOrgList = () => {
|
||||
const belongingEquipment = ref()
|
||||
const equipOrgBelonging = () => {
|
||||
equipTree().then((res) => {
|
||||
console.log(res, '设备详情所属设备列表')
|
||||
belongingEquipment.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
const treeSelectLoad = (node: any, resolve: any) => {
|
||||
console.log(node, 'treeSelectLoad')
|
||||
if (node.level === 0) {
|
||||
equipDetailsOrg({
|
||||
parentOrgId: null,
|
||||
@ -479,7 +475,6 @@ const treeSelectLoad = (node: any, resolve: any) => {
|
||||
return resolve(res.data)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -509,7 +504,6 @@ const formQuery = reactive({
|
||||
})
|
||||
const queryParameter = ref()
|
||||
const handleNodeClick = (data: any) => {
|
||||
console.log(data, '设备树data')
|
||||
queryParameter.value = data
|
||||
formQuery.pageSize = currentPageSize.value
|
||||
formQuery.pageNum = currentPage.value
|
||||
@ -636,7 +630,6 @@ const handleCloseEditDevice = () => {
|
||||
|
||||
// 设备查看按钮
|
||||
const viewDeviceDetails = (data: any) => {
|
||||
console.log(data, '查看设备详情')
|
||||
equipOrgBelonging()
|
||||
modifyDeviceDetails.value?.resetFields()
|
||||
editDeviceDialog.value = true
|
||||
@ -700,7 +693,6 @@ const longitudePass = (rule: any, value: any, callback: any) => {
|
||||
}
|
||||
|
||||
const latitudePass = (rule: any, value: any, callback: any) => {
|
||||
console.log(value, 6666)
|
||||
if (!value) {
|
||||
callback()
|
||||
}
|
||||
@ -753,7 +745,6 @@ const saveData = () => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!')
|
||||
return false
|
||||
}
|
||||
})
|
||||
@ -807,7 +798,6 @@ const saveAddData = () => {
|
||||
editAddDeviceData.objectType = ele.equipmentTypeId
|
||||
}
|
||||
})
|
||||
console.log(editAddDeviceData, 'editAddDeviceData')
|
||||
equipAdd(editAddDeviceData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
@ -831,8 +821,6 @@ const handleCloseAddEditDevice = () => {
|
||||
}
|
||||
// 导入
|
||||
const upLoadModel = (file: any) => {
|
||||
console.log(queryParameter.value.equipmentTypeId,"min132");
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('file', file.file)
|
||||
const v = generateRandomNumber(16)
|
||||
|
Loading…
Reference in New Issue
Block a user