12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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;
- }
- }
|