|
@@ -11,12 +11,9 @@ import com.fdkankan.common.util.SecurityUtil;
|
|
import com.fdkankan.manage.common.CacheUtil;
|
|
import com.fdkankan.manage.common.CacheUtil;
|
|
import com.fdkankan.manage.common.OssPath;
|
|
import com.fdkankan.manage.common.OssPath;
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
-import com.fdkankan.manage.entity.CameraDetail;
|
|
|
|
-import com.fdkankan.manage.entity.SysUser;
|
|
|
|
-import com.fdkankan.manage.entity.UserIncrement;
|
|
|
|
|
|
+import com.fdkankan.manage.entity.*;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
-import com.fdkankan.manage.entity.User;
|
|
|
|
import com.fdkankan.manage.httpClient.service.LaserService;
|
|
import com.fdkankan.manage.httpClient.service.LaserService;
|
|
import com.fdkankan.manage.mapper.IUserMapper;
|
|
import com.fdkankan.manage.mapper.IUserMapper;
|
|
import com.fdkankan.manage.service.*;
|
|
import com.fdkankan.manage.service.*;
|
|
@@ -47,6 +44,8 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
@Autowired
|
|
@Autowired
|
|
private IUserIncrementService userIncrementService;
|
|
private IUserIncrementService userIncrementService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private ICameraService cameraService;
|
|
|
|
+ @Autowired
|
|
private ICameraDetailService cameraDetailService;
|
|
private ICameraDetailService cameraDetailService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneService sceneService;
|
|
private ISceneService sceneService;
|
|
@@ -167,10 +166,13 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HashMap<Long, User> getByIds(List<Long> userIds) {
|
|
public HashMap<Long, User> getByIds(List<Long> userIds) {
|
|
|
|
+ HashMap<Long,User> map = new HashMap<>();
|
|
|
|
+ if(userIds.isEmpty()){
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.in(User::getId,userIds);
|
|
wrapper.in(User::getId,userIds);
|
|
List<User> list = this.list(wrapper);
|
|
List<User> list = this.list(wrapper);
|
|
- HashMap<Long,User> map = new HashMap<>();
|
|
|
|
list.forEach(entity -> map.put(entity.getId(),entity));
|
|
list.forEach(entity -> map.put(entity.getId(),entity));
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
@@ -274,4 +276,28 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
wrapper.like(User::getUserName,userName);
|
|
wrapper.like(User::getUserName,userName);
|
|
return this.list(wrapper);
|
|
return this.list(wrapper);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HashMap<String, User> getUserBySn(Set<String> snCodes) {
|
|
|
|
+ HashMap<Long,User> map = new HashMap<>();
|
|
|
|
+ HashMap<String,User> mapUser = new HashMap<>();
|
|
|
|
+ List<Camera> cameraList = cameraService.getBySnCodes(snCodes);
|
|
|
|
+ List<Long> cameraIds = cameraList.parallelStream().map(Camera::getId).collect(Collectors.toList());
|
|
|
|
+ List<CameraDetail> cameraDetails = cameraDetailService.getByCameraIds(cameraIds);
|
|
|
|
+ List<Long> userIds = cameraDetails.parallelStream().map(CameraDetail::getUserId).collect(Collectors.toList());
|
|
|
|
+ HashMap<Long, User> useMap = this.getByIds(userIds);
|
|
|
|
+
|
|
|
|
+ for (CameraDetail cameraDetail : cameraDetails) {
|
|
|
|
+ if(cameraDetail.getUserId() != null){
|
|
|
|
+ User user = useMap.get(cameraDetail.getUserId());
|
|
|
|
+ if(user != null){
|
|
|
|
+ map.put(cameraDetail.getCameraId(),user);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ cameraList.forEach(e -> mapUser.put(e.getSnCode(),map.get(e.getId())));
|
|
|
|
+
|
|
|
|
+ return mapUser;
|
|
|
|
+ }
|
|
}
|
|
}
|