设备主题获取录入
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.njcn.access.param.DevAccessParam;
|
||||
import com.njcn.access.param.WgDeviceRegisterParam;
|
||||
import com.njcn.access.param.WgRegisterParam;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.access.pojo.po.CsTopic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-07-13
|
||||
*/
|
||||
public interface ICsTopicService extends IService<CsTopic> {
|
||||
|
||||
/**
|
||||
* 新增设备主题信息
|
||||
* @param nDid 网络设备码
|
||||
* @param list 主题集合
|
||||
*/
|
||||
void addTopic(String nDid,List<CsTopic> list);
|
||||
}
|
||||
@@ -185,8 +185,8 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
redisUtil.delete("MODEL" + devAccessParam.getNDid());
|
||||
//5.修改装置状态
|
||||
equipmentFeignClient.updateStatusBynDid(devAccessParam.getNDid(), AccessEnum.REGISTERED.getCode());
|
||||
//6.设置心跳时间,超时改为掉线
|
||||
redisUtil.saveByKeyWithExpire("MQTT:" + devAccessParam.getNDid(), Instant.now().toEpochMilli(),180L);
|
||||
//6.装置接入之后再设置心跳时间,超时改为掉线
|
||||
//redisUtil.saveByKeyWithExpire("MQTT:" + devAccessParam.getNDid(), Instant.now().toEpochMilli(),180L);
|
||||
//7.绑定装置和人的关系
|
||||
CsDeviceUserPO po = new CsDeviceUserPO();
|
||||
po.setPrimaryUserId(RequestUtil.getUserIndex());
|
||||
|
||||
@@ -106,6 +106,10 @@ public class CsGatewayServiceImpl extends ServiceImpl<CsGatewayMapper, CsGateway
|
||||
|
||||
@Override
|
||||
public void registerByWg(List<WgDeviceRegisterParam> list) {
|
||||
//判断网关是否在线
|
||||
//1.根据装置型号查询最新模板信息,发送给网关校验
|
||||
//2.网关给出应答,哪些可以接入,哪些无法接入。将可以接入的装置入库,不能接入的返回给前端
|
||||
//3.可以接入的设备填写监测点信息、选择拓扑图
|
||||
list.forEach(item->{
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.access.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsTopicMapper;
|
||||
import com.njcn.access.pojo.po.CsTopic;
|
||||
import com.njcn.access.service.ICsTopicService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-07-13
|
||||
*/
|
||||
@Service
|
||||
public class CsTopicServiceImpl extends ServiceImpl<CsTopicMapper, CsTopic> implements ICsTopicService {
|
||||
|
||||
@Override
|
||||
public void addTopic(String nDid, List<CsTopic> list) {
|
||||
LambdaQueryWrapper<CsTopic> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsTopic::getNdid,nDid);
|
||||
List<CsTopic> topics = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(topics)){
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
this.saveBatch(list,1000);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user