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
5f262d04
Commit
5f262d04
authored
Mar 20, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'release'
移动端调整改动上线 See merge request
!249
parents
ae9e5702
6419ab60
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
979 additions
and
58 deletions
+979
-58
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+1
-0
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
+3
-1
src/main/java/com/zhiwei/brandkbs2/controller/LoginController.java
+14
-7
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileChannelController.java
+88
-0
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileEventController.java
+80
-0
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileIndexController.java
+111
-0
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileReportController.java
+67
-0
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileSearchController.java
+120
-0
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileUserController.java
+61
-0
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
+18
-16
src/main/java/com/zhiwei/brandkbs2/pojo/UserRole.java
+2
-1
src/main/java/com/zhiwei/brandkbs2/pojo/dto/MarkSearchDTO.java
+6
-0
src/main/java/com/zhiwei/brandkbs2/pojo/dto/UnionDTO.java
+29
-0
src/main/java/com/zhiwei/brandkbs2/pojo/vo/ChannelVO.java
+10
-0
src/main/java/com/zhiwei/brandkbs2/pojo/vo/MobileLoginVO.java
+34
-0
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/service/IndexService.java
+9
-0
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
+15
-0
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/service/UserCenterService.java
+14
-0
src/main/java/com/zhiwei/brandkbs2/service/UserService.java
+16
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+60
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
+28
-3
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+52
-14
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
+3
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
+2
-9
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+0
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+1
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/UserCenterServiceImpl.java
+25
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
+91
-0
src/main/resources/application-dev.properties
+5
-2
src/main/resources/application-local.properties
+5
-2
src/main/resources/application-prod.properties
+5
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
5f262d04
...
...
@@ -67,6 +67,7 @@ public class RedisKeyPrefix {
* 项目简报报相关缓存KEY
*/
public
static
final
String
REPORT_PC
=
"BRANDKBS:REPORT:PC:"
;
public
static
final
String
REPORT_MOBILE
=
"BRANDKBS:REPORT:MOBILE:"
;
/**
* 稿件数据上传缓存key
...
...
src/main/java/com/zhiwei/brandkbs2/config/Constant.java
View file @
5f262d04
...
...
@@ -27,7 +27,7 @@ public class Constant {
public
static
final
FastDateFormat
HOUR_FORMAT
=
FastDateFormat
.
getInstance
(
HOUR_PATTERN
);
public
static
final
FastDateFormat
DAY_FORMAT
=
FastDateFormat
.
getInstance
(
DAY_PATTERN
);
public
static
final
FastDateFormat
SPEC_DAY_FORMAT
=
FastDateFormat
.
getInstance
(
"yyyy/MM/dd"
);
public
static
final
FastDateFormat
MONTH_FORMAT
=
FastDateFormat
.
getInstance
(
MONTH_PATTERN
);
public
static
final
FastDateFormat
ONLY_MONTH_FORMAT
=
FastDateFormat
.
getInstance
(
"M月"
);
/**
* 自定义fid分隔符号
...
...
@@ -62,4 +62,6 @@ public class Constant {
* 主品牌默认竞品ID
*/
public
static
final
String
PRIMARY_CONTEND_ID
=
"0"
;
public
final
static
String
DEFAULT_PROJECT_ID
=
"62beadd1bbf8eb20f96d2f1c"
;
}
src/main/java/com/zhiwei/brandkbs2/controller/LoginController.java
View file @
5f262d04
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.vo.MobileLoginVO
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.UserCenterService
;
import
com.zhiwei.brandkbs2.service.UserService
;
...
...
@@ -33,7 +34,7 @@ public class LoginController extends BaseController {
private
int
jwtHour
;
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
U
serService
;
private
UserService
u
serService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
ProjectService
;
...
...
@@ -44,14 +45,14 @@ public class LoginController extends BaseController {
@ApiOperation
(
"用户登录"
)
@PostMapping
(
"/user/login"
)
public
ResponseResult
login
()
{
return
ResponseResult
.
success
(
U
serService
.
login
().
toMap
());
return
ResponseResult
.
success
(
u
serService
.
login
().
toMap
());
}
@ApiOperation
(
"用户信息获取"
)
@GetMapping
(
"/user/getLoginInfo"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
ResponseResult
getLoginInfo
()
{
return
ResponseResult
.
success
(
U
serService
.
getLoginInfo
());
return
ResponseResult
.
success
(
u
serService
.
getLoginInfo
());
}
@ApiOperation
(
"重置绑定关系(本地测试)"
)
...
...
@@ -59,7 +60,7 @@ public class LoginController extends BaseController {
@ApiImplicitParam
(
name
=
"username"
,
value
=
"用户名"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"string"
))
@PostMapping
(
"/user/bind/reset"
)
public
ResponseResult
resetBind
(
@RequestBody
JSONObject
json
)
{
U
serService
.
resetBind
(
json
.
getString
(
"username"
));
u
serService
.
resetBind
(
json
.
getString
(
"username"
));
return
ResponseResult
.
success
();
}
...
...
@@ -71,19 +72,19 @@ public class LoginController extends BaseController {
public
ResponseResult
bindUser
(
@RequestBody
JSONObject
json
)
{
String
username
=
json
.
getString
(
"username"
);
String
password
=
json
.
getString
(
"password"
);
return
ResponseResult
.
success
(
U
serService
.
bindUser
(
username
,
password
));
return
ResponseResult
.
success
(
u
serService
.
bindUser
(
username
,
password
));
}
@ApiOperation
(
"跳过绑定(赋默认权限)"
)
@PostMapping
(
"/user/bind/skip"
)
public
ResponseResult
skipBindUser
()
{
return
ResponseResult
.
success
(
U
serService
.
skipBindUser
());
return
ResponseResult
.
success
(
u
serService
.
skipBindUser
());
}
@ApiOperation
(
"校验用户是否已有绑定关系"
)
@GetMapping
(
"/user/login/checkBind"
)
public
ResponseResult
checkBind
()
{
return
ResponseResult
.
success
(
U
serService
.
checkUserRoles
());
return
ResponseResult
.
success
(
u
serService
.
checkUserRoles
());
}
@ApiOperation
(
"获取当前用户拥有的所有项目(含过期)"
)
...
...
@@ -104,6 +105,12 @@ public class LoginController extends BaseController {
return
userCenterService
.
verifyTicket
(
ticket
);
}
@ApiOperation
(
"移动端用户登录"
)
@PostMapping
(
"/mobile/login"
)
public
ResponseResult
mobileLogin
(
@RequestBody
MobileLoginVO
loginVO
)
{
return
userService
.
mobileLogin
(
loginVO
);
}
@ApiOperation
(
"测试接口"
)
@GetMapping
(
"/test"
)
public
ResponseResult
test
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileChannelController.java
0 → 100644
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
controller
.
mobile
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.vo.ChannelListVO
;
import
com.zhiwei.brandkbs2.service.ChannelService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author sjj
* @version 1.0
* @description 移动端渠道展示
* @date 2023年3月14日11:32:52
*/
@RestController
@RequestMapping
(
"/mobile/channel"
)
@Api
(
tags
=
"移动端渠道展示接口"
,
description
=
"提供移动端渠道相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
MobileChannelController
extends
BaseController
{
@Resource
(
name
=
"channelServiceImpl"
)
private
ChannelService
channelService
;
@ApiOperation
(
"渠道基本信息"
)
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"渠道ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@GetMapping
(
"/details/{channelId}"
)
public
ResponseResult
getDetailsByChannelId
(
@PathVariable
(
"channelId"
)
String
channelId
)
{
return
ResponseResult
.
success
(
channelService
.
getBaseInfoByChannelId
(
channelId
));
}
@ApiOperation
(
"收藏或取消收藏渠道"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"渠道ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"collect"
,
value
=
"收藏或取消收藏"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"boolean"
)
})
@PostMapping
(
"/collect/{channelId}/{collect}"
)
public
ResponseResult
collectChannel
(
@PathVariable
String
channelId
,
@PathVariable
boolean
collect
)
{
if
(
collect
)
{
return
ResponseResult
.
success
(
channelService
.
collectChannel
(
channelId
));
}
return
ResponseResult
.
success
(
channelService
.
removeCollectChannel
(
channelId
));
}
@ApiOperation
(
"趋势对比和提要"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"channelId"
,
value
=
"渠道ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"趋势类型"
,
required
=
false
,
defaultValue
=
"稿件"
,
paramType
=
"query"
,
dataType
=
"string"
)
})
@GetMapping
(
"/spreadingTend"
)
public
ResponseResult
getMobileSpreadingTendByChannelId
(
@RequestParam
(
"channelId"
)
String
channelId
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"稿件"
)
String
type
)
{
return
ResponseResult
.
success
(
channelService
.
getMobileSpreadingTend
(
channelId
,
type
));
}
@ApiOperation
(
"移动端渠道榜单展示"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"contendId"
,
value
=
"品牌ID"
,
required
=
false
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"emotion"
,
value
=
"情感倾向"
,
required
=
false
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"int"
)
})
@GetMapping
(
"/rankList"
)
public
ResponseResult
getMobileChannelRankList
(
@RequestParam
(
"startTime"
)
long
startTime
,
@RequestParam
(
"endTime"
)
long
endTime
,
@RequestParam
(
value
=
"contendId"
,
defaultValue
=
"0"
)
String
contendId
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"0"
)
int
emotion
)
{
List
<
ChannelListVO
>
res
;
String
sorter
=
"{\"index\":\"descend\"}"
;
if
(
0
==
emotion
)
{
res
=
channelService
.
getActiveChannelList
(
contendId
,
null
,
null
,
startTime
,
endTime
,
50
,
true
);
}
else
if
(
EmotionEnum
.
POSITIVE
.
getState
()
==
emotion
)
{
res
=
channelService
.
getPositiveList
(
contendId
,
null
,
null
,
sorter
,
startTime
,
endTime
,
50
,
true
);
}
else
{
res
=
channelService
.
getNegativeList
(
contendId
,
null
,
null
,
sorter
,
startTime
,
endTime
,
50
,
true
);
}
return
ResponseResult
.
success
(
res
);
}
}
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileEventController.java
0 → 100644
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
controller
.
mobile
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.EventService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.List
;
/**
* @author sjj
* @version 1.0
* @description 移动端事件接口
* @date 2023年3月15日14:44:44
*/
@RestController
@RequestMapping
(
"/mobile/event"
)
@Api
(
tags
=
"移动端事件展示接口"
,
description
=
"提供移动端事件相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
MobileEventController
extends
BaseController
{
@Resource
(
name
=
"eventServiceImpl"
)
private
EventService
eventService
;
@Resource
(
name
=
"commonServiceImpl"
)
private
CommonService
commonService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@ApiOperation
(
"移动端事件榜单"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"brandId"
,
value
=
"品牌ID"
,
required
=
false
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"string"
),
@ApiImplicitParam
(
name
=
"emotion"
,
value
=
"情感倾向"
,
required
=
false
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"int"
)
})
@GetMapping
(
"/rankList"
)
public
ResponseResult
getMobileEventRankList
(
@RequestParam
(
"startTime"
)
long
startTime
,
@RequestParam
(
"endTime"
)
long
endTime
,
@RequestParam
(
value
=
"brandId"
,
defaultValue
=
"0"
)
String
brandId
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"0"
)
int
emotion
)
{
BrandkbsEventSearchDTO
dto
=
new
BrandkbsEventSearchDTO
();
dto
.
setStartTime
(
startTime
);
dto
.
setEndTime
(
endTime
);
dto
.
setBrandId
(
brandId
);
if
(
0
!=
emotion
)
{
String
emotionName
=
EmotionEnum
.
state2Name
(
emotion
);
String
linkedGroupId
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
Constant
.
PRIMARY_CONTEND_ID
).
getBrandLinkedGroupId
();
List
<
MarkerTag
>
tags
=
commonService
.
getQbjcTags
(
linkedGroupId
,
TagField
.
GROUP_NAME
.
is
(
"情感倾向"
));
tags
.
forEach
(
tag
->
{
if
(
tag
.
getName
().
equals
(
emotionName
))
{
dto
.
setEmotions
(
Collections
.
singletonList
(
tag
.
getUniqueId
()));
}
});
}
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
}
}
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileIndexController.java
0 → 100644
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
controller
.
mobile
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.IndexService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
/**
* @author sjj
* @version 1.0
* @description 移动端首页接口
* @date 2023年3月14日11:34:18
*/
@RestController
@RequestMapping
(
"/mobile/index"
)
@Api
(
tags
=
"移动端首页展示接口"
,
description
=
"提供移动端首页相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
MobileIndexController
{
@Resource
(
name
=
"indexServiceImpl"
)
private
IndexService
indexService
;
@Resource
(
name
=
"markDataServiceImpl"
)
private
MarkDataService
markDataService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@Resource
(
name
=
"commonServiceImpl"
)
private
CommonService
commonService
;
@ApiOperation
(
"主品牌整体指标"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
)
})
@GetMapping
(
"/wholeCriteria"
)
public
ResponseResult
getWholeCriteria
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
)
{
return
ResponseResult
.
success
(
indexService
.
getMobileWholeCriteria
(
startTime
,
endTime
));
}
@ApiOperation
(
"传播趋势"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
)
})
@GetMapping
(
"/spreadingTend"
)
public
ResponseResult
getSpreadingTend
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
)
{
return
ResponseResult
.
success
(
indexService
.
getSpreadingTend
(
startTime
,
endTime
,
true
));
}
@ApiOperation
(
"移动端舆情总结页面"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"brandId"
,
value
=
"竞品品牌ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
})
@GetMapping
(
"/summary"
)
public
ResponseResult
getMobileSummary
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
"brandId"
)
String
brandId
)
throws
IOException
{
MarkSearchDTO
dto
=
new
MarkSearchDTO
();
dto
.
setStartTime
(
startTime
);
dto
.
setEndTime
(
endTime
);
dto
.
setContendId
(
brandId
);
return
ResponseResult
.
success
(
markDataService
.
getContendSummary
(
dto
,
true
));
}
@ApiOperation
(
"移动端传播分析页面"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"开始时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"结束时间"
,
required
=
false
,
paramType
=
"query"
,
dataType
=
"long"
),
@ApiImplicitParam
(
name
=
"brandId"
,
value
=
"竞品品牌ID"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"string"
)
})
@GetMapping
(
"/spread/analyze"
)
public
ResponseResult
getMobileSpreadAnalyze
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
Long
startTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
Long
endTime
,
@RequestParam
(
value
=
"brandId"
)
String
brandId
)
throws
IOException
{
if
(
null
==
startTime
||
null
==
endTime
)
{
Long
[]
timeRangeMonth
=
commonService
.
getTimeRangeMonth
();
startTime
=
timeRangeMonth
[
0
];
endTime
=
timeRangeMonth
[
1
];
}
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
startTime
,
endTime
,
UserThreadLocal
.
getProjectId
(),
brandId
,
3
,
true
));
}
@ApiOperation
(
"移动端首页竞品列表"
)
@GetMapping
(
"/contends"
)
public
ResponseResult
getContends
()
{
return
ResponseResult
.
success
(
projectService
.
getBrands
(
UserThreadLocal
.
getProjectId
(),
false
));
}
}
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileReportController.java
0 → 100644
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
controller
.
mobile
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.ReportSearchDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ReportService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
/**
* @author sjj
* @version 1.0
* @description 移动端月报界面接口
* @date 2023年3月14日17:27:18
*/
@RestController
@RequestMapping
(
"/mobile/report"
)
@Api
(
tags
=
"移动端项目月报相关信息展示接口"
,
description
=
"实现移动端项目月报相关信息展示功能"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
MobileReportController
{
@Resource
(
name
=
"reportServiceImpl"
)
private
ReportService
reportService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@ApiOperation
(
"月报列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"5"
,
paramType
=
"query"
,
dataType
=
"int"
)
})
@GetMapping
(
"/list"
)
public
ResponseResult
getReportList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"5"
)
int
size
)
{
ReportSearchDTO
dto
=
new
ReportSearchDTO
();
dto
.
setPage
(
page
);
dto
.
setPageSize
(
size
);
dto
.
setType
(
"月报"
);
String
projectName
=
projectService
.
getProjectById
(
UserThreadLocal
.
getProjectId
()).
getProjectName
();
PageVO
<
JSONObject
>
reportList
=
reportService
.
findReportList
(
dto
);
reportList
.
getList
().
forEach
(
json
->
{
Long
startTime
=
json
.
getLong
(
"endTime"
);
json
.
put
(
"mobileTitle"
,
projectName
+
Constant
.
ONLY_MONTH_FORMAT
.
format
(
startTime
)
+
"简报"
);
});
return
ResponseResult
.
success
(
reportList
);
}
@ApiOperation
(
"舆情简报-获取月报结果"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"报告ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@GetMapping
(
"/analyze/{id}"
)
public
ResponseResult
getReportAnalyze
(
@PathVariable
String
id
)
{
return
ResponseResult
.
success
(
reportService
.
getMobileReportAnalyze
(
id
,
true
));
}
}
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileSearchController.java
0 → 100644
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
controller
.
mobile
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.service.*
;
import
com.zhiwei.middleware.event.pojo.dto.BrandkbsEventSearchDTO
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.List
;
/**
* @author sjj
* @version 1.0
* @description 移动端搜索展示接口
* @date 2023年3月14日17:30:10
*/
@RestController
@RequestMapping
(
"/mobile/search"
)
@Api
(
tags
=
"移动端搜索展示接口"
,
description
=
"提供移动端搜索相关信息展示"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
MobileSearchController
{
@Resource
(
name
=
"channelServiceImpl"
)
private
ChannelService
channelService
;
@Resource
(
name
=
"eventServiceImpl"
)
private
EventService
eventService
;
@Resource
(
name
=
"commonServiceImpl"
)
private
CommonService
commonService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@Resource
(
name
=
"markDataServiceImpl"
)
private
MarkDataService
markDataService
;
@ApiOperation
(
"移动端关键字搜索渠道列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"page"
,
value
=
"页码"
,
required
=
false
,
defaultValue
=
"1"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"size"
,
value
=
"每页记录数"
,
required
=
false
,
defaultValue
=
"10"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"platform"
,
value
=
"平台筛选"
,
required
=
false
,
defaultValue
=
"全部"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"emotion"
,
value
=
"情感倾向"
,
required
=
false
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"int"
)
})
@GetMapping
(
"/channel"
)
public
ResponseResult
searchChannelList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
,
@RequestParam
(
value
=
"platform"
,
defaultValue
=
"全部"
)
String
platform
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"0"
)
int
emotion
)
{
JSONObject
sorter
=
new
JSONObject
();
sorter
.
put
(
"last_time"
,
"descend"
);
return
ResponseResult
.
success
(
channelService
.
getChannelListNew
(
page
,
size
,
keyword
,
Collections
.
singletonList
(
platform
),
Collections
.
singletonList
(
emotion
),
null
,
null
,
sorter
));
}
@ApiOperation
(
"移动端渠道搜索条件"
)
@GetMapping
(
"/channel/criteria"
)
public
ResponseResult
getChannelSearchCriteria
()
{
return
ResponseResult
.
success
(
channelService
.
getChannelSearchCriteria
());
}
@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
=
"emotion"
,
value
=
"情感倾向"
,
required
=
false
,
defaultValue
=
"0"
,
paramType
=
"query"
,
dataType
=
"int"
),
@ApiImplicitParam
(
name
=
"keyword"
,
value
=
"关键字"
,
required
=
false
,
defaultValue
=
""
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@GetMapping
(
"/event"
)
public
ResponseResult
searchEventList
(
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
int
size
,
@RequestParam
(
value
=
"emotion"
,
defaultValue
=
"0"
)
int
emotion
,
@RequestParam
(
value
=
"keyword"
,
defaultValue
=
""
)
String
keyword
)
{
BrandkbsEventSearchDTO
dto
=
new
BrandkbsEventSearchDTO
();
dto
.
setPage
(
page
);
dto
.
setPageSize
(
size
);
if
(
0
!=
emotion
)
{
String
emotionName
=
EmotionEnum
.
state2Name
(
emotion
);
String
linkedGroupId
=
projectService
.
getProjectByContendId
(
UserThreadLocal
.
getProjectId
(),
Constant
.
PRIMARY_CONTEND_ID
).
getBrandLinkedGroupId
();
List
<
MarkerTag
>
tags
=
commonService
.
getQbjcTags
(
linkedGroupId
,
TagField
.
GROUP_NAME
.
is
(
"情感倾向"
));
tags
.
forEach
(
tag
->
{
if
(
tag
.
getName
().
equals
(
emotionName
))
{
dto
.
setEmotions
(
Collections
.
singletonList
(
tag
.
getUniqueId
()));
}
});
}
dto
.
setKeyword
(
keyword
);
return
ResponseResult
.
success
(
eventService
.
getEventListMiddleware
(
dto
));
}
@ApiOperation
(
"移动端关键字搜索稿件列表"
)
@PostMapping
(
"/article"
)
public
ResponseResult
searchArticleList
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
{
return
ResponseResult
.
success
(
markDataService
.
getYuqingMarkList
(
markSearchDTO
));
}
@ApiOperation
(
"移动端稿件搜索条件"
)
@GetMapping
(
"/article/criteria"
)
public
ResponseResult
getArticleCriteria
()
{
return
ResponseResult
.
success
(
markDataService
.
getMobileYuqingMarkCriteria
());
}
}
src/main/java/com/zhiwei/brandkbs2/controller/mobile/MobileUserController.java
0 → 100644
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
controller
.
mobile
;
import
com.zhiwei.brandkbs2.auth.Auth
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.controller.BaseController
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.service.ChannelService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
/**
* @author lxj
* @version 1.0
* @description 移动端用户个人中心接口
* @date 2020/1/13 14:33
*/
@RestController
@RequestMapping
(
"/mobile/user"
)
@Api
(
tags
=
"移动端用户信息接口"
,
description
=
"提供移动端用户信息展示功能"
)
@Auth
(
role
=
RoleEnum
.
CUSTOMER
)
public
class
MobileUserController
extends
BaseController
{
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
userService
;
@Resource
(
name
=
"channelServiceImpl"
)
private
ChannelService
channelService
;
@Resource
(
name
=
"projectServiceImpl"
)
private
ProjectService
projectService
;
@ApiOperation
(
"移动端切换登陆"
)
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"项目ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"string"
)
@PostMapping
(
"/cutLogin/{projectId}"
)
public
ResponseResult
cutLogin
(
@PathVariable
String
projectId
)
{
String
userId
=
UserThreadLocal
.
getUserId
();
return
ResponseResult
.
success
(
userService
.
mobileCutLogin
(
userId
,
projectId
));
}
@ApiOperation
(
"收藏列表"
)
@GetMapping
(
"/collects"
)
public
ResponseResult
collectList
()
{
// 暂时只返回渠道收藏列表
return
ResponseResult
.
success
(
channelService
.
getCollectList
(
Constant
.
PRIMARY_CONTEND_ID
));
}
@ApiOperation
(
"项目列表"
)
@GetMapping
(
"/projects"
)
public
ResponseResult
projectList
()
{
return
ResponseResult
.
success
(
projectService
.
getUserAllProjects
());
}
}
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
View file @
5f262d04
...
...
@@ -94,20 +94,23 @@ public class EsQueryTools {
}
public
static
BoolQueryBuilder
assembleCacheMapsQuery
(
String
projectId
,
String
linkedGroupId
,
String
contendId
,
List
<
String
>
mediaTypes
)
{
BoolQueryBuilder
nestedBoolQueryBuilder
=
QueryBuilders
.
boolQuery
();
return
assembleCacheMapsQuery
(
projectId
,
linkedGroupId
,
contendId
,
mediaTypes
,
null
);
}
public
static
BoolQueryBuilder
assembleCacheMapsQuery
(
String
projectId
,
String
linkedGroupId
,
String
contendId
,
List
<
String
>
mediaTypes
,
Integer
channelEmotion
)
{
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
();
String
key
=
concat
(
projectId
,
contendId
);
TermQueryBuilder
mustQuery
=
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.key.keyword"
,
key
);
if
(
CollectionUtils
.
isEmpty
(
mediaTypes
))
{
// 不组装mediaTypes的情况
nestedBoolQueryBuilder
.
must
(
cacheMapsNestedQuery
(
mustQuery
));
}
else
{
// BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
// mediaTypes.forEach(e -> {
// BoolQueryBuilder mediaTypeQueryBuilder = QueryBuilders.boolQuery();
// mediaTypeQueryBuilder.must(QueryBuilders.termQuery("brandkbs_cache_maps.channel_type.keyword", e));
// mediaTypeQueryBuilder.must(mustQuery);
// boolQueryBuilder.should(cacheMapsNestedQuery(mediaTypeQueryBuilder));
// });
BoolQueryBuilder
nestedBoolBuilder
=
QueryBuilders
.
boolQuery
();
// 必要条件
nestedBoolBuilder
.
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.key.keyword"
,
key
));
// nested字段
if
(
null
!=
channelEmotion
)
{
nestedBoolBuilder
.
must
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.channel_emotion"
,
channelEmotion
));
}
boolQueryBuilder
.
must
(
cacheMapsNestedQuery
(
nestedBoolBuilder
));
// 其他字段
if
(
CollectionUtils
.
isNotEmpty
(
mediaTypes
))
{
BoolQueryBuilder
mediaTypesBoolQueryBuilder
=
QueryBuilders
.
boolQuery
();
for
(
String
mediaType
:
mediaTypes
)
{
BoolQueryBuilder
mediaTypeBoolQueryBuilder
=
QueryBuilders
.
boolQuery
();
...
...
@@ -121,10 +124,9 @@ public class EsQueryTools {
}
mediaTypesBoolQueryBuilder
.
should
(
mediaTypeBoolQueryBuilder
);
}
nestedBoolQueryBuilder
.
must
(
cacheMapsNestedQuery
(
mustQuery
));
nestedBoolQueryBuilder
.
must
(
mediaTypesBoolQueryBuilder
);
boolQueryBuilder
.
must
(
mediaTypesBoolQueryBuilder
);
}
return
nestedB
oolQueryBuilder
;
return
b
oolQueryBuilder
;
}
public
static
BoolQueryBuilder
assembleCacheMapsQueryWithProject
(
String
projectId
,
List
<
String
>
mediaTypes
)
{
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/UserRole.java
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
pojo
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.util.Tools
;
...
...
@@ -23,7 +24,7 @@ import java.util.Date;
public
class
UserRole
{
// 默认绑定阿里项目
private
final
static
String
DEFAULT_PROJECT_ID
=
"62beadd1bbf8eb20f96d2f1c"
;
private
final
static
String
DEFAULT_PROJECT_ID
=
Constant
.
DEFAULT_PROJECT_ID
;
// 默认导出1000
private
final
static
int
DEFAULT_EXPORT_LIMIT
=
1000
;
// 默认角色ID
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/MarkSearchDTO.java
View file @
5f262d04
...
...
@@ -82,6 +82,12 @@ public class MarkSearchDTO {
private
List
<
String
>
tags
;
/**
* 渠道倾向
*/
@ApiModelProperty
(
value
=
"渠道倾向"
)
private
Integer
channelEmotion
;
/**
* 自定义标签筛选
*/
@ApiModelProperty
(
value
=
"自定义标签筛选"
)
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/dto/UnionDTO.java
0 → 100644
View file @
5f262d04
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 2023年3月15日09:20:54
*/
@Data
@ToString
@ApiModel
(
"微信关联解密参数"
)
public
class
UnionDTO
{
/**
* 完整用户信息的加密数据
*/
@ApiModelProperty
(
"完整用户信息的加密数据"
)
private
String
encryptedData
;
/**
* 加密算法的初始向量
*/
@ApiModelProperty
(
"加密算法的初始向量"
)
private
String
iv
;
}
src/main/java/com/zhiwei/brandkbs2/pojo/vo/ChannelVO.java
View file @
5f262d04
...
...
@@ -19,6 +19,9 @@ public class ChannelVO {
@ApiModelProperty
(
value
=
"id"
)
private
String
id
;
@ApiModelProperty
(
value
=
"平台"
)
private
String
platform
;
@ApiModelProperty
(
value
=
"渠道"
)
private
String
source
;
...
...
@@ -49,12 +52,17 @@ public class ChannelVO {
@ApiModelProperty
(
value
=
"最近发文链接"
)
private
JSONObject
lastArticle
;
@ApiModelProperty
(
value
=
"渠道标签"
)
private
String
channelTag
;
@Deprecated
public
static
ChannelVO
createFromChannelInfo
(
JSONObject
channelInfo
,
String
projectId
)
{
Channel
channel
=
(
Channel
)
channelInfo
.
get
(
"channel"
);
JSONObject
lastArticle
=
channelInfo
.
getJSONObject
(
"lastArticle"
);
return
createFromChannelVO
(
channel
,
projectId
,
lastArticle
);
}
@Deprecated
public
static
ChannelVO
createFromChannelVO
(
Channel
channel
,
String
projectId
,
JSONObject
lastArticle
)
{
ChannelVO
channelVO
=
new
ChannelVO
();
channelVO
.
setId
(
channel
.
getId
());
...
...
@@ -78,6 +86,7 @@ public class ChannelVO {
JSONObject
json
=
new
JSONObject
(
map
);
ChannelVO
channelVO
=
new
ChannelVO
();
channelVO
.
setId
(
json
.
getString
(
"id"
));
channelVO
.
setPlatform
(
json
.
getString
(
"platform"
));
channelVO
.
setSource
(
json
.
getString
(
"source"
));
channelVO
.
setRealSource
(
json
.
getString
(
"real_source"
));
channelVO
.
setEmotion
(
ChannelEmotion
.
getNameFromState
(
json
.
getInteger
(
"emotion"
)));
...
...
@@ -96,6 +105,7 @@ public class ChannelVO {
if
(
null
!=
influence
&&
influence
!=
-
1
)
{
channelVO
.
setInfluence
(
new
BigDecimal
(
influence
).
setScale
(
2
,
RoundingMode
.
UP
).
doubleValue
());
}
channelVO
.
setChannelTag
(
GlobalPojo
.
CHANNEL_TAGS
.
get
(
channelVO
.
getSource
()));
return
channelVO
;
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/vo/MobileLoginVO.java
0 → 100644
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
pojo
.
vo
;
import
com.zhiwei.brandkbs2.pojo.dto.UnionDTO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.ToString
;
/**
* @author sjj
* @version V1.0
* @description 移动端登陆用户实体
* @date 2023年3月15日09:21:02
**/
@Data
@ToString
@ApiModel
(
"移动端登陆用户实体"
)
public
class
MobileLoginVO
{
/**
* 账号
*/
@ApiModelProperty
(
"手机号"
)
private
Long
phoneNumber
;
/**
* 项目名
*/
@ApiModelProperty
(
"小程序临时code"
)
private
String
code
;
/**
* 微信关联解密参数
*/
@ApiModelProperty
(
"微信关联解密参数"
)
private
UnionDTO
union
;
}
src/main/java/com/zhiwei/brandkbs2/service/ChannelService.java
View file @
5f262d04
...
...
@@ -268,4 +268,6 @@ public interface ChannelService {
PageVO
<
ChannelVO
>
getChannelListNew
(
int
page
,
int
pageSize
,
String
keyword
,
List
<
String
>
platforms
,
List
<
Integer
>
emotions
,
List
<
String
>
mediaTypes
,
Integer
[]
articlesCount
,
JSONObject
sorter
);
JSONObject
getMobileSpreadingTend
(
String
channelId
,
String
type
);
}
src/main/java/com/zhiwei/brandkbs2/service/IndexService.java
View file @
5f262d04
...
...
@@ -72,4 +72,13 @@ public interface IndexService {
*/
JSONObject
getSpreadingTend
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
contendId
,
boolean
cache
);
/**
* 获取主品牌整体指标
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 主品牌整体指标
*/
JSONObject
getMobileWholeCriteria
(
Long
startTime
,
Long
endTime
);
}
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
View file @
5f262d04
...
...
@@ -65,6 +65,11 @@ public interface MarkDataService {
JSONObject
getYuqingMarkCriteria
(
String
linkedGroup
);
/**
* 舆情标注数据搜索条件
*/
JSONObject
getMobileYuqingMarkCriteria
();
/**
* 舆情标注数据提要信息
*
* @param startTime 开始时间
...
...
@@ -112,6 +117,16 @@ public interface MarkDataService {
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
);
/**
* 获取舆情标注数据舆情平台分布
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param emotion 情感倾向筛选
* @return 获取舆情标注数据舆情平台分布
*/
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
emotion
,
boolean
cache
);
/**
* 获取舆情标注数据舆情高频词分布
*
* @param startTime 开始时间
...
...
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
View file @
5f262d04
...
...
@@ -90,6 +90,8 @@ public interface ReportService {
*/
JSONObject
getPcReportAnalyze
(
Report
report
,
boolean
cache
);
JSONObject
getMobileReportAnalyze
(
String
id
,
boolean
cache
);
/**
* 分页查询报告列表
*
...
...
src/main/java/com/zhiwei/brandkbs2/service/UserCenterService.java
View file @
5f262d04
...
...
@@ -32,4 +32,18 @@ public interface UserCenterService {
*/
CenterUser
registerUser
(
long
phone
,
String
password
,
String
nickName
);
/**
* ticket绑定用户信息
* @param ticket
* @param userId
* @return
*/
boolean
bindUser
(
String
ticket
,
String
userId
);
/**
* 添加产品开通权限
* @return
*/
boolean
addProduct
(
String
userId
);
}
src/main/java/com/zhiwei/brandkbs2/service/UserService.java
View file @
5f262d04
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.MobileLoginVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
java.util.List
;
...
...
@@ -118,4 +119,19 @@ public interface UserService {
void
resetBind
(
String
username
);
/**
* 移动端用户登录
* @param loginVO
* @return
*/
ResponseResult
mobileLogin
(
MobileLoginVO
loginVO
);
/**
* 移动端切换用户
* @param userId
* @param projectId
* @return
*/
ResponseResult
mobileCutLogin
(
String
userId
,
String
projectId
);
}
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
5f262d04
...
...
@@ -578,6 +578,11 @@ public class ChannelServiceImpl implements ChannelService {
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"id"
,
channel
.
getId
());
json
.
put
(
"source"
,
channel
.
getSource
());
json
.
put
(
"platform"
,
channel
.
getPlatform
());
json
.
put
(
"emotion"
,
channel
.
getEmotion
());
json
.
put
(
"avatarUrl"
,
channel
.
getAvatarUrl
());
json
.
put
(
"emotionRank"
,
getChannelEmotionRank
(
channel
.
getEmotionIndex
(),
channel
.
getEmotion
()));
json
.
put
(
"channelTag"
,
channelTagDao
.
getTagByChannelName
(
channel
.
getSource
()));
return
json
;
}).
collect
(
Collectors
.
toList
());
}
...
...
@@ -603,6 +608,7 @@ public class ChannelServiceImpl implements ChannelService {
if
(
Boolean
.
TRUE
.
equals
(
channel
.
getIsCollect
()))
{
jsonObject
.
put
(
"collectTime"
,
channel
.
getCollectTime
());
}
jsonObject
.
put
(
"lastTime"
,
channel
.
getLastTime
());
// 渠道倾向变化 TODO
return
jsonObject
;
}
...
...
@@ -1028,6 +1034,60 @@ public class ChannelServiceImpl implements ChannelService {
return
null
;
}
@Override
public
JSONObject
getMobileSpreadingTend
(
String
channelId
,
String
type
)
{
Long
[]
timeRangeWeek
=
commonService
.
getTimeRangeMonth
();
Long
startTime
=
timeRangeWeek
[
0
];
Long
endTime
=
timeRangeWeek
[
1
];
String
contendId
=
Constant
.
PRIMARY_CONTEND_ID
;
JSONObject
result
=
getSpreadingTend
(
channelId
,
type
,
contendId
,
startTime
,
endTime
);
if
(
"稿件"
.
equals
(
type
))
{
List
<
ChannelIndex
.
Article
>
dataList
=
getSourceContendMap
(
channelId
,
Collections
.
singletonList
(
contendId
),
startTime
,
endTime
).
get
(
contendId
);
int
dataSize
=
dataList
.
size
();
long
positiveArticle
=
dataList
.
stream
().
filter
(
data
->
EmotionEnum
.
POSITIVE
.
getState
()
==
data
.
getEmotion
()).
count
();
long
negativeArticle
=
dataList
.
stream
().
filter
(
data
->
EmotionEnum
.
NEGATIVE
.
getState
()
==
data
.
getEmotion
()).
count
();
result
.
put
(
"positiveArticle"
,
positiveArticle
);
result
.
put
(
"positiveArticleProportion"
,
dataSize
==
0
?
0
:
positiveArticle
*
1.0
/
dataSize
);
result
.
put
(
"negativeArticle"
,
negativeArticle
);
result
.
put
(
"negativeArticleProportion"
,
dataSize
==
0
?
0
:
negativeArticle
*
1.0
/
dataSize
);
List
<
CompletableFuture
<
JSONObject
>>
futureList
=
dataList
.
stream
().
limit
(
5
).
map
(
normalData
->
CompletableFuture
.
supplyAsync
(()
->
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"emotion"
,
normalData
.
getEmotion
());
json
.
put
(
"time"
,
normalData
.
getTime
());
String
[]
titleUrl
=
getTitleAndUrlById
(
normalData
.
getId
());
json
.
put
(
"title"
,
titleUrl
[
0
]);
json
.
put
(
"url"
,
titleUrl
[
1
]);
return
json
;
},
esSearchExecutor
)).
collect
(
Collectors
.
toList
());
CompletableFuture
.
allOf
(
futureList
.
toArray
(
new
CompletableFuture
[
0
])).
join
();
result
.
put
(
"recentlyArticles"
,
futureList
.
stream
().
map
(
CompletableFuture:
:
join
).
collect
(
Collectors
.
toList
()));
}
else
if
(
"事件"
.
equals
(
type
))
{
Map
<
Long
,
List
<
Event
>>
eventMap
=
eventMiddlewareDao
.
getEventDay
(
new
ChannelIndex
(
channelDao
.
findOneById
(
channelId
),
contendId
).
getFid
(),
startTime
,
endTime
);
List
<
Event
>
events
=
new
ArrayList
<>();
eventMap
.
entrySet
().
stream
().
sorted
(
Comparator
.
comparingLong
(
Map
.
Entry
::
getKey
)).
forEach
(
entry
->{
events
.
addAll
(
entry
.
getValue
());
});
int
eventSize
=
events
.
size
();
result
.
put
(
"recentlyEvent"
,
events
.
stream
().
limit
(
5
).
map
(
event
->
{
JSONObject
eventJson
=
new
JSONObject
();
eventJson
.
put
(
"id"
,
event
.
getId
());
eventJson
.
put
(
"title"
,
event
.
getName
());
eventJson
.
put
(
"emotion"
,
event
.
getEmotionEventTag
().
getName
());
eventJson
.
put
(
"influence"
,
event
.
getInfluence
());
return
eventJson
;
}).
collect
(
Collectors
.
toList
()));
long
positiveEvent
=
events
.
stream
().
filter
(
event
->
EmotionEnum
.
POSITIVE
.
getName
().
equals
(
event
.
getEmotionEventTag
().
getName
())).
count
();
long
negativeEvent
=
events
.
stream
().
filter
(
event
->
EmotionEnum
.
NEGATIVE
.
getName
().
equals
(
event
.
getEmotionEventTag
().
getName
())).
count
();
result
.
put
(
"positiveEvent"
,
positiveEvent
);
result
.
put
(
"positiveEventProportion"
,
eventSize
==
0
?
0
:
positiveEvent
*
1.0
/
eventSize
);
result
.
put
(
"negativeEvent"
,
negativeEvent
);
result
.
put
(
"negativeEventProportion"
,
eventSize
==
0
?
0
:
negativeEvent
*
1.0
/
eventSize
);
}
return
result
;
}
private
BoolQueryBuilder
getChannelListQuery
(
String
projectId
,
String
contendId
,
String
keyword
,
List
<
String
>
platforms
,
List
<
Integer
>
emotions
,
List
<
String
>
mediaTypes
,
Integer
[]
articlesCount
)
{
BoolQueryBuilder
postFilter
=
QueryBuilders
.
boolQuery
();
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/IndexServiceImpl.java
View file @
5f262d04
...
...
@@ -13,21 +13,18 @@ import com.zhiwei.brandkbs2.exception.ExceptionCast;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.Event
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.IndexService
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.joda.time.Period
;
import
org.joda.time.PeriodType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -302,6 +299,34 @@ public class IndexServiceImpl implements IndexService {
return
resJson
;
}
@Override
public
JSONObject
getMobileWholeCriteria
(
Long
startTime
,
Long
endTime
)
{
JSONObject
result
=
new
JSONObject
();
JSONObject
yuQingResult
=
getYuqingAmount
(
startTime
,
endTime
,
true
);
JSONObject
reputationResult
=
getReputation
(
startTime
,
endTime
,
true
);
JSONObject
eventResult
=
getEventAmount
(
startTime
,
endTime
,
true
);
List
<
JSONObject
>
platformResult
=
getPlatformInfo
(
startTime
,
endTime
,
true
);
result
.
put
(
"startTime"
,
yuQingResult
.
getLongValue
(
"startTime"
));
result
.
put
(
"endTime"
,
yuQingResult
.
getLongValue
(
"endTime"
));
JSONObject
yuQing
=
new
JSONObject
();
yuQing
.
put
(
"avgTotal"
,
yuQingResult
.
getIntValue
(
"avgTotal"
));
yuQing
.
put
(
"compare"
,
yuQingResult
.
getDoubleValue
(
"compare"
));
yuQing
.
put
(
"yuqingTotal"
,
yuQingResult
.
getIntValue
(
"yuqingTotal"
));
result
.
put
(
"yuqing"
,
yuQing
);
JSONObject
reputation
=
new
JSONObject
();
reputation
.
put
(
"avgReputation"
,
reputationResult
.
getDoubleValue
(
"avgPosPro"
));
reputation
.
put
(
"compare"
,
reputationResult
.
getDoubleValue
(
"compare"
));
reputation
.
put
(
"reputation"
,
reputationResult
.
getDoubleValue
(
"posPro"
));
result
.
put
(
"reputation"
,
reputation
);
JSONObject
event
=
new
JSONObject
();
event
.
put
(
"avgEventTotal"
,
eventResult
.
getIntValue
(
"avgEventTotal"
));
event
.
put
(
"compare"
,
eventResult
.
getDoubleValue
(
"compare"
));
event
.
put
(
"eventTotal"
,
eventResult
.
getIntValue
(
"eventTotal"
));
result
.
put
(
"event"
,
event
);
result
.
put
(
"platform"
,
platformResult
.
stream
().
max
(
Comparator
.
comparing
(
json
->
json
.
getIntValue
(
"num"
))).
get
());
return
result
;
}
public
List
<
JSONObject
>
getPlatformProportionWithPlatform
(
Long
startTime
,
Long
endTime
,
String
emotion
,
String
projectId
,
String
contendId
,
long
normalCount
)
{
List
<
String
>
platformIds
=
GlobalPojo
.
PLATFORMS
.
stream
().
map
(
MessagePlatform:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
JSONObject
>
resultList
=
new
ArrayList
<>(
platformIds
.
size
());
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
5f262d04
...
...
@@ -351,6 +351,39 @@ public class MarkDataServiceImpl implements MarkDataService {
}
@Override
public
JSONObject
getMobileYuqingMarkCriteria
()
{
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
JSONObject
result
=
new
JSONObject
();
JSONObject
allFiled
=
new
JSONObject
();
allFiled
.
put
(
"id"
,
null
);
allFiled
.
put
(
"name"
,
"全部"
);
List
<
JSONObject
>
platformList
=
commonService
.
getQbjcPlatform
(
"id"
,
"name"
);
platformList
.
add
(
0
,
allFiled
);
// 平台
result
.
put
(
"platformList"
,
platformList
);
// 情感标签
List
<
JSONObject
>
emotionList
=
commonService
.
getEmotionTagsWithSort
(
projectId
,
linkedGroupId
).
stream
().
map
(
markerTag
->
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"id"
,
markerTag
.
getUniqueId
());
json
.
put
(
"name"
,
markerTag
.
getName
());
return
json
;
}).
collect
(
Collectors
.
toList
());
emotionList
.
add
(
0
,
allFiled
);
result
.
put
(
"emotionList"
,
emotionList
);
// 渠道情感倾向
List
<
JSONObject
>
channelEmotionList
=
Arrays
.
stream
(
ChannelEmotion
.
values
()).
filter
(
emotion
->
emotion
!=
ChannelEmotion
.
UNDEFINED
).
map
(
emotion
->
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"id"
,
emotion
.
getState
());
json
.
put
(
"name"
,
emotion
.
getName
());
return
json
;
}).
collect
(
Collectors
.
toList
());
channelEmotionList
.
add
(
0
,
allFiled
);
result
.
put
(
"channelEmotionList"
,
channelEmotionList
);
return
result
;
}
@Override
public
JSONObject
getAnalyzeSummary
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
try
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
...
...
@@ -477,15 +510,19 @@ public class MarkDataServiceImpl implements MarkDataService {
@Override
public
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
boolean
cache
)
{
return
getMarkPlatformProportion
(
startTime
,
endTime
,
null
,
cache
);
}
@Override
public
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
emotion
,
boolean
cache
)
{
List
<
JSONObject
>
res
=
null
;
try
{
Long
[]
timeRange
=
Tools
.
formatTimeRange
(
startTime
,
endTime
);
startTime
=
timeRange
[
0
];
endTime
=
timeRange
[
1
];
String
projectId
=
UserThreadLocal
.
getProjectId
();
String
linkedGroupId
=
projectService
.
getProjectVOById
(
projectId
).
getBrandLinkedGroupId
();
// 舆情库默认contendId为0
res
=
getMarkPlatformProportion
(
startTime
,
endTime
,
projectId
,
linkedGroupId
,
Constant
.
PRIMARY_CONTEND_ID
,
cache
);
res
=
getMarkPlatformProportion
(
startTime
,
endTime
,
projectId
,
Constant
.
PRIMARY_CONTEND_ID
,
emotion
,
cache
);
}
catch
(
IOException
e
)
{
ExceptionCast
.
cast
(
CommonCodeEnum
.
FAIL
,
"es查询异常"
,
e
);
}
...
...
@@ -551,10 +588,10 @@ public class MarkDataServiceImpl implements MarkDataService {
markSearchDTO
.
setStartTime
(
DateUtils
.
addDays
(
now
,
-
29
).
getTime
());
}
// 页码默认
if
(
markSearchDTO
.
getPage
()
<
1
)
{
if
(
null
==
markSearchDTO
.
getPage
()
||
markSearchDTO
.
getPage
()
<
1
)
{
markSearchDTO
.
setPage
(
1
);
}
if
(
markSearchDTO
.
getPageSize
()
<=
0
||
markSearchDTO
.
getPageSize
()
>
10000
)
{
if
(
null
==
markSearchDTO
.
getPageSize
()
||
markSearchDTO
.
getPageSize
()
<=
0
||
markSearchDTO
.
getPageSize
()
>
10000
)
{
markSearchDTO
.
setPageSize
(
20
);
}
// 排序默认
...
...
@@ -580,7 +617,8 @@ public class MarkDataServiceImpl implements MarkDataService {
String
contendId
=
dto
.
getContendId
();
// PostFilter 后置过滤器
// BoolQueryBuilder postFilter = projectLinkedGroupQuery(projectId, linkedGroupId);
BoolQueryBuilder
postFilter
=
EsQueryTools
.
assembleCacheMapsQuery
(
projectId
,
linkedGroupId
,
contendId
,
dto
.
getMediaTypes
());
// 新增channelEmotion
BoolQueryBuilder
postFilter
=
EsQueryTools
.
assembleCacheMapsQuery
(
projectId
,
linkedGroupId
,
contendId
,
dto
.
getMediaTypes
(),
dto
.
getChannelEmotion
());
// time
postFilter
.
must
(
QueryBuilders
.
rangeQuery
(
dto
.
getTimeType
()).
gte
(
dto
.
getStartTime
()).
lt
(
dto
.
getEndTime
()));
// platform
...
...
@@ -1754,14 +1792,14 @@ public class MarkDataServiceImpl implements MarkDataService {
});
}
private
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
boolean
cache
)
throws
IOException
{
private
List
<
JSONObject
>
getMarkPlatformProportion
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
contendId
,
String
emotion
,
boolean
cache
)
throws
IOException
{
String
redisKey
=
RedisKeyPrefix
.
MARK_PLATFORM_PROPORTION
+
Tools
.
concat
(
projectId
,
contendId
,
startTime
,
endTime
);
String
resultStr
;
if
(
cache
&&
StringUtils
.
isNotEmpty
(
resultStr
=
redisUtil
.
get
(
redisKey
)))
{
return
JSON
.
parseArray
(
resultStr
,
JSONObject
.
class
);
}
List
<
JSONObject
>
platformList
=
commonService
.
getQbjcPlatform
(
"id"
,
"name"
);
List
<
JSONObject
>
platformsCount
=
getPlatformsCount
(
startTime
,
endTime
,
null
,
null
,
projectId
,
linkedGroupId
,
contendId
,
platformList
);
List
<
JSONObject
>
platformsCount
=
getPlatformsCount
(
startTime
,
endTime
,
null
,
null
,
projectId
,
emotion
,
contendId
,
platformList
);
long
articlesCount
=
platformsCount
.
stream
().
mapToLong
(
platform
->
platform
.
getLongValue
(
"count"
)).
sum
();
List
<
JSONObject
>
resultList
=
platformsCount
.
stream
().
peek
(
platform
->
platform
.
put
(
"proportion"
,
0
==
articlesCount
?
0
:
platform
.
getLongValue
(
"count"
)
*
1.0
/
articlesCount
)).
collect
(
Collectors
.
toList
());
redisUtil
.
setExpire
(
redisKey
,
JSON
.
toJSONString
(
resultList
));
...
...
@@ -1779,20 +1817,23 @@ public class MarkDataServiceImpl implements MarkDataService {
* @param platformList 平台集合
* @return 所有平台稿件数量信息
*/
private
List
<
JSONObject
>
getPlatformsCount
(
Long
startTime
,
Long
endTime
,
String
keyword
,
String
searchField
,
String
projectId
,
String
linkedGroupId
,
String
contendId
,
List
<
JSONObject
>
platformList
)
throws
IOException
{
private
List
<
JSONObject
>
getPlatformsCount
(
Long
startTime
,
Long
endTime
,
String
keyword
,
String
searchField
,
String
projectId
,
String
emotion
,
String
contendId
,
List
<
JSONObject
>
platformList
)
throws
IOException
{
// 获取索引
String
[]
indexes
=
esClientDao
.
getIndexes
();
// 聚合请求
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count"
).
field
(
"platform_id"
).
order
(
BucketOrder
.
count
(
false
)).
size
(
100
);
// query
BoolQueryBuilder
query
=
projectLinkedGroupContendIdQuery
(
projectId
,
linkedGroupId
,
contendId
);
BoolQueryBuilder
query
=
projectLinkedGroupContendIdQuery
(
projectId
,
null
,
contendId
);
// keyword
if
(
StringUtils
.
isNotEmpty
(
keyword
))
{
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
(
QueryBuilders
.
rangeQuery
(
"time"
).
gte
(
startTime
).
lt
(
endTime
));
if
(
null
!=
emotion
&&
!
Objects
.
equals
(
emotion
,
EmotionEnum
.
ALL
.
getName
()))
{
query
.
must
(
QueryBuilders
.
termQuery
(
"brandkbs_mark_cache_maps.name.keyword"
,
emotion
));
}
List
<
JSONObject
>
platformResultList
=
new
ArrayList
<>(
platformList
.
size
());
SearchResponse
searchResponse
=
esClientDao
.
searchResponse
(
indexes
,
null
,
query
,
aggregationBuilder
,
null
,
null
,
0
,
0
,
null
);
Map
<
String
,
Aggregation
>
aggMap
=
searchResponse
.
getAggregations
().
asMap
();
...
...
@@ -1838,7 +1879,7 @@ public class MarkDataServiceImpl implements MarkDataService {
}
}
}
long
total
=
emotionMap
.
values
().
stream
().
mapToInt
(
AtomicInteger:
:
get
AndIncrement
).
sum
();
long
total
=
emotionMap
.
values
().
stream
().
mapToInt
(
AtomicInteger:
:
get
).
sum
();
channelEmotionResult
.
put
(
"positivePercent"
,
total
==
0
?
0
:
(
double
)
emotionMap
.
get
(
ChannelEmotion
.
POSITIVE
.
getState
()).
get
()
/
total
);
channelEmotionResult
.
put
(
"negativePercent"
,
total
==
0
?
0
:
(
double
)
emotionMap
.
get
(
ChannelEmotion
.
NEGATIVE
.
getState
()).
get
()
/
total
);
channelEmotionResult
.
put
(
"neutralPercent"
,
total
==
0
?
0
:
(
double
)
emotionMap
.
get
(
ChannelEmotion
.
NEUTRAL
.
getState
()).
get
()
/
total
);
...
...
@@ -1888,9 +1929,6 @@ public class MarkDataServiceImpl implements MarkDataService {
}
public
BoolQueryBuilder
projectLinkedGroupContendIdQuery
(
String
projectId
,
String
linkedGroupId
,
String
contendId
)
{
if
(
null
==
linkedGroupId
)
{
linkedGroupId
=
projectService
.
getProjectByContendId
(
projectId
,
contendId
).
getBrandLinkedGroupId
();
}
return
EsQueryTools
.
assembleCacheMapsQuery
(
projectId
,
linkedGroupId
,
contendId
);
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkFlowServiceImpl.java
View file @
5f262d04
...
...
@@ -5,6 +5,7 @@ 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.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.ChannelDao
;
import
com.zhiwei.brandkbs2.dao.ChannelTagDao
;
...
...
@@ -110,6 +111,8 @@ public class MarkFlowServiceImpl implements MarkFlowService {
}
// C4,realSource提取展示
sourceDetails
.
put
(
"clientFrom"
,
getClientFrom
(
tJson
.
getIntValue
(
GenericAttribute
.
ES_C4
),
tJson
.
getString
(
GenericAttribute
.
ES_REAL_SOURCE
)));
// platform
sourceDetails
.
put
(
"platform"
,
GlobalPojo
.
getPlatformNameById
(
tJson
.
getString
(
"platform_id"
)));
// source
sourceDetails
.
put
(
"source"
,
source
);
// 粉丝量提取
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectServiceImpl.java
View file @
5f262d04
...
...
@@ -19,25 +19,17 @@ import com.zhiwei.brandkbs2.pojo.Project;
import
com.zhiwei.brandkbs2.pojo.User
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.pojo.vo.ProjectVO
;
import
com.zhiwei.brandkbs2.service.CommonService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.SystemInfoService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
com.zhiwei.middleware.event.core.EventTagClient
;
import
com.zhiwei.middleware.event.pojo.dto.EventTagRelatedDTO
;
import
com.zhiwei.middleware.event.pojo.entity.BrandkbsBasicInfo
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.mark.pojo.enums.TagField
;
import
com.zhiwei.middleware.mark.vo.MarkerTag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
...
...
@@ -48,7 +40,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Array
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -314,6 +305,7 @@ public class ProjectServiceImpl implements ProjectService {
json
.
put
(
"contendId"
,
"0"
);
json
.
put
(
"brandName"
,
project
.
getBrandName
());
json
.
put
(
"linkedGroupId"
,
project
.
getBrandLinkedGroupId
());
json
.
put
(
"avatarUrl"
,
project
.
getAvatarUrl
());
resultList
.
add
(
json
);
}
List
<
Contend
>
contendList
=
project
.
getContendList
();
...
...
@@ -323,6 +315,7 @@ public class ProjectServiceImpl implements ProjectService {
json
.
put
(
"contendId"
,
contend
.
getId
());
json
.
put
(
"brandName"
,
contend
.
getBrandName
());
json
.
put
(
"linkedGroupId"
,
contend
.
getBrandLinkedGroupId
());
json
.
put
(
"avatarUrl"
,
contend
.
getAvatarUrl
());
resultList
.
add
(
json
);
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
5f262d04
This diff is collapsed.
Click to expand it.
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
5f262d04
...
...
@@ -335,6 +335,7 @@ public class TaskServiceImpl implements TaskService {
// 用作生成缓存
reportService
.
getPcReportAnalyze
(
report
.
getId
(),
false
);
reportService
.
switchReportStatus
(
report
.
getId
(),
true
);
reportService
.
getMobileReportAnalyze
(
report
.
getId
(),
false
);
}
return
flag
;
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/UserCenterServiceImpl.java
View file @
5f262d04
...
...
@@ -45,7 +45,7 @@ public class UserCenterServiceImpl implements UserCenterService {
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
httpHeaders
);
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
exchange
(
yuqingInterface
+
"/thirdPart/external/verify/token"
,
HttpMethod
.
GET
,
requestEntity
,
JSONObject
.
class
);
if
(
null
!=
entity
.
getBody
()
||
!
entity
.
getBody
().
getBoolean
(
"status"
))
{
if
(
null
!=
entity
.
getBody
()
&&
entity
.
getBody
().
getBoolean
(
"status"
))
{
String
ticket
=
entity
.
getBody
().
getJSONObject
(
"data"
).
getString
(
"ticket"
);
return
ResponseResult
.
success
(
ticket
);
}
...
...
@@ -85,4 +85,28 @@ public class UserCenterServiceImpl implements UserCenterService {
}
return
entity
.
getBody
().
getObject
(
"data"
,
CenterUser
.
class
);
}
@Override
public
boolean
bindUser
(
String
ticket
,
String
userId
)
{
String
url
=
yuqingInterface
+
"/thirdPart/external/ticket/bindUser?ticket="
+
ticket
+
"&userId="
+
userId
+
"&service"
+
SERVICE_NAME
;
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
null
,
JSONObject
.
class
);
if
(
null
==
entity
.
getBody
()
||
!
entity
.
getBody
().
getBoolean
(
"status"
))
{
return
false
;
}
return
entity
.
getBody
().
getObject
(
"status"
,
Boolean
.
class
);
}
@Override
public
boolean
addProduct
(
String
userId
)
{
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
set
(
EXTERNAL_ORIGIN
,
SERVICE_NAME
);
httpHeaders
.
set
(
EXTERNAL_SERVICE
,
SERVICE_NAME
);
httpHeaders
.
set
(
EXTERNAL_TOKEN
,
token
);
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"userId"
,
userId
);
HttpEntity
<
JSONObject
>
requestEntity
=
new
HttpEntity
<>(
json
,
httpHeaders
);
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
exchange
(
yuqingInterface
+
"/thirdPart/external/user/product"
,
HttpMethod
.
POST
,
requestEntity
,
JSONObject
.
class
);
return
null
!=
entity
.
getBody
()
&&
entity
.
getBody
().
getBoolean
(
"status"
);
}
}
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
View file @
5f262d04
package
com
.
zhiwei
.
brandkbs2
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.dao.impl.UserOldDaoImpl
;
...
...
@@ -15,6 +17,7 @@ import com.zhiwei.brandkbs2.pojo.User;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
import
com.zhiwei.brandkbs2.pojo.UserRole
;
import
com.zhiwei.brandkbs2.pojo.dto.UserDTO
;
import
com.zhiwei.brandkbs2.pojo.vo.MobileLoginVO
;
import
com.zhiwei.brandkbs2.pojo.vo.PageVO
;
import
com.zhiwei.brandkbs2.service.UserCenterService
;
import
com.zhiwei.brandkbs2.service.UserService
;
...
...
@@ -23,10 +26,14 @@ import com.zhiwei.brandkbs2.util.Tools;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.Update
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.util.*
;
...
...
@@ -66,6 +73,15 @@ public class UserServiceImpl implements UserService {
@Resource
(
name
=
"userCenterServiceImpl"
)
private
UserCenterService
userCenterService
;
@Value
(
"${wx.accesstoken.url}"
)
private
String
wechatAccessTokenUrl
;
@Value
(
"${wx.getuserphonenumber}"
)
private
String
wxGetUserPhoneNumberUrl
;
@Autowired
private
RestTemplate
restTemplate
;
@Override
public
UserInfo
login
()
{
String
uid
=
UserThreadLocal
.
getUserId
();
...
...
@@ -155,6 +171,7 @@ public class UserServiceImpl implements UserService {
newUser
=
createNewUser
(
userDTO
);
}
userDao
.
insertOne
(
newUser
);
userCenterService
.
addProduct
(
newUser
.
getId
());
return
ResponseResult
.
success
();
}
List
<
UserRole
>
roles
=
user
.
getRoles
();
...
...
@@ -244,6 +261,7 @@ public class UserServiceImpl implements UserService {
newUser
=
createNewUser
(
userDTO
);
}
userDao
.
insertOne
(
newUser
);
userCenterService
.
addProduct
(
newUser
.
getId
());
return
ResponseResult
.
success
();
}
...
...
@@ -332,6 +350,56 @@ public class UserServiceImpl implements UserService {
}
@Override
public
ResponseResult
mobileLogin
(
MobileLoginVO
loginVO
)
{
Long
phoneNumber
;
if
(
null
==
(
phoneNumber
=
loginVO
.
getPhoneNumber
()))
{
// 解析code获取手机号
ResponseEntity
<
String
>
entity
=
restTemplate
.
getForEntity
(
wechatAccessTokenUrl
,
String
.
class
);
if
(
null
==
entity
.
getBody
())
{
return
ResponseResult
.
failure
(
"手机号获取失败"
);
}
String
accessToken
=
JSON
.
parseObject
(
entity
.
getBody
()).
getJSONObject
(
"data"
).
getString
(
"accessToken"
);
JSONObject
info
=
new
JSONObject
();
info
.
put
(
"code"
,
loginVO
.
getCode
());
HttpEntity
<
JSONObject
>
phoneNumberEntity
=
restTemplate
.
postForEntity
(
wxGetUserPhoneNumberUrl
+
accessToken
,
info
,
JSONObject
.
class
);
if
(
null
==
phoneNumberEntity
.
getBody
())
{
return
ResponseResult
.
failure
(
"手机号获取失败"
);
}
phoneNumber
=
Long
.
valueOf
(
phoneNumberEntity
.
getBody
().
getJSONObject
(
"phone_info"
).
getString
(
"purePhoneNumber"
));
}
User
user
=
userDao
.
findOne
(
"phoneNumber"
,
phoneNumber
);
if
(
null
==
user
)
{
return
ResponseResult
.
failure
(
"手机号未注册"
);
}
String
userCenterToken
=
getUserCenterToken
(
user
.
getId
());
if
(
null
==
userCenterToken
)
{
return
ResponseResult
.
failure
(
"用户中心校验失败"
);
}
setThreadLocalUserInfoByUser
(
user
);
// 登录状态
Map
<
String
,
Object
>
map
=
login
().
toMap
();
map
.
put
(
"token"
,
userCenterToken
);
return
ResponseResult
.
success
(
map
);
}
@Override
public
ResponseResult
mobileCutLogin
(
String
userId
,
String
projectId
)
{
UserInfo
userInfo
=
queryUserInfo
(
userId
,
projectId
);
if
(
null
==
userInfo
)
{
return
ResponseResult
.
failure
(
"未有该项目权限"
);
}
String
userCenterToken
=
getUserCenterToken
(
userInfo
.
getUserId
());
if
(
null
==
userCenterToken
)
{
return
ResponseResult
.
failure
(
"用户中心校验失败"
);
}
UserThreadLocal
.
set
(
userInfo
);
// 登录状态
Map
<
String
,
Object
>
map
=
login
().
toMap
();
map
.
put
(
"token"
,
userCenterToken
);
return
ResponseResult
.
success
(
map
);
}
@Override
public
Map
<
String
,
Object
>
getLoginInfo
()
{
// String userId = UserThreadLocal.getUserId();
// String projectId = UserThreadLocal.getProjectId();
...
...
@@ -386,4 +454,27 @@ public class UserServiceImpl implements UserService {
return
PageVO
.
createPageVo
(
pageHelper
,
resList
);
}
private
String
getUserCenterToken
(
String
userId
)
{
// 1.获取ticket
String
ticket
=
userCenterService
.
verifyToken
().
getData
().
toString
();
// 2.绑定用户
if
(
userCenterService
.
bindUser
(
ticket
,
userId
))
{
ResponseResult
responseResult
=
userCenterService
.
verifyTicket
(
ticket
);
return
((
JSONObject
)
responseResult
.
getData
()).
getString
(
"token"
);
}
return
null
;
}
private
void
setThreadLocalUserInfoByUser
(
User
user
)
{
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setUserId
(
user
.
getId
());
// 默认登录项目id
if
(
user
.
isSuperAdmin
())
{
userInfo
.
setProjectId
(
Constant
.
DEFAULT_PROJECT_ID
);
}
else
{
userInfo
.
setProjectId
(
user
.
getRoles
().
get
(
0
).
getProjectId
());
}
UserThreadLocal
.
set
(
userInfo
);
}
}
src/main/resources/application-dev.properties
View file @
5f262d04
...
...
@@ -103,4 +103,7 @@ warn.yuQing.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/bra
warn.taskSwitch.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/enable/used
#\u9884\u8B66\u5916\u90E8\u63A5\u53E3
ef.external.filterNew.url
=
https://ef.zhiweidata.com/external/filterNew.do?firstTypes={1}&start={2}&end={3}
hot.search.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findNewHotSearch?type={1}
\ No newline at end of file
hot.search.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findNewHotSearch?type={1}
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
\ No newline at end of file
src/main/resources/application-local.properties
View file @
5f262d04
...
...
@@ -106,4 +106,7 @@ warn.yuQing.url=http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/
warn.taskSwitch.url
=
http://192.168.0.225:11003/qbjc/brandkbsPush/interface/brandkbs/enable/used
#\u9884\u8B66\u5916\u90E8\u63A5\u53E3
ef.external.filterNew.url
=
https://ef.zhiweidata.com/external/filterNew.do?firstTypes={1}&start={2}&end={3}
hot.search.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findNewHotSearch?type={1}
\ No newline at end of file
hot.search.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findNewHotSearch?type={1}
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
\ No newline at end of file
src/main/resources/application-prod.properties
View file @
5f262d04
...
...
@@ -103,4 +103,7 @@ warn.yuQing.url=https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/bra
warn.taskSwitch.url
=
https://auto-push.zhiweidata.com/qbjc/brandkbsPush/interface/brandkbs/enable/used
#\u9884\u8B66\u5916\u90E8\u63A5\u53E3
ef.external.filterNew.url
=
https://ef.zhiweidata.com/external/filterNew.do?firstTypes={1}&start={2}&end={3}
hot.search.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findNewHotSearch?type={1}
\ No newline at end of file
hot.search.url
=
https://hotsearch-manage.zhiweidata.com/hotsearch/hotSearch/findNewHotSearch?type={1}
#\u5FAE\u4FE1\u76F8\u5173\u63A5\u53E3
wx.accesstoken.url
=
https://ef.zhiweidata.com/smallprogram/api/codeToken/getToken?appId=7FFBB9B377D0D28FBCF9FA481D6FF77546718A121E4BD0EA1AAB28011C53E7EE
wx.getuserphonenumber
=
https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=
\ No newline at end of file
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