ScenePlusServiceImpl.java 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package com.fdkankan.manage.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.fdkankan.common.util.DateUtil;
  6. import com.fdkankan.manage.httpClient.service.LaserService;
  7. import com.fdkankan.manage.entity.*;
  8. import com.fdkankan.manage.mapper.IScenePlusMapper;
  9. import com.fdkankan.manage.service.*;
  10. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  11. import com.fdkankan.manage.vo.request.SceneParam;
  12. import com.fdkankan.manage.vo.response.GroupByCount;
  13. import com.fdkankan.manage.vo.response.UserAuthSceneVo;
  14. import com.fdkankan.manage.vo.response.UserShareSceneVo;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.stereotype.Service;
  17. import java.util.ArrayList;
  18. import java.util.Date;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. /**
  22. * <p>
  23. * 场景主表 服务实现类
  24. * </p>
  25. *
  26. * @author
  27. * @since 2022-08-02
  28. */
  29. @Service
  30. public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlus> implements IScenePlusService {
  31. @Autowired
  32. ISceneProService sceneProService;
  33. @Autowired
  34. LaserService laserService;
  35. @Override
  36. public ScenePlus getByNum(String sceneNum) {
  37. LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
  38. wrapper.eq(ScenePlus::getNum,sceneNum);
  39. List<ScenePlus> list = this.list(wrapper);
  40. if(list!=null && list.size() >0){
  41. return list.get(0);
  42. }
  43. return null;
  44. }
  45. @Override
  46. public void unbindCamera(Long cameraId) {
  47. LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
  48. wrapper.set(ScenePlus::getUserId,null)
  49. .eq(ScenePlus::getCameraId,cameraId);
  50. this.update(wrapper);
  51. }
  52. @Override
  53. public HashMap<Long, Long> getCountGroupByUserId(List<Long> userIdList,Integer isObj) {
  54. HashMap<Long,Long> map = new HashMap<>();
  55. if(!userIdList.isEmpty()){
  56. List<GroupByCount> result = this.getBaseMapper().getCountGroupByUserId(userIdList,isObj);
  57. result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
  58. }
  59. return map;
  60. }
  61. @Override
  62. public HashMap<Long, Long> getCountGroupByCameraId(ArrayList<Long> cameraIds) {
  63. HashMap<Long,Long> map = new HashMap<>();
  64. if(!cameraIds.isEmpty()){
  65. List<GroupByCount> result = this.getBaseMapper().getCountGroupByCameraId(cameraIds);
  66. result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
  67. }
  68. return map;
  69. }
  70. @Override
  71. public Page<UserShareSceneVo> shareScenePageList(Page<UserShareSceneVo> objectPage, UserShareParam param) {
  72. return this.getBaseMapper().shareScenePageList(objectPage,param);
  73. }
  74. @Override
  75. public Page<UserShareSceneVo> sceneAuthPageList(Page<UserShareSceneVo> objectPage, UserShareParam param) {
  76. return this.getBaseMapper().sceneAuthPageList(objectPage,param);
  77. }
  78. @Override
  79. public Page<UserAuthSceneVo> sceneAuthVoPageList(Page<UserShareSceneVo> objectPage, UserShareParam param) {
  80. return this.getBaseMapper().sceneAuthVoPageList(objectPage,param);
  81. }
  82. }