设备列表添加mqtt连接状态属性
This commit is contained in:
@@ -86,6 +86,9 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||||
private Integer usageStatus ;
|
private Integer usageStatus ;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="装置与MQTT服务器连接状态")
|
||||||
|
private String connectStatus ;
|
||||||
|
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,9 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.access.utils.MqttUtil;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
@@ -63,10 +65,8 @@ import java.util.stream.Stream;
|
|||||||
public class EquipmentDeliveryController extends BaseController {
|
public class EquipmentDeliveryController extends BaseController {
|
||||||
|
|
||||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
|
||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
|
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -178,14 +178,6 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
||||||
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
|
||||||
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
|
||||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
|
||||||
csEquipmentDeliveryVO.setStatus(5);
|
|
||||||
} else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
|
||||||
csEquipmentDeliveryVO.setStatus(6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||||
|
import com.njcn.access.utils.MqttUtil;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
@@ -94,6 +95,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final CsSoftInfoMapper csSoftInfoMapper;
|
private final CsSoftInfoMapper csSoftInfoMapper;
|
||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
|
private final MqttUtil mqttUtil;
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -311,6 +313,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
item.setQrPath(item.getQrPath());
|
item.setQrPath(item.getQrPath());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||||
|
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
||||||
|
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||||
|
csEquipmentDeliveryVO.setStatus(5);
|
||||||
|
} else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
||||||
|
csEquipmentDeliveryVO.setStatus(6);
|
||||||
|
}
|
||||||
|
//判断装置是否已经连接上mqtt服务器
|
||||||
|
String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
||||||
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
|
if (mqttClient) {
|
||||||
|
csEquipmentDeliveryVO.setConnectStatus("已连接");
|
||||||
|
} else {
|
||||||
|
csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||||
|
}
|
||||||
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user