|
@@ -1,6 +1,7 @@
|
|
|
package com.fdkankan.openApi.service.www.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -316,13 +317,24 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
}
|
|
|
Map<Long, String> cameraMap = cameraService.list().stream().collect(Collectors.toMap(Camera::getId, Camera::getSnCode));
|
|
|
Page<ScenePlus> scenePage = this.page(new Page<>(sceneVO.getPageNum(), sceneVO.getPageSize()), queryWrapper);
|
|
|
+ if(CollUtil.isEmpty(scenePage.getRecords())){
|
|
|
+ return PageInfo.PageInfo(scenePage);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> plusIdList = scenePage.getRecords().stream().map(plus -> plus.getId()).collect(Collectors.toList());
|
|
|
+ List<ScenePlusExt> scenePlusExtList = scenePlusExtService.list(new LambdaQueryWrapper<ScenePlusExt>().in(ScenePlusExt::getPlusId, plusIdList));
|
|
|
+ Map<Long, ScenePlusExt> plusExtMap = new HashMap<>();
|
|
|
+ scenePlusExtList.stream().forEach(ext->plusExtMap.put(ext.getPlusId(), ext));
|
|
|
+
|
|
|
List<SceneVO> sceneVos = scenePage.getRecords().stream().map(scenePlus -> {
|
|
|
SceneVO vo = new SceneVO();
|
|
|
vo.setSceneCode(scenePlus.getNum());
|
|
|
vo.setSceneName(scenePlus.getTitle());
|
|
|
vo.setCreateTime(DateUtil.date2String(scenePlus.getCreateTime(), null));
|
|
|
- ScenePlusExt plusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
- vo.setShootCount(plusExt.getShootCount());
|
|
|
+ ScenePlusExt plusExt = plusExtMap.get(scenePlus.getId());
|
|
|
+ if(Objects.nonNull(plusExt)){
|
|
|
+ vo.setShootCount(plusExt.getShootCount());
|
|
|
+ }
|
|
|
vo.setSnCode(cameraMap.get(scenePlus.getCameraId()));
|
|
|
vo.setCameraType("kankan");
|
|
|
if (scenePlus.getSceneSource() == 4) {
|
|
@@ -334,7 +346,8 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
}
|
|
|
return vo;
|
|
|
}).collect(Collectors.toList());
|
|
|
- return PageInfo.PageInfo(scenePage.getCurrent(),scenePage.getSize(),scenePage.getTotal(),sceneVos);
|
|
|
+
|
|
|
+ return PageInfo.PageInfo(scenePage);
|
|
|
}
|
|
|
|
|
|
@Override
|