Commit f9f49e69 by shenjunjie

调整project-linkedGroupId

parent da66b7a4
package com.zhiwei.brandkbs2.common;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.pojo.ChannelTag;
import com.zhiwei.brandkbs2.pojo.Project;
import com.zhiwei.brandkbs2.service.SystemInfoService;
......@@ -51,6 +52,11 @@ public class GlobalPojo {
public static Map<String, Project> PROJECT_MAP;
/**
* 外部舆情项目
*/
public static List<JSONObject> YU_QING_PROJECTS;
public static final List<String> PERMANENT_PLATFORM_NAMES = Arrays.asList("网媒", "微博", "微信", "今日头条");
public static final String ELSE_PLATFORM_NAME = "其他自媒体";
......@@ -75,13 +81,18 @@ public class GlobalPojo {
}
private void updatePojo(String logMsg) {
PLATFORMS = systemInfoService.getPlatforms();
TAGS = systemInfoService.getTags().stream().collect(Collectors.groupingBy(Tag::getGroupName));
CHANNEL_TAGS = systemInfoService.getChannelTags().stream().collect(Collectors.toMap(ChannelTag::getChannel, ChannelTag::getTag));
MEDIA_TYPE = systemInfoService.getMediaTypes();
PROJECT_MAP = systemInfoService.getProjects();
log.info("{}-获取PLATFORMS-size:{},TAGS-size:{},CHANNEL_TAGS:{},MEDIA_TYPE:{},PROJECT_MAP:{}", logMsg, PLATFORMS.size(), TAGS.size(),
CHANNEL_TAGS.size(), MEDIA_TYPE.size(), PROJECT_MAP.size());
try {
PLATFORMS = systemInfoService.getPlatforms();
TAGS = systemInfoService.getTags().stream().collect(Collectors.groupingBy(Tag::getGroupName));
CHANNEL_TAGS = systemInfoService.getChannelTags().stream().collect(Collectors.toMap(ChannelTag::getChannel, ChannelTag::getTag));
MEDIA_TYPE = systemInfoService.getMediaTypes();
PROJECT_MAP = systemInfoService.getProjects();
YU_QING_PROJECTS = systemInfoService.getYuQingProjects();
log.info("{}-获取PLATFORMS-size:{},TAGS-size:{},CHANNEL_TAGS:{},MEDIA_TYPE:{},PROJECT_MAP:{},YUQING-PROJECTS-size:{}", logMsg, PLATFORMS.size(), TAGS.size(),
CHANNEL_TAGS.size(), MEDIA_TYPE.size(), PROJECT_MAP.size(), YU_QING_PROJECTS.size());
} catch (Exception e) {
log.info("{}-获取缓存值异常", logMsg, e);
}
}
public static String getPlatformIdByName(String platformName) {
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zhiwei.brandkbs2.auth.Auth;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.common.GlobalPojo;
import com.zhiwei.brandkbs2.controller.BaseController;
import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO;
......@@ -66,9 +67,6 @@ public class ProjectController extends BaseController {
@Value("${brandkbs.image.url}")
private String brandkbsImageUrl;
@Value("${qbjc.project.url}")
private String yqProjectUrl;
@Value("${hqd.groupAll.url}")
private String hqdGroupAllUrl;
......@@ -162,15 +160,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParams({@ApiImplicitParam(name = "keyword", value = "搜索关键字", required = false, defaultValue = "", paramType = "query", dataType = "string")})
@GetMapping("/get/linkedGroups")
public ResponseResult getLinkedGroups(@RequestParam(value = "keyword", defaultValue = "") String keyword) {
ResponseEntity<JSONObject> entity = restTemplate.getForEntity(yqProjectUrl, JSONObject.class);
List<JSONObject> dataList = Objects.requireNonNull(entity.getBody()).getJSONArray("data").toJavaList(JSONObject.class);
List<JSONObject> resList = dataList.stream().filter(json -> json.getString("projectName").contains(keyword)).map(json -> {
JSONObject res = new JSONObject();
res.put("groupName", json.getString("projectName"));
res.put("id", json.getString("id"));
return res;
}).collect(Collectors.toList());
// List<String> groupNames = jsonArray.stream().map(object -> ((JSONObject) object).getString("groupName")).filter(group -> group.contains(keyword)).collect(Collectors.toList());
List<JSONObject> resList = GlobalPojo.YU_QING_PROJECTS.stream().filter(json -> json.getString("groupName").contains(keyword)).collect(Collectors.toList());
return ResponseResult.success(resList);
}
......
......@@ -49,4 +49,6 @@ public interface SystemInfoService {
*/
JSONObject getExtraParam();
List<JSONObject> getYuQingProjects();
}
......@@ -608,8 +608,9 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
return null;
}
JSONObject hitMap = Tools.getBrandkbsHitMapWithProjectId(sourceMap, projectId);
if (!hitMap.isEmpty() && !Constant.PRIMARY_CONTEND_ID.equals(hitMap.getString("contend_id"))) {
baseMap.setBrandName(projectService.getProjectByContendId(projectId, hitMap.getString("contend_id")).getBrandName());
String contendId = hitMap.getString("contend_id");
if (!hitMap.isEmpty() && (null != config.getContends() && config.getContends().contains(contendId))) {
baseMap.setBrandName(projectService.getProjectByContendId(projectId, contendId).getBrandName());
}
return baseMap;
}).filter(Objects::nonNull).collect(Collectors.toList());
......
......@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @ClassName: SystemInfoServiceImpl
......@@ -52,6 +53,9 @@ public class SystemInfoServiceImpl implements SystemInfoService {
@Value("${whole.extraParam.url}")
private String YU_QING_EXTRA_PARAM;
@Value("${qbjc.project.url}")
private String yqProjectUrl;
@Override
public List<MessagePlatform> getPlatforms() {
return qbjcPojoDao.findMessagePlatformAll();
......@@ -92,4 +96,16 @@ public class SystemInfoServiceImpl implements SystemInfoService {
}
return null;
}
@Override
public List<JSONObject> getYuQingProjects() {
ResponseEntity<JSONObject> entity = restTemplate.getForEntity(yqProjectUrl, JSONObject.class);
List<JSONObject> dataList = Objects.requireNonNull(entity.getBody()).getJSONArray("data").toJavaList(JSONObject.class);
return dataList.stream().map(json -> {
JSONObject res = new JSONObject();
res.put("groupName", json.getString("projectName"));
res.put("id", json.getString("id"));
return res;
}).collect(Collectors.toList());
}
}
......@@ -53,7 +53,7 @@ auth.center.client.application.name=brandkbs2
#\u8206\u60C5\u7CFB\u7EDF\u5916\u90E8\u63A5\u53E3
qbjc.interface.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/
qbjc.interface.upload.token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjoiXCLlk4Hop4FcIiIsImV4cCI6NDc2MjgyMjEzMiwiaWF0IjoxNjUyNDIyMDcyfQ.DXQ8yKgfsCMjhT0xniZeWCMv4syqIoDvztU4QWsd-Fg
qbjc.project.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/project/resource
qbjc.project.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/project/resource?withProjectId=true
qbjc.event.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/aplan/event
qbjc.event.tag.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/tag/event?project={1}
qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platform/resource
......
......@@ -55,7 +55,7 @@ auth.center.client.application.name=brandkbs2
#\u8206\u60C5\u7CFB\u7EDF\u5916\u90E8\u63A5\u53E3
qbjc.interface.url=http://192.168.0.79:11000/qbjcbackPhoenix/interface/
qbjc.interface.upload.token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjoiXCLlk4Hop4FcIiIsImV4cCI6NDc2MjgyMjEzMiwiaWF0IjoxNjUyNDIyMDcyfQ.DXQ8yKgfsCMjhT0xniZeWCMv4syqIoDvztU4QWsd-Fg
qbjc.project.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/project/resource
qbjc.project.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/project/resource?withProjectId=true
qbjc.event.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/aplan/event
qbjc.event.tag.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/tag/event?project={1}
qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platform/resource
......
......@@ -53,7 +53,7 @@ auth.center.client.application.name=brandkbs2
#\u8206\u60C5\u7CFB\u7EDF\u5916\u90E8\u63A5\u53E3
qbjc.interface.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/
qbjc.interface.upload.token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjoiXCLlk4Hop4FcIiIsImV4cCI6NDc2MjgyMjEzMiwiaWF0IjoxNjUyNDIyMDcyfQ.DXQ8yKgfsCMjhT0xniZeWCMv4syqIoDvztU4QWsd-Fg
qbjc.project.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/project/resource
qbjc.project.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/project/resource?withProjectId=true
qbjc.event.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/aplan/event
qbjc.event.tag.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/tag/event?project={1}
qbjc.platform.url=https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/platform/resource
......
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