|
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoClassifyListReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoClassifyListReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotTreeListReqVO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
|
|
@@ -63,6 +64,20 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
double mb = size / (1024.0 * 1024.0);
|
|
double mb = size / (1024.0 * 1024.0);
|
|
iotInfo.setFileSize(String.format("%.2f MB", mb));
|
|
iotInfo.setFileSize(String.format("%.2f MB", mb));
|
|
iotInfo.setDeleted(false);
|
|
iotInfo.setDeleted(false);
|
|
|
|
+ if ("book".equals(createReqVO.getType())) {
|
|
|
|
+ IotInfoClassifyDO classify = iotInfoClassifyService.getIotInfoClassify(classId);
|
|
|
|
+ //如果是设备的话
|
|
|
|
+ IotTreeListReqVO reqVO = new IotTreeListReqVO();
|
|
|
|
+ if (classify.getParentId()==0) {
|
|
|
|
+ reqVO.setType("device").setOriginId(classId);
|
|
|
|
+ } else {
|
|
|
|
+ reqVO.setType("file").setOriginId(classId);
|
|
|
|
+ }
|
|
|
|
+ List<IotTreeDO> iotTreeList = iotTreeService.getIotTreeList(reqVO);
|
|
|
|
+ if (CollUtil.isNotEmpty(iotTreeList)) {
|
|
|
|
+ iotInfo.setClassId(iotTreeList.get(0).getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return iotInfo;
|
|
return iotInfo;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
@@ -106,6 +121,18 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public PageResult<IotInfoDO> getIotInfoPage(IotInfoPageReqVO pageReqVO) {
|
|
public PageResult<IotInfoDO> getIotInfoPage(IotInfoPageReqVO pageReqVO) {
|
|
|
|
+ IotInfoClassifyDO classify = iotInfoClassifyService.getIotInfoClassify(pageReqVO.getClassId());
|
|
|
|
+ //如果是设备的话
|
|
|
|
+ IotTreeListReqVO reqVO = new IotTreeListReqVO();
|
|
|
|
+ if (classify.getParentId()==0) {
|
|
|
|
+ reqVO.setType("device").setOriginId(classify.getDeviceId());
|
|
|
|
+ } else {
|
|
|
|
+ reqVO.setType("file").setOriginId(pageReqVO.getClassId());
|
|
|
|
+ }
|
|
|
|
+ List<IotTreeDO> iotTreeList = iotTreeService.getIotTreeList(reqVO);
|
|
|
|
+ if (CollUtil.isNotEmpty(iotTreeList)) {
|
|
|
|
+ pageReqVO.setClassId(iotTreeList.get(0).getId());
|
|
|
|
+ }
|
|
return iotInfoMapper.selectPage(pageReqVO, getInfoCondition(pageReqVO.getClassId()));
|
|
return iotInfoMapper.selectPage(pageReqVO, getInfoCondition(pageReqVO.getClassId()));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -122,17 +149,18 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
if (Objects.isNull(iotTree)) {
|
|
if (Objects.isNull(iotTree)) {
|
|
throw exception(IOT_INFO_NOT_EXISTS);
|
|
throw exception(IOT_INFO_NOT_EXISTS);
|
|
}
|
|
}
|
|
- Set<Long> fileIds = convertSet(iotTreeService.getChildTreeList(classId), IotTreeDO::getOriginId);
|
|
|
|
|
|
+ Set<Long> fileIds = convertSet(iotTreeService.getChildTreeList(classId), IotTreeDO::getId);
|
|
//如果是设备的话
|
|
//如果是设备的话
|
|
if ("device".equals(iotTree.getType())) {
|
|
if ("device".equals(iotTree.getType())) {
|
|
- IotInfoClassifyListReqVO iotInfoClassifyListReqVO = new IotInfoClassifyListReqVO();
|
|
|
|
- IotInfoClassifyListReqVO classifyListReqVO = iotInfoClassifyListReqVO.setDeviceId(iotTree.getOriginId());
|
|
|
|
- List<IotInfoClassifyDO> iotInfoClassifyList = iotInfoClassifyService.getIotInfoClassifyList(classifyListReqVO);
|
|
|
|
- if (CollUtil.isNotEmpty(iotInfoClassifyList)) {
|
|
|
|
- fileIds.add(iotInfoClassifyList.get(0).getId());
|
|
|
|
- }
|
|
|
|
|
|
+// IotInfoClassifyListReqVO iotInfoClassifyListReqVO = new IotInfoClassifyListReqVO();
|
|
|
|
+// IotInfoClassifyListReqVO classifyListReqVO = iotInfoClassifyListReqVO.setDeviceId(iotTree.getOriginId());
|
|
|
|
+// List<IotInfoClassifyDO> iotInfoClassifyList = iotInfoClassifyService.getIotInfoClassifyList(classifyListReqVO);
|
|
|
|
+// if (CollUtil.isNotEmpty(iotInfoClassifyList)) {
|
|
|
|
+// fileIds.add(iotInfoClassifyList.get(0).getId());
|
|
|
|
+// }
|
|
|
|
+ fileIds.add(iotTree.getId());
|
|
} else {
|
|
} else {
|
|
- fileIds.add(iotTree.getOriginId()); // 包括自身
|
|
|
|
|
|
+ fileIds.add(iotTree.getId()); // 包括自身
|
|
}
|
|
}
|
|
|
|
|
|
return fileIds;
|
|
return fileIds;
|