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
7160b127
Commit
7160b127
authored
Oct 08, 2021
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor:+=改为stringbuffer
parent
d07c0835
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
CheckQywxSettingApiServiceImpl.java
...vice/service/out/impl/CheckQywxSettingApiServiceImpl.java
+11
-9
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/CheckQywxSettingApiServiceImpl.java
View file @
7160b127
...
...
@@ -19,7 +19,9 @@ import org.slf4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
@@ -160,12 +162,12 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
dingMap
.
put
(
"msgtype"
,
"markdown"
);
dingMap
.
put
(
"markdown"
,
markdownMap
);
String
text
=
""
;
String
Buffer
text
=
new
StringBuffer
()
;
String
dingUrl
=
ALERT_URL
;
AlertTypeEnum
anEnum
=
AlertTypeEnum
.
getEnum
(
messageDTO
.
getAlertType
());
if
(
anEnum
!=
null
)
{
markdownMap
.
put
(
"title"
,
anEnum
.
getName
()
+
"-"
+
messageDTO
.
getAlertTitle
());
text
+=
"标题:"
+
anEnum
.
getName
()
+
"-"
+
messageDTO
.
getAlertTitle
()
+
"\n\r"
;
text
.
append
(
"标题:"
).
append
(
anEnum
.
getName
()).
append
(
"-"
).
append
(
messageDTO
.
getAlertTitle
()).
append
(
"\n\r"
)
;
if
(
anEnum
.
getDingUrl
()
!=
null
)
{
dingUrl
=
anEnum
.
getDingUrl
();
}
...
...
@@ -174,18 +176,18 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
}
}
else
{
markdownMap
.
put
(
"title"
,
messageDTO
.
getAlertTitle
());
text
+=
"标题:"
+
messageDTO
.
getAlertTitle
()
+
"\n\r"
;
text
.
append
(
"标题:"
).
append
(
messageDTO
.
getAlertTitle
()).
append
(
"\n\r"
)
;
}
//企业信息
if
(
StringUtils
.
isNotBlank
(
messageDTO
.
getWxEnterpriseId
()))
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
messageDTO
.
getWxEnterpriseId
());
text
+=
"企业:"
+
wxEnterpriseDTO
.
getCorpName
()
+
"\n\r"
;
text
.
append
(
"企业:"
).
append
(
wxEnterpriseDTO
.
getCorpName
()).
append
(
"\n\r"
)
;
}
// 商户信息
if
(
StringUtils
.
isNotBlank
(
messageDTO
.
getEnterpriseId
()))
{
EnterpriseDTO
enterpriseDTO
=
enterpriseService
.
getEnterpriseById
(
messageDTO
.
getEnterpriseId
());
text
+=
"商户:"
+
enterpriseDTO
.
getEnterpriseName
()
+
"("
+
enterpriseDTO
.
getBrandName
()
+
")\n\r"
;
text
.
append
(
"商户:"
).
append
(
enterpriseDTO
.
getEnterpriseName
()).
append
(
"("
).
append
(
enterpriseDTO
.
getBrandName
()).
append
(
")\n\r"
)
;
}
Map
<
String
,
Object
>
contentMap
=
messageDTO
.
getContentMap
();
...
...
@@ -193,14 +195,14 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
Set
<
String
>
keySet
=
contentMap
.
keySet
();
for
(
String
k
:
keySet
)
{
Object
o
=
contentMap
.
get
(
k
);
text
+=
k
+
":"
+
o
+
"\n\r"
;
text
.
append
(
k
).
append
(
":"
).
append
(
o
).
append
(
"\n\r"
)
;
}
}
if
(
StringUtils
.
isNotBlank
(
messageDTO
.
getTraceId
()))
{
String
traceUrl
=
"http://10.105.8.172:8780/damo-stats/mongodb/getLogMessagesView?trace_id="
+
messageDTO
.
getTraceId
();
text
+=
"链路:["
+
messageDTO
.
getTraceId
()
+
"]("
+
traceUrl
+
")"
;
text
.
append
(
"链路:["
).
append
(
messageDTO
.
getTraceId
()).
append
(
"]("
).
append
(
traceUrl
).
append
(
")"
)
;
}
markdownMap
.
put
(
"text"
,
text
);
markdownMap
.
put
(
"text"
,
text
.
toString
()
);
String
post
=
HttpUtil
.
post
(
dingUrl
,
JSONObject
.
toJSONString
(
dingMap
));
logger
.
info
(
"alert:{}"
,
post
);
...
...
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