Commit ef37d1a7 by 陈健智

非人工项目-舆情库舆情数据聚合修复

parent fb2a085f
......@@ -41,7 +41,7 @@ import java.util.Set;
* @date: 2022-05-16 14:30
*/
@RestController
@RequestMapping("/admin/event")
//@RequestMapping("/admin/event")
@Api(tags = "事件管理", description = "提供事件的增、删、改、查等功能")
@Auth(role = RoleEnum.COMMON_ADMIN)
@Deprecated
......
......@@ -71,34 +71,39 @@ public class AppEventController extends BaseController {
}
@ApiOperation("前台事件库-搜索条件")
@GetMapping("/search/criteria")
// @GetMapping("/search/criteria")
@Deprecated
public ResponseResult getEventsSearchCriteria() {
return ResponseResult.success(eventService.getEventsSearchCriteria());
}
@ApiOperation("前台事件库-品牌事件库")
@PostMapping("/list")
// @PostMapping("/list")
@Deprecated
public ResponseResult getEventList(@RequestBody EventSearchDTO eventSearchDTO) {
return ResponseResult.success(eventService.getEventList(eventSearchDTO));
}
@ApiOperation("前台事件库-事件详情-基础信息")
@GetMapping("/info/base/{id}")
// @GetMapping("/info/base/{id}")
@Auth(role = RoleEnum.NO_AUTHORISE)
@Deprecated
public ResponseResult getEventBaseInfo(@PathVariable String id) {
return ResponseResult.success(eventService.getEventBaseInfo(id));
}
@ApiOperation("前台事件库-事件详情-传播趋势图")
@GetMapping("/info/dissemination-trends/{id}")
// @GetMapping("/info/dissemination-trends/{id}")
@Auth(role = RoleEnum.NO_AUTHORISE)
@Deprecated
public ResponseResult getEventDisseminationTrends(@PathVariable String id, @RequestParam(value = "type", defaultValue = "小时") String type) {
return ResponseResult.success(eventService.getEventDisseminationTrends(id, type));
}
@ApiOperation("前台事件库-事件详情-渠道发声")
@GetMapping("/info/channel-voices/{id}")
// @GetMapping("/info/channel-voices/{id}")
@Auth(role = RoleEnum.NO_AUTHORISE)
@Deprecated
public ResponseResult getEventChannelVoices(@PathVariable String id,
@RequestParam(value = "type", defaultValue = "重要渠道") String type,
@RequestParam(value = "page", defaultValue = "1") int page,
......@@ -108,8 +113,9 @@ public class AppEventController extends BaseController {
}
@ApiOperation("前台事件库-事件详情-热门文章分析")
@GetMapping("/info/top-articles-analysis/{id}")
// @GetMapping("/info/top-articles-analysis/{id}")
@Auth(role = RoleEnum.NO_AUTHORISE)
@Deprecated
public ResponseResult getEventTopArticlesAnalysis(@PathVariable String id,
@RequestParam(value = "type", defaultValue = "按时间") String type,
@RequestParam(value = "emotion", defaultValue = "全部") String emotion,
......
......@@ -19,6 +19,7 @@ import java.util.Objects;
@Getter
@Setter
@Document(collection = "brandkbs_event")
@Deprecated
public class Event extends AbstractBaseMongo {
/**
......
......@@ -23,6 +23,7 @@ import java.util.Optional;
*/
@Getter
@Setter
@Deprecated
public class EventData extends AbstractBaseMongo {
/**
......
......@@ -19,6 +19,7 @@ import java.util.Map;
@Getter
@Setter
@Document(collection = "brandkbs_event_dissemination_trend")
@Deprecated
public class EventDisseminationTrend extends AbstractBaseMongo {
/**
* 负面稿件传播
......
......@@ -12,6 +12,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
@Getter
@Setter
@Document(collection = "brandkbs_event_top_articles_analysis")
@Deprecated
public class EventTopArticlesAnalysis extends AbstractBaseMongo {
/**
......
......@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.pojo;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.pojo.dto.NonManualProjectPlanDTO;
import com.zhiwei.brandkbs2.util.Tools;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......@@ -63,8 +64,8 @@ public class NonManualProjectPlan extends AbstractBaseMongo{
this.id = dto.getId();
this.projectId = UserThreadLocal.getProjectId();
this.name = dto.getName();
this.keyword = dto.getKeyword();
this.filterWord = dto.getFilterWord();
this.keyword = Tools.canonicalKeyword(dto.getKeyword());
this.filterWord = Tools.canonicalKeyword(dto.getFilterWord());
this.lasting = dto.getLasting();
this.endTime = dto.getEndTime();
this.type = dto.getType();
......
......@@ -2076,6 +2076,7 @@ public class MarkDataServiceImpl implements MarkDataService {
@Override
public PageVO<MarkFlowEntity> getNonManualMarkAggreeList(MarkSearchDTO dto) {
try {
dto.setGid(-1L);
PageVO<MarkFlowEntity> aggreeList = getAggreeList(dto, markFlowService::createNonManualMarkFlowInfo, false);
JSONObject jsonObject = new JSONObject();
// 统计平台进量(声量)
......@@ -2608,7 +2609,7 @@ public class MarkDataServiceImpl implements MarkDataService {
List<MarkFlowEntity> markFlowEntities = new ArrayList<>();
MarkFlowEntity instance = new MarkFlowEntity(aggreeResult.getData(), dto.getLinkedGroupId());
instance.setInfo(createMarkFlowInfo.create(new MarkFlowService.MarkInfoSource(aggreeResult.getData(), dto.getProjectId(), dto.getContendId(),
dto.getPlanId(), dto.getLinkedGroupId(), dto.getGid())));
dto.getLinkedGroupId(), dto.getPlanId(), dto.getGid())));
markFlowEntities.add(instance);
// 添加父标题集下的子标题集
resList.add(MarkFlowEntity.getAggreeInstance(markFlowEntities, aggreeResult, sonDetails));
......
......@@ -1245,4 +1245,96 @@ public class Tools {
return null;
}
}
/**
* 是否为null
*
* @param @param obj
* @param @return 设定文件
* @return boolean 返回类型
* @Title: isNull
* @Description: 是否为null
*/
public static boolean isNull(Object obj) {
return !nonNull(obj);
}
/**
* 关键词规范 空格且丨或
*
* @param str
* @return String
*/
public static String canonicalKeyword(String str) {
if (isNull(str)) {
return null;
}
// 回车、换行处理
str = str.replaceAll("(\r\n|\r|\n|\n\r)", "|");
// 空格处理
str = checkAndUniteStringBlankOnce(str);
// 前后空格去除
str = str.trim();
// 多余|去除
str = checkAndUniteStringVerticalOnce(str);
// 前后|去除
str = trimSpecial(str, '|');
return str;
}
/**
* 特殊trim
*
* @param str
* @param c
* @return String
*/
public static String trimSpecial(String str, char c) {
char[] chars = str.toCharArray();
int len = chars.length;
int st = 0;
while ((st < len) && (chars[st] == c)) {
st++;
}
while ((st < len) && (chars[len - 1] == c)) {
len--;
}
return (st > 0) && (len < chars.length) ? str.substring(st, len) : str;
}
/**
* 空格处理(多空格-》1,特殊空格去除)
*
* @param str
* @return
*/
public static String checkAndUniteStringBlankOnce(String str) {
//全角空格替换
if (str.split("[\\u3000]+").length > 1) {
str = str.replaceAll("[\\u3000]+", " ");
}
//不间断空格替换
if (str.split("[\\u00A0]+").length > 1) {
str = str.replaceAll("[\\u00A0]+", " ");
}
// XSL中的空格
if (str.split("(\\u0026\\u0023\\u0031\\u0036\\u0030\\u003b)+").length > 1) {
str = str.replaceAll("(\\u0026\\u0023\\u0031\\u0036\\u0030\\u003b)+", " ");
}
return Arrays.stream(str.split("[\\u0020]+")).filter(StringUtils::isNotBlank).collect(Collectors.joining(" "));
}
/**
* 丨处理
*
* @param str
* @return
*/
public static String checkAndUniteStringVerticalOnce(String str) {
//丨替换
if (str.split("[\\u4e28]+").length > 1) {
str = str.replaceAll("[\\u4e28]+", "|");
}
return Arrays.stream(str.split("[\\u007c]+")).filter(StringUtils::isNotBlank).collect(Collectors.joining("|"));
}
}
\ 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