|
@@ -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.IotInfoPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
|
|
|
+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.IotInfoDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotTreeDO;
|
|
@@ -42,6 +43,8 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
|
private IotInfoClassifyService iotInfoClassifyService;
|
|
|
@Autowired
|
|
|
private IotTreeService iotTreeService;
|
|
|
+ @Autowired
|
|
|
+ private IotDeviceService iotDeviceService;
|
|
|
|
|
|
@Override
|
|
|
public void createIotInfo(IotInfoSaveReqVO createReqVO) {
|
|
@@ -50,10 +53,12 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
|
throw exception(IOT_INFO_NOT_EXISTS);
|
|
|
}
|
|
|
Long classId = createReqVO.getClassId();
|
|
|
+ IotDeviceDO iotDevice = iotDeviceService.getIotDevice(createReqVO.getDeviceId());
|
|
|
List<IotInfoDO> collect = createReqVO.getFileList().stream().map(e -> {
|
|
|
IotInfoDO iotInfo = BeanUtils.toBean(createReqVO, IotInfoDO.class);
|
|
|
iotInfo.setFilename(StringUtils.substringAfterLast(e.get("url"), "/"));
|
|
|
iotInfo.setFilePath(e.get("url"));
|
|
|
+ iotInfo.setDeptId(iotDevice.getDeptId());
|
|
|
long size = Long.parseLong(e.get("size"));
|
|
|
double mb = size / (1024.0 * 1024.0);
|
|
|
iotInfo.setFileSize(String.format("%.2f MB", mb));
|