Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
89be3efb6a
@ -64,7 +64,6 @@ public class SysOrgServiceImpl implements SysOrgService {
|
||||
if(sysOrgQueryDto.getParentOrgId() == null) {
|
||||
sysOrgQueryDto.setParentOrgId(0L);
|
||||
}
|
||||
|
||||
return sysOrgMapper.queryAllOrgTree(sysOrgQueryDto.getParentOrgId());
|
||||
}
|
||||
|
||||
|
@ -107,10 +107,9 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
List<Long> errorRole = new ArrayList<>();
|
||||
for (String strRoleId : roles) {
|
||||
if (StringUtils.hasText(strRoleId)) {
|
||||
long roleId=Long.getLong(strRoleId);
|
||||
long roleCount = sysRoleMapper.existRoleByRoleId(roleId);
|
||||
long roleCount = sysRoleMapper.existRoleByRoleId(Long.valueOf(strRoleId));
|
||||
if (roleCount == 0) {
|
||||
errorRole.add(roleId);
|
||||
errorRole.add(Long.valueOf(strRoleId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,6 +146,11 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
SysUser newSysUser = new SysUser();
|
||||
BeanUtils.copyProperties(sysUserDto, newSysUser);
|
||||
if (!BCrypt.checkpw(sysUserDto.getPassword(), sysUser.getPassword()) && StringUtils.hasText(sysUserDto.getPassword())) {
|
||||
newSysUser.setPassword(BCrypt.hashpw(sysUserDto.getPassword(), BCrypt.gensalt()));
|
||||
}else {
|
||||
newSysUser.setPassword(sysUser.getPassword());
|
||||
}
|
||||
newSysUser.setUpdatedTime(new Date());
|
||||
sysUserMapper.updateById(newSysUser);
|
||||
|
||||
@ -162,10 +166,9 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
sysUserRoleMapper.delete(accountRoleQueryWrapper);
|
||||
//绑定角色
|
||||
for (String strRoleId : sysUserDto.getRoleList()) {
|
||||
long roleId = Long.getLong(strRoleId);
|
||||
SysUserRole accountRole = new SysUserRole();
|
||||
accountRole.setUserId(sysUser.getId());
|
||||
accountRole.setRoleId(roleId);
|
||||
accountRole.setRoleId(Long.valueOf(strRoleId));
|
||||
accountRole.setRevision(1);
|
||||
accountRole.setCreatedTime(new Date());
|
||||
accountRole.setUpdatedTime(new Date());
|
||||
|
@ -1,14 +1,15 @@
|
||||
package com.das.modules.equipment.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelReader;
|
||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.das.common.exceptions.ServiceException;
|
||||
import com.das.common.config.SessionUtil;
|
||||
import com.das.common.utils.*;
|
||||
import com.das.modules.auth.entity.SysOrg;
|
||||
import com.das.modules.auth.domain.vo.SysUserVo;
|
||||
import com.das.modules.auth.mapper.SysOrgMapper;
|
||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||
import com.das.modules.equipment.domain.excel.SheetInfoBean;
|
||||
@ -24,7 +25,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -51,13 +51,13 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
SysEquipment sysEquipment = new SysEquipment();
|
||||
BeanCopyUtils.copy(sysEquipmentDto,sysEquipment);
|
||||
|
||||
// SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
sysEquipment.setCreatedTime(new Date());
|
||||
sysEquipment.setUpdatedTime(new Date());
|
||||
// sysEquipment.setCreatedBy(sysUserVo.getAccount());
|
||||
// sysEquipment.setUpdatedBy(sysUserVo.getAccount());
|
||||
sysEquipment.setCreatedBy("测试");
|
||||
sysEquipment.setUpdatedBy("测试");
|
||||
sysEquipment.setCreatedBy(sysUserVo.getAccount());
|
||||
sysEquipment.setUpdatedBy(sysUserVo.getAccount());
|
||||
// sysEquipment.setCreatedBy("测试");
|
||||
// sysEquipment.setUpdatedBy("测试");
|
||||
sysEquipment.setRevision(1);
|
||||
sysEquipmentMapper.insert(sysEquipment);
|
||||
SysEquipmentVo sysEquipmentVo = new SysEquipmentVo();
|
||||
@ -69,10 +69,10 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
public SysEquipmentVo updateSysEquipment(SysEquipmentDto sysEquipmentDto) {
|
||||
SysEquipment sysEquipment = new SysEquipment();
|
||||
BeanCopyUtils.copy(sysEquipmentDto,sysEquipment);
|
||||
// SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
sysEquipment.setUpdatedTime(new Date());
|
||||
sysEquipment.setUpdatedBy("测试");
|
||||
// sysIotModel.setUpdatedBy("sysUserVo.getAccount()");
|
||||
// sysEquipment.setUpdatedBy("测试");
|
||||
sysEquipment.setUpdatedBy(sysUserVo.getAccount());
|
||||
sysEquipmentMapper.updateById(sysEquipment);
|
||||
SysEquipmentVo sysEquipmentVo = new SysEquipmentVo();
|
||||
BeanCopyUtils.copy(sysEquipment,sysEquipmentVo);
|
||||
@ -109,19 +109,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
@Override
|
||||
public List<SysEquipmentVo> getRootEquipment() {
|
||||
List<SysEquipmentVo> equipList = sysEquipmentMapper.queryEquipmentTree();
|
||||
// 根据ordId和设备编码查出对应的子设备
|
||||
List<SysEquipmentVo> newEquipList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(equipList)) {
|
||||
for(SysEquipmentVo info : equipList) {
|
||||
QueryWrapper<SysEquipment> queryEquipWrapper = new QueryWrapper<>();
|
||||
queryEquipWrapper.eq("parent_equipment_id", info.getId());
|
||||
queryEquipWrapper.eq("object_type", info.getObjectType());
|
||||
List<SysEquipment> children = sysEquipmentMapper.selectList(queryEquipWrapper);
|
||||
info.setEquipChildren(children);
|
||||
newEquipList.add(info);
|
||||
}
|
||||
}
|
||||
return newEquipList;
|
||||
return equipList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,9 +5,7 @@ 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.SysCommunicationLinkDto;
|
||||
import com.das.modules.node.domain.dto.SysNodeDto;
|
||||
import com.das.modules.node.domain.vo.SysCommunicationLinkVo;
|
||||
import com.das.modules.node.domain.vo.SysNodeVo;
|
||||
@ -45,7 +43,7 @@ public class SysNodeController {
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有设备管理权限");
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
return R.success(sysNodeService.createSysNode(sysNodeDto));
|
||||
}
|
||||
@ -55,10 +53,10 @@ public class SysNodeController {
|
||||
public R<SysNodeVo> updateSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
||||
|
||||
//判断是否有权限
|
||||
// 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("没有节点管理权限");
|
||||
}
|
||||
return R.success(sysNodeService.updateSysNode(sysNodeDto));
|
||||
}
|
||||
|
||||
@ -67,10 +65,10 @@ public class SysNodeController {
|
||||
public R<Void> deleteSysNode(@RequestBody SysNodeDto sysNodeDto) {
|
||||
|
||||
//判断是否有权限
|
||||
// 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 (sysNodeDto.getId() == null) {
|
||||
throw new ServiceException("参数缺失");
|
||||
}
|
||||
@ -84,5 +82,53 @@ public class SysNodeController {
|
||||
return R.success();
|
||||
}
|
||||
|
||||
|
||||
/** 获取链路列表 */
|
||||
@PostMapping("/link/list")
|
||||
public PageDataInfo<SysCommunicationLinkVo> querySysCommunicationLinkList(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||
|
||||
return sysNodeService.querySysCommunicationLinkList(sysCommunicationLinkDto);
|
||||
}
|
||||
|
||||
|
||||
/** 新增链路 */
|
||||
@PostMapping("/link/add")
|
||||
public R<SysCommunicationLinkVo> createSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
return R.success(sysNodeService.createSysCommunicationLink(sysCommunicationLinkDto));
|
||||
}
|
||||
|
||||
/** 修改链路 */
|
||||
@PostMapping("/link/update")
|
||||
public R<SysCommunicationLinkVo> updateSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
return R.success(sysNodeService.updateSysCommunicationLink(sysCommunicationLinkDto));
|
||||
}
|
||||
|
||||
/** 删除链路 */
|
||||
@PostMapping("/link/delete")
|
||||
public R<SysCommunicationLinkVo> deleteSysCommunicationLink(@RequestBody SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有节点管理权限");
|
||||
}
|
||||
if (sysCommunicationLinkDto.getId() == null) {
|
||||
throw new ServiceException("参数缺失");
|
||||
}
|
||||
sysNodeService.deleteSysCommunicationLink(sysCommunicationLinkDto.getId());
|
||||
return R.success();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
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 SysCommunicationLinkDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 链路id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 节点id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long nodeId;
|
||||
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 通讯协议
|
||||
*/
|
||||
private Integer protocol;
|
||||
|
||||
/**
|
||||
* 协议参数
|
||||
*/
|
||||
private String params;
|
||||
|
||||
private Integer revision;
|
||||
|
||||
/**
|
||||
* 分页大小
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
private Integer pageNum;
|
||||
}
|
@ -2,11 +2,14 @@ package com.das.modules.node.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.das.modules.node.domain.vo.SysCommunicationLinkVo;
|
||||
import com.das.modules.node.entity.SysCommunicationLink;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface SysCommunicationLinkMapper extends BaseMapper<SysCommunicationLink> {
|
||||
|
||||
IPage<SysCommunicationLinkVo> querySysCommunicationLinkList(IPage<SysCommunicationLinkVo> page, @Param("id")Long id);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
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.vo.SysCommunicationLinkVo;
|
||||
import com.das.modules.node.domain.vo.SysNodeVo;
|
||||
|
||||
import java.util.List;
|
||||
@ -14,4 +17,13 @@ public interface SysNodeService {
|
||||
|
||||
void deleteSysNode(Long id);
|
||||
|
||||
PageDataInfo<SysCommunicationLinkVo> querySysCommunicationLinkList(SysCommunicationLinkDto sysCommunicationLinkDto);
|
||||
|
||||
SysCommunicationLinkVo createSysCommunicationLink(SysCommunicationLinkDto sysCommunicationLinkDto);
|
||||
|
||||
SysCommunicationLinkVo updateSysCommunicationLink(SysCommunicationLinkDto sysCommunicationLinkDto);
|
||||
|
||||
void deleteSysCommunicationLink(Long id);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,22 @@
|
||||
package com.das.modules.node.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.das.common.config.SessionUtil;
|
||||
import com.das.common.exceptions.ServiceException;
|
||||
import com.das.common.utils.BeanCopyUtils;
|
||||
import com.das.common.utils.PageDataInfo;
|
||||
import com.das.common.utils.PageQuery;
|
||||
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.SysCommunicationLinkDto;
|
||||
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.entity.SysCommunicationLink;
|
||||
import com.das.modules.node.entity.SysNode;
|
||||
import com.das.modules.node.mapper.SysCommunicationLinkMapper;
|
||||
import com.das.modules.node.mapper.SysNodeMapper;
|
||||
import com.das.modules.node.service.SysNodeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -32,6 +33,10 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
@Autowired
|
||||
private SysNodeMapper sysNodeMapper;
|
||||
|
||||
@Autowired
|
||||
private SysCommunicationLinkMapper sysCommunicationLinkMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysOrgMapper sysOrgMapper;
|
||||
|
||||
@ -68,10 +73,10 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
public SysNodeVo updateSysNode(SysNodeDto sysNodeDto) {
|
||||
SysNode sysNode = new SysNode();
|
||||
BeanCopyUtils.copy(sysNodeDto,sysNode);
|
||||
// SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
sysNode.setUpdatedTime(new Date());
|
||||
sysNode.setUpdatedBy("测试");
|
||||
// sysIotModel.setUpdatedBy("sysUserVo.getAccount()");
|
||||
// sysNode.setUpdatedBy("测试");
|
||||
sysNode.setUpdatedBy(sysUserVo.getAccount());
|
||||
sysNodeMapper.updateById(sysNode);
|
||||
SysNodeVo sysNodeVo = new SysNodeVo();
|
||||
// 根据org_id查询组织名称
|
||||
@ -86,4 +91,61 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
// 判断节点下是否有链路,有就不能删除
|
||||
sysNodeMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageDataInfo<SysCommunicationLinkVo> querySysCommunicationLinkList(SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||
PageQuery pageQuery = new PageQuery();
|
||||
pageQuery.setPageNum(sysCommunicationLinkDto.getPageNum());
|
||||
pageQuery.setPageSize(sysCommunicationLinkDto.getPageSize());
|
||||
IPage<SysCommunicationLinkVo> iPage = sysCommunicationLinkMapper.querySysCommunicationLinkList(pageQuery.build(), sysCommunicationLinkDto.getNodeId());
|
||||
return PageDataInfo.build(iPage.getRecords(), iPage.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCommunicationLinkVo createSysCommunicationLink(SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||
SysCommunicationLink sysCommunicationLink = new SysCommunicationLink();
|
||||
BeanCopyUtils.copy(sysCommunicationLinkDto,sysCommunicationLink);
|
||||
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
sysCommunicationLink.setId(SequenceUtils.generateId());
|
||||
sysCommunicationLink.setCreatedTime(new Date());
|
||||
sysCommunicationLink.setUpdatedTime(new Date());
|
||||
sysCommunicationLink.setCreatedBy(sysUserVo.getAccount());
|
||||
sysCommunicationLink.setUpdatedBy(sysUserVo.getAccount());
|
||||
// sysCommunicationLink.setCreatedBy("测试");
|
||||
// sysCommunicationLink.setUpdatedBy("测试");
|
||||
sysCommunicationLink.setRevision(1);
|
||||
sysCommunicationLinkMapper.insert(sysCommunicationLink);
|
||||
SysCommunicationLinkVo sysCommunicationLinkVo = new SysCommunicationLinkVo();
|
||||
// 根据org_id查询组织名称
|
||||
SysNode sysNode = sysNodeMapper.selectById(sysCommunicationLinkDto.getNodeId());
|
||||
BeanCopyUtils.copy(sysCommunicationLink,sysCommunicationLinkVo);
|
||||
sysCommunicationLinkVo.setNodeName(sysNode.getNodeName());
|
||||
return sysCommunicationLinkVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCommunicationLinkVo updateSysCommunicationLink(SysCommunicationLinkDto sysCommunicationLinkDto) {
|
||||
|
||||
SysCommunicationLink sysCommunicationLink = new SysCommunicationLink();
|
||||
BeanCopyUtils.copy(sysCommunicationLinkDto,sysCommunicationLink);
|
||||
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
sysCommunicationLink.setUpdatedTime(new Date());
|
||||
sysCommunicationLink.setUpdatedBy(sysUserVo.getAccount());
|
||||
// sysCommunicationLink.setUpdatedBy("测试");
|
||||
sysCommunicationLinkMapper.updateById(sysCommunicationLink);
|
||||
SysCommunicationLinkVo sysCommunicationLinkVo = new SysCommunicationLinkVo();
|
||||
// 根据org_id查询组织名称
|
||||
SysNode sysNode = sysNodeMapper.selectById(sysCommunicationLinkDto.getNodeId());
|
||||
BeanCopyUtils.copy(sysCommunicationLink,sysCommunicationLinkVo);
|
||||
sysCommunicationLinkVo.setNodeName(sysNode.getNodeName());
|
||||
return sysCommunicationLinkVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSysCommunicationLink(Long id) {
|
||||
// 判断节点下是否有链路,有就不能删除
|
||||
sysCommunicationLinkMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
21
das/src/main/resources/mapper/SysCommunicationLinkMapper.xml
Normal file
21
das/src/main/resources/mapper/SysCommunicationLinkMapper.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?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.SysCommunicationLinkMapper">
|
||||
|
||||
<resultMap type="com.das.modules.node.domain.vo.SysCommunicationLinkVo" id="SysCommunicationLinkMap">
|
||||
<result property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="linkName" column="link_name" jdbcType="VARCHAR"/>
|
||||
<result property="protocol" column="protocol" jdbcType="INTEGER"/>
|
||||
<result property="params" column="params" jdbcType="VARCHAR"/>
|
||||
<result property="nodeId" column="node_id" jdbcType="BIGINT"/>
|
||||
<result property="nodeName" column="nodeName" jdbcType="VARCHAR"/>
|
||||
<result property="revision" column="revision" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="querySysCommunicationLinkList" resultMap="SysCommunicationLinkMap">
|
||||
select sc.*, sn.node_name as nodeName from sys_communicationlink sc left join sys_node sn on sc.node_id = sn.id
|
||||
where sc.node_id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -19,6 +19,24 @@
|
||||
<result property="iotModelId" column="iot_model_id" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.das.modules.equipment.domain.vo.SysEquipmentVo" id="SysEquipmentListMap">
|
||||
<result property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="code" column="code" jdbcType="VARCHAR"/>
|
||||
<result property="location" column="location" jdbcType="VARCHAR"/>
|
||||
<result property="madeinFactory" column="madein_factory" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="model" column="model" jdbcType="VARCHAR"/>
|
||||
<result property="objectType" column="object_type" jdbcType="INTEGER"/>
|
||||
<result property="orgId" column="org_id" jdbcType="BIGINT"/>
|
||||
<result property="parentEquipmentId" column="parent_equipment_id" jdbcType="BIGINT"/>
|
||||
<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"/>
|
||||
<result property="iotModelId" column="iot_model_id" jdbcType="BIGINT"/>
|
||||
<collection property="equipChildren" column="id" ofType="com.das.modules.equipment.domain.vo.SysEquipmentVo" select="queryChildrenEquipById"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.das.modules.equipment.domain.excel.SysEquipmentExcel" id="SysEquipmentExcelMap">
|
||||
|
||||
<result property="orgName" column="org_name" jdbcType="VARCHAR"/>
|
||||
@ -58,10 +76,15 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryEquipmentTree" resultMap="SysEquipmentMap">
|
||||
select t.* from sys_equipment t WHERE t.object_type in (10001,10002) and t.parent_equipment_id = 0
|
||||
<select id="queryEquipmentTree" resultMap="SysEquipmentListMap">
|
||||
select t.* from sys_equipment t WHERE t.parent_equipment_id = 0 order by t.code
|
||||
</select>
|
||||
|
||||
<select id="queryChildrenEquipById" resultMap="SysEquipmentListMap">
|
||||
select t.* from sys_equipment t WHERE t.parent_equipment_id = #{id}
|
||||
</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
|
||||
|
157
docs/api/node.md
157
docs/api/node.md
@ -174,3 +174,160 @@ POST 请求接口
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2.1 获取节点下的链路分页查询
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/list
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"nodeId":1
|
||||
}
|
||||
|
||||
```
|
||||
入参描述
|
||||
|
||||
| 参数名 | 参数类型 | 可选 | 描述 |
|
||||
|----------| -------- | ---- |------|
|
||||
| nodeId | String | 否 | 节点Id |
|
||||
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"total": 1,
|
||||
"rows": [
|
||||
{
|
||||
"id": "1",
|
||||
"linkName": "测试链路",
|
||||
"protocol": 1,
|
||||
"params": "测试",
|
||||
"nodeName": "测试节点",
|
||||
"nodeId": "1",
|
||||
"revision": 1
|
||||
}
|
||||
],
|
||||
"code": 200,
|
||||
"msg": "查询成功"
|
||||
}
|
||||
```
|
||||
|
||||
返参描述
|
||||
|
||||
| 参数名 | 参数类型 | 可选 | 描述 |
|
||||
|----------| -------- | ---- |------|
|
||||
| id | String | 否 | 链路ID |
|
||||
| linkName | String | 否 | 链路名称 |
|
||||
| protocol | String | 否 | 协议类型 |
|
||||
| params | String | 否 | 参数 |
|
||||
| nodeName | String | 否 | 节点名称 |
|
||||
| nodeId | String | 否 | 节点ID |
|
||||
| revision | String | 否 | 乐观锁 |
|
||||
|
||||
|
||||
#### 1.2.2 新增链路
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/add
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"linkName": "测试链路1",
|
||||
"protocol": 1,
|
||||
"params": "测试",
|
||||
"nodeId": "1"
|
||||
}
|
||||
|
||||
```
|
||||
入参描述
|
||||
|
||||
| 参数名 | 参数类型 | 可选 | 描述 |
|
||||
|----------| -------- | ---- |------|
|
||||
| linkName | String | 否 | 链路名称 |
|
||||
| protocol | String | 否 | 协议类型 |
|
||||
| params | String | 否 | 参数 |
|
||||
| nodeId | String | 否 | 节点ID |
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "73556002258550784",
|
||||
"linkName": "测试链路1",
|
||||
"protocol": 1,
|
||||
"params": "测试",
|
||||
"nodeName": "测试节点",
|
||||
"nodeId": "1",
|
||||
"revision": 1
|
||||
},
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2.3 修改链路
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/update
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"id": "73556002258550784",
|
||||
"linkName": "测试链路2",
|
||||
"protocol": 2,
|
||||
"params": "测试123",
|
||||
"nodeName": "测试节点",
|
||||
"nodeId": "1",
|
||||
"revision": 1
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "73556002258550784",
|
||||
"linkName": "测试链路1",
|
||||
"protocol": 1,
|
||||
"params": "测试",
|
||||
"nodeName": "测试节点",
|
||||
"nodeId": "1",
|
||||
"revision": 1
|
||||
},
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2.4 删除链路
|
||||
POST 请求接口
|
||||
|
||||
> /api/node/link/delete
|
||||
|
||||
请求参数
|
||||
```json
|
||||
{
|
||||
"id": "73556002258550784"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
返回报文
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"msg": "操作成功"
|
||||
}
|
||||
```
|
@ -1,4 +1,7 @@
|
||||
import createAxios from '/@/utils/axios'
|
||||
import { encrypt_aes } from '/@/utils/crypto'
|
||||
import { useAdminInfo } from '/@/stores/adminInfo'
|
||||
const adminInfo = useAdminInfo()
|
||||
|
||||
export function index() {
|
||||
return createAxios({
|
||||
@ -154,3 +157,83 @@ export function userChangePassword(params: object = {}) {
|
||||
})
|
||||
}
|
||||
|
||||
// 设备页面设备树
|
||||
export function equipTree(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/equipment/getEquipmentTree',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 设备分页查询
|
||||
export function equipQuery(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/equipment/query',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 设备新增
|
||||
export function equipAdd(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/equipment/add',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 设备删除
|
||||
export function equipDelete(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/equipment/delete',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 设备修改
|
||||
export function equipUpdate(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/equipment/update',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
// 导入
|
||||
// export function equipImport(params: object = {}) {
|
||||
// return createAxios({
|
||||
// url: '/api/equipment/import',
|
||||
// method: 'POST',
|
||||
// })
|
||||
// }
|
||||
|
||||
export const equipImport = (data:FormData, v:string) => {
|
||||
const token = encrypt_aes(adminInfo.token, v)
|
||||
return createAxios(
|
||||
{
|
||||
url: '/api/equipment/import',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
v,
|
||||
token,
|
||||
},
|
||||
},
|
||||
{ customEncrypt: true }
|
||||
)
|
||||
}
|
||||
|
||||
// 导出
|
||||
export function equipExport(params: object = {}) {
|
||||
return createAxios({
|
||||
url: '/api/equipment/export',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
responseType: 'blob',
|
||||
})
|
||||
}
|
||||
|
@ -30,10 +30,11 @@
|
||||
<el-table-column prop="menuName" label="菜单名称" />
|
||||
<el-table-column prop="funParam" label="菜单路径" />
|
||||
<el-table-column prop="menuOrder" label="菜单排序" />
|
||||
<el-table-column prop="menuIcon" label="图标" />
|
||||
<!-- <el-table-column prop="name" label="状态" width="180">
|
||||
<el-switch v-model="switchValue" />
|
||||
</el-table-column> -->
|
||||
<el-table-column label="图标">
|
||||
<template #default="scope">
|
||||
<Icon :name="scope.row.menuIcon" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template #default="scope">
|
||||
<span style="color: #0064aa; cursor: pointer" @click="menuEdit(scope)">编辑</span>
|
||||
@ -192,7 +193,7 @@ const RyMenusTreeQuery = (data: any) => {
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
RyMenusTreeQuery(fromParameter), allPermission()
|
||||
RyMenusTreeQuery(fromParameter), allPermission(), queryMenuMethod({ parentMenuId: 1 })
|
||||
})
|
||||
|
||||
interface Tree {
|
||||
@ -505,7 +506,6 @@ const addOnSubmit = () => {
|
||||
console.log(formInlineAdd, 'formInlineAdd')
|
||||
formRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
alert(1)
|
||||
formInlineAdd.parentMenuId = fromDataId.value
|
||||
menuAdd(formInlineAdd).then((res: any) => {
|
||||
console.log(res, '增加')
|
||||
|
@ -239,10 +239,11 @@ const getTree = () => {
|
||||
onMounted(() => {
|
||||
getTree()
|
||||
allPermission()
|
||||
RyUserQuery(formQuery)
|
||||
})
|
||||
|
||||
const formQuery = reactive({
|
||||
orgId: '',
|
||||
orgId: '1',
|
||||
recursive: false,
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
@ -604,12 +605,6 @@ const handleCurrentChange = (val: number) => {
|
||||
RyUserQuery(formQuery)
|
||||
}
|
||||
const pageTotal = ref(0)
|
||||
const originData = ref()
|
||||
const tableData1 = computed(() => {
|
||||
const start = (currentPage.value - 1) * currentPageSize.value
|
||||
const end = start + currentPageSize.value
|
||||
return originData.value?.slice(start, end)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user