Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
5c4ab7ba
Commit
5c4ab7ba
authored
Jun 17, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:dingding告警修改
parent
a9db0e32
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
32 deletions
+20
-32
CheckQywxSettingApiServiceImpl.java
...vice/service/out/impl/CheckQywxSettingApiServiceImpl.java
+19
-12
QywxTagApiServiceImpl.java
...anage/service/service/out/impl/QywxTagApiServiceImpl.java
+1
-20
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/CheckQywxSettingApiServiceImpl.java
View file @
5c4ab7ba
...
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.out.impl;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
...
...
@@ -9,6 +10,7 @@ import com.gic.haoban.manage.api.dto.*;
import
com.gic.haoban.manage.api.enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -109,23 +111,28 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
RBucket
<
Object
>
bucket
=
RedisUtil
.
getRedisClient
().
getBucket
(
key
);
boolean
b
=
bucket
.
trySet
(
1
,
2L
,
TimeUnit
.
HOURS
);
if
(!
b
)
{
logger
.
info
(
"同一个企业加好友2小时内重复无需提醒"
);
return
;
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
ProviderLocalTag
providerLocalTag
=
ProviderLocalTag
.
tag
.
get
();
String
traceId
=
providerLocalTag
.
traceId
;
String
traceUrl
=
"http://10.105.8.172:8780/damo-stats/mongodb/getLogMessagesView?trace_id="
+
traceId
;
String
title
=
wxEnterpriseDTO
.
getCorpName
()
+
": "
+
titleSub
;
AlertMessageDTO
messageDTO
=
new
AlertMessageDTO
();
messageDTO
.
setAlertTitle
(
titleSub
);
messageDTO
.
setEnterpriseId
(
dto
.
getEnterpriseId
());
messageDTO
.
setAlertType
(
AlertTypeEnum
.
QYWX_TAG_SYNC
.
getType
());
messageDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
link
=
new
HashMap
<>();
map
.
put
(
"msgtype"
,
"link"
);
link
.
put
(
"title"
,
title
);
link
.
put
(
"text"
,
JSONObject
.
toJSONString
(
dto
));
link
.
put
(
"messageUrl"
,
traceUrl
);
map
.
put
(
"link"
,
link
);
String
post
=
HttpUtil
.
post
(
ALERT_URL
,
JSONObject
.
toJSONString
(
map
));
logger
.
info
(
"alert:{}"
,
post
);
map
.
put
(
"员工userid"
,
dto
.
getWxUserId
());
map
.
put
(
"企业id"
,
dto
.
getEnterpriseId
());
messageDTO
.
setContentMap
(
map
);
messageDTO
.
setTraceId
(
traceId
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendMessage
(
"haobanAlertMq"
,
JSONObject
.
toJSONString
(
messageDTO
));
}
catch
(
Exception
e
)
{
logger
.
info
(
"异常:{}"
,
e
.
getMessage
(),
e
);
}
}
@Override
...
...
@@ -203,7 +210,7 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
}
markdownMap
.
put
(
"text"
,
text
.
toString
());
String
post
=
HttpUtil
.
post
(
dingUrl
,
JSONObject
.
toJSONString
(
dingMap
));
logger
.
info
(
"alert:{}"
,
post
);
logger
.
info
(
"
dingding推送
alert:{}"
,
post
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/QywxTagApiServiceImpl.java
View file @
5c4ab7ba
...
...
@@ -6,13 +6,11 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.haoban.app.customer.enums.QywxTaskStatusEnum
;
import
com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.enums.QywxTagRelationSyncFlagEnum
;
import
com.gic.haoban.manage.api.enums.QywxTagRelationTypeEnum
;
import
com.gic.haoban.manage.api.service.QywxTagApiService
;
...
...
@@ -787,10 +785,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override
public
void
checkQywxSync
(
String
params
)
{
List
<
TabHaobanWxEnterprise
>
wxEnterprises
=
wxEnterpriseService
.
listAll
();
ProviderLocalTag
providerLocalTag
=
ProviderLocalTag
.
tag
.
get
();
String
traceIdMid
=
providerLocalTag
.
traceId
;
wxEnterprises
.
forEach
(
wxEnterprise
->
{
String
traceId
=
providerLocalTag
.
traceId
=
traceIdMid
+
"_"
+
wxEnterprise
.
getWxEnterpriseId
();
logger
.
info
(
"企业:{}"
,
wxEnterprise
.
getWxEnterpriseId
());
try
{
List
<
TabQywxTagRelation
>
tagRelations
=
qywxTagService
.
listAllQywxRelation
(
wxEnterprise
.
getWxEnterpriseId
());
...
...
@@ -804,21 +799,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
for
(
TabQywxTagRelation
qywxTagRelation
:
qywxTagRelations
)
{
Map
<
String
,
Object
>
map
=
checkQywxSyncByQywxTag
(
qywxTagRelation
,
wxEnterprise
,
pojo
);
if
(
MapUtils
.
isNotEmpty
(
map
))
{
AlertMessageDTO
messageDTO
=
new
AlertMessageDTO
();
messageDTO
.
setAlertTitle
(
"企微与好办同步标签不相同"
);
messageDTO
.
setEnterpriseId
(
qywxTagRelation
.
getEnterpriseId
());
messageDTO
.
setAlertType
(
AlertTypeEnum
.
QYWX_TAG_SYNC
.
getType
());
messageDTO
.
setWxEnterpriseId
(
wxEnterprise
.
getWxEnterpriseId
());
messageDTO
.
setContentMap
(
map
);
messageDTO
.
setTraceId
(
traceId
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendMessage
(
"haobanAlertMq"
,
JSONObject
.
toJSONString
(
messageDTO
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
info
(
"异常:{}"
,
e
);
}
logger
.
error
(
"企微与好办同步标签不相同:{}"
,
JSON
.
toJSONString
(
map
));
}
}
}
catch
(
Exception
e
)
{
...
...
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