|
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.constant.Constant;
|
|
|
-import com.fdkankan.common.response.PageInfo;
|
|
|
+import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.common.CameraTypeEnum;
|
|
@@ -133,38 +133,40 @@ public class CameraDetailServiceImpl extends ServiceImpl<ICameraDetailMapper, Ca
|
|
|
List<CameraDetail> list = this.list(wrapper);
|
|
|
Set<Long> cameraIds = list.parallelStream().map(CameraDetail::getCameraId).collect(Collectors.toSet());
|
|
|
HashMap<Long, Long> resultMap = new HashMap<>();
|
|
|
- HashMap<Long, Long> sceneProMap = sceneProService.getCountGroupByCameraId(new ArrayList<>(cameraIds));
|
|
|
- HashMap<Long, Long> sceneMap = sceneService.getCountGroupByCameraId(new ArrayList<>(cameraIds));
|
|
|
- HashMap<Long, Long> scenePlusMap = scenePlusService.getCountGroupByCameraId(new ArrayList<>(cameraIds));
|
|
|
-
|
|
|
- HashMap<Long,Camera> cameraHashMap = new HashMap<>();
|
|
|
- List<Camera> cameraList = cameraService.listByIds(cameraIds);
|
|
|
- cameraList.forEach(entity -> cameraHashMap.put(entity.getId(),entity));
|
|
|
- HashMap<Long,List<String>> companySnCodeMap = new HashMap<>();
|
|
|
- for (CameraDetail cameraDetail : list) {
|
|
|
- Long sceneProCount = sceneProMap.get(cameraDetail.getCameraId()) == null ? 0L : sceneProMap.get(cameraDetail.getCameraId());
|
|
|
- Long sceneCount = sceneMap.get(cameraDetail.getCameraId()) == null ? 0L : sceneMap.get(cameraDetail.getCameraId());
|
|
|
- Long scenePlusCount = scenePlusMap.get(cameraDetail.getCameraId()) == null ? 0L : scenePlusMap.get(cameraDetail.getCameraId());
|
|
|
- Long count = sceneProCount + sceneCount + scenePlusCount;
|
|
|
-
|
|
|
- List<String> snCodeList = companySnCodeMap.computeIfAbsent(cameraDetail.getCompanyId(), k -> new ArrayList<>());
|
|
|
- Camera camera = cameraHashMap.get(cameraDetail.getCameraId());
|
|
|
- if(camera != null){
|
|
|
- snCodeList.add(camera.getSnCode());
|
|
|
+ if(cameraIds.size() >0){
|
|
|
+ HashMap<Long, Long> sceneProMap = sceneProService.getCountGroupByCameraId(new ArrayList<>(cameraIds));
|
|
|
+ HashMap<Long, Long> sceneMap = sceneService.getCountGroupByCameraId(new ArrayList<>(cameraIds));
|
|
|
+ HashMap<Long, Long> scenePlusMap = scenePlusService.getCountGroupByCameraId(new ArrayList<>(cameraIds));
|
|
|
+ HashMap<Long,Camera> cameraHashMap = new HashMap<>();
|
|
|
+ List<Camera> cameraList = cameraService.listByIds(cameraIds);
|
|
|
+ cameraList.forEach(entity -> cameraHashMap.put(entity.getId(),entity));
|
|
|
+ HashMap<Long,List<String>> companySnCodeMap = new HashMap<>();
|
|
|
+ for (CameraDetail cameraDetail : list) {
|
|
|
+ Long sceneProCount = sceneProMap.get(cameraDetail.getCameraId()) == null ? 0L : sceneProMap.get(cameraDetail.getCameraId());
|
|
|
+ Long sceneCount = sceneMap.get(cameraDetail.getCameraId()) == null ? 0L : sceneMap.get(cameraDetail.getCameraId());
|
|
|
+ Long scenePlusCount = scenePlusMap.get(cameraDetail.getCameraId()) == null ? 0L : scenePlusMap.get(cameraDetail.getCameraId());
|
|
|
+ Long count = sceneProCount + sceneCount + scenePlusCount;
|
|
|
+
|
|
|
+ List<String> snCodeList = companySnCodeMap.computeIfAbsent(cameraDetail.getCompanyId(), k -> new ArrayList<>());
|
|
|
+ Camera camera = cameraHashMap.get(cameraDetail.getCameraId());
|
|
|
+ if(camera != null){
|
|
|
+ snCodeList.add(camera.getSnCode());
|
|
|
+ }
|
|
|
+ resultMap.merge(cameraDetail.getCompanyId(), count, Long::sum);
|
|
|
}
|
|
|
- resultMap.merge(cameraDetail.getCompanyId(), count, Long::sum);
|
|
|
- }
|
|
|
|
|
|
- for (Long companyId : companySnCodeMap.keySet()) {
|
|
|
- List<String> snCodeList = companySnCodeMap.get(companyId);
|
|
|
- if(snCodeList == null || snCodeList.size() <=0){
|
|
|
- continue;
|
|
|
+ for (Long companyId : companySnCodeMap.keySet()) {
|
|
|
+ List<String> snCodeList = companySnCodeMap.get(companyId);
|
|
|
+ if(snCodeList == null || snCodeList.size() <=0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ SceneParam param = new SceneParam();
|
|
|
+ param.setSnCodes(snCodeList);
|
|
|
+ PageInfo pageInfo = laserService.pageList(param);
|
|
|
+ resultMap.merge(companyId, pageInfo.getTotal(), Long::sum);
|
|
|
}
|
|
|
- SceneParam param = new SceneParam();
|
|
|
- param.setSnCodes(snCodeList);
|
|
|
- PageInfo pageInfo = laserService.pageList(param);
|
|
|
- resultMap.merge(companyId, pageInfo.getTotal(), Long::sum);
|
|
|
}
|
|
|
+
|
|
|
return resultMap;
|
|
|
}
|
|
|
|