Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 46a8c3a1
authored
Jan 09, 2021
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev
2 parents
0dc3777a
491121c4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
69 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterFontController.java
linkwe-common/src/main/java/com/linkwechat/common/core/elasticsearch/ElasticSearch.java
linkwe-common/src/main/java/com/linkwechat/common/utils/img/NetFileUtils.java
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/RyTask.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatContactMappingService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatContactMappingServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePosterServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeSensitiveServiceImpl.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterController.java
View file @
46a8c3a
...
...
@@ -5,22 +5,19 @@ import com.linkwechat.common.core.domain.AjaxResult;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.domain.WeMaterial
;
import
com.linkwechat.wecom.domain.WePoster
;
import
com.linkwechat.wecom.domain.WePosterFont
;
import
com.linkwechat.wecom.domain.WePosterSubassembly
;
import
com.linkwechat.wecom.service.IWePosterFontService
;
import
com.linkwechat.wecom.service.IWePosterService
;
import
com.linkwechat.wecom.service.IWePosterSubassemblyService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.awt.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -46,8 +43,9 @@ public class WePosterController extends BaseController {
@PostMapping
(
value
=
"insert"
)
@ApiOperation
(
"创建海报"
)
@PreAuthorize
(
"@ss.hasAnyPermi('wecom:poster:insert')"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AjaxResult
insert
(
@RequestBody
WePoster
poster
){
public
AjaxResult
insert
(
@RequestBody
WePoster
poster
)
{
wePosterService
.
generateSimpleImg
(
poster
);
poster
.
setId
(
SnowFlakeUtil
.
nextId
());
poster
.
setDelFlag
(
0
);
...
...
@@ -68,37 +66,38 @@ public class WePosterController extends BaseController {
@PutMapping
(
value
=
"update"
)
@ApiOperation
(
"修改海报"
)
@PreAuthorize
(
"@ss.hasAnyPermi('wecom:poster:update')"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AjaxResult
update
(
@RequestBody
WePoster
poster
){
if
(
poster
.
getId
()
==
null
)
{
public
AjaxResult
update
(
@RequestBody
WePoster
poster
)
{
if
(
poster
.
getId
()
==
null
)
{
return
AjaxResult
.
error
(
"id为空"
);
}
poster
.
setMediaType
(
null
);
wePosterService
.
generateSimpleImg
(
poster
);
wePosterService
.
saveOrUpdate
(
poster
);
List
<
WePosterSubassembly
>
posterSubassemblyList
=
wePosterSubassemblyService
.
lambdaQuery
().
eq
(
WePosterSubassembly:
:
getPosterId
,
poster
.
getId
()).
eq
(
WePosterSubassembly:
:
getDelFlag
,
1
).
list
();
Map
<
Long
,
WePosterSubassembly
>
posterSubassemblyMap
=
posterSubassemblyList
.
stream
().
collect
(
Collectors
.
toMap
(
WePosterSubassembly:
:
getId
,
p
->
p
));
List
<
WePosterSubassembly
>
posterSubassemblyList
=
wePosterSubassemblyService
.
lambdaQuery
().
eq
(
WePosterSubassembly:
:
getPosterId
,
poster
.
getId
()).
eq
(
WePosterSubassembly:
:
getDelFlag
,
1
).
list
();
Map
<
Long
,
WePosterSubassembly
>
posterSubassemblyMap
=
posterSubassemblyList
.
stream
().
collect
(
Collectors
.
toMap
(
WePosterSubassembly:
:
getId
,
p
->
p
));
List
<
WePosterSubassembly
>
insertList
=
new
ArrayList
<>();
List
<
WePosterSubassembly
>
updateList
=
new
ArrayList
<>();
poster
.
getPosterSubassemblyList
().
forEach
(
wePosterSubassembly
->
{
if
(
wePosterSubassembly
.
getId
()
==
null
)
{
if
(
wePosterSubassembly
.
getId
()
==
null
)
{
wePosterSubassembly
.
setId
(
SnowFlakeUtil
.
nextId
());
wePosterSubassembly
.
setPosterId
(
poster
.
getId
());
wePosterSubassembly
.
setDelFlag
(
0
);
insertList
.
add
(
wePosterSubassembly
);
}
else
{
}
else
{
posterSubassemblyMap
.
remove
(
wePosterSubassembly
.
getId
());
updateList
.
add
(
wePosterSubassembly
);
}
});
if
(!
CollectionUtils
.
isEmpty
(
insertList
))
{
if
(!
CollectionUtils
.
isEmpty
(
insertList
))
{
wePosterSubassemblyService
.
saveBatch
(
insertList
);
}
if
(!
CollectionUtils
.
isEmpty
(
updateList
))
{
if
(!
CollectionUtils
.
isEmpty
(
updateList
))
{
wePosterSubassemblyService
.
updateBatchById
(
updateList
);
}
List
<
WePosterSubassembly
>
deleteList
=
new
ArrayList
<>(
posterSubassemblyMap
.
values
());
if
(!
CollectionUtils
.
isEmpty
(
deleteList
))
{
if
(!
CollectionUtils
.
isEmpty
(
deleteList
))
{
deleteList
.
forEach
(
wePosterSubassembly
->
wePosterSubassembly
.
setDelFlag
(
1
));
wePosterSubassemblyService
.
updateBatchById
(
deleteList
);
}
...
...
@@ -118,19 +117,21 @@ public class WePosterController extends BaseController {
}*/
@GetMapping
(
value
=
"entity/{id}"
)
@PreAuthorize
(
"@ss.hasAnyPermi('wecom:poster:entity')"
)
@ApiOperation
(
"查询海报详情"
)
public
AjaxResult
entity
(
@PathVariable
Long
id
){
public
AjaxResult
entity
(
@PathVariable
Long
id
)
{
return
AjaxResult
.
success
(
wePosterService
.
selectOne
(
id
));
}
@GetMapping
(
value
=
"page"
)
@ApiOperation
(
"分页查询海报"
)
public
AjaxResult
page
(
Long
categoryId
,
String
name
){
@PreAuthorize
(
"@ss.hasAnyPermi('wecom:poster:page')"
)
public
AjaxResult
page
(
Long
categoryId
,
String
name
)
{
startPage
();
List
<
WePoster
>
fontList
=
wePosterService
.
lambdaQuery
()
.
eq
(
WePoster:
:
getDelFlag
,
0
)
.
eq
(
categoryId
!=
null
,
WePoster:
:
getCategoryId
,
categoryId
)
.
like
(
StringUtils
.
isNotBlank
(
name
),
WePoster:
:
getTitle
,
name
)
.
eq
(
WePoster:
:
getDelFlag
,
0
)
.
eq
(
categoryId
!=
null
,
WePoster:
:
getCategoryId
,
categoryId
)
.
like
(
StringUtils
.
isNotBlank
(
name
),
WePoster:
:
getTitle
,
name
)
.
orderByDesc
(
WePoster:
:
getCreateTime
)
.
list
();
return
AjaxResult
.
success
(
getDataTable
(
fontList
));
...
...
@@ -138,14 +139,15 @@ public class WePosterController extends BaseController {
@DeleteMapping
(
value
=
"delete/{id}"
)
@ApiOperation
(
value
=
"删除海报"
)
@PreAuthorize
(
"@ss.hasAnyPermi('wecom:poster:delete')"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AjaxResult
deletePosterFont
(
@PathVariable
Long
id
){
wePosterService
.
lambdaUpdate
().
set
(
WePoster:
:
getDelFlag
,
1
).
eq
(
WePoster:
:
getId
,
id
);
wePosterSubassemblyService
.
lambdaUpdate
().
set
(
WePosterSubassembly:
:
getDelFlag
,
1
).
eq
(
WePosterSubassembly:
:
getPosterId
,
id
);
public
AjaxResult
deletePosterFont
(
@PathVariable
Long
id
)
{
wePosterService
.
update
(
wePosterService
.
lambdaUpdate
().
set
(
WePoster:
:
getDelFlag
,
1
).
eq
(
WePoster:
:
getId
,
id
));
wePosterSubassemblyService
.
update
(
wePosterSubassemblyService
.
lambdaUpdate
().
set
(
WePosterSubassembly:
:
getDelFlag
,
1
).
eq
(
WePosterSubassembly:
:
getPosterId
,
id
));
return
AjaxResult
.
success
(
"删除成功"
);
}
}
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterFontController.java
View file @
46a8c3a
...
...
@@ -4,7 +4,6 @@ import com.linkwechat.common.core.controller.BaseController;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.web.controller.common.CommonController
;
import
com.linkwechat.wecom.domain.WePosterFont
;
import
com.linkwechat.wecom.service.IWePosterFontService
;
import
io.swagger.annotations.Api
;
...
...
@@ -30,7 +29,7 @@ public class WePosterFontController extends BaseController {
@PostMapping
(
value
=
"posterFont"
)
@ApiOperation
(
"创建海报字体"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AjaxResult
insertPosterFont
(
@RequestBody
WePosterFont
posterFont
){
public
AjaxResult
insertPosterFont
(
@RequestBody
WePosterFont
posterFont
)
{
posterFont
.
setId
(
SnowFlakeUtil
.
nextId
());
posterFont
.
setDelFlag
(
0
);
posterFont
.
setMediaType
(
MediaType
.
POSTER_FONT
.
getType
());
...
...
@@ -42,8 +41,8 @@ public class WePosterFontController extends BaseController {
@PutMapping
(
value
=
"posterFont"
)
@ApiOperation
(
"修改海报字体"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AjaxResult
updatePosterFont
(
@RequestBody
WePosterFont
posterFont
){
if
(
posterFont
.
getId
()
==
null
)
{
public
AjaxResult
updatePosterFont
(
@RequestBody
WePosterFont
posterFont
)
{
if
(
posterFont
.
getId
()
==
null
)
{
return
AjaxResult
.
error
(
"id为空"
);
}
posterFont
.
setMediaType
(
null
);
...
...
@@ -53,9 +52,9 @@ public class WePosterFontController extends BaseController {
@GetMapping
(
value
=
"posterFontList"
)
@ApiOperation
(
"列表查询海报字体"
)
public
AjaxResult
selectPosterFontList
(){
public
AjaxResult
selectPosterFontList
()
{
List
<
WePosterFont
>
fontList
=
wePosterFontService
.
lambdaQuery
()
.
eq
(
WePosterFont:
:
getDelFlag
,
0
)
.
eq
(
WePosterFont:
:
getDelFlag
,
0
)
.
orderByDesc
(
WePosterFont:
:
getOrder
)
.
orderByDesc
(
WePosterFont:
:
getCreateTime
)
.
list
();
...
...
@@ -64,10 +63,10 @@ public class WePosterFontController extends BaseController {
@GetMapping
(
value
=
"posterFontPage"
)
@ApiOperation
(
"分页查询海报字体"
)
public
AjaxResult
selectPosterFontPage
(){
public
AjaxResult
selectPosterFontPage
()
{
startPage
();
List
<
WePosterFont
>
fontList
=
wePosterFontService
.
lambdaQuery
()
.
eq
(
WePosterFont:
:
getDelFlag
,
0
)
.
eq
(
WePosterFont:
:
getDelFlag
,
0
)
.
orderByDesc
(
WePosterFont:
:
getOrder
)
.
orderByDesc
(
WePosterFont:
:
getCreateTime
)
.
list
();
...
...
@@ -77,11 +76,11 @@ public class WePosterFontController extends BaseController {
@DeleteMapping
(
value
=
"posterFont/{id}"
)
@ApiOperation
(
"删除海报字体"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
AjaxResult
deletePosterFont
(
@PathVariable
Long
id
){
wePosterFontService
.
lambdaUpdate
().
set
(
WePosterFont:
:
getDelFlag
,
1
).
eq
(
WePosterFont:
:
getId
,
id
);
public
AjaxResult
deletePosterFont
(
@PathVariable
Long
id
)
{
wePosterFontService
.
update
(
wePosterFontService
.
lambdaUpdate
().
set
(
WePosterFont:
:
getDelFlag
,
1
).
eq
(
WePosterFont:
:
getId
,
id
));
return
AjaxResult
.
success
(
"删除成功"
);
}
}
linkwe-common/src/main/java/com/linkwechat/common/core/elasticsearch/ElasticSearch.java
View file @
46a8c3a
...
...
@@ -216,7 +216,7 @@ public class ElasticSearch {
*/
public
void
insertBatchAsync
(
String
idxName
,
List
<
JSONObject
>
list
,
List
<
Consumer
<
List
<
JSONObject
>>>
consumers
)
{
BulkRequest
request
=
new
BulkRequest
();
list
.
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getString
(
"msgid"
))
list
.
parallelStream
().
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getString
(
"msgid"
))
.
source
(
item
,
XContentType
.
JSON
)));
try
{
restHighLevelClient
.
bulkAsync
(
request
,
RequestOptions
.
DEFAULT
,
getActionListener
(
list
,
consumers
));
...
...
linkwe-common/src/main/java/com/linkwechat/common/utils/img/NetFileUtils.java
View file @
46a8c3a
...
...
@@ -25,19 +25,6 @@ public class NetFileUtils {
private
static
final
WebClient
webClient
=
WebClient
.
create
(
vertx
);
public
static
void
main
(
String
[]
args
)
{
FileCallable
fileCallable
=
getNetFile
(
"https://pc-index-skin.cdn.bcebos.com/hiphoto/51631423522.jpg?x-bce-process=image/crop,x_0,y_13,w_1999,h_1250"
);
ByteArrayOutputStream
byteArrayOutputStream
=
getByteArrayOutputStream
(
fileCallable
,
true
);
StreamMultipartFile
file
=
new
StreamMultipartFile
(
"你好啊.jpg"
,
byteArrayOutputStream
.
toByteArray
());
File
f
=
new
File
(
"D:/网页/2.jpg"
);
try
{
file
.
transferTo
(
f
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
static
FileCallable
getNetFile
(
String
urlPath
){
FileCallable
fileCallable
=
new
FileCallable
();
...
...
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/RyTask.java
View file @
46a8c3a
...
...
@@ -76,10 +76,10 @@ public class RyTask {
""
,
redisCache
);
if
(
CollectionUtil
.
isNotEmpty
(
chatDataList
)){
try
{
List
<
JSONObject
>
elasticSearchEntities
=
weChatContactMappingService
.
saveWeChatContactMapping
(
chatDataList
);
List
<
Consumer
<
List
<
JSONObject
>>>
consumerList
=
Lists
.
newArrayList
();
consumerList
.
add
(
weChatContactMappingService:
:
saveWeChatContactMapping
);
consumerList
.
add
(
weSensitiveService:
:
hitSensitive
);
elasticSearch
.
insertBatchAsync
(
WeConstans
.
WECOM_FINANCE_INDEX
,
chatDataList
,
consumerList
);
elasticSearch
.
insertBatchAsync
(
WeConstans
.
WECOM_FINANCE_INDEX
,
elasticSearchEntities
,
consumerList
);
}
catch
(
Exception
e
)
{
log
.
error
(
"消息处理异常:ex:{}"
,
e
);
e
.
printStackTrace
();
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatContactMappingService.java
View file @
46a8c3a
...
...
@@ -70,7 +70,7 @@ public interface IWeChatContactMappingService extends IService<WeChatContactMapp
*
* @param query
*/
public
List
<
ElasticSearchEntity
>
saveWeChatContactMapping
(
List
<
JSONObject
>
query
);
public
List
<
JSONObject
>
saveWeChatContactMapping
(
List
<
JSONObject
>
query
);
/**
* 按客户查询关系映射列表
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatContactMappingServiceImpl.java
View file @
46a8c3a
...
...
@@ -160,11 +160,9 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
* @param query
*/
@Override
public
List
<
ElasticSearchEntity
>
saveWeChatContactMapping
(
List
<
JSONObject
>
query
)
{
List
<
ElasticSearchEntity
>
resultList
=
new
ArrayList
<>();
public
List
<
JSONObject
>
saveWeChatContactMapping
(
List
<
JSONObject
>
query
)
{
List
<
JSONObject
>
resultList
=
new
ArrayList
<>();
query
.
stream
().
filter
(
chatData
->
StringUtils
.
isNotEmpty
(
chatData
.
getString
(
"from"
))).
forEach
(
chatData
->
{
ElasticSearchEntity
elasticSearchEntity
=
new
ElasticSearchEntity
();
elasticSearchEntity
.
setId
(
chatData
.
getString
(
"msgid"
));
//发送人映射数据
WeChatContactMapping
fromWeChatContactMapping
=
new
WeChatContactMapping
();
String
fromId
=
chatData
.
getString
(
"from"
);
...
...
@@ -194,8 +192,7 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
WeChatContactMapping
reveiceWeChatContactMapping
=
from2ReveiceData
(
fromType
,
fromWeChatContactMapping
);
insertWeChatContactMapping
(
fromWeChatContactMapping
);
insertWeChatContactMapping
(
reveiceWeChatContactMapping
);
elasticSearchEntity
.
setData
(
chatData
);
resultList
.
add
(
elasticSearchEntity
);
resultList
.
add
(
chatData
);
});
return
resultList
;
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePosterServiceImpl.java
View file @
46a8c3a
...
...
@@ -7,10 +7,12 @@ import com.linkwechat.common.utils.file.FileUploadUtils;
import
com.linkwechat.common.utils.file.FileUtils
;
import
com.linkwechat.common.utils.img.ImageUtils
;
import
com.linkwechat.common.utils.img.NetFileUtils
;
import
com.linkwechat.wecom.domain.WeCategory
;
import
com.linkwechat.wecom.domain.WePoster
;
import
com.linkwechat.wecom.domain.WePosterFont
;
import
com.linkwechat.wecom.domain.WePosterSubassembly
;
import
com.linkwechat.wecom.mapper.WePosterMapper
;
import
com.linkwechat.wecom.service.IWeCategoryService
;
import
com.linkwechat.wecom.service.IWePosterFontService
;
import
com.linkwechat.wecom.service.IWePosterService
;
import
com.linkwechat.wecom.service.IWePosterSubassemblyService
;
...
...
@@ -54,6 +56,9 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
@Resource
private
ServerConfig
serverConfig
;
@Resource
private
IWeCategoryService
weCategoryService
;
/**
* 查询一条
...
...
@@ -86,8 +91,10 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
});
}
}
}
/*if(poster.getCategoryId() != null){
weCategoryService.findWeCategoryById(poster.getId());
}*/
return
poster
;
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeSensitiveServiceImpl.java
View file @
46a8c3a
...
...
@@ -22,6 +22,8 @@ import com.linkwechat.wecom.service.IWeUserService;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.elasticsearch.common.xcontent.XContentBuilder
;
import
org.elasticsearch.common.xcontent.XContentFactory
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
...
...
@@ -30,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -165,6 +166,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
@Override
public
void
hitSensitive
(
List
<
JSONObject
>
entityList
)
{
log
.
info
(
"执行敏感词命中过滤,time=[{}]"
,
System
.
currentTimeMillis
());
//获取所有的敏感词规则
List
<
WeSensitive
>
allSensitiveRules
=
weSensitiveMapper
.
selectWeSensitiveList
(
new
WeSensitive
());
//根据规则过滤命中
...
...
@@ -175,18 +177,14 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
List
<
String
>
users
=
getScopeUsers
(
weSensitive
.
getAuditUserScope
());
jsonList
.
addAll
(
hitSensitiveInES
(
patternWords
,
users
));
//将命中结果插入es
try
{
addHitSensitiveList
(
jsonList
,
weSensitive
);
}
catch
(
IOException
e
)
{
log
.
warn
(
"添加敏感词命中信息失败, jsonList={}, auditUserId={}, exception={}"
,
jsonList
,
weSensitive
.
getAuditUserId
(),
ExceptionUtils
.
getStackTrace
(
e
));
}
addHitSensitiveList
(
jsonList
,
weSensitive
);
});
}
}
@Override
public
PageInfo
<
JSONObject
>
getHitSensitiveList
(
WeSensitiveHitQuery
weSensitiveHitQuery
)
{
elasticSearch
.
createIndex2
(
WeConstans
.
WECOM_SENSITIVE_HIT_INDEX
,
getSensitiveHitMapping
());
List
<
String
>
userIds
=
Lists
.
newArrayList
();
if
(
weSensitiveHitQuery
.
getScopeType
().
equals
(
WeConstans
.
USE_SCOP_BUSINESSID_TYPE_USER
))
{
userIds
.
add
(
weSensitiveHitQuery
.
getAuditScopeId
());
...
...
@@ -218,9 +216,8 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
return
elasticSearch
.
searchPage
(
WeConstans
.
WECOM_SENSITIVE_HIT_INDEX
,
builder
,
pageNum
,
pageSize
,
JSONObject
.
class
);
}
private
void
addHitSensitiveList
(
List
<
JSONObject
>
json
,
WeSensitive
weSensitive
)
throws
IOException
{
//创建索引
elasticSearch
.
createIndex2
(
WeConstans
.
WECOM_SENSITIVE_HIT_INDEX
,
elasticSearch
.
getFinanceMapping
());
private
void
addHitSensitiveList
(
List
<
JSONObject
>
json
,
WeSensitive
weSensitive
)
{
elasticSearch
.
createIndex2
(
WeConstans
.
WECOM_SENSITIVE_HIT_INDEX
,
getSensitiveHitMapping
());
if
(
weSensitive
.
getAlertFlag
().
equals
(
1
))
{
//针对每一条命中信息发送消息通知给相应的审计人 TODO
}
...
...
@@ -270,4 +267,43 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
builder
.
query
(
searchBuilder
);
return
elasticSearch
.
search
(
WeConstans
.
WECOM_FINANCE_INDEX
,
builder
,
JSONObject
.
class
);
}
private
XContentBuilder
getSensitiveHitMapping
()
{
try
{
//创建索引
XContentBuilder
mapping
=
XContentFactory
.
jsonBuilder
()
.
startObject
()
.
startObject
(
"properties"
)
.
startObject
(
"msgid"
)
.
field
(
"type"
,
"keyword"
)
.
endObject
()
.
startObject
(
"seq"
)
.
field
(
"type"
,
"long"
)
.
endObject
()
.
startObject
(
"action"
)
.
field
(
"type"
,
"keyword"
)
.
endObject
()
.
startObject
(
"from"
)
.
field
(
"type"
,
"keyword"
)
.
endObject
()
.
startObject
(
"roomid"
)
.
field
(
"type"
,
"keyword"
)
.
endObject
()
.
startObject
(
"msgtime"
)
.
field
(
"type"
,
"long"
)
.
endObject
()
.
startObject
(
"msgtype"
)
.
field
(
"type"
,
"keyword"
)
.
endObject
()
.
startObject
(
"alerted"
)
.
field
(
"type"
,
"keyword"
)
.
endObject
()
.
endObject
()
.
endObject
();
return
mapping
;
}
catch
(
Exception
e
)
{
log
.
warn
(
"create sensitive-hit mapping failed, exception={}"
,
ExceptionUtils
.
getStackTrace
(
e
));
}
return
null
;
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment