feat(后端): 联调修改4
parent
f107d97cf8
commit
2e90f5684f
|
@ -14,6 +14,7 @@ import com.unisinsight.project.mapper.ImageMapper;
|
||||||
import com.unisinsight.project.service.ClientService;
|
import com.unisinsight.project.service.ClientService;
|
||||||
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.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -37,6 +38,9 @@ public class ClientServiceImpl implements ClientService {
|
||||||
@Resource
|
@Resource
|
||||||
private DeviceImageMappingMapper deviceImageMappingMapper;
|
private DeviceImageMappingMapper deviceImageMappingMapper;
|
||||||
|
|
||||||
|
// 请求bt配置
|
||||||
|
@Value("${file.upload.bt-url}")
|
||||||
|
private String btUrl;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<?> getImageList(String deviceId, String token) {
|
public Result<?> getImageList(String deviceId, String token) {
|
||||||
|
@ -60,7 +64,12 @@ public class ClientServiceImpl implements ClientService {
|
||||||
hashMap.put("name", e.getImageName());
|
hashMap.put("name", e.getImageName());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(e.getBtPath())) {
|
if (StringUtils.isNotBlank(e.getBtPath())) {
|
||||||
hashMap.put("torrent", e.getBtPath());
|
if (e.getBtPath().contains("http://") || e.getBtPath().contains("https://")) {
|
||||||
|
hashMap.put("torrent", e.getBtPath());
|
||||||
|
} else {
|
||||||
|
String fileName = e.getBtPath().substring(Math.max(e.getBtPath().lastIndexOf("\\"), e.getBtPath().lastIndexOf("/")) + 1);
|
||||||
|
hashMap.put("torrent", btUrl + "/api/vdi/file/down/" + fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return hashMap;
|
return hashMap;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author rdpnr_puzhi
|
* @author rdpnr_puzhi
|
||||||
|
@ -71,6 +73,16 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, Image>
|
||||||
return Result.successResult();
|
return Result.successResult();
|
||||||
} else {
|
} else {
|
||||||
PageResult<ImageRes> convert = PageResult.convertIPage(imageIPage, ImageRes.class);
|
PageResult<ImageRes> convert = PageResult.convertIPage(imageIPage, ImageRes.class);
|
||||||
|
List<ImageRes> data = convert.getData();
|
||||||
|
List<ImageRes> collect = data.stream().distinct().peek(e -> {
|
||||||
|
if (StringUtils.isNotBlank(e.getBtPath())) {
|
||||||
|
if (!e.getBtPath().contains("http://") || !e.getBtPath().contains("https://")) {
|
||||||
|
String fileName = e.getBtPath().substring(Math.max(e.getBtPath().lastIndexOf("\\"), e.getBtPath().lastIndexOf("/")) + 1);
|
||||||
|
e.setBtPath(btUrl + "/api/vdi/file/down/" + fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
convert.setData(collect);
|
||||||
return Result.successResult(convert);
|
return Result.successResult(convert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue