123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- package com.fdkankan.manage.service.impl;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
- import com.fdkankan.common.util.DateUtil;
- import com.fdkankan.manage.httpClient.service.LaserService;
- import com.fdkankan.manage.entity.*;
- import com.fdkankan.manage.mapper.IScenePlusMapper;
- import com.fdkankan.manage.service.*;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.fdkankan.manage.vo.response.GroupByCount;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- /**
- * <p>
- * 场景主表 服务实现类
- * </p>
- *
- * @author
- * @since 2022-08-02
- */
- @Service
- public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlus> implements IScenePlusService {
- @Autowired
- ISceneProService sceneProService;
- @Autowired
- LaserService laserService;
- @Autowired
- IScenePlusExtService scenePlusExtService;
- @Override
- public ScenePlus getByNum(String sceneNum) {
- LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(ScenePlus::getNum,sceneNum);
- List<ScenePlus> list = this.list(wrapper);
- if(list!=null && list.size() >0){
- return list.get(0);
- }
- return null;
- }
- @Override
- public void unbindCamera(Long cameraId) {
- LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
- wrapper.set(ScenePlus::getUserId,null)
- .eq(ScenePlus::getCameraId,cameraId);
- this.update(wrapper);
- }
- @Override
- public HashMap<Long, Long> getCountGroupByUserId(List<Long> userIdList,Integer isObj) {
- HashMap<Long,Long> map = new HashMap<>();
- List<GroupByCount> result = this.getBaseMapper().getCountGroupByUserId(userIdList,isObj);
- result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
- return map;
- }
- @Override
- public HashMap<Long, Long> getCountGroupByCameraId(ArrayList<Long> cameraIds) {
- HashMap<Long,Long> map = new HashMap<>();
- List<GroupByCount> result = this.getBaseMapper().getCountGroupByCameraId(cameraIds);
- result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
- return map;
- }
- @Override
- public String getDataSourceByNum(String num) {
- ScenePro scenePro = sceneProService.getByNum(num);
- if(scenePro != null ){
- return scenePro.getDataSource();
- }
- ScenePlus plus = this.getByNum(num);
- if(plus != null){
- ScenePlusExt plusExt = scenePlusExtService.getByPlusId(plus.getId());
- if(plusExt.getDataSource() != null){
- return plusExt.getDataSource();
- }
- }
- return null;
- }
- @Override
- public Long getSpaceSumByCameraId(Long cameraId) {
- return this.getBaseMapper().getSpaceSumByCameraId(cameraId);
- }
- @Override
- public Long getCountByCameraId(Long cameraId) {
- LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(ScenePlus::getCameraId,cameraId);
- wrapper.eq(ScenePlus::getSceneStatus,-2);
- return this.count(wrapper);
- }
- }
|