Commit 614b7720 by shentao

Merge branch 'feature' into 'release'

2023/6/21 热搜模板调整上线

See merge request !345
parents d0275428 87f255d7
......@@ -25,7 +25,7 @@
<java.version>1.8</java.version>
<springboot.version>2.2.5.RELEASE</springboot.version>
<qbjc.bean.version>1.1.7.1-SNAPSHOT</qbjc.bean.version>
<springfox.version>2.7.0</springfox.version>
<springfox.version>2.9.2</springfox.version>
<fastjson.version>1.2.47</fastjson.version>
<easyexcel.version>3.0.5</easyexcel.version>
<marker.client.version>1.1.9-SNAPSHOT</marker.client.version>
......
......@@ -63,6 +63,7 @@ public class RedisKeyPrefix {
public static final String HOT_RANK_LIST = "BRANDKBS:HOT:RANK_LIST:";
public static final String HOT_LIST = "BRANDKBS:HOT:LIST:";
public static final String HOT_KEYWORD = "BRANDKBS:HOT:KEYWORD:";
public static final String HOT_SUPPLEMENT_WORD = "BRANDKBS:HOT:SUPPLEMENT_WORD:";
/**
* 项目简报报相关缓存KEY
......@@ -125,6 +126,10 @@ public class RedisKeyPrefix {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.HOT_KEYWORD, projectId);
}
public static String supplementWordKey(String projectId) {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.HOT_SUPPLEMENT_WORD, projectId);
}
private static String generateRedisKey(String... keys) {
Objects.requireNonNull(keys);
boolean contains = keys[0].endsWith(":");
......
......@@ -16,6 +16,7 @@ public class Constant {
public static final Long ONE_DAY = 24 * 60 * 60 * 1000L;
public static final Long ONE_WEEK = 7 * 24 * 60 * 60 * 1000L;
public static final Long ONE_MONTH = 30 * 24 * 60 * 60 * 1000L;
public static final Long ONE_YEAR = ONE_MONTH * 12;
public static final String SPEC_MINUTE_PATTERN = "yyyy.MM.dd HH:mm";
public static final String HOUR_PATTERN = "yyyy-MM-dd HH";
......
package com.zhiwei.brandkbs2.enmus;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName: HotPlatformEnum
* @Description 热搜中间件返回平台枚举
* @author: sjj
* @date: 2023-06-13 14:30
*/
@Getter
public enum HotPlatformEnum {
WEIBO("微博", "weibo", "微博热搜"),
WEIBO_TOPIC("微博", "weibo-topic", "微博话题"),
WEIBO_RISE("微博", "weibo-rise", "微博预热榜"),
ZHIHU("知乎", "zhihu", "知乎热搜"),
JINRITOUTIAO("今日头条", "toutiao", "今日头条热搜"),
DOUYIN("抖音", "douyin", "抖音热搜"),
BILIBILI("B站", "bilibili-ranking", "B站热搜"),
KUAISHOU("快手", "kuaishou", "快手热榜"),
BAIDU("百度", "baidu", "百度热搜");
private final String platform;
private final String engName;
private final String name;
private static final Map<String, String> CONVERT_MAP = new HashMap<>();
static {
for (HotPlatformEnum platform : HotPlatformEnum.values()) {
CONVERT_MAP.put(platform.name, platform.platform);
}
}
HotPlatformEnum(String platform, String engName, String name) {
this.platform = platform;
this.engName = engName;
this.name = name;
}
public static String convertPlatform(String name) {
return CONVERT_MAP.get(name);
}
public static String convertFromName2Eng(String name) {
for (HotPlatformEnum platform : HotPlatformEnum.values()) {
if (name.equals(platform.name)) {
return platform.engName;
}
}
return name;
}
}
package com.zhiwei.brandkbs2.pojo.vo;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName: SupplementWord
* @Description SupplementWord
* @author: sjj
* @date: 2023-06-12 17:42
*/
@Data
@NoArgsConstructor
public class SupplementWord {
/**
* 补录标题
*/
private String title;
/**
* 更新时间
*/
private Long updateTime;
/**
* 提交人
*/
private String submitter;
public SupplementWord(String title, String submitter) {
this.title = title;
this.submitter = submitter;
this.updateTime = System.currentTimeMillis();
}
public String uniqueKey() {
return title + updateTime;
}
}
......@@ -59,6 +59,8 @@ public interface CommonService {
*/
void addMtagBatch(List<MarkInfo> markInfos);
Long[] getTimeRangeYear();
Long[] getTimeRangeMonth();
Long[] getTimeRangeWeek();
......
......@@ -132,6 +132,13 @@ public class CommonServiceImpl implements CommonService {
}
@Override
public Long[] getTimeRangeYear() {
long endTime = Tools.truncDate(new Date(), Constant.DAY_PATTERN).getTime();
long startTime = DateUtils.addYears(new Date(endTime), -1).getTime();
return new Long[]{startTime, endTime};
}
@Override
public Long[] getTimeRangeMonth() {
long endTime = Tools.truncDate(new Date(), Constant.DAY_PATTERN).getTime();
long startTime = DateUtils.addMonths(new Date(endTime), -1).getTime();
......
......@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.util;
import com.zhiwei.brandkbs2.common.RedisKeyPrefix;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
......@@ -92,15 +93,35 @@ public class RedisUtil {
return stringRedisTemplate.keys(key);
}
public void setListLeft(String key, String value) {
if (null == key) {
return;
public List<Object> getMapValueAll(String key) {
return stringRedisTemplate.opsForHash().values(key);
}
public boolean setMapValue(String key, String field, String value) {
HashOperations<String, Object, Object> operations = stringRedisTemplate.opsForHash();
Boolean result = operations.putIfAbsent(key, field, value);
return Boolean.TRUE.equals(result);
}
public boolean resetMapValue(String key, String field, String newField, String value) {
HashOperations<String, Object, Object> operations = stringRedisTemplate.opsForHash();
if (operations.hasKey(key, field)) {
operations.put(key, newField, value);
deleteMapValue(key, field);
return true;
}
return false;
}
public void deleteMapValue(String key, String field) {
HashOperations<String, Object, Object> operations = stringRedisTemplate.opsForHash();
if (operations.hasKey(key, field)) {
operations.delete(key, field);
}
stringRedisTemplate.opsForList().leftPush(key, value);
}
public List<String> getListAll(String key) {
return stringRedisTemplate.opsForList().range(key, 0, -1);
public long getMapSize(String key){
return stringRedisTemplate.opsForHash().size(key);
}
public void remove(String key) {
......
......@@ -84,7 +84,9 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url=https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5\}&accurateWord={6}
trends.queryHotSearchTrendInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
ef.search.url=https://ef.zhiweidata.com/external/search.do?name={1}&page={2}
ef.searchCriteria.url=https://ef.zhiweidata.com/index/getSearchKey.do
......
......@@ -87,7 +87,10 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url=https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=http://192.168.0.192:9091/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}
trends.queryHotSearchTrendInner.url=http://192.168.27.203:9094/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
ef.search.url=https://ef.zhiweidata.com/external/search.do?name={1}&page={2}&size={3}
ef.searchCriteria.url=https://ef.zhiweidata.com/index/getSearchKey.do
......
......@@ -84,7 +84,9 @@ crisis.event.url =https://crisis.zhiweidata.com/event/{1}/general?share={2}
trends.longTimeInListSearchByInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/longTimeInListSearchByInner?sortType={1}&type={2}&day={3}
trends.findHotSearchESDataInTimeByInner.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findHotSearchESDataInTimeByInner?limit={1}&page={2}&type={3}&word={4}
trends.longTimeInListSearch.url=https://trends.zhiweidata.com/hotSearchTrend/search/longTimeInListSearch?type={1}&sortType=realTime
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}
trends.getHotSearchFromEsInTimeAndTypeOrWord.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchFromEsInTimeAndTypeOrWord?limit={1}&page={2}&type={3}&word={4}&sort={5}&accurateWord={6}
trends.queryHotSearchTrendInner.url=https://trends.zhiweidata.com/hotSearchTrend/inner/queryHotSearchTrendInner?name={1}&startTime={2}&type={3}
trends.getHotSearchSnapshot.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/getHotSearchSnapshot?type={1}&time={2}&rank={3}
#\u4E8B\u4EF6\u5E93\u5916\u90E8\u63A5\u53E3
ef.search.url=https://ef.zhiweidata.com/external/search.do?name={1}&page={2}
ef.searchCriteria.url=https://ef.zhiweidata.com/index/getSearchKey.do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment