Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjunjie
brandkbs2
Commits
553c2390
Commit
553c2390
authored
Jun 24, 2024
by
陈健智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道库-重要渠道清单
parent
386ac95d
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
357 additions
and
2 deletions
+357
-2
src/main/java/com/zhiwei/brandkbs2/controller/app/AppChannelController.java
+15
-0
src/main/java/com/zhiwei/brandkbs2/dao/ImportantChannelDao.java
+12
-0
src/main/java/com/zhiwei/brandkbs2/dao/ImportantChannelOverviewDao.java
+12
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/ImportantChannelDaoImpl.java
+20
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/ImportantChannelOverviewDaoImpl.java
+20
-0
src/main/java/com/zhiwei/brandkbs2/pojo/ImportantChannel.java
+71
-0
src/main/java/com/zhiwei/brandkbs2/pojo/ImportantChannelOverview.java
+58
-0
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
+23
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+123
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ToolsetServiceImpl.java
+3
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/app/AppChannelController.java
View file @
553c2390
...
@@ -315,4 +315,19 @@ public class AppChannelController extends BaseController {
...
@@ -315,4 +315,19 @@ public class AppChannelController extends BaseController {
}
}
return
ResponseResult
.
failure
(
"渠道申请失败"
);
return
ResponseResult
.
failure
(
"渠道申请失败"
);
}
}
@ApiOperation
(
"重要渠道清单-清单列表"
)
@GetMapping
(
"/important-channel/list"
)
public
ResponseResult
getImportantChannelList
(
@RequestParam
(
value
=
"type"
,
defaultValue
=
"市监局"
)
String
type
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
)
{
return
ResponseResult
.
success
(
channelService
.
getImportantChannelList
(
type
,
keyword
));
}
@ApiOperation
(
"重要渠道清单-清单列表-详情"
)
@GetMapping
(
"/important-channel/list/detail"
)
public
ResponseResult
getImportantChannelListDetail
(
@RequestParam
(
value
=
"type"
)
String
type
,
@RequestParam
(
value
=
"name"
)
String
name
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
)
{
return
ResponseResult
.
success
(
channelService
.
getImportantChannelListDetail
(
type
,
name
,
keyword
));
}
}
}
src/main/java/com/zhiwei/brandkbs2/dao/ImportantChannelDao.java
0 → 100644
View file @
553c2390
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.zhiwei.brandkbs2.pojo.ImportantChannel
;
/**
* @ClassName: ImportantChannelDao
* @Description 重要渠道清单dao
* @author: cjz
* @date: 2024-06-14 14:03
*/
public
interface
ImportantChannelDao
extends
BaseMongoDao
<
ImportantChannel
>{
}
src/main/java/com/zhiwei/brandkbs2/dao/ImportantChannelOverviewDao.java
0 → 100644
View file @
553c2390
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.zhiwei.brandkbs2.pojo.ImportantChannelOverview
;
/**
* @ClassName: ImportantChannelOverviewDao
* @Description 重要渠道清单概览dao
* @author: cjz
* @date: 2024-06-17 10:03
*/
public
interface
ImportantChannelOverviewDao
extends
BaseMongoDao
<
ImportantChannelOverview
>{
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/ImportantChannelDaoImpl.java
0 → 100644
View file @
553c2390
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.ImportantChannelDao
;
import
com.zhiwei.brandkbs2.pojo.ImportantChannel
;
import
org.springframework.stereotype.Component
;
/**
* @ClassName: ImportantChannelDaoImpl
* @Description 重要渠道清单dao
* @author: cjz
* @date: 2024-06-14 14:03
*/
@Component
(
"importantChannelDao"
)
public
class
ImportantChannelDaoImpl
extends
BaseMongoDaoImpl
<
ImportantChannel
>
implements
ImportantChannelDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_important_channel"
;
public
ImportantChannelDaoImpl
()
{
super
(
COLLECTION_NAME
);
}
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/ImportantChannelOverviewDaoImpl.java
0 → 100644
View file @
553c2390
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.ImportantChannelOverviewDao
;
import
com.zhiwei.brandkbs2.pojo.ImportantChannelOverview
;
import
org.springframework.stereotype.Component
;
/**
* @ClassName: ImportantChannelOverviewDao
* @Description 重要渠道清单概览dao
* @author: cjz
* @date: 2024-06-17 10:03
*/
@Component
(
"importantChannelOverviewDao"
)
public
class
ImportantChannelOverviewDaoImpl
extends
BaseMongoDaoImpl
<
ImportantChannelOverview
>
implements
ImportantChannelOverviewDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_important_channel_overview"
;
public
ImportantChannelOverviewDaoImpl
()
{
super
(
COLLECTION_NAME
);
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/ImportantChannel.java
0 → 100644
View file @
553c2390
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* @author cjz
* @version 1.0
* @description 重要渠道清单
* @date 2024年6月14日10:06:46
*/
@Getter
@Setter
public
class
ImportantChannel
extends
AbstractBaseMongo
{
/**
* 机构类型
*/
private
String
institution
;
/**
* 机构标签
*/
private
List
<
String
>
institutionTags
;
/**
* 地域
*/
private
String
region
;
/**
* 细分地域
*/
private
String
subdivideRegion
;
/**
* 平台
*/
private
String
platform
;
/**
* 渠道
*/
private
String
source
;
/**
* 媒体类型
*/
private
String
media
;
/**
* 媒体标签
*/
private
List
<
String
>
mediaTags
;
/**
* 主体
*/
private
String
mainBody
;
/**
* 单位名称
*/
private
String
organization
;
/**
* 应用程序
*/
private
String
application
;
/**
* 创建时间
*/
private
Long
cTime
;
/**
* 修改时间
*/
private
Long
uTime
;
}
src/main/java/com/zhiwei/brandkbs2/pojo/ImportantChannelOverview.java
0 → 100644
View file @
553c2390
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* @author cjz
* @version 1.0
* @description 重要渠道清单
* @date 2024年6月14日10:06:46
*/
@Getter
@Setter
public
class
ImportantChannelOverview
extends
AbstractBaseMongo
{
/**
* 机构类型
*/
private
String
type
;
/**
* 机构标签
*/
private
List
<
String
>
tags
;
// /**
// * 媒体类型
// */
// private String media;
// /**
// * 媒体标签
// */
// private List<String> mediaTags;
// /**
// * 地域
// */
// private String region;
//
// /**
// * 单位名称
// */
// private String mainBody;
/**
* 具体信息
*/
private
List
<
JSONObject
>
info
;
// private List<String> source;
/**
* 创建时间
*/
private
Long
cTime
;
/**
* 修改时间
*/
private
Long
uTime
;
}
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
View file @
553c2390
...
@@ -309,5 +309,28 @@ public interface ChannelService {
...
@@ -309,5 +309,28 @@ public interface ChannelService {
*/
*/
Map
<
String
,
JSONObject
>
getProjectEmotionChannelListData
()
throws
IOException
;
Map
<
String
,
JSONObject
>
getProjectEmotionChannelListData
()
throws
IOException
;
/**
* 匹配舆情重要渠道
* @param linkedGroupId
* @param source
* @return
*/
JSONObject
matchYuQingSensitiveChannel
(
String
linkedGroupId
,
String
source
);
JSONObject
matchYuQingSensitiveChannel
(
String
linkedGroupId
,
String
source
);
/**
* 获取重要渠道清单列表
* @param type
* @param keyword
* @return
*/
List
<
JSONObject
>
getImportantChannelList
(
String
type
,
String
keyword
);
/**
* 获取重要渠道清单列表详情
* @param type
* @param name
* @param keyword
* @return
*/
JSONObject
getImportantChannelListDetail
(
String
type
,
String
name
,
String
keyword
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
553c2390
...
@@ -69,6 +69,7 @@ import java.math.BigDecimal;
...
@@ -69,6 +69,7 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -120,6 +121,12 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -120,6 +121,12 @@ public class ChannelServiceImpl implements ChannelService {
@Resource
(
name
=
"eventMiddlewareDao"
)
@Resource
(
name
=
"eventMiddlewareDao"
)
EventMiddlewareDao
eventMiddlewareDao
;
EventMiddlewareDao
eventMiddlewareDao
;
@Resource
(
name
=
"importantChannelDao"
)
private
ImportantChannelDao
importantChannelDao
;
@Resource
(
name
=
"importantChannelOverviewDao"
)
private
ImportantChannelOverviewDao
importantChannelOverviewDao
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
MongoUtil
mongoUtil
;
MongoUtil
mongoUtil
;
...
@@ -759,6 +766,122 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -759,6 +766,122 @@ public class ChannelServiceImpl implements ChannelService {
}
}
@Override
@Override
public
List
<
JSONObject
>
getImportantChannelList
(
String
type
,
String
keyword
)
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"type"
).
is
(
type
));
ImportantChannelOverview
overview
=
importantChannelOverviewDao
.
findOne
(
"type"
,
type
);
if
(
StringUtils
.
isNotEmpty
(
keyword
)){
List
<
JSONObject
>
res
=
new
ArrayList
<>();
Pattern
pattern
=
Pattern
.
compile
(
keyword
);
for
(
JSONObject
jsonObject
:
overview
.
getInfo
())
{
List
<
String
>
sources
=
jsonObject
.
getJSONArray
(
"source"
).
toJavaList
(
String
.
class
);
for
(
String
source
:
sources
)
{
if
(
pattern
.
matcher
(
source
).
find
()){
res
.
add
(
jsonObject
);
break
;
}
}
}
return
res
;
}
return
overview
.
getInfo
();
}
@Override
public
JSONObject
getImportantChannelListDetail
(
String
type
,
String
name
,
String
keyword
)
{
String
searchType
=
Arrays
.
asList
(
"18家媒体"
,
"区域媒体"
).
contains
(
type
)
?
"media"
:
"institution"
;
String
searchName
=
Objects
.
equals
(
"18家媒体"
,
type
)
?
"mainBody"
:
"region"
;
List
<
String
>
platformSort
=
Arrays
.
asList
(
"18家媒体"
,
"区域媒体"
).
contains
(
type
)
?
Arrays
.
asList
(
"新浪微博"
,
"微信"
,
"网媒"
,
"B站"
,
"头条"
,
"抖音"
)
:
Arrays
.
asList
(
"微信公众号"
,
"新浪微博"
,
"网媒"
);
// query
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
searchType
).
is
(
type
));
query
.
addCriteria
(
Criteria
.
where
(
searchName
).
is
(
name
));
if
(
StringUtils
.
isNotEmpty
(
keyword
)){
importantChannelOverviewDao
.
addKeywordFuzz
(
query
,
keyword
,
"source"
);
}
List
<
ImportantChannel
>
list
=
importantChannelDao
.
findList
(
query
);
// 顺序需按照平台命中 例:微博不为空的优先放前面
List
<
ImportantChannel
>
sortList
=
new
ArrayList
<>();
Map
<
String
,
List
<
ImportantChannel
>>
platformGroup
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getPlatform
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
String
platform
:
platformSort
){
if
(
Objects
.
nonNull
(
platformGroup
.
get
(
platform
))){
sortList
.
addAll
(
platformGroup
.
get
(
platform
));
}
}
if
(
Objects
.
equals
(
"区域媒体"
,
type
)){
return
regionMediaDataProcess
(
sortList
);
}
else
if
(
Arrays
.
asList
(
"纪检委"
,
"政法委"
).
contains
(
type
)){
return
provinceDataProcess
(
sortList
);
}
else
{
return
dataProcess
(
sortList
,
type
);
}
}
private
JSONObject
provinceDataProcess
(
List
<
ImportantChannel
>
sortList
){
List
<
JSONObject
>
resList
=
new
ArrayList
<>();
JSONObject
jsonObject
=
new
JSONObject
(
new
LinkedHashMap
<>());
LinkedHashMap
<
String
,
List
<
ImportantChannel
>>
platformMap
=
sortList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getPlatform
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
Map
.
Entry
<
String
,
List
<
ImportantChannel
>>
entry
:
platformMap
.
entrySet
())
{
jsonObject
.
put
(
entry
.
getKey
(),
entry
.
getValue
().
stream
().
map
(
ImportantChannel:
:
getSource
).
collect
(
Collectors
.
toList
()));
}
resList
.
add
(
jsonObject
);
JSONObject
res
=
new
JSONObject
();
res
.
put
(
"count"
,
sortList
.
size
());
res
.
put
(
"list"
,
resList
);
return
res
;
}
private
JSONObject
dataProcess
(
List
<
ImportantChannel
>
sortList
,
String
type
){
Map
<
String
,
List
<
ImportantChannel
>>
map
=
Objects
.
equals
(
"18家媒体"
,
type
)
?
sortList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getOrganization
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()))
:
sortList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getSubdivideRegion
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
List
<
JSONObject
>
resList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
ImportantChannel
>>
entry
:
map
.
entrySet
())
{
JSONObject
jsonObject
=
new
JSONObject
(
new
LinkedHashMap
<>());
jsonObject
.
put
(
Objects
.
equals
(
"18家媒体"
,
type
)
?
"单位名称"
:
"细分地域"
,
entry
.
getKey
());
if
(
Objects
.
equals
(
"18家媒体"
,
type
))
{
jsonObject
.
put
(
"应用程序"
,
entry
.
getValue
().
stream
().
map
(
ImportantChannel:
:
getApplication
).
filter
(
Objects:
:
nonNull
).
distinct
().
collect
(
Collectors
.
toList
()));
}
LinkedHashMap
<
String
,
List
<
ImportantChannel
>>
platformMap
=
entry
.
getValue
().
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getPlatform
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
Map
.
Entry
<
String
,
List
<
ImportantChannel
>>
platformEntry
:
platformMap
.
entrySet
())
{
jsonObject
.
put
(
platformEntry
.
getKey
(),
platformEntry
.
getValue
().
stream
().
map
(
ImportantChannel:
:
getSource
).
collect
(
Collectors
.
toList
()));
}
resList
.
add
(
jsonObject
);
}
JSONObject
res
=
new
JSONObject
();
res
.
put
(
"count"
,
sortList
.
size
());
res
.
put
(
"list"
,
resList
);
return
res
;
}
private
JSONObject
regionMediaDataProcess
(
List
<
ImportantChannel
>
sortList
){
Map
<
String
,
List
<
ImportantChannel
>>
map
=
sortList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getMainBody
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
List
<
JSONObject
>
resList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
ImportantChannel
>>
entry
:
map
.
entrySet
())
{
JSONObject
mainBodyJson
=
new
JSONObject
(
new
LinkedHashMap
<>());
mainBodyJson
.
put
(
"主体"
,
entry
.
getKey
());
LinkedHashMap
<
String
,
List
<
ImportantChannel
>>
organizationMap
=
entry
.
getValue
().
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getOrganization
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
List
<
JSONObject
>
platformJson
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
ImportantChannel
>>
organizationEntry
:
organizationMap
.
entrySet
())
{
LinkedHashMap
<
String
,
List
<
ImportantChannel
>>
platformMap
=
organizationEntry
.
getValue
().
stream
().
collect
(
Collectors
.
groupingBy
(
ImportantChannel:
:
getPlatform
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
JSONObject
dataJson
=
new
JSONObject
(
new
LinkedHashMap
<>());
dataJson
.
put
(
"单位名称"
,
organizationEntry
.
getKey
());
dataJson
.
put
(
"应用程序"
,
organizationEntry
.
getValue
().
stream
().
map
(
ImportantChannel:
:
getApplication
).
filter
(
Objects:
:
nonNull
).
distinct
().
collect
(
Collectors
.
toList
()));
for
(
Map
.
Entry
<
String
,
List
<
ImportantChannel
>>
platformEntry
:
platformMap
.
entrySet
())
{
dataJson
.
put
(
platformEntry
.
getKey
(),
platformEntry
.
getValue
().
stream
().
map
(
ImportantChannel:
:
getSource
).
collect
(
Collectors
.
toList
()));
}
platformJson
.
add
(
dataJson
);
}
mainBodyJson
.
put
(
"list"
,
platformJson
);
resList
.
add
(
mainBodyJson
);
}
JSONObject
res
=
new
JSONObject
();
res
.
put
(
"count"
,
sortList
.
size
());
res
.
put
(
"list"
,
resList
);
return
res
;
}
@Override
public
JSONObject
getSpreadingTend
(
String
channelId
,
String
type
,
String
contendIds
,
Long
startTime
,
Long
endTime
)
{
public
JSONObject
getSpreadingTend
(
String
channelId
,
String
type
,
String
contendIds
,
Long
startTime
,
Long
endTime
)
{
JSONObject
res
=
new
JSONObject
();
JSONObject
res
=
new
JSONObject
();
// 默认全部 TODO
// 默认全部 TODO
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ToolsetServiceImpl.java
View file @
553c2390
...
@@ -964,10 +964,11 @@ public class ToolsetServiceImpl implements ToolsetService {
...
@@ -964,10 +964,11 @@ public class ToolsetServiceImpl implements ToolsetService {
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
jsonObject
=
restTemplate
.
getForEntity
(
articleInfoUrl
,
JSONObject
.
class
,
url
,
linkedGroupId
,
UserThreadLocal
.
getNickname
()).
getBody
();
jsonObject
=
restTemplate
.
getForEntity
(
articleInfoUrl
,
JSONObject
.
class
,
url
,
linkedGroupId
,
UserThreadLocal
.
getNickname
()).
getBody
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"url:{},访问链接信息提取接口异常-"
,
url
,
e
);
log
.
error
(
"url:{},访问链接信息提取接口异常-"
,
url
,
e
);
return
null
;
return
null
;
}
}
if
(
Objects
.
isNull
(
jsonObject
)
||
!
jsonObject
.
getBoolean
(
"status"
))
{
if
(
Objects
.
isNull
(
jsonObject
)
||
!
jsonObject
.
getBoolean
(
"status"
))
{
log
.
error
(
"url:{},访问链接信息提取接口异常-返回信息:{}"
,
url
,
JSONObject
.
toJSONString
(
jsonObject
));
return
null
;
return
null
;
}
}
return
jsonObject
.
getJSONObject
(
"data"
);
return
jsonObject
.
getJSONObject
(
"data"
);
...
@@ -994,7 +995,7 @@ public class ToolsetServiceImpl implements ToolsetService {
...
@@ -994,7 +995,7 @@ public class ToolsetServiceImpl implements ToolsetService {
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
articleSummaryUrl
,
request
,
String
.
class
);
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
articleSummaryUrl
,
request
,
String
.
class
);
return
response
.
getBody
();
return
response
.
getBody
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
info
(
"访问摘要提取接口异常-"
,
e
);
log
.
error
(
"访问摘要提取接口异常-"
,
e
);
return
errorString
;
return
errorString
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment