Commit f99e990a by shenjunjie

Merge branch 'feature' into 'dev'

调整project-linkedGroupId

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