Commit 69568aff by shenjunjie

Merge branch 'feature' into 'dev'

2023/1/11 17:46

See merge request !159
parents 531a1f1a 7d1defa4
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<fastjson.version>1.2.47</fastjson.version> <fastjson.version>1.2.47</fastjson.version>
<easyexcel.version>3.0.5</easyexcel.version> <easyexcel.version>3.0.5</easyexcel.version>
<marker.client.version>1.1.9-SNAPSHOT</marker.client.version> <marker.client.version>1.1.9-SNAPSHOT</marker.client.version>
<base-objects.version>2.0.0-SNAPSHOT</base-objects.version> <base-objects.version>2.1.4-SNAPSHOT</base-objects.version>
<es.version>7.9.2</es.version> <es.version>7.9.2</es.version>
<dozer.version>5.5.1</dozer.version> <dozer.version>5.5.1</dozer.version>
<dubbo.version>2.7.4.1</dubbo.version> <dubbo.version>2.7.4.1</dubbo.version>
......
...@@ -105,6 +105,12 @@ public class MarkSearchDTO { ...@@ -105,6 +105,12 @@ public class MarkSearchDTO {
@ApiModelProperty(value = "渠道关键词") @ApiModelProperty(value = "渠道关键词")
private String sourceKeyword; private String sourceKeyword;
/**
* 域名关键词
*/
@ApiModelProperty(value = "域名关键词")
private String hostKeyword;
// sort // sort
/** /**
* 排序字段 * 排序字段
......
package com.zhiwei.brandkbs2.pojo.dto; package com.zhiwei.brandkbs2.pojo.dto;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -83,6 +84,12 @@ public class SearchFilterDTO { ...@@ -83,6 +84,12 @@ public class SearchFilterDTO {
private String source; private String source;
/** /**
* 域名
*/
@ApiModelProperty(value = "域名")
private String host;
/**
* 过滤关键字 * 过滤关键字
*/ */
@ApiModelProperty(value = "过滤关键字") @ApiModelProperty(value = "过滤关键字")
...@@ -127,6 +134,7 @@ public class SearchFilterDTO { ...@@ -127,6 +134,7 @@ public class SearchFilterDTO {
map.put("startTime", startTime); map.put("startTime", startTime);
map.put("endTime", endTime); map.put("endTime", endTime);
map.put("source", source); map.put("source", source);
map.put("url",host);
map.put("sort", Objects.nonNull(sorter) ? sorter : "DESC"); map.put("sort", Objects.nonNull(sorter) ? sorter : "DESC");
map.put("page", page); map.put("page", page);
map.put("pageSize", pageSize); map.put("pageSize", pageSize);
...@@ -134,6 +142,7 @@ public class SearchFilterDTO { ...@@ -134,6 +142,7 @@ public class SearchFilterDTO {
map.put("sensitiveChannels", sensitiveChannels); map.put("sensitiveChannels", sensitiveChannels);
map.put("fans", fans); map.put("fans", fans);
map.put("filterType", filterType); map.put("filterType", filterType);
System.out.println("map:"+ JSON.toJSONString(map));
return map; return map;
} }
......
...@@ -8,6 +8,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -8,6 +8,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Map; import java.util.Map;
@Data @Data
...@@ -80,14 +82,21 @@ public class ChannelVO { ...@@ -80,14 +82,21 @@ public class ChannelVO {
channelVO.setRealSource(json.getString("real_source")); channelVO.setRealSource(json.getString("real_source"));
channelVO.setEmotion(ChannelEmotion.getNameFromState(json.getInteger("emotion"))); channelVO.setEmotion(ChannelEmotion.getNameFromState(json.getInteger("emotion")));
channelVO.setEmotionRank(ChannelEmotion.getEmotionRank(json.getDouble("emotion_index"))); channelVO.setEmotionRank(ChannelEmotion.getEmotionRank(json.getDouble("emotion_index")));
channelVO.setAvatarUrl(json.getString("avatar_url"));
channelVO.setEventCount(json.getLong("event_count")); channelVO.setEventCount(json.getLong("event_count"));
channelVO.setArticleCount(json.getLong("article_count")); channelVO.setArticleCount(json.getLong("article_count"));
channelVO.setInfluence(json.getDouble("influence"));
channelVO.setMediaType(json.getString("media_type")); channelVO.setMediaType(json.getString("media_type"));
channelVO.setLastArticle(json.getJSONObject("last_article")); channelVO.setLastArticle(json.getJSONObject("last_article"));
// 修正部分avatarUrl和influence
String avatarUrl = json.getString("avatar_url");
if (null != avatarUrl && avatarUrl.contains("brandkbs/")) {
avatarUrl = avatarUrl.replace("brandkbs/", "");
channelVO.setAvatarUrl(avatarUrl);
}
Double influence = json.getDouble("influence");
if (null != influence && influence != -1) {
channelVO.setInfluence(new BigDecimal(influence).setScale(2, RoundingMode.UP).doubleValue());
}
return channelVO; return channelVO;
} }
} }
...@@ -434,7 +434,7 @@ public class ChannelServiceImpl implements ChannelService { ...@@ -434,7 +434,7 @@ public class ChannelServiceImpl implements ChannelService {
List<ChannelListVO> resList = new ArrayList<>(); List<ChannelListVO> resList = new ArrayList<>();
try { try {
String projectId = UserThreadLocal.getProjectId(); String projectId = UserThreadLocal.getProjectId();
String redisKey = RedisUtil.getChannelRecordList(projectId, startTime, endTime); String redisKey = RedisUtil.getChannelRecordList(projectId, startTime, endTime, emotion);
String resultStr; String resultStr;
// 返回缓存 // 返回缓存
if (cache && StringUtils.isNotEmpty(resultStr = redisUtil.get(redisKey))) { if (cache && StringUtils.isNotEmpty(resultStr = redisUtil.get(redisKey))) {
...@@ -513,8 +513,8 @@ public class ChannelServiceImpl implements ChannelService { ...@@ -513,8 +513,8 @@ public class ChannelServiceImpl implements ChannelService {
resList.add(ChannelListVO.createFromChannel(record, record.getRecord().getArticles().size())); resList.add(ChannelListVO.createFromChannel(record, record.getRecord().getArticles().size()));
} }
}); });
// TODO 配合天级缓存开启 // 配合天级缓存开启
// redisUtil.set(redisKey, JSON.toJSONString(resList)); redisUtil.setExpire(redisKey, JSON.toJSONString(resList));
} catch (IOException e) { } catch (IOException e) {
ExceptionCast.cast(CommonCodeEnum.FAIL, "es查询异常"); ExceptionCast.cast(CommonCodeEnum.FAIL, "es查询异常");
} }
......
...@@ -132,4 +132,32 @@ public class CommonServiceImpl implements CommonService { ...@@ -132,4 +132,32 @@ public class CommonServiceImpl implements CommonService {
return new Long[]{startTime, endTime}; return new Long[]{startTime, endTime};
} }
@Override
public Long[] getTimeRangeFormatWeek() {
long startTime;
long endTime;
Date date = Tools.truncDate(new Date(), Constant.DAY_PATTERN);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_WEEK, 1);
startTime = calendar.getTime().getTime();
calendar.set(Calendar.DAY_OF_WEEK, 7);
endTime = DateUtils.addDays(calendar.getTime(), 1).getTime();
return new Long[]{startTime, endTime};
}
@Override
public Long[] getTimeRangeFormatMonth() {
long startTime;
long endTime;
Date date = Tools.truncDate(new Date(), Constant.DAY_PATTERN);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_MONTH, 1);
startTime = calendar.getTime().getTime();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
endTime = DateUtils.addDays(calendar.getTime(), 1).getTime();
return new Long[]{startTime, endTime};
}
} }
...@@ -604,6 +604,10 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -604,6 +604,10 @@ public class MarkDataServiceImpl implements MarkDataService {
if (StringUtils.isNotEmpty(dto.getSourceKeyword())) { if (StringUtils.isNotEmpty(dto.getSourceKeyword())) {
postFilter.must(EsQueryTools.assembleSourceQuery(dto.getSourceKeyword())); postFilter.must(EsQueryTools.assembleSourceQuery(dto.getSourceKeyword()));
} }
// hostKeyword
if (StringUtils.isNotEmpty(dto.getHostKeyword())) {
postFilter.must(EsQueryTools.assembleFiledKeywordQuery("host", dto.getHostKeyword()));
}
helper.setPostFilter(postFilter); helper.setPostFilter(postFilter);
// helper.setQuery(query); // helper.setQuery(query);
// sort // sort
...@@ -1015,6 +1019,10 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1015,6 +1019,10 @@ public class MarkDataServiceImpl implements MarkDataService {
if (StringUtils.isNotEmpty(dto.getSourceKeyword())) { if (StringUtils.isNotEmpty(dto.getSourceKeyword())) {
postFilter.must(EsQueryTools.assembleSourceQuery(dto.getSourceKeyword())); postFilter.must(EsQueryTools.assembleSourceQuery(dto.getSourceKeyword()));
} }
// hostKeyword
if (StringUtils.isNotEmpty(dto.getHostKeyword())) {
postFilter.must(EsQueryTools.assembleFiledKeywordQuery("host", dto.getHostKeyword()));
}
helper.setPostFilter(postFilter); helper.setPostFilter(postFilter);
// helper.setQuery(query); // helper.setQuery(query);
// sort // sort
...@@ -1352,6 +1360,11 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1352,6 +1360,11 @@ public class MarkDataServiceImpl implements MarkDataService {
} }
result.put("url", url); result.put("url", url);
result.put("time", list.get("time")); result.put("time", list.get("time"));
result.put("avatarUrl", list.get("avatar_url"));
result.put("source", list.get("source"));
result.put("followersNum", list.get("followers_num"));
result.put("realSource", list.get("real_source"));
result.put("ipLocation", list.get("ip_location"));
resultList.add(result); resultList.add(result);
} }
jsonObject.put("list", resultList); jsonObject.put("list", resultList);
......
...@@ -30,7 +30,7 @@ public class ControlCenter { ...@@ -30,7 +30,7 @@ public class ControlCenter {
log.info("定时按天录入渠道进量-启动"); log.info("定时按天录入渠道进量-启动");
try { try {
taskService.messageFlowCount(1); taskService.messageFlowCount(1);
// taskService.channelRecordListCache(); taskService.channelRecordListCache();
} catch (Exception e) { } catch (Exception e) {
log.error("定时按天录入渠道进量-出错", e); log.error("定时按天录入渠道进量-出错", e);
} finally { } finally {
......
...@@ -52,9 +52,9 @@ public class RedisUtil { ...@@ -52,9 +52,9 @@ public class RedisUtil {
public static String getIndexSpread(String projectId, Long startTime, Long endTime) { public static String getIndexSpread(String projectId, Long startTime, Long endTime) {
return RedisKeyPrefix.INDEX_SPREAD + Tools.concat(projectId, startTime, endTime); return RedisKeyPrefix.INDEX_SPREAD + Tools.concat(projectId, startTime, endTime);
} }
public static String getChannelRecordList(String projectId, Long startTime, Long endTime) { public static String getChannelRecordList(String projectId, Long startTime, Long endTime, int emotion) {
return RedisKeyPrefix.CHANNEL_RECORD_LIST + Tools.concat(projectId, startTime, endTime); return RedisKeyPrefix.CHANNEL_RECORD_LIST + Tools.concat(projectId, startTime, endTime, emotion);
} }
public static String getNewCrisisCaseListAllKey() { public static String getNewCrisisCaseListAllKey() {
......
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