|
@@ -4,23 +4,23 @@ import cn.hutool.core.collection.CollUtil;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
|
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
-import cn.iocoder.yudao.module.pms.controller.admin.vo.*;
|
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoRespVO;
|
|
|
|
+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;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotTreeDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotTreeDO;
|
|
-import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoClassifyMapper;
|
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotTreeMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotTreeMapper;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -55,8 +55,6 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
private DeptApi deptApi;
|
|
private DeptApi deptApi;
|
|
@Autowired
|
|
@Autowired
|
|
private IotTreeMapper iotTreeMapper;
|
|
private IotTreeMapper iotTreeMapper;
|
|
- @Value("${file.url}")
|
|
|
|
- private String fileUrl;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<IotInfoRespVO> getChildContentFile(Long classId) {
|
|
public List<IotInfoRespVO> getChildContentFile(Long classId) {
|
|
@@ -369,7 +367,9 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
private void processFiles(JsonNode filesNode, Long rootParentId,Long fileClassId, Long deviceId, Long deptId) {
|
|
private void processFiles(JsonNode filesNode, Long rootParentId,Long fileClassId, Long deviceId, Long deptId) {
|
|
for (JsonNode fileNode : filesNode) {
|
|
for (JsonNode fileNode : filesNode) {
|
|
String path = fileNode.get("path").asText();
|
|
String path = fileNode.get("path").asText();
|
|
|
|
+ String filePath = fileNode.get("filePath").asText();
|
|
String fileName = fileNode.get("name").asText();
|
|
String fileName = fileNode.get("name").asText();
|
|
|
|
+ String size = fileNode.get("size").asText();
|
|
|
|
|
|
// 根据路径确定父文件夹ID
|
|
// 根据路径确定父文件夹ID
|
|
String[] pathParts = path.split("/");
|
|
String[] pathParts = path.split("/");
|
|
@@ -394,7 +394,12 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
if (fileName.contains("jpg")||fileName.contains("jpeg")||fileName.contains("png")||fileName.contains("gif")) {
|
|
if (fileName.contains("jpg")||fileName.contains("jpeg")||fileName.contains("png")||fileName.contains("gif")) {
|
|
info.setFileType("pic");
|
|
info.setFileType("pic");
|
|
}
|
|
}
|
|
- info.setFilePath(fileUrl+fileName);
|
|
|
|
|
|
+ info.setFilePath(filePath);
|
|
|
|
+ if (StringUtils.isNotBlank(size)&&!"null".equals(size)) {
|
|
|
|
+ long fileSize = Long.parseLong(size);
|
|
|
|
+ double mb = fileSize / (1024.0 * 1024.0);
|
|
|
|
+ info.setFileSize(String.format("%.2f MB", mb));
|
|
|
|
+ }
|
|
iotInfoMapper.insert(info);
|
|
iotInfoMapper.insert(info);
|
|
}
|
|
}
|
|
}
|
|
}
|