|
@@ -1,6 +1,7 @@
|
|
package com.fdkankan.scene.service.impl;
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -10,22 +11,18 @@ import com.fdkankan.common.constant.CommonStatus;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.SceneInfoReqType;
|
|
import com.fdkankan.common.constant.SceneInfoReqType;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
-import com.fdkankan.scene.entity.Scene;
|
|
|
|
-import com.fdkankan.scene.entity.SceneEditControls;
|
|
|
|
-import com.fdkankan.scene.entity.SceneEditInfo;
|
|
|
|
-import com.fdkankan.scene.entity.SceneEditInfoExt;
|
|
|
|
|
|
+import com.fdkankan.redis.constant.RedisKey;
|
|
|
|
+import com.fdkankan.redis.util.RedisClient;
|
|
|
|
+import com.fdkankan.scene.entity.*;
|
|
import com.fdkankan.scene.mapper.SceneEditInfoMapper;
|
|
import com.fdkankan.scene.mapper.SceneEditInfoMapper;
|
|
-import com.fdkankan.scene.service.SceneEditControlsService;
|
|
|
|
-import com.fdkankan.scene.service.SceneEditInfoExtService;
|
|
|
|
-import com.fdkankan.scene.service.SceneEditInfoService;
|
|
|
|
-import com.fdkankan.scene.service.SceneService;
|
|
|
|
|
|
+import com.fdkankan.scene.service.*;
|
|
import com.fdkankan.scene.vo.*;
|
|
import com.fdkankan.scene.vo.*;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -53,8 +50,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
// private ISceneProService sceneProService;
|
|
// private ISceneProService sceneProService;
|
|
// @Resource
|
|
// @Resource
|
|
// private FYunFileServiceInterface fYunFileService;
|
|
// private FYunFileServiceInterface fYunFileService;
|
|
-// @Autowired
|
|
|
|
-// RedisUtil redisUtil;
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private RedisClient redisClient;
|
|
// @Autowired
|
|
// @Autowired
|
|
// private RedisLockUtil redisLockUtil;
|
|
// private RedisLockUtil redisLockUtil;
|
|
// @Autowired
|
|
// @Autowired
|
|
@@ -63,6 +60,8 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
private SceneEditInfoExtService sceneEditInfoExtService;
|
|
private SceneEditInfoExtService sceneEditInfoExtService;
|
|
@Autowired
|
|
@Autowired
|
|
private SceneService sceneService;
|
|
private SceneService sceneService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SceneFileMappingService sceneFileMappingService;
|
|
// @Autowired
|
|
// @Autowired
|
|
// IScenePlusExtService scenePlusExtService;
|
|
// IScenePlusExtService scenePlusExtService;
|
|
// @Autowired
|
|
// @Autowired
|
|
@@ -416,7 +415,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
return this.getSceneInfo4Edit(param.getNum());
|
|
return this.getSceneInfo4Edit(param.getNum());
|
|
//如果是查看页面请求,查redis
|
|
//如果是查看页面请求,查redis
|
|
case VIEW:
|
|
case VIEW:
|
|
- return this.getSceneInfo4View(param.getNum());
|
|
|
|
|
|
+ return this.getSceneInfo4Edit(param.getNum());
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -468,6 +467,28 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
|
|
|
|
// this.SortBoxVideos(sceneInfoVO);
|
|
// this.SortBoxVideos(sceneInfoVO);
|
|
|
|
|
|
|
|
+ Set<String> keySet = new HashSet<>();
|
|
|
|
+ Set<Long> deleteIds = new HashSet<>();
|
|
|
|
+ List<SceneFileMapping> mappings = new ArrayList<>();
|
|
|
|
+ List<SceneFileMapping> mappingList = sceneFileMappingService.list(new LambdaQueryWrapper<SceneFileMapping>().eq(SceneFileMapping::getNum, num).orderByDesc(SceneFileMapping::getId));
|
|
|
|
+ for (SceneFileMapping mapping : mappingList) {
|
|
|
|
+ if(keySet.contains(mapping.getKey())){
|
|
|
|
+ deleteIds.add(mapping.getId());
|
|
|
|
+ }else{
|
|
|
|
+ keySet.add(mapping.getKey());
|
|
|
|
+ mappings.add(mapping);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(CollUtil.isNotEmpty(deleteIds)){
|
|
|
|
+ sceneFileMappingService.removeByIds(deleteIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, String> keyMap = new HashMap<>();
|
|
|
|
+ for (SceneFileMapping sceneFileMapping : mappings) {
|
|
|
|
+ keyMap.put(sceneFileMapping.getKey(), "service/scene/file?key=" + sceneFileMapping.getKey());
|
|
|
|
+ }
|
|
|
|
+ sceneInfoVO.setMapping(keyMap);
|
|
|
|
+
|
|
return sceneInfoVO;
|
|
return sceneInfoVO;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1423,28 +1444,28 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<SceneEditInfoMapper, S
|
|
// }
|
|
// }
|
|
// });
|
|
// });
|
|
// }
|
|
// }
|
|
-//
|
|
|
|
-// @Override
|
|
|
|
-// public void saveTagsToSceneEditInfo(String num, SceneEditInfo sceneEditInfo){
|
|
|
|
-// //查询缓存是否包含热点数据
|
|
|
|
-// String key = String.format(RedisKey.SCENE_HOT_DATA, num);
|
|
|
|
-// Map<String, String> allTagsMap = redisUtil.hmget(key);
|
|
|
|
-// boolean hashTags = false;
|
|
|
|
-// for (Entry<String, String> tagMap : allTagsMap.entrySet()) {
|
|
|
|
-// if(StrUtil.isEmpty(tagMap.getValue())){
|
|
|
|
-// continue;
|
|
|
|
-// }
|
|
|
|
-// hashTags = true;
|
|
|
|
-// break;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //更改热点状态
|
|
|
|
-// sceneEditInfo.setTags(hashTags ? CommonStatus.YES.code() : CommonStatus.NO.code());
|
|
|
|
-// //version 是空的代表 sceneEditInfo记录集不存在
|
|
|
|
-// if(sceneEditInfo.getVersion() != null){
|
|
|
|
-// sceneEditInfo.setVersion(sceneEditInfo.getVersion() + 1);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void saveTagsToSceneEditInfo(String num, SceneEditInfo sceneEditInfo){
|
|
|
|
+ //查询缓存是否包含热点数据
|
|
|
|
+ String key = String.format(RedisKey.SCENE_HOT_DATA, num);
|
|
|
|
+ Map<String, String> allTagsMap = redisClient.hmget(key);
|
|
|
|
+ boolean hashTags = false;
|
|
|
|
+ for (Map.Entry<String, String> tagMap : allTagsMap.entrySet()) {
|
|
|
|
+ if(StrUtil.isEmpty(tagMap.getValue())){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ hashTags = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //更改热点状态
|
|
|
|
+ sceneEditInfo.setTags(hashTags ? CommonStatus.YES.code() : CommonStatus.NO.code());
|
|
|
|
+ //version 是空的代表 sceneEditInfo记录集不存在
|
|
|
|
+ if(sceneEditInfo.getVersion() != null){
|
|
|
|
+ sceneEditInfo.setVersion(sceneEditInfo.getVersion() + 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//
|
|
//
|
|
// @Override
|
|
// @Override
|
|
// public ResultData saveVideoBox(FileNameAndDataParamVO param) throws Exception {
|
|
// public ResultData saveVideoBox(FileNameAndDataParamVO param) throws Exception {
|