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
5231cd72
Commit
5231cd72
authored
Feb 16, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
Feature See merge request
!211
parents
069d6d45
ebe46919
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
117 additions
and
47 deletions
+117
-47
src/main/java/com/zhiwei/brandkbs2/Brandkbs2Application.java
+4
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
+8
-0
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
+5
-8
src/main/java/com/zhiwei/brandkbs2/exception/ExceptionCatch.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/pojo/Report.java
+2
-0
src/main/java/com/zhiwei/brandkbs2/pojo/UserRole.java
+5
-0
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
+8
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
+26
-21
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
+1
-1
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
+45
-5
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
+0
-2
src/main/resources/pushlog.properties
+6
-6
src/test/java/com/zhiwei/brandkbs2/MarkDataServiceTest.java
+5
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/Brandkbs2Application.java
View file @
5231cd72
package
com
.
zhiwei
.
brandkbs2
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
...
...
@@ -20,9 +22,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
(
exclude
=
{
MongoAutoConfiguration
.
class
,
DataSourceAutoConfiguration
.
class
})
@EnableAspectJAutoProxy
public
class
Brandkbs2Application
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Brandkbs2Application
.
class
);
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Brandkbs2Application
.
class
,
args
);
logger
.
error
(
"Brandkbs启动完成....2023/2/15"
);
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
View file @
5231cd72
...
...
@@ -190,4 +190,12 @@ public class AppArticleController extends BaseController {
return
ResponseResult
.
success
();
}
@ApiOperation
(
"舆情简报-简报状态轮询接口"
)
@ApiImplicitParam
(
name
=
"idList"
,
value
=
"报告ID列表"
,
required
=
true
,
paramType
=
"body"
,
dataType
=
"list"
)
@PostMapping
(
"report/schedule"
)
public
ResponseResult
scheduleReportStatus
(
@RequestBody
JSONObject
json
)
{
List
<
String
>
idList
=
json
.
getJSONArray
(
"idList"
).
toJavaList
(
String
.
class
);
return
reportService
.
getReportSchedule
(
idList
);
}
}
src/main/java/com/zhiwei/brandkbs2/controller/app/AppContendController.java
View file @
5231cd72
...
...
@@ -7,23 +7,17 @@ import com.zhiwei.brandkbs2.controller.BaseController;
import
com.zhiwei.brandkbs2.easyexcel.EasyExcelUtil
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.dto.ExportAppYuqingDTO
;
import
com.zhiwei.brandkbs2.pojo.dto.MarkSearchDTO
;
import
com.zhiwei.brandkbs2.service.MarkDataService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @ClassName AppContendController
...
...
@@ -60,8 +54,11 @@ public class AppContendController extends BaseController {
@ApiOperation
(
"竞品库-竞品对比-传播分析页面"
)
@PostMapping
(
"/spread/analyze"
)
public
ResponseResult
getSpreadAnalyze
(
@RequestBody
MarkSearchDTO
markSearchDTO
)
throws
IOException
{
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
markSearchDTO
,
5
,
true
));
public
ResponseResult
getSpreadAnalyze
(
@RequestBody
JSONObject
json
)
throws
IOException
{
Long
startTime
=
json
.
getLong
(
"startTime"
);
Long
endTime
=
json
.
getLong
(
"endTime"
);
String
contendId
=
json
.
getString
(
"contendId"
);
return
ResponseResult
.
success
(
markDataService
.
getContendSpreadAnalyze
(
startTime
,
endTime
,
UserThreadLocal
.
getProjectId
(),
contendId
,
5
,
true
));
}
@ApiOperation
(
"竞品库-竞品舆情-舆情导出"
)
...
...
src/main/java/com/zhiwei/brandkbs2/exception/ExceptionCatch.java
View file @
5231cd72
...
...
@@ -34,7 +34,7 @@ public class ExceptionCatch {
Exception
exception
=
customException
.
getException
();
//记录日志
if
(
null
==
exception
)
{
log
.
error
(
"catch exception-custom:{}"
,
resultCode
.
message
());
log
.
info
(
"catch exception-custom:{}"
,
resultCode
.
message
());
}
else
{
log
.
error
(
"catch exception-custom:{}"
,
resultCode
.
message
(),
exception
);
}
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/Report.java
View file @
5231cd72
...
...
@@ -57,6 +57,8 @@ public class Report extends AbstractBaseMongo {
*/
private
String
userId
;
private
boolean
status
;
public
static
Report
createFromReportDTO
(
ReportDTO
reportDTO
)
{
Report
report
=
new
Report
();
report
.
setTitle
(
reportDTO
.
getTitle
());
...
...
src/main/java/com/zhiwei/brandkbs2/pojo/UserRole.java
View file @
5231cd72
...
...
@@ -56,6 +56,11 @@ public class UserRole {
*/
private
Integer
exportAmount
;
public
void
setRoleId
(
Integer
roleId
)
{
this
.
roleId
=
roleId
;
this
.
key
=
Tools
.
concat
(
projectId
,
roleId
);
}
public
UserRole
(
String
projectId
,
int
roleId
,
Long
expiredTime
,
Integer
exportAmount
)
{
this
.
projectId
=
projectId
;
this
.
roleId
=
roleId
;
...
...
src/main/java/com/zhiwei/brandkbs2/service/MarkDataService.java
View file @
5231cd72
...
...
@@ -228,7 +228,7 @@ public interface MarkDataService {
* @param cache 是否启用缓存
* @return JSONObject
*/
JSONObject
getContendSpreadAnalyze
(
MarkSearchDTO
markSearchDTO
,
int
hotArticleSize
,
boolean
c
ache
)
throws
IOException
;
JSONObject
getContendSpreadAnalyze
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
contendId
,
int
hotArticleSize
,
boolean
useC
ache
)
throws
IOException
;
/**
* 竞品库-舆情导出
...
...
src/main/java/com/zhiwei/brandkbs2/service/ReportService.java
View file @
5231cd72
package
com
.
zhiwei
.
brandkbs2
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.Report
;
import
com.zhiwei.brandkbs2.pojo.ReportSettings
;
...
...
@@ -111,4 +112,11 @@ public interface ReportService {
*/
void
deleteReportById
(
String
id
);
/**
* 获取ID列表查询状态结果
* @param idList
* @return
*/
ResponseResult
getReportSchedule
(
List
<
String
>
idList
);
}
src/main/java/com/zhiwei/brandkbs2/service/impl/MarkDataServiceImpl.java
View file @
5231cd72
...
...
@@ -1108,46 +1108,45 @@ public class MarkDataServiceImpl implements MarkDataService {
}
@Override
public
JSONObject
getContendSpreadAnalyze
(
MarkSearchDTO
dto
,
int
hotArticleSize
,
boolean
cache
)
throws
IOException
{
defaultContendDTO
(
dto
);
ProjectVO
project
=
projectService
.
getProjectVOById
(
dto
.
getProjectId
());
public
JSONObject
getContendSpreadAnalyze
(
Long
startTime
,
Long
endTime
,
String
projectId
,
String
contendId
,
int
hotArticleSize
,
boolean
cache
)
throws
IOException
{
ProjectVO
project
=
projectService
.
getProjectVOById
(
projectId
);
// 竞品的名字
AbstractProject
projectByContendId
=
projectService
.
getProjectByContendId
(
dto
.
getProjectId
(),
dto
.
getContendId
()
);
AbstractProject
projectByContendId
=
projectService
.
getProjectByContendId
(
projectId
,
contendId
);
String
brandName
=
projectByContendId
.
getBrandName
();
String
contendLinkedGroupId
=
projectByContendId
.
getBrandLinkedGroupId
();
// 缓存
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
Constant
.
DAY_PATTERN
);
String
startTimeStr
=
sdf
.
format
(
dto
.
getStartTime
()
);
String
endTimeStr
=
sdf
.
format
(
dto
.
getEndTime
()
);
String
redisKey
=
RedisKeyPrefix
.
INDEX_COMPARE_ANALYZE
+
Tools
.
concat
(
dto
.
getProjectId
(),
dto
.
getContendId
()
,
startTimeStr
,
endTimeStr
,
hotArticleSize
);
String
startTimeStr
=
sdf
.
format
(
startTime
);
String
endTimeStr
=
sdf
.
format
(
endTime
);
String
redisKey
=
RedisKeyPrefix
.
INDEX_COMPARE_ANALYZE
+
Tools
.
concat
(
projectId
,
contendId
,
startTimeStr
,
endTimeStr
,
hotArticleSize
);
if
(
cache
)
{
String
result
=
redisUtil
.
get
(
redisKey
);
if
(
Objects
.
nonNull
(
result
))
{
return
JSON
.
parseObject
(
result
);
}
}
List
<
Map
<
String
,
Long
>>
dayList
=
Tools
.
parseToDays
(
dto
.
getStartTime
(),
dto
.
getEndTime
()
);
List
<
Map
<
String
,
Long
>>
dayList
=
Tools
.
parseToDays
(
startTime
,
endTime
);
List
<
JSONObject
>
resList
=
new
ArrayList
<>(
2
);
JSONObject
result
=
new
JSONObject
();
// 开始时间
result
.
put
(
"startTime"
,
dto
.
getStartTime
()
);
result
.
put
(
"startTime"
,
startTime
);
// 结束时间
result
.
put
(
"endTime"
,
dto
.
getEndTime
()
);
result
.
put
(
"endTime"
,
endTime
);
// 主品牌图谱
JSONObject
primaryLine
=
new
JSONObject
();
primaryLine
.
put
(
"id"
,
Constant
.
PRIMARY_CONTEND_ID
);
primaryLine
.
put
(
"brand"
,
project
.
getBrandName
());
List
<
LineVO
>
primarySpread
=
getArticleSpread
(
dto
.
getProjectId
(),
dto
.
get
LinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
dayList
);
List
<
LineVO
>
primarySpread
=
getArticleSpread
(
projectId
,
project
.
getBrand
LinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
dayList
);
primaryLine
.
put
(
"spread"
,
primarySpread
);
resList
.
add
(
primaryLine
);
result
.
put
(
"days"
,
primarySpread
.
size
());
// 竞品图谱
JSONObject
contendLine
=
new
JSONObject
();
contendLine
.
put
(
"id"
,
dto
.
getContendId
()
);
contendLine
.
put
(
"id"
,
contendId
);
contendLine
.
put
(
"brand"
,
brandName
);
List
<
LineVO
>
contendSpread
=
getArticleSpread
(
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
()
,
dayList
);
List
<
LineVO
>
contendSpread
=
getArticleSpread
(
projectId
,
contendLinkedGroupId
,
contendId
,
dayList
);
contendLine
.
put
(
"spread"
,
contendSpread
);
resList
.
add
(
contendLine
);
result
.
put
(
"spread"
,
resList
);
...
...
@@ -1167,20 +1166,23 @@ public class MarkDataServiceImpl implements MarkDataService {
long
priMaxDayStartTime
=
primaryMax
.
getDate
();
long
priMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
primaryMax
.
getDate
()),
1
).
getTime
();
// 获取时间段某情感数据最多的标题
List
<
Map
.
Entry
<
String
,
Integer
>>
priTopTitle
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
1
);
List
<
Map
.
Entry
<
String
,
Integer
>>
priTopTitle
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
project
.
getBrandLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
1
);
if
(
CollectionUtils
.
isNotEmpty
(
priTopTitle
))
{
// 首发稿件
BaseMap
priFirstArticle
=
getFirstArticle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
priTopTitle
.
get
(
0
).
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
BaseMap
priFirstArticle
=
getFirstArticle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
priTopTitle
.
get
(
0
).
getKey
(),
projectId
,
project
.
getBrandLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
result
.
put
(
"priTopTitle"
,
priFirstArticle
.
getTitle
());
result
.
put
(
"priTopTitleUrl"
,
priFirstArticle
.
getUrl
());
}
// 获取主品牌热门媒体方向
List
<
Map
.
Entry
<
String
,
Integer
>>
priHotTitles
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
dto
.
get
LinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
hotArticleSize
);
List
<
Map
.
Entry
<
String
,
Integer
>>
priHotTitles
=
getMarkTopTitle
(
priMaxDayStartTime
,
priMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
project
.
getBrand
LinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
,
hotArticleSize
);
if
(
CollectionUtils
.
isNotEmpty
(
priHotTitles
))
{
List
<
JSONObject
>
priHotArticle
=
priHotTitles
.
stream
().
map
(
map
->
{
JSONObject
jsonObject
=
new
JSONObject
();
try
{
BaseMap
priFirstArticle
=
getFirstArticle
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
map
.
getKey
(),
dto
.
getProjectId
(),
dto
.
getLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
BaseMap
priFirstArticle
=
getFirstArticle
(
startTime
,
endTime
,
map
.
getKey
(),
projectId
,
project
.
getBrandLinkedGroupId
(),
Constant
.
PRIMARY_CONTEND_ID
);
if
(
null
!=
priFirstArticle
)
{
jsonObject
.
put
(
"title"
,
priFirstArticle
.
getTitle
());
jsonObject
.
put
(
"url"
,
priFirstArticle
.
getUrl
());
...
...
@@ -1209,20 +1211,23 @@ public class MarkDataServiceImpl implements MarkDataService {
result
.
put
(
"conMaxCount"
,
contendMax
.
getCount
());
long
conMaxDayStartTime
=
contendMax
.
getDate
();
long
conMaxDayEndTime
=
DateUtils
.
addDays
(
new
Date
(
contendMax
.
getDate
()),
1
).
getTime
();
List
<
Map
.
Entry
<
String
,
Integer
>>
conTopTitle
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
(),
1
);
List
<
Map
.
Entry
<
String
,
Integer
>>
conTopTitle
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendLinkedGroupId
,
contendId
,
1
);
if
(
CollectionUtils
.
isNotEmpty
(
conTopTitle
))
{
// 首发稿件
BaseMap
conFirstArticle
=
getFirstArticle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
conTopTitle
.
get
(
0
).
getKey
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
());
BaseMap
conFirstArticle
=
getFirstArticle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
conTopTitle
.
get
(
0
).
getKey
(),
projectId
,
contendLinkedGroupId
,
contendId
);
result
.
put
(
"conTopTitle"
,
conFirstArticle
.
getTitle
());
result
.
put
(
"conTopTitleUrl"
,
conFirstArticle
.
getUrl
());
}
// 获取竞品热门媒体方向
List
<
Map
.
Entry
<
String
,
Integer
>>
conHotTitles
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
(),
hotArticleSize
);
List
<
Map
.
Entry
<
String
,
Integer
>>
conHotTitles
=
getMarkTopTitle
(
conMaxDayStartTime
,
conMaxDayEndTime
,
EmotionEnum
.
ALL
.
getName
(),
projectId
,
contendLinkedGroupId
,
contendId
,
hotArticleSize
);
if
(
CollectionUtils
.
isNotEmpty
(
conHotTitles
))
{
List
<
JSONObject
>
conHotArticle
=
conHotTitles
.
stream
().
map
(
map
->
{
JSONObject
jsonObject
=
new
JSONObject
();
try
{
BaseMap
conFirstArticle
=
getFirstArticle
(
dto
.
getStartTime
(),
dto
.
getEndTime
(),
map
.
getKey
(),
dto
.
getProjectId
(),
contendLinkedGroupId
,
dto
.
getContendId
()
);
BaseMap
conFirstArticle
=
getFirstArticle
(
startTime
,
endTime
,
map
.
getKey
(),
projectId
,
contendLinkedGroupId
,
contendId
);
if
(
null
!=
conFirstArticle
)
{
jsonObject
.
put
(
"title"
,
conFirstArticle
.
getTitle
());
jsonObject
.
put
(
"url"
,
conFirstArticle
.
getUrl
());
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
View file @
5231cd72
...
...
@@ -94,7 +94,7 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
TYPE_SEARCH
.
put
(
"抖音热搜"
,
"douyin"
);
TYPE_SEARCH
.
put
(
"知乎热搜"
,
"zhihu"
);
TYPE_SEARCH
.
put
(
"B站热搜"
,
"bilibili-ranking"
);
TYPE_SEARCH
.
put
(
"快手热
搜
"
,
"kuaishou"
);
TYPE_SEARCH
.
put
(
"快手热
榜
"
,
"kuaishou"
);
}
@Override
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ReportServiceImpl.java
View file @
5231cd72
...
...
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.google.common.collect.Maps
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.EventDao
;
import
com.zhiwei.brandkbs2.dao.EventDataDao
;
import
com.zhiwei.brandkbs2.dao.ReportDao
;
...
...
@@ -16,7 +15,11 @@ import com.zhiwei.brandkbs2.enmus.response.ReportCodeEnum;
import
com.zhiwei.brandkbs2.exception.ExceptionCast
;
import
com.zhiwei.brandkbs2.listener.ApplicationProjectListener
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
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
;
...
...
@@ -271,7 +274,8 @@ public class ReportServiceImpl implements ReportService {
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("status", null != redisUtil.get(RedisKeyPrefix.REPORT_PC + report.getId()));
result
.
put
(
"status"
,
report
.
isStatus
());
result
.
put
(
"title"
,
report
.
getTitle
());
result
.
put
(
"startTime"
,
report
.
getStartTime
());
result
.
put
(
"endTime"
,
report
.
getEndTime
());
...
...
@@ -286,7 +290,11 @@ public class ReportServiceImpl implements ReportService {
@Override
public
void
addCustomReport
(
ReportDTO
reportDTO
)
{
reportDao
.
insertOneWithoutId
(
Report
.
createFromReportDTO
(
reportDTO
));
Report
report
=
Report
.
createFromReportDTO
(
reportDTO
);
reportDao
.
insertOneWithoutId
(
report
);
ApplicationProjectListener
.
getThreadPool
().
execute
(()
->
{
getPcReportAnalyze
(
report
.
getId
(),
false
);
});
}
@Override
...
...
@@ -295,6 +303,30 @@ public class ReportServiceImpl implements ReportService {
reportDao
.
deleteOneByIdWithQuery
(
id
,
Query
.
query
(
Criteria
.
where
(
"type"
).
is
(
ReportTypeEnum
.
CUSTOM
.
getState
())));
}
@Override
public
ResponseResult
getReportSchedule
(
List
<
String
>
idList
)
{
if
(
null
==
idList
||
idList
.
isEmpty
())
{
return
ResponseResult
.
success
();
}
boolean
isEnd
=
true
;
Map
<
String
,
Boolean
>
listStatus
=
new
HashMap
<>();
for
(
String
id
:
idList
)
{
Report
report
=
reportDao
.
findOneById
(
id
);
if
(
null
==
report
)
{
listStatus
.
put
(
id
,
true
);
continue
;
}
if
(!
report
.
isStatus
())
{
isEnd
=
false
;
}
listStatus
.
put
(
id
,
report
.
isStatus
());
}
JSONObject
res
=
new
JSONObject
();
res
.
put
(
"isEnd"
,
isEnd
);
res
.
put
(
"listStatus"
,
listStatus
);
return
ResponseResult
.
success
(
res
);
}
/**
* 获取PC端月报结果
*
...
...
@@ -302,6 +334,8 @@ public class ReportServiceImpl implements ReportService {
* @return 月报结果
*/
private
JSONObject
getPcReportResult
(
Report
report
)
throws
IOException
{
switchReportStatus
(
report
.
getId
(),
false
);
log
.
info
(
"getPcReportResult-生成报告开始,id:{}"
,
report
.
getId
());
Long
startTime
=
report
.
getStartTime
();
Long
endTime
=
report
.
getEndTime
();
Long
lastStartTimeStr
=
startTime
-
(
endTime
-
startTime
);
...
...
@@ -323,10 +357,16 @@ public class ReportServiceImpl implements ReportService {
AbstractProject
abstractProject
=
projectService
.
getProjectByContendId
(
projectId
,
brandContendId
);
json
.
put
(
"id"
,
brandContendId
);
json
.
put
(
"brand"
,
abstractProject
.
getBrandName
());
json
.
put
(
"brandCompare"
,
indexService
.
getSpreadingTend
(
startTime
,
endTime
,
projectId
,
contendId
,
true
));
try
{
json
.
put
(
"brandCompare"
,
markDataService
.
getContendSpreadAnalyze
(
startTime
,
endTime
,
projectId
,
brandContendId
,
5
,
true
));
}
catch
(
IOException
e
)
{
log
.
error
(
"getPcReportResult-brandCompare-"
,
e
);
}
return
json
;
}).
collect
(
Collectors
.
toList
());
result
.
put
(
"contendCompare"
,
contendCompare
);
log
.
info
(
"getPcReportResult-生成报告结束,id:{}"
,
report
.
getId
());
switchReportStatus
(
report
.
getId
(),
true
);
return
result
;
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/TaskServiceImpl.java
View file @
5231cd72
...
...
@@ -306,7 +306,6 @@ public class TaskServiceImpl implements TaskService {
Report
report
=
booleanReportPair
.
getRight
();
// 用作生成缓存
reportService
.
getPcReportAnalyze
(
report
.
getId
(),
false
);
reportService
.
switchReportStatus
(
report
.
getId
(),
true
);
}
flag
=
true
;
}
...
...
@@ -315,7 +314,6 @@ public class TaskServiceImpl implements TaskService {
for
(
Report
report
:
reportService
.
getCustomReportByStatus
(
project
.
getId
(),
false
))
{
// 用作生成缓存
reportService
.
getPcReportAnalyze
(
report
.
getId
(),
false
);
reportService
.
switchReportStatus
(
report
.
getId
(),
true
);
}
return
flag
;
}
...
...
src/main/resources/pushlog.properties
View file @
5231cd72
...
...
@@ -10,8 +10,8 @@ dev.robot.push.filterclass=org.apache.dubbo.common.Version,com.alibaba.dubbo.com
dev.robot.push.level
=
error
dev.robot.push.app.name
=
brandkbs2-dev
prod.robot.push.address
=
https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=759b600c-d47a-4c6b-9a9b-90b6c80d343c
prod.robot.push.enable
=
true
prod.robot.push.filterclass
=
org.apache.dubbo.common.Version,com.alibaba.dubbo.common.Version,org.apache.dubbo.monitor.dubbo.DubboMonitor,com.alibaba.dubbo
\.
monitor.dubbo.DubboMonitor
prod.robot.push.level
=
error
prod.robot.push.app.name
=
brandkbs2-prod
\ No newline at end of file
pro.robot.push.address
=
https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=759b600c-d47a-4c6b-9a9b-90b6c80d343c
pro.robot.push.enable
=
true
pro.robot.push.filterclass
=
org.apache.dubbo.common.Version,com.alibaba.dubbo.common.Version,org.apache.dubbo.monitor.dubbo.DubboMonitor,com.alibaba.dubbo.monitor.dubbo.DubboMonitor
pro.robot.push.level
=
error
pro.robot.push.app.name
=
brandkbs2-prod
\ No newline at end of file
src/test/java/com/zhiwei/brandkbs2/MarkDataServiceTest.java
View file @
5231cd72
...
...
@@ -167,8 +167,11 @@ public class MarkDataServiceTest {
@Test
public
void
getContendSpreadAnalyzeTest
()
throws
IOException
{
MarkSearchDTO
dto
=
new
MarkSearchDTO
();
JSONObject
contendSpreadAnalyze
=
markDataService
.
getContendSpreadAnalyze
(
dto
,
5
,
false
);
Long
startTime
=
null
;
Long
endTime
=
null
;
String
projectId
=
null
;
String
contendId
=
null
;
JSONObject
contendSpreadAnalyze
=
markDataService
.
getContendSpreadAnalyze
(
startTime
,
endTime
,
projectId
,
contendId
,
5
,
false
);
System
.
out
.
println
(
contendSpreadAnalyze
);
}
...
...
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