Commit b2df46a8 by shenjunjie

Merge branch 'feature' into 'dev'

Feature

See merge request !356
parents 696ab642 2f862a94
......@@ -148,7 +148,30 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
......
......@@ -23,7 +23,11 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.List;
......@@ -53,6 +57,12 @@ public class AppArticleController extends BaseController {
@Resource(name = "projectServiceImpl")
ProjectService projectService;
@Autowired
private RestTemplate restTemplate;
@Value("${brief.report.url}")
private String briefReportUrl;
@ApiOperation("原始数据列表")
@PostMapping("/origin/list")
@LogRecord(description = "舆情库-原始数据列表")
......@@ -228,6 +238,26 @@ public class AppArticleController extends BaseController {
return ResponseResult.success(commonService.getTimeRangeMonth());
}
@ApiOperation("舆情简报-定制简报-获取")
@GetMapping("/report/brief")
public ResponseResult getBriefReport(@RequestParam(value = "startTime", required = false) Long startTime,
@RequestParam(value = "endTime", required = false) Long endTime,
@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
@RequestParam(value = "keyword", required = false) String keyword) {
String linkedGroupId = projectService.getProjectById(UserThreadLocal.getProjectId()).getBrandLinkedGroupId();
ResponseEntity<JSONObject> responseEntity = restTemplate.getForEntity(briefReportUrl + "?startTime={1}&endTime={2}&page={3}&pageSize={4}&projectId={5" +
"}&keyword={6}", JSONObject.class, startTime, endTime, page, pageSize, linkedGroupId, keyword);
return ResponseResult.success(responseEntity.getBody());
}
@ApiOperation("舆情简报-定制简报-删除")
@DeleteMapping("/report/brief/{id}")
public ResponseResult deleteBriefReport(@PathVariable String id) {
restTemplate.delete(briefReportUrl + "/" + id);
return ResponseResult.success();
}
@ApiOperation("舆情简报-分类统计")
@GetMapping("/report/aggCount")
public ResponseResult getReportsAggCount() {
......
......@@ -18,7 +18,9 @@ import com.zhiwei.brandkbs2.service.CommonService;
import com.zhiwei.brandkbs2.service.MarkDataService;
import com.zhiwei.brandkbs2.service.ProjectService;
import com.zhiwei.brandkbs2.util.RedisUtil;
import io.swagger.annotations.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
......@@ -136,19 +138,23 @@ public class AppHotController extends BaseController {
@ApiOperation("热点库-品牌热点-关键词获取")
@GetMapping("/keyword")
public ResponseResult getKeyword(@ApiParam(name = "竞品id")@RequestParam(required = false) String contendId) {
String keyId = null == contendId ? UserThreadLocal.getProjectId() : contendId;
boolean primary = null == contendId;
String keyId = primary ? UserThreadLocal.getProjectId() : contendId;
String key = RedisKeyPrefix.hotKeywordKey(keyId);
String keywordStr = redisUtil.get(key);
if (null != keywordStr) {
return ResponseResult.success(JSONArray.parseArray(keywordStr));
}
// 主品牌则默认返回并设置品牌名
if (null == contendId) {
List<String> defaultKeyword = Collections.singletonList(projectService.getProjectById(keyId).getBrandName());
redisUtil.set(key, JSON.toJSONString(defaultKeyword));
return ResponseResult.success(defaultKeyword);
// 默认返回并设置品牌名
List<String> defaultKeyword;
if(primary){
defaultKeyword = Collections.singletonList(projectService.getProjectById(UserThreadLocal.getProjectId()).getBrandName());
}else{
String brandName = projectService.getProjectById(UserThreadLocal.getProjectId()).getContendList().stream().filter(contend -> contend.getId().equals(keyId)).findFirst().get().getBrandName();
defaultKeyword = Collections.singletonList(brandName);
}
return ResponseResult.success();
redisUtil.set(key, JSON.toJSONString(defaultKeyword));
return ResponseResult.success(defaultKeyword);
}
@ApiOperation("热点库-品牌热点-关键词调整")
......@@ -286,7 +292,7 @@ public class AppHotController extends BaseController {
@ApiOperation("热点库-品牌热点-热点总览")
@GetMapping("/overview")
public ResponseResult hotOverview() {
Long[] timeMonth = commonService.getTimeRangeFormatMonth();
Long[] timeMonth = commonService.getTimeRangeMonth();
JSONObject result = searchHotHandler(10000, 1, allPlatform, "endTime", timeMonth[0], timeMonth[1]);
if (Objects.isNull(result)) {
return ResponseResult.success();
......
......@@ -159,7 +159,7 @@ public class ReportServiceImpl implements ReportService {
public JSONObject getReportsAggCount() {
JSONObject result = new JSONObject();
List<JSONObject> reportAggCount = reportDao.getReportAggCount(UserThreadLocal.getProjectId());
result.put("times", addYearTimeWithAggCount(filterAggCount(reportAggCount, "year", "count")));
// result.put("times", addYearTimeWithAggCount(filterAggCount(reportAggCount, "year", "count")));
result.put("types", filterAggCount(reportAggCount, "type", "count"));
return result;
}
......@@ -192,7 +192,7 @@ public class ReportServiceImpl implements ReportService {
});
}
JSONObject all = new JSONObject();
all.put("name", "不限");
all.put("name", "全部");
all.put("count", collect.values().stream().mapToInt(v -> v).sum());
result.add(0, all);
return result;
......
......@@ -99,6 +99,7 @@ istarshine.getIStarShineKSInfoData.url=https://istarshine-service.zhiweidata.com
whole.search.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/pt
whole.extraParam.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
brief.report.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/brief-report-web
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token=AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project
......
......@@ -103,6 +103,7 @@ istarshine.getIStarShineKSInfoData.url=https://istarshine-service.zhiweidata.com
whole.search.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/pt
whole.extraParam.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
brief.report.url=http://192.168.0.79:11000/qbjcbackPhoenix/interface/middleware/brief-report-web
#\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/brandkbsPush/interface/brandkbs/project
......
......@@ -99,6 +99,7 @@ istarshine.getIStarShineKSInfoData.url=https://istarshine-service.zhiweidata.com
whole.search.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/yuqing
whole.searchCriteria.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/pt
whole.extraParam.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/search/extra/param
brief.report.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/brief-report-web
#\u60C5\u62A5\u9884\u8B66\u5916\u90E8\u63A5\u53E3
warn.pushTask.token=AoJ0ooy3H2BpHmuaviYObTKw/Xfw/oA5aKccNYhYnoJFJQ/BgeW/
warn.project.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/project
......
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