|
|
@@ -1,6 +1,8 @@
|
|
|
package cn.reghao.tnb.content.app.disk.service;
|
|
|
|
|
|
import cn.reghao.jutil.jdk.db.Page;
|
|
|
+import cn.reghao.tnb.account.api.dto.AccountAvatar;
|
|
|
+import cn.reghao.tnb.account.api.iface.AccountQuery;
|
|
|
import cn.reghao.tnb.common.auth.UserContext;
|
|
|
import cn.reghao.tnb.content.app.disk.db.mapper.CamDeviceMapper;
|
|
|
import cn.reghao.tnb.content.app.disk.db.mapper.UserActivityMapper;
|
|
|
@@ -12,6 +14,7 @@ import cn.reghao.tnb.content.app.disk.model.query.CamDeviceQuery;
|
|
|
import cn.reghao.tnb.content.app.geo.model.vo.SelectOption;
|
|
|
import cn.reghao.tnb.content.app.util.IdService;
|
|
|
import cn.reghao.tnb.content.app.util.RandomUtil;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
@@ -26,6 +29,9 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CamService {
|
|
|
+ @DubboReference(check = false, retries = 0, timeout = 60_000)
|
|
|
+ private AccountQuery accountQuery;
|
|
|
+
|
|
|
private int pageSize = 10;
|
|
|
private final IdService idService;
|
|
|
private final CamDeviceMapper camDeviceMapper;
|
|
|
@@ -58,6 +64,7 @@ public class CamService {
|
|
|
List<Long> sharedCamIds = diskShareService.getSharedAlbumIds(AlbumType.cam.getValue(), loginUser);
|
|
|
if (!sharedCamIds.isEmpty()) {
|
|
|
List<CamDevice> sharedCamDevices = camDeviceMapper.findByCamIds(sharedCamIds);
|
|
|
+ sharedCamDevices.forEach(this::setSharedCamName);
|
|
|
camDeviceList.addAll(sharedCamDevices);
|
|
|
}
|
|
|
|
|
|
@@ -84,12 +91,21 @@ public class CamService {
|
|
|
.camId(camId)
|
|
|
.build();
|
|
|
camDeviceList = camDeviceMapper.findCamDeviceQueryByPage(page, camDeviceQuery);
|
|
|
+ camDeviceList.forEach(this::setSharedCamName);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return camDeviceList.isEmpty() ? null : camDeviceList.get(0);
|
|
|
}
|
|
|
|
|
|
+ private void setSharedCamName(CamDevice camDevice) {
|
|
|
+ long createBy = camDevice.getAddBy();
|
|
|
+ AccountAvatar accountAvatar = accountQuery.getAccountAvatar(createBy);
|
|
|
+ String username = accountAvatar.getUsername();
|
|
|
+ String albumName = String.format("%s(%s的分享)", camDevice.getCamName(), username);
|
|
|
+ camDevice.setCamName(albumName);
|
|
|
+ }
|
|
|
+
|
|
|
public void addActivity() {
|
|
|
int total = RandomUtil.getNumber(10, 100);
|
|
|
List<UserActivity> list = new ArrayList<>();
|