| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- package com.fdkankan.manage.service.impl;
- import cn.hutool.core.io.FileUtil;
- import com.alibaba.excel.EasyExcel;
- import com.alibaba.excel.ExcelWriter;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.fdkankan.common.util.DateUtil;
- import com.fdkankan.fyun.face.FYunFileServiceInterface;
- import com.fdkankan.manage.common.OssPath;
- import com.fdkankan.manage.common.ResultCode;
- import com.fdkankan.manage.common.SensitiveWordReplacer;
- import com.fdkankan.manage.config.ManageConfig;
- import com.fdkankan.manage.exception.BusinessException;
- 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.util.ShellUtil;
- import com.fdkankan.manage.vo.request.AllShareParam;
- import com.fdkankan.manage.vo.request.SceneParam;
- import com.fdkankan.manage.vo.request.SceneTotalParam;
- import com.fdkankan.manage.vo.response.*;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.io.File;
- import java.nio.charset.StandardCharsets;
- import java.util.*;
- import java.util.stream.Collectors;
- /**
- * <p>
- * 场景主表 服务实现类
- * </p>
- *
- * @author
- * @since 2022-08-02
- */
- @Service
- public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlus> implements IScenePlusService {
- @Autowired
- ISceneProService sceneProService;
- @Autowired
- LaserService laserService;
- @Autowired
- ISceneBuildProcessLogService sceneBuildProcessLogService;
- @Autowired
- IBuildLogService buildLogService;
- @Autowired
- IOrigFileUploadBatchService origFileUploadBatchService;
- @Autowired
- IOrigFileUploadService origFileUploadService;
- @Autowired
- IExcelService excelService;
- @Autowired
- IScenePlusExtService scenePlusExtService;
- @Autowired
- FYunFileServiceInterface fYunFileServiceInterface;
- @Autowired
- ManageConfig manageConfig;
- @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<>();
- if(!userIdList.isEmpty()){
- 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<>();
- if(!cameraIds.isEmpty()){
- List<GroupByCount> result = this.getBaseMapper().getCountGroupByCameraId(cameraIds);
- result.forEach(entity ->map.put(entity.getId(),entity.getCount()));
- }
- return map;
- }
- @Override
- public Page<UserShareSceneVo> shareScenePageList(Page<UserShareSceneVo> objectPage, UserShareParam param) {
- return this.getBaseMapper().shareScenePageList(objectPage,param);
- }
- @Override
- public Page<UserShareSceneVo> allScenePageList(Page<UserShareSceneVo> objectPage, AllShareParam param) {
- return this.getBaseMapper().allScenePageList(objectPage,param);
- }
- @Override
- public Page<UserShareSceneVo> sceneAuthPageList(Page<UserShareSceneVo> objectPage, UserShareParam param) {
- return this.getBaseMapper().sceneAuthPageList(objectPage,param);
- }
- @Override
- public Page<UserAuthSceneVo> sceneAuthVoPageList(Page<UserShareSceneVo> objectPage, UserShareParam param) {
- return this.getBaseMapper().sceneAuthVoPageList(objectPage,param);
- }
- @Override
- public List<ScenePlus> getByNumList(List<String> numList) {
- if(numList == null || numList.isEmpty()){
- return new ArrayList<>();
- }
- LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
- wrapper.in(ScenePlus::getNum,numList);
- return this.list(wrapper);
- }
- @Override
- public String getSceneBuildLog(String num) {
- String sceneBuildLogPath = String.format(OssPath.SCENE_BUILD_LOG_PATH,num,num);
- if(!fYunFileServiceInterface.fileExist(sceneBuildLogPath)){
- throw new BusinessException(ResultCode.LOG_NOT_EXIST);
- }
- return manageConfig.getQueryPath() + sceneBuildLogPath ;
- }
- @Override
- public List<String> getNumListBySceneName(String sceneName) {
- LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
- wrapper.like(ScenePlus::getTitle,sceneName);
- return this.list(wrapper).stream().map(ScenePlus::getNum).collect(Collectors.toList());
- }
- @Override
- public List<SceneVoSimp> getVoByNumList(List<String> notAuthList) {
- if(notAuthList == null || notAuthList.isEmpty()){
- return null;
- }
- return this.getBaseMapper().getVoByNumList(notAuthList);
- }
- @Override
- public List<String> getByUserIds(List<Long> otherUserIds) {
- if(otherUserIds == null || otherUserIds.isEmpty()){
- return new ArrayList<>();
- }
- LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
- wrapper.in(ScenePlus::getUserId,otherUserIds);
- return this.list(wrapper).stream().map(ScenePlus::getNum).collect(Collectors.toList());
- }
- @Override
- public List<String> getByPlatformIds(List<Integer> otherPlatformIds) {
- if(otherPlatformIds == null || otherPlatformIds.isEmpty()){
- return new ArrayList<>();
- }
- return this.getBaseMapper().getByPlatformIds(otherPlatformIds);
- }
- }
|