wangys 5 năm trước cách đây
mục cha
commit
ccc72bdbab
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      src/main/java/cn/efunbox/audio/impl/DeviceServiceImpl.java

+ 10 - 0
src/main/java/cn/efunbox/audio/impl/DeviceServiceImpl.java

@@ -10,6 +10,7 @@ import cn.efunbox.audio.utils.ApiCode;
 import cn.efunbox.audio.utils.ApiResult;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
@@ -34,6 +35,9 @@ public class DeviceServiceImpl implements DeviceService {
     @Autowired
     AlbumRepo albumRepo;
 
+    @Value("${efunbox.oss.img.url}")
+    private String imgURL;
+
     @Override
     public boolean CheckRegister(Long idChannel, String idDevice){
         List<Device> list = deviceRepo.findByChannelDevice(idChannel, idDevice);
@@ -161,6 +165,12 @@ public class DeviceServiceImpl implements DeviceService {
         if(Objects.isNull(devices)){
             return null;
         }
+        List<Album> albums = albumRepo.findAlbum(idDevice);
+        albums.stream().forEach(album -> {
+            if(Objects.nonNull(album.getImage())){
+                album.setImage(imgURL + album.getImage());
+            }
+        });
         return albumRepo.findAlbum(idDevice);
     }
 }