Commit 8bfd01d1 by shenjunjie

Merge branch 'release' into 'master'

Release

See merge request !227
parents 45ce3c83 e0de219d
...@@ -4,6 +4,7 @@ package com.zhiwei.brandkbs2.controller.app; ...@@ -4,6 +4,7 @@ package com.zhiwei.brandkbs2.controller.app;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.auth.Auth; import com.zhiwei.brandkbs2.auth.Auth;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.config.Constant; import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.controller.BaseController; import com.zhiwei.brandkbs2.controller.BaseController;
import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil; import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
...@@ -71,6 +72,9 @@ public class AppSearchController extends BaseController { ...@@ -71,6 +72,9 @@ public class AppSearchController extends BaseController {
@Resource(name = "commonServiceImpl") @Resource(name = "commonServiceImpl")
CommonService commonService; CommonService commonService;
@Resource(name = "projectServiceImpl")
ProjectService projectService;
@ApiOperation("搜索-查热点") @ApiOperation("搜索-查热点")
@GetMapping("/hot/list") @GetMapping("/hot/list")
public ResponseResult searchHotList(@RequestParam(value = "pageSize", defaultValue = "10") Integer limit, public ResponseResult searchHotList(@RequestParam(value = "pageSize", defaultValue = "10") Integer limit,
...@@ -129,6 +133,8 @@ public class AppSearchController extends BaseController { ...@@ -129,6 +133,8 @@ public class AppSearchController extends BaseController {
@ApiOperation("搜索-全网搜") @ApiOperation("搜索-全网搜")
@PostMapping("/searchWhole") @PostMapping("/searchWhole")
public ResponseResult searchWholeNetwork(@RequestBody SearchFilterDTO dto) { public ResponseResult searchWholeNetwork(@RequestBody SearchFilterDTO dto) {
// 针对商业数据库做限制
if (2 == projectService.getProjectById(UserThreadLocal.getProjectId()).getWholeSearchDataSource()) {
long time = DateUtils.addDays(Tools.truncDate(new Date(), Constant.DAY_PATTERN), -89).getTime(); long time = DateUtils.addDays(Tools.truncDate(new Date(), Constant.DAY_PATTERN), -89).getTime();
if (time > dto.getStartTime()) { if (time > dto.getStartTime()) {
// 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制 // 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制
...@@ -139,6 +145,7 @@ public class AppSearchController extends BaseController { ...@@ -139,6 +145,7 @@ public class AppSearchController extends BaseController {
// 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制 // 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制
return ResponseResult.failure("时间跨度不能超过30天"); return ResponseResult.failure("时间跨度不能超过30天");
} }
}
return ResponseResult.success(markDataService.searchWholeNetwork(dto)); return ResponseResult.success(markDataService.searchWholeNetwork(dto));
} }
......
...@@ -85,11 +85,13 @@ public class ResponseResult { ...@@ -85,11 +85,13 @@ public class ResponseResult {
/** /**
* 操作失败带返回数据 * 操作失败带返回数据
* *
* @param data 返回数据 * @param message 失败信息
* @return 操作失败带返回数据 * @return 操作失败带返回数据
*/ */
public static ResponseResult failure(Object data) { public static ResponseResult failure(String message) {
return new ResponseResult(CommonCodeEnum.FAIL, data); ResponseResult responseResult = new ResponseResult(CommonCodeEnum.FAIL, null);
responseResult.setMessage(message);
return responseResult;
} }
/** /**
......
...@@ -1160,10 +1160,10 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1160,10 +1160,10 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("priGtAvg", priGreaterThanAvg); result.put("priGtAvg", priGreaterThanAvg);
// 获取主品牌传播峰值时信息 // 获取主品牌传播峰值时信息
LineVO primaryMax = primarySpread.stream().max(Comparator.comparing(LineVO::getCount)).orElse(new LineVO()); LineVO primaryMax = primarySpread.stream().max(Comparator.comparing(LineVO::getCount)).orElse(new LineVO());
result.put("priMaxTime", sdf.format(primaryMax.getDate())); result.put("priMaxTime", primaryMax.getDate());
result.put("priMaxCount", primaryMax.getCount()); result.put("priMaxCount", primaryMax.getCount());
long priMaxDayStartTime = primaryMax.getDate(); long priMaxDayStartTime = Tools.truncDate(primaryMax.getDate(), Constant.DAY_PATTERN);
long priMaxDayEndTime = DateUtils.addDays(new Date(primaryMax.getDate()), 1).getTime(); long priMaxDayEndTime = DateUtils.addDays(new Date(priMaxDayStartTime), 1).getTime();
// 获取时间段某情感数据最多的标题 // 获取时间段某情感数据最多的标题
List<Map.Entry<String, Integer>> priTopTitle = getMarkTopTitle(priMaxDayStartTime, priMaxDayEndTime, EmotionEnum.ALL.getName(), projectId, List<Map.Entry<String, Integer>> priTopTitle = getMarkTopTitle(priMaxDayStartTime, priMaxDayEndTime, EmotionEnum.ALL.getName(), projectId,
project.getBrandLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, 1); project.getBrandLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, 1);
...@@ -1175,7 +1175,8 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1175,7 +1175,8 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("priTopTitleUrl", priFirstArticle.getUrl()); result.put("priTopTitleUrl", priFirstArticle.getUrl());
} }
// 获取主品牌热门媒体方向 // 获取主品牌热门媒体方向
List<Map.Entry<String, Integer>> priHotTitles = getMarkTopTitle(priMaxDayStartTime, priMaxDayEndTime, EmotionEnum.ALL.getName(), projectId, project.getBrandLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, hotArticleSize); List<Map.Entry<String, Integer>> priHotTitles = getMarkTopTitle(startTime, endTime, EmotionEnum.ALL.getName(), projectId,
project.getBrandLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, hotArticleSize);
if (CollectionUtils.isNotEmpty(priHotTitles)) { if (CollectionUtils.isNotEmpty(priHotTitles)) {
List<JSONObject> priHotArticle = priHotTitles.stream().map(map -> { List<JSONObject> priHotArticle = priHotTitles.stream().map(map -> {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
...@@ -1206,10 +1207,11 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1206,10 +1207,11 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("conGtAvg", conGreaterThanAvg); result.put("conGtAvg", conGreaterThanAvg);
//获取竞品传播峰值信息 //获取竞品传播峰值信息
LineVO contendMax = contendSpread.stream().max(Comparator.comparing(LineVO::getCount)).orElse(new LineVO()); LineVO contendMax = contendSpread.stream().max(Comparator.comparing(LineVO::getCount)).orElse(new LineVO());
result.put("conMaxTime", sdf.format(contendMax.getDate())); result.put("conMaxTime", contendMax.getDate());
result.put("conMaxCount", contendMax.getCount()); result.put("conMaxCount", contendMax.getCount());
long conMaxDayStartTime = contendMax.getDate(); long conMaxDayStartTime = Tools.truncDate(contendMax.getDate(), Constant.DAY_PATTERN);
long conMaxDayEndTime = DateUtils.addDays(new Date(contendMax.getDate()), 1).getTime(); long conMaxDayEndTime = DateUtils.addDays(new Date(conMaxDayStartTime), 1).getTime();
List<Map.Entry<String, Integer>> conTopTitle = getMarkTopTitle(conMaxDayStartTime, conMaxDayEndTime, EmotionEnum.ALL.getName(),projectId, List<Map.Entry<String, Integer>> conTopTitle = getMarkTopTitle(conMaxDayStartTime, conMaxDayEndTime, EmotionEnum.ALL.getName(),projectId,
contendLinkedGroupId, contendId, 1); contendLinkedGroupId, contendId, 1);
if (CollectionUtils.isNotEmpty(conTopTitle)) { if (CollectionUtils.isNotEmpty(conTopTitle)) {
...@@ -1220,7 +1222,7 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1220,7 +1222,7 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("conTopTitleUrl", conFirstArticle.getUrl()); result.put("conTopTitleUrl", conFirstArticle.getUrl());
} }
// 获取竞品热门媒体方向 // 获取竞品热门媒体方向
List<Map.Entry<String, Integer>> conHotTitles = getMarkTopTitle(conMaxDayStartTime, conMaxDayEndTime, EmotionEnum.ALL.getName(), projectId, List<Map.Entry<String, Integer>> conHotTitles = getMarkTopTitle(startTime, endTime, EmotionEnum.ALL.getName(), projectId,
contendLinkedGroupId, contendId, hotArticleSize); contendLinkedGroupId, contendId, hotArticleSize);
if (CollectionUtils.isNotEmpty(conHotTitles)) { if (CollectionUtils.isNotEmpty(conHotTitles)) {
List<JSONObject> conHotArticle = conHotTitles.stream().map(map -> { List<JSONObject> conHotArticle = conHotTitles.stream().map(map -> {
......
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