Commit 8c51a0f7 by shenjunjie

Merge branch 'feature' into 'dev'

Feature

See merge request !78
parents 8408fc8b 138f137e
package com.zhiwei.brandkbs2.common;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.util.Tools;
import java.util.Objects;
......@@ -82,6 +83,19 @@ public class RedisKeyPrefix {
*/
private static final String EVENT_ANALYZE_PROGRESS = "BRANDKBS:EVENT:ANALYZE:PROGRESS:";
/**
* 项目预警相关缓存
*/
public static final String PROJECT_WARN_HOT_TOP = "BRANDKBS:HOT_TOP:";
public static String projectWarnHotTopKeyAll(String projectId, String type) {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.PROJECT_WARN_HOT_TOP, projectId, Tools.concat(type, "*"));
}
public static String projectWarnHotTopKey(String projectId, String type, String name) {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.PROJECT_WARN_HOT_TOP, projectId, Tools.concat(type, name));
}
public static String eventAnalysisProgress(String eventId, String projectId) {
return RedisKeyPrefix.generateRedisKey(RedisKeyPrefix.EVENT_ANALYZE_PROGRESS, projectId, eventId);
}
......
......@@ -42,7 +42,7 @@ import java.util.Map;
public class AppWarnController extends BaseController {
private static final Logger log = LogManager.getLogger(AppWarnController.class);
private static final String taskType = "brandkbs";
private static final String TASK_TYPE = "brandkbs";
@Value("${jwt.key}")
private String jwtKey;
......@@ -127,7 +127,7 @@ public class AppWarnController extends BaseController {
headers.add("token", token);
HttpEntity<Object> request = new HttpEntity<>(headers);
JSONObject data = restTemplate.exchange(warnTicketUrl, HttpMethod.GET, request, JSONObject.class, pushTaskId, taskType).getBody().getJSONObject("data");
JSONObject data = restTemplate.exchange(warnTicketUrl, HttpMethod.GET, request, JSONObject.class, pushTaskId, TASK_TYPE).getBody().getJSONObject("data");
return ResponseResult.success(data);
}
......@@ -139,7 +139,7 @@ public class AppWarnController extends BaseController {
headers.add("token", token);
HttpEntity<Object> request = new HttpEntity<>(headers);
JSONArray data = restTemplate.exchange(warnPushRecipientsUrl, HttpMethod.GET, request, JSONObject.class, pushTaskId, taskType).getBody().getJSONArray("data");
JSONArray data = restTemplate.exchange(warnPushRecipientsUrl, HttpMethod.GET, request, JSONObject.class, pushTaskId, TASK_TYPE).getBody().getJSONArray("data");
return ResponseResult.success(data);
}
......@@ -152,7 +152,7 @@ public class AppWarnController extends BaseController {
headers.add("token", token);
HttpEntity<Object> request = new HttpEntity<>(headers);
JSONObject data = restTemplate.exchange(deletePushRecipientsUrl, HttpMethod.GET, request, JSONObject.class, pushTaskId, recipientsId, taskType).getBody().getJSONObject("data");
JSONObject data = restTemplate.exchange(deletePushRecipientsUrl, HttpMethod.GET, request, JSONObject.class, pushTaskId, recipientsId, TASK_TYPE).getBody().getJSONObject("data");
return ResponseResult.success(data);
}
......
......@@ -107,8 +107,11 @@ public class Event extends AbstractBaseMongo {
Event event = new Event();
event.setTitle(yqEventDTO.getName());
event.setStartTime(yqEventDTO.getStartTime());
event.setEndTime(yqEventDTO.getEndTime());
event.setEndStatus(Objects.nonNull(yqEventDTO.getEndTime()));
boolean endStatus = "结束".equals(yqEventDTO.getSpreadStatus());
event.setEndStatus(endStatus);
if (endStatus) {
event.setEndTime(yqEventDTO.getEndTime());
}
event.setKeyword(yqEventDTO.getKeyword());
event.setEmotion(yqEventDTO.getTagInfo().getString(EventTagEnum.EVENT_ATTRIBUTE.getName()));
event.setEventTag(yqEventDTO.getTagInfo());
......
package com.zhiwei.brandkbs2.pojo.external;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
/**
......@@ -51,6 +54,17 @@ public class BrandkbsHotTopWarn {
* 上榜时间
*/
private Long time;
public static HotTop createFromJSON(JSONObject json, String topReason, String topName) {
HotTop hotTop = new HotTop();
hotTop.setTitle(json.getString("name"));
hotTop.setTopReason(topReason);
hotTop.setRank(json.getString("lastRank") + "名");
hotTop.setHot(BigDecimal.valueOf(json.getLongValue("lastCount") / 10000.00).setScale(2, RoundingMode.UP) + "w");
hotTop.setTopName(topName);
hotTop.setTime(json.getLong("endTime"));
return hotTop;
}
}
}
......@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
......@@ -74,6 +75,10 @@ public class RedisUtil {
return stringRedisTemplate.opsForValue().get(key);
}
public Set<String> keys(String key) {
return stringRedisTemplate.keys(key);
}
public void remove(String key) {
setExpire(key, "-1", 1, TimeUnit.SECONDS);
}
......
......@@ -884,6 +884,34 @@ public class Tools {
return false;
}
public static boolean isExclusive(String keyword, String content) {
return isExclusive(Arrays.asList(keyword.split("\\|")), content);
}
/**
* 是否排除关键字 只有或逻辑
*
* @param filterKeywords 排除关键词
* @param data 字符串标题+内容
* @return 是否包含关键字
*/
public static boolean isExclusive(List<String> filterKeywords, String data) {
boolean exclusive = true;
for (String key : filterKeywords) {
if(StringUtils.isBlank(key)){
continue;
}
if (data.contains(key.toLowerCase())) {
exclusive=false;
}
if (!exclusive) {
//已经满足条件,视为有效数据,结束循环
break;
}
}
return exclusive;
}
public static JSONObject getBrandkbsHitMap(Map<String, Object> esMap, String hitKey) {
List<Map<String, Object>> cacheMaps = (List<Map<String, Object>>) esMap.get(GenericAttribute.ES_BRANDKBS_CACHE_MAPS);
for (Map<String, Object> cacheMap : cacheMaps) {
......
......@@ -82,14 +82,14 @@ whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface
whole.extraParam.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token=AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/project?projectId={1}&projectName={2}
warn.ticket.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
warn.channel.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/channel/{1}
warn.hotEvent.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/hotEvent/{1}
warn.hotTop.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/hotTop/{1}
warn.yuQing.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/yuQing/{1}
warn.taskSwitch.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/enable/used
warn.project.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project?projectId={1}&projectName={2}
warn.ticket.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
warn.channel.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/channel/{1}
warn.hotEvent.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/hotEvent/{1}
warn.hotTop.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/hotTop/{1}
warn.yuQing.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/yuQing/{1}
warn.taskSwitch.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/enable/used
#\u9884\u8B66\u5916\u90E8\u63A5\u53E3
ef.external.filterNew.url=https://ef.zhiweidata.com/external/filterNew.do?firstTypes={1}&start={2}&end={3}
\ No newline at end of file
......@@ -84,14 +84,14 @@ whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface
whole.extraParam.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token=AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url=http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/project?projectId={1}&projectName={2}
warn.ticket.url=http://192.168.0.225:11003/qbjc/pushTask/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url=http://192.168.0.225:11003/qbjc/pushTask/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url=http://192.168.0.225:11003/qbjc/pushTask/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
warn.channel.url=http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/channel/{1}
warn.hotEvent.url=http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/hotEvent/{1}
warn.hotTop.url=http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/hotTop/{1}
warn.yuQing.url=http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/config/yuQing/{1}
warn.taskSwitch.url=http://192.168.0.225:11003/qbjc/pushTask/interface/brandkbs/enable/used
warn.project.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/project?projectId={1}&projectName={2}
warn.ticket.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
warn.channel.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/config/channel/{1}
warn.hotEvent.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/config/hotEvent/{1}
warn.hotTop.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/config/hotTop/{1}
warn.yuQing.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/config/yuQing/{1}
warn.taskSwitch.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/enable/used
#\u9884\u8B66\u5916\u90E8\u63A5\u53E3
ef.external.filterNew.url=https://ef.zhiweidata.com/external/filterNew.do?firstTypes={1}&start={2}&end={3}
\ No newline at end of file
......@@ -82,14 +82,14 @@ whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface
whole.extraParam.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token=AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/project?projectId={1}&projectName={2}
warn.ticket.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
warn.channel.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/channel/{1}
warn.hotEvent.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/hotEvent/{1}
warn.hotTop.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/hotTop/{1}
warn.yuQing.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/config/yuQing/{1}
warn.taskSwitch.url=https://auto-push.zhiweidata.com/qbjc/pushTask/interface/brandkbs/enable/used
warn.project.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project?projectId={1}&projectName={2}
warn.ticket.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/code?pushId={1}&taskType={2}
warn.pushRecipientsList.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/{1}?taskType={2}
warn.deletePushRecipients.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/pushRecipients/?pushId={1}&recipientsId={2}&taskType={3}
warn.channel.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/channel/{1}
warn.hotEvent.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/hotEvent/{1}
warn.hotTop.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/hotTop/{1}
warn.yuQing.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/config/yuQing/{1}
warn.taskSwitch.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/enable/used
#\u9884\u8B66\u5916\u90E8\u63A5\u53E3
ef.external.filterNew.url=https://ef.zhiweidata.com/external/filterNew.do?firstTypes={1}&start={2}&end={3}
\ No newline at end of file
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