Commit 4370639f by shenjunjie

Merge branch 'feature' into 'release'

Feature

See merge request !382
parents 68532b6e fac87a3b
package com.zhiwei.brandkbs2.controller.app; package com.zhiwei.brandkbs2.controller.app;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.aop.LogRecord; import com.zhiwei.brandkbs2.aop.LogRecord;
import com.zhiwei.brandkbs2.auth.Auth; import com.zhiwei.brandkbs2.auth.Auth;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.controller.BaseController; import com.zhiwei.brandkbs2.controller.BaseController;
import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil; import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import com.zhiwei.brandkbs2.easyexcel.dto.ExportAppChannelArticleDTO; import com.zhiwei.brandkbs2.easyexcel.dto.ExportAppChannelArticleDTO;
...@@ -9,14 +11,20 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum; ...@@ -9,14 +11,20 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.model.ResponseResult; import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.dto.ExportAppChannelEventDTO; import com.zhiwei.brandkbs2.pojo.dto.ExportAppChannelEventDTO;
import com.zhiwei.brandkbs2.service.ChannelService; import com.zhiwei.brandkbs2.service.ChannelService;
import io.swagger.annotations.Api; import com.zhiwei.brandkbs2.service.ProjectService;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.*;
import io.swagger.annotations.ApiImplicitParams; import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @ClassName: AppChannelController * @ClassName: AppChannelController
...@@ -33,6 +41,14 @@ public class AppChannelController extends BaseController { ...@@ -33,6 +41,14 @@ public class AppChannelController extends BaseController {
@Resource(name = "channelServiceImpl") @Resource(name = "channelServiceImpl")
ChannelService channelService; ChannelService channelService;
@Resource(name = "projectServiceImpl")
ProjectService projectService;
@Autowired
private RestTemplate restTemplate;
@Value("${qbjc.channel.application.url}")
private String channelApplicationUrl;
@ApiImplicitParams({@ApiImplicitParam(name = "contendId", value = "品牌id", defaultValue = "0", paramType = "query", dataType = "string"), @ApiImplicitParams({@ApiImplicitParam(name = "contendId", value = "品牌id", defaultValue = "0", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "platform", value = "平台", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "platform", value = "平台", paramType = "query", dataType = "string"),
...@@ -232,4 +248,67 @@ public class AppChannelController extends BaseController { ...@@ -232,4 +248,67 @@ public class AppChannelController extends BaseController {
return ResponseResult.success(); return ResponseResult.success();
} }
@ApiImplicitParams({@ApiImplicitParam(name = "contendId", value = "品牌id", defaultValue = "0", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "startTime", value = "起始时间", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "pageSize", value = "选取前几", defaultValue = "50", paramType = "query", dataType = "int"),
})
@ApiOperation("渠道库-活跃渠道榜")
@LogRecord(description = "渠道库-活跃渠道榜")
@GetMapping("/list/new/active")
public ResponseResult getActiveChannelList(@RequestParam(value = "contendId", defaultValue = "0") String contendId,
@RequestParam(value = "startTime", required = false) Long startTime,
@RequestParam(value = "endTime", required = false) Long endTime,
@RequestParam(value = "pageSize", defaultValue = "50") int size) {
return ResponseResult.success(channelService.getActiveChannelList(contendId, startTime, endTime, size, true));
}
@ApiImplicitParams({@ApiImplicitParam(name = "contendId", value = "品牌id", defaultValue = "0", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "startTime", value = "起始时间", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "pageSize", value = "选取前几", defaultValue = "50", paramType = "query", dataType = "int"),
})
@ApiOperation("渠道库-友好渠道榜")
@LogRecord(description = "渠道库-友好渠道榜")
@GetMapping("/list/new/positive")
public ResponseResult getPositiveChannelList(@RequestParam(value = "contendId", defaultValue = "0") String contendId,
@RequestParam(value = "startTime", required = false) Long startTime,
@RequestParam(value = "endTime", required = false) Long endTime,
@RequestParam(value = "pageSize", defaultValue = "50") int size) {
return ResponseResult.success(channelService.getPositiveChannelList(contendId, startTime, endTime, size, true));
}
@ApiImplicitParams({@ApiImplicitParam(name = "contendId", value = "品牌id", defaultValue = "0", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "startTime", value = "起始时间", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "pageSize", value = "选取前几", defaultValue = "50", paramType = "query", dataType = "int"),
})
@ApiOperation("渠道库-敏感渠道榜")
@LogRecord(description = "渠道库-敏感渠道榜")
@GetMapping("/list/new/negative")
public ResponseResult getNegativeChannelList(@RequestParam(value = "contendId", defaultValue = "0") String contendId,
@RequestParam(value = "startTime", required = false) Long startTime,
@RequestParam(value = "endTime", required = false) Long endTime,
@RequestParam(value = "pageSize", defaultValue = "50") int size) {
return ResponseResult.success(channelService.getNegativeChannelList(contendId, startTime, endTime, size, true));
}
@ApiOperation("渠道库-渠道申请")
@PostMapping("/channel-application")
public ResponseResult channelApplication(@ApiParam(name = "info", value = "渠道申请-json:{source:中华网}", required = true)
@RequestBody JSONObject info) {
JSONObject body = new JSONObject();
body.put("name", info.getString("source"));
body.put("submitter", UserThreadLocal.getNickname());
String linkedGroupId = projectService.getProjectById(UserThreadLocal.getProjectId()).getBrandLinkedGroupId();
body.put("projectId", linkedGroupId);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> request = new HttpEntity<>(body.toJSONString(), headers);
ResponseEntity<JSONObject> response = restTemplate.postForEntity(channelApplicationUrl, request, JSONObject.class);
if (200 == Objects.requireNonNull(response.getBody()).getIntValue("code")) {
return ResponseResult.success();
}
return ResponseResult.failure("渠道申请失败");
}
} }
package com.zhiwei.brandkbs2.dao; package com.zhiwei.brandkbs2.dao;
import com.zhiwei.brandkbs2.pojo.SensitiveChannel;
import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform; import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform;
import com.zhiwei.qbjc.bean.pojo.common.Tag; import com.zhiwei.qbjc.bean.pojo.common.Tag;
...@@ -35,4 +36,19 @@ public interface QbjcPojoDao { ...@@ -35,4 +36,19 @@ public interface QbjcPojoDao {
* @return tags * @return tags
*/ */
List<Tag> findEmotionTagByLinkedGroupId(); List<Tag> findEmotionTagByLinkedGroupId();
/**
* qbjc项目重要渠道
* @param linkedGroupId
* @param source
* @return
*/
SensitiveChannel findSensitiveChannelBySource(String linkedGroupId, String source);
/**
* qbjc通用重要渠道
* @param source
* @return
*/
SensitiveChannel findSensitiveChannelBySource(String source);
} }
package com.zhiwei.brandkbs2.dao.impl; package com.zhiwei.brandkbs2.dao.impl;
import com.zhiwei.brandkbs2.dao.QbjcPojoDao; import com.zhiwei.brandkbs2.dao.QbjcPojoDao;
import com.zhiwei.brandkbs2.pojo.SensitiveChannel;
import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform; import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform;
import com.zhiwei.qbjc.bean.pojo.common.Tag; import com.zhiwei.qbjc.bean.pojo.common.Tag;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -39,6 +41,19 @@ public class QbjcPojoDaoImpl implements QbjcPojoDao { ...@@ -39,6 +41,19 @@ public class QbjcPojoDaoImpl implements QbjcPojoDao {
return mongoTemplate.find(new Query(), Tag.class).stream().filter(tag -> tag.getGroupName().equals("情感倾向")).collect(Collectors.toList()); return mongoTemplate.find(new Query(), Tag.class).stream().filter(tag -> tag.getGroupName().equals("情感倾向")).collect(Collectors.toList());
} }
@Override
public SensitiveChannel findSensitiveChannelBySource(String linkedGroupId, String source) {
Query query = new Query();
query.addCriteria(Criteria.where("projectId").is(linkedGroupId));
query.addCriteria(Criteria.where("name").is(source));
return mongoTemplate.findOne(query, SensitiveChannel.class, "qbjc_sensitive_channel");
}
@Override
public SensitiveChannel findSensitiveChannelBySource(String source) {
Query query = new Query();
query.addCriteria(Criteria.where("name").is(source));
return mongoTemplate.findOne(query, SensitiveChannel.class, "qbjc_sensitive_channel_system");
}
} }
package com.zhiwei.brandkbs2.pojo;
import lombok.Data;
@Data
public class SensitiveChannel {
private String id;
/**
* 渠道名称
*/
private String name;
/**
* 主体类型 央级
*/
private String mainBodyType;
/**
* 地域
*/
private String region;
/**
* 行政级别
*/
private String politicsLevel;
/**
* 领域
*/
private String field;
/**
* 主办单位
*/
private String sponsor;
/**
* 矩阵归属
*/
private String matrixAttribution;
/**
* 背景资料
*/
private String backgroundInfo;
/**
* ccid
*/
private String ccid;
/**
* 省份
*/
private String province;
/**
* 细分领域
*/
private String subDividedField;
/**
* 展现领域
*/
private String displayField;
/**
* 项目标签
*/
private String projectTag;
/**
* 类别身份
*/
private String identity;
/**
* 更新渠道状态
*/
private Boolean updateStatus;
/**
* 项目
*/
private String project;
/**
* 项目id
*/
private String projectId;
/**
* createAt 创建时间
*/
private Long createAt;
/**
* creator 创建者
*/
private String creator;
/**
* creatorId 创建者id
*/
private String creatorId;
/**
* updateAt 更新时间
*/
private Long updateAt;
/**
* submitter 最后提交人 用于呈现最后操作者
*/
private String submitter;
/**
* submitterId 最后提交人id 用于记录最后操作者
*/
private String submitterId;
}
...@@ -152,6 +152,36 @@ public interface ChannelService { ...@@ -152,6 +152,36 @@ public interface ChannelService {
List<ChannelListVO> getNegativeList(String contendId, String platform, String keyword, String sorter, Long startTime, Long endTime, int size,boolean cache); List<ChannelListVO> getNegativeList(String contendId, String platform, String keyword, String sorter, Long startTime, Long endTime, int size,boolean cache);
/** /**
* 新-活跃渠道榜
* @param contendId 品牌id
* @param startTime 开始时间
* @param endTime 结束时间
* @param size 数据量
* @return
*/
JSONObject getActiveChannelList(String contendId, Long startTime, Long endTime, int size, boolean cache);
/**
* 新-友好渠道榜
* @param contendId 品牌id
* @param startTime 开始时间
* @param endTime 结束时间
* @param size 数据量
* @return
*/
JSONObject getPositiveChannelList(String contendId, Long startTime, Long endTime, int size, boolean cache);
/**
* 新-敏感渠道榜
* @param contendId 品牌id
* @param startTime 开始时间
* @param endTime 结束时间
* @param size 数据量
* @return
*/
JSONObject getNegativeChannelList(String contendId, Long startTime, Long endTime, int size, boolean cache);
/**
* 收藏渠道 * 收藏渠道
* *
* @param channelId * @param channelId
......
...@@ -152,10 +152,13 @@ public class TaskServiceImpl implements TaskService { ...@@ -152,10 +152,13 @@ public class TaskServiceImpl implements TaskService {
timeList.forEach(times -> { timeList.forEach(times -> {
// 活跃渠道榜 // 活跃渠道榜
channelService.getActiveChannelList(Constant.PRIMARY_CONTEND_ID, null, null, times[0], times[1], 50, false); channelService.getActiveChannelList(Constant.PRIMARY_CONTEND_ID, null, null, times[0], times[1], 50, false);
channelService.getActiveChannelList(Constant.PRIMARY_CONTEND_ID, times[0], times[1], 50, false);
// 友好渠道榜 // 友好渠道榜
channelService.getPositiveList(Constant.PRIMARY_CONTEND_ID, null, null, sorter, times[0], times[1], 50, false); channelService.getPositiveList(Constant.PRIMARY_CONTEND_ID, null, null, sorter, times[0], times[1], 50, false);
channelService.getPositiveChannelList(Constant.PRIMARY_CONTEND_ID, times[0], times[1], 50, false);
// 敏感渠道榜 // 敏感渠道榜
channelService.getNegativeList(Constant.PRIMARY_CONTEND_ID, null, null, sorter, times[0], times[1], 50, false); channelService.getNegativeList(Constant.PRIMARY_CONTEND_ID, null, null, sorter, times[0], times[1], 50, false);
channelService.getNegativeChannelList(Constant.PRIMARY_CONTEND_ID, times[0], times[1], 50, false);
}); });
log.info("项目:{}-渠道榜单缓存已完成:{}个", project.getProjectName(), total.incrementAndGet()); log.info("项目:{}-渠道榜单缓存已完成:{}个", project.getProjectName(), total.incrementAndGet());
return null; return null;
......
...@@ -58,6 +58,10 @@ public class RedisUtil { ...@@ -58,6 +58,10 @@ public class RedisUtil {
return RedisKeyPrefix.CHANNEL_RECORD_LIST + Tools.concat(projectId, startTime, endTime, platform, emotion); return RedisKeyPrefix.CHANNEL_RECORD_LIST + Tools.concat(projectId, startTime, endTime, platform, emotion);
} }
public static String getChannelRecordList(String projectId, String contendId, Long startTime, Long endTime, int emotion) {
return RedisKeyPrefix.CHANNEL_RECORD_LIST + Tools.concat(projectId, contendId, startTime, endTime, emotion);
}
public static String getNewCrisisCaseListAllKey() { public static String getNewCrisisCaseListAllKey() {
return RedisKeyPrefix.PROJECT_WARN_NEW_CASE_LIST + "*"; return RedisKeyPrefix.PROJECT_WARN_NEW_CASE_LIST + "*";
} }
......
...@@ -72,6 +72,7 @@ qbjc.event.tag.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/tag/e ...@@ -72,6 +72,7 @@ qbjc.event.tag.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/tag/e
qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platform/resource qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platform/resource
qbjc.userCenter.url=https://login.zhiweidata.com/plogin/center qbjc.userCenter.url=https://login.zhiweidata.com/plogin/center
qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr
qbjc.channel.application.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-application
#\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3 #\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3
crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3} crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3}
crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4} crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4}
......
...@@ -75,6 +75,7 @@ qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platfo ...@@ -75,6 +75,7 @@ qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platfo
#qbjc.userCenter.url=http://192.168.0.225:10000 #qbjc.userCenter.url=http://192.168.0.225:10000
qbjc.userCenter.url=http://login.zhiweidata.top/plogin/center qbjc.userCenter.url=http://login.zhiweidata.top/plogin/center
qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr
qbjc.channel.application.url=http://192.168.0.79:11000/qbjcbackPhoenix/interface/middleware/channel-application
#\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3 #\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3
crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3} crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3}
crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4} crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4}
......
...@@ -72,6 +72,7 @@ qbjc.event.tag.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/tag/e ...@@ -72,6 +72,7 @@ qbjc.event.tag.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/tag/e
qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platform/resource qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platform/resource
qbjc.userCenter.url=https://login.zhiweidata.com/plogin/center qbjc.userCenter.url=https://login.zhiweidata.com/plogin/center
qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr qbjc.userCenter.token=AoJ0ooy3HV1EElWnvQw9YTS9b5Y+fmtkbM6DdpPgDO6D/OhNqH4qrJKarzMr
qbjc.channel.application.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/channel-application
#\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3 #\u5371\u673A\u5E93\u5916\u90E8\u63A5\u53E3
crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3} crisis.search.url=https://crisis.zhiweidata.com/app/brandkbs/crisisSearch?page={1}&size={2}&keyword={3}
crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4} crisis.searchTags.url=https://crisis.zhiweidata.com/app/brandkbs/searchCrisisByTags?page={1}&size={2}&brand={3}&category={4}
......
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