|
@@ -34,6 +34,7 @@ import com.fdkankan.scene.mapper.ISceneProMapper;
|
|
|
import com.fdkankan.scene.service.*;
|
|
|
import com.fdkankan.scene.vo.*;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import java.util.Map.Entry;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import net.coobird.thumbnailator.Thumbnails;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -2205,15 +2206,39 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
//处理新增和修改数据
|
|
|
this.addOrUpdateHotData(param.getNum(), addOrUpdateMap);
|
|
|
|
|
|
+ //保存数据库
|
|
|
+ this.saveTagsToSceneEditInfo(param.getNum(), scenePro.getId());
|
|
|
|
|
|
- //更改场景编辑版本
|
|
|
- sceneEditInfoService.update(
|
|
|
+ return ResultData.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void saveTagsToSceneEditInfo(String num, Long sceneProId){
|
|
|
+ //查询缓存是否包含热点数据
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<SceneEditInfo> updateWrapper =
|
|
|
new LambdaUpdateWrapper<SceneEditInfo>()
|
|
|
- .setSql("version=version+"+1)
|
|
|
- .eq(SceneEditInfo::getSceneProId, scenePro.getId()));
|
|
|
+ .setSql("version=version+" + 1)
|
|
|
+ .eq(SceneEditInfo::getSceneProId, sceneProId);
|
|
|
|
|
|
+ //如果有热点数据,更新数据库tags标识为1,否则为0
|
|
|
+ if(hashTags){
|
|
|
+ updateWrapper.set(SceneEditInfo::getTags, CommonStatus.YES.code());
|
|
|
+ }else{
|
|
|
+ updateWrapper.set(SceneEditInfo::getTags, CommonStatus.NO.code());
|
|
|
+ }
|
|
|
|
|
|
- return ResultData.ok();
|
|
|
+ //更改场景编辑版本
|
|
|
+ sceneEditInfoService.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
private void addOrUpdateHotData(String num, Map<String, String> addOrUpdateMap){
|