|
|
@@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.Constants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
+import com.xunmei.common.core.domain.iot.domain.IotServerProduct;
|
|
|
import com.xunmei.common.core.enums.iot.BaseDeviceTypeEnum;
|
|
|
import com.xunmei.common.core.utils.StringUtils;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import com.xunmei.iot.dto.deviceInfo.IotDeviceInfoPageDto;
|
|
|
import com.xunmei.iot.mapper.IotAlarmSubsystemMapper;
|
|
|
import com.xunmei.iot.mapper.IotDeviceInfoMapper;
|
|
|
+import com.xunmei.iot.mapper.IotServerProductMapper;
|
|
|
import com.xunmei.iot.service.IIotDeviceInfoService;
|
|
|
import com.xunmei.iot.vo.deviceInfo.DeviceDetailInfoVo;
|
|
|
import com.xunmei.iot.vo.deviceInfo.IotDeviceInfoPageVo;
|
|
|
@@ -19,6 +21,7 @@ import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import com.xunmei.system.api.domain.iot.IotDeviceInfo;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.Serializable;
|
|
|
import java.util.List;
|
|
|
@@ -31,18 +34,21 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
|
|
|
@Resource
|
|
|
private IotAlarmSubsystemMapper subsystemMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IotServerProductMapper productMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public TableDataInfo<IotDeviceInfoPageVo> deviceInfoPage(IotDeviceInfoPageDto request) {
|
|
|
if (request.getCheckSub()) {
|
|
|
SysOrg sysOrg = orgService.selectOrgById(request.getOrgId(), SecurityConstants.INNER);
|
|
|
request.setOrgPath(sysOrg.getPath());
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(request.getDeviceType())){
|
|
|
+ if (StringUtils.isNotEmpty(request.getDeviceType())) {
|
|
|
request.setDeviceTypeList(null);
|
|
|
}
|
|
|
Page<IotDeviceInfoPageVo> page = baseMapper.selectDeviceInfoPage(request.getPageRequest(), request);
|
|
|
List<IotDeviceInfoPageVo> records = page.getRecords();
|
|
|
- if (records != null && records.size() > 0){
|
|
|
+ if (records != null && records.size() > 0) {
|
|
|
for (IotDeviceInfoPageVo record : records) {
|
|
|
record.setDeviceTypeName(BaseDeviceTypeEnum.getDescByCode(record.getDeviceType()));
|
|
|
}
|
|
|
@@ -53,18 +59,18 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
|
|
|
@Override
|
|
|
public DeviceDetailInfoVo getDetail(Serializable id) {
|
|
|
DeviceDetailInfoVo detailInfoVo = baseMapper.getDetailById(id);
|
|
|
- if (detailInfoVo != null){
|
|
|
+ if (detailInfoVo != null) {
|
|
|
detailInfoVo.setDeviceTypeName(BaseDeviceTypeEnum.getDescByCode(detailInfoVo.getDeviceType()));
|
|
|
//动环主机和dvs有子设备(门禁主机和对讲主机无子设备)
|
|
|
- if (ObjectUtil.equal(BaseDeviceTypeEnum.Dvs.getCode(),detailInfoVo.getDeviceType())
|
|
|
- || ObjectUtil.equal(BaseDeviceTypeEnum.FSU.getCode(),detailInfoVo.getDeviceType())){
|
|
|
+ if (ObjectUtil.equal(BaseDeviceTypeEnum.Dvs.getCode(), detailInfoVo.getDeviceType())
|
|
|
+ || ObjectUtil.equal(BaseDeviceTypeEnum.FSU.getCode(), detailInfoVo.getDeviceType())) {
|
|
|
String deviceProduct = null;
|
|
|
//监控主机需要查询deviceProduct
|
|
|
- if (ObjectUtil.equal(BaseDeviceTypeEnum.Dvs.getCode(),detailInfoVo.getDeviceType())){
|
|
|
+ if (ObjectUtil.equal(BaseDeviceTypeEnum.Dvs.getCode(), detailInfoVo.getDeviceType())) {
|
|
|
deviceProduct = detailInfoVo.getDeviceProduct();
|
|
|
}
|
|
|
List<DeviceDetailInfoVo> infoList = baseMapper.getChildrenInfoList(deviceProduct, detailInfoVo.getIotToken(), detailInfoVo.getDeviceCode());
|
|
|
- if (infoList !=null && infoList.size() > 0){
|
|
|
+ if (infoList != null && infoList.size() > 0) {
|
|
|
for (DeviceDetailInfoVo infoVo : infoList) {
|
|
|
infoVo.setDeviceTypeName(BaseDeviceTypeEnum.getDescByCode(infoVo.getDeviceType()));
|
|
|
}
|
|
|
@@ -78,7 +84,7 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
|
|
|
@Override
|
|
|
public DeviceDetailInfoVo getAlarmHostDetail(Serializable id) {
|
|
|
DeviceDetailInfoVo detailInfoVo = baseMapper.getDetailById(id);
|
|
|
- if (detailInfoVo != null){
|
|
|
+ if (detailInfoVo != null) {
|
|
|
detailInfoVo.setDeviceTypeName(BaseDeviceTypeEnum.getDescByCode(detailInfoVo.getDeviceType()));
|
|
|
//查询报警控制器列表(报警子系统)
|
|
|
List<DeviceDetailInfoVo> list = subsystemMapper.getByDeviceCodeAndIotToken(detailInfoVo.getDeviceCode(), detailInfoVo.getIotToken());
|
|
|
@@ -104,6 +110,13 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
|
|
|
|
|
|
@Override
|
|
|
public List<DeviceDetailInfoVo> getByProductTypesAndOrgId(List<String> productTypes, Long orgId) {
|
|
|
- return baseMapper.getByProductTypesAndOrgId(productTypes,orgId);
|
|
|
+ return baseMapper.getByProductTypesAndOrgId(productTypes, orgId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IotServerProduct> getProductDisplayName(String type) {
|
|
|
+ final LambdaQueryWrapper<IotServerProduct> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.like(IotServerProduct::getName, type);
|
|
|
+ return productMapper.selectList(wrapper);
|
|
|
}
|
|
|
}
|