|
@@ -1,6 +1,8 @@
|
|
package cn.iocoder.yudao.module.pms.service;
|
|
package cn.iocoder.yudao.module.pms.service;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
+import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
|
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.dal.dataobject.IotInfoClassifyDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
|
|
@@ -16,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -55,6 +58,7 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
// todo iotInfo.setFilename(StringUtils.substringAfterLast(path, File.separator));
|
|
// todo iotInfo.setFilename(StringUtils.substringAfterLast(path, File.separator));
|
|
iotInfo.setFilename(StringUtils.substringAfterLast(path, "/"));
|
|
iotInfo.setFilename(StringUtils.substringAfterLast(path, "/"));
|
|
iotInfo.setFilePath(path);
|
|
iotInfo.setFilePath(path);
|
|
|
|
+ iotInfo.setFileSize(String.valueOf(FileUtils.getFileSizeMB(path)));
|
|
iotInfo.setDeleted(false);
|
|
iotInfo.setDeleted(false);
|
|
return iotInfo;
|
|
return iotInfo;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
@@ -69,6 +73,8 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
// 更新
|
|
// 更新
|
|
IotInfoDO updateObj = BeanUtils.toBean(updateReqVO, IotInfoDO.class);
|
|
IotInfoDO updateObj = BeanUtils.toBean(updateReqVO, IotInfoDO.class);
|
|
updateObj.setFilename(StringUtils.substringAfterLast(updateObj.getFilePath(), "/"));
|
|
updateObj.setFilename(StringUtils.substringAfterLast(updateObj.getFilePath(), "/"));
|
|
|
|
+ updateObj.setFilePath(updateReqVO.getFilePath());
|
|
|
|
+ updateObj.setFileSize(String.valueOf(FileUtils.getFileSizeMB(updateReqVO.getFilePath())));
|
|
iotInfoMapper.updateById(updateObj);
|
|
iotInfoMapper.updateById(updateObj);
|
|
}
|
|
}
|
|
|
|
|