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
d6139789
Commit
d6139789
authored
Jul 15, 2022
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
Feature See merge request
!11
parents
26238275
9683fdbc
Hide whitespace changes
Inline
Side-by-side
Showing
107 changed files
with
1889 additions
and
553 deletions
+1889
-553
src/main/java/com/zhiwei/brandkbs2/auth/AuthAspect.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
+11
-0
src/main/java/com/zhiwei/brandkbs2/common/GlobalPojo.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+8
-1
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
+8
-0
src/main/java/com/zhiwei/brandkbs2/controller/CommonController.java
+18
-4
src/main/java/com/zhiwei/brandkbs2/controller/LoginController.java
+10
-10
src/main/java/com/zhiwei/brandkbs2/controller/admin/ArticleController.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/controller/admin/BaseModuleController.java
+6
-6
src/main/java/com/zhiwei/brandkbs2/controller/admin/BehaviorController.java
+5
-5
src/main/java/com/zhiwei/brandkbs2/controller/admin/ChannelController.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/controller/admin/CustomTagController.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/controller/admin/EventController.java
+25
-25
src/main/java/com/zhiwei/brandkbs2/controller/admin/ProjectController.java
+15
-15
src/main/java/com/zhiwei/brandkbs2/controller/admin/ReportController.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/controller/admin/UserController.java
+11
-11
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
+46
-8
src/main/java/com/zhiwei/brandkbs2/controller/app/GlobalController.java
+41
-0
src/main/java/com/zhiwei/brandkbs2/dao/BaseMongoDao.java
+22
-6
src/main/java/com/zhiwei/brandkbs2/dao/BehaviorDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/BrandkbsTaskDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/ChannelDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/ChannelLabelDao.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/dao/ChannelTagDao.java
+14
-0
src/main/java/com/zhiwei/brandkbs2/dao/CustomTagDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/EventDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/EventDataDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/HighWordDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/ProjectDao.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/QbjcPojoDao.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/dao/ReportDao.java
+9
-3
src/main/java/com/zhiwei/brandkbs2/dao/ReportSettingsDao.java
+8
-3
src/main/java/com/zhiwei/brandkbs2/dao/ShardingMongo.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/TagFilterDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/dao/UserDao.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/BaseMongoDaoImpl.java
+15
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/BehaviorDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/BrandkbsTaskDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/ChannelDaoImpl.java
+11
-7
src/main/java/com/zhiwei/brandkbs2/dao/impl/ChannelLabelDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/ChannelTagDaoImpl.java
+29
-0
src/main/java/com/zhiwei/brandkbs2/dao/impl/CustomTagDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDataDaoImpl.java
+10
-3
src/main/java/com/zhiwei/brandkbs2/dao/impl/HighWordDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/ProjectDaoImlp.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/QbjcPojoDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/ReportDaoImpl.java
+21
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/ReportSettingsDaoImpl.java
+13
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/TagFilterDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/dao/impl/UserDaoImpl.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/easyexcel/listener/EventDataListener.java
+5
-5
src/main/java/com/zhiwei/brandkbs2/easyexcel/listener/EventFileListener.java
+5
-5
src/main/java/com/zhiwei/brandkbs2/enmus/ChannelEmotion.java
+45
-0
src/main/java/com/zhiwei/brandkbs2/enmus/ImportantChannelEnum.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/enmus/ReportTypeEnum.java
+73
-0
src/main/java/com/zhiwei/brandkbs2/es/EsClientDao.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
+13
-1
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
+32
-4
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelTag.java
+20
-0
src/main/java/com/zhiwei/brandkbs2/pojo/MarkFlowEntity.java
+19
-14
src/main/java/com/zhiwei/brandkbs2/pojo/Report.java
+59
-11
src/main/java/com/zhiwei/brandkbs2/pojo/ReportSettings.java
+11
-0
src/main/java/com/zhiwei/brandkbs2/pojo/dto/EventSearchDTO.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/pojo/dto/MarkSearchDTO.java
+3
-3
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ReportDTO.java
+54
-0
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ReportSearchDTO.java
+56
-0
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ReportSettingsDTO.java
+4
-3
src/main/java/com/zhiwei/brandkbs2/service/BehaviorService.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/BrandkbsTaskService.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
+5
-3
src/main/java/com/zhiwei/brandkbs2/service/CommonService.java
+10
-3
src/main/java/com/zhiwei/brandkbs2/service/CustomTagService.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/EventDataService.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/HighWordService.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/IReportService.java
+0
-36
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
+9
-2
src/main/java/com/zhiwei/brandkbs2/service/MarkFlowService.java
+39
-0
src/main/java/com/zhiwei/brandkbs2/service/ProjectService.java
+8
-1
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
+114
-0
src/main/java/com/zhiwei/brandkbs2/service/SystemInfoService.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/TagFilterService.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/TaskService.java
+5
-5
src/main/java/com/zhiwei/brandkbs2/service/UserService.java
+2
-2
src/main/java/com/zhiwei/brandkbs2/service/impl/BehaviorServiceImpl.java
+6
-6
src/main/java/com/zhiwei/brandkbs2/service/impl/BrandkbsTaskServiceImpl.java
+7
-4
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+10
-10
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
+24
-10
src/main/java/com/zhiwei/brandkbs2/service/impl/CustomTagServiceImpl.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/service/impl/EventDataServiceImpl.java
+6
-6
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
+11
-11
src/main/java/com/zhiwei/brandkbs2/service/impl/HighWordServiceImpl.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+121
-98
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
+161
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
+13
-7
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+226
-14
src/main/java/com/zhiwei/brandkbs2/service/impl/SystemInfoServiceImpl.java
+6
-6
src/main/java/com/zhiwei/brandkbs2/service/impl/TagFilterServiceImpl.java
+8
-9
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+100
-18
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
+6
-6
src/main/java/com/zhiwei/brandkbs2/task/ControlCenter.java
+4
-4
src/main/java/com/zhiwei/brandkbs2/util/FlowEntityUtil.java
+12
-12
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
+38
-0
src/main/java/com/zhiwei/brandkbs2/util/TextUtil.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
+39
-0
src/test/java/com/zhiwei/brandkbs2/TestRunWith.java
+43
-20
No files found.
src/main/java/com/zhiwei/brandkbs2/auth/AuthAspect.java
View file @
d6139789
...
@@ -5,7 +5,7 @@ import com.zhiwei.brandkbs2.common.GenericAttribute;
...
@@ -5,7 +5,7 @@ import com.zhiwei.brandkbs2.common.GenericAttribute;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
import
com.zhiwei.brandkbs2.service.
I
UserService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.Signature
;
import
org.aspectj.lang.Signature
;
...
@@ -40,7 +40,7 @@ public class AuthAspect {
...
@@ -40,7 +40,7 @@ public class AuthAspect {
private
String
jwtKey
;
private
String
jwtKey
;
@Resource
(
name
=
"userServiceImpl"
)
@Resource
(
name
=
"userServiceImpl"
)
private
IUserService
i
UserService
;
private
UserService
UserService
;
@Pointcut
(
"execution(com.zhiwei.brandkbs2.model.ResponseResult com.zhiwei.brandkbs2.controller..*.*(..))"
)
@Pointcut
(
"execution(com.zhiwei.brandkbs2.model.ResponseResult com.zhiwei.brandkbs2.controller..*.*(..))"
)
// @Pointcut("within(com.zhiwei.brandkbs2.controller..*)")
// @Pointcut("within(com.zhiwei.brandkbs2.controller..*)")
...
@@ -73,7 +73,7 @@ public class AuthAspect {
...
@@ -73,7 +73,7 @@ public class AuthAspect {
return
unAuthenticatedResponse
(
response
,
noAuth
,
joinPoint
);
return
unAuthenticatedResponse
(
response
,
noAuth
,
joinPoint
);
}
}
String
uid
=
tokenInfo
.
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
uid
=
tokenInfo
.
get
(
GenericAttribute
.
USER_ID
).
toString
();
UserInfo
userInfo
=
i
UserService
.
queryUserInfo
(
uid
,
request
.
getHeader
(
"pid"
));
UserInfo
userInfo
=
UserService
.
queryUserInfo
(
uid
,
request
.
getHeader
(
"pid"
));
if
(!
noAuth
&&
null
==
userInfo
)
{
if
(!
noAuth
&&
null
==
userInfo
)
{
return
unAuthoriseResponse
(
response
);
return
unAuthoriseResponse
(
response
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/common/GenericAttribute.java
View file @
d6139789
...
@@ -7,6 +7,7 @@ package com.zhiwei.brandkbs2.common;
...
@@ -7,6 +7,7 @@ package com.zhiwei.brandkbs2.common;
* @date: 2022-04-21 10:10
* @date: 2022-04-21 10:10
*/
*/
public
class
GenericAttribute
{
public
class
GenericAttribute
{
private
GenericAttribute
()
{
private
GenericAttribute
()
{
}
}
...
@@ -24,12 +25,22 @@ public class GenericAttribute {
...
@@ -24,12 +25,22 @@ public class GenericAttribute {
**/
**/
public
static
final
String
ES_IND_FULL_TEXT
=
"ind_full_text"
;
public
static
final
String
ES_IND_FULL_TEXT
=
"ind_full_text"
;
/**
/**
* es followers_num
*/
public
static
final
String
ES_FOLLOWERS_NUM
=
"followers_num"
;
/**
* es rootSource
**/
public
static
final
String
ES_ROOT_SOURCE
=
"root_source"
;
/**
* es gid
* es gid
**/
**/
public
static
final
String
ES_GID
=
"gid"
;
public
static
final
String
ES_GID
=
"gid"
;
public
static
final
String
ES_CNAME
=
"cname"
;
public
static
final
String
ES_CNAME
=
"cname"
;
/** es c2 **/
/** es c2 **/
public
static
final
String
ES_C2
=
"c2"
;
public
static
final
String
ES_C2
=
"c2"
;
/** es c4 **/
public
static
final
String
ES_C4
=
"c4"
;
/** es c5 **/
/** es c5 **/
public
static
final
String
ES_C5
=
"c5"
;
public
static
final
String
ES_C5
=
"c5"
;
/** es foreign **/
/** es foreign **/
...
...
src/main/java/com/zhiwei/brandkbs2/common/GlobalPojo.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
common
;
package
com
.
zhiwei
.
brandkbs2
.
common
;
import
com.zhiwei.brandkbs2.service.
I
SystemInfoService
;
import
com.zhiwei.brandkbs2.service.SystemInfoService
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -26,7 +26,7 @@ public class GlobalPojo {
...
@@ -26,7 +26,7 @@ public class GlobalPojo {
public
static
final
Logger
log
=
LogManager
.
getLogger
(
GlobalPojo
.
class
);
public
static
final
Logger
log
=
LogManager
.
getLogger
(
GlobalPojo
.
class
);
@Resource
(
name
=
"systemInfoServiceImpl"
)
@Resource
(
name
=
"systemInfoServiceImpl"
)
private
I
SystemInfoService
systemInfoService
;
private
SystemInfoService
systemInfoService
;
/**
/**
* 监测系统平台
* 监测系统平台
...
...
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
d6139789
...
@@ -15,6 +15,8 @@ public class RedisKeyPrefix {
...
@@ -15,6 +15,8 @@ public class RedisKeyPrefix {
private
RedisKeyPrefix
()
{
private
RedisKeyPrefix
()
{
}
}
private
static
final
String
SEPARATOR
=
":"
;
public
static
final
String
MARK_ANALYZE_SUMMARY
=
"BRANDKBS:MARK:ANALYZE_SUMMARY:"
;
public
static
final
String
MARK_ANALYZE_SUMMARY
=
"BRANDKBS:MARK:ANALYZE_SUMMARY:"
;
public
static
final
String
MARK_PLATFORM_PROPORTION
=
"BRANDKBS:MARK:PLATFORM_PROPORTION:"
;
public
static
final
String
MARK_PLATFORM_PROPORTION
=
"BRANDKBS:MARK:PLATFORM_PROPORTION:"
;
public
static
final
String
MARK_SPREAD
=
"BRANDKBS:MARK:SPREAD:"
;
public
static
final
String
MARK_SPREAD
=
"BRANDKBS:MARK:SPREAD:"
;
...
@@ -22,7 +24,12 @@ public class RedisKeyPrefix {
...
@@ -22,7 +24,12 @@ public class RedisKeyPrefix {
public
static
final
String
MARK_EMOTION_PROPORTION
=
"BRANDKBS:MARK:EMOTION_PROPORTION:"
;
public
static
final
String
MARK_EMOTION_PROPORTION
=
"BRANDKBS:MARK:EMOTION_PROPORTION:"
;
public
static
final
String
MARK_HIGH_WORD
=
"BRANDKBS:MARK:HIGH_WORD:"
;
public
static
final
String
MARK_HIGH_WORD
=
"BRANDKBS:MARK:HIGH_WORD:"
;
private
static
final
String
SEPARATOR
=
":"
;
public
static
final
String
REDIS_SYSTEM_COPY
=
"BRANDKBS:SYSTEM:COPY:"
;
/**
* 项目简报报相关缓存KEY
*/
public
static
final
String
REPORT_PC
=
"BRANDKBS:REPORT:PC:"
;
/**
/**
* 稿件数据上传缓存key
* 稿件数据上传缓存key
...
...
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
config
;
package
com
.
zhiwei
.
brandkbs2
.
config
;
import
org.apache.commons.lang3.time.FastDateFormat
;
/**
/**
* @ClassName: Constant
* @ClassName: Constant
* @Description 常量
* @Description 常量
...
@@ -8,8 +10,12 @@ package com.zhiwei.brandkbs2.config;
...
@@ -8,8 +10,12 @@ package com.zhiwei.brandkbs2.config;
*/
*/
public
class
Constant
{
public
class
Constant
{
public
static
final
String
HOUR_PATTERN
=
"yyyy-MM-dd HH"
;
public
static
final
String
DAY_PATTERN
=
"yyyy-MM-dd"
;
public
static
final
String
DAY_PATTERN
=
"yyyy-MM-dd"
;
public
static
final
FastDateFormat
HOUR_FORMAT
=
FastDateFormat
.
getInstance
(
HOUR_PATTERN
);
public
static
final
FastDateFormat
DAY_FORMAT
=
FastDateFormat
.
getInstance
(
DAY_PATTERN
);
/**
/**
* 自定义fid分隔符号
* 自定义fid分隔符号
*/
*/
...
@@ -19,6 +25,8 @@ public class Constant {
...
@@ -19,6 +25,8 @@ public class Constant {
* 标签相关
* 标签相关
*/
*/
public
static
final
String
EMOTION_LABEL_KEY
=
"情感倾向"
;
public
static
final
String
EMOTION_LABEL_KEY
=
"情感倾向"
;
public
static
final
String
EMOTION_SENSITIVE
=
"敏感"
;
public
static
final
String
EMOTION_NEGATIVE
=
"负面"
;
public
static
final
String
BRAND_LABEL_KEY
=
"品牌归属"
;
public
static
final
String
BRAND_LABEL_KEY
=
"品牌归属"
;
/**
/**
...
...
src/main/java/com/zhiwei/brandkbs2/controller/CommonController.java
View file @
d6139789
...
@@ -3,8 +3,8 @@ package com.zhiwei.brandkbs2.controller;
...
@@ -3,8 +3,8 @@ package com.zhiwei.brandkbs2.controller;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.Auth
;
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.service.
I
CommonService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -33,10 +33,10 @@ import java.util.stream.Collectors;
...
@@ -33,10 +33,10 @@ import java.util.stream.Collectors;
public
class
CommonController
extends
BaseController
{
public
class
CommonController
extends
BaseController
{
@Resource
(
name
=
"commonServiceImpl"
)
@Resource
(
name
=
"commonServiceImpl"
)
I
CommonService
commonService
;
CommonService
commonService
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
I
ProjectService
projectService
;
ProjectService
projectService
;
@ApiOperation
(
"获取情感倾向标签信息"
)
@ApiOperation
(
"获取情感倾向标签信息"
)
@ApiImplicitParam
(
name
=
"linkedGroupId"
,
value
=
"关联项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"linkedGroupId"
,
value
=
"关联项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
...
@@ -67,4 +67,18 @@ public class CommonController extends BaseController {
...
@@ -67,4 +67,18 @@ public class CommonController extends BaseController {
return
ResponseResult
.
success
(
projectService
.
getUserAllProjects
());
return
ResponseResult
.
success
(
projectService
.
getUserAllProjects
());
}
}
// @ApiOperation("获取默认月间隔时间节点")
// @GetMapping("/time/month")
// @Auth(role = RoleEnum.CUSTOMER)
// public ResponseResult getTimeRangeMonth() {
// return ResponseResult.success(commonService.getTimeRangeMonth());
// }
//
// @ApiOperation("获取默认周间隔时间节点")
// @GetMapping("/time/week")
// @Auth(role = RoleEnum.CUSTOMER)
// public ResponseResult getTimeRangeWeek() {
// return ResponseResult.success(commonService.getTimeRangeWeek());
// }
}
}
src/main/java/com/zhiwei/brandkbs2/controller/LoginController.java
View file @
d6139789
...
@@ -5,8 +5,8 @@ import com.zhiwei.brandkbs2.auth.Auth;
...
@@ -5,8 +5,8 @@ import com.zhiwei.brandkbs2.auth.Auth;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
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.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.
I
UserService
;
import
com.zhiwei.brandkbs2.service.UserService
;
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
;
...
@@ -36,15 +36,15 @@ public class LoginController extends BaseController {
...
@@ -36,15 +36,15 @@ public class LoginController extends BaseController {
private
int
jwtHour
;
private
int
jwtHour
;
@Resource
(
name
=
"userServiceImpl"
)
@Resource
(
name
=
"userServiceImpl"
)
private
IUserService
i
UserService
;
private
UserService
UserService
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
IProjectService
i
ProjectService
;
private
ProjectService
ProjectService
;
@ApiOperation
(
"用户登录"
)
@ApiOperation
(
"用户登录"
)
@PostMapping
(
"/user/login"
)
@PostMapping
(
"/user/login"
)
public
ResponseResult
login
()
{
public
ResponseResult
login
()
{
return
ResponseResult
.
success
(
i
UserService
.
login
().
toMap
());
return
ResponseResult
.
success
(
UserService
.
login
().
toMap
());
}
}
@ApiOperation
(
"用户信息获取"
)
@ApiOperation
(
"用户信息获取"
)
...
@@ -59,7 +59,7 @@ public class LoginController extends BaseController {
...
@@ -59,7 +59,7 @@ public class LoginController extends BaseController {
@ApiImplicitParam
(
name
=
"username"
,
value
=
"用户名"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"string"
))
@ApiImplicitParam
(
name
=
"username"
,
value
=
"用户名"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"string"
))
@PostMapping
(
"/user/bind/reset"
)
@PostMapping
(
"/user/bind/reset"
)
public
ResponseResult
resetBind
(
@RequestBody
JSONObject
json
)
{
public
ResponseResult
resetBind
(
@RequestBody
JSONObject
json
)
{
i
UserService
.
resetBind
(
json
.
getString
(
"username"
));
UserService
.
resetBind
(
json
.
getString
(
"username"
));
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -71,25 +71,25 @@ public class LoginController extends BaseController {
...
@@ -71,25 +71,25 @@ public class LoginController extends BaseController {
public
ResponseResult
bindUser
(
@RequestBody
JSONObject
json
)
{
public
ResponseResult
bindUser
(
@RequestBody
JSONObject
json
)
{
String
username
=
json
.
getString
(
"username"
);
String
username
=
json
.
getString
(
"username"
);
String
password
=
json
.
getString
(
"password"
);
String
password
=
json
.
getString
(
"password"
);
return
ResponseResult
.
success
(
i
UserService
.
bindUser
(
username
,
password
));
return
ResponseResult
.
success
(
UserService
.
bindUser
(
username
,
password
));
}
}
@ApiOperation
(
"跳过绑定(赋默认权限)"
)
@ApiOperation
(
"跳过绑定(赋默认权限)"
)
@PostMapping
(
"/user/bind/skip"
)
@PostMapping
(
"/user/bind/skip"
)
public
ResponseResult
skipBindUser
()
{
public
ResponseResult
skipBindUser
()
{
return
ResponseResult
.
success
(
i
UserService
.
skipBindUser
());
return
ResponseResult
.
success
(
UserService
.
skipBindUser
());
}
}
@ApiOperation
(
"校验用户是否已有绑定关系"
)
@ApiOperation
(
"校验用户是否已有绑定关系"
)
@GetMapping
(
"/user/login/checkBind"
)
@GetMapping
(
"/user/login/checkBind"
)
public
ResponseResult
checkBind
()
{
public
ResponseResult
checkBind
()
{
return
ResponseResult
.
success
(
i
UserService
.
checkUserRoles
());
return
ResponseResult
.
success
(
UserService
.
checkUserRoles
());
}
}
@ApiOperation
(
"获取当前用户拥有的所有项目(含过期)"
)
@ApiOperation
(
"获取当前用户拥有的所有项目(含过期)"
)
@GetMapping
(
"/user/login/getUserAllProjects"
)
@GetMapping
(
"/user/login/getUserAllProjects"
)
public
ResponseResult
getLoginUserAllProjects
()
{
public
ResponseResult
getLoginUserAllProjects
()
{
return
ResponseResult
.
success
(
i
ProjectService
.
getLoginUserAllProjects
());
return
ResponseResult
.
success
(
ProjectService
.
getLoginUserAllProjects
());
}
}
@ApiOperation
(
"测试接口"
)
@ApiOperation
(
"测试接口"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/ArticleController.java
View file @
d6139789
...
@@ -7,8 +7,8 @@ import com.zhiwei.brandkbs2.controller.BaseController;
...
@@ -7,8 +7,8 @@ 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.Behavior
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.service.
I
BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.Tools
;
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
;
...
@@ -55,10 +55,10 @@ public class ArticleController extends BaseController {
...
@@ -55,10 +55,10 @@ public class ArticleController extends BaseController {
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@javax
.
annotation
.
Resource
(
name
=
"behaviorServiceImpl"
)
@javax
.
annotation
.
Resource
(
name
=
"behaviorServiceImpl"
)
private
I
BehaviorService
behaviorService
;
private
BehaviorService
behaviorService
;
@javax
.
annotation
.
Resource
(
name
=
"projectServiceImpl"
)
@javax
.
annotation
.
Resource
(
name
=
"projectServiceImpl"
)
private
I
ProjectService
projectService
;
private
ProjectService
projectService
;
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"稿件上传"
,
true
);
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"稿件上传"
,
true
);
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/BaseModuleController.java
View file @
d6139789
...
@@ -10,9 +10,9 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
...
@@ -10,9 +10,9 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.
I
HighWordService
;
import
com.zhiwei.brandkbs2.service.HighWordService
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.
I
TagFilterService
;
import
com.zhiwei.brandkbs2.service.TagFilterService
;
import
com.zhiwei.brandkbs2.util.Tools
;
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
;
...
@@ -37,13 +37,13 @@ import java.util.List;
...
@@ -37,13 +37,13 @@ import java.util.List;
public
class
BaseModuleController
extends
BaseController
{
public
class
BaseModuleController
extends
BaseController
{
@Resource
(
name
=
"tagFilterServiceImpl"
)
@Resource
(
name
=
"tagFilterServiceImpl"
)
I
TagFilterService
tagFilterService
;
TagFilterService
tagFilterService
;
@Resource
(
name
=
"highWordServiceImpl"
)
@Resource
(
name
=
"highWordServiceImpl"
)
I
HighWordService
highWordService
;
HighWordService
highWordService
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
I
ProjectService
projectService
;
ProjectService
projectService
;
@ApiOperation
(
"获取在用筛选器列表"
)
@ApiOperation
(
"获取在用筛选器列表"
)
@GetMapping
(
"/tagFilter"
)
@GetMapping
(
"/tagFilter"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/BehaviorController.java
View file @
d6139789
...
@@ -7,8 +7,8 @@ import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
...
@@ -7,8 +7,8 @@ import com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportBehaviorDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportBehaviorDTO
;
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.service.
I
BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
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
;
...
@@ -34,10 +34,10 @@ import java.util.List;
...
@@ -34,10 +34,10 @@ import java.util.List;
public
class
BehaviorController
extends
BaseController
{
public
class
BehaviorController
extends
BaseController
{
@Resource
(
name
=
"behaviorServiceImpl"
)
@Resource
(
name
=
"behaviorServiceImpl"
)
private
I
BehaviorService
behaviorService
;
private
BehaviorService
behaviorService
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
IProjectService
i
ProjectService
;
private
ProjectService
ProjectService
;
@ApiOperation
(
"分页查询用户行为列表"
)
@ApiOperation
(
"分页查询用户行为列表"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
...
@@ -72,7 +72,7 @@ public class BehaviorController extends BaseController {
...
@@ -72,7 +72,7 @@ public class BehaviorController extends BaseController {
@RequestParam
(
value
=
"behavior"
,
defaultValue
=
"true"
)
boolean
behavior
)
{
@RequestParam
(
value
=
"behavior"
,
defaultValue
=
"true"
)
boolean
behavior
)
{
List
<
ExportBehaviorDTO
>
downloadList
=
behaviorService
.
download
(
startTime
,
endTime
,
behavior
);
List
<
ExportBehaviorDTO
>
downloadList
=
behaviorService
.
download
(
startTime
,
endTime
,
behavior
);
String
behaviorName
=
behavior
?
"后台"
:
"前台"
;
String
behaviorName
=
behavior
?
"后台"
:
"前台"
;
String
sheetName
=
i
ProjectService
.
getProjectVOById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
()
+
"_"
+
behaviorName
;
String
sheetName
=
ProjectService
.
getProjectVOById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
()
+
"_"
+
behaviorName
;
EasyExcelUtil
.
download
(
sheetName
+
"用户行为"
,
sheetName
,
ExportBehaviorDTO
.
class
,
downloadList
,
response
);
EasyExcelUtil
.
download
(
sheetName
+
"用户行为"
,
sheetName
,
ExportBehaviorDTO
.
class
,
downloadList
,
response
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/ChannelController.java
View file @
d6139789
...
@@ -12,8 +12,8 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
...
@@ -12,8 +12,8 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.ChannelDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ChannelDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.
I
ChannelService
;
import
com.zhiwei.brandkbs2.service.ChannelService
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.Tools
;
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
;
...
@@ -41,10 +41,10 @@ import java.util.stream.Collectors;
...
@@ -41,10 +41,10 @@ import java.util.stream.Collectors;
public
class
ChannelController
extends
BaseController
{
public
class
ChannelController
extends
BaseController
{
@Resource
(
name
=
"channelServiceImpl"
)
@Resource
(
name
=
"channelServiceImpl"
)
I
ChannelService
channelService
;
ChannelService
channelService
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
I
ProjectService
projectService
;
ProjectService
projectService
;
@Value
(
"${brandkbs.img.url}"
)
@Value
(
"${brandkbs.img.url}"
)
private
String
brandkbsImgPath
;
private
String
brandkbsImgPath
;
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/CustomTagController.java
View file @
d6139789
...
@@ -6,8 +6,8 @@ import com.zhiwei.brandkbs2.controller.BaseController;
...
@@ -6,8 +6,8 @@ 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.Behavior
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.service.
I
BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.
I
CustomTagService
;
import
com.zhiwei.brandkbs2.service.CustomTagService
;
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
;
...
@@ -33,10 +33,10 @@ import static com.alibaba.fastjson.JSON.parseArray;
...
@@ -33,10 +33,10 @@ import static com.alibaba.fastjson.JSON.parseArray;
public
class
CustomTagController
extends
BaseController
{
public
class
CustomTagController
extends
BaseController
{
@Resource
(
name
=
"customTagServiceImpl"
)
@Resource
(
name
=
"customTagServiceImpl"
)
private
I
CustomTagService
customTagService
;
private
CustomTagService
customTagService
;
@Resource
(
name
=
"behaviorServiceImpl"
)
@Resource
(
name
=
"behaviorServiceImpl"
)
private
I
BehaviorService
behaviorService
;
private
BehaviorService
behaviorService
;
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"自定义标签管理"
,
true
);
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"自定义标签管理"
,
true
);
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/EventController.java
View file @
d6139789
...
@@ -15,8 +15,8 @@ import com.zhiwei.brandkbs2.pojo.dto.YqEventDTO;
...
@@ -15,8 +15,8 @@ import com.zhiwei.brandkbs2.pojo.dto.YqEventDTO;
import
com.zhiwei.brandkbs2.pojo.vo.EventVO
;
import
com.zhiwei.brandkbs2.pojo.vo.EventVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.YqEventSearchVO
;
import
com.zhiwei.brandkbs2.pojo.vo.YqEventSearchVO
;
import
com.zhiwei.brandkbs2.service.
I
BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.
I
EventService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.util.Tools
;
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
;
...
@@ -47,10 +47,10 @@ import java.util.Set;
...
@@ -47,10 +47,10 @@ import java.util.Set;
public
class
EventController
extends
BaseController
{
public
class
EventController
extends
BaseController
{
@Resource
(
name
=
"eventServiceImpl"
)
@Resource
(
name
=
"eventServiceImpl"
)
private
IEventService
i
EventService
;
private
EventService
EventService
;
@Resource
(
name
=
"behaviorServiceImpl"
)
@Resource
(
name
=
"behaviorServiceImpl"
)
private
I
BehaviorService
behaviorService
;
private
BehaviorService
behaviorService
;
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"事件管理"
,
true
);
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"事件管理"
,
true
);
...
@@ -64,13 +64,13 @@ public class EventController extends BaseController {
...
@@ -64,13 +64,13 @@ public class EventController extends BaseController {
@ApiImplicitParam
(
name
=
"linkedGroupId"
,
value
=
"关联项目组id"
,
paramType
=
"query"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"linkedGroupId"
,
value
=
"关联项目组id"
,
paramType
=
"query"
,
dataType
=
"string"
)
@GetMapping
(
"/yq/tag"
)
@GetMapping
(
"/yq/tag"
)
public
ResponseResult
searchCriteria
(
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
)
{
public
ResponseResult
searchCriteria
(
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
)
{
return
ResponseResult
.
success
(
i
EventService
.
findEventTagListAll
(
linkedGroupId
));
return
ResponseResult
.
success
(
EventService
.
findEventTagListAll
(
linkedGroupId
));
}
}
@ApiOperation
(
"分页查询舆情事件列表"
)
@ApiOperation
(
"分页查询舆情事件列表"
)
@PostMapping
(
"/yq/list"
)
@PostMapping
(
"/yq/list"
)
public
ResponseResult
findYqEventList
(
@RequestBody
YqEventSearchVO
yqEventSearchVO
)
{
public
ResponseResult
findYqEventList
(
@RequestBody
YqEventSearchVO
yqEventSearchVO
)
{
PageVO
<
JSONObject
>
yqEventList
=
i
EventService
.
findYqEventList
(
yqEventSearchVO
);
PageVO
<
JSONObject
>
yqEventList
=
EventService
.
findYqEventList
(
yqEventSearchVO
);
return
ResponseResult
.
success
(
yqEventList
);
return
ResponseResult
.
success
(
yqEventList
);
}
}
...
@@ -87,27 +87,27 @@ public class EventController extends BaseController {
...
@@ -87,27 +87,27 @@ public class EventController extends BaseController {
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
,
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"startTime\":\"descend\"}"
)
String
sorter
)
{
@RequestParam
(
value
=
"sorter"
,
defaultValue
=
"{\"startTime\":\"descend\"}"
)
String
sorter
)
{
return
ResponseResult
.
success
(
i
EventService
.
findEventList
(
page
,
size
,
linkedGroupId
,
keyword
,
sorter
));
return
ResponseResult
.
success
(
EventService
.
findEventList
(
page
,
size
,
linkedGroupId
,
keyword
,
sorter
));
}
}
@ApiOperation
(
"获取单个事件信息"
)
@ApiOperation
(
"获取单个事件信息"
)
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@GetMapping
(
"/get/{eventId}"
)
@GetMapping
(
"/get/{eventId}"
)
public
ResponseResult
getEvent
(
@PathVariable
(
"eventId"
)
String
eventId
)
{
public
ResponseResult
getEvent
(
@PathVariable
(
"eventId"
)
String
eventId
)
{
return
ResponseResult
.
success
(
i
EventService
.
getEventJSONByEventId
(
eventId
));
return
ResponseResult
.
success
(
EventService
.
getEventJSONByEventId
(
eventId
));
}
}
@ApiOperation
(
"获取事件数据列表"
)
@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
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)})
@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
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/data/get"
)
@GetMapping
(
"/data/get"
)
public
ResponseResult
getEventDatas
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"eventId"
)
String
eventId
)
{
public
ResponseResult
getEventDatas
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"eventId"
)
String
eventId
)
{
return
ResponseResult
.
success
(
i
EventService
.
getEventDatas
(
page
,
size
,
eventId
));
return
ResponseResult
.
success
(
EventService
.
getEventDatas
(
page
,
size
,
eventId
));
}
}
@ApiOperation
(
"修改事件信息"
)
@ApiOperation
(
"修改事件信息"
)
@PutMapping
(
"/update"
)
@PutMapping
(
"/update"
)
public
ResponseResult
updateEvent
(
@RequestBody
EventVO
eventVO
)
{
public
ResponseResult
updateEvent
(
@RequestBody
EventVO
eventVO
)
{
i
EventService
.
updateEvent
(
eventVO
);
EventService
.
updateEvent
(
eventVO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"修改事件信息:"
+
eventVO
.
getId
(),
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"修改事件信息:"
+
eventVO
.
getId
(),
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -115,7 +115,7 @@ public class EventController extends BaseController {
...
@@ -115,7 +115,7 @@ public class EventController extends BaseController {
@ApiOperation
(
"修改事件首发信息"
)
@ApiOperation
(
"修改事件首发信息"
)
@PutMapping
(
"/updateFirst"
)
@PutMapping
(
"/updateFirst"
)
public
ResponseResult
updateEventFirst
(
@RequestBody
EventDataDTO
eventDataDTO
)
{
public
ResponseResult
updateEventFirst
(
@RequestBody
EventDataDTO
eventDataDTO
)
{
i
EventService
.
updateEventFirst
(
eventDataDTO
);
EventService
.
updateEventFirst
(
eventDataDTO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"修改事件首发信息:"
+
eventDataDTO
.
getEventId
(),
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"修改事件首发信息:"
+
eventDataDTO
.
getEventId
(),
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -124,7 +124,7 @@ public class EventController extends BaseController {
...
@@ -124,7 +124,7 @@ public class EventController extends BaseController {
@ApiImplicitParam
(
name
=
"eventIds"
,
value
=
"事件ID集合"
,
paramType
=
"body"
,
dataType
=
"list"
)
@ApiImplicitParam
(
name
=
"eventIds"
,
value
=
"事件ID集合"
,
paramType
=
"body"
,
dataType
=
"list"
)
@PostMapping
(
"/analyze"
)
@PostMapping
(
"/analyze"
)
public
ResponseResult
analysisEvents
(
@RequestBody
JSONObject
info
)
{
public
ResponseResult
analysisEvents
(
@RequestBody
JSONObject
info
)
{
i
EventService
.
analysisEvents
(
info
.
getJSONArray
(
"eventIds"
).
toJavaList
(
String
.
class
));
EventService
.
analysisEvents
(
info
.
getJSONArray
(
"eventIds"
).
toJavaList
(
String
.
class
));
behaviorService
.
pushBehavior
(
OPERATION
,
"批量更新事件"
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"批量更新事件"
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -133,7 +133,7 @@ public class EventController extends BaseController {
...
@@ -133,7 +133,7 @@ public class EventController extends BaseController {
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@PutMapping
(
"/end/{eventId}"
)
@PutMapping
(
"/end/{eventId}"
)
public
ResponseResult
endEvent
(
@PathVariable
(
"eventId"
)
String
eventId
)
{
public
ResponseResult
endEvent
(
@PathVariable
(
"eventId"
)
String
eventId
)
{
i
EventService
.
endEvent
(
eventId
);
EventService
.
endEvent
(
eventId
);
behaviorService
.
pushBehavior
(
OPERATION
,
"结束事件:"
+
eventId
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"结束事件:"
+
eventId
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -142,7 +142,7 @@ public class EventController extends BaseController {
...
@@ -142,7 +142,7 @@ public class EventController extends BaseController {
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@DeleteMapping
(
"/delete/{eventId}"
)
@DeleteMapping
(
"/delete/{eventId}"
)
public
ResponseResult
deleteEvent
(
@PathVariable
(
"eventId"
)
String
eventId
)
{
public
ResponseResult
deleteEvent
(
@PathVariable
(
"eventId"
)
String
eventId
)
{
String
title
=
i
EventService
.
deleteEvent
(
eventId
);
String
title
=
EventService
.
deleteEvent
(
eventId
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除事件:"
+
title
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除事件:"
+
title
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -153,7 +153,7 @@ public class EventController extends BaseController {
...
@@ -153,7 +153,7 @@ public class EventController extends BaseController {
public
ResponseResult
deleteEventData
(
@RequestBody
JSONObject
info
)
{
public
ResponseResult
deleteEventData
(
@RequestBody
JSONObject
info
)
{
String
id
=
info
.
getString
(
"id"
);
String
id
=
info
.
getString
(
"id"
);
String
eventId
=
info
.
getString
(
"eventId"
);
String
eventId
=
info
.
getString
(
"eventId"
);
String
title
=
i
EventService
.
deleteEventData
(
id
,
eventId
);
String
title
=
EventService
.
deleteEventData
(
id
,
eventId
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除事件单条数据,eventId:"
+
eventId
+
",数据id:"
+
id
+
",事件标题:"
+
title
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除事件单条数据,eventId:"
+
eventId
+
",数据id:"
+
id
+
",事件标题:"
+
title
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -172,14 +172,14 @@ public class EventController extends BaseController {
...
@@ -172,14 +172,14 @@ public class EventController extends BaseController {
@ApiOperation
(
"事件上传进度获取"
)
@ApiOperation
(
"事件上传进度获取"
)
@GetMapping
(
"data/upload/progress/{ticket}"
)
@GetMapping
(
"data/upload/progress/{ticket}"
)
public
ResponseResult
getEventDataUploadProgress
(
@PathVariable
String
ticket
)
{
public
ResponseResult
getEventDataUploadProgress
(
@PathVariable
String
ticket
)
{
return
ResponseResult
.
success
(
i
EventService
.
getEventDataUploadProgress
(
ticket
));
return
ResponseResult
.
success
(
EventService
.
getEventDataUploadProgress
(
ticket
));
}
}
@ApiOperation
(
"事件数据上传进度获取"
)
@ApiOperation
(
"事件数据上传进度获取"
)
@ApiImplicitParams
(
@ApiImplicitParam
(
name
=
"eventIds"
,
value
=
"事件id列表"
,
paramType
=
"body"
,
dataType
=
"list"
))
@ApiImplicitParams
(
@ApiImplicitParam
(
name
=
"eventIds"
,
value
=
"事件id列表"
,
paramType
=
"body"
,
dataType
=
"list"
))
@PostMapping
(
"analyze/progress"
)
@PostMapping
(
"analyze/progress"
)
public
ResponseResult
getEventAnalyzeProgress
(
@RequestBody
JSONObject
info
)
{
public
ResponseResult
getEventAnalyzeProgress
(
@RequestBody
JSONObject
info
)
{
return
ResponseResult
.
success
(
i
EventService
.
getEventAnalyzeProgress
(
info
.
getJSONArray
(
"eventIds"
).
toJavaList
(
String
.
class
)));
return
ResponseResult
.
success
(
EventService
.
getEventAnalyzeProgress
(
info
.
getJSONArray
(
"eventIds"
).
toJavaList
(
String
.
class
)));
}
}
@ApiOperation
(
"事件上传模板下载"
)
@ApiOperation
(
"事件上传模板下载"
)
...
@@ -202,7 +202,7 @@ public class EventController extends BaseController {
...
@@ -202,7 +202,7 @@ public class EventController extends BaseController {
@ApiImplicitParam
(
name
=
"linkedGroupId"
,
value
=
"关联项目组id"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"linkedGroupId"
,
value
=
"关联项目组id"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
@GetMapping
(
"/download"
)
@GetMapping
(
"/download"
)
public
ResponseResult
downloadEvents
(
@RequestParam
(
"linkedGroupId"
)
String
linkedGroupId
)
{
public
ResponseResult
downloadEvents
(
@RequestParam
(
"linkedGroupId"
)
String
linkedGroupId
)
{
Pair
<
String
,
List
<
ExportEventDTO
>>
result
=
i
EventService
.
downloadEvents
(
linkedGroupId
);
Pair
<
String
,
List
<
ExportEventDTO
>>
result
=
EventService
.
downloadEvents
(
linkedGroupId
);
String
fileName
=
result
.
getLeft
();
String
fileName
=
result
.
getLeft
();
EasyExcelUtil
.
download
(
fileName
+
"_事件列表数据"
,
fileName
,
ExportEventDTO
.
class
,
result
.
getRight
(),
response
);
EasyExcelUtil
.
download
(
fileName
+
"_事件列表数据"
,
fileName
,
ExportEventDTO
.
class
,
result
.
getRight
(),
response
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
...
@@ -212,7 +212,7 @@ public class EventController extends BaseController {
...
@@ -212,7 +212,7 @@ public class EventController extends BaseController {
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"eventId"
,
value
=
"事件ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
@GetMapping
(
"/data/download"
)
@GetMapping
(
"/data/download"
)
public
ResponseResult
downloadEventDatas
(
@RequestParam
(
"eventId"
)
String
eventId
)
{
public
ResponseResult
downloadEventDatas
(
@RequestParam
(
"eventId"
)
String
eventId
)
{
Pair
<
String
,
List
<
ExportEventDataDTO
>>
result
=
i
EventService
.
downloadEventDatas
(
eventId
);
Pair
<
String
,
List
<
ExportEventDataDTO
>>
result
=
EventService
.
downloadEventDatas
(
eventId
);
String
title
=
result
.
getLeft
();
String
title
=
result
.
getLeft
();
EasyExcelUtil
.
download
(
title
,
title
,
ExportEventDataDTO
.
class
,
result
.
getRight
(),
response
);
EasyExcelUtil
.
download
(
title
,
title
,
ExportEventDataDTO
.
class
,
result
.
getRight
(),
response
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
...
@@ -224,7 +224,7 @@ public class EventController extends BaseController {
...
@@ -224,7 +224,7 @@ public class EventController extends BaseController {
public
ResponseResult
addEventsByYq
(
@RequestBody
JSONObject
info
)
{
public
ResponseResult
addEventsByYq
(
@RequestBody
JSONObject
info
)
{
String
linkedGroupId
=
info
.
getString
(
"linkedGroupId"
);
String
linkedGroupId
=
info
.
getString
(
"linkedGroupId"
);
List
<
YqEventDTO
>
yqEventList
=
info
.
getJSONArray
(
"list"
).
toJavaList
(
YqEventDTO
.
class
);
List
<
YqEventDTO
>
yqEventList
=
info
.
getJSONArray
(
"list"
).
toJavaList
(
YqEventDTO
.
class
);
i
EventService
.
addYqEvents
(
linkedGroupId
,
yqEventList
);
EventService
.
addYqEvents
(
linkedGroupId
,
yqEventList
);
behaviorService
.
pushBehavior
(
OPERATION
,
"批量导入舆情事件数据"
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"批量导入舆情事件数据"
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -232,7 +232,7 @@ public class EventController extends BaseController {
...
@@ -232,7 +232,7 @@ public class EventController extends BaseController {
@ApiOperation
(
"按搜索条件全部导入舆情事件数据"
)
@ApiOperation
(
"按搜索条件全部导入舆情事件数据"
)
@PutMapping
(
"/upload/yqAll"
)
@PutMapping
(
"/upload/yqAll"
)
public
ResponseResult
addEventAllByYq
(
@RequestBody
YqEventSearchVO
yqEventSearchVO
)
{
public
ResponseResult
addEventAllByYq
(
@RequestBody
YqEventSearchVO
yqEventSearchVO
)
{
i
EventService
.
addYqEventAll
(
yqEventSearchVO
);
EventService
.
addYqEventAll
(
yqEventSearchVO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"全部导入舆情事件数据"
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"全部导入舆情事件数据"
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -242,7 +242,7 @@ public class EventController extends BaseController {
...
@@ -242,7 +242,7 @@ public class EventController extends BaseController {
@PostMapping
(
value
=
"/upload/file"
,
headers
=
"content-type=multipart/form-data"
)
@PostMapping
(
value
=
"/upload/file"
,
headers
=
"content-type=multipart/form-data"
)
@Auth
(
role
=
RoleEnum
.
SUPER_ADMIN
)
@Auth
(
role
=
RoleEnum
.
SUPER_ADMIN
)
public
ResponseResult
addEventsByFile
(
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
"fileUrl"
)
String
fileUrl
)
{
public
ResponseResult
addEventsByFile
(
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
"fileUrl"
)
String
fileUrl
)
{
i
EventService
.
addFileEvents
(
linkedGroupId
,
fileUrl
);
EventService
.
addFileEvents
(
linkedGroupId
,
fileUrl
);
behaviorService
.
pushBehavior
(
OPERATION
,
"文件上传事件"
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"文件上传事件"
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -252,7 +252,7 @@ public class EventController extends BaseController {
...
@@ -252,7 +252,7 @@ public class EventController extends BaseController {
"linkedGroupId"
,
value
=
"关联项目id"
,
paramType
=
"form"
,
dataType
=
"string"
)})
"linkedGroupId"
,
value
=
"关联项目id"
,
paramType
=
"form"
,
dataType
=
"string"
)})
@PostMapping
(
value
=
"/data/upload"
,
headers
=
"content-type=multipart/form-data"
)
@PostMapping
(
value
=
"/data/upload"
,
headers
=
"content-type=multipart/form-data"
)
public
ResponseResult
uploadEventDatas
(
@RequestParam
(
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
public
ResponseResult
uploadEventDatas
(
@RequestParam
(
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
i
EventService
.
uploadEventDatas
(
linkedGroupId
,
file
);
EventService
.
uploadEventDatas
(
linkedGroupId
,
file
);
behaviorService
.
pushBehavior
(
OPERATION
,
"事件数据上传"
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"事件数据上传"
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -261,13 +261,13 @@ public class EventController extends BaseController {
...
@@ -261,13 +261,13 @@ public class EventController extends BaseController {
@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
=
"linkedGroupId"
,
value
=
"关联性项目组id"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"tagGroupName"
,
value
=
"标签组名"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)})
@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
=
"linkedGroupId"
,
value
=
"关联性项目组id"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"tagGroupName"
,
value
=
"标签组名"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/tag/list"
)
@GetMapping
(
"/tag/list"
)
public
ResponseResult
findEventTagList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
value
=
"tagGroupName"
)
String
tagGroupName
)
{
public
ResponseResult
findEventTagList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
,
@RequestParam
(
value
=
"tagGroupName"
)
String
tagGroupName
)
{
return
ResponseResult
.
success
(
i
EventService
.
findEventTagList
(
page
,
size
,
linkedGroupId
,
tagGroupName
));
return
ResponseResult
.
success
(
EventService
.
findEventTagList
(
page
,
size
,
linkedGroupId
,
tagGroupName
));
}
}
@ApiOperation
(
"查询所有事件标签组名"
)
@ApiOperation
(
"查询所有事件标签组名"
)
@GetMapping
(
"/tag/groupName"
)
@GetMapping
(
"/tag/groupName"
)
public
ResponseResult
findEventTagGroupName
(
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
)
{
public
ResponseResult
findEventTagGroupName
(
@RequestParam
(
value
=
"linkedGroupId"
)
String
linkedGroupId
)
{
return
ResponseResult
.
success
(
i
EventService
.
findEventTagGroupName
(
linkedGroupId
));
return
ResponseResult
.
success
(
EventService
.
findEventTagGroupName
(
linkedGroupId
));
}
}
}
}
src/main/java/com/zhiwei/brandkbs2/controller/admin/ProjectController.java
View file @
d6139789
...
@@ -11,9 +11,9 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
...
@@ -11,9 +11,9 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.
I
BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.
I
CommonService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -50,13 +50,13 @@ public class ProjectController extends BaseController {
...
@@ -50,13 +50,13 @@ public class ProjectController extends BaseController {
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
IProjectService
i
ProjectService
;
private
ProjectService
ProjectService
;
@Resource
(
name
=
"behaviorServiceImpl"
)
@Resource
(
name
=
"behaviorServiceImpl"
)
private
I
BehaviorService
behaviorService
;
private
BehaviorService
behaviorService
;
@Resource
(
name
=
"commonServiceImpl"
)
@Resource
(
name
=
"commonServiceImpl"
)
private
I
CommonService
commonService
;
private
CommonService
commonService
;
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"项目管理"
,
true
);
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"项目管理"
,
true
);
...
@@ -75,7 +75,7 @@ public class ProjectController extends BaseController {
...
@@ -75,7 +75,7 @@ public class ProjectController extends BaseController {
@ApiOperation
(
"添加项目配置"
)
@ApiOperation
(
"添加项目配置"
)
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
public
ResponseResult
addProject
(
@RequestBody
ProjectVO
projectVO
)
{
public
ResponseResult
addProject
(
@RequestBody
ProjectVO
projectVO
)
{
i
ProjectService
.
addProject
(
projectVO
);
ProjectService
.
addProject
(
projectVO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"添加项目配置:"
+
projectVO
.
getId
(),
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"添加项目配置:"
+
projectVO
.
getId
(),
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -85,14 +85,14 @@ public class ProjectController extends BaseController {
...
@@ -85,14 +85,14 @@ public class ProjectController extends BaseController {
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"string"
)})
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"搜索关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"string"
)})
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
ResponseResult
findProjectList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
public
ResponseResult
findProjectList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
return
ResponseResult
.
success
(
i
ProjectService
.
findProjectList
(
page
,
size
,
keyword
));
return
ResponseResult
.
success
(
ProjectService
.
findProjectList
(
page
,
size
,
keyword
));
}
}
@ApiOperation
(
"修改项目"
)
@ApiOperation
(
"修改项目"
)
@PutMapping
(
"/update"
)
@PutMapping
(
"/update"
)
public
ResponseResult
updateProject
(
@RequestBody
ProjectVO
projectVO
)
{
public
ResponseResult
updateProject
(
@RequestBody
ProjectVO
projectVO
)
{
i
ProjectService
.
updateProject
(
projectVO
);
ProjectService
.
updateProject
(
projectVO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"修改项目:"
+
projectVO
.
getId
(),
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"修改项目:"
+
projectVO
.
getId
(),
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -101,7 +101,7 @@ public class ProjectController extends BaseController {
...
@@ -101,7 +101,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@DeleteMapping
(
"/delete/{pid}"
)
@DeleteMapping
(
"/delete/{pid}"
)
public
ResponseResult
deleteProject
(
@PathVariable
(
"pid"
)
String
pid
)
{
public
ResponseResult
deleteProject
(
@PathVariable
(
"pid"
)
String
pid
)
{
i
ProjectService
.
deleteProject
(
pid
,
UserThreadLocal
.
getProjectId
());
ProjectService
.
deleteProject
(
pid
,
UserThreadLocal
.
getProjectId
());
behaviorService
.
pushBehavior
(
OPERATION
,
"删除项目:"
+
pid
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除项目:"
+
pid
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -110,7 +110,7 @@ public class ProjectController extends BaseController {
...
@@ -110,7 +110,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@PutMapping
(
"/switch/projectShow/{pid}"
)
@PutMapping
(
"/switch/projectShow/{pid}"
)
public
ResponseResult
switchProjectShow
(
@PathVariable
String
pid
)
{
public
ResponseResult
switchProjectShow
(
@PathVariable
String
pid
)
{
boolean
result
=
i
ProjectService
.
switchProjectShow
(
pid
);
boolean
result
=
ProjectService
.
switchProjectShow
(
pid
);
if
(
result
)
{
if
(
result
)
{
behaviorService
.
pushBehavior
(
OPERATION
,
"切换项目展示状态:"
+
pid
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"切换项目展示状态:"
+
pid
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
...
@@ -123,7 +123,7 @@ public class ProjectController extends BaseController {
...
@@ -123,7 +123,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@PutMapping
(
"/switch/projectStart/{pid}"
)
@PutMapping
(
"/switch/projectStart/{pid}"
)
public
ResponseResult
switchProjectStart
(
@PathVariable
String
pid
)
{
public
ResponseResult
switchProjectStart
(
@PathVariable
String
pid
)
{
i
ProjectService
.
switchProjectStart
(
pid
);
ProjectService
.
switchProjectStart
(
pid
);
behaviorService
.
pushBehavior
(
OPERATION
,
"切换项目状态:"
+
pid
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"切换项目状态:"
+
pid
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -132,7 +132,7 @@ public class ProjectController extends BaseController {
...
@@ -132,7 +132,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@GetMapping
(
"/get/{pid}"
)
@GetMapping
(
"/get/{pid}"
)
public
ResponseResult
getProjectVOById
(
@PathVariable
(
"pid"
)
String
pid
)
{
public
ResponseResult
getProjectVOById
(
@PathVariable
(
"pid"
)
String
pid
)
{
return
ResponseResult
.
success
(
i
ProjectService
.
getProjectVOById
(
pid
));
return
ResponseResult
.
success
(
ProjectService
.
getProjectVOById
(
pid
));
}
}
@ApiOperation
(
"图片上传"
)
@ApiOperation
(
"图片上传"
)
...
@@ -153,7 +153,7 @@ public class ProjectController extends BaseController {
...
@@ -153,7 +153,7 @@ public class ProjectController extends BaseController {
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@GetMapping
(
"/download/keyword/{pid}"
)
@GetMapping
(
"/download/keyword/{pid}"
)
public
ResponseResult
downloadArticles
(
@PathVariable
(
"pid"
)
String
pid
)
{
public
ResponseResult
downloadArticles
(
@PathVariable
(
"pid"
)
String
pid
)
{
ProjectVO
project
=
i
ProjectService
.
getProjectVOById
(
pid
);
ProjectVO
project
=
ProjectService
.
getProjectVOById
(
pid
);
EasyExcelUtil
.
download
(
project
.
getBrandName
()
+
"_命中关键词"
,
"sheet1"
,
UploadKeywordDTO
.
class
,
UploadKeywordDTO
.
change2This
(
project
.
getHitKeywords
()),
response
);
EasyExcelUtil
.
download
(
project
.
getBrandName
()
+
"_命中关键词"
,
"sheet1"
,
UploadKeywordDTO
.
class
,
UploadKeywordDTO
.
change2This
(
project
.
getHitKeywords
()),
response
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -202,7 +202,7 @@ public class ProjectController extends BaseController {
...
@@ -202,7 +202,7 @@ public class ProjectController extends BaseController {
@GetMapping
(
"/user/getUserAllProjects"
)
@GetMapping
(
"/user/getUserAllProjects"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
ResponseResult
getUserAllProjects
()
{
public
ResponseResult
getUserAllProjects
()
{
return
ResponseResult
.
success
(
i
ProjectService
.
getUserAllProjects
());
return
ResponseResult
.
success
(
ProjectService
.
getUserAllProjects
());
}
}
}
}
src/main/java/com/zhiwei/brandkbs2/controller/admin/ReportController.java
View file @
d6139789
...
@@ -4,7 +4,7 @@ import com.zhiwei.brandkbs2.auth.Auth;
...
@@ -4,7 +4,7 @@ import com.zhiwei.brandkbs2.auth.Auth;
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.dto.ReportSettingsDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSettingsDTO
;
import
com.zhiwei.brandkbs2.service.
I
ReportService
;
import
com.zhiwei.brandkbs2.service.ReportService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -24,7 +24,7 @@ import javax.annotation.Resource;
...
@@ -24,7 +24,7 @@ import javax.annotation.Resource;
public
class
ReportController
{
public
class
ReportController
{
@Resource
(
name
=
"reportServiceImpl"
)
@Resource
(
name
=
"reportServiceImpl"
)
private
I
ReportService
reportService
;
private
ReportService
reportService
;
@ApiOperation
(
"获取简报设置"
)
@ApiOperation
(
"获取简报设置"
)
...
...
src/main/java/com/zhiwei/brandkbs2/controller/admin/UserController.java
View file @
d6139789
...
@@ -6,8 +6,8 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
...
@@ -6,8 +6,8 @@ import com.zhiwei.brandkbs2.enmus.RoleEnum;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.service.
I
BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.service.
I
UserService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
...
@@ -31,10 +31,10 @@ import javax.annotation.Resource;
...
@@ -31,10 +31,10 @@ import javax.annotation.Resource;
public
class
UserController
extends
BaseController
{
public
class
UserController
extends
BaseController
{
@Resource
(
name
=
"userServiceImpl"
)
@Resource
(
name
=
"userServiceImpl"
)
private
IUserService
i
UserService
;
private
UserService
UserService
;
@Resource
(
name
=
"behaviorServiceImpl"
)
@Resource
(
name
=
"behaviorServiceImpl"
)
private
I
BehaviorService
behaviorService
;
private
BehaviorService
behaviorService
;
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"用户管理"
,
true
);
private
static
final
Behavior
.
Operation
OPERATION
=
new
Behavior
.
Operation
(
"用户管理"
,
true
);
...
@@ -55,7 +55,7 @@ public class UserController extends BaseController {
...
@@ -55,7 +55,7 @@ public class UserController extends BaseController {
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
,
@RequestParam
(
value
=
"pid"
)
String
pid
,
@RequestParam
(
value
=
"pid"
)
String
pid
,
@RequestParam
(
value
=
"role"
,
defaultValue
=
"-1"
)
int
role
)
{
@RequestParam
(
value
=
"role"
,
defaultValue
=
"-1"
)
int
role
)
{
return
ResponseResult
.
success
(
i
UserService
.
findUserList
(
page
,
size
,
keyword
,
pid
,
role
));
return
ResponseResult
.
success
(
UserService
.
findUserList
(
page
,
size
,
keyword
,
pid
,
role
));
}
}
@ApiOperation
(
"根据手机号搜索用户信息"
)
@ApiOperation
(
"根据手机号搜索用户信息"
)
...
@@ -77,7 +77,7 @@ public class UserController extends BaseController {
...
@@ -77,7 +77,7 @@ public class UserController extends BaseController {
@ApiOperation
(
"添加用户"
)
@ApiOperation
(
"添加用户"
)
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
public
ResponseResult
addUser
(
@RequestBody
UserDTO
userDTO
)
{
public
ResponseResult
addUser
(
@RequestBody
UserDTO
userDTO
)
{
i
UserService
.
addUser
(
userDTO
);
UserService
.
addUser
(
userDTO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"添加用户:"
+
userDTO
.
getId
(),
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"添加用户:"
+
userDTO
.
getId
(),
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -89,7 +89,7 @@ public class UserController extends BaseController {
...
@@ -89,7 +89,7 @@ public class UserController extends BaseController {
@DeleteMapping
(
"/delete"
)
@DeleteMapping
(
"/delete"
)
@Auth
(
role
=
RoleEnum
.
ADMIN
)
@Auth
(
role
=
RoleEnum
.
ADMIN
)
public
ResponseResult
deleteUser
(
@RequestParam
(
value
=
"uid"
)
String
userId
,
@RequestParam
(
value
=
"pid"
)
String
pid
)
{
public
ResponseResult
deleteUser
(
@RequestParam
(
value
=
"uid"
)
String
userId
,
@RequestParam
(
value
=
"pid"
)
String
pid
)
{
i
UserService
.
deleteUser
(
userId
,
pid
);
UserService
.
deleteUser
(
userId
,
pid
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除用户:"
+
userId
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除用户:"
+
userId
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -97,7 +97,7 @@ public class UserController extends BaseController {
...
@@ -97,7 +97,7 @@ public class UserController extends BaseController {
@ApiOperation
(
"编辑用户"
)
@ApiOperation
(
"编辑用户"
)
@PutMapping
(
"/update"
)
@PutMapping
(
"/update"
)
public
ResponseResult
updateUser
(
@RequestBody
UserDTO
userDTO
)
{
public
ResponseResult
updateUser
(
@RequestBody
UserDTO
userDTO
)
{
i
UserService
.
updateUser
(
userDTO
);
UserService
.
updateUser
(
userDTO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"编辑用户:"
+
userDTO
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"编辑用户:"
+
userDTO
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -113,14 +113,14 @@ public class UserController extends BaseController {
...
@@ -113,14 +113,14 @@ public class UserController extends BaseController {
public
ResponseResult
findSuperAdminList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
public
ResponseResult
findSuperAdminList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
return
ResponseResult
.
success
(
i
UserService
.
findSuperAdminList
(
page
,
size
,
keyword
));
return
ResponseResult
.
success
(
UserService
.
findSuperAdminList
(
page
,
size
,
keyword
));
}
}
@ApiOperation
(
"添加超级管理员"
)
@ApiOperation
(
"添加超级管理员"
)
@PostMapping
(
"/add/superAdmin"
)
@PostMapping
(
"/add/superAdmin"
)
@Auth
(
role
=
RoleEnum
.
SUPER_ADMIN
)
@Auth
(
role
=
RoleEnum
.
SUPER_ADMIN
)
public
ResponseResult
addSuperAdmin
(
@RequestBody
UserDTO
userDTO
)
{
public
ResponseResult
addSuperAdmin
(
@RequestBody
UserDTO
userDTO
)
{
i
UserService
.
addSuperAdmin
(
userDTO
);
UserService
.
addSuperAdmin
(
userDTO
);
behaviorService
.
pushBehavior
(
OPERATION
,
"添加超级管理员:"
+
userDTO
.
getId
(),
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"添加超级管理员:"
+
userDTO
.
getId
(),
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
@@ -131,7 +131,7 @@ public class UserController extends BaseController {
...
@@ -131,7 +131,7 @@ public class UserController extends BaseController {
@DeleteMapping
(
"/delete/superAdmin"
)
@DeleteMapping
(
"/delete/superAdmin"
)
@Auth
(
role
=
RoleEnum
.
SUPER_ADMIN
)
@Auth
(
role
=
RoleEnum
.
SUPER_ADMIN
)
public
ResponseResult
deleteSuperAdmin
(
@RequestParam
(
value
=
"uid"
)
String
userId
)
{
public
ResponseResult
deleteSuperAdmin
(
@RequestParam
(
value
=
"uid"
)
String
userId
)
{
i
UserService
.
deleteSuperAdmin
(
userId
);
UserService
.
deleteSuperAdmin
(
userId
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除超级管理员:"
+
userId
,
request
);
behaviorService
.
pushBehavior
(
OPERATION
,
"删除超级管理员:"
+
userId
,
request
);
return
ResponseResult
.
success
();
return
ResponseResult
.
success
();
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/controller/AppArticleController.java
→
src/main/java/com/zhiwei/brandkbs2/controller/
app/
AppArticleController.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
controller
;
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.Auth
;
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.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.service.IMarkDataService
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportDTO
;
import
com.zhiwei.brandkbs2.service.IReportService
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSearchDTO
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ReportService
;
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
;
...
@@ -27,10 +31,13 @@ import javax.annotation.Resource;
...
@@ -27,10 +31,13 @@ import javax.annotation.Resource;
public
class
AppArticleController
extends
BaseController
{
public
class
AppArticleController
extends
BaseController
{
@Resource
(
name
=
"markDataServiceImpl"
)
@Resource
(
name
=
"markDataServiceImpl"
)
I
MarkDataService
markDataService
;
MarkDataService
markDataService
;
@Resource
(
name
=
"reportServiceImpl"
)
@Resource
(
name
=
"reportServiceImpl"
)
IReportService
reportService
;
ReportService
reportService
;
@Resource
(
name
=
"commonServiceImpl"
)
CommonService
commonService
;
@ApiOperation
(
"舆情列表"
)
@ApiOperation
(
"舆情列表"
)
@PostMapping
(
"/mark/list"
)
@PostMapping
(
"/mark/list"
)
...
@@ -38,6 +45,12 @@ public class AppArticleController extends BaseController {
...
@@ -38,6 +45,12 @@ public class AppArticleController extends BaseController {
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
}
}
@ApiOperation
(
"舆情列表-生成聚合"
)
@PostMapping
(
"/mark/agree"
)
public
ResponseResult
generateYuqingMarkAggreeList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
return
ResponseResult
.
success
(
markDataService
.
generateYuqingMarkAggreeList
(
markSearchDTO
));
}
@ApiOperation
(
"舆情列表-搜索条件"
)
@ApiOperation
(
"舆情列表-搜索条件"
)
@GetMapping
(
"/mark/list/criteria"
)
@GetMapping
(
"/mark/list/criteria"
)
public
ResponseResult
getYuqingMark
(
@RequestParam
(
required
=
false
)
String
linkedGroupId
)
{
public
ResponseResult
getYuqingMark
(
@RequestParam
(
required
=
false
)
String
linkedGroupId
)
{
...
@@ -62,7 +75,7 @@ public class AppArticleController extends BaseController {
...
@@ -62,7 +75,7 @@ public class AppArticleController extends BaseController {
return
ResponseResult
.
success
(
markDataService
.
getMarkSpread
(
startTime
,
endTime
,
true
));
return
ResponseResult
.
success
(
markDataService
.
getMarkSpread
(
startTime
,
endTime
,
true
));
}
}
@ApiOperation
(
"舆情分析-
平台
曝光对比"
)
@ApiOperation
(
"舆情分析-
品牌
曝光对比"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@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"
)
...
@@ -98,16 +111,41 @@ public class AppArticleController extends BaseController {
...
@@ -98,16 +111,41 @@ public class AppArticleController extends BaseController {
})
})
@GetMapping
(
"/highWord"
)
@GetMapping
(
"/highWord"
)
public
ResponseResult
getMarkHighWord
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
public
ResponseResult
getMarkHighWord
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
)
{
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
)
{
return
ResponseResult
.
success
(
markDataService
.
getMarkHighWord
(
startTime
,
endTime
));
return
ResponseResult
.
success
(
markDataService
.
getMarkHighWord
(
startTime
,
endTime
));
}
}
@ApiOperation
(
"舆情分析-获取默认时间"
)
@GetMapping
(
"/default/time"
)
public
ResponseResult
getDefaultTime
()
{
return
ResponseResult
.
success
(
commonService
.
getTimeRangeMonth
());
}
@ApiOperation
(
"舆情简报-分类统计"
)
@ApiOperation
(
"舆情简报-分类统计"
)
@GetMapping
(
"/aggCount"
)
@GetMapping
(
"/
report/
aggCount"
)
public
ResponseResult
getReportsAggCount
()
{
public
ResponseResult
getReportsAggCount
()
{
return
ResponseResult
.
success
(
reportService
.
getReportsAggCount
());
return
ResponseResult
.
success
(
reportService
.
getReportsAggCount
());
}
}
@ApiOperation
(
"舆情简报-全部报告列表"
)
@GetMapping
(
"/report/list"
)
public
ResponseResult
findReportList
(
ReportSearchDTO
reportSearch
)
{
return
ResponseResult
.
success
(
reportService
.
findReportList
(
reportSearch
));
}
@ApiOperation
(
"舆情简报-添加自定义简报"
)
@PostMapping
(
"report/custom/add"
)
public
ResponseResult
addCustomReport
(
@RequestBody
ReportDTO
reportDTO
)
{
reportService
.
addCustomReport
(
reportDTO
);
return
ResponseResult
.
success
();
}
@ApiOperation
(
"舆情简报-删除简报"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"报告ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"String"
)
@DeleteMapping
(
"report/{id}"
)
public
ResponseResult
deleteReportById
(
@PathVariable
String
id
)
{
reportService
.
deleteReportById
(
id
);
return
ResponseResult
.
success
();
}
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/GlobalController.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
controller
.
app
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.service.MarkFlowService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
/**
* @ClassName: GlobalController
* @Description 全局通用获取Controller
* @author: sjj
* @date: 2022-07-15 10:33
*/
@RestController
@RequestMapping
(
"/app/global"
)
@Api
(
tags
=
"全局通用接口"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
GlobalController
extends
BaseController
{
@Resource
(
name
=
"markFlowServiceImpl"
)
MarkFlowService
markFlowService
;
@ApiOperation
(
"内部快照-组装页面"
)
@PostMapping
(
"/shotPage"
)
public
ResponseResult
setShotPage
(
@RequestBody
String
markFlowEntity
)
{
return
ResponseResult
.
success
(
markFlowService
.
setShotPage
(
markFlowEntity
));
}
@ApiOperation
(
"内部快照-获取页面"
)
@GetMapping
(
"/shotPage/{id}"
)
public
ResponseResult
getShotPage
(
@PathVariable
(
name
=
"id"
)
String
id
)
{
return
ResponseResult
.
success
(
markFlowService
.
getShotPageFromCache
(
id
));
}
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
BaseMongoDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/BaseMongoDao.java
View file @
d6139789
...
@@ -15,7 +15,7 @@ import java.util.List;
...
@@ -15,7 +15,7 @@ import java.util.List;
* @date: 2022-04-29 14:45
* @date: 2022-04-29 14:45
*/
*/
public
interface
I
BaseMongoDao
<
T
extends
AbstractBaseMongo
>
{
public
interface
BaseMongoDao
<
T
extends
AbstractBaseMongo
>
{
/**
/**
* 插入一条数据
* 插入一条数据
...
@@ -54,6 +54,13 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
...
@@ -54,6 +54,13 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
void
deleteOneById
(
String
id
,
String
...
collectionNames
);
void
deleteOneById
(
String
id
,
String
...
collectionNames
);
/**
/**
* 通过id删除数据
*
* @param id 数据库唯一id
*/
void
deleteOneByIdWithQuery
(
String
id
,
Query
query
,
String
...
collectionNames
);
/**
* 通过id查找单条数据
* 通过id查找单条数据
*
*
* @param id 数据库唯一id
* @param id 数据库唯一id
...
@@ -95,7 +102,7 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
...
@@ -95,7 +102,7 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
* @param preQuery 查询请求
* @param preQuery 查询请求
* @return list<T>
* @return list<T>
*/
*/
List
<
T
>
findList
(
Query
preQuery
,
String
...
collectionNames
);
List
<
T
>
findList
(
Query
preQuery
,
String
...
collectionNames
);
/**
/**
* 量查询
* 量查询
...
@@ -106,18 +113,26 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
...
@@ -106,18 +113,26 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
long
count
(
Query
preQuery
,
String
...
collectionNames
);
long
count
(
Query
preQuery
,
String
...
collectionNames
);
/**
/**
* 量查询with关键词
*
* @param preQuery 查询请求
* @return long
*/
long
count
(
Query
preQuery
,
String
keyword
,
String
[]
matchFields
,
String
...
collectionNames
);
/**
* 添加模糊查询条件
* 添加模糊查询条件
*
*
* @param query query
* @param query
query
* @param keyword 关键字
* @param keyword
关键字
* @param fuzzKeys 匹配keys
* @param fuzzKeys 匹配keys
*/
*/
void
addKeywordFuzz
(
Query
query
,
String
keyword
,
String
...
fuzzKeys
);
void
addKeywordFuzz
(
Query
query
,
String
keyword
,
String
...
fuzzKeys
);
/**
/**
* 添加排序
* 添加排序
*
*
* @param query query
* @param query
query
* @param sorter 排序字段
* @param sorter 排序字段
*/
*/
void
addSort
(
Query
query
,
String
sorter
);
void
addSort
(
Query
query
,
String
sorter
);
...
@@ -133,6 +148,7 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
...
@@ -133,6 +148,7 @@ public interface IBaseMongoDao<T extends AbstractBaseMongo> {
criteria
.
and
(
"platform"
).
is
(
channelIndex
.
getPlatform
());
criteria
.
and
(
"platform"
).
is
(
channelIndex
.
getPlatform
());
criteria
.
and
(
"realSource"
).
is
(
channelIndex
.
getRealSource
());
criteria
.
and
(
"realSource"
).
is
(
channelIndex
.
getRealSource
());
criteria
.
and
(
"source"
).
is
(
channelIndex
.
getSource
());
criteria
.
and
(
"source"
).
is
(
channelIndex
.
getSource
());
criteria
.
and
(
"projectId"
).
is
(
channelIndex
.
getProjectId
());
criteria
.
and
(
"linkedGroupId"
).
is
(
channelIndex
.
getLinkedGroupId
());
criteria
.
and
(
"linkedGroupId"
).
is
(
channelIndex
.
getLinkedGroupId
());
return
criteria
;
return
criteria
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
BehaviorDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/BehaviorDao.java
View file @
d6139789
...
@@ -3,10 +3,10 @@ package com.zhiwei.brandkbs2.dao;
...
@@ -3,10 +3,10 @@ package com.zhiwei.brandkbs2.dao;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
/**
/**
* @ClassName:
I
BehaviorDao
* @ClassName: BehaviorDao
* @Description
I
BehaviorDao
* @Description BehaviorDao
* @author: sjj
* @author: sjj
* @date: 2022-05-27 13:46
* @date: 2022-05-27 13:46
*/
*/
public
interface
IBehaviorDao
extends
IBaseMongoDao
<
Behavior
>,
I
ShardingMongo
{
public
interface
BehaviorDao
extends
BaseMongoDao
<
Behavior
>,
ShardingMongo
{
}
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
BrandkbsTaskDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/BrandkbsTaskDao.java
View file @
d6139789
...
@@ -3,12 +3,12 @@ package com.zhiwei.brandkbs2.dao;
...
@@ -3,12 +3,12 @@ package com.zhiwei.brandkbs2.dao;
import
com.zhiwei.brandkbs2.pojo.BrandkbsTask
;
import
com.zhiwei.brandkbs2.pojo.BrandkbsTask
;
/**
/**
* @ClassName:
I
BrandkbsTaskDao
* @ClassName: BrandkbsTaskDao
* @Description
I
BrandkbsTaskDao
* @Description BrandkbsTaskDao
* @author: sjj
* @author: sjj
* @date: 2022-07-12 17:25
* @date: 2022-07-12 17:25
*/
*/
public
interface
IBrandkbsTaskDao
extends
I
BaseMongoDao
<
BrandkbsTask
>
{
public
interface
BrandkbsTaskDao
extends
BaseMongoDao
<
BrandkbsTask
>
{
/**
/**
* 根据任务名称获取任务
* 根据任务名称获取任务
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
ChannelDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/ChannelDao.java
View file @
d6139789
...
@@ -4,12 +4,12 @@ import com.zhiwei.brandkbs2.pojo.Channel;
...
@@ -4,12 +4,12 @@ import com.zhiwei.brandkbs2.pojo.Channel;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
/**
/**
* @ClassName:
I
ChannelDao
* @ClassName: ChannelDao
* @Description
I
ChannelDao
* @Description ChannelDao
* @author: sjj
* @author: sjj
* @date: 2022-06-16 15:30
* @date: 2022-06-16 15:30
*/
*/
public
interface
IChannelDao
extends
I
BaseMongoDao
<
Channel
>{
public
interface
ChannelDao
extends
BaseMongoDao
<
Channel
>{
Channel
queryUnique
(
ChannelIndex
channelIndex
);
Channel
queryUnique
(
ChannelIndex
channelIndex
);
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
ChannelLabelDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/ChannelLabelDao.java
View file @
d6139789
...
@@ -10,7 +10,7 @@ import java.util.List;
...
@@ -10,7 +10,7 @@ import java.util.List;
* @author: sjj
* @author: sjj
* @date: 2022-06-20 16:53
* @date: 2022-06-20 16:53
*/
*/
public
interface
IChannelLabelDao
extends
I
BaseMongoDao
<
ChannelLabel
>{
public
interface
ChannelLabelDao
extends
BaseMongoDao
<
ChannelLabel
>{
List
<
String
>
getChannelLabelType
();
List
<
String
>
getChannelLabelType
();
...
...
src/main/java/com/zhiwei/brandkbs2/dao/ChannelTagDao.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.zhiwei.brandkbs2.pojo.ChannelTag
;
/**
* @ClassName: ChannelTagDao
* @Description ChannelTagDao
* @author: sjj
* @date: 2022-07-13 14:28
*/
public
interface
ChannelTagDao
extends
BaseMongoDao
<
ChannelTag
>{
String
getTagByChannelName
(
String
name
);
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
CustomTagDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/CustomTagDao.java
View file @
d6139789
...
@@ -5,12 +5,12 @@ import com.zhiwei.brandkbs2.pojo.CustomTag;
...
@@ -5,12 +5,12 @@ import com.zhiwei.brandkbs2.pojo.CustomTag;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
CustomTagDao
* @ClassName: CustomTagDao
* @Description
I
CustomTagDao
* @Description CustomTagDao
* @author: sjj
* @author: sjj
* @date: 2022-07-04 13:43
* @date: 2022-07-04 13:43
*/
*/
public
interface
ICustomTagDao
extends
I
BaseMongoDao
<
CustomTag
>
{
public
interface
CustomTagDao
extends
BaseMongoDao
<
CustomTag
>
{
/**
/**
* 查询所有自定义标签(按创建时间降序)
* 查询所有自定义标签(按创建时间降序)
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
EventDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/EventDao.java
View file @
d6139789
...
@@ -3,12 +3,12 @@ package com.zhiwei.brandkbs2.dao;
...
@@ -3,12 +3,12 @@ package com.zhiwei.brandkbs2.dao;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.Event
;
/**
/**
* @ClassName:
I
EventDao
* @ClassName: EventDao
* @Description
I
EventDao
* @Description EventDao
* @author: sjj
* @author: sjj
* @date: 2022-05-18 14:35
* @date: 2022-05-18 14:35
*/
*/
public
interface
IEventDao
extends
I
BaseMongoDao
<
Event
>{
public
interface
EventDao
extends
BaseMongoDao
<
Event
>{
/**
/**
* 是否已存在事件
* 是否已存在事件
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
EventDataDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/EventDataDao.java
View file @
d6139789
...
@@ -8,12 +8,12 @@ import java.util.Date;
...
@@ -8,12 +8,12 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
EventDataDao
* @ClassName: EventDataDao
* @Description
I
EventDataDao
* @Description EventDataDao
* @author: sjj
* @author: sjj
* @date: 2022-05-19 16:08
* @date: 2022-05-19 16:08
*/
*/
public
interface
IEventDataDao
extends
IBaseMongoDao
<
EventData
>,
I
ShardingMongo
{
public
interface
EventDataDao
extends
BaseMongoDao
<
EventData
>,
ShardingMongo
{
/**
/**
* 获取首发稿件
* 获取首发稿件
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
HighWordDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/HighWordDao.java
View file @
d6139789
...
@@ -3,10 +3,10 @@ package com.zhiwei.brandkbs2.dao;
...
@@ -3,10 +3,10 @@ package com.zhiwei.brandkbs2.dao;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
/**
/**
* @ClassName:
I
HighWordDao
* @ClassName: HighWordDao
* @Description
I
HighWordDao
* @Description HighWordDao
* @author: sjj
* @author: sjj
* @date: 2022-06-06 09:47
* @date: 2022-06-06 09:47
*/
*/
public
interface
IHighWordDao
extends
I
BaseMongoDao
<
HighWord
>{
public
interface
HighWordDao
extends
BaseMongoDao
<
HighWord
>{
}
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
ProjectDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/ProjectDao.java
View file @
d6139789
...
@@ -5,9 +5,9 @@ import com.zhiwei.brandkbs2.pojo.Project;
...
@@ -5,9 +5,9 @@ import com.zhiwei.brandkbs2.pojo.Project;
/**
/**
* @author sjj
* @author sjj
* @version 1.0
* @version 1.0
* @description
I
ProjectDao
* @description ProjectDao
* @date 2022年4月20日17:38:54
* @date 2022年4月20日17:38:54
*/
*/
public
interface
IProjectDao
extends
I
BaseMongoDao
<
Project
>{
public
interface
ProjectDao
extends
BaseMongoDao
<
Project
>{
}
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
QbjcPojoDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/QbjcPojoDao.java
View file @
d6139789
...
@@ -6,14 +6,14 @@ import com.zhiwei.qbjc.bean.pojo.common.Tag;
...
@@ -6,14 +6,14 @@ import com.zhiwei.qbjc.bean.pojo.common.Tag;
import
java.util.List
;
import
java.util.List
;
/**
/**
*
I
QbjcPojoDao-interface
* QbjcPojoDao-interface
*
*
* @ClassName:
I
QbjcPojoDao
* @ClassName: QbjcPojoDao
* @Description
I
QbjcPojoDao-interface
* @Description QbjcPojoDao-interface
* @author sjj
* @author sjj
* @date 2022年6月16日14:23:36
* @date 2022年6月16日14:23:36
*/
*/
public
interface
I
QbjcPojoDao
{
public
interface
QbjcPojoDao
{
/**
/**
* 获取qbjcPlatform
* 获取qbjcPlatform
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
ReportDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/ReportDao.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
;
package
com
.
zhiwei
.
brandkbs2
.
dao
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.Report
;
import
com.zhiwei.brandkbs2.pojo.Report
;
import
java.util.List
;
/**
/**
* @ClassName:
I
ReportDao
* @ClassName: ReportDao
* @Description
I
ReportDao
* @Description ReportDao
* @author: sjj
* @author: sjj
* @date: 2022-05-31 18:13
* @date: 2022-05-31 18:13
*/
*/
public
interface
IReportDao
extends
IBaseMongoDao
<
Report
>
{
public
interface
ReportDao
extends
BaseMongoDao
<
Report
>
{
List
<
JSONObject
>
getReportAggCount
(
String
projectId
);
}
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
ReportSettingsDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/ReportSettingsDao.java
View file @
d6139789
...
@@ -2,11 +2,16 @@ package com.zhiwei.brandkbs2.dao;
...
@@ -2,11 +2,16 @@ package com.zhiwei.brandkbs2.dao;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
java.util.List
;
/**
/**
* @ClassName:
I
ReportSettingsDao
* @ClassName: ReportSettingsDao
* @Description
I
ReportSettingsDao
* @Description ReportSettingsDao
* @author: sjj
* @author: sjj
* @date: 2022-05-31 18:13
* @date: 2022-05-31 18:13
*/
*/
public
interface
IReportSettingsDao
extends
IBaseMongoDao
<
ReportSettings
>
{
public
interface
ReportSettingsDao
extends
BaseMongoDao
<
ReportSettings
>
{
List
<
ReportSettings
>
getReportSettingByProjectWithUsed
(
String
projectId
);
}
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
ShardingMongo.java
→
src/main/java/com/zhiwei/brandkbs2/dao/ShardingMongo.java
View file @
d6139789
...
@@ -5,12 +5,12 @@ import com.zhiwei.brandkbs2.util.IndexUtil;
...
@@ -5,12 +5,12 @@ import com.zhiwei.brandkbs2.util.IndexUtil;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
* @ClassName:
I
ShardingMongo
* @ClassName: ShardingMongo
* @Description 分库mongo接口
* @Description 分库mongo接口
* @author: sjj
* @author: sjj
* @date: 2022-05-27 11:29
* @date: 2022-05-27 11:29
*/
*/
public
interface
I
ShardingMongo
{
public
interface
ShardingMongo
{
String
collectionPrefix
();
String
collectionPrefix
();
...
...
src/main/java/com/zhiwei/brandkbs2/dao/
I
TagFilterDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/TagFilterDao.java
View file @
d6139789
...
@@ -3,10 +3,10 @@ package com.zhiwei.brandkbs2.dao;
...
@@ -3,10 +3,10 @@ package com.zhiwei.brandkbs2.dao;
import
com.zhiwei.brandkbs2.pojo.TagFilter
;
import
com.zhiwei.brandkbs2.pojo.TagFilter
;
/**
/**
* @ClassName:
I
TagFilterDao
* @ClassName: TagFilterDao
* @Description
I
TagFilterDao
* @Description TagFilterDao
* @author: sjj
* @author: sjj
* @date: 2022-06-01 13:52
* @date: 2022-06-01 13:52
*/
*/
public
interface
ITagFilterDao
extends
I
BaseMongoDao
<
TagFilter
>{
public
interface
TagFilterDao
extends
BaseMongoDao
<
TagFilter
>{
}
}
src/main/java/com/zhiwei/brandkbs2/dao/
I
UserDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/UserDao.java
View file @
d6139789
...
@@ -3,11 +3,11 @@ package com.zhiwei.brandkbs2.dao;
...
@@ -3,11 +3,11 @@ package com.zhiwei.brandkbs2.dao;
import
com.zhiwei.brandkbs2.pojo.User
;
import
com.zhiwei.brandkbs2.pojo.User
;
/**
/**
* @ClassName:
I
UserDao
* @ClassName: UserDao
* @Description 用户相关接口
* @Description 用户相关接口
* @author: sjj
* @author: sjj
* @date: 2022-04-28 18:10
* @date: 2022-04-28 18:10
*/
*/
public
interface
IUserDao
extends
I
BaseMongoDao
<
User
>{
public
interface
UserDao
extends
BaseMongoDao
<
User
>{
}
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/BaseMongoDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.
I
BaseMongoDao
;
import
com.zhiwei.brandkbs2.dao.BaseMongoDao
;
import
com.zhiwei.brandkbs2.pojo.AbstractBaseMongo
;
import
com.zhiwei.brandkbs2.pojo.AbstractBaseMongo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.bson.Document
;
import
org.bson.Document
;
...
@@ -24,7 +24,7 @@ import java.util.regex.Pattern;
...
@@ -24,7 +24,7 @@ import java.util.regex.Pattern;
* @author: sjj
* @author: sjj
* @date: 2022-04-29 15:11
* @date: 2022-04-29 15:11
*/
*/
public
class
BaseMongoDaoImpl
<
T
extends
AbstractBaseMongo
>
implements
I
BaseMongoDao
<
T
>
{
public
class
BaseMongoDaoImpl
<
T
extends
AbstractBaseMongo
>
implements
BaseMongoDao
<
T
>
{
protected
static
final
String
ID
=
"_id"
;
protected
static
final
String
ID
=
"_id"
;
private
final
String
collectionName
;
private
final
String
collectionName
;
...
@@ -77,6 +77,11 @@ public class BaseMongoDaoImpl<T extends AbstractBaseMongo> implements IBaseMongo
...
@@ -77,6 +77,11 @@ public class BaseMongoDaoImpl<T extends AbstractBaseMongo> implements IBaseMongo
}
}
@Override
@Override
public
void
deleteOneByIdWithQuery
(
String
id
,
Query
query
,
String
...
collectionNames
)
{
mongoTemplate
.
remove
(
query
.
addCriteria
(
Criteria
.
where
(
ID
).
is
(
id
)),
getCollections
(
collectionNames
)[
0
]);
}
@Override
public
T
findOneById
(
String
id
,
String
...
collectionNames
)
{
public
T
findOneById
(
String
id
,
String
...
collectionNames
)
{
return
mongoTemplate
.
findOne
(
new
Query
(
Criteria
.
where
(
ID
).
is
(
id
)),
clazz
,
getCollections
(
collectionNames
)[
0
]);
return
mongoTemplate
.
findOne
(
new
Query
(
Criteria
.
where
(
ID
).
is
(
id
)),
clazz
,
getCollections
(
collectionNames
)[
0
]);
}
}
...
@@ -119,10 +124,18 @@ public class BaseMongoDaoImpl<T extends AbstractBaseMongo> implements IBaseMongo
...
@@ -119,10 +124,18 @@ public class BaseMongoDaoImpl<T extends AbstractBaseMongo> implements IBaseMongo
@Override
@Override
public
long
count
(
Query
preQuery
,
String
...
collectionNames
)
{
public
long
count
(
Query
preQuery
,
String
...
collectionNames
)
{
return
count
(
preQuery
,
null
,
null
,
collectionNames
);
}
@Override
public
long
count
(
Query
preQuery
,
String
keyword
,
String
[]
matchFields
,
String
...
collectionNames
)
{
Query
query
=
new
Query
();
Query
query
=
new
Query
();
if
(
null
!=
preQuery
)
{
if
(
null
!=
preQuery
)
{
query
=
preQuery
;
query
=
preQuery
;
}
}
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
addKeywordFuzz
(
query
,
keyword
,
matchFields
);
}
long
count
=
0
;
long
count
=
0
;
for
(
String
collection
:
getCollections
(
collectionNames
))
{
for
(
String
collection
:
getCollections
(
collectionNames
))
{
count
+=
mongoTemplate
.
count
(
query
,
collection
);
count
+=
mongoTemplate
.
count
(
query
,
collection
);
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/BehaviorDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
BehaviorDao
;
import
com.zhiwei.brandkbs2.dao.BehaviorDao
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
com.zhiwei.brandkbs2.pojo.Behavior
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-05-27 13:48
* @date: 2022-05-27 13:48
*/
*/
@Component
(
"behaviorDao"
)
@Component
(
"behaviorDao"
)
public
class
BehaviorDaoImpl
extends
BaseMongoDaoImpl
<
Behavior
>
implements
I
BehaviorDao
{
public
class
BehaviorDaoImpl
extends
BaseMongoDaoImpl
<
Behavior
>
implements
BehaviorDao
{
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_behavior"
;
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_behavior"
;
private
static
final
String
TIME_PATTERN
=
"yyyyMM"
;
private
static
final
String
TIME_PATTERN
=
"yyyyMM"
;
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/BrandkbsTaskDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
BrandkbsTaskDao
;
import
com.zhiwei.brandkbs2.dao.BrandkbsTaskDao
;
import
com.zhiwei.brandkbs2.pojo.BrandkbsTask
;
import
com.zhiwei.brandkbs2.pojo.BrandkbsTask
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
...
@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
...
@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-07-12 17:27
* @date: 2022-07-12 17:27
*/
*/
@Component
(
"brandkbsTaskDao"
)
@Component
(
"brandkbsTaskDao"
)
public
class
BrandkbsTaskDaoImpl
extends
BaseMongoDaoImpl
<
BrandkbsTask
>
implements
I
BrandkbsTaskDao
{
public
class
BrandkbsTaskDaoImpl
extends
BaseMongoDaoImpl
<
BrandkbsTask
>
implements
BrandkbsTaskDao
{
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_task"
;
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_task"
;
public
BrandkbsTaskDaoImpl
()
{
public
BrandkbsTaskDaoImpl
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/ChannelDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
ChannelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.pojo.Channel
;
import
com.zhiwei.brandkbs2.pojo.Channel
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
...
@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
...
@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-06-16 15:31
* @date: 2022-06-16 15:31
*/
*/
@Component
(
"channelDao"
)
@Component
(
"channelDao"
)
public
class
ChannelDaoImpl
extends
BaseMongoDaoImpl
<
Channel
>
implements
I
ChannelDao
{
public
class
ChannelDaoImpl
extends
BaseMongoDaoImpl
<
Channel
>
implements
ChannelDao
{
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_channel"
;
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_channel"
;
...
@@ -24,11 +24,15 @@ public class ChannelDaoImpl extends BaseMongoDaoImpl<Channel> implements IChanne
...
@@ -24,11 +24,15 @@ public class ChannelDaoImpl extends BaseMongoDaoImpl<Channel> implements IChanne
@Override
@Override
public
Channel
queryUnique
(
ChannelIndex
channelIndex
)
{
public
Channel
queryUnique
(
ChannelIndex
channelIndex
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"linkedGroupId"
).
is
(
channelIndex
.
getLinkedGroupId
()).
if
(
null
==
channelIndex
)
{
and
(
"projectId"
).
is
(
channelIndex
.
getProjectId
()).
return
null
;
and
(
"platform"
).
is
(
channelIndex
.
getPlatform
()).
}
and
(
"realSource"
).
is
(
channelIndex
.
getRealSource
()).
// Query query = Query.query(Criteria.where("linkedGroupId").is(channelIndex.getLinkedGroupId()).
and
(
"source"
).
is
(
channelIndex
.
getSource
()));
// and("projectId").is(channelIndex.getProjectId()).
// and("platform").is(channelIndex.getPlatform()).
// and("realSource").is(channelIndex.getRealSource()).
// and("source").is(channelIndex.getSource()));
Query
query
=
Query
.
query
(
Criteria
.
where
(
"fid"
).
is
(
channelIndex
.
getFid
()));
return
mongoTemplate
.
findOne
(
query
,
clazz
,
COLLECTION_PREFIX
);
return
mongoTemplate
.
findOne
(
query
,
clazz
,
COLLECTION_PREFIX
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/ChannelLabelDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.
I
ChannelLabelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelLabelDao
;
import
com.zhiwei.brandkbs2.pojo.ChannelLabel
;
import
com.zhiwei.brandkbs2.pojo.ChannelLabel
;
import
org.springframework.data.mongodb.core.aggregation.Aggregation
;
import
org.springframework.data.mongodb.core.aggregation.Aggregation
;
import
org.springframework.data.mongodb.core.aggregation.AggregationResults
;
import
org.springframework.data.mongodb.core.aggregation.AggregationResults
;
...
@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
...
@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
* @date: 2022-06-20 16:56
* @date: 2022-06-20 16:56
*/
*/
@Component
(
"channelLabelDao"
)
@Component
(
"channelLabelDao"
)
public
class
ChannelLabelDaoImpl
extends
BaseMongoDaoImpl
<
ChannelLabel
>
implements
I
ChannelLabelDao
{
public
class
ChannelLabelDaoImpl
extends
BaseMongoDaoImpl
<
ChannelLabel
>
implements
ChannelLabelDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_channel_label"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_channel_label"
;
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/ChannelTagDaoImpl.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.ChannelTagDao
;
import
com.zhiwei.brandkbs2.pojo.ChannelTag
;
import
org.springframework.stereotype.Component
;
/**
* @ClassName: ChannelTagDaoImpl
* @Description ChannelTagDaoImpl
* @author: sjj
* @date: 2022-07-13 14:29
*/
@Component
(
"channelTagDao"
)
public
class
ChannelTagDaoImpl
extends
BaseMongoDaoImpl
<
ChannelTag
>
implements
ChannelTagDao
{
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_channel_tag"
;
public
ChannelTagDaoImpl
()
{
super
(
COLLECTION_PREFIX
);
}
@Override
public
String
getTagByChannelName
(
String
name
)
{
ChannelTag
channelTag
=
findOne
(
"channel"
,
name
);
if
(
null
==
channelTag
)
{
return
null
;
}
return
channelTag
.
getTag
();
}
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/CustomTagDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
CustomTagDao
;
import
com.zhiwei.brandkbs2.dao.CustomTagDao
;
import
com.zhiwei.brandkbs2.pojo.CustomTag
;
import
com.zhiwei.brandkbs2.pojo.CustomTag
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -14,7 +14,7 @@ import java.util.List;
...
@@ -14,7 +14,7 @@ import java.util.List;
* @date: 2022-07-04 13:46
* @date: 2022-07-04 13:46
*/
*/
@Component
(
"customTagDao"
)
@Component
(
"customTagDao"
)
public
class
CustomTagDaoImpl
extends
BaseMongoDaoImpl
<
CustomTag
>
implements
I
CustomTagDao
{
public
class
CustomTagDaoImpl
extends
BaseMongoDaoImpl
<
CustomTag
>
implements
CustomTagDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_custom_tag"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_custom_tag"
;
public
CustomTagDaoImpl
()
{
public
CustomTagDaoImpl
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
...
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
...
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-05-18 14:45
* @date: 2022-05-18 14:45
*/
*/
@Component
(
"eventDao"
)
@Component
(
"eventDao"
)
public
class
EventDaoImpl
extends
BaseMongoDaoImpl
<
Event
>
implements
I
EventDao
{
public
class
EventDaoImpl
extends
BaseMongoDaoImpl
<
Event
>
implements
EventDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_event"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_event"
;
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/EventDataDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.
I
EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.EventData
;
import
com.zhiwei.brandkbs2.pojo.EventData
;
...
@@ -12,6 +12,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
...
@@ -12,6 +12,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -23,7 +24,7 @@ import java.util.stream.Collectors;
...
@@ -23,7 +24,7 @@ import java.util.stream.Collectors;
* @date: 2022-05-19 17:42
* @date: 2022-05-19 17:42
*/
*/
@Component
(
"eventDataDao"
)
@Component
(
"eventDataDao"
)
public
class
EventDataDaoImpl
extends
BaseMongoDaoImpl
<
EventData
>
implements
I
EventDataDao
{
public
class
EventDataDaoImpl
extends
BaseMongoDaoImpl
<
EventData
>
implements
EventDataDao
{
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_event_data"
;
private
static
final
String
COLLECTION_PREFIX
=
"brandkbs_event_data"
;
private
static
final
String
TIME_PATTERN
=
"yyyy"
;
private
static
final
String
TIME_PATTERN
=
"yyyy"
;
...
@@ -57,7 +58,7 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements IEv
...
@@ -57,7 +58,7 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements IEv
Criteria
criteria
=
addChannelIndex
(
channelIndex
);
Criteria
criteria
=
addChannelIndex
(
channelIndex
);
// 分组
// 分组
Aggregation
agg
=
Aggregation
.
newAggregation
(
Aggregation
.
match
(
criteria
),
Aggregation
.
group
(
"eventId"
).
count
().
as
(
"eventCount"
));
Aggregation
agg
=
Aggregation
.
newAggregation
(
Aggregation
.
match
(
criteria
),
Aggregation
.
group
(
"eventId"
).
count
().
as
(
"eventCount"
));
AggregationResults
<
JSONObject
>
aggregate
=
mongoTemplate
.
aggregate
(
agg
,
"brandkbs_event_data_2022"
,
JSONObject
.
class
);
AggregationResults
<
JSONObject
>
aggregate
=
mongoTemplate
.
aggregate
(
agg
,
getAggreeCollection
()
,
JSONObject
.
class
);
List
<
JSONObject
>
mappedResults
=
aggregate
.
getMappedResults
();
List
<
JSONObject
>
mappedResults
=
aggregate
.
getMappedResults
();
return
mappedResults
.
stream
().
map
(
json
->
json
.
getString
(
"_id"
)).
collect
(
Collectors
.
toList
());
return
mappedResults
.
stream
().
map
(
json
->
json
.
getString
(
"_id"
)).
collect
(
Collectors
.
toList
());
}
}
...
@@ -90,4 +91,10 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements IEv
...
@@ -90,4 +91,10 @@ public class EventDataDaoImpl extends BaseMongoDaoImpl<EventData> implements IEv
return
mongoTemplate
.
count
(
query
,
EventData
.
class
,
collectionName
);
return
mongoTemplate
.
count
(
query
,
EventData
.
class
,
collectionName
);
}
}
private
String
getAggreeCollection
()
{
Calendar
date
=
Calendar
.
getInstance
();
int
year
=
date
.
get
(
Calendar
.
YEAR
);
return
COLLECTION_PREFIX
+
"_"
+
year
;
}
}
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/HighWordDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
HighWordDao
;
import
com.zhiwei.brandkbs2.dao.HighWordDao
;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-06-06 09:48
* @date: 2022-06-06 09:48
*/
*/
@Component
(
"highWordDao"
)
@Component
(
"highWordDao"
)
public
class
HighWordDaoImpl
extends
BaseMongoDaoImpl
<
HighWord
>
implements
I
HighWordDao
{
public
class
HighWordDaoImpl
extends
BaseMongoDaoImpl
<
HighWord
>
implements
HighWordDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_high_word"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_high_word"
;
public
HighWordDaoImpl
()
{
public
HighWordDaoImpl
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/ProjectDaoImlp.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
ProjectDao
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.pojo.Project
;
import
com.zhiwei.brandkbs2.pojo.Project
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-04-21 13:51
* @date: 2022-04-21 13:51
*/
*/
@Component
(
"projectDao"
)
@Component
(
"projectDao"
)
public
class
ProjectDaoImlp
extends
BaseMongoDaoImpl
<
Project
>
implements
I
ProjectDao
{
public
class
ProjectDaoImlp
extends
BaseMongoDaoImpl
<
Project
>
implements
ProjectDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_project"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_project"
;
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/QbjcPojoDao.java
→
src/main/java/com/zhiwei/brandkbs2/dao/impl/QbjcPojoDao
Impl
.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
QbjcPojoDao
;
import
com.zhiwei.brandkbs2.dao.QbjcPojoDao
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
...
@@ -17,7 +17,7 @@ import java.util.List;
...
@@ -17,7 +17,7 @@ import java.util.List;
* @date: 2022-06-16 14:24
* @date: 2022-06-16 14:24
*/
*/
@Component
(
"qbjcPojoDao"
)
@Component
(
"qbjcPojoDao"
)
public
class
QbjcPojoDao
implements
I
QbjcPojoDao
{
public
class
QbjcPojoDao
Impl
implements
QbjcPojoDao
{
@Resource
(
name
=
"secondaryMongoTemplate"
)
@Resource
(
name
=
"secondaryMongoTemplate"
)
protected
MongoTemplate
mongoTemplate
;
protected
MongoTemplate
mongoTemplate
;
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/ReportDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.IReportDao
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.ReportDao
;
import
com.zhiwei.brandkbs2.pojo.Report
;
import
com.zhiwei.brandkbs2.pojo.Report
;
import
org.springframework.data.mongodb.core.aggregation.Aggregation
;
import
org.springframework.data.mongodb.core.aggregation.AggregationResults
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
/**
* @ClassName: ReportDaoImpl
* @ClassName: ReportDaoImpl
* @Description ReportDaoImpl
* @Description ReportDaoImpl
...
@@ -11,10 +17,23 @@ import org.springframework.stereotype.Component;
...
@@ -11,10 +17,23 @@ import org.springframework.stereotype.Component;
* @date: 2022-05-31 18:14
* @date: 2022-05-31 18:14
*/
*/
@Component
(
"reportDao"
)
@Component
(
"reportDao"
)
public
class
ReportDaoImpl
extends
BaseMongoDaoImpl
<
Report
>
implements
I
ReportDao
{
public
class
ReportDaoImpl
extends
BaseMongoDaoImpl
<
Report
>
implements
ReportDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_report"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_report"
;
public
ReportDaoImpl
()
{
public
ReportDaoImpl
()
{
super
(
COLLECTION_NAME
);
super
(
COLLECTION_NAME
);
}
}
@Override
public
List
<
JSONObject
>
getReportAggCount
(
String
projectId
)
{
// 添加渠道唯一标识
Criteria
criteria
=
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"status"
).
is
(
true
);
// 分组
Aggregation
aggregation
=
Aggregation
.
newAggregation
(
Aggregation
.
match
(
criteria
),
//
Aggregation
.
project
(
"publishTime"
,
"type"
).
andExpression
(
"add(new java.util.Date(0l),publishTime)"
).
substring
(
0
,
4
).
as
(
"year"
),
Aggregation
.
group
(
"type"
,
"year"
).
count
().
as
(
"count"
));
AggregationResults
<
JSONObject
>
aggregate
=
mongoTemplate
.
aggregate
(
aggregation
,
COLLECTION_NAME
,
JSONObject
.
class
);
return
aggregate
.
getMappedResults
();
}
}
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/ReportSettingsDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
ReportSettingsDao
;
import
com.zhiwei.brandkbs2.dao.ReportSettingsDao
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
/**
* @ClassName: ReportSettingsDaoImpl
* @ClassName: ReportSettingsDaoImpl
* @Description ReportSettingsDaoImpl
* @Description ReportSettingsDaoImpl
...
@@ -11,10 +15,17 @@ import org.springframework.stereotype.Component;
...
@@ -11,10 +15,17 @@ import org.springframework.stereotype.Component;
* @date: 2022-05-31 18:14
* @date: 2022-05-31 18:14
*/
*/
@Component
(
"reportSettingsDao"
)
@Component
(
"reportSettingsDao"
)
public
class
ReportSettingsDaoImpl
extends
BaseMongoDaoImpl
<
ReportSettings
>
implements
I
ReportSettingsDao
{
public
class
ReportSettingsDaoImpl
extends
BaseMongoDaoImpl
<
ReportSettings
>
implements
ReportSettingsDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_report_settings"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_report_settings"
;
public
ReportSettingsDaoImpl
()
{
public
ReportSettingsDaoImpl
()
{
super
(
COLLECTION_NAME
);
super
(
COLLECTION_NAME
);
}
}
@Override
public
List
<
ReportSettings
>
getReportSettingByProjectWithUsed
(
String
projectId
)
{
Query
query
=
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"used"
).
is
(
true
));
return
findList
(
query
);
}
}
}
src/main/java/com/zhiwei/brandkbs2/dao/impl/TagFilterDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
TagFilterDao
;
import
com.zhiwei.brandkbs2.dao.TagFilterDao
;
import
com.zhiwei.brandkbs2.pojo.TagFilter
;
import
com.zhiwei.brandkbs2.pojo.TagFilter
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-06-01 14:26
* @date: 2022-06-01 14:26
*/
*/
@Component
(
"tagFilterDao"
)
@Component
(
"tagFilterDao"
)
public
class
TagFilterDaoImpl
extends
BaseMongoDaoImpl
<
TagFilter
>
implements
I
TagFilterDao
{
public
class
TagFilterDaoImpl
extends
BaseMongoDaoImpl
<
TagFilter
>
implements
TagFilterDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_tag_filter"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_tag_filter"
;
public
TagFilterDaoImpl
()
{
public
TagFilterDaoImpl
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/dao/impl/UserDaoImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
dao
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
UserDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.pojo.User
;
import
com.zhiwei.brandkbs2.pojo.User
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
* @date: 2022-04-28 18:10
* @date: 2022-04-28 18:10
*/
*/
@Component
(
"userDao"
)
@Component
(
"userDao"
)
public
class
UserDaoImpl
extends
BaseMongoDaoImpl
<
User
>
implements
I
UserDao
{
public
class
UserDaoImpl
extends
BaseMongoDaoImpl
<
User
>
implements
UserDao
{
private
static
final
String
COLLECTION_NAME
=
"brandkbs_user"
;
private
static
final
String
COLLECTION_NAME
=
"brandkbs_user"
;
...
...
src/main/java/com/zhiwei/brandkbs2/easyexcel/listener/EventDataListener.java
View file @
d6139789
...
@@ -2,8 +2,8 @@ package com.zhiwei.brandkbs2.easyexcel.listener;
...
@@ -2,8 +2,8 @@ package com.zhiwei.brandkbs2.easyexcel.listener;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.zhiwei.brandkbs2.dao.
I
EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.
I
EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadEventDataDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadEventDataDTO
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.EventData
;
import
com.zhiwei.brandkbs2.pojo.EventData
;
...
@@ -20,15 +20,15 @@ import org.springframework.data.redis.core.StringRedisTemplate;
...
@@ -20,15 +20,15 @@ import org.springframework.data.redis.core.StringRedisTemplate;
public
class
EventDataListener
extends
AnalysisEventListener
<
UploadEventDataDTO
>
{
public
class
EventDataListener
extends
AnalysisEventListener
<
UploadEventDataDTO
>
{
private
final
I
EventDao
eventDao
;
private
final
EventDao
eventDao
;
private
final
I
EventDataDao
eventDataDao
;
private
final
EventDataDao
eventDataDao
;
private
final
StringRedisTemplate
stringRedisTemplate
;
private
final
StringRedisTemplate
stringRedisTemplate
;
private
final
String
linkedGroupId
;
private
final
String
linkedGroupId
;
private
final
String
redisKey
;
private
final
String
redisKey
;
public
EventDataListener
(
IEventDao
eventDao
,
I
EventDataDao
eventDataDao
,
StringRedisTemplate
stringRedisTemplate
,
String
linkedGroupId
,
public
EventDataListener
(
EventDao
eventDao
,
EventDataDao
eventDataDao
,
StringRedisTemplate
stringRedisTemplate
,
String
linkedGroupId
,
String
redisKey
)
{
String
redisKey
)
{
this
.
eventDao
=
eventDao
;
this
.
eventDao
=
eventDao
;
this
.
eventDataDao
=
eventDataDao
;
this
.
eventDataDao
=
eventDataDao
;
...
...
src/main/java/com/zhiwei/brandkbs2/easyexcel/listener/EventFileListener.java
View file @
d6139789
...
@@ -3,7 +3,7 @@ package com.zhiwei.brandkbs2.easyexcel.listener;
...
@@ -3,7 +3,7 @@ package com.zhiwei.brandkbs2.easyexcel.listener;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.UploadEventDTO
;
import
com.zhiwei.brandkbs2.service.
I
EventService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -25,12 +25,12 @@ public class EventFileListener extends AnalysisEventListener<UploadEventDTO> {
...
@@ -25,12 +25,12 @@ public class EventFileListener extends AnalysisEventListener<UploadEventDTO> {
* 储存解析数据集合
* 储存解析数据集合
*/
*/
private
final
List
<
UploadEventDTO
>
datas
=
new
ArrayList
<>(
BATCH_COUNT
);
private
final
List
<
UploadEventDTO
>
datas
=
new
ArrayList
<>(
BATCH_COUNT
);
private
final
IEventService
i
EventService
;
private
final
EventService
EventService
;
private
final
String
projectId
;
private
final
String
projectId
;
private
final
String
linkedGroupId
;
private
final
String
linkedGroupId
;
public
EventFileListener
(
IEventService
i
EventService
,
String
projectId
,
String
linkedGroupId
)
{
public
EventFileListener
(
EventService
EventService
,
String
projectId
,
String
linkedGroupId
)
{
this
.
iEventService
=
i
EventService
;
this
.
EventService
=
EventService
;
this
.
projectId
=
projectId
;
this
.
projectId
=
projectId
;
this
.
linkedGroupId
=
linkedGroupId
;
this
.
linkedGroupId
=
linkedGroupId
;
}
}
...
@@ -65,6 +65,6 @@ public class EventFileListener extends AnalysisEventListener<UploadEventDTO> {
...
@@ -65,6 +65,6 @@ public class EventFileListener extends AnalysisEventListener<UploadEventDTO> {
* 保存更新事件信息逻辑
* 保存更新事件信息逻辑
*/
*/
private
void
addFileEvent
()
{
private
void
addFileEvent
()
{
datas
.
forEach
(
eventDTO
->
i
EventService
.
addFileEvent
(
projectId
,
linkedGroupId
,
eventDTO
));
datas
.
forEach
(
eventDTO
->
EventService
.
addFileEvent
(
projectId
,
linkedGroupId
,
eventDTO
));
}
}
}
}
src/main/java/com/zhiwei/brandkbs2/enmus/ChannelEmotion.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
enmus
;
import
lombok.Getter
;
/**
* @ClassName: ChannelEmotion
* @Description 渠道倾向枚举类
* @author: sjj
* @date: 2022-07-14 17:56
*/
public
enum
ChannelEmotion
{
/**
* 正面的
*/
POSITIVE
(
1
,
"友好渠道"
),
/**
* 中性的
*/
NEUTRAL
(
2
,
"不友好渠道"
),
/**
* 负面的
*/
NEGATIVE
(
3
,
"中性渠道"
);
@Getter
private
final
int
state
;
@Getter
private
final
String
name
;
ChannelEmotion
(
int
state
,
String
name
)
{
this
.
state
=
state
;
this
.
name
=
name
;
}
public
static
ChannelEmotion
getFromState
(
int
state
)
{
for
(
ChannelEmotion
value
:
ChannelEmotion
.
values
())
{
if
(
value
.
state
==
state
)
{
return
value
;
}
}
throw
new
IllegalArgumentException
(
"不识别的类型:"
+
state
);
}
}
src/main/java/com/zhiwei/brandkbs2/enmus/ImportantChannelEnum.java
View file @
d6139789
...
@@ -41,7 +41,7 @@ public enum ImportantChannelEnum {
...
@@ -41,7 +41,7 @@ public enum ImportantChannelEnum {
QITA
(
"其他"
);
QITA
(
"其他"
);
private
String
state
;
private
final
String
state
;
ImportantChannelEnum
(
String
state
)
{
ImportantChannelEnum
(
String
state
)
{
this
.
state
=
state
;
this
.
state
=
state
;
...
...
src/main/java/com/zhiwei/brandkbs2/enmus/ReportTypeEnum.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
enmus
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.List
;
/**
* @author lxj
* @version 1.0
* @description 平台枚举类
* @date 2019/9/2 10:51
*/
public
enum
ReportTypeEnum
{
/**
* 月报
*/
MONTH
(
"月报"
,
"每月一号"
,
"月"
),
/**
* 周报
*/
WEEK
(
"周报"
,
"每周一"
,
"周"
),
/**
* 自定义简报
*/
CUSTOM
(
"自定义"
,
"自定义"
,
"周期"
);
@Getter
private
final
String
state
;
@Getter
private
final
String
publishTime
;
@Getter
private
final
String
describe
;
// 发布最小间隔1天
public
static
final
Long
PUSH_LIMIT
=
24
*
60
*
60
*
1000L
;
public
static
final
List
<
String
>
SORT_LIST
=
Arrays
.
asList
(
ReportTypeEnum
.
MONTH
.
getState
(),
ReportTypeEnum
.
WEEK
.
getState
(),
ReportTypeEnum
.
CUSTOM
.
getState
());
ReportTypeEnum
(
String
state
,
String
publishTime
,
String
describe
)
{
this
.
state
=
state
;
this
.
publishTime
=
publishTime
;
this
.
describe
=
describe
;
}
public
static
boolean
canPublishNowByState
(
String
state
)
{
return
canPublishNow
(
getInstanceByState
(
state
));
}
public
static
ReportTypeEnum
getInstanceByState
(
String
state
)
{
for
(
ReportTypeEnum
value
:
ReportTypeEnum
.
values
())
{
if
(
value
.
getState
().
equals
(
state
))
{
return
value
;
}
}
throw
new
IllegalArgumentException
(
"不识别的类型:"
+
state
);
}
public
static
boolean
canPublishNow
(
ReportTypeEnum
type
)
{
Calendar
cal
=
Calendar
.
getInstance
();
switch
(
type
)
{
case
WEEK:
return
cal
.
get
(
Calendar
.
DAY_OF_WEEK
)
==
Calendar
.
MONDAY
;
case
MONTH:
return
cal
.
get
(
Calendar
.
DAY_OF_MONTH
)
==
1
;
}
// 自定义简报
return
true
;
}
}
src/main/java/com/zhiwei/brandkbs2/es/EsClientDao.java
View file @
d6139789
...
@@ -171,7 +171,7 @@ public class EsClientDao {
...
@@ -171,7 +171,7 @@ public class EsClientDao {
private
List
<
Map
<
String
,
Object
>>
searchScroll
(
QueryBuilder
queryBuilder
,
int
size
,
String
[]
fetchSource
)
throws
IOException
{
private
List
<
Map
<
String
,
Object
>>
searchScroll
(
QueryBuilder
queryBuilder
,
int
size
,
String
[]
fetchSource
)
throws
IOException
{
SearchSourceBuilder
sourceBuilder
=
new
SearchSourceBuilder
();
SearchSourceBuilder
sourceBuilder
=
new
SearchSourceBuilder
();
sourceBuilder
.
query
(
queryBuilder
).
size
(
size
).
fetchSource
(
fetchSource
,
null
);
sourceBuilder
.
query
(
queryBuilder
).
size
(
size
).
fetchSource
(
fetchSource
,
null
);
return
searchScroll
(
sourceBuilder
);
return
retryTemplate
.
execute
(
context
->
searchScroll
(
sourceBuilder
)
);
}
}
private
Map
<
ChannelIndex
,
ChannelIndex
.
ChannelRecord
>
searchChannelRecord
(
long
startTime
,
long
endTime
)
{
private
Map
<
ChannelIndex
,
ChannelIndex
.
ChannelRecord
>
searchChannelRecord
(
long
startTime
,
long
endTime
)
{
...
@@ -180,7 +180,7 @@ public class EsClientDao {
...
@@ -180,7 +180,7 @@ public class EsClientDao {
QueryBuilder
queryBuilder
=
QueryBuilders
.
rangeQuery
(
"mtime"
).
gte
(
startTime
).
lt
(
endTime
);
QueryBuilder
queryBuilder
=
QueryBuilders
.
rangeQuery
(
"mtime"
).
gte
(
startTime
).
lt
(
endTime
);
List
<
Map
<
String
,
Object
>>
results
=
searchScroll
(
queryBuilder
,
10000
,
CHANNEL_RECORD_FETCH_SOURCE
);
List
<
Map
<
String
,
Object
>>
results
=
searchScroll
(
queryBuilder
,
10000
,
CHANNEL_RECORD_FETCH_SOURCE
);
for
(
Map
<
String
,
Object
>
result
:
results
)
{
for
(
Map
<
String
,
Object
>
result
:
results
)
{
for
(
ChannelIndex
channelIndex
:
ChannelIndex
.
get
ChannelIndexes
(
result
))
{
for
(
ChannelIndex
channelIndex
:
ChannelIndex
.
create
ChannelIndexes
(
result
))
{
res
.
compute
(
channelIndex
,
(
k
,
v
)
->
{
res
.
compute
(
channelIndex
,
(
k
,
v
)
->
{
if
(
null
==
v
)
{
if
(
null
==
v
)
{
v
=
new
ChannelIndex
.
ChannelRecord
();
v
=
new
ChannelIndex
.
ChannelRecord
();
...
@@ -189,8 +189,8 @@ public class EsClientDao {
...
@@ -189,8 +189,8 @@ public class EsClientDao {
return
v
.
mergeRecord
(
new
ChannelIndex
.
ChannelRecord
((
long
)
result
.
get
(
GenericAttribute
.
ES_TIME
),
String
.
valueOf
(
result
.
get
(
"id"
))));
return
v
.
mergeRecord
(
new
ChannelIndex
.
ChannelRecord
((
long
)
result
.
get
(
GenericAttribute
.
ES_TIME
),
String
.
valueOf
(
result
.
get
(
"id"
))));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"searchChannelRecord-error-id:{}"
,
result
.
get
(
"id"
),
e
);
log
.
error
(
"searchChannelRecord-error-id:{}"
,
result
.
get
(
"id"
),
e
);
return
null
;
}
}
return
v
;
});
});
}
}
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/Channel.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
com.zhiwei.brandkbs2.enmus.ChannelEmotion
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -50,7 +51,7 @@ public class Channel extends ChannelIndex {
...
@@ -50,7 +51,7 @@ public class Channel extends ChannelIndex {
/**
/**
* 渠道倾向
* 渠道倾向
*/
*/
private
String
emotion
=
"未定义"
;
private
int
emotion
;
/**
/**
* 渠道指数
* 渠道指数
...
@@ -100,6 +101,17 @@ public class Channel extends ChannelIndex {
...
@@ -100,6 +101,17 @@ public class Channel extends ChannelIndex {
channel
.
setSource
(
channelIndex
.
getSource
());
channel
.
setSource
(
channelIndex
.
getSource
());
channel
.
setLastTime
(
channelRecord
.
getLastTime
());
channel
.
setLastTime
(
channelRecord
.
getLastTime
());
channel
.
setArticleIds
(
channelRecord
.
getArticleIds
());
channel
.
setArticleIds
(
channelRecord
.
getArticleIds
());
// fid 用来便捷搜索
channel
.
setFid
(
channelIndex
.
getFid
());
// TODO 调性随机分配
double
random
=
Math
.
random
();
if
(
random
<
0.3
)
{
channel
.
setEmotion
(
ChannelEmotion
.
POSITIVE
.
getState
());
}
else
if
(
random
<
0.6
)
{
channel
.
setEmotion
(
ChannelEmotion
.
NEGATIVE
.
getState
());
}
else
{
channel
.
setEmotion
(
ChannelEmotion
.
NEUTRAL
.
getState
());
}
return
channel
;
return
channel
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelIndex.java
View file @
d6139789
...
@@ -2,6 +2,8 @@ package com.zhiwei.brandkbs2.pojo;
...
@@ -2,6 +2,8 @@ package com.zhiwei.brandkbs2.pojo;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.tools.BeanTools
;
import
com.zhiwei.qbjc.bean.tools.BeanTools
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.Getter
;
...
@@ -44,18 +46,44 @@ public class ChannelIndex extends AbstractBaseMongo {
...
@@ -44,18 +46,44 @@ public class ChannelIndex extends AbstractBaseMongo {
*/
*/
private
String
source
;
private
String
source
;
public
static
List
<
ChannelIndex
>
getChannelIndexes
(
Map
<
String
,
Object
>
sourceAsMap
)
{
private
String
fid
;
public
ChannelIndex
(
String
projectId
,
String
linkedGroupId
,
String
platform
,
String
realSource
,
String
source
)
{
this
.
projectId
=
projectId
;
this
.
linkedGroupId
=
linkedGroupId
;
this
.
platform
=
platform
;
this
.
realSource
=
realSource
;
this
.
source
=
source
;
this
.
fid
=
Tools
.
concat
(
projectId
,
linkedGroupId
,
platform
,
realSource
,
source
);
}
public
static
ChannelIndex
createChannelIndex
(
Map
<
String
,
Object
>
sourceAsMap
,
String
projectId
,
String
linkedGroupId
)
{
String
realSource
=
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_REAL_SOURCE
));
String
source
=
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_SOURCE
));
Integer
c5
=
Integer
.
parseInt
(
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_C5
)));
Integer
foreign
=
Integer
.
parseInt
(
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_FOREIGN
)));
MessagePlatform
messagePlatform
=
BeanTools
.
filterPlatform
(
GlobalPojo
.
PLATFORMS
,
c5
,
foreign
);
if
(
null
==
messagePlatform
)
{
return
null
;
}
return
new
ChannelIndex
(
projectId
,
linkedGroupId
,
messagePlatform
.
getName
(),
realSource
,
source
);
}
public
static
List
<
ChannelIndex
>
createChannelIndexes
(
Map
<
String
,
Object
>
sourceAsMap
)
{
List
<
ChannelIndex
>
res
=
new
ArrayList
<>();
List
<
ChannelIndex
>
res
=
new
ArrayList
<>();
String
realSource
=
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_REAL_SOURCE
));
String
realSource
=
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_REAL_SOURCE
));
String
source
=
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_SOURCE
));
String
source
=
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_SOURCE
));
Integer
c5
=
Integer
.
parseInt
(
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_C5
)));
Integer
c5
=
Integer
.
parseInt
(
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_C5
)));
Integer
foreign
=
Integer
.
parseInt
(
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_FOREIGN
)));
Integer
foreign
=
Integer
.
parseInt
(
String
.
valueOf
(
sourceAsMap
.
get
(
GenericAttribute
.
ES_FOREIGN
)));
MessagePlatform
messagePlatform
=
BeanTools
.
filterPlatform
(
GlobalPojo
.
PLATFORMS
,
c5
,
foreign
);
if
(
null
==
messagePlatform
)
{
return
res
;
}
List
<
Map
<
String
,
Object
>>
cacheMaps
=
(
List
<
Map
<
String
,
Object
>>)
sourceAsMap
.
get
(
GenericAttribute
.
ES_BRANDKBS_CACHE_MAPS
);
List
<
Map
<
String
,
Object
>>
cacheMaps
=
(
List
<
Map
<
String
,
Object
>>)
sourceAsMap
.
get
(
GenericAttribute
.
ES_BRANDKBS_CACHE_MAPS
);
for
(
Map
<
String
,
Object
>
cacheMap
:
cacheMaps
)
{
for
(
Map
<
String
,
Object
>
cacheMap
:
cacheMaps
)
{
String
projectId
=
String
.
valueOf
(
cacheMap
.
get
(
GenericAttribute
.
PROJECT_ID
));
String
projectId
=
String
.
valueOf
(
cacheMap
.
get
(
GenericAttribute
.
PROJECT_ID
));
String
linkedGroupId
=
String
.
valueOf
(
cacheMap
.
get
(
GenericAttribute
.
LINKED_GROUP_ID
));
String
linkedGroupId
=
String
.
valueOf
(
cacheMap
.
get
(
GenericAttribute
.
LINKED_GROUP_ID
));
String
platform
=
BeanTools
.
filterPlatform
(
GlobalPojo
.
PLATFORMS
,
c5
,
foreign
).
getName
();
res
.
add
(
new
ChannelIndex
(
projectId
,
linkedGroupId
,
messagePlatform
.
getName
(),
realSource
,
source
));
res
.
add
(
new
ChannelIndex
(
projectId
,
linkedGroupId
,
platform
,
realSource
,
source
));
}
}
return
res
;
return
res
;
}
}
...
@@ -76,7 +104,7 @@ public class ChannelIndex extends AbstractBaseMongo {
...
@@ -76,7 +104,7 @@ public class ChannelIndex extends AbstractBaseMongo {
}
}
private
void
setLastTime
(
Long
lastTime
)
{
private
void
setLastTime
(
Long
lastTime
)
{
if
(
null
==
this
.
lastTime
||
this
.
lastTime
<
lastTime
)
{
if
(
null
==
this
.
lastTime
||
this
.
lastTime
<
lastTime
)
{
this
.
lastTime
=
lastTime
;
this
.
lastTime
=
lastTime
;
}
}
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/ChannelTag.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* @ClassName: ChannelTag
* @Description 渠道标签
* @author: sjj
* @date: 2022-07-13 14:27
*/
@Setter
@Getter
public
class
ChannelTag
extends
AbstractBaseMongo
{
private
String
channel
;
private
String
tag
;
}
src/main/java/com/zhiwei/brandkbs2/pojo/MarkFlowEntity.java
View file @
d6139789
...
@@ -2,10 +2,10 @@ package com.zhiwei.brandkbs2.pojo;
...
@@ -2,10 +2,10 @@ package com.zhiwei.brandkbs2.pojo;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.base.category.ClassB
;
import
com.zhiwei.base.category.ClassB
;
import
com.zhiwei.base.entity.subclass.
CompleteText
;
import
com.zhiwei.base.entity.subclass.
mark.CompleteTextMark
;
import
com.zhiwei.base.entity.subclass.
IncompleteText
;
import
com.zhiwei.base.entity.subclass.
mark.IncompleteTextMark
;
import
com.zhiwei.base.entity.subclass.
QAText
;
import
com.zhiwei.base.entity.subclass.
mark.QATextMark
;
import
com.zhiwei.base.entity.subclass.
Video
;
import
com.zhiwei.base.entity.subclass.
mark.VideoMark
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.util.FlowEntityUtil
;
import
com.zhiwei.brandkbs2.util.FlowEntityUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
...
@@ -17,7 +17,6 @@ import org.elasticsearch.search.SearchHit;
...
@@ -17,7 +17,6 @@ import org.elasticsearch.search.SearchHit;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
/**
* @ClassName: MarkFlowEntity
* @ClassName: MarkFlowEntity
...
@@ -37,17 +36,23 @@ public class MarkFlowEntity {
...
@@ -37,17 +36,23 @@ public class MarkFlowEntity {
private
JSONObject
type
;
private
JSONObject
type
;
/**
/**
* 信息字段
*/
private
JSONObject
info
;
/**
* 消息内容
* 消息内容
*/
*/
private
Object
data
;
private
Object
data
;
public
static
MarkFlowEntity
get
Instance
(
List
<
JSONObject
>
tJon
s
)
{
public
static
MarkFlowEntity
get
FoldInstance
(
List
<
MarkFlowEntity
>
entitie
s
)
{
// 首条数据为主
// 首条数据为主
MarkFlowEntity
entity
=
new
MarkFlowEntity
(
tJons
.
get
(
0
)
);
MarkFlowEntity
entity
=
entities
.
get
(
0
);
if
(
tJon
s
.
size
()
>
1
)
{
if
(
entitie
s
.
size
()
>
1
)
{
entity
.
getType
().
put
(
"fold"
,
true
);
entity
.
getType
().
put
(
"fold"
,
true
);
entity
.
getType
().
put
(
"size"
,
tJons
.
size
());
entity
.
getType
().
put
(
"size"
,
entities
.
size
());
entity
.
setData
(
tJons
.
stream
().
map
(
json
->
new
MarkFlowEntity
(
json
).
getData
()).
collect
(
Collectors
.
toList
()));
// info内容
entity
.
getInfo
().
put
(
"foldInfo"
,
entities
);
}
}
return
entity
;
return
entity
;
}
}
...
@@ -79,7 +84,7 @@ public class MarkFlowEntity {
...
@@ -79,7 +84,7 @@ public class MarkFlowEntity {
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_title"
)))
{
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_title"
)))
{
tJson
.
put
(
"ind_title"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_title"
),
"[\"\"]"
)));
tJson
.
put
(
"ind_title"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_title"
),
"[\"\"]"
)));
}
}
CompleteText
completeText
=
CompleteText
.
restoreFromEs
(
tJson
);
CompleteText
Mark
completeText
=
CompleteTextMark
.
restoreFromEs
(
tJson
);
this
.
type
=
FlowEntityUtil
.
getCompleteTextType
(
completeText
);
this
.
type
=
FlowEntityUtil
.
getCompleteTextType
(
completeText
);
this
.
data
=
completeText
;
this
.
data
=
completeText
;
break
;
break
;
...
@@ -87,7 +92,7 @@ public class MarkFlowEntity {
...
@@ -87,7 +92,7 @@ public class MarkFlowEntity {
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_full_text"
)))
{
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_full_text"
)))
{
tJson
.
put
(
"ind_full_text"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_full_text"
),
"[\"\",\"\"]"
)));
tJson
.
put
(
"ind_full_text"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_full_text"
),
"[\"\",\"\"]"
)));
}
}
IncompleteText
incompleteText
=
IncompleteText
.
restoreFromEs
(
tJson
);
IncompleteText
Mark
incompleteText
=
IncompleteTextMark
.
restoreFromEs
(
tJson
);
this
.
type
=
FlowEntityUtil
.
getIncompleteTextType
(
incompleteText
);
this
.
type
=
FlowEntityUtil
.
getIncompleteTextType
(
incompleteText
);
this
.
data
=
incompleteText
;
this
.
data
=
incompleteText
;
break
;
break
;
...
@@ -101,7 +106,7 @@ public class MarkFlowEntity {
...
@@ -101,7 +106,7 @@ public class MarkFlowEntity {
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_content"
)))
{
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_content"
)))
{
tJson
.
put
(
"ind_content"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_content"
),
"[\"\"]"
)));
tJson
.
put
(
"ind_content"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_content"
),
"[\"\"]"
)));
}
}
QAText
qaText
=
QAText
.
restoreFromEs
(
tJson
);
QAText
Mark
qaText
=
QATextMark
.
restoreFromEs
(
tJson
);
this
.
type
=
FlowEntityUtil
.
getQaTextType
(
qaText
);
this
.
type
=
FlowEntityUtil
.
getQaTextType
(
qaText
);
this
.
data
=
qaText
;
this
.
data
=
qaText
;
break
;
break
;
...
@@ -112,7 +117,7 @@ public class MarkFlowEntity {
...
@@ -112,7 +117,7 @@ public class MarkFlowEntity {
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_title"
)))
{
if
(!
Tools
.
isEmpty
(
tJson
.
get
(
"ind_title"
)))
{
tJson
.
put
(
"ind_title"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_title"
),
"[\"\"]"
)));
tJson
.
put
(
"ind_title"
,
Tools
.
filterStrHtmlTag
(
ObjectUtils
.
defaultIfNull
(
tJson
.
getString
(
"ind_title"
),
"[\"\"]"
)));
}
}
Video
video
=
Video
.
restoreFromEs
(
tJson
);
Video
Mark
video
=
VideoMark
.
restoreFromEs
(
tJson
);
this
.
type
=
FlowEntityUtil
.
getVideoType
(
video
);
this
.
type
=
FlowEntityUtil
.
getVideoType
(
video
);
this
.
data
=
video
;
this
.
data
=
video
;
break
;
break
;
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/Report.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.ReportTypeEnum
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportDTO
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -15,7 +22,7 @@ import java.util.List;
...
@@ -15,7 +22,7 @@ import java.util.List;
@Setter
@Setter
@Getter
@Getter
@Document
(
"brandkbs_report"
)
@Document
(
"brandkbs_report"
)
public
class
Report
extends
AbstractBaseMongo
{
public
class
Report
extends
AbstractBaseMongo
{
/**
/**
* 简报标题
* 简报标题
...
@@ -38,24 +45,65 @@ public class Report extends AbstractBaseMongo{
...
@@ -38,24 +45,65 @@ public class Report extends AbstractBaseMongo{
*/
*/
private
String
type
;
private
String
type
;
/**
/**
* 是否是最新的
*/
private
boolean
latest
;
/**
* 项目ID
* 项目ID
*/
*/
private
String
projectId
;
private
String
projectId
;
/**
/**
* 查看用户ID:0为全项目都可查看
*/
private
String
userId
;
/**
* 竞品信息字符串
* 竞品信息字符串
*/
*/
@Deprecated
@Deprecated
private
List
<
String
>
contends
;
private
List
<
String
>
contends
;
/**
/**
*
发布
状态
*
生成
状态
*/
*/
private
boolean
release
;
private
boolean
status
;
public
static
Report
createFromReportDTO
(
ReportDTO
reportDTO
)
{
Report
report
=
new
Report
();
report
.
setTitle
(
reportDTO
.
getTitle
());
report
.
setStartTime
(
reportDTO
.
getStartTime
());
report
.
setEndTime
(
reportDTO
.
getEndTime
());
report
.
setPublishTime
(
reportDTO
.
getPublishTime
());
report
.
setType
(
ReportTypeEnum
.
CUSTOM
.
getState
());
report
.
setProjectId
(
UserThreadLocal
.
getProjectId
());
report
.
setContends
(
reportDTO
.
getContends
());
return
report
;
}
public
static
Report
createFromReportSettings
(
ReportSettings
reportSettings
,
AbstractProject
project
)
{
Report
report
=
new
Report
();
Date
now
=
new
Date
();
report
.
setPublishTime
(
now
.
getTime
());
// 枚举简报类型
ReportTypeEnum
reportType
=
ReportTypeEnum
.
getInstanceByState
(
reportSettings
.
getType
());
// 根据简报类型不同设置
report
.
setType
(
reportType
.
getState
());
switch
(
reportType
)
{
// 周报月报标题按天级别
case
WEEK:
report
.
setTitle
(
project
.
getBrandName
()
+
Constant
.
DAY_FORMAT
.
format
(
now
)
+
reportSettings
.
getType
());
now
=
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
);
report
.
setStartTime
(
DateUtils
.
addDays
(
now
,
-
7
).
getTime
());
report
.
setEndTime
(
now
.
getTime
());
break
;
case
MONTH:
report
.
setTitle
(
project
.
getBrandName
()
+
Constant
.
DAY_FORMAT
.
format
(
now
)
+
reportSettings
.
getType
());
now
=
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
);
report
.
setStartTime
(
DateUtils
.
addMonths
(
now
,
1
).
getTime
());
report
.
setEndTime
(
now
.
getTime
());
break
;
case
CUSTOM:
// 自定义简报标题按小时级别
report
.
setTitle
(
project
.
getBrandName
()
+
Constant
.
HOUR_FORMAT
.
format
(
now
)
+
reportSettings
.
getType
());
report
.
setStartTime
(
reportSettings
.
getStartTime
());
report
.
setEndTime
(
reportSettings
.
getEndTime
());
break
;
default
:
throw
new
IllegalArgumentException
(
"不识别的类型:"
+
reportSettings
.
getType
());
}
report
.
setProjectId
(
reportSettings
.
getProjectId
());
report
.
setContends
(
reportSettings
.
getContendIds
());
return
report
;
}
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/ReportSettings.java
View file @
d6139789
...
@@ -23,6 +23,17 @@ public class ReportSettings extends AbstractBaseMongo {
...
@@ -23,6 +23,17 @@ public class ReportSettings extends AbstractBaseMongo {
* 报告类型
* 报告类型
*/
*/
private
String
type
;
private
String
type
;
/**
* 数据起始时间
*/
private
Long
startTime
;
/**
* 数据截止时间
*/
private
Long
endTime
;
/**
/**
* 简报后缀标题
* 简报后缀标题
*/
*/
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/EventSearchDTO.java
View file @
d6139789
...
@@ -10,7 +10,7 @@ import java.util.Map;
...
@@ -10,7 +10,7 @@ import java.util.Map;
/**
/**
* @ClassName: EventSearchDto
* @ClassName: EventSearchDto
* @Description
TODO
* @Description
EventSearchDto
* @author: sjj
* @author: sjj
* @date: 2022-05-20 14:07
* @date: 2022-05-20 14:07
*/
*/
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/MarkSearchDTO.java
View file @
d6139789
...
@@ -99,9 +99,9 @@ public class MarkSearchDTO {
...
@@ -99,9 +99,9 @@ public class MarkSearchDTO {
private
JSONObject
sorter
;
private
JSONObject
sorter
;
/**
/**
* 是否
聚合
* 是否
去重
*/
*/
@ApiModelProperty
(
value
=
"是否
聚合
"
)
@ApiModelProperty
(
value
=
"是否
去重
"
)
private
boolean
aggregation
;
private
boolean
duplicate
;
}
}
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ReportDTO.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.List
;
/**
* @author sjj
* @version 1.0
* @description 自定义简报传输类
* @date 2022年7月15日16:16:39
*/
@Data
@ToString
@ApiModel
(
"自定义简报传输类"
)
public
class
ReportDTO
{
/**
* 简报标题
*/
@ApiModelProperty
(
"简报标题"
)
private
String
title
;
/**
* 开始时间
*/
@ApiModelProperty
(
"开始时间"
)
private
Long
startTime
;
/**
* 结束时间
*/
@ApiModelProperty
(
"结束时间"
)
private
Long
endTime
;
/**
* 发布时间
*/
@ApiModelProperty
(
"发布时间"
)
private
Long
publishTime
;
/**
* 竞品信息
*/
@ApiModelProperty
(
"竞品信息"
)
private
List
<
String
>
contends
;
/**
* 是否是仅个人查看
*/
@ApiModelProperty
(
"是否是仅个人查看"
)
private
boolean
personal
;
}
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ReportSearchDTO.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.ToString
;
/**
* @author sjj
* @version 1.0
* @description 简报搜索传输类
* @date 2022年7月15日15:55:49
*/
@Data
@ToString
@ApiModel
(
"简报搜索传输类"
)
public
class
ReportSearchDTO
{
/**
* 页码
*/
@ApiModelProperty
(
"页码"
)
private
int
page
=
1
;
/**
* 大小
*/
@ApiModelProperty
(
"页码大小"
)
private
int
pageSize
=
10
;
/**
* 开始时间
*/
@ApiModelProperty
(
"开始时间"
)
private
Long
startTime
;
/**
* 结束时间
*/
@ApiModelProperty
(
"结束时间"
)
private
Long
endTime
;
/**
* 搜索关键字
*/
@ApiModelProperty
(
value
=
"搜索关键字"
)
private
String
keyword
;
/**
* 报告类型
*/
@ApiModelProperty
(
value
=
"报告类型"
)
private
String
type
;
/**
* 排序字段
*/
@ApiModelProperty
(
value
=
"排序字段"
)
private
String
sorter
=
"{\"publishTime\":\"descend\"}"
;
}
src/main/java/com/zhiwei/brandkbs2/pojo/dto/ReportSettingsDTO.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
dto
;
import
com.zhiwei.brandkbs2.enmus.ReportTypeEnum
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -63,9 +64,9 @@ public class ReportSettingsDTO {
...
@@ -63,9 +64,9 @@ public class ReportSettingsDTO {
public
static
ReportSettingsDTO
createFromReportSettings
(
ReportSettings
reportSettings
)
{
public
static
ReportSettingsDTO
createFromReportSettings
(
ReportSettings
reportSettings
)
{
ReportSettingsDTO
reportSettingsDTO
=
Tools
.
convertMap
(
reportSettings
,
ReportSettingsDTO
.
class
);
ReportSettingsDTO
reportSettingsDTO
=
Tools
.
convertMap
(
reportSettings
,
ReportSettingsDTO
.
class
);
String
publishTime
=
"每周一"
;
String
publishTime
=
ReportTypeEnum
.
WEEK
.
getPublishTime
()
;
if
(
"月报"
.
equals
(
reportSettingsDTO
.
getType
()))
{
if
(
ReportTypeEnum
.
MONTH
.
name
().
equals
(
reportSettingsDTO
.
getType
()))
{
publishTime
=
"每月1号"
;
publishTime
=
ReportTypeEnum
.
MONTH
.
getPublishTime
()
;
}
}
reportSettingsDTO
.
setPublishTime
(
publishTime
);
reportSettingsDTO
.
setPublishTime
(
publishTime
);
return
reportSettingsDTO
;
return
reportSettingsDTO
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
BehaviorService.java
→
src/main/java/com/zhiwei/brandkbs2/service/BehaviorService.java
View file @
d6139789
...
@@ -9,12 +9,12 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -9,12 +9,12 @@ import javax.servlet.http.HttpServletRequest;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
BehaviorService
* @ClassName: BehaviorService
* @Description 用户行为业务接口
* @Description 用户行为业务接口
* @author: sjj
* @author: sjj
* @date: 2022-05-27 11:05
* @date: 2022-05-27 11:05
*/
*/
public
interface
I
BehaviorService
{
public
interface
BehaviorService
{
/**
/**
* 添加用户行为
* 添加用户行为
*
*
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
BrandkbsTaskService.java
→
src/main/java/com/zhiwei/brandkbs2/service/BrandkbsTaskService.java
View file @
d6139789
...
@@ -9,7 +9,7 @@ import com.zhiwei.brandkbs2.pojo.BrandkbsTask;
...
@@ -9,7 +9,7 @@ import com.zhiwei.brandkbs2.pojo.BrandkbsTask;
* @description 定时任务业务接口
* @description 定时任务业务接口
* @date 2019/12/12 13:58
* @date 2019/12/12 13:58
*/
*/
public
interface
I
BrandkbsTaskService
{
public
interface
BrandkbsTaskService
{
/**
/**
* 根据任务名称获取任务
* 根据任务名称获取任务
*
*
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
ChannelService.java
→
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
View file @
d6139789
...
@@ -4,18 +4,20 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,18 +4,20 @@ import com.alibaba.fastjson.JSONObject;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelArticleDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelArticleDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportChannelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportChannelDTO
;
import
com.zhiwei.brandkbs2.pojo.Channel
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.pojo.dto.ChannelDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ChannelDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
ChannelService
* @ClassName: ChannelService
* @Description
I
ChannelService
* @Description ChannelService
* @author: sjj
* @author: sjj
* @date: 2022-06-16 16:00
* @date: 2022-06-16 16:00
*/
*/
public
interface
I
ChannelService
{
public
interface
ChannelService
{
/**
/**
* 根据搜索条件查询渠道列表
* 根据搜索条件查询渠道列表
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
CommonService.java
→
src/main/java/com/zhiwei/brandkbs2/service/CommonService.java
View file @
d6139789
...
@@ -12,13 +12,13 @@ import java.util.List;
...
@@ -12,13 +12,13 @@ import java.util.List;
* @author: sjj
* @author: sjj
* @date: 2022-06-02 11:22
* @date: 2022-06-02 11:22
*/
*/
public
interface
I
CommonService
{
public
interface
CommonService
{
/**
/**
* 获取qbjcTags
* 获取qbjcTags
*
*
* @param linkedGroupId 项目组id
* @param linkedGroupId 项目组id
* @param tagSearches 搜索条件
* @param tagSearches
搜索条件
* @return markTags
* @return markTags
*/
*/
List
<
MarkerTag
>
getQbjcTags
(
String
linkedGroupId
,
TagSearch
...
tagSearches
);
List
<
MarkerTag
>
getQbjcTags
(
String
linkedGroupId
,
TagSearch
...
tagSearches
);
...
@@ -26,7 +26,7 @@ public interface ICommonService {
...
@@ -26,7 +26,7 @@ public interface ICommonService {
/**
/**
* 获取qbjcTags
* 获取qbjcTags
*
*
* @param groupName 项目组名
* @param groupName
项目组名
* @param tagSearches 搜索条件
* @param tagSearches 搜索条件
* @return markTags
* @return markTags
*/
*/
...
@@ -34,13 +34,20 @@ public interface ICommonService {
...
@@ -34,13 +34,20 @@ public interface ICommonService {
/**
/**
* 获取qbjcPlatform名称
* 获取qbjcPlatform名称
*
* @return 平台名称
* @return 平台名称
*/
*/
List
<
String
>
getQbjcPlatformNames
();
List
<
String
>
getQbjcPlatformNames
();
/**
/**
* 获取qbjcPlatform
* 获取qbjcPlatform
*
* @return 平台
* @return 平台
*/
*/
List
<
JSONObject
>
getQbjcPlatform
(
String
...
includeFields
);
List
<
JSONObject
>
getQbjcPlatform
(
String
...
includeFields
);
Long
[]
getTimeRangeMonth
();
Long
[]
getTimeRangeWeek
();
}
}
src/main/java/com/zhiwei/brandkbs2/service/
I
CustomTagService.java
→
src/main/java/com/zhiwei/brandkbs2/service/CustomTagService.java
View file @
d6139789
...
@@ -12,7 +12,7 @@ import java.util.List;
...
@@ -12,7 +12,7 @@ import java.util.List;
* @description 自定义标签业务接口
* @description 自定义标签业务接口
* @date 2022年3月24日15:20:16
* @date 2022年3月24日15:20:16
*/
*/
public
interface
I
CustomTagService
{
public
interface
CustomTagService
{
/**
/**
* 分页查询该项目所有自定义标签数据
* 分页查询该项目所有自定义标签数据
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
EventDataService.java
→
src/main/java/com/zhiwei/brandkbs2/service/EventDataService.java
View file @
d6139789
...
@@ -3,12 +3,12 @@ package com.zhiwei.brandkbs2.service;
...
@@ -3,12 +3,12 @@ package com.zhiwei.brandkbs2.service;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.Event
;
/**
/**
* @ClassName:
I
EventDataService
* @ClassName: EventDataService
* @Description 事件数据业务接口抽象类
* @Description 事件数据业务接口抽象类
* @author: sjj
* @author: sjj
* @date: 2022-05-23 17:48
* @date: 2022-05-23 17:48
*/
*/
public
interface
I
EventDataService
{
public
interface
EventDataService
{
/**
/**
* 更新事件数据
* 更新事件数据
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
EventService.java
→
src/main/java/com/zhiwei/brandkbs2/service/EventService.java
View file @
d6139789
...
@@ -16,12 +16,12 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -16,12 +16,12 @@ import org.springframework.web.multipart.MultipartFile;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
EventService
* @ClassName: EventService
* @Description 事件管理业务接口
* @Description 事件管理业务接口
* @author: sjj
* @author: sjj
* @date: 2022-05-17 16:32
* @date: 2022-05-17 16:32
*/
*/
public
interface
I
EventService
{
public
interface
EventService
{
/**
/**
* 根据事件id查询事件
* 根据事件id查询事件
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
HighWordService.java
→
src/main/java/com/zhiwei/brandkbs2/service/HighWordService.java
View file @
d6139789
...
@@ -7,12 +7,12 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
...
@@ -7,12 +7,12 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
HighWordService
* @ClassName: HighWordService
* @Description 高频词服务接口
* @Description 高频词服务接口
* @author: sjj
* @author: sjj
* @date: 2022-06-06 09:59
* @date: 2022-06-06 09:59
*/
*/
public
interface
I
HighWordService
{
public
interface
HighWordService
{
/**
/**
* 分页查询高频词列表
* 分页查询高频词列表
...
...
src/main/java/com/zhiwei/brandkbs2/service/IReportService.java
deleted
100644 → 0
View file @
26238275
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSettingsDTO
;
import
java.util.Map
;
/**
* @ClassName: IReportService
* @Description 报告业务接口
* @author: sjj
* @date: 2022-05-31 18:00
*/
public
interface
IReportService
{
/**
* 获取项目报告配置信息
*
* @return 项目报告配置信息
*/
Map
<
String
,
ReportSettingsDTO
>
getReportSettings
();
/**
* 保存报告配置
*
* @param reportSettingsDTO 报告配置传输类
*/
void
upsertReportSettings
(
ReportSettingsDTO
reportSettingsDTO
);
/**
* 获取简报分类统计
*
* @return 获取简报分类统计
*/
JSONObject
getReportsAggCount
();
}
src/main/java/com/zhiwei/brandkbs2/service/
I
MarkDataService.java
→
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
View file @
d6139789
...
@@ -8,12 +8,12 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
...
@@ -8,12 +8,12 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
MarkDataService
* @ClassName: MarkDataService
* @Description: 标注数据服务抽象类
* @Description: 标注数据服务抽象类
* @author: sjj
* @author: sjj
* @date: 2022-06-28 14:04
* @date: 2022-06-28 14:04
*/
*/
public
interface
I
MarkDataService
{
public
interface
MarkDataService
{
/**
/**
* @param markSearchDTO 标注数据搜索传输类
* @param markSearchDTO 标注数据搜索传输类
...
@@ -22,6 +22,13 @@ public interface IMarkDataService {
...
@@ -22,6 +22,13 @@ public interface IMarkDataService {
PageVO
<
MarkFlowEntity
>
getYuqingMarkList
(
MarkSearchDTO
markSearchDTO
);
PageVO
<
MarkFlowEntity
>
getYuqingMarkList
(
MarkSearchDTO
markSearchDTO
);
/**
/**
* 生成聚合列表并返回id
*
* @return 聚合id
*/
String
generateYuqingMarkAggreeList
(
MarkSearchDTO
markSearchDTO
);
/**
* 舆情标注数据搜索条件
* 舆情标注数据搜索条件
*/
*/
JSONObject
getYuqingMarkCriteria
(
String
linkedGroup
);
JSONObject
getYuqingMarkCriteria
(
String
linkedGroup
);
...
...
src/main/java/com/zhiwei/brandkbs2/service/MarkFlowService.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
/**
* @ClassName: MarkFlowService
* @Description 标注消息流服务抽象类
* @author: sjj
* @date: 2022-07-13 14:00
*/
public
interface
MarkFlowService
{
/**
* 创建标注消息流实体
*
* @param json
* @param projectId
* @param linkedGroupId
* @return
*/
JSONObject
createMarkFlowInfo
(
JSONObject
json
,
String
projectId
,
String
linkedGroupId
);
/**
* 快照页信息组装
*
* @param markFlowEntity 消息实体
*/
String
setShotPage
(
String
markFlowEntity
);
/**
* 获取标注消息实体
*
* @param id 缓存id
* @return markFlowEntity
*/
MarkFlowEntity
getShotPageFromCache
(
String
id
);
}
src/main/java/com/zhiwei/brandkbs2/service/
I
ProjectService.java
→
src/main/java/com/zhiwei/brandkbs2/service/ProjectService.java
View file @
d6139789
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.service;
...
@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.service;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.Project
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
...
@@ -13,7 +14,7 @@ import java.util.List;
...
@@ -13,7 +14,7 @@ import java.util.List;
* @description 项目业务接口
* @description 项目业务接口
* @date 2022年4月18日16:49:10
* @date 2022年4月18日16:49:10
*/
*/
public
interface
I
ProjectService
{
public
interface
ProjectService
{
/**
/**
* 添加项目
* 添加项目
...
@@ -97,4 +98,10 @@ public interface IProjectService {
...
@@ -97,4 +98,10 @@ public interface IProjectService {
*/
*/
AbstractProject
getProjectByLinkedGroupId
(
String
linkedGroupId
);
AbstractProject
getProjectByLinkedGroupId
(
String
linkedGroupId
);
/**
* 获取所有启动状态下的Project
* @return
*/
List
<
Project
>
getAllProjectsWithStart
();
}
}
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.Report
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSettingsDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
org.apache.commons.lang3.tuple.Pair
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: ReportService
* @Description 报告业务接口
* @author: sjj
* @date: 2022-05-31 18:00
*/
public
interface
ReportService
{
/**
* 获取项目报告配置信息
*
* @return 项目报告配置信息
*/
Map
<
String
,
ReportSettingsDTO
>
getReportSettings
();
List
<
Report
>
getCustomReportByStatus
(
String
projectId
,
boolean
status
);
/**
* 保存报告配置
*
* @param reportSettingsDTO 报告配置传输类
*/
void
upsertReportSettings
(
ReportSettingsDTO
reportSettingsDTO
);
/**
* 开闭简报设置使用
*
* @param id
* @param used
*/
@Deprecated
void
switchReportSettingsUsed
(
String
id
,
boolean
used
);
/**
* 开闭简报生成状态
*
* @param id
* @param status
*/
void
switchReportStatus
(
String
id
,
boolean
status
);
/**
* 获取简报分类统计
*
* @return 获取简报分类统计
*/
JSONObject
getReportsAggCount
();
/**
* 生成简报信息并返回
*
* @param reportSettings
* @param project
* @return 新否新简报&&简报
*/
Pair
<
Boolean
,
Report
>
generateReportBySettings
(
ReportSettings
reportSettings
,
AbstractProject
project
);
/**
* 获取PC端报告信息
*
* @param id 报告ID
* @param cache 是否优先读取缓存
* @return 获取PC端报告信息
*/
JSONObject
getPcReportAnalyze
(
String
id
,
boolean
cache
);
/**
* 获取PC端报告信息
*
* @param report 报告
* @param cache 是否优先读取缓存
* @return 获取PC端报告信息
*/
JSONObject
getPcReportAnalyze
(
Report
report
,
boolean
cache
);
/**
* 分页查询报告列表
*
* @param reportSearch 报告搜索对象
* @return 分页查询报告列表
*/
PageVO
<
JSONObject
>
findReportList
(
ReportSearchDTO
reportSearch
);
/**
* 添加自定义简报
*
* @param reportDTO
*/
void
addCustomReport
(
ReportDTO
reportDTO
);
/**
* 删除简报
*
* @param id
*/
void
deleteReportById
(
String
id
);
}
src/main/java/com/zhiwei/brandkbs2/service/
I
SystemInfoService.java
→
src/main/java/com/zhiwei/brandkbs2/service/SystemInfoService.java
View file @
d6139789
...
@@ -6,12 +6,12 @@ import com.zhiwei.qbjc.bean.pojo.common.Tag;
...
@@ -6,12 +6,12 @@ import com.zhiwei.qbjc.bean.pojo.common.Tag;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
SystemInfoService
* @ClassName: SystemInfoService
* @Description 监测系统相关infoService
* @Description 监测系统相关infoService
* @author: sjj
* @author: sjj
* @date: 2022-06-16 14:19
* @date: 2022-06-16 14:19
*/
*/
public
interface
I
SystemInfoService
{
public
interface
SystemInfoService
{
/**
/**
* 获取监测系统Platforms
* 获取监测系统Platforms
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
TagFilterService.java
→
src/main/java/com/zhiwei/brandkbs2/service/TagFilterService.java
View file @
d6139789
...
@@ -10,7 +10,7 @@ import java.util.List;
...
@@ -10,7 +10,7 @@ import java.util.List;
* @author: sjj
* @author: sjj
* @date: 2022-06-01 13:40
* @date: 2022-06-01 13:40
*/
*/
public
interface
I
TagFilterService
{
public
interface
TagFilterService
{
/**
/**
* 获取在用筛选器列表
* 获取在用筛选器列表
...
...
src/main/java/com/zhiwei/brandkbs2/service/
I
TaskService.java
→
src/main/java/com/zhiwei/brandkbs2/service/TaskService.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
;
package
com
.
zhiwei
.
brandkbs2
.
service
;
/**
/**
* @ClassName:
I
TaskService
* @ClassName: TaskService
* @Description 定时服务抽象类
* @Description 定时服务抽象类
* @author: sjj
* @author: sjj
* @date: 2022-06-16 15:27
* @date: 2022-06-16 15:27
*/
*/
public
interface
I
TaskService
{
public
interface
TaskService
{
/**
/**
*
渠道
记录
*
消息进量
记录
*/
*/
void
messageFlowCount
(
int
day
);
void
messageFlowCount
(
int
day
);
/**
/**
*
简报
推送
*
生成简报任务并
推送
*/
*/
void
report
Send
();
void
generateReportAnd
Send
();
}
}
src/main/java/com/zhiwei/brandkbs2/service/
I
UserService.java
→
src/main/java/com/zhiwei/brandkbs2/service/UserService.java
View file @
d6139789
...
@@ -8,12 +8,12 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
...
@@ -8,12 +8,12 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
UserService
* @ClassName: UserService
* @Description 用户管理服务接口
* @Description 用户管理服务接口
* @author: sjj
* @author: sjj
* @date: 2022-04-28 14:58
* @date: 2022-04-28 14:58
*/
*/
public
interface
I
UserService
{
public
interface
UserService
{
/**
/**
* 用户登录
* 用户登录
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/BehaviorServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.
I
BehaviorDao
;
import
com.zhiwei.brandkbs2.dao.BehaviorDao
;
import
com.zhiwei.brandkbs2.dao.
I
UserDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportBehaviorDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportBehaviorDTO
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
...
@@ -11,7 +11,7 @@ import com.zhiwei.brandkbs2.pojo.User;
...
@@ -11,7 +11,7 @@ import com.zhiwei.brandkbs2.pojo.User;
import
com.zhiwei.brandkbs2.pojo.UserRole
;
import
com.zhiwei.brandkbs2.pojo.UserRole
;
import
com.zhiwei.brandkbs2.pojo.vo.BehaviorVO
;
import
com.zhiwei.brandkbs2.pojo.vo.BehaviorVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.
I
BehaviorService
;
import
com.zhiwei.brandkbs2.service.BehaviorService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -39,14 +39,14 @@ import java.util.stream.Collectors;
...
@@ -39,14 +39,14 @@ import java.util.stream.Collectors;
* @date: 2022-05-27 13:41
* @date: 2022-05-27 13:41
*/
*/
@Service
(
"behaviorServiceImpl"
)
@Service
(
"behaviorServiceImpl"
)
public
class
BehaviorServiceImpl
implements
I
BehaviorService
{
public
class
BehaviorServiceImpl
implements
BehaviorService
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
BehaviorServiceImpl
.
class
);
public
static
final
Logger
log
=
LogManager
.
getLogger
(
BehaviorServiceImpl
.
class
);
@Resource
(
name
=
"behaviorDao"
)
@Resource
(
name
=
"behaviorDao"
)
private
I
BehaviorDao
behaviorDao
;
private
BehaviorDao
behaviorDao
;
@Resource
(
name
=
"userDao"
)
@Resource
(
name
=
"userDao"
)
private
I
UserDao
userDao
;
private
UserDao
userDao
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/BrandkbsTaskServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.
I
BrandkbsTaskDao
;
import
com.zhiwei.brandkbs2.dao.BrandkbsTaskDao
;
import
com.zhiwei.brandkbs2.pojo.BrandkbsTask
;
import
com.zhiwei.brandkbs2.pojo.BrandkbsTask
;
import
com.zhiwei.brandkbs2.service.
I
BrandkbsTaskService
;
import
com.zhiwei.brandkbs2.service.BrandkbsTaskService
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -17,10 +17,10 @@ import java.util.Objects;
...
@@ -17,10 +17,10 @@ import java.util.Objects;
* @date: 2022-07-12 17:38
* @date: 2022-07-12 17:38
*/
*/
@Service
@Service
public
class
BrandkbsTaskServiceImpl
implements
I
BrandkbsTaskService
{
public
class
BrandkbsTaskServiceImpl
implements
BrandkbsTaskService
{
@Resource
(
name
=
"brandkbsTaskDao"
)
@Resource
(
name
=
"brandkbsTaskDao"
)
private
I
BrandkbsTaskDao
brandkbsTaskDao
;
private
BrandkbsTaskDao
brandkbsTaskDao
;
/**
/**
* 根据任务名称获取任务
* 根据任务名称获取任务
...
@@ -59,6 +59,9 @@ public class BrandkbsTaskServiceImpl implements IBrandkbsTaskService {
...
@@ -59,6 +59,9 @@ public class BrandkbsTaskServiceImpl implements IBrandkbsTaskService {
*/
*/
@Override
@Override
public
void
resetTask
(
BrandkbsTask
task
,
Long
nextTime
)
{
public
void
resetTask
(
BrandkbsTask
task
,
Long
nextTime
)
{
if
(
null
==
task
)
{
return
;
}
Update
set
=
Update
.
update
(
"version"
,
Constant
.
INIT_VERSION
).
set
(
"executableTime"
,
nextTime
);
Update
set
=
Update
.
update
(
"version"
,
Constant
.
INIT_VERSION
).
set
(
"executableTime"
,
nextTime
);
brandkbsTaskDao
.
updateOneByIdWithField
(
task
.
getId
(),
set
);
brandkbsTaskDao
.
updateOneByIdWithField
(
task
.
getId
(),
set
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.
I
ChannelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.
I
ChannelLabelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelLabelDao
;
import
com.zhiwei.brandkbs2.dao.
I
EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.
I
EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelArticleDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelArticleDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportAdminChannelEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportChannelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportChannelDTO
;
...
@@ -16,7 +16,7 @@ import com.zhiwei.brandkbs2.model.CommonCodeEnum;
...
@@ -16,7 +16,7 @@ import com.zhiwei.brandkbs2.model.CommonCodeEnum;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.dto.ChannelDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ChannelDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.
I
ChannelService
;
import
com.zhiwei.brandkbs2.service.ChannelService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -38,19 +38,19 @@ import java.util.stream.Collectors;
...
@@ -38,19 +38,19 @@ import java.util.stream.Collectors;
* @date: 2022-06-16 16:07
* @date: 2022-06-16 16:07
*/
*/
@Service
(
"channelServiceImpl"
)
@Service
(
"channelServiceImpl"
)
public
class
ChannelServiceImpl
implements
I
ChannelService
{
public
class
ChannelServiceImpl
implements
ChannelService
{
@Resource
(
name
=
"eventDataDao"
)
@Resource
(
name
=
"eventDataDao"
)
I
EventDataDao
eventDataDao
;
EventDataDao
eventDataDao
;
@Resource
(
name
=
"channelDao"
)
@Resource
(
name
=
"channelDao"
)
I
ChannelDao
channelDao
;
ChannelDao
channelDao
;
@Resource
(
name
=
"eventDao"
)
@Resource
(
name
=
"eventDao"
)
I
EventDao
eventDao
;
EventDao
eventDao
;
@Resource
(
name
=
"channelLabelDao"
)
@Resource
(
name
=
"channelLabelDao"
)
I
ChannelLabelDao
channelLabelDao
;
ChannelLabelDao
channelLabelDao
;
@Resource
(
name
=
"esClientDao"
)
@Resource
(
name
=
"esClientDao"
)
EsClientDao
esClientDao
;
EsClientDao
esClientDao
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/CommonServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.service.ICommonService
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.service.IProjectService
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.service.MarkerClient
;
import
com.zhiwei.middleware.mark.service.MarkerClient
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
com.zhiwei.middleware.mark.vo.TagSearch
;
import
com.zhiwei.middleware.mark.vo.TagSearch
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpEntity
;
...
@@ -14,10 +18,7 @@ import org.springframework.stereotype.Service;
...
@@ -14,10 +18,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -27,13 +28,13 @@ import java.util.stream.Collectors;
...
@@ -27,13 +28,13 @@ import java.util.stream.Collectors;
* @date: 2022-06-02 11:23
* @date: 2022-06-02 11:23
*/
*/
@Service
(
"commonServiceImpl"
)
@Service
(
"commonServiceImpl"
)
public
class
CommonServiceImpl
implements
I
CommonService
{
public
class
CommonServiceImpl
implements
CommonService
{
@Value
(
"${qbjc.platform.url}"
)
@Value
(
"${qbjc.platform.url}"
)
private
String
qbjcPlatformUrl
;
private
String
qbjcPlatformUrl
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
I
ProjectService
projectService
;
private
ProjectService
projectService
;
@Autowired
@Autowired
private
MarkerClient
markClient
;
private
MarkerClient
markClient
;
...
@@ -71,8 +72,7 @@ public class CommonServiceImpl implements ICommonService {
...
@@ -71,8 +72,7 @@ public class CommonServiceImpl implements ICommonService {
@Override
@Override
public
List
<
String
>
getQbjcPlatformNames
()
{
public
List
<
String
>
getQbjcPlatformNames
()
{
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
getForEntity
(
qbjcPlatformUrl
,
JSONObject
.
class
);
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
getForEntity
(
qbjcPlatformUrl
,
JSONObject
.
class
);
return
Objects
.
requireNonNull
(
entity
.
getBody
()).
getJSONArray
(
"data"
).
toJavaList
(
JSONObject
.
class
).
stream
().
map
(
json
->
json
.
getString
(
"name"
))
return
Objects
.
requireNonNull
(
entity
.
getBody
()).
getJSONArray
(
"data"
).
toJavaList
(
JSONObject
.
class
).
stream
().
map
(
json
->
json
.
getString
(
"name"
)).
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
@Override
@Override
...
@@ -90,4 +90,18 @@ public class CommonServiceImpl implements ICommonService {
...
@@ -90,4 +90,18 @@ public class CommonServiceImpl implements ICommonService {
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
@Override
public
Long
[]
getTimeRangeMonth
()
{
long
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
long
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
return
new
Long
[]{
startTime
,
endTime
};
}
@Override
public
Long
[]
getTimeRangeWeek
()
{
long
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
long
startTime
=
DateUtils
.
addWeeks
(
new
Date
(
endTime
),
-
1
).
getTime
();
return
new
Long
[]{
startTime
,
endTime
};
}
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/CustomTagServiceImpl.java
View file @
d6139789
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.
I
CustomTagDao
;
import
com.zhiwei.brandkbs2.dao.CustomTagDao
;
import
com.zhiwei.brandkbs2.enmus.response.CustomTagCodeEnum
;
import
com.zhiwei.brandkbs2.enmus.response.CustomTagCodeEnum
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
...
@@ -10,7 +10,7 @@ import com.zhiwei.brandkbs2.model.CommonCodeEnum;
...
@@ -10,7 +10,7 @@ import com.zhiwei.brandkbs2.model.CommonCodeEnum;
import
com.zhiwei.brandkbs2.pojo.CustomTag
;
import
com.zhiwei.brandkbs2.pojo.CustomTag
;
import
com.zhiwei.brandkbs2.pojo.vo.CustomTagVo
;
import
com.zhiwei.brandkbs2.pojo.vo.CustomTagVo
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.
I
CustomTagService
;
import
com.zhiwei.brandkbs2.service.CustomTagService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.elasticsearch.action.DocWriteResponse
;
import
org.elasticsearch.action.DocWriteResponse
;
import
org.elasticsearch.action.update.UpdateRequest
;
import
org.elasticsearch.action.update.UpdateRequest
;
...
@@ -30,10 +30,10 @@ import java.util.stream.Collectors;
...
@@ -30,10 +30,10 @@ import java.util.stream.Collectors;
* @date 2022年3月24日18:22:53
* @date 2022年3月24日18:22:53
*/
*/
@Service
@Service
public
class
CustomTagServiceImpl
implements
I
CustomTagService
{
public
class
CustomTagServiceImpl
implements
CustomTagService
{
@Resource
(
name
=
"customTagDao"
)
@Resource
(
name
=
"customTagDao"
)
private
I
CustomTagDao
customTagDao
;
private
CustomTagDao
customTagDao
;
@Resource
(
name
=
"esClient"
)
@Resource
(
name
=
"esClient"
)
private
RestHighLevelClient
esClient
;
private
RestHighLevelClient
esClient
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/EventDataServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.
I
EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.pojo.EventData
;
import
com.zhiwei.brandkbs2.pojo.EventData
;
import
com.zhiwei.brandkbs2.service.
I
EventDataService
;
import
com.zhiwei.brandkbs2.service.EventDataService
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -25,14 +25,14 @@ import java.util.stream.Collectors;
...
@@ -25,14 +25,14 @@ import java.util.stream.Collectors;
* @date: 2022-05-23 17:49
* @date: 2022-05-23 17:49
*/
*/
@Service
(
"eventDataServiceImpl"
)
@Service
(
"eventDataServiceImpl"
)
public
class
EventDataServiceImpl
implements
I
EventDataService
{
public
class
EventDataServiceImpl
implements
EventDataService
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
EventDataServiceImpl
.
class
);
public
static
final
Logger
log
=
LogManager
.
getLogger
(
EventDataServiceImpl
.
class
);
@Resource
(
name
=
"eventDao"
)
@Resource
(
name
=
"eventDao"
)
private
I
EventDao
eventDao
;
private
EventDao
eventDao
;
@Resource
(
name
=
"eventDataDao"
)
@Resource
(
name
=
"eventDataDao"
)
private
I
EventDataDao
eventDataDao
;
private
EventDataDao
eventDataDao
;
@Resource
(
name
=
"esClientDao"
)
@Resource
(
name
=
"esClientDao"
)
private
EsClientDao
esClientDao
;
private
EsClientDao
esClientDao
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/EventServiceImpl.java
View file @
d6139789
...
@@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.dao.
I
EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.
I
EventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.config.ReadExcelDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportEventDTO
;
...
@@ -26,9 +26,9 @@ import com.zhiwei.brandkbs2.pojo.dto.YqEventDTO;
...
@@ -26,9 +26,9 @@ import com.zhiwei.brandkbs2.pojo.dto.YqEventDTO;
import
com.zhiwei.brandkbs2.pojo.vo.EventVO
;
import
com.zhiwei.brandkbs2.pojo.vo.EventVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.YqEventSearchVO
;
import
com.zhiwei.brandkbs2.pojo.vo.YqEventSearchVO
;
import
com.zhiwei.brandkbs2.service.
I
EventDataService
;
import
com.zhiwei.brandkbs2.service.EventDataService
;
import
com.zhiwei.brandkbs2.service.
I
EventService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -62,7 +62,7 @@ import java.util.stream.Collectors;
...
@@ -62,7 +62,7 @@ import java.util.stream.Collectors;
* @date: 2022-05-17 16:36
* @date: 2022-05-17 16:36
*/
*/
@Service
(
"eventServiceImpl"
)
@Service
(
"eventServiceImpl"
)
public
class
EventServiceImpl
implements
I
EventService
{
public
class
EventServiceImpl
implements
EventService
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
EventServiceImpl
.
class
);
private
static
final
Logger
log
=
LogManager
.
getLogger
(
EventServiceImpl
.
class
);
@Value
(
"${qbjc.event.tag.url}"
)
@Value
(
"${qbjc.event.tag.url}"
)
...
@@ -75,16 +75,16 @@ public class EventServiceImpl implements IEventService {
...
@@ -75,16 +75,16 @@ public class EventServiceImpl implements IEventService {
private
String
brandkbsFileUrl
;
private
String
brandkbsFileUrl
;
@Resource
(
name
=
"eventDao"
)
@Resource
(
name
=
"eventDao"
)
private
I
EventDao
eventDao
;
private
EventDao
eventDao
;
@Resource
(
name
=
"eventDataDao"
)
@Resource
(
name
=
"eventDataDao"
)
private
I
EventDataDao
eventDataDao
;
private
EventDataDao
eventDataDao
;
@Resource
(
name
=
"eventDataServiceImpl"
)
@Resource
(
name
=
"eventDataServiceImpl"
)
private
I
EventDataService
eventDataService
;
private
EventDataService
eventDataService
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
I
ProjectService
projectService
;
private
ProjectService
projectService
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
...
@@ -225,7 +225,7 @@ public class EventServiceImpl implements IEventService {
...
@@ -225,7 +225,7 @@ public class EventServiceImpl implements IEventService {
@Override
@Override
public
JSONObject
uploadEventDatas
(
String
linkedGroupId
,
MultipartFile
file
)
{
public
JSONObject
uploadEventDatas
(
String
linkedGroupId
,
MultipartFile
file
)
{
String
uuid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
uuid
=
Tools
.
getUUID
(
);
String
redisKey
=
RedisKeyPrefix
.
eventDataProgressKey
(
uuid
);
String
redisKey
=
RedisKeyPrefix
.
eventDataProgressKey
(
uuid
);
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
"0"
);
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
"0"
);
ApplicationProjectListener
.
getThreadPool
().
execute
(()
->
{
ApplicationProjectListener
.
getThreadPool
().
execute
(()
->
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/HighWordServiceImpl.java
View file @
d6139789
...
@@ -2,11 +2,11 @@ package com.zhiwei.brandkbs2.service.impl;
...
@@ -2,11 +2,11 @@ package com.zhiwei.brandkbs2.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.
I
HighWordDao
;
import
com.zhiwei.brandkbs2.dao.HighWordDao
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportHighWordDTO
;
import
com.zhiwei.brandkbs2.easyexcel.dto.ExportHighWordDTO
;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
import
com.zhiwei.brandkbs2.pojo.HighWord
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.
I
HighWordService
;
import
com.zhiwei.brandkbs2.service.HighWordService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
...
@@ -23,10 +23,10 @@ import java.util.stream.Collectors;
...
@@ -23,10 +23,10 @@ import java.util.stream.Collectors;
* @date: 2022-06-06 10:02
* @date: 2022-06-06 10:02
*/
*/
@Service
(
"highWordServiceImpl"
)
@Service
(
"highWordServiceImpl"
)
public
class
HighWordServiceImpl
implements
I
HighWordService
{
public
class
HighWordServiceImpl
implements
HighWordService
{
@Resource
(
name
=
"highWordDao"
)
@Resource
(
name
=
"highWordDao"
)
I
HighWordDao
highWordDao
;
HighWordDao
highWordDao
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
d6139789
...
@@ -8,12 +8,12 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
...
@@ -8,12 +8,12 @@ import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.ImportantChannelEnum
;
import
com.zhiwei.brandkbs2.enmus.ImportantChannelEnum
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsQueryTools
;
import
com.zhiwei.brandkbs2.es.EsQueryTools
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
...
@@ -22,6 +22,7 @@ import com.zhiwei.brandkbs2.pojo.vo.CustomTagVo;
...
@@ -22,6 +22,7 @@ import com.zhiwei.brandkbs2.pojo.vo.CustomTagVo;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.TextUtil
;
import
com.zhiwei.brandkbs2.util.TextUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
...
@@ -51,19 +52,14 @@ import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilde
...
@@ -51,19 +52,14 @@ import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilde
import
org.elasticsearch.search.sort.FieldSortBuilder
;
import
org.elasticsearch.search.sort.FieldSortBuilder
;
import
org.elasticsearch.search.sort.SortBuilders
;
import
org.elasticsearch.search.sort.SortBuilders
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
zhiwei
.
brandkbs2
.
config
.
Constant
.
DAY_PATTERN
;
/**
/**
* @ClassName: MarkDataServiceImpl
* @ClassName: MarkDataServiceImpl
* @Description
* @Description
...
@@ -71,26 +67,29 @@ import static com.zhiwei.brandkbs2.config.Constant.DAY_PATTERN;
...
@@ -71,26 +67,29 @@ import static com.zhiwei.brandkbs2.config.Constant.DAY_PATTERN;
* @date: 2022-06-28 14:07
* @date: 2022-06-28 14:07
*/
*/
@Service
(
"markDataServiceImpl"
)
@Service
(
"markDataServiceImpl"
)
public
class
MarkDataServiceImpl
implements
I
MarkDataService
{
public
class
MarkDataServiceImpl
implements
MarkDataService
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
MarkDataServiceImpl
.
class
);
private
static
final
Logger
log
=
LogManager
.
getLogger
(
MarkDataServiceImpl
.
class
);
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
I
ProjectService
projectService
;
private
ProjectService
projectService
;
@Resource
(
name
=
"esClientDao"
)
@Resource
(
name
=
"esClientDao"
)
private
EsClientDao
esClientDao
;
private
EsClientDao
esClientDao
;
@Resource
(
name
=
"commonServiceImpl"
)
@Resource
(
name
=
"commonServiceImpl"
)
private
I
CommonService
commonService
;
private
CommonService
commonService
;
@Resource
(
name
=
"customTagServiceImpl"
)
@Resource
(
name
=
"customTagServiceImpl"
)
private
I
CustomTagService
customTagService
;
private
CustomTagService
customTagService
;
@Resource
(
name
=
"tagFilterServiceImpl"
)
@Resource
(
name
=
"tagFilterServiceImpl"
)
ITagFilterService
tagFilterService
;
TagFilterService
tagFilterService
;
@Resource
(
name
=
"markFlowServiceImpl"
)
MarkFlowService
markFlowService
;
@
Autowired
@
Resource
(
name
=
"redisUtil"
)
private
StringRedisTemplate
stringRedisTemplate
;
RedisUtil
redisUtil
;
@Override
@Override
public
PageVO
<
MarkFlowEntity
>
getYuqingMarkList
(
MarkSearchDTO
markSearchDTO
)
{
public
PageVO
<
MarkFlowEntity
>
getYuqingMarkList
(
MarkSearchDTO
markSearchDTO
)
{
...
@@ -100,18 +99,12 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -100,18 +99,12 @@ public class MarkDataServiceImpl implements IMarkDataService {
Pair
<
SearchHits
,
Map
<
String
,
Long
>>
hitsAndCounts
=
searchMarkHitsAndCount
(
markSearchDTO
);
Pair
<
SearchHits
,
Map
<
String
,
Long
>>
hitsAndCounts
=
searchMarkHitsAndCount
(
markSearchDTO
);
// 总量
// 总量
long
total
=
hitsAndCounts
.
getLeft
().
getTotalHits
().
value
>
10000
?
10000
:
hitsAndCounts
.
getLeft
().
getTotalHits
().
value
;
long
total
=
hitsAndCounts
.
getLeft
().
getTotalHits
().
value
>
10000
?
10000
:
hitsAndCounts
.
getLeft
().
getTotalHits
().
value
;
// 消息流结果
// 消息列表
List
<
MarkFlowEntity
>
flowEntityList
;
List
<
MarkFlowEntity
>
flowEntityList
=
getMarkFlowEntity
(
markSearchDTO
,
hitsAndCounts
.
getLeft
());
// 是否需要聚合,文档数>1才能聚合
// 返回分页结果并设置平台count
if
(
markSearchDTO
.
isAggregation
()
&&
total
>
1
)
{
List
<
List
<
JSONObject
>>
groupList
=
aggregation
(
hitsAndCounts
.
getLeft
(),
"id"
);
flowEntityList
=
groupList
.
stream
().
map
(
MarkFlowEntity:
:
getInstance
).
collect
(
Collectors
.
toList
());
}
else
{
flowEntityList
=
Arrays
.
stream
(
hitsAndCounts
.
getLeft
().
getHits
()).
map
(
MarkFlowEntity:
:
new
).
collect
(
Collectors
.
toList
());
}
return
PageVO
.
createPageVo
(
total
,
markSearchDTO
.
getPage
(),
markSearchDTO
.
getPageSize
(),
flowEntityList
)
return
PageVO
.
createPageVo
(
total
,
markSearchDTO
.
getPage
(),
markSearchDTO
.
getPageSize
(),
flowEntityList
)
// 各平台计量
// 各平台计量
.
setInfo
(
new
JSONObject
(
ImmutableMap
.
of
(
"
c
ount"
,
hitsAndCounts
.
getRight
())));
.
setInfo
(
new
JSONObject
(
ImmutableMap
.
of
(
"
platformC
ount"
,
hitsAndCounts
.
getRight
())));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es检索异常"
));
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es检索异常"
));
}
}
...
@@ -119,12 +112,30 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -119,12 +112,30 @@ public class MarkDataServiceImpl implements IMarkDataService {
}
}
@Override
@Override
public
String
generateYuqingMarkAggreeList
(
MarkSearchDTO
markSearchDTO
)
{
String
uuid
=
Tools
.
getUUID
();
ApplicationProjectListener
.
getThreadPool
().
execute
(()
->
{
try
{
defaultMarkSearch
(
markSearchDTO
);
// 搜索es数据
Pair
<
SearchHits
,
Map
<
String
,
Long
>>
hitsAndCounts
=
searchMarkHitsAndCount
(
markSearchDTO
);
// 聚合分组后数据
List
<
List
<
JSONObject
>>
groupList
=
aggregation
(
hitsAndCounts
.
getLeft
(),
"id"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"generateYuqingMarkAggreeList-"
,
e
);
}
});
return
uuid
;
}
@Override
public
JSONObject
getYuqingMarkCriteria
(
String
linkedGroupId
)
{
public
JSONObject
getYuqingMarkCriteria
(
String
linkedGroupId
)
{
if
(
null
==
linkedGroupId
)
{
if
(
null
==
linkedGroupId
)
{
linkedGroupId
=
projectService
.
getProjectVOById
(
UserThreadLocal
.
getProjectId
()).
getBrandLinkedGroupId
();
linkedGroupId
=
projectService
.
getProjectVOById
(
UserThreadLocal
.
getProjectId
()).
getBrandLinkedGroupId
();
}
}
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
Date
endDate
=
new
Date
();
// 搜索时间
// 搜索时间
result
.
put
(
"times"
,
Arrays
.
asList
(
"今天"
,
"24小时"
,
"三天"
,
"七天"
,
"近30天"
));
result
.
put
(
"times"
,
Arrays
.
asList
(
"今天"
,
"24小时"
,
"三天"
,
"七天"
,
"近30天"
));
// 平台
// 平台
...
@@ -151,16 +162,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -151,16 +162,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
@Override
@Override
public
JSONObject
getAnalyzeSummary
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
public
JSONObject
getAnalyzeSummary
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
try
{
try
{
if
(
Objects
.
isNull
(
startTime
)
||
Objects
.
isNull
(
endTime
))
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
DAY_PATTERN
),
1
).
getTime
();
startTime
=
timeRange
[
0
];
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
endTime
=
timeRange
[
1
];
}
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
redisKey
=
RedisKeyPrefix
.
MARK_ANALYZE_SUMMARY
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
redisKey
=
RedisKeyPrefix
.
MARK_ANALYZE_SUMMARY
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
resultStr
;
String
resultStr
;
// 返回缓存
// 返回缓存
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
stringRedisTemplate
.
opsForValue
()
.
get
(
redisKey
)))
{
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSON
.
parseObject
(
resultStr
);
return
JSON
.
parseObject
(
resultStr
);
}
}
// 返回值
// 返回值
...
@@ -178,16 +188,24 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -178,16 +188,24 @@ public class MarkDataServiceImpl implements IMarkDataService {
// 负面舆情峰值平台
// 负面舆情峰值平台
platformsCount
.
stream
().
max
(
Comparator
.
comparing
(
o
->
o
.
getInteger
(
EmotionEnum
.
NEGATIVE
.
getName
()))).
ifPresent
(
e
->
result
.
put
(
"negTopPlatform"
,
e
.
getString
(
"platform_id"
)));
platformsCount
.
stream
().
max
(
Comparator
.
comparing
(
o
->
o
.
getInteger
(
EmotionEnum
.
NEGATIVE
.
getName
()))).
ifPresent
(
e
->
result
.
put
(
"negTopPlatform"
,
e
.
getString
(
"platform_id"
)));
// 获取时间段正面情感数据最多的标题
// 获取时间段正面情感数据最多的标题
String
posTopTitle
=
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
linkedGroupId
,
1
).
get
(
0
).
getKey
();
String
topTitle
=
""
;
result
.
put
(
"posTopTitle"
,
posTopTitle
);
List
<
Map
.
Entry
<
String
,
Integer
>>
markTopTitle
=
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
POSITIVE
.
getName
(),
projectId
,
linkedGroupId
,
1
);
if
(!
markTopTitle
.
isEmpty
())
{
topTitle
=
markTopTitle
.
get
(
0
).
getKey
();
}
result
.
put
(
"posTopTitle"
,
topTitle
);
// 正面舆情峰值时间
// 正面舆情峰值时间
markSpread
.
stream
().
max
(
Comparator
.
comparing
(
o
->
o
.
getInteger
(
"negNormalCount"
))).
ifPresent
(
e
->
result
.
put
(
"negMaxTime"
,
e
.
getLong
(
"time"
)));
markSpread
.
stream
().
max
(
Comparator
.
comparing
(
o
->
o
.
getInteger
(
"negNormalCount"
))).
ifPresent
(
e
->
result
.
put
(
"negMaxTime"
,
e
.
getLong
(
"time"
)));
// 获取时间段负面情感数据最多的标题
// 获取时间段负面情感数据最多的标题
String
negTopTitle
=
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
linkedGroupId
,
1
).
get
(
0
).
getKey
();
topTitle
=
""
;
result
.
put
(
"negTopTitle"
,
negTopTitle
);
List
<
Map
.
Entry
<
String
,
Integer
>>
negTopTitle
=
getMarkTopTitle
(
startTime
,
endTime
,
EmotionEnum
.
NEGATIVE
.
getName
(),
projectId
,
linkedGroupId
,
1
);
if
(!
negTopTitle
.
isEmpty
())
{
topTitle
=
negTopTitle
.
get
(
0
).
getKey
();
}
result
.
put
(
"negTopTitle"
,
topTitle
);
List
<
JSONObject
>
articlePlatformProportion
=
getMarkPlatformProportion
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
true
);
List
<
JSONObject
>
articlePlatformProportion
=
getMarkPlatformProportion
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
true
);
result
.
put
(
"platformRank"
,
articlePlatformProportion
.
stream
().
filter
(
articlePlatform
->
articlePlatform
.
getLongValue
(
"count"
)
>
0
).
sorted
((
o1
,
o2
)
->
o2
.
getLong
(
"count"
).
compareTo
(
o1
.
getLong
(
"count"
))).
collect
(
Collectors
.
toList
()));
result
.
put
(
"platformRank"
,
articlePlatformProportion
.
stream
().
filter
(
articlePlatform
->
articlePlatform
.
getLongValue
(
"count"
)
>
0
).
sorted
((
o1
,
o2
)
->
o2
.
getLong
(
"count"
).
compareTo
(
o1
.
getLong
(
"count"
))).
collect
(
Collectors
.
toList
()));
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
result
),
1
,
TimeUnit
.
HOURS
);
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
result
),
1
,
TimeUnit
.
HOURS
);
return
result
;
return
result
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es查询异常"
),
e
);
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es查询异常"
),
e
);
...
@@ -209,16 +227,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -209,16 +227,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
@Override
@Override
public
JSONObject
getMarkEmotionProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
public
JSONObject
getMarkEmotionProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
try
{
try
{
if
(
Objects
.
isNull
(
startTime
)
||
Objects
.
isNull
(
endTime
))
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
startTime
=
timeRange
[
0
];
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
endTime
=
timeRange
[
1
];
}
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
redisKey
=
RedisKeyPrefix
.
MARK_EMOTION_PROPORTION
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
redisKey
=
RedisKeyPrefix
.
MARK_EMOTION_PROPORTION
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
// 返回缓存
// 返回缓存
String
resultStr
;
String
resultStr
;
if
(
cache
&&
(
StringUtils
.
isNotEmpty
(
resultStr
=
stringRedisTemplate
.
opsForValue
()
.
get
(
redisKey
))))
{
if
(
cache
&&
(
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
))))
{
return
JSON
.
parseObject
(
resultStr
);
return
JSON
.
parseObject
(
resultStr
);
}
}
long
lastStartTime
=
startTime
-
(
endTime
-
startTime
);
long
lastStartTime
=
startTime
-
(
endTime
-
startTime
);
...
@@ -234,7 +251,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -234,7 +251,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
result
.
put
(
"lastPosCount"
,
oldEmotions
.
get
(
0
).
getLongValue
(
"count"
));
result
.
put
(
"lastPosCount"
,
oldEmotions
.
get
(
0
).
getLongValue
(
"count"
));
result
.
put
(
"lastNeuCount"
,
oldEmotions
.
get
(
1
).
getLongValue
(
"count"
));
result
.
put
(
"lastNeuCount"
,
oldEmotions
.
get
(
1
).
getLongValue
(
"count"
));
result
.
put
(
"lastNegCount"
,
oldEmotions
.
get
(
2
).
getLongValue
(
"count"
));
result
.
put
(
"lastNegCount"
,
oldEmotions
.
get
(
2
).
getLongValue
(
"count"
));
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
result
),
1
,
TimeUnit
.
HOURS
);
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
result
),
1
,
TimeUnit
.
HOURS
);
return
result
;
return
result
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es查询异常"
),
e
);
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es查询异常"
),
e
);
...
@@ -244,15 +261,14 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -244,15 +261,14 @@ public class MarkDataServiceImpl implements IMarkDataService {
@Override
@Override
public
List
<
JSONObject
>
getMarkChannelProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
public
List
<
JSONObject
>
getMarkChannelProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
if
(
Objects
.
isNull
(
startTime
)
||
Objects
.
isNull
(
endTime
))
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
startTime
=
timeRange
[
0
];
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
endTime
=
timeRange
[
1
];
}
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
redisKey
=
RedisKeyPrefix
.
MARK_CHANNEL_PROPORTION
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
redisKey
=
RedisKeyPrefix
.
MARK_CHANNEL_PROPORTION
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
resultStr
;
String
resultStr
;
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
stringRedisTemplate
.
opsForValue
()
.
get
(
redisKey
)))
{
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
}
}
// emotion范围
// emotion范围
...
@@ -284,7 +300,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -284,7 +300,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
result
.
put
(
"mediaTypePro"
,
mediaTypeResultList
);
result
.
put
(
"mediaTypePro"
,
mediaTypeResultList
);
result
.
put
(
"proportion"
,
articlesCount
==
0
?
0
d
:
channelEmotionCount
*
1.0
/
articlesCount
);
result
.
put
(
"proportion"
,
articlesCount
==
0
?
0
d
:
channelEmotionCount
*
1.0
/
articlesCount
);
}
}
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
channelEmotions
),
1
,
TimeUnit
.
HOURS
);
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
channelEmotions
),
1
,
TimeUnit
.
HOURS
);
}
}
return
channelEmotions
;
return
channelEmotions
;
}
}
...
@@ -293,10 +309,9 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -293,10 +309,9 @@ public class MarkDataServiceImpl implements IMarkDataService {
public
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
public
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
List
<
JSONObject
>
res
=
null
;
List
<
JSONObject
>
res
=
null
;
try
{
try
{
if
(
Objects
.
isNull
(
startTime
)
||
Objects
.
isNull
(
endTime
))
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
startTime
=
timeRange
[
0
];
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
endTime
=
timeRange
[
1
];
}
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
res
=
getMarkPlatformProportion
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
cache
);
res
=
getMarkPlatformProportion
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
cache
);
...
@@ -309,14 +324,13 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -309,14 +324,13 @@ public class MarkDataServiceImpl implements IMarkDataService {
@Override
@Override
public
List
<
JSONObject
>
getMarkHighWord
(
Long
startTime
,
Long
endTime
)
{
public
List
<
JSONObject
>
getMarkHighWord
(
Long
startTime
,
Long
endTime
)
{
try
{
try
{
if
(
Objects
.
isNull
(
startTime
)
||
Objects
.
isNull
(
endTime
))
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
startTime
=
timeRange
[
0
];
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
endTime
=
timeRange
[
1
];
}
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
String
redisKey
=
RedisKeyPrefix
.
MARK_HIGH_WORD
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
redisKey
=
RedisKeyPrefix
.
MARK_HIGH_WORD
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
resultStr
=
stringRedisTemplate
.
opsForValue
()
.
get
(
redisKey
);
String
resultStr
=
redisUtil
.
get
(
redisKey
);
if
(
StringUtils
.
isNotEmpty
(
resultStr
))
{
if
(
StringUtils
.
isNotEmpty
(
resultStr
))
{
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
}
}
...
@@ -327,7 +341,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -327,7 +341,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
// 分析高频词
// 分析高频词
List
<
JSONObject
>
highWords
=
TextUtil
.
getHighWordsJson
(
texts
,
30
);
List
<
JSONObject
>
highWords
=
TextUtil
.
getHighWordsJson
(
texts
,
30
);
log
.
info
(
"分析高频词耗时:{}"
,
(
System
.
currentTimeMillis
()
-
s1
));
log
.
info
(
"分析高频词耗时:{}"
,
(
System
.
currentTimeMillis
()
-
s1
));
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
highWords
),
1
,
TimeUnit
.
DAYS
);
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
highWords
)
);
return
highWords
;
return
highWords
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es查询异常"
),
e
);
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"es查询异常"
),
e
);
...
@@ -398,6 +412,10 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -398,6 +412,10 @@ public class MarkDataServiceImpl implements IMarkDataService {
// sort
// sort
FieldSortBuilder
sort
=
null
;
FieldSortBuilder
sort
=
null
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
dto
.
getSorter
().
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
dto
.
getSorter
().
entrySet
())
{
// TODO 暂不支持
if
(
entry
.
getKey
().
contains
(
"influence"
))
{
continue
;
}
if
(
entry
.
getValue
().
toString
().
contains
(
"desc"
))
{
if
(
entry
.
getValue
().
toString
().
contains
(
"desc"
))
{
sort
=
SortBuilders
.
fieldSort
(
entry
.
getKey
()).
order
(
SortOrder
.
DESC
);
sort
=
SortBuilders
.
fieldSort
(
entry
.
getKey
()).
order
(
SortOrder
.
DESC
);
}
else
{
}
else
{
...
@@ -425,7 +443,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -425,7 +443,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
Map
<
String
,
String
>
idTitle
=
jsonList
.
stream
().
collect
(
Collectors
.
toMap
(
json
->
json
.
getString
(
uniqueField
),
Map
<
String
,
String
>
idTitle
=
jsonList
.
stream
().
collect
(
Collectors
.
toMap
(
json
->
json
.
getString
(
uniqueField
),
json
->
Tools
.
getBaseFromEsMap
(
json
).
getTitleNullOptionalContent
()));
json
->
Tools
.
getBaseFromEsMap
(
json
).
getTitleNullOptionalContent
()));
List
<
List
<
String
>>
kResult
=
TextUtil
.
getKResult
(
idTitle
);
List
<
List
<
String
>>
kResult
=
TextUtil
.
getKResult
(
idTitle
);
return
TextUtil
.
sortByTimeAsc
(
kResult
,
jsonList
,
uniqueField
);
return
TextUtil
.
restoreAndSort
(
kResult
,
jsonList
,
uniqueField
);
}
}
// private List<JSONObject> criteriaTime(Date endDate) {
// private List<JSONObject> criteriaTime(Date endDate) {
...
@@ -482,8 +500,6 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -482,8 +500,6 @@ public class MarkDataServiceImpl implements IMarkDataService {
int
lastNeuCount
=
lastArticleEmotions
.
get
(
2
).
getIntValue
(
"count"
);
int
lastNeuCount
=
lastArticleEmotions
.
get
(
2
).
getIntValue
(
"count"
);
int
curArticleTotal
=
curPosCount
+
curNegCount
+
curNeuCount
;
int
curArticleTotal
=
curPosCount
+
curNegCount
+
curNeuCount
;
int
oldArticleTotal
=
lastPosCount
+
lastNegCount
+
lastNeuCount
;
int
oldArticleTotal
=
lastPosCount
+
lastNegCount
+
lastNeuCount
;
result
.
put
(
"startTime"
,
startTime
);
result
.
put
(
"endTime"
,
endTime
);
result
.
put
(
"articlesCount"
,
curArticleTotal
);
result
.
put
(
"articlesCount"
,
curArticleTotal
);
result
.
put
(
"compare"
,
oldArticleTotal
==
0
?
0
d
:
curArticleTotal
/
(
double
)
oldArticleTotal
);
result
.
put
(
"compare"
,
oldArticleTotal
==
0
?
0
d
:
curArticleTotal
/
(
double
)
oldArticleTotal
);
result
.
put
(
"posProportion"
,
curPosCount
*
1.0
/
curArticleTotal
);
result
.
put
(
"posProportion"
,
curPosCount
*
1.0
/
curArticleTotal
);
...
@@ -515,15 +531,13 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -515,15 +531,13 @@ public class MarkDataServiceImpl implements IMarkDataService {
String
[]
fieldSearch
=
"标题"
.
equals
(
searchField
)
?
new
String
[]{
GenericAttribute
.
ES_IND_TITLE
}
:
new
String
[]{
GenericAttribute
.
ES_IND_FULL_TEXT
};
String
[]
fieldSearch
=
"标题"
.
equals
(
searchField
)
?
new
String
[]{
GenericAttribute
.
ES_IND_TITLE
}
:
new
String
[]{
GenericAttribute
.
ES_IND_FULL_TEXT
};
query
.
must
(
EsQueryTools
.
assembleNormalKeywordQuery
(
keyword
,
fieldSearch
));
query
.
must
(
EsQueryTools
.
assembleNormalKeywordQuery
(
keyword
,
fieldSearch
));
}
}
// postFilter
query
.
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.linkedGroupId.keyword"
,
linkedGroupId
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.projectId.keyword"
,
projectId
));
BoolQueryBuilder
postFilter
=
QueryBuilders
.
boolQuery
();
postFilter
.
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.linkedGroupId.keyword"
,
linkedGroupId
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.projectId.keyword"
,
projectId
));
// time range
// time range
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
query
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
List
<
JSONObject
>
resultList
=
new
ArrayList
<>(
emotionList
.
size
());
List
<
JSONObject
>
resultList
=
new
ArrayList
<>(
emotionList
.
size
());
Map
<
String
,
Aggregation
>
aggMap
=
Map
<
String
,
Aggregation
>
aggMap
=
esClientDao
.
searchResponse
(
indexes
,
postFilter
,
query
,
aggregationBuilder
,
null
,
null
,
0
,
0
,
null
).
getAggregations
().
asMap
();
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
aggregationBuilder
,
null
,
null
,
0
,
0
,
null
).
getAggregations
().
asMap
();
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"count"
);
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"count"
);
List
<?
extends
Terms
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
List
<?
extends
Terms
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
for
(
String
emotion
:
emotionList
)
{
for
(
String
emotion
:
emotionList
)
{
...
@@ -539,17 +553,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -539,17 +553,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
public
List
<
JSONObject
>
getMarkSpread
(
Long
startTime
,
Long
endTime
,
String
projectId
,
boolean
cache
)
throws
IOException
{
public
List
<
JSONObject
>
getMarkSpread
(
Long
startTime
,
Long
endTime
,
String
projectId
,
boolean
cache
)
throws
IOException
{
ProjectVO
project
=
projectService
.
getProjectVOById
(
projectId
);
ProjectVO
project
=
projectService
.
getProjectVOById
(
projectId
);
String
linkedGroupId
=
project
.
getBrandLinkedGroupId
();
String
linkedGroupId
=
project
.
getBrandLinkedGroupId
();
if
(
Objects
.
isNull
(
startTime
)
||
Objects
.
isNull
(
endTime
))
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
Constant
.
DAY_PATTERN
),
1
).
getTime
();
startTime
=
timeRange
[
0
];
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
endTime
=
timeRange
[
1
];
}
String
redisKey
=
RedisKeyPrefix
.
MARK_SPREAD
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
redisKey
=
RedisKeyPrefix
.
MARK_SPREAD
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
resultStr
;
String
resultStr
;
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
stringRedisTemplate
.
opsForValue
()
.
get
(
redisKey
)))
{
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
}
}
List
<
JSONObject
>
lineList
=
new
ArrayList
<>();
List
<
JSONObject
>
lineList
=
new
ArrayList
<>();
List
<
JSONObject
>
result
=
getDayMarkEmotionCount
(
startTime
,
endTime
,
projectId
,
linkedGroupId
);
List
<
JSONObject
>
result
=
getDayMarkEmotionCount
(
startTime
,
endTime
,
projectId
,
linkedGroupId
);
result
.
forEach
(
day
->
{
result
.
forEach
(
day
->
{
JSONObject
line
=
new
JSONObject
();
JSONObject
line
=
new
JSONObject
();
...
@@ -560,7 +572,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -560,7 +572,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
line
.
put
(
"time"
,
day
.
getLongValue
(
"date"
));
line
.
put
(
"time"
,
day
.
getLongValue
(
"date"
));
lineList
.
add
(
line
);
lineList
.
add
(
line
);
});
});
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
lineList
),
1
,
TimeUnit
.
HOURS
);
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
lineList
),
1
,
TimeUnit
.
HOURS
);
return
lineList
;
return
lineList
;
}
}
...
@@ -581,17 +593,17 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -581,17 +593,17 @@ public class MarkDataServiceImpl implements IMarkDataService {
// TODO script使用
// TODO script使用
Script
script
=
new
Script
(
"params._source.ind_title"
);
Script
script
=
new
Script
(
"params._source.ind_title"
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"titles"
).
script
(
script
).
order
(
BucketOrder
.
count
(
false
)).
size
(
60000
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"titles"
).
script
(
script
).
order
(
BucketOrder
.
count
(
false
)).
size
(
60000
);
//
postFilter
//
query
BoolQueryBuilder
postFilter
=
projectLinkedGroupQuery
(
projectId
,
linkedGroupId
);
BoolQueryBuilder
query
=
projectLinkedGroupQuery
(
projectId
,
linkedGroupId
);
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
))
query
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
))
// 过滤微博
// 过滤微博
.
mustNot
(
QueryBuilders
.
termQuery
(
"platform_id.keyword"
,
"5d02236e6395002a7c380b79"
));
.
mustNot
(
QueryBuilders
.
termQuery
(
"platform_id.keyword"
,
"5d02236e6395002a7c380b79"
));
if
(
null
!=
emotion
)
{
if
(
null
!=
emotion
)
{
postFilter
.
must
(
QueryBuilders
.
termQuery
(
"mark_cache_maps.name.keyword"
,
emotion
));
query
.
must
(
QueryBuilders
.
termQuery
(
"mark_cache_maps.name.keyword"
,
emotion
));
}
}
Map
<
String
,
Integer
>
result
=
new
HashMap
<>();
Map
<
String
,
Integer
>
result
=
new
HashMap
<>();
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
postFilter
,
null
,
aggregationBuilder
,
null
,
null
,
0
,
0
,
null
);
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
aggregationBuilder
,
null
,
null
,
0
,
0
,
null
);
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"titles"
);
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"titles"
);
List
<?
extends
Terms
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
List
<?
extends
Terms
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
...
@@ -615,19 +627,21 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -615,19 +627,21 @@ public class MarkDataServiceImpl implements IMarkDataService {
* @return 所有稿件倾向稿件数量信息
* @return 所有稿件倾向稿件数量信息
*/
*/
private
List
<
JSONObject
>
getDayMarkEmotionCount
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
linkedGroupId
)
throws
IOException
{
private
List
<
JSONObject
>
getDayMarkEmotionCount
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
linkedGroupId
)
throws
IOException
{
List
<
JSONObject
>
R
esultList
=
new
ArrayList
<>();
List
<
JSONObject
>
r
esultList
=
new
ArrayList
<>();
// 索引
// 索引
String
[]
indexes
=
esClientDao
.
getIndexes
();
String
[]
indexes
=
esClientDao
.
getIndexes
();
// ??? TODO 为什么是16h offset
// ??? TODO 为什么是16h offset
DateHistogramAggregationBuilder
daysAggregationBuilder
=
AggregationBuilders
.
dateHistogram
(
"dayAgg"
).
field
(
"time"
).
calendarInterval
(
DateHistogramInterval
.
DAY
);
DateHistogramAggregationBuilder
daysAggregationBuilder
=
AggregationBuilders
.
dateHistogram
(
"dayAgg"
).
field
(
"time"
).
calendarInterval
(
DateHistogramInterval
.
DAY
);
TermsAggregationBuilder
emotionAggregationBuilder
=
AggregationBuilders
.
terms
(
"count"
).
field
(
"mark_cache_maps.name.keyword"
);
TermsAggregationBuilder
emotionAggregationBuilder
=
AggregationBuilders
.
terms
(
"count"
).
field
(
"mark_cache_maps.name.keyword"
);
// postFilter
// query
BoolQueryBuilder
postFilter
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.projectId.keyword"
,
projectId
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.linkedGroupId.keyword"
,
linkedGroupId
));
query
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.projectId.keyword"
,
projectId
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.linkedGroupId.keyword"
,
linkedGroupId
));
// 情感倾向限制
// 情感倾向限制
postFilter
.
must
(
QueryBuilders
.
termQuery
(
"mark_cache_maps.group_name.keyword"
,
"情感倾向"
));
query
.
must
(
QueryBuilders
.
termQuery
(
"mark_cache_maps.group_name.keyword"
,
"情感倾向"
));
// response
// response
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
postFilter
,
null
,
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
daysAggregationBuilder
.
subAggregation
(
emotionAggregationBuilder
),
null
,
null
,
0
,
0
,
null
);
daysAggregationBuilder
.
subAggregation
(
emotionAggregationBuilder
),
null
,
null
,
0
,
0
,
null
);
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
ParsedDateHistogram
dayAggTeam
=
(
ParsedDateHistogram
)
aggMap
.
get
(
"dayAgg"
);
ParsedDateHistogram
dayAggTeam
=
(
ParsedDateHistogram
)
aggMap
.
get
(
"dayAgg"
);
...
@@ -639,9 +653,9 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -639,9 +653,9 @@ public class MarkDataServiceImpl implements IMarkDataService {
List
<?
extends
Terms
.
Bucket
>
list
=
countTeam
.
getBuckets
();
List
<?
extends
Terms
.
Bucket
>
list
=
countTeam
.
getBuckets
();
result
.
put
(
"date"
,
bucket
.
getKeyAsString
());
result
.
put
(
"date"
,
bucket
.
getKeyAsString
());
emotionCount
(
result
,
bucket
.
getDocCount
(),
list
);
emotionCount
(
result
,
bucket
.
getDocCount
(),
list
);
R
esultList
.
add
(
result
);
r
esultList
.
add
(
result
);
});
});
return
R
esultList
;
return
r
esultList
;
}
}
/**
/**
...
@@ -661,12 +675,12 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -661,12 +675,12 @@ public class MarkDataServiceImpl implements IMarkDataService {
TermsAggregationBuilder
platformAggregationBuilder
=
AggregationBuilders
.
terms
(
"platform_count"
).
field
(
"platform_id.keyword"
).
order
(
BucketOrder
.
count
(
false
));
TermsAggregationBuilder
platformAggregationBuilder
=
AggregationBuilders
.
terms
(
"platform_count"
).
field
(
"platform_id.keyword"
).
order
(
BucketOrder
.
count
(
false
));
TermsAggregationBuilder
emotionAggregationBuilder
=
AggregationBuilders
.
terms
(
"emotion_count"
).
field
(
"mark_cache_maps.name.keyword"
);
TermsAggregationBuilder
emotionAggregationBuilder
=
AggregationBuilders
.
terms
(
"emotion_count"
).
field
(
"mark_cache_maps.name.keyword"
);
// postFilter
// postFilter
BoolQueryBuilder
postFilter
=
projectLinkedGroupQuery
(
projectId
,
linkedGroupId
);
BoolQueryBuilder
query
=
projectLinkedGroupQuery
(
projectId
,
linkedGroupId
);
// time
// time
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
query
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
// 情感倾向限制
// 情感倾向限制
postFilter
.
must
(
QueryBuilders
.
termQuery
(
"mark_cache_maps.group_name.keyword"
,
"情感倾向"
));
query
.
must
(
QueryBuilders
.
termQuery
(
"mark_cache_maps.group_name.keyword"
,
"情感倾向"
));
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
postFilter
,
null
,
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
platformAggregationBuilder
.
subAggregation
(
emotionAggregationBuilder
),
null
,
null
,
0
,
0
,
null
);
platformAggregationBuilder
.
subAggregation
(
emotionAggregationBuilder
),
null
,
null
,
0
,
0
,
null
);
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"platform_count"
);
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"platform_count"
);
...
@@ -684,6 +698,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -684,6 +698,7 @@ public class MarkDataServiceImpl implements IMarkDataService {
}
}
private
void
emotionCount
(
JSONObject
result
,
long
total
,
List
<?
extends
Terms
.
Bucket
>
list
)
{
private
void
emotionCount
(
JSONObject
result
,
long
total
,
List
<?
extends
Terms
.
Bucket
>
list
)
{
result
.
put
(
"total"
,
total
);
result
.
put
(
EmotionEnum
.
POSITIVE
.
getName
(),
0
);
result
.
put
(
EmotionEnum
.
POSITIVE
.
getName
(),
0
);
result
.
put
(
EmotionEnum
.
NEUTRAL
.
getName
(),
0
);
result
.
put
(
EmotionEnum
.
NEUTRAL
.
getName
(),
0
);
result
.
put
(
EmotionEnum
.
NEGATIVE
.
getName
(),
0
);
result
.
put
(
EmotionEnum
.
NEGATIVE
.
getName
(),
0
);
...
@@ -702,14 +717,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -702,14 +717,15 @@ public class MarkDataServiceImpl implements IMarkDataService {
private
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
linkedGroupId
,
boolean
cache
)
throws
IOException
{
private
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
linkedGroupId
,
boolean
cache
)
throws
IOException
{
String
redisKey
=
RedisKeyPrefix
.
MARK_PLATFORM_PROPORTION
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
redisKey
=
RedisKeyPrefix
.
MARK_PLATFORM_PROPORTION
+
Tools
.
concat
(
projectId
,
startTime
,
endTime
);
String
resultStr
;
String
resultStr
;
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
stringRedisTemplate
.
opsForValue
()
.
get
(
redisKey
)))
{
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
}
}
List
<
JSONObject
>
platformList
=
commonService
.
getQbjcPlatform
(
"id"
,
"name"
);
List
<
JSONObject
>
platformList
=
commonService
.
getQbjcPlatform
(
"id"
,
"name"
);
List
<
JSONObject
>
platformsCount
=
getPlatformsCount
(
startTime
,
endTime
,
null
,
null
,
projectId
,
linkedGroupId
,
platformList
);
List
<
JSONObject
>
platformsCount
=
getPlatformsCount
(
startTime
,
endTime
,
null
,
null
,
projectId
,
linkedGroupId
,
platformList
);
long
articlesCount
=
platformsCount
.
stream
().
mapToLong
(
platform
->
platform
.
getLongValue
(
"count"
)).
sum
();
long
articlesCount
=
platformsCount
.
stream
().
mapToLong
(
platform
->
platform
.
getLongValue
(
"count"
)).
sum
();
List
<
JSONObject
>
resultList
=
platformsCount
.
stream
().
peek
(
platform
->
platform
.
put
(
"proportion"
,
platform
.
getLongValue
(
"count"
)
*
1.0
/
articlesCount
)).
collect
(
Collectors
.
toList
());
List
<
JSONObject
>
resultList
=
platformsCount
.
stream
().
peek
(
platform
->
platform
.
put
(
"proportion"
,
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
resultList
),
1
,
TimeUnit
.
HOURS
);
0
==
articlesCount
?
0
:
platform
.
getLongValue
(
"count"
)
*
1.0
/
articlesCount
)).
collect
(
Collectors
.
toList
());
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
resultList
),
1
,
TimeUnit
.
HOURS
);
return
resultList
;
return
resultList
;
}
}
...
@@ -730,19 +746,16 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -730,19 +746,16 @@ public class MarkDataServiceImpl implements IMarkDataService {
// 聚合请求
// 聚合请求
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count"
).
field
(
"platform_id.keyword"
).
order
(
BucketOrder
.
count
(
false
)).
size
(
100
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count"
).
field
(
"platform_id.keyword"
).
order
(
BucketOrder
.
count
(
false
)).
size
(
100
);
// query
// query
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
(
);
BoolQueryBuilder
query
=
projectLinkedGroupQuery
(
projectId
,
linedGroupId
);
// keyword
// keyword
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
String
[]
fieldSearch
=
"标题"
.
equals
(
searchField
)
?
new
String
[]{
GenericAttribute
.
ES_IND_TITLE
}
:
new
String
[]{
GenericAttribute
.
ES_IND_FULL_TEXT
};
String
[]
fieldSearch
=
"标题"
.
equals
(
searchField
)
?
new
String
[]{
GenericAttribute
.
ES_IND_TITLE
}
:
new
String
[]{
GenericAttribute
.
ES_IND_FULL_TEXT
};
query
.
must
(
EsQueryTools
.
assembleNormalKeywordQuery
(
keyword
,
fieldSearch
));
query
.
must
(
EsQueryTools
.
assembleNormalKeywordQuery
(
keyword
,
fieldSearch
));
}
}
// postFilter
query
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
BoolQueryBuilder
postFilter
=
projectLinkedGroupQuery
(
projectId
,
linedGroupId
);
// time
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
List
<
JSONObject
>
platformResultList
=
new
ArrayList
<>(
platformList
.
size
());
List
<
JSONObject
>
platformResultList
=
new
ArrayList
<>(
platformList
.
size
());
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
postFilter
,
query
,
aggregationBuilder
,
null
,
null
,
0
,
0
,
null
);
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
aggregationBuilder
,
null
,
null
,
0
,
0
,
null
);
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"count"
);
ParsedStringTerms
teamAgg
=
(
ParsedStringTerms
)
aggMap
.
get
(
"count"
);
List
<?
extends
Terms
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
List
<?
extends
Terms
.
Bucket
>
buckets
=
teamAgg
.
getBuckets
();
...
@@ -779,7 +792,6 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -779,7 +792,6 @@ public class MarkDataServiceImpl implements IMarkDataService {
BoolQueryBuilder
postFilter
=
projectLinkedGroupQuery
(
projectId
,
linkedGroupId
);
BoolQueryBuilder
postFilter
=
projectLinkedGroupQuery
(
projectId
,
linkedGroupId
);
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
searchHelper
.
setPostFilter
(
postFilter
);
searchHelper
.
setPostFilter
(
postFilter
);
// TODO 临时添加
searchHelper
.
setSize
(
10000
);
searchHelper
.
setSize
(
10000
);
List
<
String
>
textList
=
new
ArrayList
<>();
List
<
String
>
textList
=
new
ArrayList
<>();
List
<
SearchResponse
>
searchResponses
=
Collections
.
singletonList
(
esClientDao
.
searchResponse
(
searchHelper
));
List
<
SearchResponse
>
searchResponses
=
Collections
.
singletonList
(
esClientDao
.
searchResponse
(
searchHelper
));
...
@@ -799,4 +811,14 @@ public class MarkDataServiceImpl implements IMarkDataService {
...
@@ -799,4 +811,14 @@ public class MarkDataServiceImpl implements IMarkDataService {
return
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.projectId.keyword"
,
projectId
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.linkedGroupId.keyword"
,
linkedGroupId
));
return
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.projectId.keyword"
,
projectId
)).
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.linkedGroupId.keyword"
,
linkedGroupId
));
}
}
private
List
<
MarkFlowEntity
>
getMarkFlowEntity
(
MarkSearchDTO
markSearchDTO
,
SearchHits
searchHits
)
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
markSearchDTO
.
getLinkedGroupId
();
return
Arrays
.
stream
(
searchHits
.
getHits
()).
map
(
entity
->
{
MarkFlowEntity
instance
=
new
MarkFlowEntity
(
entity
);
instance
.
setInfo
(
markFlowService
.
createMarkFlowInfo
(
new
JSONObject
(
entity
.
getSourceAsMap
()),
projectId
,
linkedGroupId
));
return
instance
;
}).
collect
(
Collectors
.
toList
());
}
}
}
\ No newline at end of file
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.base.category.ClassD
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.ChannelTagDao
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.pojo.Channel
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.pojo.MarkFlowEntity
;
import
com.zhiwei.brandkbs2.service.MarkFlowService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
/**
* @ClassName: MarkFlowServiceImpl
* @Description 标注消息流服务实现类
* @author: sjj
* @date: 2022-07-13 14:00
*/
@Service
(
"markFlowServiceImpl"
)
public
class
MarkFlowServiceImpl
implements
MarkFlowService
{
@Resource
(
name
=
"channelTagDao"
)
ChannelTagDao
channelTagDao
;
@Resource
(
name
=
"channelDao"
)
ChannelDao
channelDao
;
@Resource
(
name
=
"redisUtil"
)
RedisUtil
redisUtil
;
@Override
public
JSONObject
createMarkFlowInfo
(
JSONObject
json
,
String
projectId
,
String
linkedGroupId
)
{
JSONObject
resultInfo
=
createInfoWithEmotion
(
json
);
resultInfo
.
put
(
"sourceDetails"
,
getSourceDetails
(
json
,
projectId
,
linkedGroupId
));
return
resultInfo
;
}
@Override
public
String
setShotPage
(
String
markFlowEntity
)
{
MarkFlowEntity
data
=
JSON
.
parseObject
(
markFlowEntity
,
MarkFlowEntity
.
class
);
String
id
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
data
.
getData
())).
getString
(
"id"
);
String
key
=
RedisUtil
.
getShotPageKey
(
id
,
UserThreadLocal
.
getProjectId
());
redisUtil
.
setExpire
(
key
,
markFlowEntity
);
return
id
;
}
@Override
public
MarkFlowEntity
getShotPageFromCache
(
String
id
)
{
String
key
=
RedisUtil
.
getShotPageKey
(
id
,
UserThreadLocal
.
getProjectId
());
String
data
=
redisUtil
.
get
(
key
);
if
(
null
==
data
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"缓存不存在或已过期"
));
}
return
JSON
.
parseObject
(
data
,
MarkFlowEntity
.
class
);
// JSONObject dataJson = JSON.parseObject(data);
// FilterInfo filterInfo = null;
// JSONObject filterInfoJson = dataJson.getJSONObject("filterInfo");
// if (Objects.nonNull(filterInfoJson) && filterInfoJson.containsKey("selectType")
// && filterInfoJson.containsKey("filterMap")) {
// SelectType selectType = SelectType.valueOf(filterInfoJson.getString("selectType"));
// JSONObject filterMap = filterInfoJson.getJSONObject("filterMap");
// // 2020/5/27 15:17 论坛回答部分特殊去重解析
// if (SelectType.SPEC_FORUM_CONTENT_MARK == selectType) {
// filterInfo = FilterInfo.getInstanceWithNoTime(selectType,
// requireNonNull(filterMap.getString("url"), "url 为空"),
// requireNonNull(filterMap.getString("text"), "text 为空"),
// requireNonNull(filterMap.getString("spareText"), "spareText 为空"),
// requireNonNull(filterMap.getString("source"), "source 为空"), filterMap.getString("mgroup"));
// } else {
// filterInfo = new FilterInfo(selectType, requireNonNull(filterMap.getString("unique"), "unique 为空"),
// requireNonNull(filterMap.getString("url"), "url 为空"),
// requireNonNull(filterMap.getLong("time"), "time 为空"),
// requireNonNull(filterMap.getString("text"), "text 为空"),
// requireNonNull(filterMap.getString("source"), "source 为空"), filterMap.getString("mgroup"));
// }
// }
}
private
JSONObject
createInfoWithEmotion
(
JSONObject
json
)
{
JSONObject
info
=
new
JSONObject
();
String
emotion
=
Tools
.
getEmotion
(
json
);
// tag
if
(
null
==
emotion
)
{
info
.
put
(
"hasTag"
,
false
);
}
else
{
info
.
put
(
"hasTag"
,
true
);
// 敏感算作负面
info
.
put
(
"showEmotion"
,
Constant
.
EMOTION_SENSITIVE
.
equals
(
emotion
)
?
Constant
.
EMOTION_NEGATIVE
:
emotion
);
}
return
info
;
}
private
JSONObject
getSourceDetails
(
JSONObject
tJson
,
String
projectId
,
String
linkedGroupId
)
{
JSONObject
sourceDetails
=
new
JSONObject
();
String
source
=
tJson
.
getString
(
GenericAttribute
.
ES_SOURCE
);
// 是否原创
if
(
tJson
.
containsKey
(
GenericAttribute
.
ES_ROOT_SOURCE
)
&&
isOrigin
(
source
,
tJson
.
getString
(
GenericAttribute
.
ES_ROOT_SOURCE
)))
{
sourceDetails
.
put
(
"rootPublish"
,
"原创"
);
}
// C4,realSource提取展示
sourceDetails
.
put
(
"clientFrom"
,
getClientFrom
(
tJson
.
getIntValue
(
GenericAttribute
.
ES_C4
),
tJson
.
getString
(
GenericAttribute
.
ES_REAL_SOURCE
)));
// source
sourceDetails
.
put
(
"source"
,
source
);
// 粉丝量提取
Long
followersNum
=
tJson
.
getLongValue
(
GenericAttribute
.
ES_FOLLOWERS_NUM
);
sourceDetails
.
put
(
"followersNum"
,
followersNum
);
// 渠道标签
sourceDetails
.
put
(
"channelTag"
,
channelTagDao
.
getTagByChannelName
(
source
));
// 渠道倾向及id
Channel
channel
=
channelDao
.
queryUnique
(
ChannelIndex
.
createChannelIndex
(
tJson
,
projectId
,
linkedGroupId
));
if
(
null
!=
channel
)
{
sourceDetails
.
put
(
"channelId"
,
channel
.
getId
());
sourceDetails
.
put
(
"channelEmotion"
,
channel
.
getEmotion
());
}
else
{
sourceDetails
.
put
(
"channelId"
,
null
);
sourceDetails
.
put
(
"channelEmotion"
,
null
);
}
return
sourceDetails
;
}
/**
* 按c4、origin获取ClientFrom
*
* @param c4
* @param realSource
* @return String
*/
public
String
getClientFrom
(
int
c4
,
String
realSource
)
{
if
(
Tools
.
isEmpty
(
realSource
))
{
return
ClassD
.
TypeD
.
fromEncode
(
c4
).
title
();
}
else
{
return
realSource
;
}
}
/**
* 网媒来源是否原创
*
* @param source
* @param rootSource
* @return boolean
*/
public
boolean
isOrigin
(
String
source
,
String
rootSource
)
{
// 条件一 泛用
return
rootSource
.
contains
(
source
)
||
source
.
contains
(
rootSource
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
View file @
d6139789
...
@@ -2,8 +2,8 @@ package com.zhiwei.brandkbs2.service.impl;
...
@@ -2,8 +2,8 @@ package com.zhiwei.brandkbs2.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.
I
ProjectDao
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.
I
UserDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.enmus.response.ProjectCodeEnum
;
import
com.zhiwei.brandkbs2.enmus.response.ProjectCodeEnum
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
...
@@ -13,10 +13,11 @@ import com.zhiwei.brandkbs2.pojo.Project;
...
@@ -13,10 +13,11 @@ import com.zhiwei.brandkbs2.pojo.Project;
import
com.zhiwei.brandkbs2.pojo.User
;
import
com.zhiwei.brandkbs2.pojo.User
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.
I
ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -32,13 +33,13 @@ import java.util.stream.Collectors;
...
@@ -32,13 +33,13 @@ import java.util.stream.Collectors;
* @date 2022年4月18日16:49:10
* @date 2022年4月18日16:49:10
*/
*/
@Service
(
"projectServiceImpl"
)
@Service
(
"projectServiceImpl"
)
public
class
ProjectServiceImpl
implements
I
ProjectService
{
public
class
ProjectServiceImpl
implements
ProjectService
{
@Resource
(
name
=
"userDao"
)
@Resource
(
name
=
"userDao"
)
private
I
UserDao
userDao
;
private
UserDao
userDao
;
@Resource
(
name
=
"projectDao"
)
@Resource
(
name
=
"projectDao"
)
private
I
ProjectDao
projectDao
;
private
ProjectDao
projectDao
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
...
@@ -62,7 +63,7 @@ public class ProjectServiceImpl implements IProjectService {
...
@@ -62,7 +63,7 @@ public class ProjectServiceImpl implements IProjectService {
}
}
//给超管添加该项目权限,并且初始化预警推送 TODO
//给超管添加该项目权限,并且初始化预警推送 TODO
// for (Integer SUPER_ADMINUid : userMapper.getAllSUPER_ADMINUids()) {
// for (Integer SUPER_ADMINUid : userMapper.getAllSUPER_ADMINUids()) {
//
i
UserService.insertAdminRoleAndWarn(SUPER_ADMINUid, project.getId());
// UserService.insertAdminRoleAndWarn(SUPER_ADMINUid, project.getId());
// }
// }
projectDao
.
insertOneWithoutId
(
projectVO
.
creatProject
(
new
Date
()));
projectDao
.
insertOneWithoutId
(
projectVO
.
creatProject
(
new
Date
()));
}
}
...
@@ -218,6 +219,11 @@ public class ProjectServiceImpl implements IProjectService {
...
@@ -218,6 +219,11 @@ public class ProjectServiceImpl implements IProjectService {
return
null
;
return
null
;
}
}
@Override
public
List
<
Project
>
getAllProjectsWithStart
()
{
return
projectDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"isStart"
).
is
(
true
)));
}
// public JSONObject getUserInfoAndProjectConfig(User user) {
// public JSONObject getUserInfoAndProjectConfig(User user) {
// long start = System.currentTimeMillis();
// long start = System.currentTimeMillis();
// JSONObject result = new JSONObject();
// JSONObject result = new JSONObject();
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.IReportDao
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.dao.IReportSettingsDao
;
import
com.zhiwei.brandkbs2.dao.ReportDao
;
import
com.zhiwei.brandkbs2.dao.ReportSettingsDao
;
import
com.zhiwei.brandkbs2.enmus.ReportTypeEnum
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.Report
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSettingsDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSettingsDTO
;
import
com.zhiwei.brandkbs2.service.IProjectService
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.IReportService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ReportService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
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.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
zhiwei
.
brandkbs2
.
config
.
Constant
.
HOUR_FORMAT
;
/**
/**
* @ClassName: ReportServiceImpl
* @ClassName: ReportServiceImpl
* @Description 报告业务接口实现类
* @Description 报告业务接口实现类
...
@@ -31,24 +48,33 @@ import java.util.stream.Collectors;
...
@@ -31,24 +48,33 @@ import java.util.stream.Collectors;
* @date: 2022-05-31 18:01
* @date: 2022-05-31 18:01
*/
*/
@Service
(
"reportServiceImpl"
)
@Service
(
"reportServiceImpl"
)
public
class
ReportServiceImpl
implements
I
ReportService
{
public
class
ReportServiceImpl
implements
ReportService
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
ReportServiceImpl
.
class
);
public
static
final
Logger
log
=
LogManager
.
getLogger
(
ReportServiceImpl
.
class
);
@Resource
(
name
=
"reportDao"
)
@Resource
(
name
=
"reportDao"
)
I
ReportDao
reportDao
;
ReportDao
reportDao
;
@Resource
(
name
=
"reportSettingsDao"
)
@Resource
(
name
=
"reportSettingsDao"
)
I
ReportSettingsDao
reportSettingsDao
;
ReportSettingsDao
reportSettingsDao
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
IProjectService
projectService
;
ProjectService
projectService
;
@Resource
(
name
=
"mongoUtil"
)
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
@Resource
(
name
=
"redisUtil"
)
RedisUtil
redisUtil
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Override
@Override
public
Map
<
String
,
ReportSettingsDTO
>
getReportSettings
()
{
public
Map
<
String
,
ReportSettingsDTO
>
getReportSettings
()
{
Map
<
String
,
ReportSettingsDTO
>
res
=
new
HashMap
<>();
Map
<
String
,
ReportSettingsDTO
>
res
=
new
HashMap
<>();
for
(
ReportSettings
settings
:
getReportSettingsList
())
{
for
(
ReportSettings
settings
:
getReportSettingsList
())
{
String
key
=
"week"
;
String
key
=
"week"
;
if
(
"月报"
.
equals
(
settings
.
getType
()))
{
if
(
ReportTypeEnum
.
MONTH
.
getState
()
.
equals
(
settings
.
getType
()))
{
key
=
"month"
;
key
=
"month"
;
}
}
ReportSettingsDTO
reportSettingsDTO
=
ReportSettingsDTO
.
createFromReportSettings
(
settings
);
ReportSettingsDTO
reportSettingsDTO
=
ReportSettingsDTO
.
createFromReportSettings
(
settings
);
...
@@ -61,6 +87,12 @@ public class ReportServiceImpl implements IReportService {
...
@@ -61,6 +87,12 @@ public class ReportServiceImpl implements IReportService {
}
}
@Override
@Override
public
List
<
Report
>
getCustomReportByStatus
(
String
projectId
,
boolean
status
)
{
Criteria
criteria
=
Criteria
.
where
(
"projectId"
).
is
(
projectId
).
and
(
"status"
).
is
(
status
).
is
(
"type"
).
is
(
ReportTypeEnum
.
CUSTOM
.
getState
());
return
reportDao
.
findList
(
Query
.
query
(
criteria
));
}
@Override
public
void
upsertReportSettings
(
ReportSettingsDTO
reportSettingsDTO
)
{
public
void
upsertReportSettings
(
ReportSettingsDTO
reportSettingsDTO
)
{
ReportSettings
reportSettings
=
ReportSettings
.
createFromReportSettingsDTO
(
reportSettingsDTO
,
UserThreadLocal
.
getProjectId
());
ReportSettings
reportSettings
=
ReportSettings
.
createFromReportSettingsDTO
(
reportSettingsDTO
,
UserThreadLocal
.
getProjectId
());
String
type
=
reportSettings
.
getType
();
String
type
=
reportSettings
.
getType
();
...
@@ -78,13 +110,193 @@ public class ReportServiceImpl implements IReportService {
...
@@ -78,13 +110,193 @@ public class ReportServiceImpl implements IReportService {
}
}
@Override
@Override
public
void
switchReportSettingsUsed
(
String
id
,
boolean
used
)
{
reportSettingsDao
.
updateOneByIdWithField
(
id
,
Update
.
update
(
"used"
,
used
));
}
@Override
public
void
switchReportStatus
(
String
id
,
boolean
status
)
{
reportDao
.
updateOneByIdWithField
(
id
,
Update
.
update
(
"status"
,
status
));
}
@Override
public
JSONObject
getReportsAggCount
()
{
public
JSONObject
getReportsAggCount
()
{
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
// result.put("types", getReportTypeAggCount(pid, uid));
List
<
JSONObject
>
reportAggCount
=
reportDao
.
getReportAggCount
(
UserThreadLocal
.
getProjectId
());
// result.put("times", getTimeAggCount(pid, uid));
result
.
put
(
"times"
,
addYearTimeWithAggCount
(
filterAggCount
(
reportAggCount
,
"year"
,
"count"
)));
result
.
put
(
"types"
,
filterAggCount
(
reportAggCount
,
"type"
,
"count"
));
return
result
;
}
private
List
<
JSONObject
>
filterAggCount
(
List
<
JSONObject
>
list
,
String
groupName
,
String
countName
)
{
List
<
JSONObject
>
result
=
new
ArrayList
<>();
Map
<
String
,
JSONObject
>
map
=
new
HashMap
<>();
// Map<String, List<JSONObject>> collect = list.stream().collect(Collectors.groupingBy(json -> json.getString(groupName)));
Map
<
String
,
Integer
>
collect
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
json
->
json
.
getString
(
groupName
),
json
->
json
.
getInteger
(
countName
),
Integer:
:
sum
));
// collect.put("不限", collect.values().stream().mapToInt(v -> v).sum());
collect
.
forEach
((
type
,
count
)
->
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"name"
,
type
);
json
.
put
(
"count"
,
count
);
map
.
put
(
type
,
json
);
});
// 年份排序
if
(
"year"
.
equals
(
groupName
))
{
map
.
keySet
().
stream
().
sorted
((
k1
,
k2
)
->
Integer
.
parseInt
(
k1
)
-
Integer
.
parseInt
(
k2
)).
collect
(
Collectors
.
toList
()).
forEach
(
k
->
{
result
.
add
(
map
.
get
(
k
));
});
}
else
{
// 简报排序
ReportTypeEnum
.
SORT_LIST
.
forEach
(
sort
->
{
JSONObject
json
;
if
(
null
!=
(
json
=
map
.
get
(
sort
)))
{
result
.
add
(
json
);
}
});
}
JSONObject
all
=
new
JSONObject
();
all
.
put
(
"name"
,
"不限"
);
all
.
put
(
"count"
,
collect
.
values
().
stream
().
mapToInt
(
v
->
v
).
sum
());
result
.
add
(
0
,
all
);
return
result
;
}
private
List
<
JSONObject
>
addYearTimeWithAggCount
(
List
<
JSONObject
>
list
)
{
return
list
.
stream
().
peek
(
json
->
{
try
{
int
year
=
json
.
getIntValue
(
"name"
);
json
.
put
(
"startTime"
,
Tools
.
getYearFirst
(
year
));
json
.
put
(
"endTime"
,
Tools
.
getYearFirst
(
year
+
1
));
json
.
put
(
"name"
,
year
+
"年"
);
}
catch
(
Exception
ignored
)
{
}
}).
collect
(
Collectors
.
toList
());
}
@Override
public
Pair
<
Boolean
,
Report
>
generateReportBySettings
(
ReportSettings
reportSettings
,
AbstractProject
project
)
{
Report
report
=
Report
.
createFromReportSettings
(
reportSettings
,
project
);
// 用title用作唯一条件
Report
existReport
=
reportDao
.
findOne
(
"title"
,
report
.
getTitle
());
if
(
null
!=
existReport
)
{
return
Pair
.
of
(
false
,
existReport
);
}
reportDao
.
insertOneWithoutId
(
report
);
return
Pair
.
of
(
true
,
report
);
}
@Override
public
JSONObject
getPcReportAnalyze
(
String
id
,
boolean
cache
)
{
return
getPcReportAnalyze
(
reportDao
.
findOneById
(
id
),
cache
);
}
@Override
public
JSONObject
getPcReportAnalyze
(
Report
report
,
boolean
cache
)
{
if
(
Objects
.
isNull
(
report
))
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
.
message
(
"获取报告数据异常"
));
}
String
redisKey
=
RedisKeyPrefix
.
REPORT_PC
+
report
.
getId
();
String
resultStr
;
// 需要缓存且有缓存
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
stringRedisTemplate
.
opsForValue
().
get
(
redisKey
)))
{
return
JSON
.
parseObject
(
resultStr
);
}
// 结果立刻返回,后台任务缓存
if
(
cache
)
{
ApplicationProjectListener
.
getThreadPool
().
execute
(()
->
this
.
getPcReportAnalyze
(
report
,
false
));
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"title"
,
report
.
getTitle
());
result
.
put
(
"startTime"
,
report
.
getStartTime
());
result
.
put
(
"endTime"
,
report
.
getEndTime
());
result
.
put
(
"status"
,
false
);
return
result
;
}
JSONObject
result
=
getPcReportResult
(
report
);
stringRedisTemplate
.
opsForValue
().
set
(
redisKey
,
JSON
.
toJSONString
(
result
));
return
result
;
}
@Override
public
PageVO
<
JSONObject
>
findReportList
(
ReportSearchDTO
reportSearch
)
{
Query
query
=
new
Query
();
long
count
=
reportDao
.
count
(
query
,
reportSearch
.
getKeyword
(),
new
String
[]{
"title"
});
mongoUtil
.
start
(
reportSearch
.
getPage
(),
reportSearch
.
getPageSize
(),
query
);
// 添加排序
reportDao
.
addSort
(
query
,
reportSearch
.
getSorter
());
// query已添加模糊查询
List
<
Report
>
reportList
=
reportDao
.
findList
(
query
);
List
<
JSONObject
>
resList
=
reportList
.
stream
().
map
(
report
->
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"id"
,
report
.
getId
());
result
.
put
(
"status"
,
null
!=
redisUtil
.
get
(
RedisKeyPrefix
.
REPORT_PC
+
report
.
getId
()));
result
.
put
(
"title"
,
report
.
getTitle
());
result
.
put
(
"startTime"
,
report
.
getStartTime
());
result
.
put
(
"endTime"
,
report
.
getEndTime
());
result
.
put
(
"publishTime"
,
report
.
getPublishTime
());
result
.
put
(
"type"
,
report
.
getType
());
result
.
put
(
"enableDelete"
,
ReportTypeEnum
.
CUSTOM
.
getState
().
equals
(
report
.
getType
()));
return
result
;
}).
collect
(
Collectors
.
toList
());
MongoUtil
.
PageHelper
<
JSONObject
>
pageHelper
=
mongoUtil
.
pageHelper
(
count
,
resList
);
return
PageVO
.
createPageVo
(
pageHelper
,
resList
);
}
@Override
public
void
addCustomReport
(
ReportDTO
reportDTO
)
{
reportDao
.
insertOneWithoutId
(
Report
.
createFromReportDTO
(
reportDTO
));
}
@Override
public
void
deleteReportById
(
String
id
)
{
// 目前只能删除自定义简报
reportDao
.
deleteOneByIdWithQuery
(
id
,
Query
.
query
(
Criteria
.
where
(
"type"
).
is
(
ReportTypeEnum
.
CUSTOM
.
getState
())));
}
/**
* 获取PC端月报结果
*
* @param report 报告对象
* @return 月报结果
*/
private
JSONObject
getPcReportResult
(
Report
report
)
{
Long
startTime
=
report
.
getStartTime
();
Long
endTime
=
report
.
getEndTime
();
String
startTimeStr
=
HOUR_FORMAT
.
format
(
startTime
);
String
endTimeStr
=
HOUR_FORMAT
.
format
(
endTime
);
String
lastStartTimeStr
=
HOUR_FORMAT
.
format
(
startTime
-
(
endTime
-
startTime
));
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"title"
,
report
.
getTitle
());
result
.
put
(
"startTime"
,
startTime
);
result
.
put
(
"endTime"
,
endTime
);
result
.
put
(
"status"
,
true
);
result
.
put
(
"type"
,
ReportTypeEnum
.
getInstanceByState
(
report
.
getType
()).
getDescribe
());
// TODO
result
.
put
(
"todo"
,
"尚未完成"
);
return
result
;
return
result
;
}
}
/**
* 获取报告类型聚合结果
*
* @param pid 项目ID
* @param uid 用户ID
* @return 报告类型聚合结果
*/
private
List
<
JSONObject
>
getReportTypeAggCount
(
int
pid
,
int
uid
)
{
List
<
String
>
types
=
Arrays
.
stream
(
ReportTypeEnum
.
values
()).
map
(
ReportTypeEnum:
:
getState
).
collect
(
Collectors
.
toList
());
return
types
.
stream
()
.
map
(
type
->
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"type"
,
type
);
// result.put("count", reportDao.selectReportCountByTimeAndTypeAndProjectIdAndUserId(null, null, type, pid, uid));
return
result
;
})
.
filter
(
json
->
json
.
getIntValue
(
"count"
)
>
0
)
.
collect
(
Collectors
.
toList
());
}
private
List
<
ReportSettings
>
getReportSettingsList
()
{
private
List
<
ReportSettings
>
getReportSettingsList
()
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
projectId
=
UserThreadLocal
.
getProjectId
();
List
<
ReportSettings
>
reports
=
reportSettingsDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
)));
List
<
ReportSettings
>
reports
=
reportSettingsDao
.
findList
(
Query
.
query
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
)));
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/SystemInfoServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.dao.
I
QbjcPojoDao
;
import
com.zhiwei.brandkbs2.dao.QbjcPojoDao
;
import
com.zhiwei.brandkbs2.service.
I
SystemInfoService
;
import
com.zhiwei.brandkbs2.service.SystemInfoService
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -10,16 +10,16 @@ import javax.annotation.Resource;
...
@@ -10,16 +10,16 @@ import javax.annotation.Resource;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @ClassName:
I
SystemInfoServiceImpl
* @ClassName: SystemInfoServiceImpl
* @Description
I
SystemInfoServiceImpl
* @Description SystemInfoServiceImpl
* @author: sjj
* @author: sjj
* @date: 2022-06-16 14:21
* @date: 2022-06-16 14:21
*/
*/
@Service
(
"systemInfoServiceImpl"
)
@Service
(
"systemInfoServiceImpl"
)
public
class
SystemInfoServiceImpl
implements
I
SystemInfoService
{
public
class
SystemInfoServiceImpl
implements
SystemInfoService
{
@Resource
(
name
=
"qbjcPojoDao"
)
@Resource
(
name
=
"qbjcPojoDao"
)
private
I
QbjcPojoDao
qbjcPojoDao
;
private
QbjcPojoDao
qbjcPojoDao
;
@Override
@Override
public
List
<
MessagePlatform
>
getPlatforms
()
{
public
List
<
MessagePlatform
>
getPlatforms
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TagFilterServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.
I
TagFilterDao
;
import
com.zhiwei.brandkbs2.dao.TagFilterDao
;
import
com.zhiwei.brandkbs2.pojo.TagFilter
;
import
com.zhiwei.brandkbs2.pojo.TagFilter
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.TagFilterDTO
;
import
com.zhiwei.brandkbs2.service.
I
CommonService
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.
IProject
Service
;
import
com.zhiwei.brandkbs2.service.
TagFilter
Service
;
import
com.zhiwei.brandkbs2.service.
ITagFilter
Service
;
import
com.zhiwei.brandkbs2.service.
Project
Service
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -24,16 +23,16 @@ import java.util.stream.Collectors;
...
@@ -24,16 +23,16 @@ import java.util.stream.Collectors;
* @date: 2022-06-01 13:40
* @date: 2022-06-01 13:40
*/
*/
@Service
(
"tagFilterServiceImpl"
)
@Service
(
"tagFilterServiceImpl"
)
public
class
TagFilterServiceImpl
implements
I
TagFilterService
{
public
class
TagFilterServiceImpl
implements
TagFilterService
{
@Resource
(
name
=
"tagFilterDao"
)
@Resource
(
name
=
"tagFilterDao"
)
private
I
TagFilterDao
tagFilterDao
;
private
TagFilterDao
tagFilterDao
;
@Resource
(
name
=
"commonServiceImpl"
)
@Resource
(
name
=
"commonServiceImpl"
)
private
I
CommonService
commonService
;
private
CommonService
commonService
;
@Resource
(
name
=
"projectServiceImpl"
)
@Resource
(
name
=
"projectServiceImpl"
)
private
I
ProjectService
projectService
;
private
ProjectService
projectService
;
@Override
@Override
public
List
<
TagFilterDTO
>
getTagFilter
()
{
public
List
<
TagFilterDTO
>
getTagFilter
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.IBrandkbsTaskDao
;
import
com.zhiwei.brandkbs2.dao.BrandkbsTaskDao
;
import
com.zhiwei.brandkbs2.dao.IChannelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.IEventDataDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.dao.ReportSettingsDao
;
import
com.zhiwei.brandkbs2.enmus.ReportTypeEnum
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.pojo.BrandkbsTask
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.pojo.Channel
;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.service.BrandkbsTaskService
;
import
com.zhiwei.brandkbs2.service.ITaskService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ReportService
;
import
com.zhiwei.brandkbs2.service.TaskService
;
import
org.apache.commons.lang3.tuple.Pair
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.
Date
;
import
java.util.
ArrayList
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
/**
* @ClassName: TaskServiceImpl
* @ClassName: TaskServiceImpl
...
@@ -25,46 +34,119 @@ import java.util.Map;
...
@@ -25,46 +34,119 @@ import java.util.Map;
* @date: 2022-06-16 15:28
* @date: 2022-06-16 15:28
*/
*/
@Service
(
"taskServiceImpl"
)
@Service
(
"taskServiceImpl"
)
public
class
TaskServiceImpl
implements
I
TaskService
{
public
class
TaskServiceImpl
implements
TaskService
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
TaskServiceImpl
.
class
);
public
static
final
Logger
log
=
LogManager
.
getLogger
(
TaskServiceImpl
.
class
);
@Resource
(
name
=
"esClientDao"
)
@Resource
(
name
=
"esClientDao"
)
EsClientDao
esClientDao
;
EsClientDao
esClientDao
;
@Resource
(
name
=
"channelDao"
)
@Resource
(
name
=
"channelDao"
)
I
ChannelDao
channelDao
;
ChannelDao
channelDao
;
@Resource
(
name
=
"eventDataDao"
)
@Resource
(
name
=
"eventDataDao"
)
I
EventDataDao
eventDataDao
;
EventDataDao
eventDataDao
;
@Resource
(
name
=
"brandkbsTaskDao"
)
@Resource
(
name
=
"brandkbsTaskDao"
)
IBrandkbsTaskDao
brandkbsTaskDao
;
BrandkbsTaskDao
brandkbsTaskDao
;
@Resource
(
name
=
"reportSettingsDao"
)
ReportSettingsDao
reportSettingsDao
;
@Resource
(
name
=
"brandkbsTaskServiceImpl"
)
BrandkbsTaskService
brandkbsTaskService
;
@Resource
(
name
=
"projectServiceImpl"
)
ProjectService
projectService
;
@Resource
(
name
=
"reportServiceImpl"
)
ReportService
reportService
;
@Override
@Override
public
void
messageFlowCount
(
int
day
)
{
public
void
messageFlowCount
(
int
day
)
{
Map
<
ChannelIndex
,
ChannelIndex
.
ChannelRecord
>
channelIndexChannelRecordMap
=
esClientDao
.
searchChannelRecordRecentDay
(
day
);
Map
<
ChannelIndex
,
ChannelIndex
.
ChannelRecord
>
channelIndexChannelRecordMap
=
esClientDao
.
searchChannelRecordRecentDay
(
day
);
log
.
info
(
"渠道信息记录-搜索到近{}天的记录条数{}条"
,
day
,
channelIndexChannelRecordMap
.
size
());
log
.
info
(
"渠道信息记录-搜索到近{}天的记录条数{}条"
,
day
,
channelIndexChannelRecordMap
.
size
());
int
insertCount
=
0
;
List
<
Channel
>
insertList
=
new
ArrayList
<>()
;
for
(
Map
.
Entry
<
ChannelIndex
,
ChannelIndex
.
ChannelRecord
>
entry
:
channelIndexChannelRecordMap
.
entrySet
())
{
for
(
Map
.
Entry
<
ChannelIndex
,
ChannelIndex
.
ChannelRecord
>
entry
:
channelIndexChannelRecordMap
.
entrySet
())
{
// 是否已存在
// 是否已存在
Channel
channel
=
channelDao
.
queryUnique
(
entry
.
getKey
());
Channel
channel
=
channelDao
.
queryUnique
(
entry
.
getKey
());
if
(
null
==
channel
)
{
if
(
null
==
channel
)
{
channel
=
Channel
.
createFromChannelIndexRecord
(
entry
.
getKey
(),
entry
.
getValue
());
channel
=
Channel
.
createFromChannelIndexRecord
(
entry
.
getKey
(),
entry
.
getValue
());
channel
.
setEventIds
(
new
LinkedHashSet
<>(
eventDataDao
.
getEventCount
(
entry
.
getKey
())));
channel
.
setEventIds
(
new
LinkedHashSet
<>(
eventDataDao
.
getEventCount
(
entry
.
getKey
())));
insertList
.
add
(
channel
);
channelDao
.
insertOne
(
channel
);
channelDao
.
insertOne
(
channel
);
insertCount
++;
}
else
{
}
else
{
channel
.
setEventIds
(
new
LinkedHashSet
<>(
eventDataDao
.
getEventCount
(
entry
.
getKey
())));
channel
.
setEventIds
(
new
LinkedHashSet
<>(
eventDataDao
.
getEventCount
(
entry
.
getKey
())));
channel
.
setChannelRecord
(
entry
.
getValue
());
channel
.
setChannelRecord
(
entry
.
getValue
());
channelDao
.
updateOne
(
channel
);
channelDao
.
updateOne
(
channel
);
}
}
}
}
log
.
info
(
"渠道信息记录-录入完毕,新增渠道{}条,更新渠道{}条"
,
insertCount
,
channelIndexChannelRecordMap
.
size
()
-
insertCount
);
// ListUtils.partition(insertList, 1000).forEach(list -> {
// channelDao.insertMany(list);
// });
log
.
info
(
"渠道信息记录-录入完毕,新增渠道{}条,更新渠道{}条"
,
insertList
.
size
(),
channelIndexChannelRecordMap
.
size
()
-
insertList
.
size
());
}
}
@Override
@Override
public
void
reportSend
()
{
public
void
generateReportAndSend
()
{
Date
now
=
new
Date
();
long
now
=
System
.
currentTimeMillis
();
BrandkbsTask
task
=
brandkbsTaskDao
.
findTaskByTaskNameAndVersion
(
Constant
.
TASK_REPORT_JOB
,
Constant
.
INIT_VERSION
);
BrandkbsTask
task
=
null
;
boolean
getTask
=
false
;
try
{
task
=
brandkbsTaskDao
.
findTaskByTaskNameAndVersion
(
Constant
.
TASK_REPORT_JOB
,
Constant
.
INIT_VERSION
);
if
(!(
getTask
=
brandkbsTaskService
.
getTaskJob
(
task
,
now
)))
{
return
;
}
log
.
info
(
"执行task:{}"
,
task
.
getTaskName
());
List
<
CompletableFuture
<
Boolean
>>
futures
=
new
ArrayList
<>();
for
(
Project
project
:
projectService
.
getAllProjectsWithStart
())
{
ThreadPoolExecutor
threadPool
=
ApplicationProjectListener
.
getThreadPool
();
futures
.
add
(
CompletableFuture
.
supplyAsync
(()
->
reportSendByProject
(
project
),
threadPool
));
}
AtomicInteger
valid
=
new
AtomicInteger
();
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
])).
whenComplete
((
v
,
e
)
->
{
if
(
null
!=
e
)
{
log
.
error
(
"reportSendByProject-"
,
e
);
}
futures
.
forEach
(
f
->
{
if
(
Boolean
.
TRUE
.
equals
(
f
.
join
()))
{
valid
.
getAndIncrement
();
}
});
}).
join
();
log
.
info
(
"结束task:{},本次执行有效任务数:{}"
,
task
.
getTaskName
(),
valid
.
get
());
}
finally
{
if
(
getTask
)
{
//重置定时任务表
brandkbsTaskService
.
resetTask
(
task
,
now
);
log
.
info
(
"重置task:{}"
,
task
.
getTaskName
());
}
}
}
}
private
boolean
reportSendByProject
(
Project
project
)
{
boolean
flag
=
false
;
// 扫描setting信息
for
(
ReportSettings
reportSettings
:
reportSettingsDao
.
getReportSettingByProjectWithUsed
(
project
.
getId
()))
{
ReportTypeEnum
reportType
=
ReportTypeEnum
.
getInstanceByState
(
reportSettings
.
getType
());
if
(
ReportTypeEnum
.
canPublishNow
(
reportType
))
{
Pair
<
Boolean
,
Report
>
booleanReportPair
=
reportService
.
generateReportBySettings
(
reportSettings
,
project
);
// 生成新的简报之后的处理
if
(
booleanReportPair
.
getLeft
())
{
Report
report
=
booleanReportPair
.
getRight
();
// 用作生成缓存
reportService
.
getPcReportAnalyze
(
report
.
getId
(),
false
);
reportService
.
switchReportStatus
(
report
.
getId
(),
true
);
}
flag
=
true
;
}
}
// 自定义简报不通过setting生效
for
(
Report
report
:
reportService
.
getCustomReportByStatus
(
project
.
getId
(),
false
))
{
// 用作生成缓存
reportService
.
getPcReportAnalyze
(
report
.
getId
(),
false
);
reportService
.
switchReportStatus
(
report
.
getId
(),
true
);
}
return
flag
;
}
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
View file @
d6139789
...
@@ -2,8 +2,8 @@ package com.zhiwei.brandkbs2.service.impl;
...
@@ -2,8 +2,8 @@ package com.zhiwei.brandkbs2.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.dao.
I
ProjectDao
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.
I
UserDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.dao.impl.UserOldDaoImpl
;
import
com.zhiwei.brandkbs2.dao.impl.UserOldDaoImpl
;
import
com.zhiwei.brandkbs2.dao.impl.UserProjectOldDaoImpl
;
import
com.zhiwei.brandkbs2.dao.impl.UserProjectOldDaoImpl
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
...
@@ -14,7 +14,7 @@ import com.zhiwei.brandkbs2.pojo.UserInfo;
...
@@ -14,7 +14,7 @@ import com.zhiwei.brandkbs2.pojo.UserInfo;
import
com.zhiwei.brandkbs2.pojo.UserRole
;
import
com.zhiwei.brandkbs2.pojo.UserRole
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.
I
UserService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -36,10 +36,10 @@ import java.util.stream.Collectors;
...
@@ -36,10 +36,10 @@ import java.util.stream.Collectors;
* @date: 2022-04-28 17:34
* @date: 2022-04-28 17:34
*/
*/
@Service
(
"userServiceImpl"
)
@Service
(
"userServiceImpl"
)
public
class
UserServiceImpl
implements
I
UserService
{
public
class
UserServiceImpl
implements
UserService
{
@Resource
(
name
=
"userDao"
)
@Resource
(
name
=
"userDao"
)
private
I
UserDao
userDao
;
private
UserDao
userDao
;
@Resource
(
name
=
"userProjectOldDao"
)
@Resource
(
name
=
"userProjectOldDao"
)
private
UserProjectOldDaoImpl
userProjectOldDao
;
private
UserProjectOldDaoImpl
userProjectOldDao
;
...
@@ -48,7 +48,7 @@ public class UserServiceImpl implements IUserService {
...
@@ -48,7 +48,7 @@ public class UserServiceImpl implements IUserService {
private
UserOldDaoImpl
userOldDao
;
private
UserOldDaoImpl
userOldDao
;
@Resource
(
name
=
"projectDao"
)
@Resource
(
name
=
"projectDao"
)
private
I
ProjectDao
projectDao
;
private
ProjectDao
projectDao
;
@Resource
(
name
=
"mongoUtil"
)
@Resource
(
name
=
"mongoUtil"
)
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
private
com
.
zhiwei
.
brandkbs2
.
util
.
MongoUtil
mongoUtil
;
...
...
src/main/java/com/zhiwei/brandkbs2/task/ControlCenter.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
task
;
package
com
.
zhiwei
.
brandkbs2
.
task
;
import
com.zhiwei.brandkbs2.service.
I
TaskService
;
import
com.zhiwei.brandkbs2.service.TaskService
;
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.context.annotation.Profile
;
import
org.springframework.context.annotation.Profile
;
...
@@ -22,7 +22,7 @@ public class ControlCenter {
...
@@ -22,7 +22,7 @@ public class ControlCenter {
public
static
final
Logger
log
=
LogManager
.
getLogger
(
ControlCenter
.
class
);
public
static
final
Logger
log
=
LogManager
.
getLogger
(
ControlCenter
.
class
);
@Resource
(
name
=
"taskServiceImpl"
)
@Resource
(
name
=
"taskServiceImpl"
)
private
I
TaskService
taskService
;
private
TaskService
taskService
;
@Async
(
"scheduledExecutor"
)
@Async
(
"scheduledExecutor"
)
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
...
@@ -39,10 +39,10 @@ public class ControlCenter {
...
@@ -39,10 +39,10 @@ public class ControlCenter {
@Async
(
"scheduledExecutor"
)
@Async
(
"scheduledExecutor"
)
@Scheduled
(
cron
=
"0 0 * * * ? "
)
@Scheduled
(
cron
=
"0 0 * * * ? "
)
public
void
repo
stSend
()
{
public
void
repo
rtScanning
()
{
log
.
info
(
"每小时扫描简报信息-启动"
);
log
.
info
(
"每小时扫描简报信息-启动"
);
try
{
try
{
taskService
.
report
Send
();
taskService
.
generateReportAnd
Send
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"每小时扫描简报信息-出错"
,
e
);
log
.
info
(
"每小时扫描简报信息-出错"
,
e
);
}
finally
{
}
finally
{
...
...
src/main/java/com/zhiwei/brandkbs2/util/FlowEntityUtil.java
View file @
d6139789
...
@@ -2,10 +2,10 @@ package com.zhiwei.brandkbs2.util;
...
@@ -2,10 +2,10 @@ package com.zhiwei.brandkbs2.util;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.base.category.ClassB
;
import
com.zhiwei.base.category.ClassB
;
import
com.zhiwei.base.entity.subclass.
CompleteText
;
import
com.zhiwei.base.entity.subclass.
mark.CompleteTextMark
;
import
com.zhiwei.base.entity.subclass.
IncompleteText
;
import
com.zhiwei.base.entity.subclass.
mark.IncompleteTextMark
;
import
com.zhiwei.base.entity.subclass.
QAText
;
import
com.zhiwei.base.entity.subclass.
mark.QATextMark
;
import
com.zhiwei.base.entity.subclass.
Video
;
import
com.zhiwei.base.entity.subclass.
mark.VideoMark
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
/**
/**
...
@@ -15,14 +15,14 @@ import com.zhiwei.brandkbs2.common.GenericAttribute;
...
@@ -15,14 +15,14 @@ import com.zhiwei.brandkbs2.common.GenericAttribute;
*/
*/
public
class
FlowEntityUtil
{
public
class
FlowEntityUtil
{
public
static
JSONObject
getVideoType
(
Video
info
)
{
public
static
JSONObject
getVideoType
(
Video
Mark
info
)
{
JSONObject
type
=
new
JSONObject
();
JSONObject
type
=
new
JSONObject
();
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"fold"
,
false
);
type
.
put
(
"fold"
,
false
);
return
type
;
return
type
;
}
}
public
static
JSONObject
getQaTextType
(
QAText
info
)
{
public
static
JSONObject
getQaTextType
(
QAText
Mark
info
)
{
JSONObject
type
=
new
JSONObject
();
JSONObject
type
=
new
JSONObject
();
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"question"
,
info
.
question
());
type
.
put
(
"question"
,
info
.
question
());
...
@@ -30,14 +30,14 @@ public class FlowEntityUtil {
...
@@ -30,14 +30,14 @@ public class FlowEntityUtil {
return
type
;
return
type
;
}
}
public
static
JSONObject
getCompleteTextType
(
CompleteText
info
)
{
public
static
JSONObject
getCompleteTextType
(
CompleteText
Mark
info
)
{
JSONObject
type
=
new
JSONObject
();
JSONObject
type
=
new
JSONObject
();
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"fold"
,
false
);
type
.
put
(
"fold"
,
false
);
return
type
;
return
type
;
}
}
public
static
JSONObject
getIncompleteTextType
(
IncompleteText
info
)
{
public
static
JSONObject
getIncompleteTextType
(
IncompleteText
Mark
info
)
{
JSONObject
type
=
new
JSONObject
();
JSONObject
type
=
new
JSONObject
();
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"type"
,
getType
(
info
.
getC2
()));
type
.
put
(
"forward"
,
info
.
getIsForward
());
type
.
put
(
"forward"
,
info
.
getIsForward
());
...
@@ -66,16 +66,16 @@ public class FlowEntityUtil {
...
@@ -66,16 +66,16 @@ public class FlowEntityUtil {
int
c2
=
msgJson
.
getIntValue
(
GenericAttribute
.
ES_C2
);
int
c2
=
msgJson
.
getIntValue
(
GenericAttribute
.
ES_C2
);
switch
(
ClassB
.
TypeB
.
fromEncode
(
c2
))
{
switch
(
ClassB
.
TypeB
.
fromEncode
(
c2
))
{
case
COMPLETE:
case
COMPLETE:
CompleteText
completeText
=
CompleteText
.
restoreFromEs
(
msgJson
);
CompleteText
Mark
completeText
=
CompleteTextMark
.
restoreFromEs
(
msgJson
);
return
getCompleteTextType
(
completeText
);
return
getCompleteTextType
(
completeText
);
case
INCOMPLETE:
case
INCOMPLETE:
IncompleteText
incompleteText
=
IncompleteText
.
restoreFromEs
(
msgJson
);
IncompleteText
Mark
incompleteText
=
IncompleteTextMark
.
restoreFromEs
(
msgJson
);
return
getIncompleteTextType
(
incompleteText
);
return
getIncompleteTextType
(
incompleteText
);
case
QA:
case
QA:
QAText
qaText
=
QAText
.
restoreFromEs
(
msgJson
);
QAText
Mark
qaText
=
QATextMark
.
restoreFromEs
(
msgJson
);
return
getQaTextType
(
qaText
);
return
getQaTextType
(
qaText
);
case
VIDEO:
case
VIDEO:
Video
video
=
Video
.
restoreFromEs
(
msgJson
);
Video
Mark
video
=
VideoMark
.
restoreFromEs
(
msgJson
);
return
getVideoType
(
video
);
return
getVideoType
(
video
);
default
:
default
:
break
;
break
;
...
...
src/main/java/com/zhiwei/brandkbs2/util/RedisUtil.java
0 → 100644
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
.
util
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Component
;
import
java.util.concurrent.TimeUnit
;
/**
* @ClassName: RedisUtil
* @Description RedisUtil
* @author: sjj
* @date: 2022-07-15 10:19
*/
@Component
public
class
RedisUtil
{
@Autowired
StringRedisTemplate
stringRedisTemplate
;
public
static
String
getShotPageKey
(
String
id
,
String
projectId
)
{
return
RedisKeyPrefix
.
REDIS_SYSTEM_COPY
+
"SHOT_PAGE:"
+
projectId
+
"-"
+
id
;
}
public
void
setExpire
(
String
key
,
String
value
,
long
timeout
,
TimeUnit
unit
)
{
stringRedisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
unit
);
}
public
void
setExpire
(
String
key
,
String
value
)
{
stringRedisTemplate
.
opsForValue
().
set
(
key
,
value
,
1
,
TimeUnit
.
DAYS
);
}
public
String
get
(
String
key
)
{
return
stringRedisTemplate
.
opsForValue
().
get
(
key
);
}
}
src/main/java/com/zhiwei/brandkbs2/util/TextUtil.java
View file @
d6139789
...
@@ -67,7 +67,7 @@ public class TextUtil {
...
@@ -67,7 +67,7 @@ public class TextUtil {
return
AggreeBootStarter
.
getKResult
(
listMap
,
LIMIT
).
stream
().
map
(
KResult:
:
getDataPoints
).
collect
(
Collectors
.
toList
());
return
AggreeBootStarter
.
getKResult
(
listMap
,
LIMIT
).
stream
().
map
(
KResult:
:
getDataPoints
).
collect
(
Collectors
.
toList
());
}
}
public
static
<
T
>
List
<
List
<
JSONObject
>>
sortByTimeAsc
(
List
<
List
<
T
>>
kResultList
,
List
<
JSONObject
>
sourceList
,
String
tField
)
{
public
static
<
T
>
List
<
List
<
JSONObject
>>
restoreAndSort
(
List
<
List
<
T
>>
kResultList
,
List
<
JSONObject
>
sourceList
,
String
tField
)
{
ImmutableMap
<
T
,
JSONObject
>
idMap
=
Maps
.
uniqueIndex
(
sourceList
,
json
->
(
T
)
json
.
get
(
tField
));
ImmutableMap
<
T
,
JSONObject
>
idMap
=
Maps
.
uniqueIndex
(
sourceList
,
json
->
(
T
)
json
.
get
(
tField
));
// 还原数据
// 还原数据
return
kResultList
.
stream
().
map
(
gList
->
return
kResultList
.
stream
().
map
(
gList
->
...
...
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
View file @
d6139789
...
@@ -20,6 +20,7 @@ import com.zhiwei.qbjc.bean.tools.BeanTools;
...
@@ -20,6 +20,7 @@ import com.zhiwei.qbjc.bean.tools.BeanTools;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.FastDateFormat
;
import
org.apache.commons.lang3.time.FastDateFormat
;
import
org.dozer.DozerBeanMapper
;
import
org.dozer.DozerBeanMapper
;
import
org.springframework.data.mapping.MappingException
;
import
org.springframework.data.mapping.MappingException
;
...
@@ -39,6 +40,8 @@ import java.util.stream.Collectors;
...
@@ -39,6 +40,8 @@ import java.util.stream.Collectors;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
static
com
.
zhiwei
.
brandkbs2
.
common
.
GenericAttribute
.
ES_MARK_CACHE_MAPS
;
import
static
com
.
zhiwei
.
brandkbs2
.
common
.
GenericAttribute
.
ES_MARK_CACHE_MAPS
;
import
static
com
.
zhiwei
.
brandkbs2
.
config
.
Constant
.
DAY_PATTERN
;
import
static
com
.
zhiwei
.
brandkbs2
.
config
.
Constant
.
HOUR_PATTERN
;
import
static
java
.
util
.
Objects
.
nonNull
;
import
static
java
.
util
.
Objects
.
nonNull
;
/**
/**
...
@@ -516,4 +519,39 @@ public class Tools {
...
@@ -516,4 +519,39 @@ public class Tools {
return
result
;
return
result
;
}
}
public
static
Long
[]
formatTimeRange
(
Long
startTime
,
Long
endTime
)
{
if
(
Objects
.
isNull
(
startTime
)
||
Objects
.
isNull
(
endTime
))
{
endTime
=
DateUtils
.
addDays
(
Tools
.
truncDate
(
new
Date
(),
DAY_PATTERN
),
1
).
getTime
();
startTime
=
DateUtils
.
addMonths
(
new
Date
(
endTime
),
-
1
).
getTime
();
}
else
{
startTime
=
Tools
.
truncDate
(
new
Date
(
startTime
),
HOUR_PATTERN
).
getTime
();
endTime
=
Tools
.
truncDate
(
new
Date
(
endTime
),
HOUR_PATTERN
).
getTime
();
}
return
new
Long
[]{
startTime
,
endTime
};
}
public
String
getEmotionByEsMarkMap
(
Map
<
String
,
Object
>
map
)
{
List
<
JSONObject
>
cacheMaps
=
(
List
<
JSONObject
>)
map
.
get
(
GenericAttribute
.
ES_MARK_CACHE_MAPS
);
if
(
null
==
cacheMaps
)
{
return
null
;
}
for
(
JSONObject
json
:
cacheMaps
)
{
if
(
Constant
.
EMOTION_LABEL_KEY
.
equals
(
json
.
getString
(
"group_name"
)))
{
return
json
.
getString
(
"name"
);
}
}
return
null
;
}
public
static
String
getUUID
()
{
return
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
}
public
static
Long
getYearFirst
(
int
year
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
clear
();
calendar
.
set
(
Calendar
.
YEAR
,
year
);
return
calendar
.
getTime
().
getTime
();
}
}
}
\ No newline at end of file
src/test/java/com/zhiwei/brandkbs2/TestRunWith.java
View file @
d6139789
package
com
.
zhiwei
.
brandkbs2
;
package
com
.
zhiwei
.
brandkbs2
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.dao.IChannelLabelDao
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.dao.IEventDataDao
;
import
com.zhiwei.brandkbs2.controller.app.AppArticleController
;
import
com.zhiwei.brandkbs2.pojo.ChannelIndex
;
import
com.zhiwei.brandkbs2.dao.ChannelLabelDao
;
import
com.zhiwei.brandkbs2.service.ITaskService
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.dao.ReportDao
;
import
com.zhiwei.brandkbs2.service.ReportService
;
import
com.zhiwei.brandkbs2.service.TaskService
;
import
com.zhiwei.brandkbs2.util.TextUtil
;
import
com.zhiwei.brandkbs2.util.TextUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -18,7 +21,7 @@ import java.util.List;
...
@@ -18,7 +21,7 @@ import java.util.List;
/**
/**
* @ClassName: TestRunWith
* @ClassName: TestRunWith
* @Description T
ODO
* @Description T
estRunWith
* @author: sjj
* @author: sjj
* @date: 2022-06-16 16:27
* @date: 2022-06-16 16:27
*/
*/
...
@@ -28,43 +31,63 @@ import java.util.List;
...
@@ -28,43 +31,63 @@ import java.util.List;
public
class
TestRunWith
{
public
class
TestRunWith
{
@Autowired
@Autowired
ITaskService
iT
askService
;
TaskService
t
askService
;
@Autowired
@Autowired
IEventDataDao
eventDataDao
;
ReportService
reportService
;
@Autowired
@Autowired
IChannelLabelDao
channelLabelDao
;
EventDataDao
eventDataDao
;
@Autowired
ChannelLabelDao
channelLabelDao
;
@Autowired
ReportDao
reportDao
;
@Autowired
@Autowired
TextUtil
textUtil
;
TextUtil
textUtil
;
@Autowired
AppArticleController
appArticleController
;
@Autowired
GlobalPojo
globalPojo
;
@Test
@Test
public
void
test1
(){
public
void
test1
()
{
iTaskService
.
messageFlowCount
(
1
);
// UserInfo userInfo = new UserInfo();
// userInfo.setProjectId("62beadd1bbf8eb20f96d2f2f");
// UserThreadLocal.set(userInfo);
// ResponseResult result = appArticleController.getMarkSpread(1657468800000L, 1657555200000L);
// System.out.println(JSONObject.toJSONString(result));
// taskService.messageFlowCount(1);
reportService
.
getReportsAggCount
();
}
}
@Test
@Test
public
void
test2
(){
public
void
test2
()
{
ChannelIndex
channelIndex
=
new
ChannelIndex
();
taskService
.
generateReportAndSend
();
channelIndex
.
setPlatform
(
"微信"
);
// ChannelIndex channelIndex = new ChannelIndex();
channelIndex
.
setRealSource
(
"微信公众号"
);
// channelIndex.setPlatform("微信");
channelIndex
.
setSource
(
"金陵晚报2"
);
// channelIndex.setRealSource("微信公众号");
channelIndex
.
setLinkedGroupId
(
"41"
);
// channelIndex.setSource("金陵晚报2");
System
.
out
.
println
(
JSONObject
.
toJSONString
(
eventDataDao
.
getEventCount
(
channelIndex
)));
// channelIndex.setLinkedGroupId("41");
// System.out.println(JSONObject.toJSONString(eventDataDao.getEventCount(channelIndex)));
}
}
@Test
@Test
public
void
test3
(){
public
void
test3
()
{
channelLabelDao
.
getChannelLabelType
();
channelLabelDao
.
getChannelLabelType
();
}
}
@Test
@Test
public
void
test4
(){
public
void
test4
()
{
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"分析高频词耗时"
);
list
.
add
(
"分析高频词耗时"
);
list
.
add
(
"分析高频词"
);
list
.
add
(
"分析高频词"
);
List
<
JSONObject
>
highWordsJson
=
TextUtil
.
getHighWordsJson
(
list
,
1
);
List
<
JSONObject
>
highWordsJson
=
TextUtil
.
getHighWordsJson
(
list
,
1
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
highWordsJson
));
System
.
out
.
println
(
JSONObject
.
toJSONString
(
highWordsJson
));
}
}
...
...
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