|
@@ -2,6 +2,7 @@ package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import cn.hutool.core.codec.Caesar;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -106,6 +107,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
ISceneColdStorageService sceneColdStorageService;
|
|
ISceneColdStorageService sceneColdStorageService;
|
|
@Autowired
|
|
@Autowired
|
|
ICommonService commonService;
|
|
ICommonService commonService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IUserService userService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -216,20 +219,62 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
if(param.getType() == 3){ //双目lite
|
|
if(param.getType() == 3){ //双目lite
|
|
return sceneService.pageList(param);
|
|
return sceneService.pageList(param);
|
|
}
|
|
}
|
|
|
|
+ //优化查询,去掉left join
|
|
|
|
+ //snCode 查询,userName 查询,companyId查询
|
|
|
|
+ //snCode回显,userName回显
|
|
|
|
+ if(StringUtils.isNotBlank(param.getSnCode())){
|
|
|
|
+ List<Camera> cameraList = cameraService.getLikeBySnCode(param.getSnCode());
|
|
|
|
+ List<Long> cameraIds = cameraList.stream().map(Camera::getId).collect(Collectors.toList());
|
|
|
|
+ param.setCameraIds(cameraIds);
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(param.getUserName())){
|
|
|
|
+ List<User> userList = userService.getLikeByUserName(param.getUserName());
|
|
|
|
+ List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
|
+ param.setUserIds(userIds);
|
|
|
|
+ }
|
|
|
|
+ if(param.getCompanyId() != null){
|
|
|
|
+ List<CameraDetail> details = cameraDetailService.getListByCompanyId(param.getCompanyId());
|
|
|
|
+ List<Long> cameraIds = details.stream().map(CameraDetail::getCameraId).collect(Collectors.toList());
|
|
|
|
+ if(param.getCameraIds() == null || param.getCameraIds().size() <=0 ){
|
|
|
|
+ param.setCameraIds(cameraIds);
|
|
|
|
+ }else {
|
|
|
|
+ List<Long> intersection = cameraIds.stream().filter(param.getCameraIds()::contains).collect(Collectors.toList());
|
|
|
|
+ param.setCameraIds(intersection);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
Page<SceneVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
Page<SceneVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|
|
List<SceneVo> records = page.getRecords();
|
|
List<SceneVo> records = page.getRecords();
|
|
HashMap<String,SceneCopyLog> map = null;
|
|
HashMap<String,SceneCopyLog> map = null;
|
|
- if(records.size() >0){
|
|
|
|
- List<String> numList = records.parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
|
- map = copyLogService.getByNewNumList(numList);
|
|
|
|
- }
|
|
|
|
HashMap<String,SceneColdStorage> coldStorageMap = null;
|
|
HashMap<String,SceneColdStorage> coldStorageMap = null;
|
|
- if(records.size() >0){
|
|
|
|
|
|
+ HashMap<Long, User> userMap = null;
|
|
|
|
+ HashMap<Long, Camera> cameraMap = null;
|
|
|
|
+ if(!records.isEmpty()){
|
|
List<String> numList = records.parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
List<String> numList = records.parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
|
+ map = copyLogService.getByNewNumList(numList);
|
|
coldStorageMap = sceneColdStorageService.getByNumList(numList);
|
|
coldStorageMap = sceneColdStorageService.getByNumList(numList);
|
|
|
|
+
|
|
|
|
+ List<Long> userIds = records.parallelStream().map(SceneVo::getUserId).collect(Collectors.toList());
|
|
|
|
+ userMap = userService.getByIds(userIds);
|
|
|
|
+
|
|
|
|
+ List<Long> cameraIds = records.parallelStream().map(SceneVo::getCameraId).collect(Collectors.toList());
|
|
|
|
+ cameraMap = cameraService.getByIds(cameraIds);
|
|
|
|
+
|
|
}
|
|
}
|
|
for (SceneVo record : page.getRecords()) {
|
|
for (SceneVo record : page.getRecords()) {
|
|
record.setStatusString(SceneStatusUtil.getStatusString(record));
|
|
record.setStatusString(SceneStatusUtil.getStatusString(record));
|
|
|
|
+ if(userMap != null){
|
|
|
|
+ User user = userMap.get(record.getUserId());
|
|
|
|
+ if(user != null){
|
|
|
|
+ record.setUserName(user.getUserName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(cameraMap != null){
|
|
|
|
+ Camera camera = cameraMap.get(record.getUserId());
|
|
|
|
+ if(camera != null){
|
|
|
|
+ record.setSnCode(camera.getSnCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if(map !=null ){
|
|
if(map !=null ){
|
|
SceneCopyLog sceneCopyLog = map.get(record.getNum());
|
|
SceneCopyLog sceneCopyLog = map.get(record.getNum());
|
|
if(sceneCopyLog != null){
|
|
if(sceneCopyLog != null){
|