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
1262ce68
Commit
1262ce68
authored
Sep 19, 2023
by
shentao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
2023/09/19 工具库-摘要提取功能、任务中心相关功能、危机库相关接口迁移至事件库 See merge request
!388
parents
4e34b1c3
5c1b25a3
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1244 additions
and
67 deletions
+1244
-67
src/main/java/com/zhiwei/brandkbs2/aop/AopDownloadTask.java
+66
-0
src/main/java/com/zhiwei/brandkbs2/auth/AuthAspect.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/common/CommonConfig.java
+33
-2
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/controller/admin/EventController.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppChannelController.java
+6
-2
src/main/java/com/zhiwei/brandkbs2/controller/app/AppCrisisController.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppDownloadController.java
+402
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
+55
-6
src/main/java/com/zhiwei/brandkbs2/controller/app/AppToolsetController.java
+193
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppUserCenterController.java
+32
-0
src/main/java/com/zhiwei/brandkbs2/dao/DownloadTaskDao.java
+17
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/DownloadTaskDaoImpl.java
+23
-0
src/main/java/com/zhiwei/brandkbs2/easyexcel/EasyExcelUtil.java
+42
-0
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportArticleSummaryDTO.java
+27
-0
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/UploadArticleSummaryDTO.java
+22
-0
src/main/java/com/zhiwei/brandkbs2/easyexcel/listener/ArticleSummaryListener.java
+37
-0
src/main/java/com/zhiwei/brandkbs2/pojo/DownloadTask.java
+78
-0
src/main/java/com/zhiwei/brandkbs2/pojo/Project.java
+0
-6
src/main/java/com/zhiwei/brandkbs2/pojo/vo/ProjectVO.java
+0
-7
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/DownloadTaskService.java
+53
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+18
-19
src/main/java/com/zhiwei/brandkbs2/service/impl/DownloadTaskServiceImpl.java
+100
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/EsSearchServiceImpl.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+1
-17
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
+8
-1
src/main/resources/application-dev.properties
+4
-0
src/main/resources/application-local.properties
+4
-0
src/main/resources/application-prod.properties
+4
-0
src/test/java/com/zhiwei/brandkbs2/MarkDataServiceTest.java
+2
-3
No files found.
src/main/java/com/zhiwei/brandkbs2/aop/AopDownloadTask.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
aop
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.DownloadTask
;
import
com.zhiwei.brandkbs2.service.DownloadTaskService
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.Signature
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.lang.reflect.Method
;
import
java.util.Objects
;
/**
* @author cjz
* @ClassName AopDownloadTask
* @Description 下载任务Aop
* @date 2023-09-11 09:25
*/
@Aspect
@Component
@Order
(
2
)
public
class
AopDownloadTask
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
AopDownloadTask
.
class
);
@Resource
(
name
=
"downloadTaskServiceImpl"
)
DownloadTaskService
downloadTaskService
;
@Around
(
value
=
"execution(public * com..controller..app..AppDownloadController.*(..)) || execution(public * com..controller..app..AppToolsetController.getBatchArticleSummary(..)))"
)
public
Object
around
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
Signature
signature
=
joinPoint
.
getSignature
();
Method
method
=
((
MethodSignature
)
signature
).
getMethod
();
// 生成下载任务
String
taskName
=
method
.
getAnnotation
(
ApiOperation
.
class
).
value
()
+
"下载"
;
String
description
=
method
.
getAnnotation
(
ApiOperation
.
class
).
value
();
String
taskId
=
downloadTaskService
.
createDownloadTask
(
taskName
,
description
);
Object
proceed
=
null
;
String
fileAddress
;
// 执行目标方法
try
{
proceed
=
joinPoint
.
proceed
();
}
catch
(
Exception
e
){
// 目标方法出错时更新下载任务
downloadTaskService
.
updateDownloadTask
(
taskId
,
100
,
DownloadTask
.
Status
.
FAILED
.
getName
(),
null
);
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
,
"下载异常"
,
e
);
}
// 更新下载任务
if
(
Objects
.
equals
(
method
.
getName
(),
"getBatchArticleSummary"
)){
fileAddress
=
JSONObject
.
parseObject
(((
ResponseResult
)
proceed
).
getData
().
toString
()).
getString
(
"filePath"
);
}
else
{
fileAddress
=
((
ResponseResult
)
proceed
).
getData
().
toString
();
}
downloadTaskService
.
updateDownloadTask
(
taskId
,
100
,
DownloadTask
.
Status
.
FINISH
.
getName
(),
fileAddress
);
return
proceed
;
}
}
src/main/java/com/zhiwei/brandkbs2/auth/AuthAspect.java
View file @
1262ce68
...
@@ -18,6 +18,7 @@ import org.aspectj.lang.annotation.Aspect;
...
@@ -18,6 +18,7 @@ import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
@@ -38,6 +39,7 @@ import java.util.Map;
...
@@ -38,6 +39,7 @@ import java.util.Map;
*/
*/
@Aspect
@Aspect
@Component
@Component
@Order
(
1
)
public
class
AuthAspect
{
public
class
AuthAspect
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
AuthAspect
.
class
);
public
static
final
Logger
log
=
LogManager
.
getLogger
(
AuthAspect
.
class
);
...
...
src/main/java/com/zhiwei/brandkbs2/common/CommonConfig.java
View file @
1262ce68
...
@@ -11,8 +11,14 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -11,8 +11,14 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.client.OkHttp3ClientHttpRequestFactory
;
import
org.springframework.http.client.OkHttp3ClientHttpRequestFactory
;
import
org.springframework.http.converter.StringHttpMessageConverter
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
javax.net.ssl.*
;
import
java.nio.charset.StandardCharsets
;
import
java.security.SecureRandom
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
/**
/**
...
@@ -41,12 +47,37 @@ public class CommonConfig {
...
@@ -41,12 +47,37 @@ public class CommonConfig {
private
String
filterGroup
;
private
String
filterGroup
;
@Bean
@Bean
public
RestTemplate
restTemplate
()
{
public
RestTemplate
restTemplate
()
throws
Exception
{
final
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
final
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
connectTimeout
(
60
,
TimeUnit
.
SECONDS
)
.
connectTimeout
(
60
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
30
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
30
,
TimeUnit
.
SECONDS
)
// 忽略SSL证书验证
.
sslSocketFactory
(
createSslSocketFactory
(),
new
SkipX509TrustManager
())
.
hostnameVerifier
((
s
,
sslSession
)
->
true
)
.
build
();
.
build
();
return
new
RestTemplate
(
new
OkHttp3ClientHttpRequestFactory
(
client
));
RestTemplate
restTemplate
=
new
RestTemplate
(
new
OkHttp3ClientHttpRequestFactory
(
client
));
// 设置字符串编码
restTemplate
.
getMessageConverters
().
set
(
1
,
new
StringHttpMessageConverter
(
StandardCharsets
.
UTF_8
));
return
restTemplate
;
}
private
SSLSocketFactory
createSslSocketFactory
()
throws
Exception
{
SSLContext
context
=
SSLContext
.
getInstance
(
"TLS"
);
context
.
init
(
null
,
new
TrustManager
[]{
new
SkipX509TrustManager
()},
new
SecureRandom
());
return
context
.
getSocketFactory
();
}
private
static
class
SkipX509TrustManager
implements
X509TrustManager
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
)
throws
CertificateException
{
}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
)
throws
CertificateException
{
}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
X509Certificate
[
0
];
}
}
}
/**
/**
...
...
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
1262ce68
...
@@ -95,6 +95,11 @@ public class RedisKeyPrefix {
...
@@ -95,6 +95,11 @@ public class RedisKeyPrefix {
public
static
final
String
PROJECT_WARN_NEW_CASE_LIST
=
"BRANDKBS:NEW_CASE:LIST_"
;
public
static
final
String
PROJECT_WARN_NEW_CASE_LIST
=
"BRANDKBS:NEW_CASE:LIST_"
;
public
static
final
String
PROJECT_WARN_NEW_CASE_CURSOR
=
"BRANDKBS:NEW_CASE:CURSOR:"
;
public
static
final
String
PROJECT_WARN_NEW_CASE_CURSOR
=
"BRANDKBS:NEW_CASE:CURSOR:"
;
/**
* 工具集相关缓存
*/
public
static
final
String
TOOLSET_ARTICLE_SUMMARY_LIMIT
=
"BRANDKBS:TOOLSET:ARTICLE_SUMMARY:LIMIT:"
;
public
static
String
projectWarnHotTopKeyAll
(
String
projectId
,
String
type
)
{
public
static
String
projectWarnHotTopKeyAll
(
String
projectId
,
String
type
)
{
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
PROJECT_WARN_HOT_TOP
,
projectId
,
Tools
.
concat
(
type
,
"*"
));
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
PROJECT_WARN_HOT_TOP
,
projectId
,
Tools
.
concat
(
type
,
"*"
));
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/EventController.java
View file @
1262ce68
...
@@ -44,6 +44,8 @@ import java.util.Set;
...
@@ -44,6 +44,8 @@ import java.util.Set;
@RequestMapping
(
"/admin/event"
)
@RequestMapping
(
"/admin/event"
)
@Api
(
tags
=
"事件管理"
,
description
=
"提供事件的增、删、改、查等功能"
)
@Api
(
tags
=
"事件管理"
,
description
=
"提供事件的增、删、改、查等功能"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
@Deprecated
// 事件后台管理已下线,改用事件中间件
public
class
EventController
extends
BaseController
{
public
class
EventController
extends
BaseController
{
@Resource
(
name
=
"eventServiceImpl"
)
@Resource
(
name
=
"eventServiceImpl"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppChannelController.java
View file @
1262ce68
...
@@ -266,6 +266,7 @@ public class AppChannelController extends BaseController {
...
@@ -266,6 +266,7 @@ public class AppChannelController extends BaseController {
@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
=
"startTime"
,
value
=
"起始时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"起始时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"sorter"
,
defaultValue
=
"{\"index\":\"descend\"}"
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"选取前几"
,
defaultValue
=
"50"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"选取前几"
,
defaultValue
=
"50"
,
paramType
=
"query"
,
dataType
=
"int"
),
})
})
@ApiOperation
(
"渠道库-友好渠道榜"
)
@ApiOperation
(
"渠道库-友好渠道榜"
)
...
@@ -274,13 +275,15 @@ public class AppChannelController extends BaseController {
...
@@ -274,13 +275,15 @@ public class AppChannelController extends BaseController {
public
ResponseResult
getPositiveChannelList
(
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
,
public
ResponseResult
getPositiveChannelList
(
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"index\":\"descend\"}"
)
String
sorter
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"50"
)
int
size
)
{
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"50"
)
int
size
)
{
return
ResponseResult
.
success
(
channelService
.
getPositiveChannelList
(
contendId
,
startTime
,
endTime
,
size
,
true
));
return
ResponseResult
.
success
(
channelService
.
getPositiveChannelList
(
contendId
,
startTime
,
endTime
,
size
,
sorter
,
true
));
}
}
@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
=
"startTime"
,
value
=
"起始时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"起始时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"sorter"
,
defaultValue
=
"{\"index\":\"descend\"}"
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"选取前几"
,
defaultValue
=
"50"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"选取前几"
,
defaultValue
=
"50"
,
paramType
=
"query"
,
dataType
=
"int"
),
})
})
@ApiOperation
(
"渠道库-敏感渠道榜"
)
@ApiOperation
(
"渠道库-敏感渠道榜"
)
...
@@ -289,8 +292,9 @@ public class AppChannelController extends BaseController {
...
@@ -289,8 +292,9 @@ public class AppChannelController extends BaseController {
public
ResponseResult
getNegativeChannelList
(
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
,
public
ResponseResult
getNegativeChannelList
(
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"index\":\"descend\"}"
)
String
sorter
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"50"
)
int
size
)
{
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"50"
)
int
size
)
{
return
ResponseResult
.
success
(
channelService
.
getNegativeChannelList
(
contendId
,
startTime
,
endTime
,
size
,
true
));
return
ResponseResult
.
success
(
channelService
.
getNegativeChannelList
(
contendId
,
startTime
,
endTime
,
size
,
sorter
,
true
));
}
}
@ApiOperation
(
"渠道库-渠道申请"
)
@ApiOperation
(
"渠道库-渠道申请"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppCrisisController.java
View file @
1262ce68
...
@@ -26,6 +26,8 @@ import org.springframework.web.client.RestTemplate;
...
@@ -26,6 +26,8 @@ import org.springframework.web.client.RestTemplate;
@RequestMapping
(
"/app/crisis"
)
@RequestMapping
(
"/app/crisis"
)
@Api
(
tags
=
"前台危机库"
,
description
=
"提供前台危机相关信息展示"
)
@Api
(
tags
=
"前台危机库"
,
description
=
"提供前台危机相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
@Deprecated
// 2023/9/7 全部迁移至事件模块
public
class
AppCrisisController
extends
BaseController
{
public
class
AppCrisisController
extends
BaseController
{
@Value
(
"${crisis.searchTags.url}"
)
@Value
(
"${crisis.searchTags.url}"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppDownloadController.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.aop.LogRecord
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.dto.*
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.WholeSearchRecord
;
import
com.zhiwei.brandkbs2.pojo.dto.*
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
io.swagger.annotations.*
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
"/app/download"
)
@Api
(
tags
=
"下载功能"
,
description
=
"提供项目所有的下载内容"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
AppDownloadController
extends
BaseController
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
AppDownloadController
.
class
);
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@Resource
(
name
=
"highlightWordServiceImpl"
)
HighlightWordService
highlightWordService
;
@Resource
(
name
=
"highWordServiceImpl"
)
HighWordService
highWordService
;
@Resource
(
name
=
"behaviorServiceImpl"
)
private
BehaviorService
behaviorService
;
@Resource
(
name
=
"channelServiceImpl"
)
ChannelService
channelService
;
@Resource
(
name
=
"wholeSearchServiceImpl"
)
private
WholeSearchService
wholeSearchService
;
@Resource
(
name
=
"markDataServiceImpl"
)
MarkDataService
markDataService
;
@Resource
(
name
=
"commonServiceImpl"
)
CommonService
commonService
;
@Value
(
"${qbjc.interface.url}"
)
private
String
yuqingInterface
;
@Value
(
"${qbjc.interface.upload.token}"
)
private
String
token
;
@Value
(
"${brandkbs.file.url}"
)
private
String
brandkbsFilePath
;
@Autowired
private
RestTemplate
restTemplate
;
@ApiOperation
(
"稿件模板"
)
@ApiImplicitParams
(
@ApiImplicitParam
(
name
=
"contendId"
,
value
=
"品牌id"
,
paramType
=
"query"
,
dataType
=
"string"
))
@GetMapping
(
"/back/template/article"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadTemplateForm
(
@RequestParam
(
defaultValue
=
"0"
)
String
contendId
)
{
try
{
AbstractProject
project
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
contendId
);
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
getHeaders
());
HttpEntity
<
org
.
springframework
.
core
.
io
.
Resource
>
entity
=
restTemplate
.
exchange
(
yuqingInterface
+
"/upload/template/form?projectId="
+
project
.
getBrandLinkedGroupId
(),
HttpMethod
.
GET
,
requestEntity
,
org
.
springframework
.
core
.
io
.
Resource
.
class
);
// excel写入至指定路径
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
project
.
getProjectName
(),
UserThreadLocal
.
getNickname
(),
project
.
getBrandName
()
+
"_稿件模板"
);
if
(
null
!=
entity
.
getBody
())
{
EasyExcelUtil
.
write
(
filePath
,
entity
.
getBody
().
getInputStream
());
}
return
ResponseResult
.
success
(
filePath
);
}
catch
(
Exception
e
)
{
log
.
error
(
"稿件上传-稿件模板下载异常"
,
e
);
return
ResponseResult
.
failure
(
"稿件上传-稿件模板下载异常"
);
}
}
@ApiOperation
(
"表格上传信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"formType"
,
value
=
"表格类型:上传失败/上传成功"
,
paramType
=
"body"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"id"
,
value
=
"任务id"
,
paramType
=
"body"
,
dataType
=
"string"
)})
@PostMapping
(
value
=
"/back/template/form"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadUploadList
(
@RequestBody
JSONObject
info
)
{
try
{
String
id
=
info
.
getString
(
"id"
);
String
formType
=
info
.
getString
(
"formType"
);
HttpEntity
<
JSONObject
>
requestEntity
=
new
HttpEntity
<>(
getHeaders
());
HttpEntity
<
org
.
springframework
.
core
.
io
.
Resource
>
entity
=
restTemplate
.
exchange
(
yuqingInterface
+
"/upload/list/download/file/"
+
id
+
"?formType="
+
formType
,
HttpMethod
.
GET
,
requestEntity
,
org
.
springframework
.
core
.
io
.
Resource
.
class
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectVOById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
id
+
"_"
+
formType
);
if
(
null
!=
entity
.
getBody
())
{
EasyExcelUtil
.
write
(
filePath
,
entity
.
getBody
().
getInputStream
());
}
return
ResponseResult
.
success
(
filePath
);
}
catch
(
Exception
e
)
{
log
.
error
(
"稿件上传-下载表格上传信息"
,
e
);
return
ResponseResult
.
failure
(
"稿件上传下载表格上传信息"
);
}
}
@ApiOperation
(
"高频关键词"
)
@GetMapping
(
value
=
"/back/module/high-word"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadHighWord
()
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
List
<
ExportWordDTO
>
list
=
highWordService
.
downloadWord
(
projectId
);
ProjectVO
projectVO
=
projectService
.
getProjectVOById
(
projectId
);
// excel写入至指定路径
String
projectName
=
projectVO
.
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
projectVO
.
getBrandName
()
+
"_高频关键词"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportWordDTO
.
class
,
list
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"舆情列表高亮关键词"
)
@GetMapping
(
value
=
"/back/module/highlight-word"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadHighlightWord
()
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
List
<
ExportWordDTO
>
list
=
highlightWordService
.
downloadWord
(
projectId
);
ProjectVO
projectVO
=
projectService
.
getProjectVOById
(
projectId
);
// excel写入至指定路径
String
projectName
=
projectVO
.
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
projectVO
.
getBrandName
()
+
"_舆情列表高亮关键词"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportWordDTO
.
class
,
list
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"用户行为列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"behavior"
,
value
=
"行为所属(前台=false,后台=true)"
,
defaultValue
=
"true"
,
paramType
=
"query"
,
dataType
=
"boolean"
)
})
@GetMapping
(
"/back/behavior/behavior"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
download
(
@RequestParam
(
"startTime"
)
long
startTime
,
@RequestParam
(
"endTime"
)
long
endTime
,
@RequestParam
(
value
=
"behavior"
,
defaultValue
=
"true"
)
boolean
behavior
)
{
List
<
ExportBehaviorDTO
>
downloadList
=
behaviorService
.
download
(
startTime
,
endTime
,
behavior
);
String
behaviorName
=
behavior
?
"后台"
:
"前台"
;
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
behaviorName
+
"_用户行为"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportBehaviorDTO
.
class
,
downloadList
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"用户操作记录列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
})
@GetMapping
(
"/back/behavior/log-record"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadLogRecordList
(
@RequestParam
(
"startTime"
)
long
startTime
,
@RequestParam
(
"endTime"
)
long
endTime
)
{
List
<
ExportUserLogRecordDTO
>
list
=
behaviorService
.
downloadUserLogRecord
(
startTime
,
endTime
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
"操作记录"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportUserLogRecordDTO
.
class
,
list
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"渠道列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"contendId"
,
value
=
"品牌id"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"emotion"
,
value
=
"倾向筛选"
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"platform"
,
value
=
"平台筛选"
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"show"
,
value
=
"是否展示"
,
paramType
=
"query"
,
dataType
=
"boolean"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键字搜索"
,
paramType
=
"query"
,
dataType
=
"string"
)
})
@GetMapping
(
"/back/channel/list"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadChannelList
(
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
""
)
String
emotion
,
@RequestParam
(
value
=
"platform"
,
defaultValue
=
""
)
String
platform
,
@RequestParam
(
value
=
"show"
,
required
=
false
)
Boolean
show
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
List
<
ExportChannelDTO
>
downloadChannelList
=
channelService
.
findDownloadChannelList
(
contendId
,
emotion
,
platform
,
show
,
keyword
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
"渠道列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportChannelDTO
.
class
,
downloadChannelList
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"渠道稿件列表"
)
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"渠道ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"String"
)
@GetMapping
(
"/back/channel/article"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadArticleList
(
@RequestParam
(
value
=
"channelId"
)
String
channelId
)
{
List
<
ExportAdminChannelArticleDTO
>
downloadChannelArticleList
=
channelService
.
findDownloadChannelArticleList
(
channelId
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
channelId
+
"_渠道稿件列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
channelId
,
ExportAdminChannelArticleDTO
.
class
,
downloadChannelArticleList
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"渠道事件列表"
)
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"渠道ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"String"
)
@GetMapping
(
"/back/channel/event"
)
@Auth
(
role
=
RoleEnum
.
COMMON_ADMIN
)
public
ResponseResult
downloadEventList
(
@RequestParam
(
value
=
"channelId"
)
String
channelId
)
{
List
<
ExportAdminChannelEventDTO
>
downloadChannelEventList
=
channelService
.
findDownloadChannelEventList
(
channelId
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
channelId
+
"_渠道事件列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
channelId
,
ExportAdminChannelEventDTO
.
class
,
downloadChannelEventList
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"全网搜使用记录"
)
@PostMapping
(
"/back/search-whole/used"
)
@Auth
(
role
=
RoleEnum
.
ADMIN
)
public
ResponseResult
downloadUseList
(
@ApiParam
(
name
=
"json:{personal:个人明细=true,startTime:起始时间,endTime:结束时间,day:颗粒度天级=true}"
)
@RequestBody
JSONObject
json
)
{
boolean
personal
=
json
.
getBooleanValue
(
"personal"
);
Long
startTime
=
json
.
getLong
(
"startTime"
);
Long
endTime
=
json
.
getLong
(
"endTime"
);
boolean
day
=
json
.
getBooleanValue
(
"day"
);
List
<
JSONObject
>
collect
=
wholeSearchService
.
outputUsedList
(
personal
,
startTime
,
endTime
,
day
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
startTime
+
"_"
+
endTime
+
"使用记录"
);
if
(
personal
)
{
List
<
ExportWholeSearchRecordDTO
>
list
=
collect
.
stream
().
map
(
ExportWholeSearchRecordDTO:
:
createFromJSONObject
).
collect
(
Collectors
.
toList
());
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportWholeSearchRecordDTO
.
class
,
list
);
}
else
{
List
<
ExportLineDTO
>
list
=
collect
.
stream
().
map
(
ExportLineDTO:
:
createFromJSONObject
).
collect
(
Collectors
.
toList
());
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportLineDTO
.
class
,
list
);
}
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"项目关键词"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@GetMapping
(
"/back/project/keyword/{pid}"
)
@Auth
(
role
=
RoleEnum
.
SUPER_ADMIN
)
public
ResponseResult
downloadArticles
(
@PathVariable
(
"pid"
)
String
pid
)
{
ProjectVO
project
=
projectService
.
getProjectVOById
(
pid
);
// excel写入至指定路径
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
project
.
getProjectName
(),
UserThreadLocal
.
getNickname
(),
project
.
getBrandName
()
+
"_命中关键词"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
UploadKeywordDTO
.
class
,
UploadKeywordDTO
.
change2This
(
project
.
getHitKeywords
()));
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"舆情库原始数据"
)
@PostMapping
(
value
=
"/yuqing/origin"
)
@LogRecord
(
description
=
"舆情库-原始数据导出"
,
values
=
{
"startTime"
,
"endTime"
,
"keyword"
,
"platforms"
,
"searchField"
},
entity
=
true
,
arguments
=
true
)
public
ResponseResult
exportOriginList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
stringListPair
=
markDataService
.
downloadYuqingMarkList
(
markSearchDTO
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
stringListPair
.
getLeft
()
+
"_原始数据列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportAppYuqingDTO
.
class
,
stringListPair
.
getRight
());
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"舆情库有效舆情数据"
)
@PostMapping
(
value
=
"/yuqing/mark"
)
@LogRecord
(
description
=
"舆情库-有效舆情导出"
,
values
=
{
"startTime"
,
"endTime"
,
"customTags"
,
"field"
,
"keyword"
,
"politicsLevel"
,
"mainBodyType"
,
"platforms"
,
"region"
,
"tags"
},
entity
=
true
,
arguments
=
true
)
public
ResponseResult
exportYuqingMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
stringListPair
=
markDataService
.
downloadYuqingMarkList
(
markSearchDTO
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
stringListPair
.
getLeft
()
+
"_舆情列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportAppYuqingDTO
.
class
,
stringListPair
.
getRight
());
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"渠道库文章列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"渠道ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"contendId"
,
value
=
"品牌ID"
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"string"
)
})
@GetMapping
(
"/channel/article"
)
public
ResponseResult
downloadArticles
(
@RequestParam
(
value
=
"startTime"
)
long
startTime
,
@RequestParam
(
value
=
"endTime"
)
long
endTime
,
@RequestParam
(
"channelId"
)
String
channelId
,
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
)
{
List
<
ExportAppChannelArticleDTO
>
exportAppChannelArticleDTOS
=
channelService
.
downloadArticlesByTime
(
startTime
,
endTime
,
channelId
,
contendId
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
channelId
+
"稿件列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportAppChannelArticleDTO
.
class
,
exportAppChannelArticleDTOS
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"渠道库事件列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"渠道ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"contendId"
,
value
=
"竞品ID"
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"string"
)
})
@GetMapping
(
"/channel/event"
)
public
ResponseResult
downloadEvents
(
@RequestParam
(
value
=
"startTime"
)
long
startTime
,
@RequestParam
(
value
=
"endTime"
)
long
endTime
,
@RequestParam
(
"channelId"
)
String
channelId
,
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
)
{
List
<
ExportAppChannelEventDTO
>
exportAppChannelEventDTOS
=
channelService
.
downloadEventsByTime
(
startTime
,
endTime
,
channelId
,
contendId
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
channelId
+
"事件列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportAppChannelEventDTO
.
class
,
exportAppChannelEventDTOS
);
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"竞品库竞品舆情"
)
@PostMapping
(
value
=
"/contend/mark"
)
public
ResponseResult
exportContendMarkList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
Pair
<
String
,
List
<
ExportAppYuqingDTO
>>
stringListPair
=
markDataService
.
downloadContendMarkList
(
markSearchDTO
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
"舆情列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportAppYuqingDTO
.
class
,
stringListPair
.
getRight
());
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"全网搜舆情"
)
@PostMapping
(
"/search-whole"
)
@LogRecord
(
description
=
"全网搜-舆情导出"
,
values
=
{
"startTime"
,
"endTime"
,
"fans"
,
"filterType"
,
"filterWords"
,
"search"
,
"keyword"
,
"platforms"
,
"sensitiveChannels"
,
"sourceKeyword"
},
entity
=
true
,
arguments
=
true
)
public
ResponseResult
exportSearchWhole
(
@RequestBody
SearchFilterDTO
dto
)
{
// 针对商业数据库做限制
if
(
dto
.
isExternalDataSource
())
{
long
time
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
();
if
(
time
>
dto
.
getStartTime
())
{
// 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制
return
ResponseResult
.
failure
(
"仅能导出近3个月内信息"
);
}
Period
periodDay
=
new
Period
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
PeriodType
.
days
());
if
(
periodDay
.
getDays
()
>
30
)
{
// 仅对查商业数据库时限制时间,查舆情库时本质上无时间限制
return
ResponseResult
.
failure
(
"时间跨度不能超过30天"
);
}
if
(
dto
.
getOutputCount
()
>=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getWholeSearchBalance
())
{
return
ResponseResult
.
failure
(
"实时采集余额不足"
);
}
}
List
<
ExportSearchWholeDTO
>
exportList
=
markDataService
.
exportSearchWhole
(
dto
);
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
"全网搜舆情列表数据"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportSearchWholeDTO
.
class
,
exportList
);
if
(
dto
.
isExternalDataSource
())
{
wholeSearchService
.
decreaseRecord
(
dto
.
getSearch
(),
WholeSearchRecord
.
UsedType
.
output
,
exportList
.
size
());
}
return
ResponseResult
.
success
(
filePath
);
}
@ApiOperation
(
"摘要提取批量模板"
)
@GetMapping
(
value
=
"/article-summary/template"
)
public
ResponseResult
downloadArticleSummaryTemplate
()
{
List
<
List
<
String
>>
head
=
new
ArrayList
<>();
head
.
add
(
Collections
.
singletonList
(
"序号"
));
head
.
add
(
Collections
.
singletonList
(
"链接"
));
head
.
add
(
Collections
.
singletonList
(
"文章内容"
));
// excel写入至指定路径
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
projectName
,
UserThreadLocal
.
getNickname
(),
"摘要提取批量模板"
);
EasyExcelUtil
.
dynamicHeadWrite
(
filePath
,
"模板"
,
head
,
Collections
.
emptyList
());
return
ResponseResult
.
success
(
filePath
);
}
private
HttpHeaders
getHeaders
()
{
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
set
(
"token"
,
token
);
httpHeaders
.
set
(
"Content-Type"
,
"application/json"
);
return
httpHeaders
;
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppEventController.java
View file @
1262ce68
...
@@ -52,6 +52,18 @@ public class AppEventController extends BaseController {
...
@@ -52,6 +52,18 @@ public class AppEventController extends BaseController {
@Value
(
"${ef.checkCaptcha.url}"
)
@Value
(
"${ef.checkCaptcha.url}"
)
private
String
efCheckCaptchaUrl
;
private
String
efCheckCaptchaUrl
;
@Value
(
"${crisis.top3.url}"
)
private
String
crisisTop3Url
;
@Value
(
"${crisis.searchCriteria.url}"
)
private
String
crisisSearchCriteriaUrl
;
@Value
(
"${crisis.list.url}"
)
private
String
crisisListUrl
;
@Value
(
"${crisis.share.url}"
)
private
String
crisisEventShareUrl
;
private
final
EventService
eventService
;
private
final
EventService
eventService
;
public
AppEventController
(
EventService
eventService
)
{
public
AppEventController
(
EventService
eventService
)
{
...
@@ -105,7 +117,7 @@ public class AppEventController extends BaseController {
...
@@ -105,7 +117,7 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
eventService
.
getEventTopArticlesAnalysis
(
id
,
type
,
emotion
,
aggTitle
));
return
ResponseResult
.
success
(
eventService
.
getEventTopArticlesAnalysis
(
id
,
type
,
emotion
,
aggTitle
));
}
}
@ApiOperation
(
"前台事件库-全网事件库-搜索"
)
@ApiOperation
(
"前台事件库-全网事件库-
行业热点-
搜索"
)
@GetMapping
(
"/getWholeNetworkEvents"
)
@GetMapping
(
"/getWholeNetworkEvents"
)
public
ResponseResult
getWholeNetworkEvents
(
@RequestParam
(
"keyword"
)
String
keyword
,
public
ResponseResult
getWholeNetworkEvents
(
@RequestParam
(
"keyword"
)
String
keyword
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
)
{
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
)
{
...
@@ -115,7 +127,7 @@ public class AppEventController extends BaseController {
...
@@ -115,7 +127,7 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
jsonObject
);
return
ResponseResult
.
success
(
jsonObject
);
}
}
@ApiOperation
(
"前台事件库-全网事件库-搜索条件"
)
@ApiOperation
(
"前台事件库-全网事件库-
行业热点-
搜索条件"
)
@GetMapping
(
"/getWholeNetworkSearchCriteria"
)
@GetMapping
(
"/getWholeNetworkSearchCriteria"
)
public
ResponseResult
getWholeNetworkSearchCriteria
()
{
public
ResponseResult
getWholeNetworkSearchCriteria
()
{
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
getEfSearchCriteriaUrl
,
String
.
class
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
getEfSearchCriteriaUrl
,
String
.
class
);
...
@@ -123,8 +135,8 @@ public class AppEventController extends BaseController {
...
@@ -123,8 +135,8 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
jsonObject
);
return
ResponseResult
.
success
(
jsonObject
);
}
}
@ApiOperation
(
"前台事件库-全网事件库-列表"
)
@ApiOperation
(
"前台事件库-全网事件库-
行业热点-
列表"
)
@LogRecord
(
description
=
"事件库-全网事件库"
)
@LogRecord
(
description
=
"事件库-全网事件库
-行业热点
"
)
@GetMapping
(
"/getWholeNetworkEventsList"
)
@GetMapping
(
"/getWholeNetworkEventsList"
)
public
ResponseResult
getWholeNetworkEventsList
(
@RequestParam
(
value
=
"firstType"
,
required
=
false
,
defaultValue
=
""
)
String
firstType
,
public
ResponseResult
getWholeNetworkEventsList
(
@RequestParam
(
value
=
"firstType"
,
required
=
false
,
defaultValue
=
""
)
String
firstType
,
@RequestParam
(
value
=
"start"
,
required
=
false
,
defaultValue
=
"0"
)
long
start
,
@RequestParam
(
value
=
"start"
,
required
=
false
,
defaultValue
=
"0"
)
long
start
,
...
@@ -135,7 +147,7 @@ public class AppEventController extends BaseController {
...
@@ -135,7 +147,7 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
jsonObject
);
return
ResponseResult
.
success
(
jsonObject
);
}
}
@ApiOperation
(
"前台事件库-全网事件库-得到验证码"
)
@ApiOperation
(
"前台事件库-全网事件库-
行业热点-
得到验证码"
)
@GetMapping
(
"/getWholeNetworkCaptcha"
)
@GetMapping
(
"/getWholeNetworkCaptcha"
)
public
ResponseResult
getWholeNetworkCaptcha
()
{
public
ResponseResult
getWholeNetworkCaptcha
()
{
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
efCaptchaUrl
,
String
.
class
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
efCaptchaUrl
,
String
.
class
);
...
@@ -143,7 +155,7 @@ public class AppEventController extends BaseController {
...
@@ -143,7 +155,7 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
jsonObject
);
return
ResponseResult
.
success
(
jsonObject
);
}
}
@ApiOperation
(
"前台事件库-全网事件库-校验验证码"
)
@ApiOperation
(
"前台事件库-全网事件库-
行业热点-
校验验证码"
)
@GetMapping
(
"/checkWholeNetworkCaptcha"
)
@GetMapping
(
"/checkWholeNetworkCaptcha"
)
public
ResponseResult
checkWholeNetworkCaptcha
(
@RequestParam
(
value
=
"id"
,
required
=
false
,
defaultValue
=
""
)
String
id
,
public
ResponseResult
checkWholeNetworkCaptcha
(
@RequestParam
(
value
=
"id"
,
required
=
false
,
defaultValue
=
""
)
String
id
,
@RequestParam
(
value
=
"captcha"
,
required
=
false
,
defaultValue
=
""
)
String
captcha
)
{
@RequestParam
(
value
=
"captcha"
,
required
=
false
,
defaultValue
=
""
)
String
captcha
)
{
...
@@ -152,6 +164,43 @@ public class AppEventController extends BaseController {
...
@@ -152,6 +164,43 @@ public class AppEventController extends BaseController {
return
ResponseResult
.
success
(
jsonObject
);
return
ResponseResult
.
success
(
jsonObject
);
}
}
@ApiOperation
(
"前台事件库-全网事件库-企业危机-近期热点危机"
)
@GetMapping
(
"/recentHotCrisis"
)
public
ResponseResult
recentHotCrisis
(){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisTop3Url
,
String
.
class
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"前台事件库-全网事件库-企业危机-危机搜索条件"
)
@GetMapping
(
"/crisisSearchCriteria"
)
public
ResponseResult
crisisSearchCriteria
(){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisSearchCriteriaUrl
,
String
.
class
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"前台事件库-全网事件库-企业危机-危机库列表"
)
@LogRecord
(
description
=
"事件库-全网事件库-企业危机"
)
@GetMapping
(
"/crisisList"
)
public
ResponseResult
crisisList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
,
@RequestParam
(
value
=
"category"
,
defaultValue
=
"不限"
)
String
category
){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisListUrl
,
String
.
class
,
page
,
pageSize
,
startTime
,
endTime
,
category
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"前台事件库-全网事件库-企业危机-获取危机事件分享id"
)
@GetMapping
(
"/getCrisisEventShareId/{id}"
)
public
ResponseResult
getCrisisEventShareId
(
@PathVariable
int
id
){
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
crisisEventShareUrl
,
String
.
class
,
id
);
Object
data
=
JSON
.
parseObject
(
responseEntity
.
getBody
()).
get
(
"data"
);
return
ResponseResult
.
success
(
data
);
}
@ApiOperation
(
"关联事件"
)
@ApiOperation
(
"关联事件"
)
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键词"
,
paramType
=
"query"
,
dataType
=
"String"
)
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键词"
,
paramType
=
"query"
,
dataType
=
"String"
)
@GetMapping
(
"/getRelevanceEvent"
)
@GetMapping
(
"/getRelevanceEvent"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppToolsetController.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.aop.LogRecord
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportArticleSummaryDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadArticleSummaryDTO
;
import
com.zhiwei.brandkbs2.easyexcel.listener.ArticleSummaryListener
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.Project
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.util.*
;
/**
* @author cjz
* @ClassName AppToolsetController
* @Description 提供前台工具集相关接口
* @date 2023-09-14 10:27
*/
@RestController
@RequestMapping
(
"/app/toolset"
)
@Api
(
tags
=
"工具集"
,
description
=
"工具集"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
AppToolsetController
{
@Resource
(
name
=
"redisUtil"
)
private
RedisUtil
redisUtil
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${toolset.articleSummary.url}"
)
private
String
articleSummaryUrl
;
@Value
(
"${toolset.articleInfo.url}"
)
private
String
articleInfoUrl
;
@Value
(
"${brandkbs.file.url}"
)
private
String
brandkbsFilePath
;
private
static
final
String
TEXT_SUMMARY_PREVIOUS
=
"作为一名公关人员,将文章进行简短的中文摘要,摘要文字中需包括日期、地点等核心要素,其中日期不用包括年份,摘要起始必须为日期,字数少于150个字\n文章:\n"
;
private
static
final
int
ARTICLE_SUMMARY_LIMIT
=
1000
;
@ApiOperation
(
"摘要提取-单条"
)
@GetMapping
(
"/article-summary/single"
)
@LogRecord
(
description
=
"工具库-摘要提取-单条"
)
public
ResponseResult
getSingleArticleSummary
(
@RequestParam
(
value
=
"url"
)
String
url
)
{
JSONObject
res
=
new
JSONObject
();
JSONObject
info
=
getUrlInfo
(
url
,
UserThreadLocal
.
getProjectId
());
if
(
Objects
.
isNull
(
info
)){
return
ResponseResult
.
failure
(
"链接解析异常"
);
}
String
text
=
info
.
getString
(
"content"
);
String
articleSummaryResult
=
getArticleSummaryResult
(
text
);
// 剩余次数限制
String
redisKey
=
RedisUtil
.
getToolsetArticleSummaryLimitKey
(
UserThreadLocal
.
getProjectId
(),
UserThreadLocal
.
getUserId
());
String
redisResult
=
redisUtil
.
get
(
redisKey
);
int
usedCount
=
1
;
if
(
Objects
.
nonNull
(
redisResult
)){
int
redisCount
=
Integer
.
parseInt
(
redisResult
);
if
(
redisCount
>=
ARTICLE_SUMMARY_LIMIT
){
return
ResponseResult
.
failure
(
"本日摘要提取次数已达上限"
);
}
usedCount
=
redisCount
+
1
;
redisUtil
.
getAndSet
(
redisKey
,
String
.
valueOf
(
usedCount
));
}
else
{
redisUtil
.
setExpire
(
redisKey
,
String
.
valueOf
(
usedCount
));
}
res
.
put
(
"source"
,
info
.
get
(
"source"
));
res
.
put
(
"platform"
,
info
.
getString
(
"platform"
));
res
.
put
(
"time"
,
info
.
getLong
(
"time"
));
res
.
put
(
"text"
,
articleSummaryResult
);
res
.
put
(
"remainingCount"
,
ARTICLE_SUMMARY_LIMIT
-
usedCount
);
return
ResponseResult
.
success
(
res
);
}
@ApiOperation
(
"摘要提取"
)
@PostMapping
(
"/article-summary/batch"
)
@LogRecord
(
description
=
"工具库-摘要提取-批量"
)
public
ResponseResult
getBatchArticleSummary
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
){
JSONObject
res
=
new
JSONObject
();
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
// 调用前剩余可用次数
String
redisKey
=
RedisUtil
.
getToolsetArticleSummaryLimitKey
(
UserThreadLocal
.
getProjectId
(),
UserThreadLocal
.
getUserId
());
String
redisResult
=
redisUtil
.
get
(
redisKey
);
int
remainingCount
=
ARTICLE_SUMMARY_LIMIT
;
if
(
Objects
.
nonNull
(
redisResult
)){
remainingCount
=
ARTICLE_SUMMARY_LIMIT
-
Integer
.
parseInt
(
redisResult
);
}
if
(
remainingCount
<=
0
){
return
ResponseResult
.
failure
(
"本日摘要提取次数已达上限"
);
}
// excel信息提取
Map
<
String
,
String
>
map
=
new
LinkedHashMap
<>(
50
);
ReadExcelDTO
<
UploadArticleSummaryDTO
>
readExcel
=
new
ReadExcelDTO
<>();
readExcel
.
setClazz
(
UploadArticleSummaryDTO
.
class
);
readExcel
.
setAnalysisEventListener
(
new
ArticleSummaryListener
(
map
,
remainingCount
));
EasyExcelUtil
.
read
(
file
,
readExcel
);
int
usedCount
=
0
;
// 本次批量调用次数
List
<
ExportArticleSummaryDTO
>
datas
=
new
ArrayList
<>(
50
);
// 摘要提取
for
(
Map
.
Entry
<
String
,
String
>
entry
:
map
.
entrySet
())
{
String
text
=
entry
.
getValue
();
String
url
=
entry
.
getKey
();
// 文章内容空时,通过链接提取文章内容
if
(
Objects
.
isNull
(
text
)
&&
Objects
.
nonNull
(
url
)){
JSONObject
json
=
getUrlInfo
(
entry
.
getKey
(),
UserThreadLocal
.
getProjectId
());
text
=
Objects
.
nonNull
(
json
)
?
json
.
getString
(
"content"
)
:
null
;
}
String
articleSummaryResult
=
getArticleSummaryResult
(
text
);
usedCount
=
usedCount
+
1
;
datas
.
add
(
new
ExportArticleSummaryDTO
(
String
.
valueOf
(
usedCount
),
entry
.
getKey
(),
entry
.
getValue
(),
articleSummaryResult
));
}
// 本次批量调用后剩余次数
remainingCount
=
remainingCount
-
usedCount
;
// 更新已用次数
redisUtil
.
getAndSet
(
redisKey
,
String
.
valueOf
(
ARTICLE_SUMMARY_LIMIT
-
remainingCount
));
// excel输出到指定路径
String
filePath
=
EasyExcelUtil
.
generateExcelFilePath
(
brandkbsFilePath
,
project
.
getProjectName
(),
UserThreadLocal
.
getNickname
(),
"摘要提取结果"
);
EasyExcelUtil
.
write
(
filePath
,
"sheet1"
,
ExportArticleSummaryDTO
.
class
,
datas
);
res
.
put
(
"filePath"
,
filePath
);
res
.
put
(
"remainingCount"
,
remainingCount
);
return
ResponseResult
.
success
(
res
);
}
@ApiOperation
(
"摘要提取-剩余可用次数"
)
@GetMapping
(
"/article-summary/remaining"
)
public
ResponseResult
getArticleSummaryRemainingCount
(){
String
redisKey
=
RedisUtil
.
getToolsetArticleSummaryLimitKey
(
UserThreadLocal
.
getProjectId
(),
UserThreadLocal
.
getUserId
());
String
redisResult
=
redisUtil
.
get
(
redisKey
);
if
(
Objects
.
nonNull
(
redisResult
)){
return
ResponseResult
.
success
(
ARTICLE_SUMMARY_LIMIT
-
Integer
.
parseInt
(
redisResult
));
}
return
ResponseResult
.
success
(
ARTICLE_SUMMARY_LIMIT
);
}
/**
* 链接信息提取
* @param url 链接
* @param projectId 项目id
* @return
*/
private
JSONObject
getUrlInfo
(
String
url
,
String
projectId
){
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
JSONObject
jsonObject
=
restTemplate
.
getForEntity
(
articleInfoUrl
,
JSONObject
.
class
,
url
,
linkedGroupId
,
UserThreadLocal
.
getNickname
()).
getBody
();
if
(
Objects
.
isNull
(
jsonObject
)
||
!
jsonObject
.
getBoolean
(
"status"
)){
return
null
;
}
return
jsonObject
.
getJSONObject
(
"data"
);
}
/**
* 获取摘要提取结果
* @param text 文本
* @return
*/
private
String
getArticleSummaryResult
(
String
text
){
if
(
Objects
.
isNull
(
text
)){
return
null
;
}
// 拼接提示词模板
String
resultText
=
TEXT_SUMMARY_PREVIOUS
+
StringUtils
.
substring
(
text
,
0
,
5000
);
// 请求参数 请求头
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
TEXT_PLAIN
);
HttpEntity
<
String
>
request
=
new
HttpEntity
<>(
resultText
,
headers
);
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
articleSummaryUrl
,
request
,
String
.
class
);
return
response
.
getBody
();
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppUserCenterController.java
View file @
1262ce68
...
@@ -4,7 +4,10 @@ import com.zhiwei.brandkbs2.auth.Auth;
...
@@ -4,7 +4,10 @@ import com.zhiwei.brandkbs2.auth.Auth;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.DownloadTask
;
import
com.zhiwei.brandkbs2.service.DownloadTaskService
;
import
com.zhiwei.brandkbs2.service.NoticeInfoService
;
import
com.zhiwei.brandkbs2.service.NoticeInfoService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
...
@@ -28,6 +31,9 @@ public class AppUserCenterController extends BaseController {
...
@@ -28,6 +31,9 @@ public class AppUserCenterController extends BaseController {
@Resource
(
name
=
"noticeInfoServiceImpl"
)
@Resource
(
name
=
"noticeInfoServiceImpl"
)
private
NoticeInfoService
noticeInfoService
;
private
NoticeInfoService
noticeInfoService
;
@Resource
(
name
=
"downloadTaskServiceImpl"
)
DownloadTaskService
downloadTaskService
;
@ApiOperation
(
"个人中心-系统通知-公告列表"
)
@ApiOperation
(
"个人中心-系统通知-公告列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
)})
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
)})
...
@@ -50,4 +56,30 @@ public class AppUserCenterController extends BaseController {
...
@@ -50,4 +56,30 @@ public class AppUserCenterController extends BaseController {
noticeInfoService
.
updateReadUserId
(
id
);
noticeInfoService
.
updateReadUserId
(
id
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
@ApiOperation
(
"任务中心-下拉选项列表"
)
@GetMapping
(
"/download-task/options"
)
public
ResponseResult
getDownloadTaskCriteria
()
{
return
ResponseResult
.
success
(
downloadTaskService
.
getDownloadTaskOptions
());
}
@ApiOperation
(
"任务中心-下载任务列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键词"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/download-task/list"
)
public
ResponseResult
getDownloadTaskList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
)
{
return
ResponseResult
.
success
(
downloadTaskService
.
getDownloadTaskList
(
page
,
size
,
keyword
));
}
@ApiOperation
(
"任务中心-下载"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"任务id"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@GetMapping
(
"/download-task/download/{id}"
)
public
ResponseResult
download
(
@PathVariable
String
id
)
{
DownloadTask
task
=
downloadTaskService
.
findTask
(
id
);
Tools
.
downloadFile
(
task
.
getFileAddress
(),
response
);
return
ResponseResult
.
success
();
}
}
}
src/main/java/com/zhiwei/brandkbs2/dao/DownloadTaskDao.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.zhiwei.brandkbs2.pojo.DownloadTask
;
import
org.springframework.data.mongodb.core.query.Query
;
import
java.util.List
;
/**
* @ClassName: NoticeInfoDao
* @Description NoticeInfoDao
* @author: cjz
* @date: 2023-08-08 14:49
*/
public
interface
DownloadTaskDao
extends
BaseMongoDao
<
DownloadTask
>{
List
<
String
>
findDistinct
(
Query
query
,
String
filed
);
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/DownloadTaskDaoImpl.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.DownloadTaskDao
;
import
com.zhiwei.brandkbs2.pojo.DownloadTask
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
(
"downloadTaskDao"
)
public
class
DownloadTaskDaoImpl
extends
BaseMongoDaoImpl
<
DownloadTask
>
implements
DownloadTaskDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_download_task"
;
public
DownloadTaskDaoImpl
()
{
super
(
COLLECTION_NAME
);
}
@Override
public
List
<
String
>
findDistinct
(
Query
query
,
String
filed
)
{
return
mongoTemplate
.
findDistinct
(
query
,
filed
,
COLLECTION_NAME
,
String
.
class
);
}
}
src/main/java/com/zhiwei/brandkbs2/easyexcel/EasyExcelUtil.java
View file @
1262ce68
...
@@ -8,14 +8,21 @@ import com.alibaba.excel.read.metadata.ReadSheet;
...
@@ -8,14 +8,21 @@ import com.alibaba.excel.read.metadata.ReadSheet;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.config.WriteExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.config.WriteExcelDTO
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.Channels
;
import
java.nio.channels.ReadableByteChannel
;
import
java.nio.channels.WritableByteChannel
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,6 +34,7 @@ import java.util.List;
...
@@ -27,6 +34,7 @@ import java.util.List;
*/
*/
public
class
EasyExcelUtil
{
public
class
EasyExcelUtil
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
EasyExcelUtil
.
class
);
private
static
final
Logger
log
=
LogManager
.
getLogger
(
EasyExcelUtil
.
class
);
private
EasyExcelUtil
()
{
private
EasyExcelUtil
()
{
}
}
...
@@ -106,6 +114,28 @@ public class EasyExcelUtil {
...
@@ -106,6 +114,28 @@ public class EasyExcelUtil {
}
}
/**
/**
* 写单个sheet
* @param filePath 文件路径
* @param input 文件输入流
*/
public
static
void
write
(
String
filePath
,
InputStream
input
){
try
{
FileOutputStream
output
=
new
FileOutputStream
(
filePath
);
ReadableByteChannel
inputChannel
=
Channels
.
newChannel
(
input
);
WritableByteChannel
outputChannel
=
Channels
.
newChannel
(
output
);
ByteBuffer
buffer
=
ByteBuffer
.
allocateDirect
(
10240
);
long
size
=
0
;
while
(
inputChannel
.
read
(
buffer
)
!=
-
1
)
{
buffer
.
flip
();
size
+=
outputChannel
.
write
(
buffer
);
buffer
.
clear
();
}
}
catch
(
Exception
e
){
log
.
error
(
"file:{},write error:"
,
filePath
,
e
);
}
}
/**
* 写多个sheet
* 写多个sheet
*
*
* @param filePath 文件路径
* @param filePath 文件路径
...
@@ -190,6 +220,18 @@ public class EasyExcelUtil {
...
@@ -190,6 +220,18 @@ public class EasyExcelUtil {
}
}
}
}
/**
* 生成excel路径
* @param filePath 文件保存路径
* @param projectName 项目名
* @param nickName 昵称
* @param fileName 文件名
* @return
*/
public
static
String
generateExcelFilePath
(
String
filePath
,
String
projectName
,
String
nickName
,
String
fileName
){
return
filePath
+
Tools
.
concat
(
projectName
,
nickName
,
System
.
currentTimeMillis
(),
fileName
)
+
".xlsx"
;
}
private
static
<
T
>
void
formatExcelExports
(
Class
<
T
>
clazz
,
List
<
T
>
datas
){
private
static
<
T
>
void
formatExcelExports
(
Class
<
T
>
clazz
,
List
<
T
>
datas
){
List
<
Field
>
stringFields
=
new
ArrayList
<>();
List
<
Field
>
stringFields
=
new
ArrayList
<>();
// 记录需要设置的部分
// 记录需要设置的部分
...
...
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/ExportArticleSummaryDTO.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
easyexcel
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
/**
* @author cjz
* @version 1.0
* @description 前台导出摘要提取结果实体类
* @date 2023/9/14 15:31
*/
@Data
@AllArgsConstructor
public
class
ExportArticleSummaryDTO
{
@ExcelProperty
(
"序号"
)
private
String
id
;
@ExcelProperty
(
"链接"
)
private
String
url
;
@ExcelProperty
(
"文章内容"
)
private
String
text
;
@ExcelProperty
(
"摘要提取结果"
)
private
String
result
;
}
src/main/java/com/zhiwei/brandkbs2/easyexcel/dto/UploadArticleSummaryDTO.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
easyexcel
.
dto
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
/**
* @author cjz
* @version 1.0
* @description 解析文章摘要提前上传文件
* @date 2023/9/14 14:22
*/
@Data
public
class
UploadArticleSummaryDTO
{
@ExcelProperty
(
"序号"
)
private
String
id
;
@ExcelProperty
(
"链接"
)
private
String
url
;
@ExcelProperty
(
"文章内容"
)
private
String
text
;
}
src/main/java/com/zhiwei/brandkbs2/easyexcel/listener/ArticleSummaryListener.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
easyexcel
.
listener
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadArticleSummaryDTO
;
import
java.util.Map
;
/**
* @ClassName: ArticleSummaryListener
* @Description 文章摘要提前文件批量上传监听类
* @author: cjz
* @date: 2023-09-14 14:44
*/
public
class
ArticleSummaryListener
extends
AnalysisEventListener
<
UploadArticleSummaryDTO
>
{
private
Map
<
String
,
String
>
map
;
private
int
remainingCount
;
public
ArticleSummaryListener
(
Map
<
String
,
String
>
map
,
int
remainingCount
){
this
.
map
=
map
;
this
.
remainingCount
=
remainingCount
;
}
@Override
public
void
invoke
(
UploadArticleSummaryDTO
data
,
AnalysisContext
context
)
{
if
(
map
.
size
()
<
remainingCount
&&
map
.
size
()
<=
50
)
{
map
.
put
(
data
.
getUrl
(),
data
.
getText
());
}
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/DownloadTask.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
/**
* @ClassName: DownloadTask
* @Description 下载任务
* @author: cjz
* @date: 2023-09-01 12:13
*/
@Getter
@Setter
@AllArgsConstructor
public
class
DownloadTask
extends
AbstractBaseMongo
{
/**
* 任务名
*/
private
String
taskName
;
/**
* 数据内容
*/
private
String
description
;
/**
* 进度
*/
private
Integer
schedule
;
/**
* 任务状态
*/
private
String
status
;
/**
* 文件地址
*/
private
String
fileAddress
;
/**
* 项目名
*/
private
String
project
;
/**
* 项目
*/
private
String
projectId
;
/**
* 用户id
*/
private
String
userId
;
/**
* nickname
*/
private
String
nickname
;
/**
* uTime 更新时间
*/
private
Long
uTime
;
/**
* cTime 创建时间
*/
private
Long
cTime
;
@Getter
public
enum
Status
{
GENERATING
(
"generating"
,
"生成中"
),
FINISH
(
"finish"
,
"完成"
),
FAILED
(
"failed"
,
"任务失败"
);
private
String
name
;
private
String
description
;
Status
(
String
name
,
String
description
){
this
.
name
=
name
;
this
.
description
=
description
;
}
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/Project.java
View file @
1262ce68
...
@@ -21,11 +21,6 @@ import java.util.Map;
...
@@ -21,11 +21,6 @@ import java.util.Map;
public
class
Project
extends
AbstractProject
{
public
class
Project
extends
AbstractProject
{
/**
/**
* 全网搜数据源(1:舆情库,2:商业数据库)
*/
private
Integer
wholeSearchDataSource
;
/**
* 数据起始时间(能够绑定关联关系的时间点)
* 数据起始时间(能够绑定关联关系的时间点)
*/
*/
private
Long
importTime
;
private
Long
importTime
;
...
@@ -106,7 +101,6 @@ public class Project extends AbstractProject {
...
@@ -106,7 +101,6 @@ public class Project extends AbstractProject {
projectVO
.
setId
(
this
.
getId
());
projectVO
.
setId
(
this
.
getId
());
// 主品牌
// 主品牌
projectVO
.
setProjectName
(
this
.
getProjectName
());
projectVO
.
setProjectName
(
this
.
getProjectName
());
projectVO
.
setWholeSearchDataSource
(
this
.
getWholeSearchDataSource
());
projectVO
.
setImportTime
(
new
Date
(
this
.
getImportTime
()));
projectVO
.
setImportTime
(
new
Date
(
this
.
getImportTime
()));
projectVO
.
setBrandName
(
this
.
getBrandName
());
projectVO
.
setBrandName
(
this
.
getBrandName
());
projectVO
.
setBrandLinkedGroup
(
this
.
getBrandLinkedGroup
());
projectVO
.
setBrandLinkedGroup
(
this
.
getBrandLinkedGroup
());
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/vo/ProjectVO.java
View file @
1262ce68
...
@@ -38,12 +38,6 @@ public class ProjectVO {
...
@@ -38,12 +38,6 @@ public class ProjectVO {
private
String
projectName
;
private
String
projectName
;
/**
/**
* 全网搜数据源(1:舆情库,2:商业数据库)
*/
@ApiModelProperty
(
"全网搜数据源(1:舆情库,2:商业数据库)"
)
private
Integer
wholeSearchDataSource
;
/**
* 数据起始时间
* 数据起始时间
*/
*/
@ApiModelProperty
(
"数据起始时间"
)
@ApiModelProperty
(
"数据起始时间"
)
...
@@ -149,7 +143,6 @@ public class ProjectVO {
...
@@ -149,7 +143,6 @@ public class ProjectVO {
}
else
{
}
else
{
project
.
setAvatarUrl
(
this
.
getAvatarUrl
());
project
.
setAvatarUrl
(
this
.
getAvatarUrl
());
}
}
project
.
setWholeSearchDataSource
(
this
.
getWholeSearchDataSource
());
project
.
setImportTime
(
this
.
getImportTime
().
getTime
());
project
.
setImportTime
(
this
.
getImportTime
().
getTime
());
project
.
setHasContend
(
null
!=
this
.
getContendList
());
project
.
setHasContend
(
null
!=
this
.
getContendList
());
project
.
setContendList
(
this
.
getContendList
().
stream
().
peek
(
contend
->
{
project
.
setContendList
(
this
.
getContendList
().
stream
().
peek
(
contend
->
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
View file @
1262ce68
...
@@ -169,7 +169,7 @@ public interface ChannelService {
...
@@ -169,7 +169,7 @@ public interface ChannelService {
* @param size 数据量
* @param size 数据量
* @return
* @return
*/
*/
JSONObject
getPositiveChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
boolean
cache
);
JSONObject
getPositiveChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
String
sorter
,
boolean
cache
);
/**
/**
* 新-敏感渠道榜
* 新-敏感渠道榜
...
@@ -179,7 +179,7 @@ public interface ChannelService {
...
@@ -179,7 +179,7 @@ public interface ChannelService {
* @param size 数据量
* @param size 数据量
* @return
* @return
*/
*/
JSONObject
getNegativeChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
boolean
cache
);
JSONObject
getNegativeChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
String
sorter
,
boolean
cache
);
/**
/**
* 收藏渠道
* 收藏渠道
...
...
src/main/java/com/zhiwei/brandkbs2/service/DownloadTaskService.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.DownloadTask
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
java.util.List
;
/**
* @ClassName: DownloadTaskService
* @Description 下载任务业务接口
* @author: cjz
* @date: 2023-09-04 10:32
*/
public
interface
DownloadTaskService
{
/**
* 新建下载任务
* @param taskName
* @param description
*/
String
createDownloadTask
(
String
taskName
,
String
description
);
/**
* 更新下载任务信息
* @param id
* @param schedule
* @param status
* @param fileAddress
*/
void
updateDownloadTask
(
String
id
,
Integer
schedule
,
String
status
,
String
fileAddress
);
/**
* 获取任务中心下拉选项
* @return
*/
List
<
String
>
getDownloadTaskOptions
();
/**
* 下载任务列表
* @param page
* @param size
* @return
*/
PageVO
<
JSONObject
>
getDownloadTaskList
(
int
page
,
int
size
,
String
keyword
);
/**
* 获取单个任务
* @param id
* @return
*/
DownloadTask
findTask
(
String
id
);
}
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
1262ce68
...
@@ -451,20 +451,20 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -451,20 +451,20 @@ public class ChannelServiceImpl implements ChannelService {
@Override
@Override
public
JSONObject
getActiveChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
boolean
cache
)
{
public
JSONObject
getActiveChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
boolean
cache
)
{
return
getChannelListCache
(
contendId
,
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getState
(),
size
,
cache
);
return
getChannelListCache
(
contendId
,
startTime
,
endTime
,
EmotionEnum
.
ALL
.
getState
(),
size
,
null
,
cache
);
}
}
@Override
@Override
public
JSONObject
getPositiveChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
boolean
cache
)
{
public
JSONObject
getPositiveChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
String
sorter
,
boolean
cache
)
{
return
getChannelListCache
(
contendId
,
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getState
(),
size
,
cache
);
return
getChannelListCache
(
contendId
,
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getState
(),
size
,
sorter
,
cache
);
}
}
@Override
@Override
public
JSONObject
getNegativeChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
boolean
cache
)
{
public
JSONObject
getNegativeChannelList
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
size
,
String
sorter
,
boolean
cache
)
{
return
getChannelListCache
(
contendId
,
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getState
(),
size
,
cache
);
return
getChannelListCache
(
contendId
,
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getState
(),
size
,
sorter
,
cache
);
}
}
private
JSONObject
getChannelListCache
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
emotion
,
int
size
,
boolean
cache
)
{
private
JSONObject
getChannelListCache
(
String
contendId
,
Long
startTime
,
Long
endTime
,
int
emotion
,
int
size
,
String
sorter
,
boolean
cache
)
{
JSONObject
res
=
new
JSONObject
();
JSONObject
res
=
new
JSONObject
();
try
{
try
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
...
@@ -474,7 +474,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -474,7 +474,7 @@ public class ChannelServiceImpl implements ChannelService {
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSONObject
.
parseObject
(
resultStr
);
return
JSONObject
.
parseObject
(
resultStr
);
}
}
res
=
getChannelList
(
projectId
,
contendId
,
startTime
,
endTime
,
emotion
,
size
);
res
=
getChannelList
(
projectId
,
contendId
,
startTime
,
endTime
,
emotion
,
s
orter
,
s
ize
);
// 配合天级缓存开启
// 配合天级缓存开启
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
res
));
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
res
));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -483,8 +483,8 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -483,8 +483,8 @@ public class ChannelServiceImpl implements ChannelService {
return
res
;
return
res
;
}
}
private
JSONObject
getChannelList
(
String
projectId
,
String
contendId
,
Long
startTime
,
Long
endTime
,
int
emotion
,
int
size
)
throws
IOException
{
private
JSONObject
getChannelList
(
String
projectId
,
String
contendId
,
Long
startTime
,
Long
endTime
,
int
emotion
,
String
sorter
,
int
size
)
throws
IOException
{
JSONObject
res
=
new
JSONObject
(
new
LinkedHashMap
<>()
);
JSONObject
res
=
new
JSONObject
(
true
);
Map
<
String
,
Pair
<
Long
,
ChannelRecord
>>
keyMap
=
new
HashMap
<>();
Map
<
String
,
Pair
<
Long
,
ChannelRecord
>>
keyMap
=
new
HashMap
<>();
EsClientDao
.
SearchHelper
searchHelper
=
createSearchHelperByChannelCriteria
(
projectId
,
Collections
.
singleton
(
contendId
),
startTime
,
endTime
,
true
);
EsClientDao
.
SearchHelper
searchHelper
=
createSearchHelperByChannelCriteria
(
projectId
,
Collections
.
singleton
(
contendId
),
startTime
,
endTime
,
true
);
// 分页查询所有结果
// 分页查询所有结果
...
@@ -519,15 +519,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -519,15 +519,7 @@ public class ChannelServiceImpl implements ChannelService {
return
channelRecord
;
return
channelRecord
;
}
}
return
null
;
return
null
;
}).
filter
(
Objects:
:
nonNull
).
sorted
((
x
,
y
)
->
{
}).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
groupingBy
(
ChannelRecord:
:
getPlatform
));
// 稿件数排序
if
(
x
.
getRecord
().
getArticles
().
size
()
>
y
.
getRecord
().
getArticles
().
size
())
{
return
-
1
;
}
else
if
(
Objects
.
equals
(
x
.
getRecord
().
getArticles
().
size
(),
y
.
getRecord
().
getArticles
().
size
()))
{
return
0
;
}
return
1
;
}).
collect
(
Collectors
.
groupingBy
(
ChannelRecord:
:
getPlatform
));
for
(
String
platformName
:
PLATFORMS
)
{
for
(
String
platformName
:
PLATFORMS
)
{
List
<
ChannelRecord
>
channelRecordList
=
channelRecords
.
getOrDefault
(
platformName
,
Collections
.
emptyList
()).
stream
().
limit
(
size
).
collect
(
Collectors
.
toList
());
List
<
ChannelRecord
>
channelRecordList
=
channelRecords
.
getOrDefault
(
platformName
,
Collections
.
emptyList
()).
stream
().
limit
(
size
).
collect
(
Collectors
.
toList
());
List
<
ChannelListVO
>
list
=
new
ArrayList
<>(
size
);
List
<
ChannelListVO
>
list
=
new
ArrayList
<>(
size
);
...
@@ -541,7 +533,14 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -541,7 +533,14 @@ public class ChannelServiceImpl implements ChannelService {
list
.
add
(
ChannelListVO
.
createFromChannel
(
record
,
record
.
getRecord
().
getArticles
().
size
()));
list
.
add
(
ChannelListVO
.
createFromChannel
(
record
,
record
.
getRecord
().
getArticles
().
size
()));
}
}
});
});
res
.
put
(
platformName
,
list
);
List
<
ChannelListVO
>
resList
;
// 排序
if
(
Objects
.
nonNull
(
sorter
)
&&
sorter
.
contains
(
"index"
)){
resList
=
list
.
stream
().
sorted
(
Comparator
.
comparingDouble
(
ChannelListVO:
:
getEmotionIndex
).
reversed
()).
collect
(
Collectors
.
toList
());
}
else
{
resList
=
list
.
stream
().
sorted
(
Comparator
.
comparingDouble
(
ChannelListVO:
:
getArticleCount
).
reversed
()).
collect
(
Collectors
.
toList
());
}
res
.
put
(
platformName
,
resList
);
}
}
return
res
;
return
res
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/DownloadTaskServiceImpl.java
0 → 100644
View file @
1262ce68
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.DownloadTaskDao
;
import
com.zhiwei.brandkbs2.pojo.DownloadTask
;
import
com.zhiwei.brandkbs2.pojo.Project
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.DownloadTaskService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
(
"downloadTaskServiceImpl"
)
public
class
DownloadTaskServiceImpl
implements
DownloadTaskService
{
@Resource
(
name
=
"downloadTaskDao"
)
DownloadTaskDao
downloadTaskDao
;
@Resource
(
name
=
"projectServiceImpl"
)
ProjectService
projectService
;
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
@Override
public
String
createDownloadTask
(
String
taskName
,
String
description
)
{
Project
project
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
());
long
now
=
System
.
currentTimeMillis
();
DownloadTask
task
=
new
DownloadTask
(
taskName
,
description
,
0
,
DownloadTask
.
Status
.
GENERATING
.
getName
(),
null
,
project
.
getProjectName
(),
project
.
getId
(),
UserThreadLocal
.
getUserId
(),
UserThreadLocal
.
getNickname
(),
now
,
now
);
downloadTaskDao
.
insertOne
(
task
);
return
task
.
getId
();
}
@Override
public
void
updateDownloadTask
(
String
id
,
Integer
schedule
,
String
status
,
String
fileAddress
)
{
DownloadTask
task
=
downloadTaskDao
.
findOneById
(
id
);
if
(
Objects
.
nonNull
(
schedule
)){
task
.
setSchedule
(
schedule
);
}
if
(
Objects
.
nonNull
(
status
)){
task
.
setStatus
(
status
);
}
if
(
Objects
.
nonNull
(
fileAddress
)){
task
.
setFileAddress
(
fileAddress
);
}
downloadTaskDao
.
updateOne
(
task
);
}
@Override
public
List
<
String
>
getDownloadTaskOptions
()
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"projectId"
).
is
(
UserThreadLocal
.
getProjectId
()));
query
.
addCriteria
(
Criteria
.
where
(
"userId"
).
is
(
UserThreadLocal
.
getUserId
()));
List
<
String
>
tasks
=
downloadTaskDao
.
findDistinct
(
query
,
"description"
);
return
tasks
.
stream
().
sorted
().
collect
(
Collectors
.
toList
());
}
@Override
public
PageVO
<
JSONObject
>
getDownloadTaskList
(
int
page
,
int
size
,
String
keyword
)
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"projectId"
).
is
(
UserThreadLocal
.
getProjectId
()));
query
.
addCriteria
(
Criteria
.
where
(
"userId"
).
is
(
UserThreadLocal
.
getUserId
()));
if
(
StringUtils
.
isNotBlank
(
keyword
))
{
query
.
addCriteria
(
Criteria
.
where
(
"description"
).
is
(
keyword
));
}
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"cTime"
));
long
total
=
downloadTaskDao
.
count
(
query
);
mongoUtil
.
start
(
page
,
size
,
query
);
List
<
DownloadTask
>
taskList
=
downloadTaskDao
.
findList
(
query
);
List
<
JSONObject
>
res
=
new
ArrayList
<>();
for
(
DownloadTask
task
:
taskList
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"id"
,
task
.
getId
());
jsonObject
.
put
(
"taskName"
,
task
.
getTaskName
());
jsonObject
.
put
(
"description"
,
task
.
getDescription
());
jsonObject
.
put
(
"schedule"
,
task
.
getSchedule
());
jsonObject
.
put
(
"status"
,
task
.
getStatus
());
jsonObject
.
put
(
"cTime"
,
task
.
getCTime
());
res
.
add
(
jsonObject
);
}
return
PageVO
.
createPageVo
(
total
,
page
,
size
,
res
);
}
@Override
public
DownloadTask
findTask
(
String
id
)
{
return
downloadTaskDao
.
findOneById
(
id
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/EsSearchServiceImpl.java
View file @
1262ce68
...
@@ -196,8 +196,10 @@ public class EsSearchServiceImpl implements EsSearchService {
...
@@ -196,8 +196,10 @@ public class EsSearchServiceImpl implements EsSearchService {
}
}
helper
.
setSort
(
sort
);
helper
.
setSort
(
sort
);
// from size
// from size
if
(
null
!=
dto
.
getPageSize
())
{
helper
.
setFrom
((
dto
.
getPage
()
-
1
)
*
dto
.
getPageSize
());
helper
.
setFrom
((
dto
.
getPage
()
-
1
)
*
dto
.
getPageSize
());
helper
.
setSize
(
dto
.
getPageSize
());
helper
.
setSize
(
dto
.
getPageSize
());
}
// HighlightBuilder ???
// HighlightBuilder ???
return
helper
;
return
helper
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
1262ce68
...
@@ -1121,24 +1121,8 @@ public class MarkDataServiceImpl implements MarkDataService {
...
@@ -1121,24 +1121,8 @@ public class MarkDataServiceImpl implements MarkDataService {
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
// 搜索时间
// 搜索时间
result
.
put
(
"times"
,
Arrays
.
asList
(
"今天"
,
"24小时"
,
"三天"
,
"七天"
,
"近30天"
));
result
.
put
(
"times"
,
Arrays
.
asList
(
"今天"
,
"24小时"
,
"三天"
,
"七天"
,
"近30天"
));
result
.
put
(
"ninetyDays"
,
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
());
result
.
put
(
"ninetyDays"
,
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
-
89
).
getTime
());
result
.
put
(
"platformList"
,
commonService
.
getQbjcPlatform
(
"id"
,
"name"
).
stream
().
filter
(
s
->
!
s
.
get
(
"name"
).
equals
(
"脉脉"
)).
collect
(
Collectors
.
toList
()));
List
<
JSONObject
>
platformList
=
new
ArrayList
<>();
if
(
2
==
project
.
getWholeSearchDataSource
())
{
result
.
put
(
"origin"
,
"商业"
);
JSONObject
backUpPlatform
=
getBackUpPlatform
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
backUpPlatform
.
entrySet
())
{
JSONObject
platformJSONObject
=
new
JSONObject
();
platformJSONObject
.
put
(
"name"
,
entry
.
getKey
());
platformJSONObject
.
put
(
"id"
,
entry
.
getValue
());
platformList
.
add
(
platformJSONObject
);
}
}
else
{
result
.
put
(
"origin"
,
"舆情"
);
platformList
=
commonService
.
getQbjcPlatform
(
"id"
,
"name"
).
stream
().
filter
(
s
->
!
s
.
get
(
"name"
).
equals
(
"脉脉"
)).
collect
(
Collectors
.
toList
());
}
result
.
put
(
"platformList"
,
platformList
);
return
result
;
return
result
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
1262ce68
...
@@ -155,10 +155,10 @@ public class TaskServiceImpl implements TaskService {
...
@@ -155,10 +155,10 @@ public class TaskServiceImpl implements TaskService {
channelService
.
getActiveChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
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
.
getPositiveChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
times
[
0
],
times
[
1
],
50
,
sorter
,
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
);
channelService
.
getNegativeChannelList
(
Constant
.
PRIMARY_CONTEND_ID
,
times
[
0
],
times
[
1
],
50
,
sorter
,
false
);
});
});
log
.
info
(
"项目:{}-渠道榜单缓存已完成:{}个"
,
project
.
getProjectName
(),
total
.
incrementAndGet
());
log
.
info
(
"项目:{}-渠道榜单缓存已完成:{}个"
,
project
.
getProjectName
(),
total
.
incrementAndGet
());
return
null
;
return
null
;
...
...
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
View file @
1262ce68
...
@@ -74,6 +74,10 @@ public class RedisUtil {
...
@@ -74,6 +74,10 @@ public class RedisUtil {
return
RedisKeyPrefix
.
PROJECT_WARN_NEW_CASE_CURSOR
+
projectId
;
return
RedisKeyPrefix
.
PROJECT_WARN_NEW_CASE_CURSOR
+
projectId
;
}
}
public
static
String
getToolsetArticleSummaryLimitKey
(
String
projectId
,
String
userId
){
return
RedisKeyPrefix
.
TOOLSET_ARTICLE_SUMMARY_LIMIT
+
Tools
.
concat
(
projectId
,
userId
);
}
public
void
setExpire
(
String
key
,
String
value
,
long
timeout
,
TimeUnit
unit
)
{
public
void
setExpire
(
String
key
,
String
value
,
long
timeout
,
TimeUnit
unit
)
{
stringRedisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
unit
);
stringRedisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
unit
);
}
}
...
@@ -93,6 +97,10 @@ public class RedisUtil {
...
@@ -93,6 +97,10 @@ public class RedisUtil {
return
stringRedisTemplate
.
opsForValue
().
get
(
key
);
return
stringRedisTemplate
.
opsForValue
().
get
(
key
);
}
}
public
void
getAndSet
(
String
key
,
String
newValue
){
stringRedisTemplate
.
opsForValue
().
getAndSet
(
key
,
newValue
);
}
public
Set
<
String
>
keys
(
String
key
)
{
public
Set
<
String
>
keys
(
String
key
)
{
return
stringRedisTemplate
.
keys
(
key
);
return
stringRedisTemplate
.
keys
(
key
);
}
}
...
@@ -131,5 +139,4 @@ public class RedisUtil {
...
@@ -131,5 +139,4 @@ public class RedisUtil {
public
void
remove
(
String
key
)
{
public
void
remove
(
String
key
)
{
setExpire
(
key
,
"-1"
,
1
,
TimeUnit
.
SECONDS
);
setExpire
(
key
,
"-1"
,
1
,
TimeUnit
.
SECONDS
);
}
}
}
}
src/main/resources/application-dev.properties
View file @
1262ce68
...
@@ -118,3 +118,6 @@ hot.search.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findN
...
@@ -118,3 +118,6 @@ hot.search.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findN
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
#\u5DE5\u5177\u5E93\u76F8\u5173\u5916\u90E8\u63A5\u53E3
toolset.articleSummary.url
=
https://zhiweidata.xyz/api/front/chat-swagger
toolset.articleInfo.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/match?url={1}&projectId={2}&submitter={3}
\ No newline at end of file
src/main/resources/application-local.properties
View file @
1262ce68
...
@@ -122,3 +122,6 @@ hot.search.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findN
...
@@ -122,3 +122,6 @@ hot.search.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findN
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
#\u5DE5\u5177\u5E93\u76F8\u5173\u5916\u90E8\u63A5\u53E3
toolset.articleSummary.url
=
https://zhiweidata.xyz/api/front/chat-swagger
toolset.articleInfo.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/match?url={1}&projectId={2}&submitter={3}
\ No newline at end of file
src/main/resources/application-prod.properties
View file @
1262ce68
...
@@ -118,3 +118,6 @@ hot.search.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findN
...
@@ -118,3 +118,6 @@ hot.search.url=https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findN
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
#\u5DE5\u5177\u5E93\u76F8\u5173\u5916\u90E8\u63A5\u53E3
toolset.articleSummary.url
=
https://zhiweidata.xyz/api/front/chat-swagger
toolset.articleInfo.url
=
https://yuqing.zhiweidata.com/qbjcbackPhoenix/interface/middleware/match?url={1}&projectId={2}&submitter={3}
\ No newline at end of file
src/test/java/com/zhiwei/brandkbs2/MarkDataServiceTest.java
View file @
1262ce68
...
@@ -61,7 +61,7 @@ public class MarkDataServiceTest {
...
@@ -61,7 +61,7 @@ public class MarkDataServiceTest {
@Test
@Test
public
void
getYuqingMarkCriteriaTest
(){
public
void
getYuqingMarkCriteriaTest
(){
JSONObject
yuqingMarkCriteria
=
markDataService
.
getYuqingMarkCriteria
(
null
);
JSONObject
yuqingMarkCriteria
=
markDataService
.
getYuqingMarkCriteria
();
System
.
out
.
println
(
yuqingMarkCriteria
);
System
.
out
.
println
(
yuqingMarkCriteria
);
}
}
...
@@ -179,9 +179,8 @@ public class MarkDataServiceTest {
...
@@ -179,9 +179,8 @@ public class MarkDataServiceTest {
@Test
@Test
public
void
searchWholeNetworkTest
(){
public
void
searchWholeNetworkTest
(){
SearchFilterDTO
dto
=
new
SearchFilterDTO
();
SearchFilterDTO
dto
=
new
SearchFilterDTO
();
dto
.
setProjectId
(
"62beadd1bbf8eb20f96d2f2f"
);
dto
.
setSearch
(
"阿里"
);
dto
.
setSearch
(
"阿里"
);
JSONObject
jsonObject
=
markDataService
.
searchWholeNetwork
(
dto
);
JSONObject
jsonObject
=
markDataService
.
searchWholeNetwork
WithBalance
(
dto
).
getLeft
(
);
System
.
out
.
println
(
jsonObject
);
System
.
out
.
println
(
jsonObject
);
}
}
...
...
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